Arwork editor #2

Merged
morgane merged 10 commits from feature/artwork-editor into main 2026-10-04 10:17:21 +02:00
Owner
No description provided.
Minis get per-side art edits (art.recto / art.verso). A back without its own
image follows the front's. The Frame step rotates, crops and flips the art
after background removal. A head line makes Resize scale the art so the
height from the head to the ground matches the mini's height.
useNoBgVersion becomes art.<side>.removeBackground. Changing a side's image
clears its framing. Minis without edits keep the same chain and cache.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Modals get a `fullscreen` option (every device) and `beforeClose`, asked
  before the user dismisses one (close button, Escape, back button).
- The editor opens from "Edit the artwork" under the mini preview. It shows
  the image the Frame step gets (after background removal), rotated and
  flipped as printed, with pan, zoom (wheel, pinch, keys) and fit.
- Edits go to a draft with undo/redo; Done saves it, Cancel asks before
  discarding changes.
- An "As printed" card runs the real chain on the draft, and the status line
  shows the printed size and the effective DPI, warning under 150.
- Tools plug in through ArtTool (overlay + panel); none yet.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Frame: crop box with 8 handles (drag inside to move, Shift or "Keep
proportions" for the ratio), arrow keys, rotate by quarter turns, straighten
(-45° to 45°), flip, and the crop in numbers. Rotating keeps the crop and the
head line on the same part of the art; a quarter turn drops the head line.
A frame that changes nothing is removed, so the chain skips it.

Height: a head line to drag (or move with the arrow keys) down to the top of
the head; the ground is the bottom of the frame. The panel tells how much art
sticks out above the line.

Lines are white over a dark halo, readable on any art.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Height tool gets a ground line beside the head line: the mini's height
is measured between them. For art keeping its background, the scene below
the feet stays on the card, above the fold. Both lines turn with the image,
and are dropped when a new frame leaves them out.

Fix: the "As printed" preview and card size only refreshed on undo, the
draft mini being a raw copy that did not track changes inside it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Resize now runs before Trim and measures the art from its head line to its
ground line, an unset line being the top or bottom of the art's opaque
pixels (when trimming). Before, an unset line was the frame's edge, so a
cut-out character with one line set printed too short: the transparent rows
trimmed below its feet were counted in its height. Every chain's hash
changes: cached images are generated again once.

- The editor draws unset lines at the art's top and bottom, measured on a
  small copy of the image, and its numbers and DPI use them.
- The mini preview's figure guide sits at the head line, measured from the
  ground, with a ground guide when the art goes below it.
- Size compare stands minis on their ground line, the scene below clipped.
- Mini cards get a low resolution badge (under 150 DPI).
- The editor also opens with E (one mini selected) and from the back image.
- Line labels sit on a dark pill, readable over transparency.
- CLAUDE.md: chain order, art edits, artwork editor tools.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Running Resize before Trim measured the art correctly, but scaling first left
a faint blurred fringe above and below the art, which Trim kept: minis came
out 2 px taller (0.17 mm at 300 DPI).

Resize now finds the art's bounds, takes the height between the lines (the
art's top and bottom when unset), and draws only the art, scaled, in one go.
That is what Trim then Resize did, so minis without lines are exact again,
and the lines need no offset carried through the cache. The Trim step is
removed; its bounds measure moves to bounds.ts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Trim
- The global setting becomes `trim: { enabled, tolerance }`, and a mini can
  override it (`trimOf`), from "more options" in its Image section.
- A tolerance above 0 cuts a border of one plain color too (the corners', when
  they agree), e.g. the white around a scanned drawing. Resize and the
  editor's art measure share the same test.

Sizing modes (`sizeBy`)
- Height, as before. Width: the art's printed width. Card: a fixed size,
  margins included; the art is fitted in the room left by the margins and
  outline, then the margins grow to the card size (centered across, feet on
  the bottom margin).
- Each mode keeps its own size. Switching starts from the mini's current
  art or card size, so nothing jumps.
- Size categories, the figure guide and the editor's Height tool only apply
  to minis sized by height. Size compare labels the others with their
  printed size, and fits card art as printed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A Cutout step after the background removal applies, in pixels of the
source image:
- the removal of a plain color, picked on the image, with a tolerance, only
  where it touches the picked spot or everywhere;
- brush strokes erasing the art, or restoring the original image (the
  step loads it) where the removal went too far;
- edge cleanup: shrink then soften the edge, to drop halos.

In the editor, the Cutout tool paints with a round brush sized on screen,
shows what is removed faded, and keeps the automatic removal switch. The
image is now drawn on a canvas: a stroke shows as it is painted, then the
whole cutout runs, through the same function as the step. Strokes are
simplified once painted, to keep minis and backups small. Picking a
transparent pixel does nothing, and the brush starts as Erase each time.

Processed images left by draft previews are cleaned when the editor closes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each click with "Pick a color" now removes one more area instead of
replacing the previous pick. Each pick keeps its color, tolerance and
"touching the picked spot" choice (a new one starts like the last), can be
changed or removed on its own, and is numbered on the image as in the panel.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Panels use the side panel's section headings (Brush, Plain colors, Edge;
  Turn, Crop) instead of small gray titles.
- What the cutout removed shows tinted red: a removed white background was
  invisible, faded over the transparency checkerboard.
- Picked colors are rows with dividers instead of boxes, one explanation for
  all of them, and a shorter "Only the area around its spot".
- The automatic background removal explains itself under its checkbox
  instead of an info icon wrapping on its own line.
- "As printed" stays at the bottom of the side panel on larger screens, in
  view while the settings scroll, without covering the image.
- The zoom level shows between the zoom buttons; clicking it fits the image.
- [ and ] change the brush size.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
morgane deleted branch feature/artwork-editor 2026-10-04 10:17:21 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
morgane/2dminis!2
No description provided.