fix(core): check if prevClosestHandle exists in pointer up

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-06 01:05:17 +01:00
committed by Braks
parent 86110f9211
commit c800a86893
2 changed files with 6 additions and 4 deletions
@@ -95,7 +95,7 @@ export default {
v-if="connectionLineComponent" v-if="connectionLineComponent"
:source-x="sourceX" :source-x="sourceX"
:source-y="sourceY" :source-y="sourceY"
:source-position="sourceHandle?.position" :source-position="fromPosition"
:targetX="targetX" :targetX="targetX"
:targetY="targetY" :targetY="targetY"
:target-position="targetPosition" :target-position="targetPosition"
+5 -3
View File
@@ -176,9 +176,11 @@ export default function useHandle({
} }
function onPointerUp(event: MouseEvent | TouchEvent) { function onPointerUp(event: MouseEvent | TouchEvent) {
if (connection && isValid) { if (prevClosestHandle) {
if (!onEdgeUpdate) emits.connect({ ...(defaultEdgeOptions?.value || {}), ...connection }) if (connection && isValid) {
else onEdgeUpdate(connection) if (!onEdgeUpdate) emits.connect({ ...(defaultEdgeOptions?.value || {}), ...connection })
else onEdgeUpdate(connection)
}
} }
emits.connectEnd(event) emits.connectEnd(event)