Skip to content

Commit

Permalink
Temp: Remove node when collapsed
Browse files Browse the repository at this point in the history
  • Loading branch information
lordrip committed Nov 29, 2024
1 parent 315b0b7 commit 0c8564c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DefaultEdge,
EdgeModel,
EdgeTerminalType,
getClosestVisibleParent,
GraphElement,
isEdge,
observer,
Expand All @@ -26,6 +27,14 @@ export const CustomEdge: FunctionComponent<CustomEdgeProps> = observer(({ elemen
if (!isEdge(element)) {
throw new Error('EdgeEndWithButton must be used only on Edge elements');
}

/* If the edge connects to nodes in a collapsed group don't draw */
const sourceParent = getClosestVisibleParent(element.getSource());
const targetParent = getClosestVisibleParent(element.getTarget());
if (sourceParent?.isCollapsed() && sourceParent === targetParent) {
return null;
}

const startPoint = element.getStartPoint();
const endPoint = element.getEndPoint();
const x = startPoint.x + (endPoint.x - startPoint.x - CanvasDefaults.ADD_STEP_ICON_SIZE) / 2;
Expand Down

0 comments on commit 0c8564c

Please sign in to comment.