Repository navigation
Draw a drawing as its picture with corner marks, as images are - #3227
Merged
Merged
Conversation
leaf-agent
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-1shadow. 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::beforethat 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.cssused to style the image's × through.lf-composer-media-removeand 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 ininput.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 takez-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/⌘Zalso undo, but they take back the latest stroke wherever it went (undoTargetindrawing.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. Theresponse.cssheader records this choice.Tests and tooling.
test_render_drawing_contextchecked 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 stillsgainsdrawing-comment-hover,-hover-dark,-keyboardand-touchstates, anddrawing-photo-commentnow 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, andcheck:browser.