mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-11 02:19:56 -06:00
Selection: Cmd/Ctrl over a centre point selects behind, so the arrow stays plain
The press with Cmd/Ctrl held selects the object behind rather than taking the centre point; the pointer now agrees.
This commit is contained in:
committed by
bflatastic
parent
6d3c0fef99
commit
dd160dc768
@@ -1133,8 +1133,9 @@ impl Tool for SelectionTool {
|
||||
}
|
||||
// A selected object's centre point (Show Center): a press there moves it, where the art
|
||||
// may not reach. The box's handles and the ruler guides take a press before it, so they
|
||||
// take the pointer too (on a thin box the centre lies within a handle's reach).
|
||||
if near_selected && hit_center(cx, p, cx.point_tol()).is_some() {
|
||||
// take the pointer too (on a thin box the centre lies within a handle's reach), and with
|
||||
// Cmd/Ctrl held the press selects the object behind instead.
|
||||
if near_selected && !m.cmd && hit_center(cx, p, cx.point_tol()).is_some() {
|
||||
return Cursor::Move;
|
||||
}
|
||||
// View → Snap to Point: over an anchor a press would grab the object by, the arrow turns
|
||||
|
||||
@@ -2153,6 +2153,8 @@ fn a_press_on_the_centre_point_moves_an_unfilled_shape() {
|
||||
let centre = Point::new(150.0, 150.0);
|
||||
let mut t = SelectionTool::default();
|
||||
assert_eq!(t.cursor(&c, centre, Mods::default()), Cursor::Move);
|
||||
// Cmd/Ctrl selects the object behind, not the centre point, so the pointer says neither.
|
||||
assert_ne!(t.cursor(&c, centre, Mods { cmd: true, ..Mods::default() }), Cursor::Move);
|
||||
assert!(t.pointer(&c, &ev(PointerKind::Down, centre.x, centre.y)).is_empty());
|
||||
let a = t.pointer(&c, &ev(PointerKind::Drag, 170.0, 160.0));
|
||||
assert_eq!(a.first(), Some(&Action::Begin("Move".into())), "{a:?}");
|
||||
|
||||
Reference in New Issue
Block a user