DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Direct Selection: a Shift-click on a selected point previews no move
moppeeerfed464d9da5f
diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rsindex 76a81d8f2..81589885f 100644--- a/crates/tools/src/select.rs+++ b/crates/tools/src/select.rs@@ -1167,6 +1167,9 @@ impl Tool for SelectionTool {let mut d = p - start;if d.hypot() >= cx.tol(3.0) {self.anchor_release = None;+ } else if self.anchor_release.is_some() {+ // A Shift-press on a selected point is still a click: nothing moves yet.+ return vec![];}// Shift: horizontal, vertical or at 45°.if ev.mods.shift {diff --git a/crates/tools/src/tests.rs b/crates/tools/src/tests.rsindex 10267224a..974c38ee9 100644--- a/crates/tools/src/tests.rs+++ b/crates/tools/src/tests.rs@@ -1991,7 +1991,10 @@ fn direct_selection_marquee_selects_points_of_several_frames_and_drags_them_toge// move the points.let out = t.pointer(&cx, &PointerEvent::new(PointerKind::Down, at.x, at.y).with_mods(shift));assert!(!out.iter().any(|a| matches!(a, Action::Exec(..))), "kept while it may become a drag: {out:?}");- let out = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, at.x, at.y).with_mods(shift));+ // A jiggle inside the drag tolerance moves nothing: it is still a click.+ let jiggle = t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, at.x + 1.0, at.y + 1.0).with_mods(shift));+ assert!(jiggle.is_empty(), "{jiggle:?}");+ let out = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, at.x + 1.0, at.y + 1.0).with_mods(shift));let Some(Action::Exec(cmd, p)) = out.last() else { panic!("{out:?}") };assert_eq!(cmd, "selection.set");assert_eq!(p["anchors"].as_array().map(Vec::len), Some(3), "{p}");