fix(onEdgeUpdate): check if handle is target or source by classname fixes #982

This commit is contained in:
moklick
2021-03-14 15:32:17 +01:00
parent cd1baadf41
commit 83da698aa4
+3 -1
View File
@@ -98,12 +98,14 @@ export function onMouseDown(
onConnectEnd?: OnConnectEndFunc onConnectEnd?: OnConnectEndFunc
): void { ): void {
const reactFlowNode = (event.target as Element).closest('.react-flow'); const reactFlowNode = (event.target as Element).closest('.react-flow');
const elementBelow = document.elementFromPoint(event.clientX, event.clientY);
const elementBelowIsTarget = elementBelow?.classList.contains('target') || false;
if (!reactFlowNode) { if (!reactFlowNode) {
return; return;
} }
const handleType = isTarget ? 'target' : 'source'; const handleType = elementBelowIsTarget ? 'target' : 'source';
const containerBounds = reactFlowNode.getBoundingClientRect(); const containerBounds = reactFlowNode.getBoundingClientRect();
let recentHoveredHandle: Element; let recentHoveredHandle: Element;