chore(connections): check if handle + connection radius
This commit is contained in:
@@ -136,7 +136,7 @@ export function handlePointerDown({
|
|||||||
connectionStatus: getConnectionStatus(!!prevClosestHandle, result.isValid),
|
connectionStatus: getConnectionStatus(!!prevClosestHandle, result.isValid),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!prevClosestHandle) {
|
if (!prevClosestHandle && !result.isValid) {
|
||||||
return resetRecentHandle(prevActiveHandle);
|
return resetRecentHandle(prevActiveHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,14 +74,6 @@ export function isValidHandle(
|
|||||||
isValidConnection: ValidConnectionFunc,
|
isValidConnection: ValidConnectionFunc,
|
||||||
doc: Document | ShadowRoot
|
doc: Document | ShadowRoot
|
||||||
) {
|
) {
|
||||||
if (!handle) {
|
|
||||||
return {
|
|
||||||
handleDomNode: null,
|
|
||||||
isValid: false,
|
|
||||||
connection: nullConnection,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const isTarget = fromType === 'target';
|
const isTarget = fromType === 'target';
|
||||||
const handleDomNode = doc.querySelector(
|
const handleDomNode = doc.querySelector(
|
||||||
`.react-flow__handle[data-id="${handle?.nodeId}-${handle?.id}-${handle?.type}"]`
|
`.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 handleId = handleToCheck.getAttribute('data-handleid');
|
||||||
|
|
||||||
const connection: Connection = {
|
const connection: Connection = {
|
||||||
source: isTarget ? handle.nodeId : fromNodeId,
|
source: isTarget ? handleNodeId : fromNodeId,
|
||||||
sourceHandle: isTarget ? handleId : fromHandleId,
|
sourceHandle: isTarget ? handleId : fromHandleId,
|
||||||
target: isTarget ? fromNodeId : handle.nodeId,
|
target: isTarget ? fromNodeId : handleNodeId,
|
||||||
targetHandle: isTarget ? fromHandleId : handleId,
|
targetHandle: isTarget ? fromHandleId : handleId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user