From fc8bdc8d161ae6f8d1a8c067d37d5b55c878994b Mon Sep 17 00:00:00 2001 From: Rizumu Ayaka Date: Fri, 5 Dec 2025 21:51:59 +0800 Subject: [PATCH 1/3] fix: mouse accidentally sticks and drag the node --- .../composables/useNodePointerInteractions.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts b/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts index d3461d4c39..9cfcd22366 100644 --- a/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts +++ b/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts @@ -57,7 +57,7 @@ export function useNodePointerInteractions( startPosition.value = { x: event.clientX, y: event.clientY } - startDrag(event, nodeId) + safeDragStart(event, nodeId) } function onPointermove(event: PointerEvent) { @@ -76,9 +76,8 @@ export function useNodePointerInteractions( const lmbDown = event.buttons & 1 if (lmbDown && multiSelect && !layoutStore.isDraggingVueNodes.value) { - layoutStore.isDraggingVueNodes.value = true handleNodeSelect(event, nodeId) - startDrag(event, nodeId) + safeDragStart(event, nodeId) return } // Check if we should start dragging (pointer moved beyond threshold) @@ -102,6 +101,14 @@ export function useNodePointerInteractions( layoutStore.isDraggingVueNodes.value = false } + function safeDragStart(event: PointerEvent, nodeId: string) { + try { + startDrag(event, nodeId) + } finally { + layoutStore.isDraggingVueNodes.value = true + } + } + function safeDragEnd(event: PointerEvent) { try { const nodeId = toValue(nodeIdRef) @@ -125,7 +132,6 @@ export function useNodePointerInteractions( if (wasDragging) { safeDragEnd(event) - return } // Skip selection handling for right-click (button 2) - context menu handles its own selection From 8c6255dc05430f54d7aae0d03a8ed14653bcd780 Mon Sep 17 00:00:00 2001 From: Rizumu Ayaka Date: Mon, 8 Dec 2025 18:19:09 +0800 Subject: [PATCH 2/3] fix: auto select when dragging --- .../composables/useNodePointerInteractions.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts b/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts index 9cfcd22366..5363750d29 100644 --- a/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts +++ b/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts @@ -26,6 +26,8 @@ export function useNodePointerInteractions( return true } + let hasDraggingStarted = false + const startPosition = ref({ x: 0, y: 0 }) const DRAG_THRESHOLD = 3 // pixels @@ -105,7 +107,7 @@ export function useNodePointerInteractions( try { startDrag(event, nodeId) } finally { - layoutStore.isDraggingVueNodes.value = true + hasDraggingStarted = true } } @@ -116,6 +118,7 @@ export function useNodePointerInteractions( } catch (error) { console.error('Error during endDrag:', error) } finally { + hasDraggingStarted = false cleanupDragState() } } @@ -130,8 +133,12 @@ export function useNodePointerInteractions( } const wasDragging = layoutStore.isDraggingVueNodes.value - if (wasDragging) { + if (hasDraggingStarted || wasDragging) { safeDragEnd(event) + + if (wasDragging) { + return + } } // Skip selection handling for right-click (button 2) - context menu handles its own selection From c904f063c84773656696442008025a22e0c65c88 Mon Sep 17 00:00:00 2001 From: Rizumu Ayaka Date: Mon, 8 Dec 2025 18:31:22 +0800 Subject: [PATCH 3/3] fix: selecting one item and holding shift and dragging should drag both items --- .../vueNodes/composables/useNodePointerInteractions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts b/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts index 5363750d29..0dfdae51b1 100644 --- a/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts +++ b/src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts @@ -78,6 +78,7 @@ export function useNodePointerInteractions( const lmbDown = event.buttons & 1 if (lmbDown && multiSelect && !layoutStore.isDraggingVueNodes.value) { + layoutStore.isDraggingVueNodes.value = true handleNodeSelect(event, nodeId) safeDragStart(event, nodeId) return