diff --git a/.changeset/giant-pants-jam.md b/.changeset/giant-pants-jam.md new file mode 100644 index 00000000..b8893849 --- /dev/null +++ b/.changeset/giant-pants-jam.md @@ -0,0 +1,5 @@ +--- +"@vue-flow/core": patch +--- + +Use the connecting handle result when updating a connection, so we get an accurate connection position for `toPosition`. diff --git a/packages/core/src/composables/useHandle.ts b/packages/core/src/composables/useHandle.ts index 3ccf7a49..8d8f90c7 100644 --- a/packages/core/src/composables/useHandle.ts +++ b/packages/core/src/composables/useHandle.ts @@ -244,6 +244,7 @@ export function useHandle({ } const connectingHandle = closestHandle ?? result.toHandle + updateConnection( connectingHandle && isValid ? rendererPointToPoint( @@ -254,7 +255,7 @@ export function useHandle({ viewport.value, ) : connectionPosition, - result.toHandle, + connectingHandle, getConnectionStatus(!!connectingHandle, isValid), )