Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

G1: hide bounding box while dragging type-on-path brackets.

nrq6993-a11y99aa4e6a7cd6
diff --git a/crates/tools/src/pathtype.rs b/crates/tools/src/pathtype.rs
index 2b251f7ac..21fdaefc9 100644
--- a/crates/tools/src/pathtype.rs
+++ b/crates/tools/src/pathtype.rs
@@ -226,6 +226,11 @@ impl BracketDrag {
Value::Object(m)
}
+ /// The drag has left the click: the bracket is moving along the path.
+ pub fn adjusting(&self) -> bool {
+ self.began
+ }
+
pub fn finish(self) -> Vec<Action> {
if self.began { vec![Action::Commit] } else { vec![] }
}
diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs
index a4720b7f3..f373aa09c 100644
--- a/crates/tools/src/select.rs
+++ b/crates/tools/src/select.rs
@@ -424,6 +424,7 @@ impl Tool for SelectionTool {
State::Moving { began: true, .. } | State::Scaling { .. } | State::Rotating { .. } => true,
State::Corner(c) => c.adjusting(),
State::Pie(d) => d.adjusting(),
+ State::Bracket(b) => b.adjusting(),
State::Mirror(d) => d.adjusting(),
_ => false,
}
@@ -927,6 +928,22 @@ mod tests {
assert!(t.transforming());
}
+ /// A type-on-path bracket drag is a transform, so the sharp selection box hides while the span moves.
+ #[test]
+ fn a_bracket_drag_counts_as_transforming_once_it_moves() {
+ let (d, id) = crate::testutil::doc_with_path_type();
+ let mut s = Selection::default();
+ s.add(id);
+ let p = paint();
+ let cx = cx(&d, &s, &p);
+ let mut t = SelectionTool::default();
+ assert!(!t.transforming());
+ t.pointer(&cx, &ev(PointerKind::Down, 280.0, 290.0));
+ assert!(!t.transforming(), "a press is still a click");
+ t.pointer(&cx, &ev(PointerKind::Drag, 320.0, 290.0));
+ assert!(t.transforming());
+ }
+
/// #812: with Smart Guides on, hovering near an object's centre or an anchor labels it, and a
/// press there grabs the object by that point.
#[test]