mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 12:17:14 -06:00
Blob Brush: a release away from the press point paints with Alt down
A release that arrives at a new position with no drag before it now counts as movement, so Alt pressed at that moment no longer switches the stroke to the Smooth tool.
This commit is contained in:
@@ -519,6 +519,8 @@ impl Tool for GestureTool {
|
||||
if !self.active {
|
||||
return vec![];
|
||||
}
|
||||
// A release away from the press point counts as movement.
|
||||
self.moved |= self.points.first().is_some_and(|start| p.distance(*start) > vectorcraft_geom::EPS);
|
||||
// Alt pressed while the pointer stood still at the press point switches the release too.
|
||||
if self.blob_alt_smooths(ev.mods) {
|
||||
self.smoothing = true;
|
||||
|
||||
@@ -409,6 +409,10 @@ fn blob_brush_alt_switches_to_the_smooth_tool() {
|
||||
assert_eq!(t.cursor(&cx, at, alt), Cursor::Smooth);
|
||||
let acts = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 50.0, 150.0).with_mods(alt));
|
||||
assert!(acts.is_empty(), "{acts:?}");
|
||||
// A release away from the press point with no drag before it paints when Alt goes down.
|
||||
t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 50.0, 150.0));
|
||||
let acts = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 150.0, 150.0).with_mods(alt));
|
||||
assert!(matches!(acts.as_slice(), [Action::Exec(c, _)] if c == "path.blob"), "{acts:?}");
|
||||
// With nothing selected an Alt drag sends nothing.
|
||||
let none = Selection::default();
|
||||
let empty = crate::testutil::cx(&d, &none, &p);
|
||||
|
||||
Reference in New Issue
Block a user