Skip to content

Draw a drawing as its picture with corner marks, as images are - #3227

Merged
max-sixty merged 4 commits into
mainfrom
agent-aa760c1635ca79169
Oct 20, 2026
Merged

max-sixty merged 4 commits into
mainfrom
agent-aa760c1635ca79169

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The comment box drew a drawing as a bordered tile: a 96×64 snapshot of the page under the ink, then two presses as tall as the drawing, Undo last stroke and Remove drawing, each behind its own divider. That made three cells and two seams for one picture. #3214 had already given every attached image the floating panel's look: the picture on its own, with a round × on its corner. Drawings stayed boxed.

Now a drawing looks like an image. It is its picture alone, with 8px corners, a ring and the --raise-1 shadow. Remove drawing is the same 18px × on its top-right corner, and Undo last stroke is a ↶ mark on its top-left. Both marks show on hover or keyboard focus, are always shown under a finger, and reach the aim floor (24px with a mouse, 44px under touch) through a ::before that paints nothing. The tile keeps its own row above the field, now because the 64px picture is taller than the header row the images use, not because of its presses. The field doesn't move (y=285 at 1280×900 on main and here).

One set of rules for the marks. response.css used to style the image's × through .lf-composer-media-remove and the drawing's presses through a second set of rules. Now one rule set covers every button in a shelf item other than its picture (.lf-composer-media-item > button:not(.lf-media-open)). Removal sits on the right by default, and .lf-composer-drawing-undo, the one class this adds in input.js, puts undo on the left. The ring, radius and shadow apply to every picture. Images keep their own height rule. A drawing keeps its fixed size, plus a paper background so the page behind the box doesn't show through where the canvas letterboxes.

Marks stand over the carry band. Under touch, the box's carry band (.lf-surface-grip, 12px outside the field's edge) covered the top 11px of the undo mark's 44px reach. A press there grabbed the box instead of undoing. The marks now take z-index: 1, so the whole reach belongs to the mark. This also covers an image's × wherever it meets the band.

The undo mark shows in Draw mode and out of it. Outside Draw mode it is the only touch route to undo. In Draw mode, the panel row's Undo stroke and z/⌘Z also undo, but they take back the latest stroke wherever it went (undoTarget in drawing.js), while the mark takes back this draft's own. A mark that came and went with the mode would also move under the user. The response.css header records this choice.

Tests and tooling. test_render_drawing_context checked that each drawing button was at least 44px wide under touch. It now checks that a press 21px from each mark's centre, diagonally, reaches the mark. leaf-dev stills gains drawing-comment-hover, -hover-dark, -keyboard and -touch states, and drawing-photo-comment now crops to the comment box rather than the shelf, whose size this change alters.

I probed in Chromium and Firefox against main: rest, hover, keyboard focus on Undo, a press 2px outside the painted mark (undoes, then focus returns to the field), touch at 390px, and dark mode. Firefox can't drive a drawing under touch emulation on main either, so I checked touch in Chromium. Tests run: the drawing context test, six drawing tests that press undo or removal, the shelf tests from #3214 and #3220 (16 passed), pnpm run test:runtime, and check:browser.

This was written by Claude Code on behalf of max-sixty

@max-sixty
max-sixty merged commit aca4485 into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-aa760c1635ca79169 branch October 20, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants