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

This commit is contained in:
braks
2023-11-10 15:19:16 +01:00
committed by Braks
parent 2e578ada7d
commit ba0cf54fef
+4 -2
View File
@@ -81,13 +81,15 @@ export function getClosestHandle(
const validHandleResult = validator({ nodeId: handleNodeId, id: handleId, type: handleType }) const validHandleResult = validator({ nodeId: handleNodeId, id: handleId, type: handleType })
if (validHandleResult) { if (validHandleResult) {
const handle = handles.find((h) => h.nodeId === handleNodeId && h.type === handleType && h.id === handleId)
return { return {
handle: { handle: {
id: handleId, id: handleId,
type: handleType, type: handleType,
nodeId: handleNodeId, nodeId: handleNodeId,
x: pos.x, x: handle?.x || pos.x,
y: pos.y, y: handle?.y || pos.y,
}, },
validHandleResult, validHandleResult,
} }