Skip to content

Part of #451: guides dragged out of the rulers snap, artboard guides - #454

Merged
bflatastic merged 1 commit into
mainfrom
fix/issue-451
Oct 8, 2026
Merged

bflatastic merged 1 commit into
mainfrom
fix/issue-451

Conversation

@bflatastic

Copy link
Copy Markdown
Member

Guides dragged out of the rulers now snap like moved guides, and guides can belong to one artboard (parts a–c of #451; part d is still open).

  • Snapping (a, b): A guide dragged out of a ruler used to snap only with Shift, to the ruler's ticks. The drag now goes through the engine: Session::ruler_guide drives a NewGuide that previews guide.add, and the result is one undo step. With Smart Guides on, it lands on the edges, centres (which covers the sides' midpoints) and anchors of the art, and on the artboards' edges and centres, with a label. With Smart Guides off, View › Snap to Point pulls new and moved guides onto anchors. Shared GuideSnap in rulerguide.rs, Targets::anchors_only.
  • Moving art (b): with Smart Guides on, art moved with the Selection tool already snapped flush to artboard edges and centres on main. A new test now covers it.
  • Artboard guides (c): Guide.artboard holds an artboard id. The field is written only when set, so canvas guides save as before and older files open unchanged. guide.add {artboard?: index} makes one and guide.list reports artboard. A guide dragged out of a ruler while the Artboard tool is active belongs to the active artboard (Illustrator's rule). An artboard guide is drawn, picked and snapped to (Snap to Point) only across its artboard. It moves with the artboard (artboard.move, a pure move in artboard.setProps, artboard.rearrange), is copied with it (artboard.duplicate, Alt-drag copy) and is deleted with it (artboard.delete, artboard.cut); the guide selection stays in step through Document::retain_guides. SVG/PDF export is unchanged, since ruler guides aren't exported.
  • Not done (d): ruler guides as Layers rows with their own lock and hide. Ruler guides aren't layer nodes, and making them nodes would break their non-printing, not-selectable-as-art semantics. Lock Guides already locks them all (since Fix #414: select, move and delete ruler guides with the selection tools #415), and Make Guides paths are already <Guide> rows in Layers. This is listed in the ROADMAP parity row.
  • Docs: docs/mcp.md (Ruler guides); ROADMAP (Last updated, Drawing aids, parity row 80→82 %).

Parity: Smart Guides' alignment guides follow "the center and edges of geometric objects, artboard, and bleeds" (Smart Guides options). To keep a guide to one artboard, "select the Artboard tool and drag the guides onto the artboard" (Adobe Learn: use ruler guides, community); such a guide moves with its artboard.

Checks

  • Rebased on 5f9d280892ca38a06332a36deed711152d75f6f1.
  • New tests fail on main. canvas::tests::guides_from_the_rulers_snap_and_artboard_guides_span_their_artboard was checked against the old ruler code and got [(true, 201.7), (false, 298.3)] instead of [(true, 200.0), (false, 300.0)]. Also new: rulerguide::tests::{a_new_guide_snaps_to_the_art_and_the_artboard, a_new_guide_is_made_on_release_over_the_canvas_only, with_smart_guides_off_snap_to_point_pulls_guides_onto_anchors, an_artboard_guide_is_picked_and_snapped_to_across_its_artboard_only}, tests_menucmds::{artboard_guides_go_with_their_artboard, guides_dragged_out_of_a_ruler_snap_and_take_the_artboard_tool_s_artboard, moved_art_snaps_to_the_artboard_edges_and_centre}, native_v3::artboard_guides_round_trip_and_canvas_guides_save_as_before.
  • cargo fmt --all; cargo clippy -p vectorcraft-{doc,tools,engine,ui-egui,format} --all-targets -- -D warnings clean; cargo test on those crates: 2498 passed, 0 failed (includes the i18n message-catalog check: no new strings).
  • cargo xtask layers, cargo xtask brands and cargo xtask wasm pass; cargo check for x86_64-unknown-linux-gnu and aarch64-apple-darwin passes.
  • MCP stdio smoke (vectorcraft-cli mcp) passed. guide.add {artboard: 1} followed by artboard.move {dx: 25} gave guide.list → pos 625 with artboard: 1. A bad artboard returns "no such artboard". artboard.delete takes its guide and leaves the canvas guide.

🤖 Generated with Claude Code

Guides dragged out of a ruler did not snap at all (only Shift to the ruler's
ticks): they now go through the engine (`Session::ruler_guide`, a
`NewGuide` previewing `guide.add`, one undo step) and snap as a moved guide
does: with Smart Guides to the edges, centres (so the sides' midpoints) and
anchors of the art and of the artboards, labelled; with Smart Guides off,
View > Snap to Point pulls new and moved guides onto anchors. Moving art
with the Selection tool already snapped flush to artboard edges and centres
with Smart Guides on; a test now covers it.

Artboard guides: `Guide.artboard` holds an artboard id (written only when
set, so canvas guides save as before and older files open unchanged).
`guide.add {artboard}` makes one, `guide.list` reports it; a guide dragged
out of a ruler with the Artboard tool belongs to the active artboard. It is
drawn, picked and snapped to across its artboard only, moves with it
(`artboard.move`, a pure move in `artboard.setProps`, `artboard.rearrange`),
is copied with it (`artboard.duplicate`, Alt-drag copy) and deleted with it
(`artboard.delete`, the guide selection kept in step).

Guides as Layers rows with their own lock and hide (part d) stay open: ruler
guides are not layer nodes; Lock Guides locks them all, and Make Guides
paths are Layers rows already. Listed in the ROADMAP parity row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bflatastic
bflatastic merged commit d8e7907 into main Oct 8, 2026
@bflatastic

Copy link
Copy Markdown
Member Author

Full cargo xtask ci passed on the integrated stack; merging.

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.

1 participant