Repository navigation
Draw: Lasso Select, Add Pen, Ink to Shape and Ink Replay (#395) - #408
Merged
Merged
Conversation
vangel76
force-pushed
the
feat/395-draw-tools
branch
from
October 11, 2026 06:36
9c4c460 to
024d4ab
Compare
Contributor
Author
|
Rebased onto main after #474. Merge fix: |
vangel76
force-pushed
the
feat/395-draw-tools
branch
2 times, most recently
from
October 11, 2026 17:58
a9d6792 to
0a634a8
Compare
- draw.lasso: with no points picks up the lasso; with a loop on a page it selects the strokes mostly inside it and drawings whose centre is inside. draw.lassoMove / draw.lassoColor / draw.lassoDelete move, recolour and delete the selection (one undo step each); it lasts until the document changes otherwise. In the app: drag a loop, drag the selection to move it, Delete deletes, Esc lets go, the Color menu recolours it. - draw.addPen / draw.removePen: a pen gallery (kind, colour, width; capped, validated) shown after the built-in pens, kept in ui.json; damaged entries are dropped on reading. Right-click a gallery pen to remove it. - draw.inkToShape: toggles Ink to Shape (pen and pencil strokes that look like a line, rectangle/square, ellipse/circle, triangle or polygon of up to eight corners become that shape, in the same undo step); with ink lasso-selected it converts the selection (draw.convertInk). Our own recogniser (cmd/ink_shape.rs): chord test for lines, closure test, ellipse RMS fit, closed RDP simplification with corner merging. - draw.replay: Ink Replay plays the strokes back in drawing order with a Rewind / Play-Pause / Forward / Close bar; pages are drawn without ink meanwhile. Each new stroke records its drawing order (Freeform::order), written to DOCX in the drawing name (`Ink Pen 3 storytold#12`) and read back. Catalog 402/434 -> 406/434 (93.5%). New strings in all nine catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vangel76
force-pushed
the
feat/395-draw-tools
branch
from
October 11, 2026 19:34
0a634a8 to
81ade96
Compare
# Conflicts: # ROADMAP.md # docs/parity-checklist.md # docs/target-app-parity.md
Member
|
Thanks for the contribution, @vangel76! This is now merged into main. If you haven't already, please come join us on Discord: https://discord.gg/artcraft |
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.
Fixes #395
What
Lasso Select (
draw.lasso): no points picks up the lasso;{"page", "points"}selects the strokes mostly (≥60% of sampled points) inside the loop and the drawings whose centre is inside.draw.lassoMove {dx, dy},draw.lassoColor {color}anddraw.lassoDeleteact on the selection, one undo step each. The selection lasts until the document changes some other way. In the app you drag a loop and get a dashed frame around the selection. Dragging the frame moves the selection, Delete/Backspace deletes it, the Color menu recolours it, and Esc lets it go.Add Pen (
draw.addPen {kind, color, width},draw.removePen {index}): a pen gallery after the built-in pens. Pens are validated and capped at 24. The gallery is saved inui.json(inkPens), and on reading, entries that aren't pens are dropped without losing the other settings. Each gallery pen shows its kind's icon over a bar of its colour and width. Clicking a pen picks it up, and right-clicking it gives Remove Pen. When a gallery pen is in use, the Color and Thickness menus update it.Ink to Shape (
draw.inkToShape): toggles the mode, or{"value": bool}sets it. While it is on, a pen or pencil stroke that looks like a shape is replaced by that shape in the same undo step, keeping its colour and width:Rectangle)Ellipse)Other strokes stay ink. With ink lasso-selected, the button converts the selection instead (
draw.convertInk). The recogniser is our own code incrates/engine/src/cmd/ink_shape.rs:Ink Replay (
draw.replay): returns the strokes in drawing order and turns the replay on or off. While it runs, the pages are drawn without ink and the strokes are drawn again progressively in an overlay, timed by their length. A bottom bar has Rewind / Play-Pause / Forward (to the end of the current stroke) / "Stroke n of m" / Close, and Esc closes it.Freeform::order.Ink Pen 3 #12) and reads it back.New icons are drawn in code (
addPen, replay controls). New strings are in all 9 catalogs. Catalog goes from 402/434 to 406/434 (93.5%). Progress docs are updated.Tests
ink_shape: rectangle (started mid-side), square, ellipse, circle, a shaky line, a triangle and a pentagon are recognised. An open zigzag, a hook, a tap, a tiny tick, a 24-spike closed star, NaN/∞ points and a flood of points stay ink.drawtests:addPenvalidation, the gallery cap andremovePen; a saved gallery drops junk entrieshostile_params_never_paniccovers the new commands.cargo testpasses for doc, docx, engine and ui-egui.cargo clippy -D warningsis clean on those crates.cargo xtask wasm,layersandparitypass.ui_shot:Not done
w14:contentPart) and per-point timestamps aren't read, so a replay is paced by stroke length, not real time.🤖 Generated with Claude Code