fix: open agent cards only on click
This commit is contained in:
@@ -174,6 +174,7 @@ watch(
|
||||
|
||||
/* ── Drag & Drop ──────────────────────────────── */
|
||||
const {
|
||||
onClick,
|
||||
onClickCapture,
|
||||
onPointerDown,
|
||||
onPointerMove,
|
||||
@@ -197,6 +198,7 @@ function handleReset() {
|
||||
<div
|
||||
ref="flowRef"
|
||||
class="flow"
|
||||
@click="onClick"
|
||||
@click.capture="onClickCapture"
|
||||
@pointerdown="onPointerDown"
|
||||
@pointermove="onPointerMove"
|
||||
|
||||
@@ -100,15 +100,22 @@ export function useFlowCanvasInteractions(options: UseFlowCanvasInteractionsOpti
|
||||
const node = options.flowRef.value?.querySelector(`.node[data-id="${currentDrag.id}"]`) as HTMLElement | null
|
||||
if (node) node.classList.remove('dragging')
|
||||
|
||||
if (!currentDrag.moved) {
|
||||
options.selectAgent(currentDrag.id)
|
||||
} else {
|
||||
if (currentDrag.moved) {
|
||||
suppressClickUntil.value = performance.now() + CLICK_SUPPRESSION_MS
|
||||
}
|
||||
|
||||
drag.value = null
|
||||
}
|
||||
|
||||
function onClick(e: MouseEvent) {
|
||||
const node = findNode(e.target)
|
||||
if (!node) return
|
||||
if (performance.now() < suppressClickUntil.value) return
|
||||
|
||||
const id = node.dataset.id
|
||||
if (id) options.selectAgent(id)
|
||||
}
|
||||
|
||||
function onClickCapture(e: MouseEvent) {
|
||||
if (performance.now() >= suppressClickUntil.value) return
|
||||
if (!findNode(e.target)) return
|
||||
@@ -117,6 +124,7 @@ export function useFlowCanvasInteractions(options: UseFlowCanvasInteractionsOpti
|
||||
}
|
||||
|
||||
return {
|
||||
onClick,
|
||||
onClickCapture,
|
||||
onPointerDown,
|
||||
onPointerMove,
|
||||
|
||||
Reference in New Issue
Block a user