changed mxGraph.getCellGeometry(cell) calls to be cell.getGeometry() directly

development
mcyph 2021-04-25 12:12:27 +10:00
parent cace21a0a9
commit 6191c9944d
31 changed files with 210 additions and 195 deletions

View File

@ -131,7 +131,7 @@ export default MYNAMEHERE;
// incoming/outgoing direction.
graph.getAllConnectionConstraints = function(terminal)
{
let geo = (terminal != null) ? this.getCellGeometry(terminal.cell) : null;
let geo = (terminal != null) ? terminal.cell.getGeometry() : null;
if ((geo != null ? !geo.relative : false) &&
this.getModel().isVertex(terminal.cell) &&
@ -153,7 +153,7 @@ export default MYNAMEHERE;
}
else
{
let geo = (cell != null) ? this.graph.getCellGeometry(cell) : null;
let geo = (cell != null) ? cell.getGeometry() : null;
return (geo != null) ? geo.relative : false;
}
@ -510,7 +510,7 @@ export default MYNAMEHERE;
let s = this.scale;
let tr = this.translate;
let orig = edge.origin;
let geo = this.graph.getCellGeometry(edge.cell);
let geo = edge.cell.getGeometry();
pt = geo.getTerminalPoint(source);
// Computes edge-to-edge connection point

View File

@ -124,7 +124,7 @@ Actions.prototype.init = function()
if (cells.length == 1 && includeEdges)
{
let geo = graph.getCellGeometry(cells[0]);
let geo = cells[0].getGeometry();
if (geo != null)
{
@ -156,7 +156,7 @@ Actions.prototype.init = function()
if (graph.isEnabled() && cell != null && cell.isVertex())
{
let geo = graph.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null)
{
@ -179,7 +179,7 @@ Actions.prototype.init = function()
{
if (cells[i].isVertex())
{
let geo = graph.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (geo != null)
{
@ -599,7 +599,7 @@ Actions.prototype.init = function()
else
{
let state = graph.view.getState(cell);
let geo = graph.getCellGeometry(cell);
let geo = cell.getGeometry();
if (cell.isVertex() && state != null && state.text != null &&
geo != null && graph.isWrapping(cell))
@ -1251,15 +1251,15 @@ Actions.prototype.init = function()
let dy = t.y;
let parent = cell.getParent();
let pgeo = graph.getCellGeometry(parent);
let pgeo = parent.getGeometry();
while (parent.isVertex() && pgeo != null)
{
dx += pgeo.x;
dy += pgeo.y;
parent = parent.getParent();
pgeo = graph.getCellGeometry(parent);
pgeo = parent.getGeometry();
}
let x = Math.round(graph.snap(graph.popupMenuHandler.triggerX / s - dx));
@ -1297,7 +1297,7 @@ Actions.prototype.init = function()
if (cell.isEdge())
{
let geo = graph.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null)
{

View File

@ -2578,7 +2578,7 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
}
else if (cells[i].isVertex())
{
let geo = this.graph.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (geo != null && geo.relative)
{
@ -2691,7 +2691,7 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
if (immediate)
{
let geo = (cell.isEdge()) ? null :
this.graph.getCellGeometry(cell);
cell.getGeometry();
result = !parent.isEdge() &&
!this.graph.isSiblingSelected(cell) &&

View File

@ -1204,14 +1204,14 @@ EditorUi.prototype.installShapePicker = function()
this.graph.connectVertex(state.cell, dir, this.graph.defaultEdgeLength, evt, null, null, mxUtils.bind(this, function(x, y, execute)
{
let temp = graph.getCompositeParent(state.cell);
let geo = graph.getCellGeometry(temp);
let geo = temp.getGeometry();
me.consume();
while (temp != null && graph.model.isVertex(temp) && geo != null && geo.relative)
{
cell = temp;
temp = cell.getParent()
geo = graph.getCellGeometry(temp);
geo = temp.getGeometry();
}
// Asynchronous to avoid direct insert after double tap
@ -1645,7 +1645,7 @@ EditorUi.prototype.initClipboard = function()
if (state != null)
{
let geo = graph.getCellGeometry(clones[i]);
let geo = clones[i].getGeometry();
if (geo != null && geo.relative && !result[i].isEdge() &&
lookup[mxObjectIdentity.get(result[i].getParent())] == null)
@ -4595,7 +4595,7 @@ EditorUi.prototype.createKeyHandler = function(editor)
{
if (cells[i].isVertex() && graph.isCellResizable(cells[i]))
{
let geo = graph.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (geo != null)
{

View File

@ -142,7 +142,7 @@ Format.prototype.updateSelectionStateForCell = function(result, cell, cells)
result.cell = result.cell || graph.isTableCell(cell);
result.row = result.row || graph.isTableRow(cell);
result.vertices.push(cell);
let geo = graph.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null)
{
@ -2426,7 +2426,7 @@ ArrangePanel.prototype.addGeometryHandler = function(input, fn)
{
if (cells[i].isVertex())
{
let geo = graph.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (geo != null)
{
@ -2498,7 +2498,7 @@ ArrangePanel.prototype.addEdgeGeometryHandler = function(input, fn)
{
if (cells[i].isEdge())
{
let geo = graph.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (geo != null)
{

View File

@ -3152,12 +3152,12 @@ Graph.prototype.connectVertex = function(source, direction, length, evt, forceCl
{
// Handles relative children
let cellToClone = (targetCell != null) ? targetCell : source;
let geo = this.getCellGeometry(cellToClone);
let geo = cellToClone.getGeometry();
while (geo != null && geo.relative)
{
cellToClone = cellToClone.getParent();
geo = this.getCellGeometry(cellToClone);
geo = cellToClone.getGeometry();
}
// Handles composite cells for cloning
@ -3169,7 +3169,7 @@ Graph.prototype.connectVertex = function(source, direction, length, evt, forceCl
this.addCells([realTarget], source.getParent(), null, null, null, true);
}
let geo = this.getCellGeometry(realTarget);
let geo = realTarget.getGeometry();
if (geo != null)
{
@ -3471,7 +3471,7 @@ Graph.prototype.foldCells = function(collapse, recurse, cells, checkFoldable, ev
for (let i = 0; i < cells.length; i++)
{
let state = this.view.getState(cells[i]);
let geo = this.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (state != null && geo != null)
{
@ -3529,7 +3529,7 @@ Graph.prototype.moveSiblings = function(state, parent, dx, dy)
if (cells[i] != state.cell)
{
let tmp = this.view.getState(cells[i]);
let geo = this.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (tmp != null && geo != null)
{
@ -3563,7 +3563,7 @@ Graph.prototype.resizeParentStacks = function(parent, layout, dx, dy)
while (parent != null && layout != null && layout.constructor == mxStackLayout &&
layout.horizontal == dir && !layout.resizeLast)
{
let pgeo = this.getCellGeometry(parent);
let pgeo = parent.getGeometry();
let pstate = this.view.getState(parent);
if (pstate != null && pgeo != null)
@ -4583,11 +4583,11 @@ HoverIcons.prototype.repaint = function()
bottom = null;
}
let currentGeo = this.graph.getCellGeometry(this.currentState.cell);
let currentGeo = this.currentState.cell.getGeometry();
let checkCollision = mxUtils.bind(this, function(cell, arrow)
{
let geo = cell.isVertex() && this.graph.getCellGeometry(cell);
let geo = cell.isVertex() && cell.getGeometry();
// Ignores collision if vertex is more than 3 times the size of this vertex
if (cell != null && !this.graph.model.isAncestor(cell, this.currentState.cell) &&
@ -4830,7 +4830,7 @@ Graph.prototype.createParent = function(parent, child, childCount, dx, dy)
for (let i = 0; i < childCount; i++)
{
let clone = this.cloneCell(child);
let geo = this.getCellGeometry(clone)
let geo = clone.getGeometry()
if (geo != null)
{
@ -4976,7 +4976,7 @@ Graph.prototype.setTableRowHeight = function(row, dy, extend)
model.beginUpdate();
try
{
let rgeo = this.getCellGeometry(row);
let rgeo = row.getGeometry();
// Sets height of row
if (rgeo != null)
@ -4996,7 +4996,7 @@ Graph.prototype.setTableRowHeight = function(row, dy, extend)
if (index < rows.length - 1)
{
let nextRow = rows[index + 1];
let geo = this.getCellGeometry(nextRow);
let geo = nextRow.getGeometry();
if (geo != null)
{
@ -5010,7 +5010,7 @@ Graph.prototype.setTableRowHeight = function(row, dy, extend)
}
// Updates height of table
let tgeo = this.getCellGeometry(table);
let tgeo = table.getGeometry();
if (tgeo != null)
{
@ -5065,7 +5065,7 @@ Graph.prototype.setTableColumnWidth = function(col, dx, extend)
row = rows[i];
cells = model.getChildCells(row, true);
let cell = cells[index];
let geo = this.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null)
{
@ -5078,7 +5078,7 @@ Graph.prototype.setTableColumnWidth = function(col, dx, extend)
if (index < cells.length - 1)
{
cell = cells[index + 1];
let geo = this.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null)
{
@ -5098,7 +5098,7 @@ Graph.prototype.setTableColumnWidth = function(col, dx, extend)
if (lastColumn || extend)
{
// Updates width of table
let tgeo = this.getCellGeometry(table);
let tgeo = table.getGeometry();
if (tgeo != null)
{
@ -5167,7 +5167,7 @@ TableLayout.prototype.getSize = function(cells, horizontal)
{
if (!this.isVertexIgnored(cells[i]))
{
let geo = this.graph.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (geo != null)
{
@ -5195,7 +5195,7 @@ TableLayout.prototype.getRowLayout = function(row, width)
for (let i = 0; i < cells.length; i++)
{
let cell = this.graph.getCellGeometry(cells[i]);
let cell = cells[i].getGeometry();
if (cell != null)
{
@ -5228,7 +5228,7 @@ TableLayout.prototype.layoutRow = function(row, positions, height, tw)
for (let i = 0; i < cells.length; i++)
{
let cell = this.graph.getCellGeometry(cells[i]);
let cell = cells[i].getGeometry();
if (cell != null)
{
@ -5280,7 +5280,7 @@ TableLayout.prototype.execute = function(parent)
if (parent != null)
{
let offset = this.graph.getActualStartSize(parent, true);
let table = this.graph.getCellGeometry(parent);
let table = parent.getGeometry();
let style = this.graph.getCellStyle(parent);
let resizeLastRow = mxUtils.getValue(style,
'resizeLastRow', '0') == '1';
@ -5303,7 +5303,7 @@ TableLayout.prototype.execute = function(parent)
{
if (resizeLastRow)
{
let row = this.graph.getCellGeometry(rows[rows.length - 1]);
let row = rows[rows.length - 1].getGeometry();
if (row != null)
{
@ -5319,7 +5319,7 @@ TableLayout.prototype.execute = function(parent)
// Updates row geometries
for (let i = 0; i < rows.length; i++)
{
let row = this.graph.getCellGeometry(rows[i]);
let row = rows[i].getGeometry();
if (row != null)
{
@ -6520,7 +6520,7 @@ if (typeof mxVertexHandler != 'undefined')
if (state != null)
{
let geo = this.getCellGeometry(clones[i]);
let geo = clones[i].getGeometry();
if (geo != null && geo.relative && !cells[i].isEdge() &&
dict.get(cells[i].getParent()) == null)
@ -6698,7 +6698,7 @@ if (typeof mxVertexHandler != 'undefined')
if (target != null && this.isTableRow(cells[i]))
{
let parent = cells[i].getParent();
let row = this.getCellGeometry(cells[i]);
let row = cells[i].getGeometry();
if (this.isTable(parent))
{
@ -6712,7 +6712,7 @@ if (typeof mxVertexHandler != 'undefined')
{
if (!clone)
{
let table = this.getCellGeometry(parent);
let table = parent.getGeometry();
if (table != null)
{
@ -6722,7 +6722,7 @@ if (typeof mxVertexHandler != 'undefined')
}
}
let table = this.getCellGeometry(target);
let table = target.getGeometry();
if (table != null)
{
@ -6769,8 +6769,8 @@ if (typeof mxVertexHandler != 'undefined')
for (let j = 0; j < cols.length; j++)
{
let geo = this.getCellGeometry(cols[j]);
var geo2 = this.getCellGeometry(sourceCols[j]);
let geo = cols[j].getGeometry();
var geo2 = sourceCols[j].getGeometry();
if (geo != null && geo2 != null)
{
@ -7008,7 +7008,7 @@ if (typeof mxVertexHandler != 'undefined')
if (child.isVertex())
{
let geometry = this.getCellGeometry(child);
let geometry = child.getGeometry();
if (geometry != null && !geometry.relative)
{
@ -7161,7 +7161,7 @@ if (typeof mxVertexHandler != 'undefined')
}
else if (cell.isVertex())
{
let geo = this.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null)
{
@ -8097,8 +8097,8 @@ if (typeof mxVertexHandler != 'undefined')
// Extends tables
if (this.isTable(parent))
{
let row = this.getCellGeometry(clones[i]);
let table = this.getCellGeometry(parent);
let row = clones[i].getGeometry();
let table = parent.getGeometry();
if (row != null && table != null)
{
@ -8302,7 +8302,7 @@ if (typeof mxVertexHandler != 'undefined')
for (let i = 1; i < vertices.length - 1; i++)
{
let pstate = this.view.getState(vertices[i].cell.getParent());
let geo = this.getCellGeometry(vertices[i].cell);
let geo = vertices[i].cell.getGeometry();
t0 += dt;
if (geo != null && pstate != null)
@ -8818,8 +8818,8 @@ if (typeof mxVertexHandler != 'undefined')
if (this.isTable(parent))
{
let row = this.getCellGeometry(cells[i]);
let table = this.getCellGeometry(parent);
let row = cells[i].getGeometry();
let table = parent.getGeometry();
if (row != null && table != null)
{
@ -8901,13 +8901,13 @@ if (typeof mxVertexHandler != 'undefined')
{
let child = model.getChildCells(rows[i], true)[index];
let clone = model.cloneCell(child, false);
let geo = this.getCellGeometry(clone);
let geo = clone.getGeometry();
clone.value = null;
if (geo != null)
{
dw = geo.width;
let rowGeo = this.getCellGeometry(rows[i]);
let rowGeo = rows[i].getGeometry();
if (rowGeo != null)
{
@ -8918,7 +8918,7 @@ if (typeof mxVertexHandler != 'undefined')
model.add(rows[i], clone, index + ((before) ? 0 : 1));
}
let tableGeo = this.getCellGeometry(table);
let tableGeo = table.getGeometry();
if (tableGeo != null)
{
@ -8967,7 +8967,7 @@ if (typeof mxVertexHandler != 'undefined')
row = model.cloneCell(row, false);
row.value = null;
let rowGeo = this.getCellGeometry(row);
let rowGeo = row.getGeometry();
if (rowGeo != null)
{
@ -8977,7 +8977,7 @@ if (typeof mxVertexHandler != 'undefined')
row.insert(cell);
cell.value = null;
let geo = this.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null)
{
@ -8987,7 +8987,7 @@ if (typeof mxVertexHandler != 'undefined')
model.add(table, row, index + ((before) ? 0 : 1));
let tableGeo = this.getCellGeometry(table);
let tableGeo = table.getGeometry();
if (tableGeo != null)
{
@ -9062,7 +9062,7 @@ if (typeof mxVertexHandler != 'undefined')
let child = model.getChildCells(rows[i], true)[index];
model.remove(child);
let geo = this.getCellGeometry(child);
let geo = child.getGeometry();
if (geo != null)
{
@ -9070,7 +9070,7 @@ if (typeof mxVertexHandler != 'undefined')
}
}
let tableGeo = this.getCellGeometry(table);
let tableGeo = table.getGeometry();
if (tableGeo != null)
{
@ -9128,14 +9128,14 @@ if (typeof mxVertexHandler != 'undefined')
model.remove(row);
let height = 0;
let geo = this.getCellGeometry(row);
let geo = row.getGeometry();
if (geo != null)
{
height = geo.height;
}
let tableGeo = this.getCellGeometry(table);
let tableGeo = table.getGeometry();
if (tableGeo != null)
{
@ -9617,7 +9617,7 @@ if (typeof mxVertexHandler != 'undefined')
// Enables focus outline for edges and edge labels
let parent = this.cell.getParent();
let geo = this.graph.getCellGeometry(cell);
let geo = cell.getGeometry();
if ((parent.isEdge() && geo != null && geo.relative) ||
cell.isEdge(cell))
@ -10160,7 +10160,7 @@ if (typeof mxVertexHandler != 'undefined')
if (style['childLayout'] == null)
{
let parent = cell.getParent();
let geo = (parent != null) ? this.graph.getCellGeometry(parent) : null;
let geo = (parent != null) ? parent.getGeometry() : null;
if (geo != null)
{
@ -11110,7 +11110,7 @@ if (typeof mxVertexHandler != 'undefined')
if (this.graph.isCellMovable(cells[i]))
{
let tmp = this.graph.view.getState(cells[i]);
let geo = this.graph.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (tmp != null && geo != null)
{
@ -11334,7 +11334,7 @@ if (typeof mxVertexHandler != 'undefined')
{
let model = this.graph.getModel();
let parent = cells[0].getParent();
let geo = this.graph.getCellGeometry(cells[0]);
let geo = cells[0].getGeometry();
if (parent.isEdge() && geo != null && geo.relative)
{
@ -11377,7 +11377,7 @@ if (typeof mxVertexHandler != 'undefined')
{
let model = this.graph.getModel();
let parent = state.cell.getParent();
let geo = this.graph.getCellGeometry(state.cell);
let geo = state.cell.getGeometry();
if (parent.isEdge() && geo != null && geo.relative && state.width < 2 && state.height < 2 && state.text != null && state.text.boundingBox != null)
{
@ -11398,7 +11398,7 @@ if (typeof mxVertexHandler != 'undefined')
{
let model = this.graph.getModel();
let parent = this.state.cell.getParent();
let geo = this.graph.getCellGeometry(this.state.cell);
let geo = this.state.cell.getGeometry();
// Lets rotation events through
let handle = this.getHandleForEvent(me);

View File

@ -791,7 +791,7 @@ Menus.prototype.edgeStyleChange = function(menu, label, keys, values, sprite, pa
{
if (reset)
{
let geo = graph.getCellGeometry(cell);
let geo = cell.getGeometry();
// Resets all edge points
if (geo != null)

View File

@ -44,7 +44,7 @@
for (let i = 0; i < cols.length; i++)
{
let clr = (mxUtils.mod(i, 2) == 1) ? evenColColor : oddColColor;
let geo = graph.getCellGeometry(cols[i]);
let geo = cols[i].getGeometry();
if (geo != null && clr != mxConstants.NONE)
{
@ -75,7 +75,7 @@
for (let i = 0; i < rows.length; i++)
{
let clr = (mxUtils.mod(i, 2) == 1) ? evenRowColor : oddRowColor;
let geo = graph.getCellGeometry(rows[i]);
let geo = rows[i].getGeometry();
if (geo != null && clr != mxConstants.NONE)
{
@ -193,7 +193,7 @@
{
for (let i = 1; i < rows.length; i++)
{
let geo = graph.getCellGeometry(rows[i]);
let geo = rows[i].getGeometry();
if (geo != null)
{
@ -213,7 +213,7 @@
// Paints column lines
for (let i = 1; i < cols.length; i++)
{
let geo = graph.getCellGeometry(cols[i]);
let geo = cols[i].getGeometry();
if (geo != null)
{

View File

@ -2818,8 +2818,8 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
graph.model.beginUpdate();
try
{
let sourceGeo = graph.getCellGeometry(source);
var geo2 = graph.getCellGeometry(targets[dropCellIndex]);
let sourceGeo = source.getGeometry();
var geo2 = targets[dropCellIndex].getGeometry();
// Handles special case where target should be ignored for stack layouts
let targetParent = source.getParent();
@ -2917,7 +2917,7 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
{
// Adds new outgoing connection to vertex and clears points
graph.model.setTerminal(targets[dropCellIndex], source, true);
var geo3 = graph.getCellGeometry(targets[dropCellIndex]);
var geo3 = targets[dropCellIndex].getGeometry();
geo3.points = null;
if (geo3.getTerminalPoint(false) != null)
@ -2936,7 +2936,7 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
}
else
{
geo2 = graph.getCellGeometry(targets[dropCellIndex]);
geo2 = targets[dropCellIndex].getGeometry();
dx = geo.x - Math.round(geo2.x);
dy = geo.y - Math.round(geo2.y);
geo.x = Math.round(geo2.x);
@ -2984,8 +2984,8 @@ Sidebar.prototype.getDropAndConnectGeometry = function(source, target, direction
let graph = this.editorUi.editor.graph;
let view = graph.view;
let keepSize = targets.length > 1;
let geo = graph.getCellGeometry(source);
var geo2 = graph.getCellGeometry(target);
let geo = source.getGeometry();
var geo2 = target.getGeometry();
if (geo != null && geo2 != null)
{
@ -3097,7 +3097,7 @@ Sidebar.prototype.getDropAndConnectGeometry = function(source, target, direction
if (target.isEdge() && geo2.getTerminalPoint(true) != null &&
target.getTerminal(false) != null)
{
let targetGeo = graph.getCellGeometry(target.getTerminal(false));
let targetGeo = target.getTerminal(false) && target.getTerminal(false).getGeometry();
if (targetGeo != null)
{
@ -3371,8 +3371,8 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
let index = (currentTargetState.cell.isEdge() || freeSourceEdge == null) ? firstVertex : freeSourceEdge;
let geo = sidebar.getDropAndConnectGeometry(currentTargetState.cell, cells[index], direction, cells);
var geo2 = (!currentTargetState.cell.isEdge()) ? graph.getCellGeometry(currentTargetState.cell) : null;
var geo3 = graph.getCellGeometry(cells[index]);
var geo2 = (!currentTargetState.cell.isEdge()) ? currentTargetState.cell.getGeometry() : null;
var geo3 = cells[index].getGeometry();
let parent = currentTargetState.cell.getParent();
let dx = view.translate.x * view.scale;
let dy = view.translate.y * view.scale;

View File

@ -2215,11 +2215,11 @@ class mxConnectionHandler extends mxEventSource {
// createTargetVertex(evt: MouseEvent, source: mxCell): mxCell;
createTargetVertex(evt, source) {
// Uses the first non-relative source
let geo = this.graph.getCellGeometry(source);
let geo = source.getGeometry();
while (geo != null && geo.relative) {
source = source.getParent();
geo = this.graph.getCellGeometry(source);
geo = source.getGeometry();
}
const clone = this.graph.cloneCell(source);

View File

@ -771,7 +771,7 @@ class mxEdgeHandler {
isHandleVisible(index) {
const source = this.state.getVisibleTerminalState(true);
const target = this.state.getVisibleTerminalState(false);
const geo = this.graph.getCellGeometry(this.state.cell);
const geo = this.state.cell.getGeometry();
const edgeStyle =
geo != null
? this.graph.view.getEdgeStyle(this.state, geo.points, source, target)
@ -1309,7 +1309,7 @@ class mxEdgeHandler {
*/
// getPreviewPoints(pt: mxPoint, me?: mxMouseEvent): mxPoint[];
getPreviewPoints(pt, me) {
const geometry = this.graph.getCellGeometry(this.state.cell);
const geometry = this.state.cell.getGeometry();
let points = geometry.points != null ? geometry.points.slice() : null;
const point = new mxPoint(pt.x, pt.y);
let result = null;
@ -2149,7 +2149,7 @@ class mxEdgeHandler {
*/
// addPointAt(state: mxCellState, x: number, y: number): void;
addPointAt(state, x, y) {
let geo = this.graph.getCellGeometry(state.cell);
let geo = state.cell.getGeometry();
const pt = new mxPoint(x, y);
if (geo != null) {
@ -2191,7 +2191,7 @@ class mxEdgeHandler {
// removePoint(state: mxCellState, index: number): void;
removePoint(state, index) {
if (index > 0 && index < this.abspoints.length - 1) {
let geo = this.graph.getCellGeometry(this.state.cell);
let geo = this.state.cell.getGeometry();
if (geo != null && geo.points != null) {
geo = geo.clone();

View File

@ -463,7 +463,7 @@ class mxGraphHandler {
if (immediate) {
const geo = cell.isEdge()
? null
: this.graph.getCellGeometry(cell);
: cell.getGeometry();
return (
!this.graph.isSiblingSelected(cell) &&
@ -1339,7 +1339,7 @@ class mxGraphHandler {
const state = states[i][0];
if (state.cell.isEdge()) {
const geometry = this.graph.getCellGeometry(state.cell);
const geometry = state.cell.getGeometry();
const points = [];
if (geometry != null && geometry.points != null) {

View File

@ -1089,7 +1089,7 @@ class mxVertexHandler {
dx = tx;
dy = ty;
const geo = this.graph.getCellGeometry(this.state.cell);
const geo = this.state.cell.getGeometry();
this.unscaledBounds = this.union(
geo,
dx / scale,
@ -1277,7 +1277,7 @@ class mxVertexHandler {
// Required to store and reset absolute offset for updating label position
this.state.absoluteOffset.x = 0;
this.state.absoluteOffset.y = 0;
const geo = this.graph.getCellGeometry(this.state.cell);
const geo = this.state.cell.getGeometry();
if (geo != null) {
const offset = geo.offset || this.EMPTY_POINT;
@ -1473,10 +1473,10 @@ class mxVertexHandler {
this.graph.setCellStyles(mxConstants.STYLE_ROTATION, total, [cell]);
}
let geo = this.graph.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null) {
const pgeo = this.graph.getCellGeometry(parent);
const pgeo = parent.getGeometry();
if (pgeo != null && !parent.isEdge()) {
geo = geo.clone();
@ -1641,7 +1641,7 @@ class mxVertexHandler {
for (let i = 0; i < childCount; i += 1) {
const child = cell.getChildAt(i);
let geo = this.graph.getCellGeometry(child);
let geo = child.getGeometry();
if (geo != null) {
geo = geo.clone();
@ -1773,7 +1773,7 @@ class mxVertexHandler {
let height = bottom - top;
if (constrained) {
const geo = this.graph.getCellGeometry(this.state.cell);
const geo = this.state.cell.getGeometry();
if (geo != null) {
const aspect = geo.width / geo.height;

View File

@ -238,7 +238,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
parent.isVertex() != null &&
this.maintainParentLocation
) {
const geo = this.graph.getCellGeometry(parent);
const geo = parent.getGeometry();
if (geo != null) {
this.parentX = geo.x;
@ -275,7 +275,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
// Maintaining parent location
if (this.parentX != null && this.parentY != null) {
let geo = this.graph.getCellGeometry(parent);
let geo = parent.getGeometry();
if (geo != null) {
geo = geo.clone();

View File

@ -253,7 +253,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
parent.isVertex() != null &&
this.maintainParentLocation
) {
const geo = this.graph.getCellGeometry(parent);
const geo = parent.getGeometry();
if (geo != null) {
this.parentX = geo.x;
@ -296,7 +296,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
// Maintaining parent location
if (this.parentX != null && this.parentY != null) {
let geo = this.graph.getCellGeometry(parent);
let geo = parent.getGeometry();
if (geo != null) {
geo = geo.clone();
@ -337,7 +337,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
for (let i = 0; i < this.swimlanes.length; i += 1) {
const lane = this.swimlanes[i];
const geo = this.graph.getCellGeometry(lane);
const geo = lane.getGeometry();
if (geo != null) {
const children = this.graph.getChildCells(lane);
@ -371,7 +371,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
for (let i = 0; i < this.swimlanes.length; i += 1) {
const lane = this.swimlanes[i];
const geo = this.graph.getCellGeometry(lane);
const geo = lane.getGeometry();
if (geo != null) {
const children = this.graph.getChildCells(lane);

View File

@ -306,7 +306,7 @@ class mxCompactTreeLayout extends mxGraphLayout {
parent.isVertex() != null &&
this.maintainParentLocation
) {
const geo = this.graph.getCellGeometry(parent);
const geo = parent.getGeometry();
if (geo != null) {
this.parentX = geo.x;
@ -376,7 +376,7 @@ class mxCompactTreeLayout extends mxGraphLayout {
// Maintaining parent location
if (this.parentX != null && this.parentY != null) {
let geo = this.graph.getCellGeometry(parent);
let geo = parent.getGeometry();
if (geo != null) {
geo = geo.clone();

View File

@ -247,8 +247,8 @@ class mxStackLayout extends mxGraphLayout {
if (this.allowGaps) {
cells.sort((c1, c2) => {
const geo1 = this.graph.getCellGeometry(c1);
const geo2 = this.graph.getCellGeometry(c2);
const geo1 = c1.getGeometry();
const geo2 = c2.getGeometry();
return this.horizontal
? geo1.x === geo2.x
@ -496,7 +496,7 @@ class mxStackLayout extends mxGraphLayout {
* geo - The specific geometry of <mxGeometry>.
*/
setChildGeometry(child, geo) {
const geo2 = this.graph.getCellGeometry(child);
const geo2 = child.getGeometry();
if (
geo2 == null ||

View File

@ -62,7 +62,7 @@ class mxGraphViewCodec extends mxObjectCodec {
if (parent == null || state != null) {
const childCount = cell.getChildCount();
const geo = view.graph.getCellGeometry(cell);
const geo = cell.getGeometry();
let name = null;
if (parent === model.getRoot()) {

View File

@ -206,13 +206,13 @@ class mxMorphing extends mxAnimation {
if (cell != null) {
const parent = this.cell.getParent();
const geo = this.graph.getCellGeometry(cell);
const geo = cell.getGeometry();
result = this.getOriginForCell(parent);
// TODO: Handle offsets
if (geo != null) {
if (geo.relative) {
const pgeo = this.graph.getCellGeometry(parent);
const pgeo = parent.getGeometry();
if (pgeo != null) {
result.x += geo.x * pgeo.width;

View File

@ -121,7 +121,7 @@ class mxEdgeStyle {
let isSourceLeft = false;
if (source != null) {
const sourceGeometry = graph.getCellGeometry(source.cell);
const sourceGeometry = source.cell.getGeometry();
if (sourceGeometry.relative) {
isSourceLeft = sourceGeometry.x <= 0.5;
@ -158,7 +158,7 @@ class mxEdgeStyle {
let isTargetLeft = true;
if (target != null) {
const targetGeometry = graph.getCellGeometry(target.cell);
const targetGeometry = target.cell.getGeometry();
if (targetGeometry.relative) {
isTargetLeft = targetGeometry.x <= 0.5;

View File

@ -1150,7 +1150,7 @@ class mxCellRenderer {
bounds.x += spacing.x * scale;
bounds.y += spacing.y * scale;
const geo = graph.getCellGeometry(state.cell);
const geo = state.cell.getGeometry();
if (geo != null) {
bounds.width = Math.max(0, geo.width * scale);

View File

@ -480,6 +480,19 @@ class mxCellState extends mxRectangle {
destroy(): void {
(<mxGraph>(<mxGraphView>this.view).graph).cellRenderer.destroy(this);
}
/**
* Returns true if the given cell state is a loop.
*
* @param state {@link mxCellState} that represents a potential loop.
*/
// isLoop(state: mxCellState): boolean;
isLoop(): boolean {
const src = this.getVisibleTerminalState(true);
const trg = this.getVisibleTerminalState(false);
return src != null && src == trg;
}
}
export default mxCellState;

View File

@ -179,7 +179,7 @@ class mxCellStatePreview {
state.view.updateCellState(state);
}
const geo = this.graph.getCellGeometry(<mxCell>state.cell);
const geo = (<mxCell>state.cell).getGeometry();
const pState = state.view.getState(<mxCell>state.cell.getParent());
// Moves selection vertices which are relative

View File

@ -188,9 +188,10 @@ class mxGraph extends mxEventSource {
// mouseListeners: any[];
mouseListeners: any[] | null = null;
/**
/*****************************************************************************
* Group: Variables
*/
*****************************************************************************/
/**
* Holds the state of the mouse button.
*/
@ -1453,9 +1454,9 @@ class mxGraph extends mxEventSource {
this.getView().removeState(cell);
}
/**
/*****************************************************************************
* Group: Overlays
*/
*****************************************************************************/
/**
* Adds an {@link mxCellOverlay} for the specified cell. This method fires an
@ -1653,9 +1654,9 @@ class mxGraph extends mxEventSource {
return null;
}
/**
/*****************************************************************************
* Group: In-place editing
*/
*****************************************************************************/
/**
* Calls {@link startEditingAtCell} using the given cell or the first selection
@ -1804,9 +1805,9 @@ class mxGraph extends mxEventSource {
}
}
/**
/*****************************************************************************
* Group: Event processing
*/
*****************************************************************************/
/**
* Processes an escape keystroke.
@ -2559,9 +2560,9 @@ class mxGraph extends mxEventSource {
drawPageBreaks(this.verticalPageBreaks);
}
/**
/*****************************************************************************
* Group: Cell styles
*/
*****************************************************************************/
/**
* Returns the style for the given cell from the cell state, if one exists,
@ -2795,9 +2796,9 @@ class mxGraph extends mxEventSource {
}
}
/**
/*****************************************************************************
* Group: Cell alignment and orientation
*/
*****************************************************************************/
/**
* Aligns the given cells vertically or horizontally according to the given
@ -2863,7 +2864,7 @@ class mxGraph extends mxEventSource {
const state = this.getView().getState(cells[i]);
if (state != null) {
let geo = this.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (geo != null && !cells[i].isEdge()) {
geo = <mxGeometry>geo.clone();
@ -2992,9 +2993,9 @@ class mxGraph extends mxEventSource {
return null;
}
/**
/*****************************************************************************
* Group: Order
*/
*****************************************************************************/
/**
* Moves the given cells to the front or back. The change is carried out
@ -3062,9 +3063,9 @@ class mxGraph extends mxEventSource {
}
}
/**
/*****************************************************************************
* Group: Grouping
*/
*****************************************************************************/
/**
* Adds the cells into the given group. The change is carried out using
@ -3105,7 +3106,7 @@ class mxGraph extends mxEventSource {
try {
// Checks if the group has a geometry and
// creates one if one does not exist
if (this.getCellGeometry(group) == null) {
if (group.getGeometry() == null) {
this.getModel().setGeometry(group, new mxGeometry());
}
@ -3259,7 +3260,7 @@ class mxGraph extends mxEventSource {
// Fix relative child cells
for (let j = 0; j < children.length; j++) {
const state = this.getView().getState(children[j]);
let geo = this.getCellGeometry(children[j]);
let geo = children[j].getGeometry();
if (state != null && geo != null && geo.relative) {
geo = <mxGeometry>geo.clone();
@ -3385,7 +3386,7 @@ class mxGraph extends mxEventSource {
this.getModel().beginUpdate();
try {
for (let i = cells.length - 1; i >= 0; i--) {
let geo = this.getCellGeometry(cells[i]);
let geo = cells[i].getGeometry();
if (geo != null) {
const children = <mxCell[]>this.getChildCells(cells[i]);
@ -3474,9 +3475,9 @@ class mxGraph extends mxEventSource {
return result;
}
/**
/*****************************************************************************
* Group: Cell cloning, insertion and removal
*/
*****************************************************************************/
/**
* Returns the clone for the given cell. Uses {@link cloneCells}.
@ -4263,7 +4264,7 @@ class mxGraph extends mxEventSource {
// Removes waypoints before/after new cell
const state = this.getView().getState(edge);
let geo = this.getCellGeometry(newEdge);
let geo = newEdge.getGeometry();
if (geo != null && geo.points != null && state != null) {
const t = this.getView().translate;
@ -4275,7 +4276,7 @@ class mxGraph extends mxEventSource {
);
geo.points = geo.points.slice(0, idx);
geo = <mxGeometry>this.getCellGeometry(edge);
geo = <mxGeometry>edge.getGeometry();
if (geo != null && geo.points != null) {
geo = <mxGeometry>geo.clone();
@ -4325,9 +4326,9 @@ class mxGraph extends mxEventSource {
return newEdge;
}
/**
/*****************************************************************************
* Group: Cell visibility
*/
*****************************************************************************/
/**
* Sets the visible state of the specified cells and all connected edges
@ -4393,9 +4394,9 @@ class mxGraph extends mxEventSource {
}
}
/**
/*****************************************************************************
* Group: Folding
*/
*****************************************************************************/
/**
* Sets the collapsed state of the specified cells and all descendants
@ -4629,9 +4630,9 @@ class mxGraph extends mxEventSource {
return edges;
}
/**
/*****************************************************************************
* Group: Cell sizing
*/
*****************************************************************************/
/**
* Updates the size of the given cell in the model using {@link cellSizeUpdated}.
@ -4948,7 +4949,7 @@ class mxGraph extends mxEventSource {
* {
* if (graph.getModel().getChildCount(cells[i]) > 0)
* {
* var geo = graph.getCellGeometry(cells[i]);
* var geo = cells[i].getGeometry();
*
* if (geo != null)
* {
@ -5183,10 +5184,10 @@ class mxGraph extends mxEventSource {
extendParent(cell: mxCell | null=null): void {
if (cell != null) {
const parent = <mxCell>cell.getParent();
let p = this.getCellGeometry(parent);
let p = parent.getGeometry();
if (parent != null && p != null && !this.isCellCollapsed(parent)) {
const geo = this.getCellGeometry(cell);
const geo = cell.getGeometry();
if (
geo != null &&
@ -5204,9 +5205,9 @@ class mxGraph extends mxEventSource {
}
}
/**
/*****************************************************************************
* Group: Cell moving
*/
*****************************************************************************/
/**
* Clones and inserts the given cells into the graph using the move
@ -5298,7 +5299,7 @@ class mxGraph extends mxEventSource {
const checked = [];
for (let i = 0; i < cells.length; i += 1) {
const geo = this.getCellGeometry(cells[i]);
const geo = cells[i].getGeometry();
const parent = cells[i].getParent();
if (
@ -5351,7 +5352,7 @@ class mxGraph extends mxEventSource {
// Restores parent edge on cloned edge labels
if (clone) {
for (let i = 0; i < cells.length; i += 1) {
const geo = this.getCellGeometry(cells[i]);
const geo = cells[i].getGeometry();
const parent = <mxCell>origCells[i].getParent();
if (
@ -5589,14 +5590,14 @@ class mxGraph extends mxEventSource {
sizeFirst: boolean=true): void {
if (cell != null) {
let geo = this.getCellGeometry(cell);
let geo = cell.getGeometry();
if (
geo != null &&
(this.isConstrainRelativeChildren() || !geo.relative)
) {
const parent = cell.getParent();
const pgeo = this.getCellGeometry(<mxCell>parent);
const pgeo = (<mxCell>parent).getGeometry();
let max = this.getMaximumGraphBounds();
// Finds parent offset
@ -5776,9 +5777,9 @@ class mxGraph extends mxEventSource {
return edge;
}
/**
/*****************************************************************************
* Group: Cell connecting and connection constraints
*/
*****************************************************************************/
/**
* Returns the constraint used to connect to the outline of the given state.
@ -6369,9 +6370,9 @@ class mxGraph extends mxEventSource {
}
}
/**
/*****************************************************************************
* Group: Drilldown
*/
*****************************************************************************/
/**
* Returns the current root of the displayed cell hierarchy. This is a
@ -6429,7 +6430,7 @@ class mxGraph extends mxEventSource {
* ```javascript
* graph.isPort = function(cell)
* {
* var geo = this.getCellGeometry(cell);
* var geo = cell.getGeometry();
*
* return (geo != null) ? geo.relative : false;
* };
@ -6555,9 +6556,9 @@ class mxGraph extends mxEventSource {
return cell != null;
}
/**
/*****************************************************************************
* Group: Graph display
*/
*****************************************************************************/
/**
* Returns the bounds of the visible graph. Shortcut to
@ -6657,7 +6658,7 @@ class mxGraph extends mxEventSource {
for (const cell of cells) {
if (includeEdges || cell.isVertex()) {
// Computes the bounding box for the points in the geometry
const geo = this.getCellGeometry(cell);
const geo = cell.getGeometry();
if (geo != null) {
let bbox = null;
@ -7390,6 +7391,7 @@ class mxGraph extends mxEventSource {
*/
// getCellGeometry(cell: mxCell): mxGeometry;
getCellGeometry(cell: mxCell): mxGeometry | null {
// SLATED FOR DELETION
return cell.getGeometry();
}
@ -7406,6 +7408,7 @@ class mxGraph extends mxEventSource {
*/
// isCellVisible(cell: mxCell): boolean;
isCellVisible(cell: mxCell): boolean {
// SLATED FOR DELETION
return cell.isVisible();
}
@ -7473,9 +7476,8 @@ class mxGraph extends mxEventSource {
*/
// isLoop(state: mxCellState): boolean;
isLoop(state: mxCellState): boolean {
const src = state.getVisibleTerminalState(true);
const trg = state.getVisibleTerminalState(false);
return src != null && src == trg;
// SLATED FOR DELETION
return state.isLoop();
}
/**
@ -7503,7 +7505,7 @@ class mxGraph extends mxEventSource {
* pressed on any other platform.
*/
// isToggleEvent(evt: MouseEvent): boolean;
isToggleEvent(evt: mxEventObject | mxMouseEvent | mxMouseEvent): boolean {
isToggleEvent(evt: mxEventObject | mxMouseEvent): boolean {
return mxClient.IS_MAC
? isMetaDown(evt)
: isControlDown(evt);
@ -7534,9 +7536,9 @@ class mxGraph extends mxEventSource {
return false;
}
/**
/*****************************************************************************
* Group: Validation
*/
*****************************************************************************/
/**
* Displays the given validation error in a dialog. This implementation uses
@ -7824,9 +7826,9 @@ class mxGraph extends mxEventSource {
return null;
}
/**
/*****************************************************************************
* Group: Graph appearance
*/
*****************************************************************************/
/**
* Returns the {@link backgroundImage} as an {@link mxImage}.
@ -7917,7 +7919,7 @@ class mxGraph extends mxEventSource {
*
* if (label != null && this.model.isVertex(cell))
* {
* var geo = this.getCellGeometry(cell);
* var geo = cell.getCellGeometry();
*
* if (geo != null)
* {
@ -8452,9 +8454,9 @@ class mxGraph extends mxEventSource {
return false;
}
/**
/*****************************************************************************
* Group: Graph behaviour
*/
*****************************************************************************/
/**
* Returns {@link resizeContainer}.
@ -9775,9 +9777,9 @@ class mxGraph extends mxEventSource {
return !this.getModel().isLayer(<mxCell>cell) && parent == null ? cell : null;
}
/**
/*****************************************************************************
* Group: Cell retrieval
*/
*****************************************************************************/
/**
* Returns {@link defaultParent} or {@link mxGraphView.currentRoot} or the first child
@ -10485,9 +10487,9 @@ class mxGraph extends mxEventSource {
return result;
}
/**
/*****************************************************************************
* Group: Tree and traversal-related
*/
*****************************************************************************/
/**
* Returns all children in the given parent which do not have incoming
@ -10624,9 +10626,9 @@ class mxGraph extends mxEventSource {
}
}
/**
/*****************************************************************************
* Group: Selection
*/
*****************************************************************************/
/**
* Returns true if the given cell is selected.
@ -10969,9 +10971,9 @@ class mxGraph extends mxEventSource {
}
}
/**
/*****************************************************************************
* Group: Selection state
*/
*****************************************************************************/
/**
* Creates a new handler for the given cell state. This implementation
@ -10988,7 +10990,7 @@ class mxGraph extends mxEventSource {
if (state.cell.isEdge()) {
const source = state.getVisibleTerminalState(true);
const target = state.getVisibleTerminalState(false);
const geo = this.getCellGeometry(<mxCell>state.cell);
const geo = (<mxCell>state.cell).getGeometry();
const edgeStyle = this.getView().getEdgeStyle(
state,
@ -11062,9 +11064,9 @@ class mxGraph extends mxEventSource {
return new mxElbowEdgeHandler(state);
}
/**
/*****************************************************************************
* Group: Graph events
*/
*****************************************************************************/
/**
* Adds a listener to the graph event dispatch loop. The listener

View File

@ -965,7 +965,7 @@ class mxGraphView extends mxEventSource {
origin.y += offset.y;
}
const geo = (<mxGraph>this.graph).getCellGeometry(<mxCell>state.cell);
const geo = (<mxCell>state.cell).getGeometry();
if (geo != null) {
if (!state.cell.isEdge()) {
@ -1293,7 +1293,7 @@ class mxGraphView extends mxEventSource {
const s = this.scale;
const tr = this.translate;
const orig = <mxPoint>edge.origin;
const geo = <mxGeometry>(<mxGraph>this.graph).getCellGeometry(<mxCell>edge.cell);
const geo = <mxGeometry>(<mxCell>edge.cell).getGeometry();
pt = geo.getTerminalPoint(source);
if (pt != null) {
@ -2107,7 +2107,7 @@ class mxGraphView extends mxEventSource {
absoluteOffset.y = state.getCenterY();
if (points != null && points.length > 0 && state.segments != null) {
const geometry = <mxGeometry>(<mxGraph>this.graph).getCellGeometry(<mxCell>state.cell);
const geometry = <mxGeometry>(<mxCell>state.cell).getGeometry();
if (geometry.relative) {
const offset = this.getPoint(state, geometry);

View File

@ -58,7 +58,7 @@ class HelloPort extends React.Component {
// Ports are not used as terminals for edges, they are
// only used to compute the graphical connection point
graph.isPort = function(cell) {
const geo = this.getCellGeometry(cell);
const geo = cell.getGeometry();
return geo != null ? geo.relative : false;
};

View File

@ -137,7 +137,7 @@ class Clipboard extends React.Component {
const state = graph.view.getState(cells[i]);
if (state != null) {
const geo = graph.getCellGeometry(clones[i]);
const geo = clones[i].getGeometry();
if (geo != null && geo.relative) {
geo.relative = false;

View File

@ -77,12 +77,12 @@ class Morph extends React.Component {
graph.getModel().beginUpdate();
try {
let geo = graph.getCellGeometry(v1);
let geo = v1.getGeometry();
geo = geo.clone();
geo.x += 180 * mult;
graph.getModel().setGeometry(v1, geo);
geo = graph.getCellGeometry(v2);
geo = v2.getGeometry();
geo = geo.clone();
geo.x -= 180 * mult;
graph.getModel().setGeometry(v2, geo);

View File

@ -55,7 +55,7 @@ class Boundary extends React.Component {
for (let i = 0; i < childCount; i++) {
const child = cell.getChildAt(i);
const geo = this.getCellGeometry(child);
const geo = child.getGeometry();
if (geo != null && geo.relative) {
return false;

View File

@ -139,7 +139,7 @@ class AutoLayout extends React.Component {
// Installs a handler for clicks on the overlay
overlay.addListener(mxEvent.CLICK, (sender, evt2) => {
graph.clearSelection();
const geo = graph.getCellGeometry(cell);
const geo = cell.getGeometry();
let v2;

View File

@ -300,7 +300,7 @@ class Stencils extends React.Component {
const cell = graph.getSelectionCell();
if (cell != null) {
let geo = graph.getCellGeometry(cell);
let geo = cell.getGeometry();
if (geo != null) {
graph.getModel().beginUpdate();