Direct Selection: Alt and Cmd/Ctrl apply while Space moves a handle

A handle drag kept the Alt and Cmd/Ctrl state it had before Space was
pressed, so pressing Alt or releasing Cmd/Ctrl during a Space translation
changed nothing until Space was released and the pointer moved. Both
modifiers are now read on every drag event. The Space translation still
keeps the accepted handle position.
This commit is contained in:
dotCooCoo
2026-11-19 06:23:27 -08:00
parent 8b289bf6bb
commit c4c1495c04
2 changed files with 23 additions and 2 deletions
@@ -145,6 +145,26 @@ fn direct_handle_cmd_mirror_holds_through_a_space_translation() {
pointer(&mut s, PointerKind::Up, next, cmd());
}
#[test]
fn direct_handle_modifiers_changed_during_a_space_translation_apply_at_once() {
let mut s = session();
let id = curve(&mut s, Point::new(50.0, 100.0));
press_handle(&mut s, Point::new(180.0, 100.0));
pointer(&mut s, PointerKind::Drag, Point::new(180.0, 160.0), cmd());
let moved = Point::new(200.0, 190.0);
pointer(&mut s, PointerKind::Drag, moved, Mods { space: true, ..cmd() });
handles(anchor(&s, id), Point::new(40.0, 70.0), moved, AnchorKind::Smooth);
// Releasing Cmd while Space is held gives the opposite handle its own length again.
pointer(&mut s, PointerKind::Drag, moved, Mods { space: true, ..Mods::default() });
let a = anchor(&s, id);
near(a.p, Point::new(120.0, 130.0));
handles(a, Point::new(80.0, 100.0), moved, AnchorKind::Smooth);
// Alt while Space is held leaves the opposite handle where the translation put it.
pointer(&mut s, PointerKind::Drag, moved, Mods { space: true, alt: true, ..cmd() });
handles(anchor(&s, id), Point::new(70.0, 130.0), moved, AnchorKind::Corner);
pointer(&mut s, PointerKind::Up, moved, Mods { alt: true, ..cmd() });
}
#[derive(Debug, PartialEq)]
struct Snapshot {
document: Value,
+3 -2
View File
@@ -1609,10 +1609,11 @@ impl DirectSelectionTool {
self.snapped = snapped(q.to_vec2(), input.to_vec2(), ev.mods.shift, &guides);
self.guides = guides;
drag.handle = q;
drag.independent = ev.mods.alt;
drag.symmetric = self.mirrors(ev);
}
}
// Alt and Cmd/Ctrl take effect on every event, while Space is held too.
drag.independent = ev.mods.alt;
drag.symmetric = self.mirrors(ev);
drag.last = p;
drag.space = ev.mods.space;
let mut params = json!({