refactor(xyhandle): use center for to-xy, block updates only if valid

This commit is contained in:
moklick
2024-06-27 12:33:54 +02:00
parent 2b0f83b72e
commit 6cc6960895
2 changed files with 3 additions and 1 deletions

View File

@@ -161,6 +161,8 @@ function onPointerDown(
// we don't want to trigger an update when the connection
// is snapped to the same handle as before
if (
isValid &&
closestHandle &&
previousConnection.toHandle &&
newConnection.toHandle &&
previousConnection.toHandle.nodeId === newConnection.toHandle.nodeId &&

View File

@@ -21,7 +21,7 @@ function getHandles(
if (node.id === currentHandle.nodeId && type === currentHandle.handleType && handle.id === currentHandle.handleId) {
excludedHandle = handle;
} else {
const handleXY = getHandlePosition(node, handle);
const handleXY = getHandlePosition(node, handle, handle.position, true);
res.push({ ...handle, ...handleXY });
}
return res;