From 2dd462ef5f0f36e0023eb9c00ec6db0e84c31e1b Mon Sep 17 00:00:00 2001 From: peterkogo Date: Thu, 15 May 2025 13:37:48 +0200 Subject: [PATCH 1/2] fix connection snapping --- packages/system/src/xyhandle/XYHandle.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/system/src/xyhandle/XYHandle.ts b/packages/system/src/xyhandle/XYHandle.ts index 9c2af456..b8a5b4d2 100644 --- a/packages/system/src/xyhandle/XYHandle.ts +++ b/packages/system/src/xyhandle/XYHandle.ts @@ -157,8 +157,8 @@ function onPointerDown( ...previousConnection, isValid, to: - closestHandle && isValid - ? rendererPointToPoint({ x: closestHandle.x, y: closestHandle.y }, transform) + result.toHandle && isValid + ? rendererPointToPoint({ x: result.toHandle.x, y: result.toHandle.y }, transform) : position, toHandle: result.toHandle, toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position], @@ -295,7 +295,7 @@ function isValidHandle( 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; From 77107453fa6f34cb08ef91640b8b02d58e31275e Mon Sep 17 00:00:00 2001 From: peterkogo Date: Thu, 15 May 2025 13:37:59 +0200 Subject: [PATCH 2/2] changeset --- .changeset/chilly-dogs-mix.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/chilly-dogs-mix.md diff --git a/.changeset/chilly-dogs-mix.md b/.changeset/chilly-dogs-mix.md new file mode 100644 index 00000000..a8081b38 --- /dev/null +++ b/.changeset/chilly-dogs-mix.md @@ -0,0 +1,7 @@ +--- +'@xyflow/system': patch +'@xyflow/react': patch +'@xyflow/svelte': patch +--- + +Fix connection snapping for handles larger than connectionRadius