fix: 修复 PR #1457 的选择与拖拽评审问题

- 标签在选择边界外也参与收窄,Dev Mode 单击已选图层只选它
- 区分点击命中图层与描边空白处的拖拽回退目标
- 重排圆环按按下时的修饰键判断点击,画布外松手视为拖拽结束
- 修复 clippy unnecessary_get_then_check
This commit is contained in:
Nicek
2026-10-29 09:33:55 +08:00
committed by trae-solo-agent
parent f8ddb5a0a8
commit dd93a6a2a8
7 changed files with 94 additions and 10 deletions
@@ -456,6 +456,21 @@ fn a_layer_stacked_below_the_selection_doesnt_take_a_drag_from_inside_it() {
assert_eq!(at(&s, gap), Point::new(home.x + 10.0, home.y + 10.0));
}
#[test]
fn a_click_where_nothing_is_hit_inside_a_multiple_selection_keeps_it() {
let mut s = Session::new();
let a = rect(&mut s, 100.0, 300.0, None);
let b = rect(&mut s, 220.0, 300.0, None);
for i in [a, b] {
ex(&mut s, "node.set", json!({"ids": [i], "props": {"fills": [], "strokes": ["#000000"], "strokeWeight": 1}}));
}
ex(&mut s, "select.set", json!({"ids": [a, b]}));
// The press is inside `a` but its unfilled inside hits nothing: `a` is only the drag fallback,
// not a clicked layer, so a click keeps the selection.
click(&mut s, 120.0, 320.0, NONE);
assert_eq!(sorted(s.selection()), sorted(vec![a, b]));
}
#[test]
fn alt_shift_drag_on_a_selected_layer_duplicates_it() {
let mut s = Session::new();