fix(edges): change xy positions to detect when edge is hidden
This commit is contained in:
@@ -47,20 +47,6 @@ function renderEdge(
|
|||||||
return null;
|
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 edgeType = edge.type || 'default';
|
||||||
const EdgeComponent = props.edgeTypes[edgeType] || props.edgeTypes.default;
|
const EdgeComponent = props.edgeTypes[edgeType] || props.edgeTypes.default;
|
||||||
const sourceHandle = getHandle(sourceNode.__rf.handleBounds.source, sourceHandleId);
|
const sourceHandle = getHandle(sourceNode.__rf.handleBounds.source, sourceHandleId);
|
||||||
@@ -87,6 +73,20 @@ function renderEdge(
|
|||||||
targetPosition
|
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;
|
const isSelected = selectedElements?.some((elm) => isEdge(elm) && elm.id === edge.id) || false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user