Merge pull request #5266 from xyflow/fix/handle-snapping
Fix/handle snapping
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
'@xyflow/system': patch
|
||||||
|
'@xyflow/react': patch
|
||||||
|
'@xyflow/svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix connection snapping for handles larger than connectionRadius
|
||||||
@@ -157,8 +157,8 @@ function onPointerDown(
|
|||||||
...previousConnection,
|
...previousConnection,
|
||||||
isValid,
|
isValid,
|
||||||
to:
|
to:
|
||||||
closestHandle && isValid
|
result.toHandle && isValid
|
||||||
? rendererPointToPoint({ x: closestHandle.x, y: closestHandle.y }, transform)
|
? rendererPointToPoint({ x: result.toHandle.x, y: result.toHandle.y }, transform)
|
||||||
: position,
|
: position,
|
||||||
toHandle: result.toHandle,
|
toHandle: result.toHandle,
|
||||||
toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],
|
toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],
|
||||||
@@ -295,7 +295,7 @@ function isValidHandle(
|
|||||||
|
|
||||||
result.isValid = isValid && isValidConnection(connection);
|
result.isValid = isValid && isValidConnection(connection);
|
||||||
|
|
||||||
result.toHandle = getHandle(handleNodeId, handleType, handleId, nodeLookup, connectionMode, false);
|
result.toHandle = getHandle(handleNodeId, handleType, handleId, nodeLookup, connectionMode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user