refactor(handles): add connectionStart and connectionEnd handle to store, cleanup

This commit is contained in:
moklick
2023-03-27 12:56:57 +02:00
parent 2fd5319cf2
commit 395a1586c3
9 changed files with 94 additions and 57 deletions
@@ -89,12 +89,17 @@ export function handlePointerDown({
setState({
connectionPosition,
connectionStatus: null,
// connectionNodeId etc will be removed in the next major in favor of connectionStartHandle
connectionNodeId: nodeId,
connectionHandleId: handleId,
connectionHandleType: handleType,
connectionStatus: null,
connectionTargetNodeId: null,
connectionTargetHandleId: null,
connectionStartHandle: {
nodeId,
handleId,
type: handleType,
},
connectionEndHandle: null,
});
onConnectStart?.(event, { nodeId, handleId, handleType });
@@ -141,8 +146,7 @@ export function handlePointerDown({
)
: connectionPosition,
connectionStatus: getConnectionStatus(!!prevClosestHandle, isValid),
connectionTargetNodeId: connection.target,
connectionTargetHandleId: connection.targetHandle,
connectionEndHandle: result.endHandle,
});
if (!prevClosestHandle && !isValid && !handleDomNode) {