fix(core): add connection target handle id to result type

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-03-08 16:32:11 +01:00
committed by Braks
parent 929e2b5d04
commit 046ee41e79
3 changed files with 14 additions and 7 deletions
@@ -42,17 +42,21 @@ const sourceHandle = $computed(
sourceNode.handleBounds[type.value ?? 'source']?.[0],
)
const targetHandle = $computed(
() =>
const targetHandle = $computed(() => {
return (
(targetNode &&
connectionStartHandle?.result?.handleId &&
((connectionMode === ConnectionMode.Strict
? targetNode.handleBounds[type.value === 'source' ? 'target' : 'source']?.find((d) => d.id === handleId)
? targetNode.handleBounds[type.value === 'source' ? 'target' : 'source']?.find(
(d) => d.id === connectionStartHandle?.result?.handleId,
)
: [...(targetNode.handleBounds.source || []), ...(targetNode.handleBounds.target || [])]?.find(
(d) => d.id === handleId,
(d) => d.id === connectionStartHandle?.result?.handleId,
)) ||
targetNode.handleBounds[type.value ?? 'source']?.[0])) ||
null,
)
targetNode.handleBounds[type.value ?? 'target']?.[0])) ||
null
)
})
const sourceHandleX = $computed(() => (sourceHandle ? sourceHandle.x + sourceHandle.width / 2 : sourceNode.dimensions.width / 2))
const sourceHandleY = $computed(() => (sourceHandle ? sourceHandle.y + sourceHandle.height / 2 : sourceNode.dimensions.height))