chore(connections): check if handle + connection radius

This commit is contained in:
moklick
2023-02-05 22:04:02 +01:00
parent 7a652fc17c
commit b07d940dac
2 changed files with 3 additions and 11 deletions

View File

@@ -136,7 +136,7 @@ export function handlePointerDown({
connectionStatus: getConnectionStatus(!!prevClosestHandle, result.isValid),
});
if (!prevClosestHandle) {
if (!prevClosestHandle && !result.isValid) {
return resetRecentHandle(prevActiveHandle);
}

View File

@@ -74,14 +74,6 @@ export function isValidHandle(
isValidConnection: ValidConnectionFunc,
doc: Document | ShadowRoot
) {
if (!handle) {
return {
handleDomNode: null,
isValid: false,
connection: nullConnection,
};
}
const isTarget = fromType === 'target';
const handleDomNode = doc.querySelector(
`.react-flow__handle[data-id="${handle?.nodeId}-${handle?.id}-${handle?.type}"]`
@@ -102,9 +94,9 @@ export function isValidHandle(
const handleId = handleToCheck.getAttribute('data-handleid');
const connection: Connection = {
source: isTarget ? handle.nodeId : fromNodeId,
source: isTarget ? handleNodeId : fromNodeId,
sourceHandle: isTarget ? handleId : fromHandleId,
target: isTarget ? fromNodeId : handle.nodeId,
target: isTarget ? fromNodeId : handleNodeId,
targetHandle: isTarget ? fromHandleId : handleId,
};