From 6f9c47802ba488b1b558df22f57eb9ce739e30ce Mon Sep 17 00:00:00 2001
From: mcyph <20507948+mcyph@users.noreply.github.com>
Date: Sun, 25 Apr 2021 17:22:00 +1000
Subject: [PATCH] moved calls isCellCollapsed and others from mxGraph to mxCell
---
docs/stashed/Ports.js | 2 +-
docs/stashed/Scrollbars.js | 6 +-
docs/stashed/Touch.js | 2 +-
docs/stashed/grapheditor/www/js/Graph.js | 20 +-
docs/stashed/grapheditor/www/js/Sidebar.js | 8 +-
packages/core/src/editor/mxDefaultToolbar.js | 4 +-
.../core/src/handler/mxConnectionHandler.js | 6 +-
.../core/src/handler/mxConstraintHandler.js | 12 +-
packages/core/src/handler/mxEdgeHandler.js | 10 +-
packages/core/src/handler/mxGraphHandler.js | 8 +-
packages/core/src/handler/mxVertexHandler.js | 2 +-
.../hierarchical/mxHierarchicalLayout.js | 12 +-
.../layout/hierarchical/mxSwimlaneLayout.js | 12 +-
packages/core/src/layout/mxGraphLayout.js | 4 +-
packages/core/src/layout/mxStackLayout.js | 2 +-
packages/core/src/view/cell/mxCell.ts | 285 +++++++++++++++++
packages/core/src/view/cell/mxCellRenderer.ts | 2 +-
packages/core/src/view/cell/mxCells.ts | 2 +-
packages/core/src/view/graph/mxGraph.ts | 24 +-
packages/core/src/view/graph/mxGraphModel.ts | 294 ++----------------
packages/core/src/view/graph/mxGraphView.ts | 7 +-
src/pages/layout/SwimLanes.js | 2 +-
src/pages/layout/Tree.js | 2 +-
23 files changed, 395 insertions(+), 333 deletions(-)
diff --git a/docs/stashed/Ports.js b/docs/stashed/Ports.js
index 2a10af491..00d7f670f 100644
--- a/docs/stashed/Ports.js
+++ b/docs/stashed/Ports.js
@@ -157,7 +157,7 @@ export default Ports;
// processing wrt the parent label)
return '';
}
- else if (this.isCellCollapsed(cell))
+ else if (cell.isCollapsed())
{
let index = tmp.indexOf('');
diff --git a/docs/stashed/Scrollbars.js b/docs/stashed/Scrollbars.js
index c2bb6e512..b7fc75ead 100644
--- a/docs/stashed/Scrollbars.js
+++ b/docs/stashed/Scrollbars.js
@@ -205,7 +205,7 @@ export default Scrollbars;
// Overrides connectable state
graph.isCellConnectable = function(cell)
{
- return !this.isCellCollapsed(cell);
+ return !cell.isCollapsed();
};
// Enables HTML markup in all labels
@@ -371,7 +371,7 @@ export default Scrollbars;
{
if (cell.isVertex())
{
- if (this.isCellCollapsed(cell))
+ if (cell.isCollapsed())
{
return '
' +
'Customers |
' +
@@ -473,7 +473,7 @@ export default Scrollbars;
{
y = start.getCenterY() - div.scrollTop;
- if (mxUtils.isNode(edge.cell.value) && !this.graph.isCellCollapsed(start.cell))
+ if (mxUtils.isNode(edge.cell.value) && !start.cell.isCollapsed())
{
let attr = (source) ? 'sourceRow' : 'targetRow';
let row = parseInt(edge.cell.value.getAttribute(attr));
diff --git a/docs/stashed/Touch.js b/docs/stashed/Touch.js
index 78840c3e3..478cc86f4 100644
--- a/docs/stashed/Touch.js
+++ b/docs/stashed/Touch.js
@@ -356,7 +356,7 @@ export default Touch;
// Only show connector image on one cell and do not show on containers
if (this.graph.connectionHandler.isEnabled() &&
- this.graph.isCellConnectable(this.state.cell) &&
+ this.state.cell.isConnectable() &&
this.graph.getSelectionCount() == 1)
{
this.connectorImg = mxUtils.createImage(connectorSrc);
diff --git a/docs/stashed/grapheditor/www/js/Graph.js b/docs/stashed/grapheditor/www/js/Graph.js
index f0d815b9f..84929bb49 100644
--- a/docs/stashed/grapheditor/www/js/Graph.js
+++ b/docs/stashed/grapheditor/www/js/Graph.js
@@ -1885,7 +1885,7 @@ Graph.prototype.init = function(container)
Graph.prototype.isRecursiveVertexResize = function(state)
{
return !this.isSwimlane(state.cell) && state.cell.getChildCount() > 0 &&
- !this.isCellCollapsed(state.cell) && mxUtils.getValue(state.style, 'recursiveResize', '1') == '1' &&
+ !state.cell.isCollapsed() && mxUtils.getValue(state.style, 'recursiveResize', '1') == '1' &&
mxUtils.getValue(state.style, 'childLayout', null) == null;
}
@@ -3120,18 +3120,18 @@ Graph.prototype.connectVertex = function(source, direction, length, evt, forceCl
// Uses connectable parent vertex if one exists
// TODO: Fix using target as parent for swimlane
- if (target != null && !this.isCellConnectable(target) && !this.isSwimlane(target))
+ if (target != null && !target.isConnectable() && !this.isSwimlane(target))
{
let parent = target.getParent();
- if (parent.isVertex() && this.isCellConnectable(parent))
+ if (parent.isVertex() && parent.isConnectable())
{
target = parent;
}
}
if (target == source || target.isEdge() ||
- !this.isCellConnectable(target) &&
+ !target.isConnectable() &&
!this.isSwimlane(target))
{
target = null;
@@ -3398,7 +3398,7 @@ Graph.prototype.getCellStyle = function(cell)
{
let parent = cell.getParent();
- if (parent.isVertex() && this.isCellCollapsed(cell))
+ if (parent.isVertex() && cell.isCollapsed())
{
let layout = this.layoutManager.getLayout(parent);
@@ -4480,7 +4480,7 @@ HoverIcons.prototype.repaint = function()
// Cell was deleted
if (this.currentState != null &&
this.currentState.cell.isVertex() &&
- this.graph.isCellConnectable(this.currentState.cell))
+ this.currentState.cell.isConnectable())
{
let bds = mxRectangle.fromRectangle(this.currentState);
@@ -4692,11 +4692,11 @@ HoverIcons.prototype.getState = function(state)
else
{
// Uses connectable parent vertex if child is not connectable
- if (cell.isVertex() && !this.graph.isCellConnectable(cell))
+ if (cell.isVertex() && !cell.isConnectable())
{
let parent = this.cell.getParent();
- if (parent.isVertex() && this.graph.isCellConnectable(parent))
+ if (parent.isVertex() && parent.isConnectable())
{
cell = parent;
}
@@ -5151,7 +5151,7 @@ TableLayout.prototype.isHorizontal = function()
TableLayout.prototype.isVertexIgnored = function(vertex)
{
return !vertex.isVertex() ||
- !this.graph.isCellVisible(vertex);
+ !vertex.isVisible();
};
/**
@@ -10282,7 +10282,7 @@ if (typeof mxVertexHandler != 'undefined')
mxVertexHandler.prototype.isCenteredEvent = function(state, me)
{
return (!(!this.graph.isSwimlane(state.cell) && state.cell.getChildCount() > 0 &&
- !this.graph.isCellCollapsed(state.cell) &&
+ !state.cell.isCollapsed() &&
mxUtils.getValue(state.style, 'recursiveResize', '1') == '1' &&
mxUtils.getValue(state.style, 'childLayout', null) == null) &&
mxEvent.isControlDown(me.getEvent())) ||
diff --git a/docs/stashed/grapheditor/www/js/Sidebar.js b/docs/stashed/grapheditor/www/js/Sidebar.js
index e4b84cfbc..1275aeb73 100644
--- a/docs/stashed/grapheditor/www/js/Sidebar.js
+++ b/docs/stashed/grapheditor/www/js/Sidebar.js
@@ -3444,13 +3444,13 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
}) : null;
// Uses connectable parent vertex if one exists
- if (cell != null && !this.graph.isCellConnectable(cell) &&
+ if (cell != null && !cell.isConnectable() &&
!cell.isEdge())
{
let parent = this.cell.getParent();
if (parent.isVertex() &&
- this.graph.isCellConnectable(parent))
+ parent.isConnectable())
{
cell = parent;
}
@@ -3641,9 +3641,9 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
state = currentStyleTarget;
}
- let validTarget = (firstVertex == null || graph.isCellConnectable(cells[firstVertex])) &&
+ let validTarget = (firstVertex == null || cells[firstVertex].isConnectable()) &&
((cell.isEdge() && firstVertex != null) ||
- (cell.isVertex() && graph.isCellConnectable(cell)));
+ (cell.isVertex() && cell.isConnectable()));
// Drop arrows shown after this.dropTargetDelay, hidden after 5 secs, switches arrows after 500ms
if ((currentTargetState != null && timeOnTarget >= 5000) ||
diff --git a/packages/core/src/editor/mxDefaultToolbar.js b/packages/core/src/editor/mxDefaultToolbar.js
index ac7fa0119..d41d77345 100644
--- a/packages/core/src/editor/mxDefaultToolbar.js
+++ b/packages/core/src/editor/mxDefaultToolbar.js
@@ -305,7 +305,7 @@ class mxDefaultToolbar {
target == null ||
target.isEdge() ||
!this.connectOnDrop ||
- !graph.isCellConnectable(target)
+ !target.isConnectable()
) {
while (
target != null &&
@@ -363,7 +363,7 @@ class mxDefaultToolbar {
if (
source != null &&
- graph.isCellConnectable(vertex) &&
+ vertex.isCellConnectable() &&
graph.isEdgeValid(null, source, vertex)
) {
let edge = null;
diff --git a/packages/core/src/handler/mxConnectionHandler.js b/packages/core/src/handler/mxConnectionHandler.js
index 04fea9691..ddb3b3637 100644
--- a/packages/core/src/handler/mxConnectionHandler.js
+++ b/packages/core/src/handler/mxConnectionHandler.js
@@ -596,12 +596,12 @@ class mxConnectionHandler extends mxEventSource {
}
// Uses connectable parent vertex if one exists
- if (cell != null && !self.graph.isCellConnectable(cell)) {
+ if (cell != null && !cell.isConnectable()) {
const parent = self.cell.getParent();
if (
parent.isVertex() &&
- self.graph.isCellConnectable(parent)
+ parent.isConnectable()
) {
cell = parent;
}
@@ -1206,7 +1206,7 @@ class mxConnectionHandler extends mxEventSource {
// are not equal (due to grid snapping) and there is no hit on shape or highlight
// but ignores cases where parent is used for non-connectable child cells
if (
- this.graph.isCellConnectable(me.getCell()) &&
+ me.getCell().isConnectable() &&
this.marker.getValidState() !== me.getState()
) {
this.marker.highlight.shape.stroke = 'transparent';
diff --git a/packages/core/src/handler/mxConstraintHandler.js b/packages/core/src/handler/mxConstraintHandler.js
index 42bcd6373..c075ac75d 100644
--- a/packages/core/src/handler/mxConstraintHandler.js
+++ b/packages/core/src/handler/mxConstraintHandler.js
@@ -205,18 +205,22 @@ class mxConstraintHandler {
}
// Uses connectable parent vertex if one exists
- if (cell != null && !this.graph.isCellConnectable(cell)) {
+ if (cell != null && !cell.isConnectable()) {
const parent = this.cell.getParent();
if (
parent.isVertex() &&
- this.graph.isCellConnectable(parent)
+ parent.isConnectable()
) {
cell = parent;
}
}
- return this.graph.isCellLocked(cell) ? null : cell;
+ if (cell) {
+ return this.graph.isCellLocked(cell) ? null : cell;
+ } else {
+ return null;
+ }
}
/**
@@ -385,7 +389,7 @@ class mxConstraintHandler {
this.constraints =
state != null &&
!this.isStateIgnored(state, source) &&
- this.graph.isCellConnectable(state.cell)
+ state.cell.isConnectable()
? this.isEnabled()
? this.graph.getAllConnectionConstraints(state, source) || []
: []
diff --git a/packages/core/src/handler/mxEdgeHandler.js b/packages/core/src/handler/mxEdgeHandler.js
index 2dd7d2fcd..ae4993c5b 100644
--- a/packages/core/src/handler/mxEdgeHandler.js
+++ b/packages/core/src/handler/mxEdgeHandler.js
@@ -601,12 +601,12 @@ class mxEdgeHandler {
}
// Uses connectable parent vertex if one exists
- if (cell != null && !this.graph.isCellConnectable(cell)) {
+ if (cell != null && !cell.isConnectable()) {
const parent = this.cell.getParent();
if (
parent.isVertex() &&
- this.graph.isCellConnectable(parent)
+ parent.isConnectable()
) {
cell = parent;
}
@@ -632,7 +632,7 @@ class mxEdgeHandler {
cell = null;
}
- if (!this.graph.isCellConnectable(cell)) {
+ if (cell && !cell.isConnectable()) {
cell = null;
}
return cell;
@@ -1523,7 +1523,7 @@ class mxEdgeHandler {
this.marker.highlight.repaint();
} else if (this.marker.hasValidState()) {
this.marker.highlight.shape.stroke =
- this.graph.isCellConnectable(me.getCell()) &&
+ me.getCell().isConnectable() &&
this.marker.getValidState() !== me.getState()
? 'transparent'
: mxConstants.DEFAULT_VALID_COLOR;
@@ -1661,7 +1661,7 @@ class mxEdgeHandler {
} else if (
terminalState != null &&
terminalState !== me.getState() &&
- this.graph.isCellConnectable(me.getCell()) &&
+ me.getCell().isConnectable() &&
this.marker.highlight.shape != null
) {
this.marker.highlight.shape.stroke = 'transparent';
diff --git a/packages/core/src/handler/mxGraphHandler.js b/packages/core/src/handler/mxGraphHandler.js
index d8a6dd11c..526311d11 100644
--- a/packages/core/src/handler/mxGraphHandler.js
+++ b/packages/core/src/handler/mxGraphHandler.js
@@ -1109,7 +1109,7 @@ class mxGraphHandler {
cell != null &&
this.cells.length === 1 &&
cell.isVertex() &&
- graph.isCellConnectable(cell)
+ cell.isConnectable()
) {
state = graph.getView().getState(cell);
@@ -1603,9 +1603,10 @@ class mxGraphHandler {
this.target == null &&
cell != null &&
cell.isVertex() &&
- graph.isCellConnectable(cell) &&
+ cell.isConnectable() &&
graph.isEdgeValid(null, this.cell, cell)
) {
+ alert("CONNECT")
graph.connectionHandler.connect(this.cell, cell, me.getEvent());
} else {
const clone =
@@ -1615,9 +1616,10 @@ class mxGraphHandler {
const { scale } = graph.getView();
const dx = this.roundLength(this.currentDx / scale);
const dy = this.roundLength(this.currentDy / scale);
- const { target } = this;
+ const target = this.target;
if (
+ target &&
graph.isSplitEnabled() &&
graph.isSplitTarget(target, this.cells, me.getEvent())
) {
diff --git a/packages/core/src/handler/mxVertexHandler.js b/packages/core/src/handler/mxVertexHandler.js
index 89ecc7b94..2470ebd8d 100644
--- a/packages/core/src/handler/mxVertexHandler.js
+++ b/packages/core/src/handler/mxVertexHandler.js
@@ -1223,7 +1223,7 @@ class mxVertexHandler {
// Shifts the children according to parent offset
if (
- !this.graph.isCellCollapsed(this.state.cell) &&
+ !this.state.cell.isCollapsed() &&
(dx3 !== 0 || dy3 !== 0)
) {
this.childOffsetX = this.state.x - this.bounds.x + dx5;
diff --git a/packages/core/src/layout/hierarchical/mxHierarchicalLayout.js b/packages/core/src/layout/hierarchical/mxHierarchicalLayout.js
index edb1e9cbe..cb25152a7 100644
--- a/packages/core/src/layout/hierarchical/mxHierarchicalLayout.js
+++ b/packages/core/src/layout/hierarchical/mxHierarchicalLayout.js
@@ -265,7 +265,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
try {
this.run(parent);
- if (this.resizeParent && !this.graph.isCellCollapsed(parent)) {
+ if (this.resizeParent && !parent.isCollapsed()) {
this.graph.updateGroupBounds(
[parent],
this.parentBorder,
@@ -314,7 +314,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
for (const i in vertices) {
const cell = vertices[i];
- if (cell.isVertex() && this.graph.isCellVisible(cell)) {
+ if (cell.isVertex() && cell.isVisible()) {
const conns = this.getEdges(cell);
let fanOut = 0;
let fanIn = 0;
@@ -368,7 +368,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
const { model } = this.graph;
let edges = [];
- const isCollapsed = this.graph.isCellCollapsed(cell);
+ const isCollapsed = cell.isCollapsed();
const childCount = cell.getChildCount();
for (let i = 0; i < childCount; i += 1) {
@@ -376,7 +376,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
if (this.isPort(child)) {
edges = edges.concat(model.getEdges(child, true, true));
- } else if (isCollapsed || !this.graph.isCellVisible(child)) {
+ } else if (isCollapsed || !child.isVisible()) {
edges = edges.concat(model.getEdges(child, true, true));
}
}
@@ -577,14 +577,14 @@ class mxHierarchicalLayout extends mxGraphLayout {
if (
cell.isVertex() &&
cell !== this.parent &&
- this.graph.isCellVisible(cell)
+ cell.isVisible()
) {
result[mxObjectIdentity.get(cell)] = cell;
}
if (
this.traverseAncestors ||
- (cell === this.parent && this.graph.isCellVisible(cell))
+ (cell === this.parent && cell.isVisible())
) {
const childCount = cell.getChildCount();
diff --git a/packages/core/src/layout/hierarchical/mxSwimlaneLayout.js b/packages/core/src/layout/hierarchical/mxSwimlaneLayout.js
index 32d3f1da0..cd0b1715b 100644
--- a/packages/core/src/layout/hierarchical/mxSwimlaneLayout.js
+++ b/packages/core/src/layout/hierarchical/mxSwimlaneLayout.js
@@ -286,7 +286,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
try {
this.run(parent);
- if (this.resizeParent && !this.graph.isCellCollapsed(parent)) {
+ if (this.resizeParent && !parent.isCollapsed()) {
this.graph.updateGroupBounds(
[parent],
this.parentBorder,
@@ -429,7 +429,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
if (
cell != null &&
cell.isVertex() &&
- this.graph.isCellVisible(cell) &&
+ cell.isVisible() &&
model.isAncestor(parent, cell)
) {
const conns = this.getEdges(cell);
@@ -490,7 +490,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
const { model } = this.graph;
let edges = [];
- const isCollapsed = this.graph.isCellCollapsed(cell);
+ const isCollapsed = cell.isCollapsed();
const childCount = cell.getChildCount();
for (let i = 0; i < childCount; i += 1) {
@@ -498,7 +498,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
if (this.isPort(child)) {
edges = edges.concat(model.getEdges(child, true, true));
- } else if (isCollapsed || !this.graph.isCellVisible(child)) {
+ } else if (isCollapsed || !child.isVisible()) {
edges = edges.concat(model.getEdges(child, true, true));
}
}
@@ -713,14 +713,14 @@ class mxSwimlaneLayout extends mxGraphLayout {
cell.isVertex() &&
cell !== this.parent &&
cell.getParent() !== this.parent &&
- this.graph.isCellVisible(cell)
+ cell.isVisible()
) {
result[mxObjectIdentity.get(cell)] = cell;
}
if (
this.traverseAncestors ||
- (cell === this.parent && this.graph.isCellVisible(cell))
+ (cell === this.parent && cell.isVisible())
) {
const childCount = cell.getChildCount();
diff --git a/packages/core/src/layout/mxGraphLayout.js b/packages/core/src/layout/mxGraphLayout.js
index f5e36d2c7..73c657ee1 100644
--- a/packages/core/src/layout/mxGraphLayout.js
+++ b/packages/core/src/layout/mxGraphLayout.js
@@ -214,7 +214,7 @@ class mxGraphLayout {
isVertexIgnored(vertex) {
return (
!vertex.isVertex() ||
- !this.graph.isCellVisible(vertex)
+ !vertex.isVisible()
);
}
@@ -230,7 +230,7 @@ class mxGraphLayout {
return (
!edge.isEdge() ||
- !this.graph.isCellVisible(edge) ||
+ !edge.isVisible() ||
edge.getTerminal(true) == null ||
edge.getTerminal(false) == null
);
diff --git a/packages/core/src/layout/mxStackLayout.js b/packages/core/src/layout/mxStackLayout.js
index 31d48f7e6..248f8b432 100644
--- a/packages/core/src/layout/mxStackLayout.js
+++ b/packages/core/src/layout/mxStackLayout.js
@@ -456,7 +456,7 @@ class mxStackLayout extends mxGraphLayout {
this.resizeParent &&
pgeo != null &&
last != null &&
- !this.graph.isCellCollapsed(parent)
+ !parent.isCollapsed()
) {
this.updateParentGeometry(parent, pgeo, last);
} else if (
diff --git a/packages/core/src/view/cell/mxCell.ts b/packages/core/src/view/cell/mxCell.ts
index 6022e54e5..53dd2b018 100644
--- a/packages/core/src/view/cell/mxCell.ts
+++ b/packages/core/src/view/cell/mxCell.ts
@@ -10,6 +10,8 @@ import mxConstants from '../../util/mxConstants';
import mxGeometry from '../../util/datatypes/mxGeometry';
import mxCellOverlay from './mxCellOverlay';
import { clone } from '../../util/mxCloneUtils';
+import mxPoint from "../../util/datatypes/mxPoint";
+import mxCellPath from "./mxCellPath";
/**
* Cells are the elements of the graph model. They represent the state
@@ -707,6 +709,289 @@ class mxCell {
}
return value;
}
+
+ /**
+ * Returns the nearest common ancestor for the specified cells to `this`.
+ *
+ * @param {mxCell} cell2 that specifies the second cell in the tree.
+ */
+ // getNearestCommonAncestor(cell1: mxCell, cell2: mxCell): mxCell;
+ getNearestCommonAncestor(cell2: mxCell | null): mxCell | null {
+
+ // Creates the cell path for the second cell
+ let path = mxCellPath.create(cell2);
+
+ if (path != null && path.length > 0) {
+ // Bubbles through the ancestors of the first
+ // cell to find the nearest common ancestor.
+ let cell: mxCell | null = this;
+ let current: string | null = mxCellPath.create(cell);
+
+ // Inverts arguments
+ if (path.length < current.length) {
+ cell = cell2;
+ const tmp = current;
+ current = path;
+ path = tmp;
+ }
+
+ while (cell != null) {
+ const parent = cell.getParent();
+
+ // Checks if the cell path is equal to the beginning of the given cell path
+ if (
+ path.indexOf(current + mxCellPath.PATH_SEPARATOR) === 0 &&
+ parent != null
+ ) {
+ return cell;
+ }
+
+ current = mxCellPath.getParentPath(current);
+ cell = parent;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns true if the given parent is an ancestor of the given child. Note
+ * returns true if child == parent.
+ *
+ * @param {mxCell} child that specifies the child.
+ */
+ // isAncestor(parent: mxCell, child: mxCell): boolean;
+ isAncestor(child: mxCell | null): boolean {
+
+ while (child != null && child !== this) {
+ child = child.getParent();
+ }
+ return child === this;
+ }
+
+ /**
+ * Returns the child vertices of the given parent.
+ */
+ // getChildVertices(parent: mxCell): Array;
+ getChildVertices() {
+ return this.getChildCells(true, false);
+ }
+
+ /**
+ * Returns the child edges of the given parent.
+ */
+ // getChildEdges(parent: mxCell): Array;
+ getChildEdges(): mxCell[] {
+ return this.getChildCells(false, true);
+ }
+
+ /**
+ * Returns the children of the given cell that are vertices and/or edges
+ * depending on the arguments.
+ *
+ * @param vertices Boolean indicating if child vertices should be returned.
+ * Default is false.
+ * @param edges Boolean indicating if child edges should be returned.
+ * Default is false.
+ */
+ // getChildCells(parent: mxCell, vertices: boolean, edges: boolean): Array;
+ getChildCells(vertices: boolean=false,
+ edges: boolean=false): mxCell[] {
+
+ const childCount = this.getChildCount();
+ const result = [];
+
+ for (let i = 0; i < childCount; i += 1) {
+ const child = this.getChildAt(i);
+
+ if (
+ (!edges && !vertices) ||
+ (edges && child.isEdge()) ||
+ (vertices && child.isVertex())
+ ) {
+ result.push(child);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the number of incoming or outgoing edges, ignoring the given
+ * edge.
+ *
+ * @param outgoing Boolean that specifies if the number of outgoing or
+ * incoming edges should be returned.
+ * @param {mxCell} ignoredEdge that represents an edge to be ignored.
+ */
+ // getDirectedEdgeCount(cell: mxCell, outgoing: boolean, ignoredEdge: boolean): number;
+ getDirectedEdgeCount(outgoing: boolean,
+ ignoredEdge: mxCell | null=null): number {
+ let count = 0;
+ const edgeCount = this.getEdgeCount();
+
+ for (let i = 0; i < edgeCount; i += 1) {
+ const edge = this.getEdgeAt(i);
+ if (edge !== ignoredEdge && edge && edge.getTerminal(outgoing) === this) {
+ count += 1;
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Returns all edges of the given cell without loops.
+ */
+ // getConnections(cell: mxCell): Array;
+ getConnections() {
+ return this.getEdges(true, true, false);
+ }
+
+ /**
+ * Returns the incoming edges of the given cell without loops.
+ */
+ // getIncomingEdges(cell: mxCell): Array;
+ getIncomingEdges(): mxCell[] {
+ return this.getEdges(true, false, false);
+ }
+
+ /**
+ * Returns the outgoing edges of the given cell without loops.
+ */
+ // getOutgoingEdges(cell: mxCell): Array;
+ getOutgoingEdges(): mxCell[] {
+ return this.getEdges(false, true, false);
+ }
+
+ /**
+ * Returns all distinct edges connected to this cell as a new array of
+ * {@link mxCell}. If at least one of incoming or outgoing is true, then loops
+ * are ignored, otherwise if both are false, then all edges connected to
+ * the given cell are returned including loops.
+ *
+ * @param incoming Optional boolean that specifies if incoming edges should be
+ * returned. Default is true.
+ * @param outgoing Optional boolean that specifies if outgoing edges should be
+ * returned. Default is true.
+ * @param includeLoops Optional boolean that specifies if loops should be returned.
+ * Default is true.
+ */
+ // getEdges(cell: mxCell, incoming?: boolean, outgoing?: boolean, includeLoops?: boolean): Array;
+ getEdges(incoming: boolean=true,
+ outgoing: boolean=true,
+ includeLoops: boolean=true) {
+
+ const edgeCount = this.getEdgeCount();
+ const result = [];
+
+ for (let i = 0; i < edgeCount; i += 1) {
+ const edge = this.getEdgeAt(i);
+ const source = edge.getTerminal(true);
+ const target = edge.getTerminal(false);
+
+ if (
+ (includeLoops && source === target) ||
+ (source !== target &&
+ ((incoming && target === this) || (outgoing && source === this)))
+ ) {
+ result.push(edge);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the absolute, accumulated origin for the children inside the
+ * given parent as an {@link mxPoint}.
+ */
+ // getOrigin(cell: mxCell): mxPoint;
+ getOrigin(): mxPoint {
+ let result = null;
+
+ if (this != null) {
+ result = (this.getParent()).getOrigin();
+
+ if (!this.isEdge()) {
+ const geo = this.getGeometry();
+
+ if (geo != null) {
+ result.x += geo.x;
+ result.y += geo.y;
+ }
+ }
+ } else {
+ result = new mxPoint();
+ }
+ return result;
+ }
+
+ /**
+ * Returns all descendants of the given cell and the cell itself in an array.
+ */
+ // getDescendants(parent: mxCell): Array;
+ getDescendants(): mxCell[] {
+ return this.filterDescendants(null);
+ }
+
+ /**
+ * Visits all cells recursively and applies the specified filter function
+ * to each cell. If the function returns true then the cell is added
+ * to the resulting array. The parent and result paramters are optional.
+ * If parent is not specified then the recursion starts at {@link root}.
+ *
+ * Example:
+ * The following example extracts all vertices from a given model:
+ * ```javascript
+ * var filter(cell)
+ * {
+ * return model.isVertex(cell);
+ * }
+ * var vertices = model.filterDescendants(filter);
+ * ```
+ *
+ * @param filter JavaScript function that takes an {@link mxCell} as an argument
+ * and returns a boolean.
+ */
+ // filterDescendants(filter: (...args: any) => boolean, parent?: mxCell): Array;
+ filterDescendants(filter: Function | null): mxCell[] {
+ let parent = this;
+
+ // Creates a new array for storing the result
+ let result: mxCell[] = [];
+
+ // Recursion starts at the root of the model
+ parent = parent || this.getRoot();
+
+ // Checks if the filter returns true for the cell
+ // and adds it to the result array
+ if (filter == null || filter(parent)) {
+ result.push(parent);
+ }
+
+ // Visits the children of the cell
+ const childCount = parent.getChildCount();
+ for (let i = 0; i < childCount; i += 1) {
+ const child = parent.getChildAt(i);
+ result = result.concat(child.filterDescendants(filter));
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the root of the model or the topmost parent of the given cell.
+ */
+ // getRoot(cell?: mxCell): mxCell;
+ getRoot(): mxCell {
+ let root: mxCell = this;
+ let cell: mxCell = this;
+
+ while (cell != null) {
+ root = cell;
+ cell = cell.getParent();
+ }
+ return root;
+ }
}
export default mxCell;
diff --git a/packages/core/src/view/cell/mxCellRenderer.ts b/packages/core/src/view/cell/mxCellRenderer.ts
index be10d1f8e..2f08f29a2 100644
--- a/packages/core/src/view/cell/mxCellRenderer.ts
+++ b/packages/core/src/view/cell/mxCellRenderer.ts
@@ -717,7 +717,7 @@ class mxCellRenderer {
return (evt: mxEventObject) => {
if (this.forceControlClickHandler || graph.isEnabled()) {
- const collapse = !graph.isCellCollapsed(state.cell);
+ const collapse = !state.cell.isCollapsed();
graph.foldCells(collapse, false, [state.cell], false, evt);
mxEvent.consume(evt);
}
diff --git a/packages/core/src/view/cell/mxCells.ts b/packages/core/src/view/cell/mxCells.ts
index d2cd72ae2..b0cfd8337 100644
--- a/packages/core/src/view/cell/mxCells.ts
+++ b/packages/core/src/view/cell/mxCells.ts
@@ -2,7 +2,7 @@ import mxCell from "./mxCell";
import mxDictionary from "../../util/datatypes/mxDictionary";
import mxObjectIdentity from "../../util/datatypes/mxObjectIdentity";
-class mxCells extends Array {
+class mxCells extends Array {
constructor(...items: mxCell[]) {
super(...items);
}
diff --git a/packages/core/src/view/graph/mxGraph.ts b/packages/core/src/view/graph/mxGraph.ts
index 75a233c4b..f71d5326a 100644
--- a/packages/core/src/view/graph/mxGraph.ts
+++ b/packages/core/src/view/graph/mxGraph.ts
@@ -1330,7 +1330,7 @@ class mxGraph extends mxEventSource {
let par = cells[i].getParent();
while (par != null && par !== this.getView().currentRoot) {
- if (this.isCellCollapsed(par) || !par.isVisible()) {
+ if (par.isCollapsed() || !par.isVisible()) {
removed.push(cells[i]);
break;
}
@@ -1374,7 +1374,7 @@ class mxGraph extends mxEventSource {
const newParent = change.child.getParent();
this.getView().invalidate(change.child, true, true);
- if (!this.getModel().contains(newParent) || this.isCellCollapsed(newParent)) {
+ if (!this.getModel().contains(newParent) || newParent.isCollapsed()) {
this.getView().invalidate(change.child, true, true);
this.removeStateForCell(change.child);
@@ -4470,7 +4470,7 @@ class mxGraph extends mxEventSource {
for (let i = 0; i < cells.length; i += 1) {
if (
(!checkFoldable || this.isCellFoldable(cells[i], collapse)) &&
- collapse !== this.isCellCollapsed(cells[i])
+ collapse !== cells[i].isCollapsed()
) {
this.getModel().setCollapsed(cells[i], collapse);
this.swapBounds(cells[i], collapse);
@@ -4678,7 +4678,7 @@ class mxGraph extends mxEventSource {
let geo = cell.getGeometry();
if (size != null && geo != null) {
- const collapsed = this.isCellCollapsed(cell);
+ const collapsed = cell.isCollapsed();
geo = geo.clone();
if (this.isSwimlane(cell)) {
@@ -5186,7 +5186,7 @@ class mxGraph extends mxEventSource {
const parent = cell.getParent();
let p = parent.getGeometry();
- if (parent != null && p != null && !this.isCellCollapsed(parent)) {
+ if (parent != null && p != null && !parent.isCollapsed()) {
const geo = cell.getGeometry();
if (
@@ -5640,7 +5640,7 @@ class mxGraph extends mxEventSource {
if (max != null) {
const cells = [cell];
- if (!this.isCellCollapsed(cell)) {
+ if (!cell.isCollapsed()) {
const desc = this.getModel().getDescendants(cell);
for (let i = 0; i < desc.length; i += 1) {
@@ -7742,7 +7742,7 @@ class mxGraph extends mxEventSource {
let warning = '';
// Adds error for invalid children if collapsed (children invisible)
- if (cell && this.isCellCollapsed(cell) && !isValid) {
+ if (cell && cell.isCollapsed() && !isValid) {
warning += `${mxResources.get(this.containsValidationErrorsResource) ||
this.containsValidationErrorsResource}\n`;
}
@@ -7859,7 +7859,7 @@ class mxGraph extends mxEventSource {
this.foldingEnabled &&
!state.cell.isEdge()
) {
- const tmp = this.isCellCollapsed(state.cell);
+ const tmp = (state.cell).isCollapsed();
if (this.isCellFoldable(state.cell, !tmp)) {
return tmp ? this.collapsedImage : this.expandedImage;
@@ -9313,7 +9313,7 @@ class mxGraph extends mxEventSource {
(cell == null && this.allowDanglingEdges) ||
(cell != null &&
(!cell.isEdge() || this.connectableEdges) &&
- this.isCellConnectable(cell))
+ cell.isConnectable())
);
}
@@ -9666,7 +9666,7 @@ class mxGraph extends mxEventSource {
(!cell.isEdge() &&
(this.isSwimlane(cell) ||
(cell.getChildCount() > 0 &&
- !this.isCellCollapsed(cell)))))
+ !cell.isCollapsed()))))
);
}
@@ -9687,7 +9687,7 @@ class mxGraph extends mxEventSource {
target.isEdge() &&
cells != null &&
cells.length == 1 &&
- this.isCellConnectable(cells[0]) &&
+ cells[0].isConnectable() &&
this.getEdgeValidationError(
target,
target.getTerminal(true),
@@ -10142,7 +10142,7 @@ class mxGraph extends mxEventSource {
recurse: boolean=false): mxCell[] {
let edges: mxCell[] = [];
- const isCollapsed = this.isCellCollapsed(cell);
+ const isCollapsed = cell.isCollapsed();
const childCount = cell.getChildCount();
for (let i = 0; i < childCount; i += 1) {
diff --git a/packages/core/src/view/graph/mxGraphModel.ts b/packages/core/src/view/graph/mxGraphModel.ts
index 028fceda4..3e749ecdc 100644
--- a/packages/core/src/view/graph/mxGraphModel.ts
+++ b/packages/core/src/view/graph/mxGraphModel.ts
@@ -345,76 +345,20 @@ class mxGraphModel extends mxEventSource {
return new mxCells(...cells).filterCells(filter);
}
- /**
- * Returns all descendants of the given cell and the cell itself in an array.
- *
- * @param {mxCell} parent whose descendants should be returned.
- */
- // getDescendants(parent: mxCell): Array;
getDescendants(parent: mxCell): mxCell[] {
- return this.filterDescendants(null, parent);
+ // SLATED FOR DELETION
+ return parent.getDescendants();
}
- /**
- * Visits all cells recursively and applies the specified filter function
- * to each cell. If the function returns true then the cell is added
- * to the resulting array. The parent and result paramters are optional.
- * If parent is not specified then the recursion starts at {@link root}.
- *
- * Example:
- * The following example extracts all vertices from a given model:
- * ```javascript
- * var filter(cell)
- * {
- * return model.isVertex(cell);
- * }
- * var vertices = model.filterDescendants(filter);
- * ```
- *
- * @param filter JavaScript function that takes an {@link mxCell} as an argument
- * and returns a boolean.
- * @param parent Optional {@link mxCell} that is used as the root of the recursion.
- */
- // filterDescendants(filter: (...args: any) => boolean, parent?: mxCell): Array;
filterDescendants(filter: Function | null,
parent: mxCell): mxCell[] {
- // Creates a new array for storing the result
- let result: mxCell[] = [];
-
- // Recursion starts at the root of the model
- parent = parent || this.getRoot();
-
- // Checks if the filter returns true for the cell
- // and adds it to the result array
- if (filter == null || filter(parent)) {
- result.push(parent);
- }
-
- // Visits the children of the cell
- const childCount = parent.getChildCount();
- for (let i = 0; i < childCount; i += 1) {
- const child = parent.getChildAt(i);
- result = result.concat(this.filterDescendants(filter, child));
- }
-
- return result;
+ // SLATED FOR DELETION
+ return parent.filterDescendants(filter);
}
- /**
- * Returns the root of the model or the topmost parent of the given cell.
- *
- * @param cell Optional {@link mxCell} that specifies the child.
- */
- // getRoot(cell?: mxCell): mxCell;
getRoot(cell: mxCell | null = null): mxCell | null {
- let root = cell || this.root;
- if (cell != null) {
- while (cell != null) {
- root = cell;
- cell = cell.getParent();
- }
- }
- return root;
+ // SLATED FOR DELETION
+ return cell ? cell.getRoot() : this.root;
}
/**
@@ -479,21 +423,10 @@ class mxGraphModel extends mxEventSource {
return this.isRoot(cell.getParent());
}
- /**
- * Returns true if the given parent is an ancestor of the given child. Note
- * returns true if child == parent.
- *
- * @param {mxCell} parent that specifies the parent.
- * @param {mxCell} child that specifies the child.
- */
- // isAncestor(parent: mxCell, child: mxCell): boolean;
isAncestor(parent: mxCell | null,
child: mxCell | null): boolean {
-
- while (child != null && child !== parent) {
- child = child.getParent();
- }
- return child === parent;
+ // SLATED FOR DELETION
+ return parent?.isAncestor(child) || false;
}
/**
@@ -700,8 +633,8 @@ class mxGraphModel extends mxEventSource {
if (this.isAncestor(root, source) && this.isAncestor(root, target)) {
if (source === target) {
cell = source ? source.getParent() : null;
- } else {
- cell = this.getNearestCommonAncestor(source, target);
+ } else if (source) {
+ cell = source.getNearestCommonAncestor(target);
}
if (
@@ -728,75 +661,15 @@ class mxGraphModel extends mxEventSource {
}
}
- /**
- * Returns the absolute, accumulated origin for the children inside the
- * given parent as an {@link mxPoint}.
- */
- // getOrigin(cell: mxCell): mxPoint;
getOrigin(cell: mxCell): mxPoint {
- let result = null;
-
- if (cell != null) {
- result = this.getOrigin(cell.getParent());
-
- if (!cell.isEdge()) {
- const geo = cell.getGeometry();
-
- if (geo != null) {
- result.x += geo.x;
- result.y += geo.y;
- }
- }
- } else {
- result = new mxPoint();
- }
- return result;
+ // SLATED FOR DELETION
+ return cell.getOrigin();
}
- /**
- * Returns the nearest common ancestor for the specified cells.
- *
- * @param {mxCell} cell1 that specifies the first cell in the tree.
- * @param {mxCell} cell2 that specifies the second cell in the tree.
- */
- // getNearestCommonAncestor(cell1: mxCell, cell2: mxCell): mxCell;
- getNearestCommonAncestor(cell1: mxCell | null,
- cell2: mxCell | null): mxCell | null {
-
- // Creates the cell path for the second cell
- let path = mxCellPath.create(cell2);
-
- if (path != null && path.length > 0) {
- // Bubbles through the ancestors of the first
- // cell to find the nearest common ancestor.
- let cell = cell1;
- let current: string | null = mxCellPath.create(cell);
-
- // Inverts arguments
- if (path.length < current.length) {
- cell = cell2;
- const tmp = current;
- current = path;
- path = tmp;
- }
-
- while (cell != null) {
- const parent = cell.getParent();
-
- // Checks if the cell path is equal to the beginning of the given cell path
- if (
- path.indexOf(current + mxCellPath.PATH_SEPARATOR) === 0 &&
- parent != null
- ) {
- return cell;
- }
-
- current = mxCellPath.getParentPath(current);
- cell = parent;
- }
- }
-
- return null;
+ getNearestCommonAncestor(cell1: mxCell,
+ cell2: mxCell): mxCell | null {
+ // SLATED FOR DELETION
+ return cell1.getNearestCommonAncestor(cell2);
}
/**
@@ -912,56 +785,21 @@ class mxGraphModel extends mxEventSource {
return cell.children || [];
}
- /**
- * Returns the child vertices of the given parent.
- *
- * @param {mxCell} cell whose child vertices should be returned.
- */
- // getChildVertices(parent: mxCell): Array;
getChildVertices(parent: mxCell) {
- return this.getChildCells(parent, true, false);
+ // SLATED FOR DELETION
+ return parent.getChildVertices();
}
- /**
- * Returns the child edges of the given parent.
- *
- * @param {mxCell} cell whose child edges should be returned.
- */
- // getChildEdges(parent: mxCell): Array;
getChildEdges(parent: mxCell): mxCell[] {
- return this.getChildCells(parent, false, true);
+ // SLATED FOR DELETION
+ return parent.getChildEdges();
}
- /**
- * Returns the children of the given cell that are vertices and/or edges
- * depending on the arguments.
- *
- * @param {mxCell} cell the represents the parent.
- * @param vertices Boolean indicating if child vertices should be returned.
- * Default is false.
- * @param edges Boolean indicating if child edges should be returned.
- * Default is false.
- */
- // getChildCells(parent: mxCell, vertices: boolean, edges: boolean): Array;
getChildCells(parent: mxCell,
vertices: boolean=false,
edges: boolean=false): mxCell[] {
-
- const childCount = parent.getChildCount();
- const result = [];
-
- for (let i = 0; i < childCount; i += 1) {
- const child = parent.getChildAt(i);
-
- if (
- (!edges && !vertices) ||
- (edges && child.isEdge()) ||
- (vertices && child.isVertex())
- ) {
- result.push(child);
- }
- }
- return result;
+ // SLATED FOR DELETION
+ return parent.getChildCells(vertices, edges);
}
/**
@@ -1073,102 +911,34 @@ class mxGraphModel extends mxEventSource {
return cell.getEdgeAt(index);
}
- /**
- * Returns the number of incoming or outgoing edges, ignoring the given
- * edge.
- *
- * @param {mxCell} cell whose edge count should be returned.
- * @param outgoing Boolean that specifies if the number of outgoing or
- * incoming edges should be returned.
- * @param {mxCell} ignoredEdge that represents an edge to be ignored.
- */
- // getDirectedEdgeCount(cell: mxCell, outgoing: boolean, ignoredEdge: boolean): number;
getDirectedEdgeCount(cell: mxCell,
outgoing: boolean,
ignoredEdge: mxCell | null=null): number {
- let count = 0;
- const edgeCount = cell.getEdgeCount();
-
- for (let i = 0; i < edgeCount; i += 1) {
- const edge = cell.getEdgeAt(i);
- if (edge !== ignoredEdge && edge && edge.getTerminal(outgoing) === cell) {
- count += 1;
- }
- }
- return count;
+ // SLATED FOR DELETION
+ return cell.getDirectedEdgeCount(outgoing, ignoredEdge)
}
- /**
- * Returns all edges of the given cell without loops.
- *
- * @param {mxCell} cell whose edges should be returned.
- *
- */
- // getConnections(cell: mxCell): Array;
getConnections(cell: mxCell) {
- return this.getEdges(cell, true, true, false);
+ // SLATED FOR DELETION
+ return cell.getConnections();
}
- /**
- * Returns the incoming edges of the given cell without loops.
- *
- * @param {mxCell} cell whose incoming edges should be returned.
- *
- */
- // getIncomingEdges(cell: mxCell): Array;
getIncomingEdges(cell: mxCell): mxCell[] {
- return this.getEdges(cell, true, false, false);
+ // SLATED FOR DELETION
+ return cell.getIncomingEdges();
}
- /**
- * Returns the outgoing edges of the given cell without loops.
- *
- * @param {mxCell} cell whose outgoing edges should be returned.
- *
- */
- // getOutgoingEdges(cell: mxCell): Array;
getOutgoingEdges(cell: mxCell): mxCell[] {
- return this.getEdges(cell, false, true, false);
+ // SLATED FOR DELETION
+ return cell.getOutgoingEdges();
}
- /**
- * Returns all distinct edges connected to this cell as a new array of
- * {@link mxCell}. If at least one of incoming or outgoing is true, then loops
- * are ignored, otherwise if both are false, then all edges connected to
- * the given cell are returned including loops.
- *
- * @param {mxCell} cell that specifies the cell.
- * @param incoming Optional boolean that specifies if incoming edges should be
- * returned. Default is true.
- * @param outgoing Optional boolean that specifies if outgoing edges should be
- * returned. Default is true.
- * @param includeLoops Optional boolean that specifies if loops should be returned.
- * Default is true.
- */
- // getEdges(cell: mxCell, incoming?: boolean, outgoing?: boolean, includeLoops?: boolean): Array;
getEdges(cell: mxCell,
incoming: boolean=true,
outgoing: boolean=true,
includeLoops: boolean=true) {
-
- const edgeCount = cell.getEdgeCount();
- const result = [];
-
- for (let i = 0; i < edgeCount; i += 1) {
- const edge = cell.getEdgeAt(i);
- const source = edge.getTerminal(true);
- const target = edge.getTerminal(false);
-
- if (
- (includeLoops && source === target) ||
- (source !== target &&
- ((incoming && target === cell) || (outgoing && source === cell)))
- ) {
- result.push(edge);
- }
- }
-
- return result;
+ // SLATED FOR DELETION
+ return cell.getEdges(incoming, outgoing, includeLoops);
}
/**
diff --git a/packages/core/src/view/graph/mxGraphView.ts b/packages/core/src/view/graph/mxGraphView.ts
index 25803aa18..7e47a05a2 100644
--- a/packages/core/src/view/graph/mxGraphView.ts
+++ b/packages/core/src/view/graph/mxGraphView.ts
@@ -859,7 +859,7 @@ class mxGraphView extends mxEventSource {
this.validateCell(
cell.getChildAt(i),
visible &&
- (!this.isCellCollapsed(cell) || cell === this.currentRoot)
+ (!cell.isCollapsed() || cell === this.currentRoot)
);
}
}
@@ -1020,7 +1020,8 @@ class mxGraphView extends mxEventSource {
*/
// isCellCollapsed(cell: mxCell): boolean;
isCellCollapsed(cell: mxCell): boolean {
- return (this.graph).isCellCollapsed(cell);
+ // SLATED FOR DELETION
+ return cell.isCollapsed();
}
/**
@@ -1837,7 +1838,7 @@ class mxGraphView extends mxEventSource {
let best = result;
while (result != null && result != this.currentRoot) {
- if ((best && !best.isVisible()) || this.isCellCollapsed(result)) {
+ if ((best && !best.isVisible()) || result.isCollapsed()) {
best = result;
}
diff --git a/src/pages/layout/SwimLanes.js b/src/pages/layout/SwimLanes.js
index defa281fd..1cc0ddd95 100644
--- a/src/pages/layout/SwimLanes.js
+++ b/src/pages/layout/SwimLanes.js
@@ -236,7 +236,7 @@ class SwimLanes extends React.Component {
// Changes swimlane orientation while collapsed
const getStyle = function() {
let style = super.getStyle();
- if (this.isCellCollapsed()) {
+ if (this.isCollapsed()) {
if (style != null) {
style += ';';
} else {
diff --git a/src/pages/layout/Tree.js b/src/pages/layout/Tree.js
index 8a396c5bb..99fb43298 100644
--- a/src/pages/layout/Tree.js
+++ b/src/pages/layout/Tree.js
@@ -188,7 +188,7 @@ class Tree extends React.Component {
}
// Stops recursion if a collapsed cell is seen
- return vertex === cell || !this.isCellCollapsed(vertex);
+ return vertex === cell || !vertex.isCollapsed();
});
this.toggleCells(show, cells, true);