Merge pull request #8092 from dotCooCoo/fix/issue-8047-group-marquee

Group Selection: a marquee selects the objects it touches, whole
This commit is contained in:
BFlat
2026-11-18 03:20:42 +07:00
committed by GitHub
6 changed files with 65 additions and 22 deletions
+2 -2
View File
@@ -393,10 +393,10 @@ fn a_group_selection_marquee_leaves_out_a_drop_shadow() {
run(&mut s, "select.none", json!({}));
let sel = marquee(&mut s, "groupSelection", (85.0, 40.0), (95.0, 60.0));
assert!(sel.objects.is_empty() && sel.anchors.is_empty(), "{sel:?}");
// Over the shadow and B's upper left corner: that anchor of B.
// Over the shadow and B's upper left corner: B whole, and not A (#8047).
let sel = marquee(&mut s, "groupSelection", (90.0, 5.0), (105.0, 30.0));
assert_eq!(sel.objects, [b]);
assert_eq!(picked_points(&s, b), [Point::new(100.0, 20.0)]);
assert!(sel.partial(b).is_none(), "{sel:?}");
// With E, a marquee around B that crosses A's shadow selects B whole, and not A.
run(&mut s, "select.none", json!({}));
let v = ViewInfo::default();
+4 -2
View File
@@ -1255,9 +1255,11 @@ fn direct_selection_shift_marquee_toggles_anchors() {
let st = s.doc().unwrap();
assert_eq!(st.selection.objects, vec![a]);
assert_eq!(st.selection.partial(a), None);
// Group Selection's marquee toggles the same way.
// Group Selection's marquee toggles the paths it touches whole: a leaves, b joins (#8047).
gesture(&mut s, "groupSelection", &top, shift);
assert_eq!(s.doc().unwrap().selection.partial(a).map(|p| p.len()), Some(2));
let st = s.doc().unwrap();
assert_eq!(st.selection.objects, vec![b]);
assert_eq!(st.selection.partial(b), None);
}
/// The Lasso: Shift adds anchors, Alt takes them away, and neither drops the rest of the