From c800a86893ac4877030e91ca5da3660f019d5fcc Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 6 Feb 2023 00:35:04 +0100 Subject: [PATCH] fix(core): check if prevClosestHandle exists in pointer up Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- .../core/src/components/ConnectionLine/ConnectionLine.vue | 2 +- packages/core/src/composables/useHandle.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/core/src/components/ConnectionLine/ConnectionLine.vue b/packages/core/src/components/ConnectionLine/ConnectionLine.vue index 15fd4116..d93fa6ff 100644 --- a/packages/core/src/components/ConnectionLine/ConnectionLine.vue +++ b/packages/core/src/components/ConnectionLine/ConnectionLine.vue @@ -95,7 +95,7 @@ export default { v-if="connectionLineComponent" :source-x="sourceX" :source-y="sourceY" - :source-position="sourceHandle?.position" + :source-position="fromPosition" :targetX="targetX" :targetY="targetY" :target-position="targetPosition" diff --git a/packages/core/src/composables/useHandle.ts b/packages/core/src/composables/useHandle.ts index 662be5b9..54b92842 100644 --- a/packages/core/src/composables/useHandle.ts +++ b/packages/core/src/composables/useHandle.ts @@ -176,9 +176,11 @@ export default function useHandle({ } function onPointerUp(event: MouseEvent | TouchEvent) { - if (connection && isValid) { - if (!onEdgeUpdate) emits.connect({ ...(defaultEdgeOptions?.value || {}), ...connection }) - else onEdgeUpdate(connection) + if (prevClosestHandle) { + if (connection && isValid) { + if (!onEdgeUpdate) emits.connect({ ...(defaultEdgeOptions?.value || {}), ...connection }) + else onEdgeUpdate(connection) + } } emits.connectEnd(event)