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
@@ -38,6 +38,19 @@ fn status(s: &mut Session, ids: &[NodeId], st: &str) {
ex(s, "node.set", json!({"ids": ids, "props": {"devStatus": st}}));
}
#[test]
fn a_dev_mode_click_on_a_selected_layer_selects_just_it() {
let mut s = Session::new();
let a = idv(&ex(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 40, "height": 40})));
let b = idv(&ex(&mut s, "shape.rectangle", json!({"x": 80, "y": 0, "width": 40, "height": 40})));
s.tool.dev_mode = true;
ex(&mut s, "select.set", json!({"ids": [a, b]}));
// Dev Mode starts no move gesture, so the click narrows the selection at the press itself.
s.pointer(&ev(PointerKind::Down, 20.0, 20.0)).unwrap();
s.pointer(&ev(PointerKind::Up, 20.0, 20.0)).unwrap();
assert_eq!(s.selection(), vec![a], "a click on one of several selected layers selects it");
}
#[test]
fn the_dev_mode_canvas_selects_and_pans_but_never_edits() {
let mut s = Session::new();