Paint: copy previous should skip empty frames

Copy previous looked for the nearest earlier ENABLED frame, and every frame is
enabled until you thin the strip out - so it resolved to f-1, which has nothing
on it, and the button appeared to only ever copy the immediate sibling while
reporting "nothing to copy".

It now takes the nearest earlier enabled frame that actually carries a drawing.
That behaves identically before and after you curate the strip, which is the
point: the rhythm of the drawings should not depend on whether you have got
round to deleting frames yet.

Cels stay tied to the keep-set. They are plate drawings and they hold until the
next enabled frame, as originally specified - an earlier version of this commit
gave them their own independent set, which is wrong for what they are.

Frames carrying a drawing are now marked in the strip, because "copy previous"
reaching back to a frame you cannot see is not much better than it reaching to
the wrong one.

Also fixes stale paint labels: onChange refreshed the strip and the panes but
not the paint header, so the drawn-frames readout lagged a copy behind. Split
the text update out of drawPaint so it can run from inside commit() without
re-rendering the canvas underneath itself.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-09-24 19:25:15 -04:00
parent 9d516a03ac
commit b68deb838a
3 changed files with 48 additions and 15 deletions

View file

@ -42,6 +42,8 @@
.fr.drop { border-color:#2a2f3e; }
.fr.drop canvas { opacity:.26; filter:grayscale(1); }
.fr.cur { border-color:var(--accent); }
.fr.cel::before { content:'▣'; position:absolute; left:3px; top:1px; color:#c084fc;
font-size:10px; text-shadow:0 0 2px #000; }
.fr.keep::after { content:'●'; position:absolute; right:3px; top:1px; color:var(--ok); font-size:10px; }
#sheet { display:flex; flex-wrap:wrap; gap:10px; }
@ -259,6 +261,7 @@
<div id="paintlayers"></div>
</div>
<div class="legend" id="paintinfo"></div>
<div class="legend" id="paintcels"></div>
<div class="legend">
<b>pen</b> click to place vertices · click the green box on the first one, or
<kbd>Enter</kbd> / double-click, to close · <kbd>Esc</kbd> cancels ·
@ -266,6 +269,9 @@
<b>edit</b> click a shape to select · drag a vertex or the shape itself ·
<kbd>Shift</kbd>-click an edge inserts a vertex · <kbd>Alt</kbd>-click a vertex
removes it · <kbd>Del</kbd> deletes the layer<br>
<b>Copy previous</b> takes the last enabled frame that actually has a drawing
— skipping empty ones, so it behaves the same before and after you thin the
strip out. Frames carrying a drawing are marked <b style="color:#c084fc">▣</b>.<br>
<b>drag a frame</b> from the strip onto the canvas to copy its drawing, every
layer. Vertices snap to the 320×200 grid, and colours are palette indices —
you cannot pick one that is not in the ramp.