fix(canvas): 点击空白清除节点/连线选中

This commit is contained in:
2026-10-12 14:32:02 +08:00
parent 00109f83a2
commit db5c77851d
@@ -373,6 +373,11 @@ function onPointerDown(e) {
const wantPan = const wantPan =
e.button === 1 || e.button === 2 || spaceHeld.value || (!node && !e.shiftKey && e.button === 0) e.button === 1 || e.button === 2 || spaceHeld.value || (!node && !e.shiftKey && e.button === 0)
if (wantPan) { if (wantPan) {
// 空白左键点击 = 平移画布,同时清空节点/连线选中(点别处失焦)
if (!node && e.button === 0 && !spaceHeld.value) {
clearSelection()
clearEdgeSel()
}
panning.value = true panning.value = true
act = { mode: 'pan', px: p.x, py: p.y, vx: vp.x, vy: vp.y } act = { mode: 'pan', px: p.x, py: p.y, vx: vp.x, vy: vp.y }
try { stageEl.value.setPointerCapture(e.pointerId) } catch { /* 合成/失效指针 */ } try { stageEl.value.setPointerCapture(e.pointerId) } catch { /* 合成/失效指针 */ }