From 390bffa20887238ce98a1e4b45ed19c3b2da0949 Mon Sep 17 00:00:00 2001 From: AzuTear Date: Sun, 14 Jun 2026 15:33:51 +0200 Subject: [PATCH] fix: detect drag state on pointer release --- .../components/dashboard/v2/useFlowCanvasInteractions.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/dashboard/v2/useFlowCanvasInteractions.ts b/frontend/src/components/dashboard/v2/useFlowCanvasInteractions.ts index 660f9c0..ed69231 100644 --- a/frontend/src/components/dashboard/v2/useFlowCanvasInteractions.ts +++ b/frontend/src/components/dashboard/v2/useFlowCanvasInteractions.ts @@ -1,7 +1,7 @@ import { ref } from 'vue' const DRAG_THRESHOLD = 5 -const CLICK_SUPPRESSION_MS = 250 +const CLICK_SUPPRESSION_MS = 400 export interface FlowPosition { x: number @@ -93,14 +93,16 @@ export function useFlowCanvasInteractions(options: UseFlowCanvasInteractionsOpti } } - function onPointerUp() { + function onPointerUp(e: PointerEvent) { if (!drag.value) return const currentDrag = drag.value + const endDistance = Math.hypot(e.clientX - currentDrag.startX, e.clientY - currentDrag.startY) + const wasDragged = currentDrag.moved || endDistance >= DRAG_THRESHOLD const node = options.flowRef.value?.querySelector(`.node[data-id="${currentDrag.id}"]`) as HTMLElement | null if (node) node.classList.remove('dragging') - if (currentDrag.moved) { + if (wasDragged) { suppressClickUntil.value = performance.now() + CLICK_SUPPRESSION_MS }