refactor(xyhandle): use center for to-xy, block updates only if valid
This commit is contained in:
@@ -161,6 +161,8 @@ function onPointerDown(
|
|||||||
// we don't want to trigger an update when the connection
|
// we don't want to trigger an update when the connection
|
||||||
// is snapped to the same handle as before
|
// is snapped to the same handle as before
|
||||||
if (
|
if (
|
||||||
|
isValid &&
|
||||||
|
closestHandle &&
|
||||||
previousConnection.toHandle &&
|
previousConnection.toHandle &&
|
||||||
newConnection.toHandle &&
|
newConnection.toHandle &&
|
||||||
previousConnection.toHandle.nodeId === newConnection.toHandle.nodeId &&
|
previousConnection.toHandle.nodeId === newConnection.toHandle.nodeId &&
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ function getHandles(
|
|||||||
if (node.id === currentHandle.nodeId && type === currentHandle.handleType && handle.id === currentHandle.handleId) {
|
if (node.id === currentHandle.nodeId && type === currentHandle.handleType && handle.id === currentHandle.handleId) {
|
||||||
excludedHandle = handle;
|
excludedHandle = handle;
|
||||||
} else {
|
} else {
|
||||||
const handleXY = getHandlePosition(node, handle);
|
const handleXY = getHandlePosition(node, handle, handle.position, true);
|
||||||
res.push({ ...handle, ...handleXY });
|
res.push({ ...handle, ...handleXY });
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
Reference in New Issue
Block a user