fix(xyhandle): only fire end events when connection started #5315

This commit is contained in:
moklick
2025-06-27 21:09:02 +02:00
parent ef90e2cb1a
commit 4a3af6da2f
+4 -2
View File
@@ -112,6 +112,7 @@ function onPointerDown(
};
function startConnection() {
connectionStarted = true;
updateConnection(previousConnection);
onConnectStart?.(event, { nodeId, handleId, handleType });
}
@@ -132,8 +133,6 @@ function onPointerDown(
}
startConnection();
connectionStarted = nextConnectionStarted;
}
if (!getFromHandle() || !fromHandle) {
@@ -208,6 +207,7 @@ function onPointerDown(
}
function onPointerUp(event: MouseEvent | TouchEvent) {
if (connectionStarted) {
if ((closestHandle || handleDomNode) && connection && isValid) {
onConnect?.(connection);
}
@@ -222,11 +222,13 @@ function onPointerDown(
...connectionState,
toPosition: previousConnection.toHandle ? previousConnection.toPosition : null,
};
onConnectEnd?.(event, finalConnectionState);
if (edgeUpdaterType) {
onReconnectEnd?.(event, finalConnectionState);
}
}
cancelConnection();
cancelAnimationFrame(autoPanId);