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 00:35:04 +01:00
committed by Braks
parent 86110f9211
commit c800a86893
2 changed files with 6 additions and 4 deletions

View File

@@ -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"

View File

@@ -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)