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