fix(onEdgeUpdate): check if handle is target or source by classname fixes #982
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user