refactor(core): keep connection line snapped to handle while hovering

This commit is contained in:
braks
2023-11-10 00:40:33 +01:00
committed by Braks
parent 2e578ada7d
commit ba0cf54fef

View File

@@ -81,13 +81,15 @@ export function getClosestHandle(
const validHandleResult = validator({ nodeId: handleNodeId, id: handleId, type: handleType })
if (validHandleResult) {
const handle = handles.find((h) => h.nodeId === handleNodeId && h.type === handleType && h.id === handleId)
return {
handle: {
id: handleId,
type: handleType,
nodeId: handleNodeId,
x: pos.x,
y: pos.y,
x: handle?.x || pos.x,
y: handle?.y || pos.y,
},
validHandleResult,
}