mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
Fix: a path moved by its stroke or edge lands exactly on a ruler guide
Cause: with Snap to Point, the point of a moved selection that snaps to a ruler guide is the grabbed point (#1534). Away from an anchor or center that was the raw pressed spot (select.rs: `grab` fell back to `p`; direct.rs: a straight segment's `grab: p`, MoveObject's `start`). A press on a stroke or within the pick tolerance of an edge lies a few pixels beside the path, so the pressed spot landed on the guide, "align" showed, and the path stopped that far beside it: 0.096 pt at 3,891% and 0.0099 pt at 28,757% in the #3701 screenshots, visible only when zoomed in. Change: `guides::hold_on_path` finds the nearest point of the path (on a straight segment exactly on its line). `select::hold_point` uses it for a press on the stroke or outline, or within 6 px of it. The Selection tool (`State::Moving::hold`), Direct and Group Selection moves (`State::MoveObject::hold`) and Direct Selection's straight-segment drag (`grab`) snap that point. The move delta still runs from the press, so nothing jumps. A press in the middle of a fill still snaps the pressed spot, as Snap to Point is documented to. Verification: tests_prefs::a_move_held_by_a_paths_stroke_lands_the_path_on_a_ruler_guide and tests_prefs::a_straight_segment_dragged_by_direct_selection_lands_on_a_ruler_guide fail without the change (edge 0.0257 pt and anchors -0.0052 pt off the guide) and pass with it (|gap| < 1e-9 pt). A headless egui/wgpu render at 3,891% and 28,757% puts the guide, the selection outline and the centre of the 1 pt stroke band in the same pixel column. cargo xtask ci: all 10 steps passed; 9429 tests passed, 0 failed.
This commit is contained in:
committed by
bflatastic
parent
f365468684
commit
970e62f27d
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user