refactor(core): use correct end handle position in connection line (#1508)

* refactor(core): use correct end handle position in connection line

* chore(changeset): add
This commit is contained in:
Braks
2024-07-01 09:44:55 +02:00
parent 266f8744ad
commit 3489fae8fe
5 changed files with 18 additions and 9 deletions
+8 -6
View File
@@ -8,6 +8,7 @@ import type {
GraphNode,
HandleType,
NodeHandleBounds,
Position,
ValidConnectionFunc,
ValidHandleResult,
XYPosition,
@@ -192,12 +193,6 @@ export function isValidHandle(
? (isTarget && handleType === 'source') || (!isTarget && handleType === 'target')
: handleNodeId !== fromNodeId || handleId !== fromHandleId)
result.endHandle = {
nodeId: handleNodeId,
handleId,
type: handleType as HandleType,
}
if (isValid) {
result.isValid = isValidConnection(connection, {
edges,
@@ -205,6 +200,13 @@ export function isValidHandle(
sourceNode: findNode(connection.source)!,
targetNode: findNode(connection.target)!,
})
result.endHandle = {
nodeId: handleNodeId,
handleId,
type: handleType as HandleType,
position: result.isValid ? (handleToCheck.getAttribute('data-handlepos') as Position) : null,
}
}
}