diff --git a/packages/x6/src/graph/group-manager.ts b/packages/x6/src/graph/group-manager.ts index 23bd138c3b3..b19fa437dfa 100644 --- a/packages/x6/src/graph/group-manager.ts +++ b/packages/x6/src/graph/group-manager.ts @@ -173,7 +173,7 @@ export class GroupManager extends BaseManager { for (let i = cells.length - 1; i >= 0; i -= 1) { let geo = this.graph.getCellGeometry(cells[i]) if (geo != null) { - const children = this.graph.getChildren(cells[i]) + const children = this.graph.getVisibleChildren(cells[i]) if (children != null && children.length > 0) { const bounds = this.graph.getBoundingBoxFromGeometry(children, true) if (bounds != null && bounds.width > 0 && bounds.height > 0) { diff --git a/packages/x6/src/graph/retrieval-accessor.ts b/packages/x6/src/graph/retrieval-accessor.ts index 9f244daa2b4..a5c1106657b 100644 --- a/packages/x6/src/graph/retrieval-accessor.ts +++ b/packages/x6/src/graph/retrieval-accessor.ts @@ -92,21 +92,21 @@ export class RetrievalAccessor extends BaseGraph { /** * Returns the visible child nodes of the given parent. */ - getChildNodes(parent: Cell) { - return this.getChildren(parent, true, false) + getVisibleChildNodes(parent: Cell) { + return this.getVisibleChildren(parent, true, false) } /** * Returns the visible child edges of the given parent. */ - getChildEdges(parent: Cell) { - return this.getChildren(parent, false, true) + getVisibleChildEdges(parent: Cell) { + return this.getVisibleChildren(parent, false, true) } /** * Returns the visible child nodes or edges of the given parent. */ - getChildren( + getVisibleChildren( parent: Cell = this.getDefaultParent(), includeNodes: boolean = false, includeEdges: boolean = false, @@ -115,6 +115,22 @@ export class RetrievalAccessor extends BaseGraph { return cells.filter(cell => this.isCellVisible(cell)) } + getChildNodes(parent: Cell) { + return this.getChildren(parent, true, false) + } + + getChildEdges(parent: Cell) { + return this.getChildren(parent, false, true) + } + + getChildren( + parent: Cell = this.getDefaultParent(), + includeNodes: boolean = false, + includeEdges: boolean = false, + ) { + return this.model.getChildren(parent, includeNodes, includeEdges) + } + /** * Returns all visible edges connected to the given cell without loops. */ diff --git a/packages/x6/src/handler/node/preview.ts b/packages/x6/src/handler/node/preview.ts index 7fec6b79a15..e27685b9253 100644 --- a/packages/x6/src/handler/node/preview.ts +++ b/packages/x6/src/handler/node/preview.ts @@ -179,7 +179,7 @@ export class Preview extends Disposable { } protected updateMinBounds() { - const children = this.graph.getChildren(this.state.cell) + const children = this.graph.getVisibleChildren(this.state.cell) if (children.length > 0) { this.minBounds = this.graph.view.getBounds(children) if (this.minBounds != null) {