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

Match corner-radius and pie-widget drags: the Selection tool reports a transforming drag so the canvas drops the sharp selection box during bracket moves.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
nrq6993-a11y
2026-10-20 02:23:33 +07:00
committed by bflatastic
co-authored by Cursor
parent 0ee6b1ac68
commit 99aa4e6a7c
2 changed files with 22 additions and 0 deletions
+5
View File
@@ -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![] }
}
+17
View File
@@ -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]