fix(edges): change xy positions to detect when edge is hidden

This commit is contained in:
Christopher Möller
2020-11-16 14:51:59 +01:00
parent fc16bc1168
commit 16abf0595f
+14 -14
View File
@@ -47,20 +47,6 @@ function renderEdge(
return null;
}
const isVisible = onlyRenderVisibleElements
? isEdgeVisible({
sourcePos: sourceNode.__rf.position,
targetPos: targetNode.__rf.position,
width,
height,
transform,
})
: true;
if (!isVisible) {
return null;
}
const edgeType = edge.type || 'default';
const EdgeComponent = props.edgeTypes[edgeType] || props.edgeTypes.default;
const sourceHandle = getHandle(sourceNode.__rf.handleBounds.source, sourceHandleId);
@@ -87,6 +73,20 @@ function renderEdge(
targetPosition
);
const isVisible = onlyRenderVisibleElements
? isEdgeVisible({
sourcePos: { x: sourceX, y: sourceY },
targetPos: { x: targetX, y: targetY },
width,
height,
transform,
})
: true;
if (!isVisible) {
return null;
}
const isSelected = selectedElements?.some((elm) => isEdge(elm) && elm.id === edge.id) || false;
return (