reverted to using mxCell functions directly rather than through mxGraphModel
parent
233b1fec21
commit
b0d978fb8e
|
@ -201,7 +201,7 @@ export default Ports;
|
||||||
cell != null &&
|
cell != null &&
|
||||||
this.isCellEditable(cell))
|
this.isCellEditable(cell))
|
||||||
{
|
{
|
||||||
if (this.model.isEdge(cell) ||
|
if (cell.isEdge() ||
|
||||||
!this.isHtmlLabel(cell))
|
!this.isHtmlLabel(cell))
|
||||||
{
|
{
|
||||||
this.startEditingAtCell(cell);
|
this.startEditingAtCell(cell);
|
||||||
|
|
|
@ -158,13 +158,13 @@ export default MYNAMEHERE;
|
||||||
graph.isHtmlLabel = function(cell)
|
graph.isHtmlLabel = function(cell)
|
||||||
{
|
{
|
||||||
return !this.isSwimlane(cell) &&
|
return !this.isSwimlane(cell) &&
|
||||||
!this.model.isEdge(cell);
|
!cell.isEdge();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Edges are not editable
|
// Edges are not editable
|
||||||
graph.isCellEditable = function(cell)
|
graph.isCellEditable = function(cell)
|
||||||
{
|
{
|
||||||
return !this.model.isEdge(cell);
|
return !cell.isEdge();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns the name field of the user object for the label
|
// Returns the name field of the user object for the label
|
||||||
|
@ -185,10 +185,10 @@ export default MYNAMEHERE;
|
||||||
{
|
{
|
||||||
return 'Type: '+state.cell.value.type;
|
return 'Type: '+state.cell.value.type;
|
||||||
}
|
}
|
||||||
else if (this.model.isEdge(state.cell))
|
else if (state.cell.isEdge())
|
||||||
{
|
{
|
||||||
let source = this.model.getTerminal(state.cell, true);
|
let source = state.cell.getTerminal(true);
|
||||||
let parent = this.model.getParent(source);
|
let parent = source.getParent();
|
||||||
|
|
||||||
return parent.value.name+'.'+source.value.name;
|
return parent.value.name+'.'+source.value.name;
|
||||||
}
|
}
|
||||||
|
@ -241,10 +241,10 @@ export default MYNAMEHERE;
|
||||||
{
|
{
|
||||||
let cell = cells[i];
|
let cell = cells[i];
|
||||||
|
|
||||||
if (this.model.isEdge(cell))
|
if (cell.isEdge())
|
||||||
{
|
{
|
||||||
let terminal = this.model.getTerminal(cell, true);
|
let terminal = cell.getTerminal(true);
|
||||||
let parent = this.model.getParent(terminal);
|
let parent = terminal.getParent();
|
||||||
this.model.remove(terminal);
|
this.model.remove(terminal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,11 +296,11 @@ export default MYNAMEHERE;
|
||||||
{
|
{
|
||||||
// Finds the primary key child of the target table
|
// Finds the primary key child of the target table
|
||||||
let primaryKey = null;
|
let primaryKey = null;
|
||||||
let childCount = this.model.getChildCount(target);
|
let childCount = target.getChildCount();
|
||||||
|
|
||||||
for (var i=0; i < childCount; i++)
|
for (var i=0; i < childCount; i++)
|
||||||
{
|
{
|
||||||
let child = this.model.getChildAt(target, i);
|
let child = target.getChildAt(i);
|
||||||
|
|
||||||
if (child.value.primaryKey)
|
if (child.value.primaryKey)
|
||||||
{
|
{
|
||||||
|
@ -557,17 +557,17 @@ export default MYNAMEHERE;
|
||||||
pt.x -= pstate.x;
|
pt.x -= pstate.x;
|
||||||
pt.y -= pstate.y;
|
pt.y -= pstate.y;
|
||||||
|
|
||||||
let columnCount = graph.model.getChildCount(parent)+1;
|
let columnCount = parent.getChildCount()+1;
|
||||||
name = mxUtils.prompt('Enter name for new column', 'COLUMN'+columnCount);
|
name = mxUtils.prompt('Enter name for new column', 'COLUMN'+columnCount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let tableCount = 0;
|
let tableCount = 0;
|
||||||
let childCount = graph.model.getChildCount(parent);
|
let childCount = parent.getChildCount();
|
||||||
|
|
||||||
for (var i=0; i<childCount; i++)
|
for (var i=0; i<childCount; i++)
|
||||||
{
|
{
|
||||||
if (!graph.model.isEdge(graph.model.getChildAt(parent, i)))
|
if (!parent.getChildAt(i).isEdge())
|
||||||
{
|
{
|
||||||
tableCount++;
|
tableCount++;
|
||||||
}
|
}
|
||||||
|
@ -634,7 +634,7 @@ export default MYNAMEHERE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let parent = graph.getModel().getParent(cell);
|
let parent = cell.getParent();
|
||||||
|
|
||||||
if (graph.isSwimlane(parent))
|
if (graph.isSwimlane(parent))
|
||||||
{
|
{
|
||||||
|
@ -786,7 +786,7 @@ export default MYNAMEHERE;
|
||||||
}
|
}
|
||||||
form.addButtons(okFunction, cancelFunction);
|
form.addButtons(okFunction, cancelFunction);
|
||||||
|
|
||||||
let parent = graph.model.getParent(cell);
|
let parent = cell.getParent();
|
||||||
let name = parent.value.name + '.' + cell.value.name;
|
let name = parent.value.name + '.' + cell.value.name;
|
||||||
wnd = showModalWindow(name, form.table, 240, 240);
|
wnd = showModalWindow(name, form.table, 240, 240);
|
||||||
};
|
};
|
||||||
|
@ -795,23 +795,23 @@ export default MYNAMEHERE;
|
||||||
{
|
{
|
||||||
let sql = [];
|
let sql = [];
|
||||||
let parent = graph.getDefaultParent();
|
let parent = graph.getDefaultParent();
|
||||||
let childCount = graph.model.getChildCount(parent);
|
let childCount = parent.getChildCount();
|
||||||
|
|
||||||
for (var i=0; i<childCount; i++)
|
for (var i=0; i<childCount; i++)
|
||||||
{
|
{
|
||||||
let child = graph.model.getChildAt(parent, i);
|
let child = parent.getChildAt(i);
|
||||||
|
|
||||||
if (!graph.model.isEdge(child))
|
if (!child.isEdge())
|
||||||
{
|
{
|
||||||
sql.push('CREATE TABLE IF NOT EXISTS '+child.value.name+' (');
|
sql.push('CREATE TABLE IF NOT EXISTS '+child.value.name+' (');
|
||||||
|
|
||||||
let columnCount = graph.model.getChildCount(child);
|
let columnCount = child.getChildCount();
|
||||||
|
|
||||||
if (columnCount > 0)
|
if (columnCount > 0)
|
||||||
{
|
{
|
||||||
for (var j=0; j<columnCount; j++)
|
for (var j=0; j<columnCount; j++)
|
||||||
{
|
{
|
||||||
let column = graph.model.getChildAt(child, j).value;
|
let column = child.getChildAt(j).value;
|
||||||
|
|
||||||
sql.push('\n '+column.name+' '+column.type);
|
sql.push('\n '+column.name+' '+column.type);
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ export default Scrollbars;
|
||||||
// Override folding to allow for tables
|
// Override folding to allow for tables
|
||||||
graph.isCellFoldable = function(cell, collapse)
|
graph.isCellFoldable = function(cell, collapse)
|
||||||
{
|
{
|
||||||
return this.getModel().isVertex(cell);
|
return cell.isVertex();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Overrides connectable state
|
// Overrides connectable state
|
||||||
|
@ -229,7 +229,7 @@ export default Scrollbars;
|
||||||
let graph = state.view.graph;
|
let graph = state.view.graph;
|
||||||
let model = graph.model;
|
let model = graph.model;
|
||||||
|
|
||||||
if (model.isVertex(state.cell) && state.text != null)
|
if (state.cell.isVertex() && state.text != null)
|
||||||
{
|
{
|
||||||
// Scrollbars are on the div
|
// Scrollbars are on the div
|
||||||
let s = graph.view.scale;
|
let s = graph.view.scale;
|
||||||
|
@ -244,13 +244,13 @@ export default Scrollbars;
|
||||||
|
|
||||||
let updateEdges = mxUtils.bind(this, function()
|
let updateEdges = mxUtils.bind(this, function()
|
||||||
{
|
{
|
||||||
let edgeCount = model.getEdgeCount(state.cell);
|
let edgeCount = state.cell.getEdgeCount();
|
||||||
|
|
||||||
// Only updates edges to avoid update in DOM order
|
// Only updates edges to avoid update in DOM order
|
||||||
// for text label which would reset the scrollbar
|
// for text label which would reset the scrollbar
|
||||||
for (let i = 0; i < edgeCount; i++)
|
for (let i = 0; i < edgeCount; i++)
|
||||||
{
|
{
|
||||||
let edge = model.getEdgeAt(state.cell, i);
|
let edge = state.cell.getEdgeAt(i);
|
||||||
graph.view.invalidate(edge, true, false);
|
graph.view.invalidate(edge, true, false);
|
||||||
graph.view.validate(edge);
|
graph.view.validate(edge);
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ export default Scrollbars;
|
||||||
|
|
||||||
let edge = this.createEdge(relation);
|
let edge = this.createEdge(relation);
|
||||||
let style = this.graph.getCellStyle(edge);
|
let style = this.graph.getCellStyle(edge);
|
||||||
let state = new mxCellState(this.graph.view, edge, style);
|
let state = new mxCell(this.graph.view, edge, style);
|
||||||
|
|
||||||
// Stores the source row in the handler
|
// Stores the source row in the handler
|
||||||
this.sourceRowNode = this.currentRowNode;
|
this.sourceRowNode = this.currentRowNode;
|
||||||
|
@ -369,7 +369,7 @@ export default Scrollbars;
|
||||||
// short markup for collapsed cells.
|
// short markup for collapsed cells.
|
||||||
graph.getLabel = function(cell)
|
graph.getLabel = function(cell)
|
||||||
{
|
{
|
||||||
if (this.getModel().isVertex(cell))
|
if (cell.isVertex())
|
||||||
{
|
{
|
||||||
if (this.isCellCollapsed(cell))
|
if (this.isCellCollapsed(cell))
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,7 +113,7 @@ Actions.prototype.init = function()
|
||||||
|
|
||||||
for (let i = 0; i < cells.length && includeEdges; i++)
|
for (let i = 0; i < cells.length && includeEdges; i++)
|
||||||
{
|
{
|
||||||
includeEdges = includeEdges && graph.model.isEdge(cells[i]);
|
includeEdges = includeEdges && cells[i].isEdge();
|
||||||
}
|
}
|
||||||
|
|
||||||
let t = graph.view.translate;
|
let t = graph.view.translate;
|
||||||
|
@ -154,7 +154,7 @@ Actions.prototype.init = function()
|
||||||
{
|
{
|
||||||
let cell = graph.getSelectionCell();
|
let cell = graph.getSelectionCell();
|
||||||
|
|
||||||
if (graph.isEnabled() && cell != null && graph.getModel().isVertex(cell))
|
if (graph.isEnabled() && cell != null && cell.isVertex())
|
||||||
{
|
{
|
||||||
let geo = graph.getCellGeometry(cell);
|
let geo = graph.getCellGeometry(cell);
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ Actions.prototype.init = function()
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
if (graph.getModel().isVertex(cells[i]))
|
if (cells[i].isVertex())
|
||||||
{
|
{
|
||||||
let geo = graph.getCellGeometry(cells[i]);
|
let geo = graph.getCellGeometry(cells[i]);
|
||||||
|
|
||||||
|
@ -346,8 +346,8 @@ Actions.prototype.init = function()
|
||||||
{
|
{
|
||||||
if (graph.model.contains(cells[i]))
|
if (graph.model.contains(cells[i]))
|
||||||
{
|
{
|
||||||
if (graph.model.getChildCount(cells[i]) == 0 &&
|
if (cells[i].getChildCount() == 0 &&
|
||||||
graph.model.isVertex(cells[i]))
|
cells[i].isVertex())
|
||||||
{
|
{
|
||||||
graph.setCellStyles('container', '0', [cells[i]]);
|
graph.setCellStyles('container', '0', [cells[i]]);
|
||||||
}
|
}
|
||||||
|
@ -592,7 +592,7 @@ Actions.prototype.init = function()
|
||||||
{
|
{
|
||||||
let cell = cells[i];
|
let cell = cells[i];
|
||||||
|
|
||||||
if (graph.getModel().getChildCount(cell))
|
if (cell.getChildCount())
|
||||||
{
|
{
|
||||||
graph.updateGroupBounds([cell], 20);
|
graph.updateGroupBounds([cell], 20);
|
||||||
}
|
}
|
||||||
|
@ -601,7 +601,7 @@ Actions.prototype.init = function()
|
||||||
let state = graph.view.getState(cell);
|
let state = graph.view.getState(cell);
|
||||||
let geo = graph.getCellGeometry(cell);
|
let geo = graph.getCellGeometry(cell);
|
||||||
|
|
||||||
if (graph.getModel().isVertex(cell) && state != null && state.text != null &&
|
if (cell.isVertex() && state != null && state.text != null &&
|
||||||
geo != null && graph.isWrapping(cell))
|
geo != null && graph.isWrapping(cell))
|
||||||
{
|
{
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
@ -1046,7 +1046,7 @@ Actions.prototype.init = function()
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
if (graph.model.getChildCount(cells[i]) == 0)
|
if (cells[i].getChildCount() == 0)
|
||||||
{
|
{
|
||||||
graph.autoSizeCell(cells[i], false);
|
graph.autoSizeCell(cells[i], false);
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1210,7 @@ Actions.prototype.init = function()
|
||||||
let model = graph.getModel();
|
let model = graph.getModel();
|
||||||
|
|
||||||
let dlg = new TextareaDialog(this.editorUi, mxResources.get('editStyle') + ':',
|
let dlg = new TextareaDialog(this.editorUi, mxResources.get('editStyle') + ':',
|
||||||
model.getStyle(cells[0]) || '', function(newValue)
|
cells[0].getStyle() || '', function(newValue)
|
||||||
{
|
{
|
||||||
if (newValue != null)
|
if (newValue != null)
|
||||||
{
|
{
|
||||||
|
@ -1239,7 +1239,7 @@ Actions.prototype.init = function()
|
||||||
{
|
{
|
||||||
let cell = graph.getSelectionCell();
|
let cell = graph.getSelectionCell();
|
||||||
|
|
||||||
if (cell != null && graph.getModel().isEdge(cell))
|
if (cell != null && cell.isEdge())
|
||||||
{
|
{
|
||||||
let handler = editor.graph.selectionCellsHandler.getHandler(cell);
|
let handler = editor.graph.selectionCellsHandler.getHandler(cell);
|
||||||
|
|
||||||
|
@ -1250,15 +1250,15 @@ Actions.prototype.init = function()
|
||||||
let dx = t.x;
|
let dx = t.x;
|
||||||
let dy = t.y;
|
let dy = t.y;
|
||||||
|
|
||||||
let parent = graph.getModel().getParent(cell);
|
let parent = cell.getParent();
|
||||||
let pgeo = graph.getCellGeometry(parent);
|
let pgeo = graph.getCellGeometry(parent);
|
||||||
|
|
||||||
while (graph.getModel().isVertex(parent) && pgeo != null)
|
while (parent.isVertex() && pgeo != null)
|
||||||
{
|
{
|
||||||
dx += pgeo.x;
|
dx += pgeo.x;
|
||||||
dy += pgeo.y;
|
dy += pgeo.y;
|
||||||
|
|
||||||
parent = graph.getModel().getParent(parent);
|
parent = parent.getParent();
|
||||||
pgeo = graph.getCellGeometry(parent);
|
pgeo = graph.getCellGeometry(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1295,7 +1295,7 @@ Actions.prototype.init = function()
|
||||||
{
|
{
|
||||||
let cell = cells[i];
|
let cell = cells[i];
|
||||||
|
|
||||||
if (graph.getModel().isEdge(cell))
|
if (cell.isEdge())
|
||||||
{
|
{
|
||||||
let geo = graph.getCellGeometry(cell);
|
let geo = graph.getCellGeometry(cell);
|
||||||
|
|
||||||
|
@ -1403,7 +1403,7 @@ Actions.prototype.init = function()
|
||||||
if (w != null && h != null)
|
if (w != null && h != null)
|
||||||
{
|
{
|
||||||
let cell = cells[0];
|
let cell = cells[0];
|
||||||
let geo = graph.getModel().getGeometry(cell);
|
let geo = cell.getGeometry();
|
||||||
|
|
||||||
if (geo != null)
|
if (geo != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -651,7 +651,7 @@ let EditDiagramDialog = function(editorUi)
|
||||||
let codec = new mxCodec(doc);
|
let codec = new mxCodec(doc);
|
||||||
codec.decode(doc.documentElement, model);
|
codec.decode(doc.documentElement, model);
|
||||||
|
|
||||||
let children = model.getChildren(model.getChildAt(model.getRoot(), 0));
|
let children = model.getRoot().getChildAt(0).getChildren();
|
||||||
editorUi.editor.graph.setSelectionCells(editorUi.editor.graph.importCells(children));
|
editorUi.editor.graph.setSelectionCells(editorUi.editor.graph.importCells(children));
|
||||||
|
|
||||||
// LATER: Why is hideDialog between begin-/endUpdate faster?
|
// LATER: Why is hideDialog between begin-/endUpdate faster?
|
||||||
|
@ -1262,7 +1262,7 @@ let EditDataDialog = function(ui, cell)
|
||||||
let div = document.createElement('div');
|
let div = document.createElement('div');
|
||||||
let graph = ui.editor.graph;
|
let graph = ui.editor.graph;
|
||||||
|
|
||||||
let value = graph.getModel().getValue(cell);
|
let value = cell.getValue();
|
||||||
|
|
||||||
// Converts the value to an XML node
|
// Converts the value to an XML node
|
||||||
if (!mxUtils.isNode(value))
|
if (!mxUtils.isNode(value))
|
||||||
|
@ -1378,7 +1378,7 @@ let EditDataDialog = function(ui, cell)
|
||||||
};
|
};
|
||||||
|
|
||||||
let temp = [];
|
let temp = [];
|
||||||
let isLayer = graph.getModel().getParent(cell) == graph.getModel().getRoot();
|
let isLayer = cell.getParent() == graph.getModel().getRoot();
|
||||||
|
|
||||||
for (let i = 0; i < attrs.length; i++)
|
for (let i = 0; i < attrs.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -1584,7 +1584,7 @@ let EditDataDialog = function(ui, cell)
|
||||||
let buttons = document.createElement('div');
|
let buttons = document.createElement('div');
|
||||||
buttons.style.cssText = 'position:absolute;left:30px;right:30px;text-align:right;bottom:30px;height:40px;'
|
buttons.style.cssText = 'position:absolute;left:30px;right:30px;text-align:right;bottom:30px;height:40px;'
|
||||||
|
|
||||||
if (ui.editor.graph.getModel().isVertex(cell) || ui.editor.graph.getModel().isEdge(cell))
|
if (cell.isVertex() || cell.isEdge())
|
||||||
{
|
{
|
||||||
let replace = document.createElement('span');
|
let replace = document.createElement('span');
|
||||||
replace.style.marginRight = '10px';
|
replace.style.marginRight = '10px';
|
||||||
|
@ -1660,7 +1660,7 @@ EditDataDialog.getDisplayIdForCell = function(ui, cell)
|
||||||
{
|
{
|
||||||
let id = null;
|
let id = null;
|
||||||
|
|
||||||
if (ui.editor.graph.getModel().getParent(cell) != null)
|
if (ui.editor.cell.getParent() != null)
|
||||||
{
|
{
|
||||||
id = cell.getId();
|
id = cell.getId();
|
||||||
}
|
}
|
||||||
|
@ -2028,14 +2028,14 @@ let LayersWindow = function(editorUi, x, y, w, h)
|
||||||
graph.removeCells([selectionLayer], false);
|
graph.removeCells([selectionLayer], false);
|
||||||
|
|
||||||
// Creates default layer if no layer exists
|
// Creates default layer if no layer exists
|
||||||
if (graph.model.getChildCount(graph.model.root) == 0)
|
if (graph.model.root.getChildCount() == 0)
|
||||||
{
|
{
|
||||||
graph.model.add(graph.model.root, new mxCell());
|
graph.model.add(graph.model.root, new mxCell());
|
||||||
graph.setDefaultParent(null);
|
graph.setDefaultParent(null);
|
||||||
}
|
}
|
||||||
else if (index > 0 && index <= graph.model.getChildCount(graph.model.root))
|
else if (index > 0 && index <= graph.model.root.getChildCount())
|
||||||
{
|
{
|
||||||
graph.setDefaultParent(graph.model.getChildAt(graph.model.root, index - 1));
|
graph.setDefaultParent(graph.model.root.getChildAt(index - 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2085,7 +2085,7 @@ let LayersWindow = function(editorUi, x, y, w, h)
|
||||||
menu.addCheckmark(item, Editor.checkmarkImage);
|
menu.addCheckmark(item, Editor.checkmarkImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}))(graph.model.getChildAt(graph.model.root, i));
|
}))(graph.model.root.getChildAt(i));
|
||||||
}
|
}
|
||||||
}), offset.x, offset.y + insertLink.offsetHeight, evt);
|
}), offset.x, offset.y + insertLink.offsetHeight, evt);
|
||||||
}
|
}
|
||||||
|
@ -2201,7 +2201,7 @@ let LayersWindow = function(editorUi, x, y, w, h)
|
||||||
|
|
||||||
function refresh()
|
function refresh()
|
||||||
{
|
{
|
||||||
layerCount = graph.model.getChildCount(graph.model.root)
|
layerCount = graph.model.root.getChildCount()
|
||||||
listDiv.innerHTML = '';
|
listDiv.innerHTML = '';
|
||||||
|
|
||||||
function addLayer(index, label, child, defaultParent)
|
function addLayer(index, label, child, defaultParent)
|
||||||
|
@ -2319,7 +2319,7 @@ let LayersWindow = function(editorUi, x, y, w, h)
|
||||||
inp.style.marginTop = '4px';
|
inp.style.marginTop = '4px';
|
||||||
left.appendChild(inp);
|
left.appendChild(inp);
|
||||||
|
|
||||||
if (graph.model.isVisible(child))
|
if (child.isVisible())
|
||||||
{
|
{
|
||||||
inp.setAttribute('checked', 'checked');
|
inp.setAttribute('checked', 'checked');
|
||||||
inp.defaultChecked = true;
|
inp.defaultChecked = true;
|
||||||
|
@ -2327,7 +2327,7 @@ let LayersWindow = function(editorUi, x, y, w, h)
|
||||||
|
|
||||||
mxEvent.addListener(inp, 'click', function(evt)
|
mxEvent.addListener(inp, 'click', function(evt)
|
||||||
{
|
{
|
||||||
graph.model.setVisible(child, !graph.model.isVisible(child));
|
graph.model.setVisible(child, !child.isVisible());
|
||||||
mxEvent.consume(evt);
|
mxEvent.consume(evt);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2451,7 +2451,7 @@ let LayersWindow = function(editorUi, x, y, w, h)
|
||||||
{
|
{
|
||||||
addLayer(i, graph.convertValueToString(child) ||
|
addLayer(i, graph.convertValueToString(child) ||
|
||||||
mxResources.get('background'), child, child);
|
mxResources.get('background'), child, child);
|
||||||
}))(graph.model.getChildAt(graph.model.root, i));
|
}))(graph.model.root.getChildAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
let label = graph.convertValueToString(selectionLayer) || mxResources.get('background');
|
let label = graph.convertValueToString(selectionLayer) || mxResources.get('background');
|
||||||
|
|
|
@ -2576,7 +2576,7 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (this.graph.getModel().isVertex(cells[i]))
|
else if (cells[i].isVertex())
|
||||||
{
|
{
|
||||||
let geo = this.graph.getCellGeometry(cells[i]);
|
let geo = this.graph.getCellGeometry(cells[i]);
|
||||||
|
|
||||||
|
@ -2686,14 +2686,14 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
|
||||||
mxGraphHandler.prototype.isPropagateSelectionCell = function(cell, immediate, me)
|
mxGraphHandler.prototype.isPropagateSelectionCell = function(cell, immediate, me)
|
||||||
{
|
{
|
||||||
let result = false;
|
let result = false;
|
||||||
let parent = this.graph.model.getParent(cell)
|
let parent = cell.getParent()
|
||||||
|
|
||||||
if (immediate)
|
if (immediate)
|
||||||
{
|
{
|
||||||
let geo = (this.graph.model.isEdge(cell)) ? null :
|
let geo = (cell.isEdge()) ? null :
|
||||||
this.graph.getCellGeometry(cell);
|
this.graph.getCellGeometry(cell);
|
||||||
|
|
||||||
result = !this.graph.model.isEdge(parent) &&
|
result = !parent.isEdge() &&
|
||||||
!this.graph.isSiblingSelected(cell) &&
|
!this.graph.isSiblingSelected(cell) &&
|
||||||
((geo != null && geo.relative) ||
|
((geo != null && geo.relative) ||
|
||||||
!this.graph.isContainer(parent) ||
|
!this.graph.isContainer(parent) ||
|
||||||
|
@ -2709,7 +2709,7 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
|
||||||
|
|
||||||
if (!this.graph.isTable(table))
|
if (!this.graph.isTable(table))
|
||||||
{
|
{
|
||||||
table = this.graph.model.getParent(table);
|
table = table.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
result = !this.graph.selectionCellsHandler.isHandled(table) ||
|
result = !this.graph.selectionCellsHandler.isHandled(table) ||
|
||||||
|
@ -2729,11 +2729,11 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
|
||||||
{
|
{
|
||||||
let cell = me.getCell();
|
let cell = me.getCell();
|
||||||
let model = this.graph.getModel();
|
let model = this.graph.getModel();
|
||||||
let parent = model.getParent(cell);
|
let parent = cell.getParent();
|
||||||
let state = this.graph.view.getState(parent);
|
let state = this.graph.view.getState(parent);
|
||||||
let selected = this.graph.isCellSelected(cell);
|
let selected = this.graph.isCellSelected(cell);
|
||||||
|
|
||||||
while (state != null && (model.isVertex(parent) || model.isEdge(parent)))
|
while (state != null && (parent.isVertex() || parent.isEdge()))
|
||||||
{
|
{
|
||||||
let temp = this.graph.isCellSelected(parent);
|
let temp = this.graph.isCellSelected(parent);
|
||||||
selected = selected || temp;
|
selected = selected || temp;
|
||||||
|
@ -2744,7 +2744,7 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
|
||||||
cell = parent;
|
cell = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = model.getParent(parent);
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
|
|
|
@ -458,7 +458,7 @@ EditorUi = function(editor, container, lightbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles special case for value "none"
|
// Handles special case for value "none"
|
||||||
let cellStyle = graph.getModel().getStyle(state.cell);
|
let cellStyle = state.cell ? state.cell.getStyle() : null;
|
||||||
let tokens = (cellStyle != null) ? cellStyle.split(';') : [];
|
let tokens = (cellStyle != null) ? cellStyle.split(';') : [];
|
||||||
|
|
||||||
for (let i = 0; i < tokens.length; i++)
|
for (let i = 0; i < tokens.length; i++)
|
||||||
|
@ -480,7 +480,7 @@ EditorUi = function(editor, container, lightbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets current style
|
// Resets current style
|
||||||
if (graph.getModel().isEdge(state.cell))
|
if (state.cell.isEdge())
|
||||||
{
|
{
|
||||||
graph.currentEdgeStyle = {};
|
graph.currentEdgeStyle = {};
|
||||||
}
|
}
|
||||||
|
@ -564,7 +564,7 @@ EditorUi = function(editor, container, lightbox)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Removes styles defined in the cell style from the styles to be applied
|
// Removes styles defined in the cell style from the styles to be applied
|
||||||
let cellStyle = model.getStyle(cell);
|
let cellStyle = cell.getStyle();
|
||||||
let tokens = (cellStyle != null) ? cellStyle.split(';') : [];
|
let tokens = (cellStyle != null) ? cellStyle.split(';') : [];
|
||||||
appliedStyles = styles.slice();
|
appliedStyles = styles.slice();
|
||||||
|
|
||||||
|
@ -606,9 +606,9 @@ EditorUi = function(editor, container, lightbox)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applies the current style to the cell
|
// Applies the current style to the cell
|
||||||
let edge = model.isEdge(cell);
|
let edge = cell.isEdge();
|
||||||
let current = (edge) ? graph.currentEdgeStyle : graph.currentVertexStyle;
|
let current = (edge) ? graph.currentEdgeStyle : graph.currentVertexStyle;
|
||||||
let newStyle = model.getStyle(cell);
|
let newStyle = cell.getStyle();
|
||||||
|
|
||||||
for (let j = 0; j < appliedStyles.length; j++)
|
for (let j = 0; j < appliedStyles.length; j++)
|
||||||
{
|
{
|
||||||
|
@ -669,8 +669,8 @@ EditorUi = function(editor, container, lightbox)
|
||||||
{
|
{
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
vertex = graph.getModel().isVertex(cells[i]) || vertex;
|
vertex = cells[i].isVertex() || vertex;
|
||||||
edge = graph.getModel().isEdge(cells[i]) || edge;
|
edge = cells[i].isEdge() || edge;
|
||||||
|
|
||||||
if (edge && vertex)
|
if (edge && vertex)
|
||||||
{
|
{
|
||||||
|
@ -868,7 +868,7 @@ EditorUi = function(editor, container, lightbox)
|
||||||
let cells = evt.getProperty('cells');
|
let cells = evt.getProperty('cells');
|
||||||
let parent = evt.getProperty('parent');
|
let parent = evt.getProperty('parent');
|
||||||
|
|
||||||
if (graph.getModel().isLayer(parent) && !graph.isCellVisible(parent) && cells != null && cells.length > 0)
|
if (graph.getModel().isLayer(parent) && !parent.isVisible() && cells != null && cells.length > 0)
|
||||||
{
|
{
|
||||||
graph.getModel().setVisible(parent, true);
|
graph.getModel().setVisible(parent, true);
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1210,7 @@ EditorUi.prototype.installShapePicker = function()
|
||||||
while (temp != null && graph.model.isVertex(temp) && geo != null && geo.relative)
|
while (temp != null && graph.model.isVertex(temp) && geo != null && geo.relative)
|
||||||
{
|
{
|
||||||
cell = temp;
|
cell = temp;
|
||||||
temp = graph.model.getParent(cell)
|
temp = cell.getParent()
|
||||||
geo = graph.getCellGeometry(temp);
|
geo = graph.getCellGeometry(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1634,7 +1634,7 @@ EditorUi.prototype.initClipboard = function()
|
||||||
// to avoid having to carry over the mapping from object
|
// to avoid having to carry over the mapping from object
|
||||||
// ID to cell ID to the paste operation
|
// ID to cell ID to the paste operation
|
||||||
let model = new mxGraphModel();
|
let model = new mxGraphModel();
|
||||||
let parent = model.getChildAt(model.getRoot(), 0);
|
let parent = model.getRoot().getChildAt(0);
|
||||||
|
|
||||||
for (let i = 0; i < clones.length; i++)
|
for (let i = 0; i < clones.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -1647,8 +1647,8 @@ EditorUi.prototype.initClipboard = function()
|
||||||
{
|
{
|
||||||
let geo = graph.getCellGeometry(clones[i]);
|
let geo = graph.getCellGeometry(clones[i]);
|
||||||
|
|
||||||
if (geo != null && geo.relative && !model.isEdge(result[i]) &&
|
if (geo != null && geo.relative && !result[i].isEdge() &&
|
||||||
lookup[mxObjectIdentity.get(model.getParent(result[i]))] == null)
|
lookup[mxObjectIdentity.get(result[i].getParent())] == null)
|
||||||
{
|
{
|
||||||
geo.offset = null;
|
geo.offset = null;
|
||||||
geo.relative = false;
|
geo.relative = false;
|
||||||
|
@ -2120,7 +2120,7 @@ EditorUi.prototype.initCanvas = function()
|
||||||
|
|
||||||
model.addListener(mxEvent.CHANGE, function()
|
model.addListener(mxEvent.CHANGE, function()
|
||||||
{
|
{
|
||||||
layersButton.style.display = (model.getChildCount(model.root) > 1) ? '' : 'none';
|
layersButton.style.display = (model.root.getChildCount() > 1) ? '' : 'none';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2798,7 +2798,7 @@ EditorUi.prototype.isDiagramEmpty = function()
|
||||||
{
|
{
|
||||||
let model = this.editor.graph.getModel();
|
let model = this.editor.graph.getModel();
|
||||||
|
|
||||||
return model.getChildCount(model.root) == 1 && model.getChildCount(model.getChildAt(model.root, 0)) == 0;
|
return model.getChildCount(model.root) == 1 && model.root.getChildAt(0).getChildCount() == 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3475,16 +3475,16 @@ EditorUi.prototype.updateActionStates = function()
|
||||||
{
|
{
|
||||||
let cell = cells[i];
|
let cell = cells[i];
|
||||||
|
|
||||||
if (graph.getModel().isEdge(cell))
|
if (cell.isEdge())
|
||||||
{
|
{
|
||||||
edgeSelected = true;
|
edgeSelected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.getModel().isVertex(cell))
|
if (cell.isVertex())
|
||||||
{
|
{
|
||||||
vertexSelected = true;
|
vertexSelected = true;
|
||||||
|
|
||||||
if (graph.getModel().getChildCount(cell) > 0 ||
|
if (cell.getChildCount() > 0 ||
|
||||||
graph.isContainer(cell))
|
graph.isContainer(cell))
|
||||||
{
|
{
|
||||||
groupSelected = true;
|
groupSelected = true;
|
||||||
|
@ -3523,13 +3523,13 @@ EditorUi.prototype.updateActionStates = function()
|
||||||
(oneVertexSelected && !graph.isContainer(graph.getSelectionCell())));
|
(oneVertexSelected && !graph.isContainer(graph.getSelectionCell())));
|
||||||
this.actions.get('ungroup').setEnabled(groupSelected);
|
this.actions.get('ungroup').setEnabled(groupSelected);
|
||||||
this.actions.get('removeFromGroup').setEnabled(oneVertexSelected &&
|
this.actions.get('removeFromGroup').setEnabled(oneVertexSelected &&
|
||||||
graph.getModel().isVertex(graph.getModel().getParent(graph.getSelectionCell())));
|
graph.getSelectionCell().getParent().isVertex());
|
||||||
|
|
||||||
// Updates menu states
|
// Updates menu states
|
||||||
let state = graph.view.getState(graph.getSelectionCell());
|
let state = graph.view.getState(graph.getSelectionCell());
|
||||||
this.menus.get('navigation').setEnabled(selected || graph.view.currentRoot != null);
|
this.menus.get('navigation').setEnabled(selected || graph.view.currentRoot != null);
|
||||||
this.actions.get('collapsible').setEnabled(vertexSelected &&
|
this.actions.get('collapsible').setEnabled(vertexSelected &&
|
||||||
(graph.isContainer(graph.getSelectionCell()) || graph.model.getChildCount(graph.getSelectionCell()) > 0));
|
(graph.isContainer(graph.getSelectionCell()) || graph.getSelectionCell().getChildCount() > 0));
|
||||||
this.actions.get('home').setEnabled(graph.view.currentRoot != null);
|
this.actions.get('home').setEnabled(graph.view.currentRoot != null);
|
||||||
this.actions.get('exitGroup').setEnabled(graph.view.currentRoot != null);
|
this.actions.get('exitGroup').setEnabled(graph.view.currentRoot != null);
|
||||||
this.actions.get('enterGroup').setEnabled(graph.getSelectionCount() == 1 && graph.isValidRoot(graph.getSelectionCell()));
|
this.actions.get('enterGroup').setEnabled(graph.getSelectionCount() == 1 && graph.isValidRoot(graph.getSelectionCell()));
|
||||||
|
@ -4106,7 +4106,7 @@ EditorUi.prototype.ctrlEnter = function()
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
// Clones table rows instead of cells
|
// Clones table rows instead of cells
|
||||||
let cell = (graph.isTableCell(cells[i])) ? graph.model.getParent(cells[i]) : cells[i];
|
let cell = (graph.isTableCell(cells[i])) ? cells[i].getParent() : cells[i];
|
||||||
|
|
||||||
if (cell != null && !lookup.get(cell))
|
if (cell != null && !lookup.get(cell))
|
||||||
{
|
{
|
||||||
|
@ -4593,7 +4593,7 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
if (graph.getModel().isVertex(cells[i]) && graph.isCellResizable(cells[i]))
|
if (cells[i].isVertex() && graph.isCellResizable(cells[i]))
|
||||||
{
|
{
|
||||||
let geo = graph.getCellGeometry(cells[i]);
|
let geo = graph.getCellGeometry(cells[i]);
|
||||||
|
|
||||||
|
@ -4632,7 +4632,7 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
||||||
{
|
{
|
||||||
// Moves vertices up/down in a stack layout
|
// Moves vertices up/down in a stack layout
|
||||||
let cell = graph.getSelectionCell();
|
let cell = graph.getSelectionCell();
|
||||||
let parent = graph.model.getParent(cell);
|
let parent = cell.getParent();
|
||||||
let layout = null;
|
let layout = null;
|
||||||
|
|
||||||
if (graph.getSelectionCount() == 1 && graph.model.isVertex(cell) &&
|
if (graph.getSelectionCount() == 1 && graph.model.isVertex(cell) &&
|
||||||
|
@ -4651,7 +4651,7 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
||||||
}
|
}
|
||||||
else if (keyCode == 39 ||keyCode == 40)
|
else if (keyCode == 39 ||keyCode == 40)
|
||||||
{
|
{
|
||||||
graph.model.add(parent, cell, Math.min(graph.model.getChildCount(parent), index + 1));
|
graph.model.add(parent, cell, Math.min(parent.getChildCount(), index + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4666,7 +4666,7 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
||||||
|
|
||||||
if (mxUtils.getValue(style, 'part', '0') == '1')
|
if (mxUtils.getValue(style, 'part', '0') == '1')
|
||||||
{
|
{
|
||||||
let parent = graph.model.getParent(cells[i]);
|
let parent = cells[i].getParent();
|
||||||
|
|
||||||
if (graph.model.isVertex(parent) && mxUtils.indexOf(cells, parent) < 0)
|
if (graph.model.isVertex(parent) && mxUtils.indexOf(cells, parent) < 0)
|
||||||
{
|
{
|
||||||
|
@ -4790,7 +4790,7 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
||||||
// On macOS, Control+Cursor is used by Expose so allow for Alt+Control to resize
|
// On macOS, Control+Cursor is used by Expose so allow for Alt+Control to resize
|
||||||
if (!this.isControlDown(evt) && mxEvent.isShiftDown(evt) && mxEvent.isAltDown(evt))
|
if (!this.isControlDown(evt) && mxEvent.isShiftDown(evt) && mxEvent.isAltDown(evt))
|
||||||
{
|
{
|
||||||
if (graph.model.isVertex(graph.getSelectionCell()))
|
if (graph.getSelectionCell() && graph.getSelectionCell().isVertex())
|
||||||
{
|
{
|
||||||
return function()
|
return function()
|
||||||
{
|
{
|
||||||
|
@ -4799,9 +4799,9 @@ EditorUi.prototype.createKeyHandler = function(editor)
|
||||||
|
|
||||||
if (cells != null && cells.length > 0)
|
if (cells != null && cells.length > 0)
|
||||||
{
|
{
|
||||||
if (cells.length == 1 && graph.model.isEdge(cells[0]))
|
if (cells.length == 1 && cells[0].isEdge())
|
||||||
{
|
{
|
||||||
graph.setSelectionCell(graph.model.getTerminal(cells[0], false));
|
graph.setSelectionCell(cells[0].getTerminal(false));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,7 +132,7 @@ Format.prototype.updateSelectionStateForCell = function(result, cell, cells)
|
||||||
{
|
{
|
||||||
let graph = this.editorUi.editor.graph;
|
let graph = this.editorUi.editor.graph;
|
||||||
|
|
||||||
if (graph.getModel().isVertex(cell))
|
if (cell.isVertex())
|
||||||
{
|
{
|
||||||
result.resizable = result.resizable && graph.isCellResizable(cell);
|
result.resizable = result.resizable && graph.isCellResizable(cell);
|
||||||
result.rotatable = result.rotatable && graph.isCellRotatable(cell);
|
result.rotatable = result.rotatable && graph.isCellRotatable(cell);
|
||||||
|
@ -203,7 +203,7 @@ Format.prototype.updateSelectionStateForCell = function(result, cell, cells)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (graph.getModel().isEdge(cell))
|
else if (cell.isEdge())
|
||||||
{
|
{
|
||||||
result.edges.push(cell);
|
result.edges.push(cell);
|
||||||
result.resizable = false;
|
result.resizable = false;
|
||||||
|
@ -252,7 +252,7 @@ Format.prototype.updateSelectionStateForCell = function(result, cell, cells)
|
||||||
Format.prototype.isFillState = function(state)
|
Format.prototype.isFillState = function(state)
|
||||||
{
|
{
|
||||||
return !this.isSpecialColor(state.style[mxConstants.STYLE_FILLCOLOR]) &&
|
return !this.isSpecialColor(state.style[mxConstants.STYLE_FILLCOLOR]) &&
|
||||||
(state.view.graph.model.isVertex(state.cell) ||
|
(state.cell.isVertex() ||
|
||||||
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) == 'arrow' ||
|
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) == 'arrow' ||
|
||||||
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) == 'filledEdge' ||
|
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) == 'filledEdge' ||
|
||||||
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) == 'flexArrow');
|
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) == 'flexArrow');
|
||||||
|
@ -723,7 +723,7 @@ BaseFormatPanel.prototype.installInputHandler = function(input, key, defaultValu
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
if (graph.model.getChildCount(cells[i]) == 0)
|
if (cells[i].getChildCount() == 0)
|
||||||
{
|
{
|
||||||
graph.autoSizeCell(cells[i], false);
|
graph.autoSizeCell(cells[i], false);
|
||||||
}
|
}
|
||||||
|
@ -1745,8 +1745,8 @@ ArrangePanel.prototype.addGroupOps = function(div)
|
||||||
div.appendChild(btn);
|
div.appendChild(btn);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
else if (graph.getSelectionCount() == 1 && !graph.getModel().isEdge(cell) && !graph.isSwimlane(cell) &&
|
else if (graph.getSelectionCount() == 1 && !cell.isEdge() && !graph.isSwimlane(cell) &&
|
||||||
!graph.isTable(cell) && !ss.row && !ss.cell && graph.getModel().getChildCount(cell) > 0)
|
!graph.isTable(cell) && !ss.row && !ss.cell && cell.getChildCount() > 0)
|
||||||
{
|
{
|
||||||
btn = mxUtils.button(mxResources.get('ungroup'), function(evt)
|
btn = mxUtils.button(mxResources.get('ungroup'), function(evt)
|
||||||
{
|
{
|
||||||
|
@ -1802,8 +1802,8 @@ ArrangePanel.prototype.addGroupOps = function(div)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.getSelectionCount() == 1 && graph.getModel().isVertex(cell) && !ss.row &&
|
if (graph.getSelectionCount() == 1 && cell.isVertex() && !ss.row &&
|
||||||
!ss.cell && graph.getModel().isVertex(graph.getModel().getParent(cell)))
|
!ss.cell && cell.getParent().isVertex())
|
||||||
{
|
{
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
|
@ -2257,7 +2257,7 @@ ArrangePanel.prototype.addGeometry = function(container)
|
||||||
{
|
{
|
||||||
if (graph.isTableCell(cell))
|
if (graph.isTableCell(cell))
|
||||||
{
|
{
|
||||||
cell = graph.model.getParent(cell);
|
cell = cell.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.isTableRow(cell))
|
if (graph.isTableRow(cell))
|
||||||
|
@ -2424,7 +2424,7 @@ ArrangePanel.prototype.addGeometryHandler = function(input, fn)
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
if (graph.getModel().isVertex(cells[i]))
|
if (cells[i].isVertex())
|
||||||
{
|
{
|
||||||
let geo = graph.getCellGeometry(cells[i]);
|
let geo = graph.getCellGeometry(cells[i]);
|
||||||
|
|
||||||
|
@ -2496,7 +2496,7 @@ ArrangePanel.prototype.addEdgeGeometryHandler = function(input, fn)
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
if (graph.getModel().isEdge(cells[i]))
|
if (cells[i].isEdge())
|
||||||
{
|
{
|
||||||
let geo = graph.getCellGeometry(cells[i]);
|
let geo = graph.getCellGeometry(cells[i]);
|
||||||
|
|
||||||
|
@ -2658,11 +2658,11 @@ ArrangePanel.prototype.addEdgeGeometry = function(container)
|
||||||
div.style.display = 'none';
|
div.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.getSelectionCount() == 1 && graph.model.isEdge(cell))
|
if (graph.getSelectionCount() == 1 && cell.isEdge())
|
||||||
{
|
{
|
||||||
let geo = graph.model.getGeometry(cell);
|
let geo = cell.getGeometry();
|
||||||
|
|
||||||
if (geo.sourcePoint != null && graph.model.getTerminal(cell, true) == null)
|
if (geo.sourcePoint != null && cell.getTerminal(true) == null)
|
||||||
{
|
{
|
||||||
xs.value = geo.sourcePoint.x;
|
xs.value = geo.sourcePoint.x;
|
||||||
ys.value = geo.sourcePoint.y;
|
ys.value = geo.sourcePoint.y;
|
||||||
|
@ -2672,7 +2672,7 @@ ArrangePanel.prototype.addEdgeGeometry = function(container)
|
||||||
divs.style.display = 'none';
|
divs.style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geo.targetPoint != null && graph.model.getTerminal(cell, false) == null)
|
if (geo.targetPoint != null && cell.getTerminal(false) == null)
|
||||||
{
|
{
|
||||||
xt.value = geo.targetPoint.x;
|
xt.value = geo.targetPoint.x;
|
||||||
yt.value = geo.targetPoint.y;
|
yt.value = geo.targetPoint.y;
|
||||||
|
@ -5614,8 +5614,8 @@ DiagramStylePanel.prototype.addView = function(div)
|
||||||
graphStyle.background : null, [cells[i]]);
|
graphStyle.background : null, [cells[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let edge = model.isEdge(cells[i]);
|
let edge = cells[i].isEdge();
|
||||||
let newStyle = model.getStyle(cells[i]);
|
let newStyle = cells[i].getStyle();
|
||||||
let current = (edge) ? graph.currentEdgeStyle : graph.currentVertexStyle;
|
let current = (edge) ? graph.currentEdgeStyle : graph.currentVertexStyle;
|
||||||
|
|
||||||
for (let j = 0; j < styles.length; j++)
|
for (let j = 0; j < styles.length; j++)
|
||||||
|
@ -5745,7 +5745,7 @@ DiagramStylePanel.prototype.addView = function(div)
|
||||||
let defaultStyle = graph.stylesheet.getDefaultVertexStyle();
|
let defaultStyle = graph.stylesheet.getDefaultVertexStyle();
|
||||||
let appliedStyle = vertexStyle;
|
let appliedStyle = vertexStyle;
|
||||||
|
|
||||||
if (model.isEdge(cell))
|
if (cell.isEdge())
|
||||||
{
|
{
|
||||||
defaultStyle = graph.stylesheet.getDefaultEdgeStyle();
|
defaultStyle = graph.stylesheet.getDefaultEdgeStyle();
|
||||||
appliedStyle = edgeStyle;
|
appliedStyle = edgeStyle;
|
||||||
|
@ -5883,7 +5883,7 @@ DiagramStylePanel.prototype.addView = function(div)
|
||||||
let defaultStyle = graph.stylesheet.getDefaultVertexStyle();
|
let defaultStyle = graph.stylesheet.getDefaultVertexStyle();
|
||||||
let appliedStyle = vertexStyle;
|
let appliedStyle = vertexStyle;
|
||||||
|
|
||||||
if (model.isEdge(cell))
|
if (cell.isEdge())
|
||||||
{
|
{
|
||||||
defaultStyle = graph.stylesheet.getDefaultEdgeStyle();
|
defaultStyle = graph.stylesheet.getDefaultEdgeStyle();
|
||||||
appliedStyle = edgeStyle;
|
appliedStyle = edgeStyle;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -253,9 +253,9 @@ Menus.prototype.init = function()
|
||||||
let tmp = graph.getSelectionCell();
|
let tmp = graph.getSelectionCell();
|
||||||
let roots = null;
|
let roots = null;
|
||||||
|
|
||||||
if (tmp == null || graph.getModel().getChildCount(tmp) == 0)
|
if (tmp == null || tmp.getChildCount() == 0)
|
||||||
{
|
{
|
||||||
if (graph.getModel().getEdgeCount(tmp) == 0)
|
if (tmp.getEdgeCount() == 0)
|
||||||
{
|
{
|
||||||
roots = graph.findTreeRoots(graph.getDefaultParent());
|
roots = graph.findTreeRoots(graph.getDefaultParent());
|
||||||
}
|
}
|
||||||
|
@ -292,9 +292,9 @@ Menus.prototype.init = function()
|
||||||
let tmp = graph.getSelectionCell();
|
let tmp = graph.getSelectionCell();
|
||||||
let roots = null;
|
let roots = null;
|
||||||
|
|
||||||
if (tmp == null || graph.getModel().getChildCount(tmp) == 0)
|
if (tmp == null || tmp.getChildCount() == 0)
|
||||||
{
|
{
|
||||||
if (graph.getModel().getEdgeCount(tmp) == 0)
|
if (tmp.getEdgeCount() == 0)
|
||||||
{
|
{
|
||||||
roots = graph.findTreeRoots(graph.getDefaultParent());
|
roots = graph.findTreeRoots(graph.getDefaultParent());
|
||||||
}
|
}
|
||||||
|
@ -331,9 +331,9 @@ Menus.prototype.init = function()
|
||||||
let tmp = graph.getSelectionCell();
|
let tmp = graph.getSelectionCell();
|
||||||
let roots = null;
|
let roots = null;
|
||||||
|
|
||||||
if (tmp == null || graph.getModel().getChildCount(tmp) == 0)
|
if (tmp == null || tmp.getChildCount() == 0)
|
||||||
{
|
{
|
||||||
if (graph.getModel().getEdgeCount(tmp) == 0)
|
if (tmp.getEdgeCount() == 0)
|
||||||
{
|
{
|
||||||
roots = graph.findTreeRoots(graph.getDefaultParent());
|
roots = graph.findTreeRoots(graph.getDefaultParent());
|
||||||
}
|
}
|
||||||
|
@ -364,9 +364,9 @@ Menus.prototype.init = function()
|
||||||
|
|
||||||
if (!graph.isSelectionEmpty())
|
if (!graph.isSelectionEmpty())
|
||||||
{
|
{
|
||||||
tmp = graph.getModel().getParent(tmp);
|
tmp = tmp.getParent();
|
||||||
|
|
||||||
if (graph.getModel().isVertex(tmp))
|
if (tmp.isVertex())
|
||||||
{
|
{
|
||||||
graph.updateGroupBounds([tmp], graph.gridSize * 2, true);
|
graph.updateGroupBounds([tmp], graph.gridSize * 2, true);
|
||||||
}
|
}
|
||||||
|
@ -388,14 +388,14 @@ Menus.prototype.init = function()
|
||||||
{
|
{
|
||||||
let tmp = graph.getSelectionCell();
|
let tmp = graph.getSelectionCell();
|
||||||
|
|
||||||
if (tmp == null || graph.getModel().getChildCount(tmp) == 0)
|
if (tmp == null || tmp.getChildCount() == 0)
|
||||||
{
|
{
|
||||||
tmp = graph.getDefaultParent();
|
tmp = graph.getDefaultParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
layout.execute(tmp);
|
layout.execute(tmp);
|
||||||
|
|
||||||
if (graph.getModel().isVertex(tmp))
|
if (tmp.isVertex())
|
||||||
{
|
{
|
||||||
graph.updateGroupBounds([tmp], graph.gridSize * 2, true);
|
graph.updateGroupBounds([tmp], graph.gridSize * 2, true);
|
||||||
}
|
}
|
||||||
|
@ -410,14 +410,14 @@ Menus.prototype.init = function()
|
||||||
{
|
{
|
||||||
let tmp = graph.getSelectionCell();
|
let tmp = graph.getSelectionCell();
|
||||||
|
|
||||||
if (tmp == null || graph.getModel().getChildCount(tmp) == 0)
|
if (tmp == null || tmp.getChildCount() == 0)
|
||||||
{
|
{
|
||||||
tmp = graph.getDefaultParent();
|
tmp = graph.getDefaultParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
layout.execute(tmp);
|
layout.execute(tmp);
|
||||||
|
|
||||||
if (graph.getModel().isVertex(tmp))
|
if (tmp.isVertex())
|
||||||
{
|
{
|
||||||
graph.updateGroupBounds([tmp], graph.gridSize * 2, true);
|
graph.updateGroupBounds([tmp], graph.gridSize * 2, true);
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ Menus.prototype.edgeStyleChange = function(menu, label, keys, values, sprite, pa
|
||||||
{
|
{
|
||||||
let cell = cells[i];
|
let cell = cells[i];
|
||||||
|
|
||||||
if (graph.getModel().isEdge(cell))
|
if (cell.isEdge())
|
||||||
{
|
{
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
|
@ -877,7 +877,7 @@ Menus.prototype.createStyleChangeFunction = function(keys, values)
|
||||||
{
|
{
|
||||||
for (let j = 0; j < cells.length; j++)
|
for (let j = 0; j < cells.length; j++)
|
||||||
{
|
{
|
||||||
if (graph.model.getChildCount(cells[j]) == 0)
|
if (cells[j].getChildCount() == 0)
|
||||||
{
|
{
|
||||||
graph.autoSizeCell(cells[j], false);
|
graph.autoSizeCell(cells[j], false);
|
||||||
}
|
}
|
||||||
|
@ -1143,8 +1143,8 @@ Menus.prototype.addPopupMenuArrangeItems = function(menu, cell, evt)
|
||||||
{
|
{
|
||||||
this.addMenuItems(menu, ['-', 'group'], null, evt);
|
this.addMenuItems(menu, ['-', 'group'], null, evt);
|
||||||
}
|
}
|
||||||
else if (graph.getSelectionCount() == 1 && !graph.getModel().isEdge(cell) &&
|
else if (graph.getSelectionCount() == 1 && !cell.isEdge() &&
|
||||||
!graph.isSwimlane(cell) && graph.getModel().getChildCount(cell) > 0)
|
!graph.isSwimlane(cell) && cell.getChildCount() > 0)
|
||||||
{
|
{
|
||||||
this.addMenuItems(menu, ['-', 'ungroup'], null, evt);
|
this.addMenuItems(menu, ['-', 'ungroup'], null, evt);
|
||||||
}
|
}
|
||||||
|
@ -1164,7 +1164,7 @@ Menus.prototype.addPopupMenuCellItems = function(menu, cell, evt)
|
||||||
{
|
{
|
||||||
let hasWaypoints = false;
|
let hasWaypoints = false;
|
||||||
|
|
||||||
if (graph.getModel().isEdge(cell) && mxUtils.getValue(state.style, mxConstants.STYLE_EDGE, null) != 'entityRelationEdgeStyle' &&
|
if (cell.isEdge() && mxUtils.getValue(state.style, mxConstants.STYLE_EDGE, null) != 'entityRelationEdgeStyle' &&
|
||||||
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) != 'arrow')
|
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) != 'arrow')
|
||||||
{
|
{
|
||||||
let handler = graph.selectionCellsHandler.getHandler(cell);
|
let handler = graph.selectionCellsHandler.getHandler(cell);
|
||||||
|
@ -1188,12 +1188,12 @@ Menus.prototype.addPopupMenuCellItems = function(menu, cell, evt)
|
||||||
this.addMenuItems(menu, [(isWaypoint) ? 'removeWaypoint' : 'addWaypoint'], null, evt);
|
this.addMenuItems(menu, [(isWaypoint) ? 'removeWaypoint' : 'addWaypoint'], null, evt);
|
||||||
|
|
||||||
// Adds reset waypoints option if waypoints exist
|
// Adds reset waypoints option if waypoints exist
|
||||||
let geo = graph.getModel().getGeometry(cell);
|
let geo = cell.getGeometry();
|
||||||
hasWaypoints = geo != null && geo.points != null && geo.points.length > 0;
|
hasWaypoints = geo != null && geo.points != null && geo.points.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.getSelectionCount() == 1 && (hasWaypoints || (graph.getModel().isVertex(cell) &&
|
if (graph.getSelectionCount() == 1 && (hasWaypoints || (cell.isVertex() &&
|
||||||
graph.getModel().getEdgeCount(cell) > 0)))
|
cell.getEdgeCount() > 0)))
|
||||||
{
|
{
|
||||||
this.addMenuItems(menu, ['-', 'clearWaypoints'], null, evt);
|
this.addMenuItems(menu, ['-', 'clearWaypoints'], null, evt);
|
||||||
}
|
}
|
||||||
|
@ -1203,7 +1203,7 @@ Menus.prototype.addPopupMenuCellItems = function(menu, cell, evt)
|
||||||
this.addMenuItems(menu, ['-', 'editStyle', 'editData', 'editLink'], null, evt);
|
this.addMenuItems(menu, ['-', 'editStyle', 'editData', 'editLink'], null, evt);
|
||||||
|
|
||||||
// Shows edit image action if there is an image in the style
|
// Shows edit image action if there is an image in the style
|
||||||
if (graph.getModel().isVertex(cell) && mxUtils.getValue(state.style, mxConstants.STYLE_IMAGE, null) != null)
|
if (cell.isVertex() && mxUtils.getValue(state.style, mxConstants.STYLE_IMAGE, null) != null)
|
||||||
{
|
{
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
this.addMenuItem(menu, 'image', null, evt).firstChild.nextSibling.innerHTML = mxResources.get('editImage') + '...';
|
this.addMenuItem(menu, 'image', null, evt).firstChild.nextSibling.innerHTML = mxResources.get('editImage') + '...';
|
||||||
|
|
|
@ -4181,7 +4181,7 @@
|
||||||
if (graph.isTableRow(state.cell) || graph.isTableCell(state.cell))
|
if (graph.isTableRow(state.cell) || graph.isTableCell(state.cell))
|
||||||
{
|
{
|
||||||
let dir = graph.getSwimlaneDirection(state.style);
|
let dir = graph.getSwimlaneDirection(state.style);
|
||||||
let parent = graph.model.getParent(state.cell);
|
let parent = state.cell.getParent();
|
||||||
let cells = graph.model.getChildCells(parent, true);
|
let cells = graph.model.getChildCells(parent, true);
|
||||||
let temp = [];
|
let temp = [];
|
||||||
|
|
||||||
|
|
|
@ -2607,7 +2607,7 @@ Sidebar.prototype.updateShapes = function(source, targets)
|
||||||
graph.model.beginUpdate();
|
graph.model.beginUpdate();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
let cellStyle = graph.getModel().getStyle(source);
|
let cellStyle = source.getStyle();
|
||||||
|
|
||||||
// Lists the styles to carry over from the existing shape
|
// Lists the styles to carry over from the existing shape
|
||||||
let styles = ['shadow', 'dashed', 'dashPattern', 'fontFamily', 'fontSize', 'fontColor', 'align', 'startFill',
|
let styles = ['shadow', 'dashed', 'dashPattern', 'fontFamily', 'fontSize', 'fontColor', 'align', 'startFill',
|
||||||
|
@ -2621,8 +2621,8 @@ Sidebar.prototype.updateShapes = function(source, targets)
|
||||||
{
|
{
|
||||||
let targetCell = targets[i];
|
let targetCell = targets[i];
|
||||||
|
|
||||||
if ((graph.getModel().isVertex(targetCell) == graph.getModel().isVertex(source)) ||
|
if ((targetCell.isVertex() == source.isVertex()) ||
|
||||||
(graph.getModel().isEdge(targetCell) == graph.getModel().isEdge(source)))
|
(targetCell.isEdge() == source.isEdge()))
|
||||||
{
|
{
|
||||||
let style = graph.getCurrentCellStyle(targets[i]);
|
let style = graph.getCurrentCellStyle(targets[i]);
|
||||||
graph.getModel().setStyle(targetCell, cellStyle);
|
graph.getModel().setStyle(targetCell, cellStyle);
|
||||||
|
@ -2630,11 +2630,11 @@ Sidebar.prototype.updateShapes = function(source, targets)
|
||||||
// Removes all children of composite cells
|
// Removes all children of composite cells
|
||||||
if (mxUtils.getValue(style, 'composite', '0') == '1')
|
if (mxUtils.getValue(style, 'composite', '0') == '1')
|
||||||
{
|
{
|
||||||
let childCount = graph.model.getChildCount(targetCell);
|
let childCount = targetCell.getChildCount();
|
||||||
|
|
||||||
for (let j = childCount; j >= 0; j--)
|
for (let j = childCount; j >= 0; j--)
|
||||||
{
|
{
|
||||||
graph.model.remove(graph.model.getChildAt(targetCell, j));
|
graph.model.remove(targetCell.getChildAt(j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2822,7 +2822,7 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
|
||||||
var geo2 = graph.getCellGeometry(targets[dropCellIndex]);
|
var geo2 = graph.getCellGeometry(targets[dropCellIndex]);
|
||||||
|
|
||||||
// Handles special case where target should be ignored for stack layouts
|
// Handles special case where target should be ignored for stack layouts
|
||||||
let targetParent = graph.model.getParent(source);
|
let targetParent = source.getParent();
|
||||||
let validLayout = true;
|
let validLayout = true;
|
||||||
|
|
||||||
// Ignores parent if it has a stack layout or if it is a table or row
|
// Ignores parent if it has a stack layout or if it is a table or row
|
||||||
|
@ -2838,7 +2838,7 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if another container is at the drop location
|
// Checks if another container is at the drop location
|
||||||
let tmp = (graph.model.isEdge(source)) ? null : graph.view.getState(targetParent);
|
let tmp = (source.isEdge()) ? null : graph.view.getState(targetParent);
|
||||||
let dx = 0;
|
let dx = 0;
|
||||||
let dy = 0;
|
let dy = 0;
|
||||||
|
|
||||||
|
@ -2859,7 +2859,7 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
|
||||||
}
|
}
|
||||||
|
|
||||||
let useParent = !graph.isTableRow(source) && !graph.isTableCell(source) &&
|
let useParent = !graph.isTableRow(source) && !graph.isTableCell(source) &&
|
||||||
(graph.model.isEdge(source) || (sourceGeo != null &&
|
(source.isEdge() || (sourceGeo != null &&
|
||||||
!sourceGeo.relative && validLayout));
|
!sourceGeo.relative && validLayout));
|
||||||
|
|
||||||
let tempTarget = graph.getCellAt((geo.x + dx + graph.view.translate.x) * graph.view.scale,
|
let tempTarget = graph.getCellAt((geo.x + dx + graph.view.translate.x) * graph.view.scale,
|
||||||
|
@ -2879,7 +2879,7 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
|
||||||
targetParent = tempTarget;
|
targetParent = tempTarget;
|
||||||
useParent = true;
|
useParent = true;
|
||||||
|
|
||||||
if (!graph.model.isEdge(source))
|
if (!source.isEdge())
|
||||||
{
|
{
|
||||||
geo.x -= offset.x - dx;
|
geo.x -= offset.x - dx;
|
||||||
geo.y -= offset.y - dy;
|
geo.y -= offset.y - dy;
|
||||||
|
@ -2896,7 +2896,7 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
|
||||||
dy = geo2.y;
|
dy = geo2.y;
|
||||||
|
|
||||||
// Ignores geometry of edges
|
// Ignores geometry of edges
|
||||||
if (graph.model.isEdge(targets[dropCellIndex]))
|
if (targets[dropCellIndex].isEdge())
|
||||||
{
|
{
|
||||||
dx = 0;
|
dx = 0;
|
||||||
dy = 0;
|
dy = 0;
|
||||||
|
@ -2906,14 +2906,14 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
|
||||||
(geo.y - (useParent ? dy : 0)), (useParent) ? targetParent : null);
|
(geo.y - (useParent ? dy : 0)), (useParent) ? targetParent : null);
|
||||||
tmp = targets;
|
tmp = targets;
|
||||||
|
|
||||||
if (graph.model.isEdge(source))
|
if (source.isEdge())
|
||||||
{
|
{
|
||||||
// Adds new terminal to edge
|
// Adds new terminal to edge
|
||||||
// LATER: Push new terminal out radially from edge start point
|
// LATER: Push new terminal out radially from edge start point
|
||||||
graph.model.setTerminal(source, targets[dropCellIndex],
|
graph.model.setTerminal(source, targets[dropCellIndex],
|
||||||
direction == mxConstants.DIRECTION_NORTH);
|
direction == mxConstants.DIRECTION_NORTH);
|
||||||
}
|
}
|
||||||
else if (graph.model.isEdge(targets[dropCellIndex]))
|
else if (targets[dropCellIndex].isEdge())
|
||||||
{
|
{
|
||||||
// Adds new outgoing connection to vertex and clears points
|
// Adds new outgoing connection to vertex and clears points
|
||||||
graph.model.setTerminal(targets[dropCellIndex], source, true);
|
graph.model.setTerminal(targets[dropCellIndex], source, true);
|
||||||
|
@ -2924,7 +2924,7 @@ Sidebar.prototype.dropAndConnect = function(source, targets, direction, dropCell
|
||||||
{
|
{
|
||||||
geo3.setTerminalPoint(geo.getTerminalPoint(false), false);
|
geo3.setTerminalPoint(geo.getTerminalPoint(false), false);
|
||||||
}
|
}
|
||||||
else if (useParent && graph.model.isVertex(targetParent))
|
else if (useParent && targetParent.isVertex())
|
||||||
{
|
{
|
||||||
// Adds parent offset to other nodes
|
// Adds parent offset to other nodes
|
||||||
let tmpState = graph.view.getState(targetParent);
|
let tmpState = graph.view.getState(targetParent);
|
||||||
|
@ -2991,7 +2991,7 @@ Sidebar.prototype.getDropAndConnectGeometry = function(source, target, direction
|
||||||
{
|
{
|
||||||
geo2 = geo2.clone();
|
geo2 = geo2.clone();
|
||||||
|
|
||||||
if (graph.model.isEdge(source))
|
if (source.isEdge())
|
||||||
{
|
{
|
||||||
let state = graph.view.getState(source);
|
let state = graph.view.getState(source);
|
||||||
let pts = state.absolutePoints;
|
let pts = state.absolutePoints;
|
||||||
|
@ -3022,7 +3022,7 @@ Sidebar.prototype.getDropAndConnectGeometry = function(source, target, direction
|
||||||
let length = graph.defaultEdgeLength;
|
let length = graph.defaultEdgeLength;
|
||||||
|
|
||||||
// Maintains edge length
|
// Maintains edge length
|
||||||
if (graph.model.isEdge(target) && geo2.getTerminalPoint(true) != null &&
|
if (target.isEdge() && geo2.getTerminalPoint(true) != null &&
|
||||||
geo2.getTerminalPoint(false) != null)
|
geo2.getTerminalPoint(false) != null)
|
||||||
{
|
{
|
||||||
var p0 = geo2.getTerminalPoint(true);
|
var p0 = geo2.getTerminalPoint(true);
|
||||||
|
@ -3094,7 +3094,7 @@ Sidebar.prototype.getDropAndConnectGeometry = function(source, target, direction
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds offset to match cells without connecting edge
|
// Adds offset to match cells without connecting edge
|
||||||
if (graph.model.isEdge(target) && geo2.getTerminalPoint(true) != null &&
|
if (target.isEdge() && geo2.getTerminalPoint(true) != null &&
|
||||||
target.getTerminal(false) != null)
|
target.getTerminal(false) != null)
|
||||||
{
|
{
|
||||||
let targetGeo = graph.getCellGeometry(target.getTerminal(false));
|
let targetGeo = graph.getCellGeometry(target.getTerminal(false));
|
||||||
|
@ -3174,12 +3174,12 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++)
|
for (let i = 0; i < cells.length; i++)
|
||||||
{
|
{
|
||||||
if (firstVertex == null && graph.model.isVertex(cells[i]))
|
if (firstVertex == null && cells[i].isVertex())
|
||||||
{
|
{
|
||||||
firstVertex = i;
|
firstVertex = i;
|
||||||
}
|
}
|
||||||
else if (freeSourceEdge == null && graph.model.isEdge(cells[i]) &&
|
else if (freeSourceEdge == null && cells[i].isEdge() &&
|
||||||
graph.model.getTerminal(cells[i], true) == null)
|
cells[i].getTerminal(true) == null)
|
||||||
{
|
{
|
||||||
freeSourceEdge = i;
|
freeSourceEdge = i;
|
||||||
}
|
}
|
||||||
|
@ -3202,12 +3202,12 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
if (cells != null && currentStyleTarget != null && activeArrow == styleTarget)
|
if (cells != null && currentStyleTarget != null && activeArrow == styleTarget)
|
||||||
{
|
{
|
||||||
let tmp = graph.isCellSelected(currentStyleTarget.cell) ? graph.getSelectionCells() : [currentStyleTarget.cell];
|
let tmp = graph.isCellSelected(currentStyleTarget.cell) ? graph.getSelectionCells() : [currentStyleTarget.cell];
|
||||||
let updatedCells = this.updateShapes((graph.model.isEdge(currentStyleTarget.cell)) ? cells[0] : cells[firstVertex], tmp);
|
let updatedCells = this.updateShapes((currentStyleTarget.cell.isEdge()) ? cells[0] : cells[firstVertex], tmp);
|
||||||
graph.setSelectionCells(updatedCells);
|
graph.setSelectionCells(updatedCells);
|
||||||
}
|
}
|
||||||
else if (cells != null && activeArrow != null && currentTargetState != null && activeArrow != styleTarget)
|
else if (cells != null && activeArrow != null && currentTargetState != null && activeArrow != styleTarget)
|
||||||
{
|
{
|
||||||
let index = (graph.model.isEdge(currentTargetState.cell) || freeSourceEdge == null) ? firstVertex : freeSourceEdge;
|
let index = (currentTargetState.cell.isEdge() || freeSourceEdge == null) ? firstVertex : freeSourceEdge;
|
||||||
graph.setSelectionCells(this.dropAndConnect(currentTargetState.cell, cells, direction, index, evt));
|
graph.setSelectionCells(this.dropAndConnect(currentTargetState.cell, cells, direction, index, evt));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3355,7 +3355,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
|
|
||||||
if (currentStyleTarget != null && activeArrow == styleTarget)
|
if (currentStyleTarget != null && activeArrow == styleTarget)
|
||||||
{
|
{
|
||||||
this.previewElement.style.display = (graph.model.isEdge(currentStyleTarget.cell)) ? 'none' : '';
|
this.previewElement.style.display = (currentStyleTarget.cell.isEdge()) ? 'none' : '';
|
||||||
|
|
||||||
this.previewElement.style.left = currentStyleTarget.x + 'px';
|
this.previewElement.style.left = currentStyleTarget.x + 'px';
|
||||||
this.previewElement.style.top = currentStyleTarget.y + 'px';
|
this.previewElement.style.top = currentStyleTarget.y + 'px';
|
||||||
|
@ -3369,15 +3369,15 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
dragSource.currentHighlight.hide();
|
dragSource.currentHighlight.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
let index = (graph.model.isEdge(currentTargetState.cell) || freeSourceEdge == null) ? firstVertex : freeSourceEdge;
|
let index = (currentTargetState.cell.isEdge() || freeSourceEdge == null) ? firstVertex : freeSourceEdge;
|
||||||
let geo = sidebar.getDropAndConnectGeometry(currentTargetState.cell, cells[index], direction, cells);
|
let geo = sidebar.getDropAndConnectGeometry(currentTargetState.cell, cells[index], direction, cells);
|
||||||
var geo2 = (!graph.model.isEdge(currentTargetState.cell)) ? graph.getCellGeometry(currentTargetState.cell) : null;
|
var geo2 = (!currentTargetState.cell.isEdge()) ? graph.getCellGeometry(currentTargetState.cell) : null;
|
||||||
var geo3 = graph.getCellGeometry(cells[index]);
|
var geo3 = graph.getCellGeometry(cells[index]);
|
||||||
let parent = graph.model.getParent(currentTargetState.cell);
|
let parent = currentTargetState.cell.getParent();
|
||||||
let dx = view.translate.x * view.scale;
|
let dx = view.translate.x * view.scale;
|
||||||
let dy = view.translate.y * view.scale;
|
let dy = view.translate.y * view.scale;
|
||||||
|
|
||||||
if (geo2 != null && !geo2.relative && graph.model.isVertex(parent) && parent != view.currentRoot)
|
if (geo2 != null && !geo2.relative && parent.isVertex() && parent != view.currentRoot)
|
||||||
{
|
{
|
||||||
let pState = view.getState(parent);
|
let pState = view.getState(parent);
|
||||||
|
|
||||||
|
@ -3389,7 +3389,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
var dy2 = geo3.y;
|
var dy2 = geo3.y;
|
||||||
|
|
||||||
// Ignores geometry of edges
|
// Ignores geometry of edges
|
||||||
if (graph.model.isEdge(cells[index]))
|
if (cells[index].isEdge())
|
||||||
{
|
{
|
||||||
dx2 = 0;
|
dx2 = 0;
|
||||||
dy2 = 0;
|
dy2 = 0;
|
||||||
|
@ -3408,7 +3408,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
this.previewElement.style.display = '';
|
this.previewElement.style.display = '';
|
||||||
}
|
}
|
||||||
else if (dragSource.currentHighlight.state != null &&
|
else if (dragSource.currentHighlight.state != null &&
|
||||||
graph.model.isEdge(dragSource.currentHighlight.state.cell))
|
dragSource.currentHighlight.state.cell.isEdge())
|
||||||
{
|
{
|
||||||
// Centers drop cells when splitting edges
|
// Centers drop cells when splitting edges
|
||||||
this.previewElement.style.left = Math.round(parseInt(this.previewElement.style.left) -
|
this.previewElement.style.left = Math.round(parseInt(this.previewElement.style.left) -
|
||||||
|
@ -3445,11 +3445,11 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
|
|
||||||
// Uses connectable parent vertex if one exists
|
// Uses connectable parent vertex if one exists
|
||||||
if (cell != null && !this.graph.isCellConnectable(cell) &&
|
if (cell != null && !this.graph.isCellConnectable(cell) &&
|
||||||
!this.graph.model.isEdge(cell))
|
!cell.isEdge())
|
||||||
{
|
{
|
||||||
let parent = this.graph.getModel().getParent(cell);
|
let parent = this.cell.getParent();
|
||||||
|
|
||||||
if (this.graph.getModel().isVertex(parent) &&
|
if (parent.isVertex() &&
|
||||||
this.graph.isCellConnectable(parent))
|
this.graph.isCellConnectable(parent))
|
||||||
{
|
{
|
||||||
cell = parent;
|
cell = parent;
|
||||||
|
@ -3503,12 +3503,12 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
mxUtils.getValue(state.style, mxConstants.STYLE_FILLCOLOR, mxConstants.NONE) != mxConstants.NONE ||
|
mxUtils.getValue(state.style, mxConstants.STYLE_FILLCOLOR, mxConstants.NONE) != mxConstants.NONE ||
|
||||||
mxUtils.getValue(state.style, mxConstants.STYLE_GRADIENTCOLOR, mxConstants.NONE) != mxConstants.NONE)) ||
|
mxUtils.getValue(state.style, mxConstants.STYLE_GRADIENTCOLOR, mxConstants.NONE) != mxConstants.NONE)) ||
|
||||||
mxUtils.getValue(sourceCellStyle, mxConstants.STYLE_SHAPE) == 'image') ||
|
mxUtils.getValue(sourceCellStyle, mxConstants.STYLE_SHAPE) == 'image') ||
|
||||||
timeOnTarget > 1500 || graph.model.isEdge(state.cell)) && (timeOnTarget > this.dropTargetDelay) &&
|
timeOnTarget > 1500 || state.cell.isEdge()) && (timeOnTarget > this.dropTargetDelay) &&
|
||||||
!this.isDropStyleTargetIgnored(state) && ((graph.model.isVertex(state.cell) && firstVertex != null) ||
|
!this.isDropStyleTargetIgnored(state) && ((state.cell.isVertex() && firstVertex != null) ||
|
||||||
(graph.model.isEdge(state.cell) && graph.model.isEdge(cells[0]))))
|
(state.cell.isEdge() && cells[0].isEdge())))
|
||||||
{
|
{
|
||||||
currentStyleTarget = state;
|
currentStyleTarget = state;
|
||||||
let tmp = (graph.model.isEdge(state.cell)) ? graph.view.getPoint(state) :
|
let tmp = (state.cell.isEdge()) ? graph.view.getPoint(state) :
|
||||||
new mxPoint(state.getCenterX(), state.getCenterY());
|
new mxPoint(state.getCenterX(), state.getCenterY());
|
||||||
tmp = new mxRectangle(tmp.x - this.refreshTarget.width / 2, tmp.y - this.refreshTarget.height / 2,
|
tmp = new mxRectangle(tmp.x - this.refreshTarget.width / 2, tmp.y - this.refreshTarget.height / 2,
|
||||||
this.refreshTarget.width, this.refreshTarget.height);
|
this.refreshTarget.width, this.refreshTarget.height);
|
||||||
|
@ -3539,7 +3539,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
else if (currentStyleTarget != null && styleTargetParent != null)
|
else if (currentStyleTarget != null && styleTargetParent != null)
|
||||||
{
|
{
|
||||||
// Sets active Arrow as side effect
|
// Sets active Arrow as side effect
|
||||||
let tmp = (graph.model.isEdge(currentStyleTarget.cell)) ? graph.view.getPoint(currentStyleTarget) : new mxPoint(currentStyleTarget.getCenterX(), currentStyleTarget.getCenterY());
|
let tmp = (currentStyleTarget.cell.isEdge()) ? graph.view.getPoint(currentStyleTarget) : new mxPoint(currentStyleTarget.getCenterX(), currentStyleTarget.getCenterY());
|
||||||
tmp = new mxRectangle(tmp.x - this.refreshTarget.width / 2, tmp.y - this.refreshTarget.height / 2,
|
tmp = new mxRectangle(tmp.x - this.refreshTarget.width / 2, tmp.y - this.refreshTarget.height / 2,
|
||||||
this.refreshTarget.width, this.refreshTarget.height);
|
this.refreshTarget.width, this.refreshTarget.height);
|
||||||
checkArrow(x, y, tmp, styleTarget);
|
checkArrow(x, y, tmp, styleTarget);
|
||||||
|
@ -3551,7 +3551,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
// LATER: Use hit-detection for edges
|
// LATER: Use hit-detection for edges
|
||||||
bbox = mxRectangle.fromRectangle(currentTargetState);
|
bbox = mxRectangle.fromRectangle(currentTargetState);
|
||||||
|
|
||||||
if (graph.model.isEdge(currentTargetState.cell))
|
if (currentTargetState.cell.isEdge())
|
||||||
{
|
{
|
||||||
let pts = currentTargetState.absolutePoints;
|
let pts = currentTargetState.absolutePoints;
|
||||||
|
|
||||||
|
@ -3642,8 +3642,8 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
}
|
}
|
||||||
|
|
||||||
let validTarget = (firstVertex == null || graph.isCellConnectable(cells[firstVertex])) &&
|
let validTarget = (firstVertex == null || graph.isCellConnectable(cells[firstVertex])) &&
|
||||||
((graph.model.isEdge(cell) && firstVertex != null) ||
|
((cell.isEdge() && firstVertex != null) ||
|
||||||
(graph.model.isVertex(cell) && graph.isCellConnectable(cell)));
|
(cell.isVertex() && graph.isCellConnectable(cell)));
|
||||||
|
|
||||||
// Drop arrows shown after this.dropTargetDelay, hidden after 5 secs, switches arrows after 500ms
|
// Drop arrows shown after this.dropTargetDelay, hidden after 5 secs, switches arrows after 500ms
|
||||||
if ((currentTargetState != null && timeOnTarget >= 5000) ||
|
if ((currentTargetState != null && timeOnTarget >= 5000) ||
|
||||||
|
@ -3653,7 +3653,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
{
|
{
|
||||||
activeTarget = false;
|
activeTarget = false;
|
||||||
currentTargetState = ((timeOnTarget < 5000 && timeOnTarget > this.dropTargetDelay) ||
|
currentTargetState = ((timeOnTarget < 5000 && timeOnTarget > this.dropTargetDelay) ||
|
||||||
graph.model.isEdge(cell)) ? state : null;
|
cell.isEdge()) ? state : null;
|
||||||
|
|
||||||
if (currentTargetState != null && validTarget)
|
if (currentTargetState != null && validTarget)
|
||||||
{
|
{
|
||||||
|
@ -3667,7 +3667,7 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.model.isEdge(cell))
|
if (cell.isEdge())
|
||||||
{
|
{
|
||||||
let pts = state.absolutePoints;
|
let pts = state.absolutePoints;
|
||||||
|
|
||||||
|
@ -3684,12 +3684,12 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
roundTarget.style.left = Math.floor(pe.x - this.roundDrop.width / 2) + 'px';
|
roundTarget.style.left = Math.floor(pe.x - this.roundDrop.width / 2) + 'px';
|
||||||
roundTarget.style.top = Math.floor(pe.y - this.roundDrop.height / 2) + 'px';
|
roundTarget.style.top = Math.floor(pe.y - this.roundDrop.height / 2) + 'px';
|
||||||
|
|
||||||
if (graph.model.getTerminal(cell, true) == null)
|
if (cell.getTerminal(true) == null)
|
||||||
{
|
{
|
||||||
graph.container.appendChild(roundSource);
|
graph.container.appendChild(roundSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (graph.model.getTerminal(cell, false) == null)
|
if (cell.getTerminal(false) == null)
|
||||||
{
|
{
|
||||||
graph.container.appendChild(roundTarget);
|
graph.container.appendChild(roundTarget);
|
||||||
}
|
}
|
||||||
|
@ -3793,15 +3793,15 @@ Sidebar.prototype.createDragSource = function(elt, dropHandler, preview, cells,
|
||||||
{
|
{
|
||||||
// Selects parent group as drop target
|
// Selects parent group as drop target
|
||||||
while (target != null && !graph.isValidDropTarget(target, cells, evt) &&
|
while (target != null && !graph.isValidDropTarget(target, cells, evt) &&
|
||||||
model.isVertex(model.getParent(target)))
|
target.getParent().isVertex())
|
||||||
{
|
{
|
||||||
target = model.getParent(target);
|
target = target.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target != null && (graph.view.currentRoot == target ||
|
if (target != null && (graph.view.currentRoot == target ||
|
||||||
(!graph.isValidRoot(target) &&
|
(!graph.isValidRoot(target) &&
|
||||||
graph.getModel().getChildCount(target) == 0) ||
|
target.getChildCount() == 0) ||
|
||||||
graph.isCellLocked(target) || model.isEdge(target) ||
|
graph.isCellLocked(target) || target.isEdge() ||
|
||||||
!graph.isValidDropTarget(target, cells, evt)))
|
!graph.isValidDropTarget(target, cells, evt)))
|
||||||
{
|
{
|
||||||
target = null;
|
target = null;
|
||||||
|
@ -3851,13 +3851,13 @@ Sidebar.prototype.itemClicked = function(cells, ds, evt, elt)
|
||||||
|
|
||||||
// Alt+Click inserts and connects
|
// Alt+Click inserts and connects
|
||||||
if (mxEvent.isAltDown(evt) && graph.getSelectionCount() == 1 &&
|
if (mxEvent.isAltDown(evt) && graph.getSelectionCount() == 1 &&
|
||||||
graph.model.isVertex(graph.getSelectionCell()))
|
graph.getSelectionCell().isVertex())
|
||||||
{
|
{
|
||||||
let firstVertex = null;
|
let firstVertex = null;
|
||||||
|
|
||||||
for (let i = 0; i < cells.length && firstVertex == null; i++)
|
for (let i = 0; i < cells.length && firstVertex == null; i++)
|
||||||
{
|
{
|
||||||
if (graph.model.isVertex(cells[i]))
|
if (cells[i].isVertex())
|
||||||
{
|
{
|
||||||
firstVertex = i;
|
firstVertex = i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class mxChildChange {
|
||||||
// execute(): void;
|
// execute(): void;
|
||||||
execute() {
|
execute() {
|
||||||
if (this.child != null) {
|
if (this.child != null) {
|
||||||
let tmp = this.model.getParent(this.child);
|
let tmp = this.child.getParent();
|
||||||
const tmp2 = tmp != null ? tmp.getIndex(this.child) : 0;
|
const tmp2 = tmp != null ? tmp.getIndex(this.child) : 0;
|
||||||
|
|
||||||
if (this.previous == null) {
|
if (this.previous == null) {
|
||||||
|
@ -84,10 +84,10 @@ class mxChildChange {
|
||||||
cell.setTerminal(source, true);
|
cell.setTerminal(source, true);
|
||||||
cell.setTerminal(target, false);
|
cell.setTerminal(target, false);
|
||||||
|
|
||||||
const childCount = this.model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.connect(this.model.getChildAt(cell, i), isConnect);
|
this.connect(cell.getChildAt(i), isConnect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import mxGraphView from './mxGraphView';
|
import mxGraphView from '../view/graph/mxGraphView';
|
||||||
import mxEventObject from '../../util/event/mxEventObject';
|
import mxEventObject from '../util/event/mxEventObject';
|
||||||
import mxPoint from '../../util/datatypes/mxPoint';
|
import mxPoint from '../util/datatypes/mxPoint';
|
||||||
import mxCell from '../cell/mxCell';
|
import mxCell from '../view/cell/mxCell';
|
||||||
import mxEvent from '../../util/event/mxEvent';
|
import mxEvent from '../util/event/mxEvent';
|
||||||
import mxGraphModel from './mxGraphModel';
|
import mxGraphModel from '../view/graph/mxGraphModel';
|
||||||
import mxGraph from "./mxGraph";
|
import mxGraph from "../view/graph/mxGraph";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: mxCurrentRootChange
|
* Class: mxCurrentRootChange
|
||||||
|
@ -27,7 +27,7 @@ class mxCurrentRootChange {
|
||||||
this.isUp = true;
|
this.isUp = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tmp = model.getParent(tmp);
|
tmp = tmp.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
import mxEventObject from '../../util/event/mxEventObject';
|
import mxEventObject from '../util/event/mxEventObject';
|
||||||
import mxResources from '../../util/mxResources';
|
import mxResources from '../util/mxResources';
|
||||||
import mxLog from '../../util/gui/mxLog';
|
import mxLog from '../util/gui/mxLog';
|
||||||
import mxEvent from '../../util/event/mxEvent';
|
import mxEvent from '../util/event/mxEvent';
|
||||||
import mxGraphSelectionModel from './mxGraphSelectionModel';
|
import mxGraphSelectionModel from '../view/graph/mxGraphSelectionModel';
|
||||||
import mxCell from '../cell/mxCell';
|
import mxCell from '../view/cell/mxCell';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class mxSelectionChange
|
* @class mxSelectionChange
|
|
@ -267,14 +267,14 @@ class mxDefaultPopupMenu {
|
||||||
createConditions(editor, cell, evt) {
|
createConditions(editor, cell, evt) {
|
||||||
// Creates array with conditions
|
// Creates array with conditions
|
||||||
const model = editor.graph.getModel();
|
const model = editor.graph.getModel();
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
// Adds some frequently used conditions
|
// Adds some frequently used conditions
|
||||||
const conditions = [];
|
const conditions = [];
|
||||||
conditions.nocell = cell == null;
|
conditions.nocell = cell == null;
|
||||||
conditions.ncells = editor.graph.getSelectionCount() > 1;
|
conditions.ncells = editor.graph.getSelectionCount() > 1;
|
||||||
conditions.notRoot =
|
conditions.notRoot =
|
||||||
model.getRoot() !== model.getParent(editor.graph.getDefaultParent());
|
model.getRoot() !== editor.graph.getDefaultParent().getParent();
|
||||||
conditions.cell = cell != null;
|
conditions.cell = cell != null;
|
||||||
|
|
||||||
const isCell = cell != null && editor.graph.getSelectionCount() === 1;
|
const isCell = cell != null && editor.graph.getSelectionCount() === 1;
|
||||||
|
|
|
@ -303,7 +303,7 @@ class mxDefaultToolbar {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
target == null ||
|
target == null ||
|
||||||
model.isEdge(target) ||
|
target.isEdge() ||
|
||||||
!this.connectOnDrop ||
|
!this.connectOnDrop ||
|
||||||
!graph.isCellConnectable(target)
|
!graph.isCellConnectable(target)
|
||||||
) {
|
) {
|
||||||
|
@ -311,7 +311,7 @@ class mxDefaultToolbar {
|
||||||
target != null &&
|
target != null &&
|
||||||
!graph.isValidDropTarget(target, [vertex], evt)
|
!graph.isValidDropTarget(target, [vertex], evt)
|
||||||
) {
|
) {
|
||||||
target = model.getParent(target);
|
target = target.getParent();
|
||||||
}
|
}
|
||||||
this.insert(vertex, evt, target);
|
this.insert(vertex, evt, target);
|
||||||
} else {
|
} else {
|
||||||
|
@ -370,8 +370,8 @@ class mxDefaultToolbar {
|
||||||
|
|
||||||
model.beginUpdate();
|
model.beginUpdate();
|
||||||
try {
|
try {
|
||||||
const geo = model.getGeometry(source);
|
const geo = source.getGeometry();
|
||||||
const g = model.getGeometry(vertex).clone();
|
const g = vertex.getGeometry().clone();
|
||||||
|
|
||||||
// Moves the vertex away from the drop target that will
|
// Moves the vertex away from the drop target that will
|
||||||
// be used as the source for the new connection
|
// be used as the source for the new connection
|
||||||
|
@ -391,7 +391,7 @@ class mxDefaultToolbar {
|
||||||
|
|
||||||
// Fires two add-events with the code below - should be fixed
|
// Fires two add-events with the code below - should be fixed
|
||||||
// to only fire one add event for both inserts
|
// to only fire one add event for both inserts
|
||||||
const parent = model.getParent(source);
|
const parent = source.getParent();
|
||||||
graph.addCell(vertex, parent);
|
graph.addCell(vertex, parent);
|
||||||
graph.constrainChild(vertex);
|
graph.constrainChild(vertex);
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ class mxDefaultToolbar {
|
||||||
// the second function that fires an add event
|
// the second function that fires an add event
|
||||||
edge = this.editor.createEdge(source, vertex);
|
edge = this.editor.createEdge(source, vertex);
|
||||||
|
|
||||||
if (model.getGeometry(edge) == null) {
|
if (edge.getGeometry() == null) {
|
||||||
const edgeGeometry = new mxGeometry();
|
const edgeGeometry = new mxGeometry();
|
||||||
edgeGeometry.relative = true;
|
edgeGeometry.relative = true;
|
||||||
|
|
||||||
|
|
|
@ -1555,7 +1555,7 @@ class mxEditor extends mxEventSource {
|
||||||
let layout = null;
|
let layout = null;
|
||||||
const model = self.graph.getModel();
|
const model = self.graph.getModel();
|
||||||
|
|
||||||
if (model.getParent(cell) != null) {
|
if (cell.getParent() != null) {
|
||||||
// Executes the swimlane layout if a child of
|
// Executes the swimlane layout if a child of
|
||||||
// a swimlane has been changed. The layout is
|
// a swimlane has been changed. The layout is
|
||||||
// lazy created in createSwimlaneLayout.
|
// lazy created in createSwimlaneLayout.
|
||||||
|
@ -1573,7 +1573,7 @@ class mxEditor extends mxEventSource {
|
||||||
else if (
|
else if (
|
||||||
self.layoutDiagram &&
|
self.layoutDiagram &&
|
||||||
(graph.isValidRoot(cell) ||
|
(graph.isValidRoot(cell) ||
|
||||||
model.getParent(model.getParent(cell)) == null)
|
cell.getParent().getParent() == null)
|
||||||
) {
|
) {
|
||||||
if (self.diagramLayout == null) {
|
if (self.diagramLayout == null) {
|
||||||
self.diagramLayout = self.createDiagramLayout();
|
self.diagramLayout = self.createDiagramLayout();
|
||||||
|
@ -1892,14 +1892,14 @@ class mxEditor extends mxEventSource {
|
||||||
|
|
||||||
while (
|
while (
|
||||||
cell != null &&
|
cell != null &&
|
||||||
graph.getModel().getParent(graph.getModel().getParent(cell)) != null
|
cell.getParent().getParent() != null
|
||||||
) {
|
) {
|
||||||
// Append each label of a valid root
|
// Append each label of a valid root
|
||||||
if (graph.isValidRoot(cell)) {
|
if (graph.isValidRoot(cell)) {
|
||||||
title = ` > ${graph.convertValueToString(cell)}${title}`;
|
title = ` > ${graph.convertValueToString(cell)}${title}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = graph.getModel().getParent(cell);
|
cell = cell.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
const prefix = this.getRootTitle();
|
const prefix = this.getRootTitle();
|
||||||
|
@ -2249,8 +2249,8 @@ class mxEditor extends mxEventSource {
|
||||||
let heightField = null;
|
let heightField = null;
|
||||||
|
|
||||||
// Adds fields for the location and size
|
// Adds fields for the location and size
|
||||||
if (model.isVertex(cell)) {
|
if (cell.isVertex()) {
|
||||||
geo = model.getGeometry(cell);
|
geo = cell.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
yField = form.addText('top', geo.y);
|
yField = form.addText('top', geo.y);
|
||||||
|
@ -2261,7 +2261,7 @@ class mxEditor extends mxEventSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds a field for the cell style
|
// Adds a field for the cell style
|
||||||
const tmp = model.getStyle(cell);
|
const tmp = cell.getStyle();
|
||||||
const style = form.addText('Style', tmp || '');
|
const style = form.addText('Style', tmp || '');
|
||||||
|
|
||||||
// Creates textareas for each attribute of the
|
// Creates textareas for each attribute of the
|
||||||
|
@ -2690,8 +2690,8 @@ class mxEditor extends mxEventSource {
|
||||||
parent = parent != null ? parent : this.graph.getSwimlaneAt(x, y);
|
parent = parent != null ? parent : this.graph.getSwimlaneAt(x, y);
|
||||||
const { scale } = this.graph.getView();
|
const { scale } = this.graph.getView();
|
||||||
|
|
||||||
let geo = model.getGeometry(vertex);
|
let geo = vertex.getGeometry();
|
||||||
const pgeo = model.getGeometry(parent);
|
const pgeo = parent.getGeometry();
|
||||||
|
|
||||||
if (this.graph.isSwimlane(vertex) && !this.graph.swimlaneNesting) {
|
if (this.graph.isSwimlane(vertex) && !this.graph.swimlaneNesting) {
|
||||||
parent = null;
|
parent = null;
|
||||||
|
|
|
@ -597,10 +597,10 @@ class mxConnectionHandler extends mxEventSource {
|
||||||
|
|
||||||
// Uses connectable parent vertex if one exists
|
// Uses connectable parent vertex if one exists
|
||||||
if (cell != null && !self.graph.isCellConnectable(cell)) {
|
if (cell != null && !self.graph.isCellConnectable(cell)) {
|
||||||
const parent = self.graph.getModel().getParent(cell);
|
const parent = self.cell.getParent();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.graph.getModel().isVertex(parent) &&
|
parent.isVertex() &&
|
||||||
self.graph.isCellConnectable(parent)
|
self.graph.isCellConnectable(parent)
|
||||||
) {
|
) {
|
||||||
cell = parent;
|
cell = parent;
|
||||||
|
@ -2008,12 +2008,12 @@ class mxConnectionHandler extends mxEventSource {
|
||||||
// FIXME: Should not shift if vertex was aligned (same in Java)
|
// FIXME: Should not shift if vertex was aligned (same in Java)
|
||||||
if (
|
if (
|
||||||
dropTarget == null ||
|
dropTarget == null ||
|
||||||
!this.graph.getModel().isEdge(dropTarget)
|
!dropTarget.isEdge()
|
||||||
) {
|
) {
|
||||||
const pstate = this.graph.getView().getState(dropTarget);
|
const pstate = this.graph.getView().getState(dropTarget);
|
||||||
|
|
||||||
if (pstate != null) {
|
if (pstate != null) {
|
||||||
const tmp = model.getGeometry(target);
|
const tmp = target.getGeometry();
|
||||||
tmp.x -= pstate.origin.x;
|
tmp.x -= pstate.origin.x;
|
||||||
tmp.y -= pstate.origin.y;
|
tmp.y -= pstate.origin.y;
|
||||||
}
|
}
|
||||||
|
@ -2030,10 +2030,10 @@ class mxConnectionHandler extends mxEventSource {
|
||||||
if (
|
if (
|
||||||
source != null &&
|
source != null &&
|
||||||
target != null &&
|
target != null &&
|
||||||
model.getParent(source) === model.getParent(target) &&
|
source.getParent() === target.getParent() &&
|
||||||
model.getParent(model.getParent(source)) !== model.getRoot()
|
source.getParent().getParent() !== model.getRoot()
|
||||||
) {
|
) {
|
||||||
parent = model.getParent(source);
|
parent = source.getParent();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
source.geometry != null &&
|
source.geometry != null &&
|
||||||
|
@ -2041,7 +2041,7 @@ class mxConnectionHandler extends mxEventSource {
|
||||||
target.geometry != null &&
|
target.geometry != null &&
|
||||||
target.geometry.relative
|
target.geometry.relative
|
||||||
) {
|
) {
|
||||||
parent = model.getParent(parent);
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2077,7 +2077,7 @@ class mxConnectionHandler extends mxEventSource {
|
||||||
model.setGeometry(edge, this.edgeState.cell.geometry);
|
model.setGeometry(edge, this.edgeState.cell.geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent = model.getParent(source);
|
parent = source.getParent();
|
||||||
|
|
||||||
// Inserts edge before source
|
// Inserts edge before source
|
||||||
if (this.isInsertBefore(edge, source, target, evt, dropTarget)) {
|
if (this.isInsertBefore(edge, source, target, evt, dropTarget)) {
|
||||||
|
@ -2090,7 +2090,7 @@ class mxConnectionHandler extends mxEventSource {
|
||||||
tmp.geometry.relative &&
|
tmp.geometry.relative &&
|
||||||
tmp.parent !== edge.parent
|
tmp.parent !== edge.parent
|
||||||
) {
|
) {
|
||||||
tmp = this.graph.model.getParent(tmp);
|
tmp = tmp.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -2103,7 +2103,7 @@ class mxConnectionHandler extends mxEventSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makes sure the edge has a non-null, relative geometry
|
// Makes sure the edge has a non-null, relative geometry
|
||||||
let geo = model.getGeometry(edge);
|
let geo = edge.getGeometry();
|
||||||
|
|
||||||
if (geo == null) {
|
if (geo == null) {
|
||||||
geo = new mxGeometry();
|
geo = new mxGeometry();
|
||||||
|
@ -2218,12 +2218,12 @@ class mxConnectionHandler extends mxEventSource {
|
||||||
let geo = this.graph.getCellGeometry(source);
|
let geo = this.graph.getCellGeometry(source);
|
||||||
|
|
||||||
while (geo != null && geo.relative) {
|
while (geo != null && geo.relative) {
|
||||||
source = this.graph.getModel().getParent(source);
|
source = source.getParent();
|
||||||
geo = this.graph.getCellGeometry(source);
|
geo = this.graph.getCellGeometry(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
const clone = this.graph.cloneCell(source);
|
const clone = this.graph.cloneCell(source);
|
||||||
geo = this.graph.getModel().getGeometry(clone);
|
geo = clone.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
const t = this.graph.view.translate;
|
const t = this.graph.view.translate;
|
||||||
|
|
|
@ -206,10 +206,10 @@ class mxConstraintHandler {
|
||||||
|
|
||||||
// Uses connectable parent vertex if one exists
|
// Uses connectable parent vertex if one exists
|
||||||
if (cell != null && !this.graph.isCellConnectable(cell)) {
|
if (cell != null && !this.graph.isCellConnectable(cell)) {
|
||||||
const parent = this.graph.getModel().getParent(cell);
|
const parent = this.cell.getParent();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.graph.getModel().isVertex(parent) &&
|
parent.isVertex() &&
|
||||||
this.graph.isCellConnectable(parent)
|
this.graph.isCellConnectable(parent)
|
||||||
) {
|
) {
|
||||||
cell = parent;
|
cell = parent;
|
||||||
|
@ -257,7 +257,7 @@ class mxConstraintHandler {
|
||||||
(this.currentFocusArea == null ||
|
(this.currentFocusArea == null ||
|
||||||
this.currentFocus == null ||
|
this.currentFocus == null ||
|
||||||
state != null ||
|
state != null ||
|
||||||
!this.graph.getModel().isVertex(this.currentFocus.cell) ||
|
!this.currentFocus.cell.isVertex() ||
|
||||||
!mxUtils.intersects(this.currentFocusArea, mouse)) &&
|
!mxUtils.intersects(this.currentFocusArea, mouse)) &&
|
||||||
state !== this.currentFocus
|
state !== this.currentFocus
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -273,7 +273,7 @@ class mxEdgeHandler {
|
||||||
*/
|
*/
|
||||||
isParentHighlightVisible() {
|
isParentHighlightVisible() {
|
||||||
return !this.graph.isCellSelected(
|
return !this.graph.isCellSelected(
|
||||||
this.graph.model.getParent(this.state.cell)
|
this.state.cell.getParent()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,11 +285,11 @@ class mxEdgeHandler {
|
||||||
updateParentHighlight() {
|
updateParentHighlight() {
|
||||||
if (!this.isDestroyed()) {
|
if (!this.isDestroyed()) {
|
||||||
const visible = this.isParentHighlightVisible();
|
const visible = this.isParentHighlightVisible();
|
||||||
const parent = this.graph.model.getParent(this.state.cell);
|
const parent = this.state.cell.getParent();
|
||||||
const pstate = this.graph.view.getState(parent);
|
const pstate = this.graph.view.getState(parent);
|
||||||
|
|
||||||
if (this.parentHighlight != null) {
|
if (this.parentHighlight != null) {
|
||||||
if (this.graph.model.isVertex(parent) && visible) {
|
if (parent.isVertex() && visible) {
|
||||||
const b = this.parentHighlight.bounds;
|
const b = this.parentHighlight.bounds;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -315,7 +315,7 @@ class mxEdgeHandler {
|
||||||
}
|
}
|
||||||
} else if (this.parentHighlightEnabled && visible) {
|
} else if (this.parentHighlightEnabled && visible) {
|
||||||
if (
|
if (
|
||||||
this.graph.model.isVertex(parent) &&
|
parent.isVertex() &&
|
||||||
pstate != null &&
|
pstate != null &&
|
||||||
pstate.parentHighlight == null
|
pstate.parentHighlight == null
|
||||||
) {
|
) {
|
||||||
|
@ -602,10 +602,10 @@ class mxEdgeHandler {
|
||||||
|
|
||||||
// Uses connectable parent vertex if one exists
|
// Uses connectable parent vertex if one exists
|
||||||
if (cell != null && !this.graph.isCellConnectable(cell)) {
|
if (cell != null && !this.graph.isCellConnectable(cell)) {
|
||||||
const parent = this.graph.getModel().getParent(cell);
|
const parent = this.cell.getParent();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.graph.getModel().isVertex(parent) &&
|
parent.isVertex() &&
|
||||||
this.graph.isCellConnectable(parent)
|
this.graph.isCellConnectable(parent)
|
||||||
) {
|
) {
|
||||||
cell = parent;
|
cell = parent;
|
||||||
|
@ -626,7 +626,7 @@ class mxEdgeHandler {
|
||||||
cell === self.state.cell ||
|
cell === self.state.cell ||
|
||||||
(cell != null &&
|
(cell != null &&
|
||||||
!self.graph.connectableEdges &&
|
!self.graph.connectableEdges &&
|
||||||
model.isEdge(cell)) ||
|
cell.isEdge()) ||
|
||||||
model.isAncestor(self.state.cell, cell)
|
model.isAncestor(self.state.cell, cell)
|
||||||
) {
|
) {
|
||||||
cell = null;
|
cell = null;
|
||||||
|
@ -644,7 +644,7 @@ class mxEdgeHandler {
|
||||||
const other = self.graph.view.getTerminalPort(
|
const other = self.graph.view.getTerminalPort(
|
||||||
state,
|
state,
|
||||||
self.graph.view.getState(
|
self.graph.view.getState(
|
||||||
model.getTerminal(self.state.cell, !self.isSource)
|
self.state.cell.getTerminal(!self.isSource)
|
||||||
),
|
),
|
||||||
!self.isSource
|
!self.isSource
|
||||||
);
|
);
|
||||||
|
@ -1052,7 +1052,7 @@ class mxEdgeHandler {
|
||||||
|
|
||||||
if (this.isSource || this.isTarget) {
|
if (this.isSource || this.isTarget) {
|
||||||
const { cell } = this.state;
|
const { cell } = this.state;
|
||||||
const terminal = this.graph.model.getTerminal(cell, this.isSource);
|
const terminal = cell.getTerminal(this.isSource);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(terminal == null &&
|
(terminal == null &&
|
||||||
|
@ -1252,7 +1252,7 @@ class mxEdgeHandler {
|
||||||
const other = this.graph.view.getTerminalPort(
|
const other = this.graph.view.getTerminalPort(
|
||||||
this.state,
|
this.state,
|
||||||
this.graph.view.getState(
|
this.graph.view.getState(
|
||||||
model.getTerminal(this.state.cell, !this.isSource)
|
this.state.cell.getTerminal(!this.isSource)
|
||||||
),
|
),
|
||||||
!this.isSource
|
!this.isSource
|
||||||
);
|
);
|
||||||
|
@ -1784,22 +1784,22 @@ class mxEdgeHandler {
|
||||||
|
|
||||||
if (terminal != null) {
|
if (terminal != null) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const parent = model.getParent(edge);
|
const parent = edge.getParent();
|
||||||
|
|
||||||
model.beginUpdate();
|
model.beginUpdate();
|
||||||
try {
|
try {
|
||||||
// Clones and adds the cell
|
// Clones and adds the cell
|
||||||
if (clone) {
|
if (clone) {
|
||||||
let geo = model.getGeometry(edge);
|
let geo = edge.getGeometry();
|
||||||
clone = this.graph.cloneCell(edge);
|
clone = this.graph.cloneCell(edge);
|
||||||
model.add(parent, clone, model.getChildCount(parent));
|
model.add(parent, clone, parent.getChildCount());
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
model.setGeometry(clone, geo);
|
model.setGeometry(clone, geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
const other = model.getTerminal(edge, !this.isSource);
|
const other = edge.getTerminal(!this.isSource);
|
||||||
this.graph.connectCell(clone, other, !this.isSource);
|
this.graph.connectCell(clone, other, !this.isSource);
|
||||||
|
|
||||||
edge = clone;
|
edge = clone;
|
||||||
|
@ -1822,7 +1822,7 @@ class mxEdgeHandler {
|
||||||
|
|
||||||
const pstate = this.graph
|
const pstate = this.graph
|
||||||
.getView()
|
.getView()
|
||||||
.getState(this.graph.getModel().getParent(edge));
|
.getState(edge.getParent());
|
||||||
|
|
||||||
if (pstate != null) {
|
if (pstate != null) {
|
||||||
pt.x -= pstate.origin.x;
|
pt.x -= pstate.origin.x;
|
||||||
|
@ -1947,7 +1947,7 @@ class mxEdgeHandler {
|
||||||
|
|
||||||
const pstate = this.graph
|
const pstate = this.graph
|
||||||
.getView()
|
.getView()
|
||||||
.getState(this.graph.getModel().getParent(this.state.cell));
|
.getState(this.state.cell.getParent());
|
||||||
|
|
||||||
if (pstate != null) {
|
if (pstate != null) {
|
||||||
point.x -= pstate.origin.x;
|
point.x -= pstate.origin.x;
|
||||||
|
@ -1971,7 +1971,7 @@ class mxEdgeHandler {
|
||||||
// moveLabel(edgeState: mxCellState, x: number, y: number): void;
|
// moveLabel(edgeState: mxCellState, x: number, y: number): void;
|
||||||
moveLabel(edgeState, x, y) {
|
moveLabel(edgeState, x, y) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
let geometry = model.getGeometry(edgeState.cell);
|
let geometry = edgeState.cell.getGeometry();
|
||||||
|
|
||||||
if (geometry != null) {
|
if (geometry != null) {
|
||||||
const { scale } = this.graph.getView();
|
const { scale } = this.graph.getView();
|
||||||
|
@ -2032,7 +2032,7 @@ class mxEdgeHandler {
|
||||||
// connect(edge: mxCell, terminal: mxCell, isSource: boolean, isClone: boolean, me: mxMouseEvent): mxCell;
|
// connect(edge: mxCell, terminal: mxCell, isSource: boolean, isClone: boolean, me: mxMouseEvent): mxCell;
|
||||||
connect(edge, terminal, isSource, isClone, me) {
|
connect(edge, terminal, isSource, isClone, me) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const parent = model.getParent(edge);
|
const parent = edge.getParent();
|
||||||
|
|
||||||
model.beginUpdate();
|
model.beginUpdate();
|
||||||
try {
|
try {
|
||||||
|
@ -2062,14 +2062,14 @@ class mxEdgeHandler {
|
||||||
model.beginUpdate();
|
model.beginUpdate();
|
||||||
try {
|
try {
|
||||||
if (clone) {
|
if (clone) {
|
||||||
const parent = model.getParent(edge);
|
const parent = edge.getParent();
|
||||||
const terminal = model.getTerminal(edge, !isSource);
|
const terminal = edge.getTerminal(!isSource);
|
||||||
edge = this.graph.cloneCell(edge);
|
edge = this.graph.cloneCell(edge);
|
||||||
model.add(parent, edge, model.getChildCount(parent));
|
model.add(parent, edge, parent.getChildCount());
|
||||||
model.setTerminal(edge, terminal, !isSource);
|
model.setTerminal(edge, terminal, !isSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
let geo = model.getGeometry(edge);
|
let geo = edge.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
@ -2100,16 +2100,16 @@ class mxEdgeHandler {
|
||||||
model.beginUpdate();
|
model.beginUpdate();
|
||||||
try {
|
try {
|
||||||
if (clone) {
|
if (clone) {
|
||||||
const parent = model.getParent(edge);
|
const parent = edge.getParent();
|
||||||
const source = model.getTerminal(edge, true);
|
const source = edge.getTerminal(true);
|
||||||
const target = model.getTerminal(edge, false);
|
const target = edge.getTerminal(false);
|
||||||
edge = this.graph.cloneCell(edge);
|
edge = this.graph.cloneCell(edge);
|
||||||
model.add(parent, edge, model.getChildCount(parent));
|
model.add(parent, edge, parent.getChildCount());
|
||||||
model.setTerminal(edge, source, true);
|
model.setTerminal(edge, source, true);
|
||||||
model.setTerminal(edge, target, false);
|
model.setTerminal(edge, target, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
let geo = model.getGeometry(edge);
|
let geo = edge.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
@ -2158,9 +2158,9 @@ class mxEdgeHandler {
|
||||||
const s = this.graph.view.scale;
|
const s = this.graph.view.scale;
|
||||||
let offset = new mxPoint(t.x * s, t.y * s);
|
let offset = new mxPoint(t.x * s, t.y * s);
|
||||||
|
|
||||||
const parent = this.graph.model.getParent(this.state.cell);
|
const parent = this.state.cell.getParent();
|
||||||
|
|
||||||
if (this.graph.model.isVertex(parent)) {
|
if (parent.isVertex()) {
|
||||||
const pState = this.graph.view.getState(parent);
|
const pState = this.graph.view.getState(parent);
|
||||||
offset = new mxPoint(pState.x, pState.y);
|
offset = new mxPoint(pState.x, pState.y);
|
||||||
}
|
}
|
||||||
|
@ -2212,7 +2212,7 @@ class mxEdgeHandler {
|
||||||
getHandleFillColor(index) {
|
getHandleFillColor(index) {
|
||||||
const isSource = index === 0;
|
const isSource = index === 0;
|
||||||
const { cell } = this.state;
|
const { cell } = this.state;
|
||||||
const terminal = this.graph.getModel().getTerminal(cell, isSource);
|
const terminal = cell.getTerminal(isSource);
|
||||||
let color = mxConstants.HANDLE_FILLCOLOR;
|
let color = mxConstants.HANDLE_FILLCOLOR;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -2240,7 +2240,7 @@ class mxEdgeHandler {
|
||||||
redraw(ignoreHandles) {
|
redraw(ignoreHandles) {
|
||||||
if (this.state != null) {
|
if (this.state != null) {
|
||||||
this.abspoints = this.state.absolutePoints.slice();
|
this.abspoints = this.state.absolutePoints.slice();
|
||||||
const g = this.graph.getModel().getGeometry(this.state.cell);
|
const g = this.state.cell.getGeometry();
|
||||||
|
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
const pts = g.points;
|
const pts = g.points;
|
||||||
|
@ -2636,7 +2636,7 @@ class mxEdgeHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parentHighlight != null) {
|
if (this.parentHighlight != null) {
|
||||||
const parent = this.graph.model.getParent(this.state.cell);
|
const parent = this.state.cell.getParent();
|
||||||
const pstate = this.graph.view.getState(parent);
|
const pstate = this.graph.view.getState(parent);
|
||||||
|
|
||||||
if (pstate != null && pstate.parentHighlight === this.parentHighlight) {
|
if (pstate != null && pstate.parentHighlight === this.parentHighlight) {
|
||||||
|
|
|
@ -215,7 +215,7 @@ class mxEdgeSegmentHandler extends mxElbowEdgeHandler {
|
||||||
// connect(edge: mxCell, terminal: mxCell, isSource: boolean, isClone: boolean, me: mxMouseEvent): mxCell;
|
// connect(edge: mxCell, terminal: mxCell, isSource: boolean, isClone: boolean, me: mxMouseEvent): mxCell;
|
||||||
connect(edge, terminal, isSource, isClone, me) {
|
connect(edge, terminal, isSource, isClone, me) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
let geo = model.getGeometry(edge);
|
let geo = edge.getGeometry();
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
// Merges adjacent edge segments
|
// Merges adjacent edge segments
|
||||||
|
@ -245,7 +245,7 @@ class mxEdgeSegmentHandler extends mxElbowEdgeHandler {
|
||||||
model.beginUpdate();
|
model.beginUpdate();
|
||||||
try {
|
try {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
geo = model.getGeometry(edge);
|
geo = edge.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
|
|
@ -192,7 +192,7 @@ class mxElbowEdgeHandler extends mxEdgeHandler {
|
||||||
*/
|
*/
|
||||||
// redrawInnerBends(p0: mxPoint, pe: mxPoint): void;
|
// redrawInnerBends(p0: mxPoint, pe: mxPoint): void;
|
||||||
redrawInnerBends(p0, pe) {
|
redrawInnerBends(p0, pe) {
|
||||||
const g = this.graph.getModel().getGeometry(this.state.cell);
|
const g = this.state.cell.getGeometry();
|
||||||
const pts = this.state.absolutePoints;
|
const pts = this.state.absolutePoints;
|
||||||
let pt = null;
|
let pt = null;
|
||||||
|
|
||||||
|
|
|
@ -458,10 +458,10 @@ class mxGraphHandler {
|
||||||
* selection state to the parent.
|
* selection state to the parent.
|
||||||
*/
|
*/
|
||||||
isPropagateSelectionCell(cell, immediate, me) {
|
isPropagateSelectionCell(cell, immediate, me) {
|
||||||
const parent = this.graph.model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
|
|
||||||
if (immediate) {
|
if (immediate) {
|
||||||
const geo = this.graph.model.isEdge(cell)
|
const geo = cell.isEdge()
|
||||||
? null
|
? null
|
||||||
: this.graph.getCellGeometry(cell);
|
: this.graph.getCellGeometry(cell);
|
||||||
|
|
||||||
|
@ -497,17 +497,17 @@ class mxGraphHandler {
|
||||||
!this.graph.isCellSelected(state.cell)
|
!this.graph.isCellSelected(state.cell)
|
||||||
) {
|
) {
|
||||||
const { model } = this.graph;
|
const { model } = this.graph;
|
||||||
let next = this.graph.view.getState(model.getParent(state.cell));
|
let next = this.graph.view.getState(state.cell.getParent());
|
||||||
|
|
||||||
while (
|
while (
|
||||||
next != null &&
|
next != null &&
|
||||||
!this.graph.isCellSelected(next.cell) &&
|
!this.graph.isCellSelected(next.cell) &&
|
||||||
(model.isVertex(next.cell) || model.isEdge(next.cell)) &&
|
(next.cell.isVertex() || next.cell.isEdge()) &&
|
||||||
this.isPropagateSelectionCell(state.cell, true, me)
|
this.isPropagateSelectionCell(state.cell, true, me)
|
||||||
) {
|
) {
|
||||||
state = next;
|
state = next;
|
||||||
next = this.graph.view.getState(
|
next = this.graph.view.getState(
|
||||||
this.graph.getModel().getParent(state.cell)
|
state.cell.getParent()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ class mxGraphHandler {
|
||||||
return this.graph.cellEditor.getEditingCell() != cell;
|
return this.graph.cellEditor.getEditingCell() != cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = this.graph.model.getParent(cell);
|
cell = cell.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,15 +576,15 @@ class mxGraphHandler {
|
||||||
!isAltDown(me.getEvent())
|
!isAltDown(me.getEvent())
|
||||||
) {
|
) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
let parent = model.getParent(cell);
|
let parent = cell.getParent();
|
||||||
|
|
||||||
while (
|
while (
|
||||||
this.graph.view.getState(parent) != null &&
|
this.graph.view.getState(parent) != null &&
|
||||||
(model.isVertex(parent) || model.isEdge(parent)) &&
|
(parent.isVertex() || parent.isEdge()) &&
|
||||||
this.isPropagateSelectionCell(cell, false, me)
|
this.isPropagateSelectionCell(cell, false, me)
|
||||||
) {
|
) {
|
||||||
cell = parent;
|
cell = parent;
|
||||||
parent = model.getParent(cell);
|
parent = cell.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,15 +645,15 @@ class mxGraphHandler {
|
||||||
|
|
||||||
if (this.isMoveEnabled()) {
|
if (this.isMoveEnabled()) {
|
||||||
const { model } = this.graph;
|
const { model } = this.graph;
|
||||||
const geo = model.getGeometry(cell);
|
const geo = cell.getGeometry();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.graph.isCellMovable(cell) &&
|
this.graph.isCellMovable(cell) &&
|
||||||
(!model.isEdge(cell) ||
|
(!cell.isEdge() ||
|
||||||
this.graph.getSelectionCount() > 1 ||
|
this.graph.getSelectionCount() > 1 ||
|
||||||
(geo.points != null && geo.points.length > 0) ||
|
(geo.points != null && geo.points.length > 0) ||
|
||||||
model.getTerminal(cell, true) == null ||
|
cell.getTerminal(true) == null ||
|
||||||
model.getTerminal(cell, false) == null ||
|
cell.getTerminal(false) == null ||
|
||||||
this.graph.allowDanglingEdges ||
|
this.graph.allowDanglingEdges ||
|
||||||
(this.graph.isCloneEvent(me.getEvent()) &&
|
(this.graph.isCloneEvent(me.getEvent()) &&
|
||||||
this.graph.isCellsCloneable()))
|
this.graph.isCellsCloneable()))
|
||||||
|
@ -682,9 +682,9 @@ class mxGraphHandler {
|
||||||
const filter = mxUtils.bind(this, cell => {
|
const filter = mxUtils.bind(this, cell => {
|
||||||
return (
|
return (
|
||||||
this.graph.view.getState(cell) != null &&
|
this.graph.view.getState(cell) != null &&
|
||||||
model.isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
model.getGeometry(cell) != null &&
|
cell.getGeometry() != null &&
|
||||||
!model.getGeometry(cell).relative
|
!cell.getGeometry().relative
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -774,14 +774,14 @@ class mxGraphHandler {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
if (model.isVertex(cells[i]) || model.isEdge(cells[i])) {
|
if (cells[i].isVertex() || cells[i].isEdge()) {
|
||||||
const state = this.graph.view.getState(cells[i]);
|
const state = this.graph.view.getState(cells[i]);
|
||||||
|
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
let bbox = state;
|
let bbox = state;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
model.isVertex(cells[i]) &&
|
cells[i].isVertex() &&
|
||||||
state.shape != null &&
|
state.shape != null &&
|
||||||
state.shape.boundingBox != null
|
state.shape.boundingBox != null
|
||||||
) {
|
) {
|
||||||
|
@ -859,8 +859,8 @@ class mxGraphHandler {
|
||||||
|
|
||||||
if (this.guidesEnabled) {
|
if (this.guidesEnabled) {
|
||||||
this.guide = this.createGuide();
|
this.guide = this.createGuide();
|
||||||
const parent = this.graph.model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
const ignore = this.graph.model.getChildCount(parent) < 2;
|
const ignore = parent.getChildCount() < 2;
|
||||||
|
|
||||||
// Uses connected states as guides
|
// Uses connected states as guides
|
||||||
const connected = new mxDictionary();
|
const connected = new mxDictionary();
|
||||||
|
@ -878,7 +878,7 @@ class mxGraphHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.guide.isStateIgnored = state => {
|
this.guide.isStateIgnored = state => {
|
||||||
const p = this.graph.model.getParent(state.cell);
|
const p = state.cell.getParent();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
state.cell != null &&
|
state.cell != null &&
|
||||||
|
@ -887,7 +887,7 @@ class mxGraphHandler {
|
||||||
!ignore &&
|
!ignore &&
|
||||||
!connected.get(state) &&
|
!connected.get(state) &&
|
||||||
(this.target == null ||
|
(this.target == null ||
|
||||||
this.graph.model.getChildCount(this.target) >= 2) &&
|
this.target.getChildCount() >= 2) &&
|
||||||
p !== (this.target || parent)))
|
p !== (this.target || parent)))
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -908,10 +908,10 @@ class mxGraphHandler {
|
||||||
dict.put(cell, state);
|
dict.put(cell, state);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
const childCount = this.graph.model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
count += this.addStates(this.graph.model.getChildAt(cell, i), dict);
|
count += this.addStates(cell.getChildAt(i), dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1008,7 +1008,7 @@ class mxGraphHandler {
|
||||||
* Returns true if the given cell is a valid drop target.
|
* Returns true if the given cell is a valid drop target.
|
||||||
*/
|
*/
|
||||||
isValidDropTarget(target, me) {
|
isValidDropTarget(target, me) {
|
||||||
return this.graph.model.getParent(this.cell) !== target;
|
return this.cell.getParent() !== target;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1108,7 +1108,7 @@ class mxGraphHandler {
|
||||||
this.connectOnDrop &&
|
this.connectOnDrop &&
|
||||||
cell != null &&
|
cell != null &&
|
||||||
this.cells.length === 1 &&
|
this.cells.length === 1 &&
|
||||||
graph.getModel().isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
graph.isCellConnectable(cell)
|
graph.isCellConnectable(cell)
|
||||||
) {
|
) {
|
||||||
state = graph.getView().getState(cell);
|
state = graph.getView().getState(cell);
|
||||||
|
@ -1187,7 +1187,7 @@ class mxGraphHandler {
|
||||||
graph.isEnabled() &&
|
graph.isEnabled() &&
|
||||||
graph.isCellMovable(me.getCell())
|
graph.isCellMovable(me.getCell())
|
||||||
) {
|
) {
|
||||||
if (graph.getModel().isEdge(me.getCell())) {
|
if (me.getCell().isEdge()) {
|
||||||
cursor = mxConstants.CURSOR_MOVABLE_EDGE;
|
cursor = mxConstants.CURSOR_MOVABLE_EDGE;
|
||||||
} else {
|
} else {
|
||||||
cursor = mxConstants.CURSOR_MOVABLE_VERTEX;
|
cursor = mxConstants.CURSOR_MOVABLE_VERTEX;
|
||||||
|
@ -1289,7 +1289,7 @@ class mxGraphHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporarily changes position
|
// Temporarily changes position
|
||||||
if (this.graph.model.isVertex(state.cell)) {
|
if (state.cell.isVertex()) {
|
||||||
state.x += dx;
|
state.x += dx;
|
||||||
state.y += dy;
|
state.y += dy;
|
||||||
|
|
||||||
|
@ -1338,7 +1338,7 @@ class mxGraphHandler {
|
||||||
for (let i = 0; i < states.length; i += 1) {
|
for (let i = 0; i < states.length; i += 1) {
|
||||||
const state = states[i][0];
|
const state = states[i][0];
|
||||||
|
|
||||||
if (this.graph.model.isEdge(state.cell)) {
|
if (state.cell.isEdge()) {
|
||||||
const geometry = this.graph.getCellGeometry(state.cell);
|
const geometry = this.graph.getCellGeometry(state.cell);
|
||||||
const points = [];
|
const points = [];
|
||||||
|
|
||||||
|
@ -1602,7 +1602,7 @@ class mxGraphHandler {
|
||||||
this.connectOnDrop &&
|
this.connectOnDrop &&
|
||||||
this.target == null &&
|
this.target == null &&
|
||||||
cell != null &&
|
cell != null &&
|
||||||
graph.getModel().isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
graph.isCellConnectable(cell) &&
|
graph.isCellConnectable(cell) &&
|
||||||
graph.isEdgeValid(null, this.cell, cell)
|
graph.isEdgeValid(null, this.cell, cell)
|
||||||
) {
|
) {
|
||||||
|
@ -1702,7 +1702,7 @@ class mxGraphHandler {
|
||||||
*/
|
*/
|
||||||
// shouldRemoveCellsFromParent(parent: mxCell, cells: mxCell[], evt: Event): boolean;
|
// shouldRemoveCellsFromParent(parent: mxCell, cells: mxCell[], evt: Event): boolean;
|
||||||
shouldRemoveCellsFromParent(parent, cells, evt) {
|
shouldRemoveCellsFromParent(parent, cells, evt) {
|
||||||
if (this.graph.getModel().isVertex(parent)) {
|
if (parent.isVertex()) {
|
||||||
const pState = this.graph.getView().getState(parent);
|
const pState = this.graph.getView().getState(parent);
|
||||||
|
|
||||||
if (pState != null) {
|
if (pState != null) {
|
||||||
|
@ -1741,7 +1741,7 @@ class mxGraphHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes cells from parent
|
// Removes cells from parent
|
||||||
const parent = this.graph.getModel().getParent(this.cell);
|
const parent = this.cell.getParent();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
target == null &&
|
target == null &&
|
||||||
|
@ -1771,7 +1771,7 @@ class mxGraphHandler {
|
||||||
|
|
||||||
// LATER: Recurse up the cell hierarchy
|
// LATER: Recurse up the cell hierarchy
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
const par = this.graph.model.getParent(cells[i]);
|
const par = cells[i].getParent();
|
||||||
|
|
||||||
if (par != null && !dict.get(par)) {
|
if (par != null && !dict.get(par)) {
|
||||||
dict.put(par, true);
|
dict.put(par, true);
|
||||||
|
@ -1818,10 +1818,10 @@ class mxGraphHandler {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
state != null &&
|
state != null &&
|
||||||
(this.graph.model.isEdge(state.cell) ||
|
(state.cell.isEdge() ||
|
||||||
this.graph.model.isVertex(state.cell)) &&
|
state.cell.isVertex()) &&
|
||||||
this.graph.isCellDeletable(state.cell) &&
|
this.graph.isCellDeletable(state.cell) &&
|
||||||
this.graph.model.getChildCount(state.cell) === 0 &&
|
state.cell.getChildCount() === 0 &&
|
||||||
this.graph.isTransparentState(state)
|
this.graph.isTransparentState(state)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ class mxVertexHandler {
|
||||||
this.sizers.push(this.createSizer('se-resize', i++));
|
this.sizers.push(this.createSizer('se-resize', i++));
|
||||||
}
|
}
|
||||||
|
|
||||||
const geo = this.graph.model.getGeometry(this.state.cell);
|
const geo = this.state.cell.getGeometry();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
geo != null &&
|
geo != null &&
|
||||||
|
@ -720,7 +720,7 @@ class mxVertexHandler {
|
||||||
if (this.selectionBorder != null) {
|
if (this.selectionBorder != null) {
|
||||||
this.livePreviewActive =
|
this.livePreviewActive =
|
||||||
this.livePreview &&
|
this.livePreview &&
|
||||||
this.graph.model.getChildCount(this.state.cell) === 0;
|
this.state.cell.getChildCount() === 0;
|
||||||
this.inTolerance = true;
|
this.inTolerance = true;
|
||||||
this.childOffsetX = 0;
|
this.childOffsetX = 0;
|
||||||
this.childOffsetY = 0;
|
this.childOffsetY = 0;
|
||||||
|
@ -733,11 +733,11 @@ class mxVertexHandler {
|
||||||
} else {
|
} else {
|
||||||
// Saves reference to parent state
|
// Saves reference to parent state
|
||||||
const { model } = this.state.view.graph;
|
const { model } = this.state.view.graph;
|
||||||
const parent = model.getParent(this.state.cell);
|
const parent = this.state.cell.getParent();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.state.view.currentRoot !== parent &&
|
this.state.view.currentRoot !== parent &&
|
||||||
(model.isVertex(parent) || model.isEdge(parent))
|
(parent.isVertex() || parent.isEdge())
|
||||||
) {
|
) {
|
||||||
this.parentState = this.state.view.graph.view.getState(parent);
|
this.parentState = this.state.view.graph.view.getState(parent);
|
||||||
}
|
}
|
||||||
|
@ -989,7 +989,7 @@ class mxVertexHandler {
|
||||||
* Returns true if a ghost preview should be used for custom handles.
|
* Returns true if a ghost preview should be used for custom handles.
|
||||||
*/
|
*/
|
||||||
isGhostPreview() {
|
isGhostPreview() {
|
||||||
return this.state.view.graph.model.getChildCount(this.state.cell) > 0;
|
return this.state.cell.getChildCount() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1466,8 +1466,8 @@ class mxVertexHandler {
|
||||||
if (angle !== 0) {
|
if (angle !== 0) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
|
|
||||||
if (model.isVertex(cell) || model.isEdge(cell)) {
|
if (cell.isVertex() || cell.isEdge()) {
|
||||||
if (!model.isEdge(cell)) {
|
if (!cell.isEdge()) {
|
||||||
const style = this.graph.getCurrentCellStyle(cell);
|
const style = this.graph.getCurrentCellStyle(cell);
|
||||||
const total = (style[mxConstants.STYLE_ROTATION] || 0) + angle;
|
const total = (style[mxConstants.STYLE_ROTATION] || 0) + angle;
|
||||||
this.graph.setCellStyles(mxConstants.STYLE_ROTATION, total, [cell]);
|
this.graph.setCellStyles(mxConstants.STYLE_ROTATION, total, [cell]);
|
||||||
|
@ -1478,18 +1478,18 @@ class mxVertexHandler {
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
const pgeo = this.graph.getCellGeometry(parent);
|
const pgeo = this.graph.getCellGeometry(parent);
|
||||||
|
|
||||||
if (pgeo != null && !model.isEdge(parent)) {
|
if (pgeo != null && !parent.isEdge()) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
geo.rotate(angle, new mxPoint(pgeo.width / 2, pgeo.height / 2));
|
geo.rotate(angle, new mxPoint(pgeo.width / 2, pgeo.height / 2));
|
||||||
model.setGeometry(cell, geo);
|
model.setGeometry(cell, geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((model.isVertex(cell) && !geo.relative) || model.isEdge(cell)) {
|
if ((cell.isVertex() && !geo.relative) || cell.isEdge()) {
|
||||||
// Recursive rotation
|
// Recursive rotation
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.rotateCell(model.getChildAt(cell, i), angle, cell);
|
this.rotateCell(cell.getChildAt(i), angle, cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1580,7 +1580,7 @@ class mxVertexHandler {
|
||||||
* in the graph using <mxGraph.resizeCell>.
|
* in the graph using <mxGraph.resizeCell>.
|
||||||
*/
|
*/
|
||||||
resizeCell(cell, dx, dy, index, gridEnabled, constrained, recurse) {
|
resizeCell(cell, dx, dy, index, gridEnabled, constrained, recurse) {
|
||||||
let geo = this.graph.model.getGeometry(cell);
|
let geo = cell.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
if (index === mxEvent.LABEL_HANDLE) {
|
if (index === mxEvent.LABEL_HANDLE) {
|
||||||
|
@ -1637,10 +1637,10 @@ class mxVertexHandler {
|
||||||
// moveChildren(cell: mxCell, dx: number, dy: number): void;
|
// moveChildren(cell: mxCell, dx: number, dy: number): void;
|
||||||
moveChildren(cell, dx, dy) {
|
moveChildren(cell, dx, dy) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(cell, i);
|
const child = cell.getChildAt(i);
|
||||||
let geo = this.graph.getCellGeometry(child);
|
let geo = this.graph.getCellGeometry(child);
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
|
@ -2138,7 +2138,7 @@ class mxVertexHandler {
|
||||||
*/
|
*/
|
||||||
isParentHighlightVisible() {
|
isParentHighlightVisible() {
|
||||||
return !this.graph.isCellSelected(
|
return !this.graph.isCellSelected(
|
||||||
this.graph.model.getParent(this.state.cell)
|
this.state.cell.getParent()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2151,11 +2151,11 @@ class mxVertexHandler {
|
||||||
updateParentHighlight() {
|
updateParentHighlight() {
|
||||||
if (!this.isDestroyed()) {
|
if (!this.isDestroyed()) {
|
||||||
const visible = this.isParentHighlightVisible();
|
const visible = this.isParentHighlightVisible();
|
||||||
const parent = this.graph.model.getParent(this.state.cell);
|
const parent = this.state.cell.getParent();
|
||||||
const pstate = this.graph.view.getState(parent);
|
const pstate = this.graph.view.getState(parent);
|
||||||
|
|
||||||
if (this.parentHighlight != null) {
|
if (this.parentHighlight != null) {
|
||||||
if (this.graph.model.isVertex(parent) && visible) {
|
if (parent.isVertex() && visible) {
|
||||||
const b = this.parentHighlight.bounds;
|
const b = this.parentHighlight.bounds;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -2181,7 +2181,7 @@ class mxVertexHandler {
|
||||||
}
|
}
|
||||||
} else if (this.parentHighlightEnabled && visible) {
|
} else if (this.parentHighlightEnabled && visible) {
|
||||||
if (
|
if (
|
||||||
this.graph.model.isVertex(parent) &&
|
parent.isVertex() &&
|
||||||
pstate != null &&
|
pstate != null &&
|
||||||
pstate.parentHighlight == null
|
pstate.parentHighlight == null
|
||||||
) {
|
) {
|
||||||
|
@ -2267,7 +2267,7 @@ class mxVertexHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parentHighlight != null) {
|
if (this.parentHighlight != null) {
|
||||||
const parent = this.graph.model.getParent(this.state.cell);
|
const parent = this.state.cell.getParent();
|
||||||
const pstate = this.graph.view.getState(parent);
|
const pstate = this.graph.view.getState(parent);
|
||||||
|
|
||||||
if (pstate != null && pstate.parentHighlight === this.parentHighlight) {
|
if (pstate != null && pstate.parentHighlight === this.parentHighlight) {
|
||||||
|
|
|
@ -212,7 +212,7 @@ class mxGraphHierarchyModel {
|
||||||
// Looking for outgoing edges only
|
// Looking for outgoing edges only
|
||||||
if (
|
if (
|
||||||
cell !== vertices[i] &&
|
cell !== vertices[i] &&
|
||||||
layout.graph.model.isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
!layout.isVertexIgnored(cell)
|
!layout.isVertexIgnored(cell)
|
||||||
) {
|
) {
|
||||||
// We process all edge between this source and its targets
|
// We process all edge between this source and its targets
|
||||||
|
|
|
@ -207,7 +207,7 @@ class mxSwimlaneModel {
|
||||||
internalVertices[i].swimlaneIndex = -1;
|
internalVertices[i].swimlaneIndex = -1;
|
||||||
|
|
||||||
for (let ii = 0; ii < swimlanes.length; ii += 1) {
|
for (let ii = 0; ii < swimlanes.length; ii += 1) {
|
||||||
if (graph.model.getParent(vertices[i]) === swimlanes[ii]) {
|
if (vertices[i].getParent() === swimlanes[ii]) {
|
||||||
internalVertices[i].swimlaneIndex = ii;
|
internalVertices[i].swimlaneIndex = ii;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ class mxSwimlaneModel {
|
||||||
// Looking for outgoing edges only
|
// Looking for outgoing edges only
|
||||||
if (
|
if (
|
||||||
cell !== vertices[i] &&
|
cell !== vertices[i] &&
|
||||||
layout.graph.model.isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
!layout.isVertexIgnored(cell)
|
!layout.isVertexIgnored(cell)
|
||||||
) {
|
) {
|
||||||
// We process all edge between this source and its targets
|
// We process all edge between this source and its targets
|
||||||
|
|
|
@ -235,7 +235,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
parent !== this.root &&
|
parent !== this.root &&
|
||||||
model.isVertex(parent) != null &&
|
parent.isVertex() != null &&
|
||||||
this.maintainParentLocation
|
this.maintainParentLocation
|
||||||
) {
|
) {
|
||||||
const geo = this.graph.getCellGeometry(parent);
|
const geo = this.graph.getCellGeometry(parent);
|
||||||
|
@ -253,7 +253,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
|
||||||
const ancestor =
|
const ancestor =
|
||||||
parent != null ? model.isAncestor(parent, roots[i]) : true;
|
parent != null ? model.isAncestor(parent, roots[i]) : true;
|
||||||
|
|
||||||
if (ancestor && model.isVertex(roots[i])) {
|
if (ancestor && roots[i].isVertex()) {
|
||||||
rootsCopy.push(roots[i]);
|
rootsCopy.push(roots[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
|
||||||
for (const i in vertices) {
|
for (const i in vertices) {
|
||||||
const cell = vertices[i];
|
const cell = vertices[i];
|
||||||
|
|
||||||
if (model.isVertex(cell) && this.graph.isCellVisible(cell)) {
|
if (cell.isVertex() && this.graph.isCellVisible(cell)) {
|
||||||
const conns = this.getEdges(cell);
|
const conns = this.getEdges(cell);
|
||||||
let fanOut = 0;
|
let fanOut = 0;
|
||||||
let fanIn = 0;
|
let fanIn = 0;
|
||||||
|
@ -369,10 +369,10 @@ class mxHierarchicalLayout extends mxGraphLayout {
|
||||||
const { model } = this.graph;
|
const { model } = this.graph;
|
||||||
let edges = [];
|
let edges = [];
|
||||||
const isCollapsed = this.graph.isCellCollapsed(cell);
|
const isCollapsed = this.graph.isCellCollapsed(cell);
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(cell, i);
|
const child = cell.getChildAt(i);
|
||||||
|
|
||||||
if (this.isPort(child)) {
|
if (this.isPort(child)) {
|
||||||
edges = edges.concat(model.getEdges(child, true, true));
|
edges = edges.concat(model.getEdges(child, true, true));
|
||||||
|
@ -446,12 +446,10 @@ class mxHierarchicalLayout extends mxGraphLayout {
|
||||||
|
|
||||||
if (terminal != null) {
|
if (terminal != null) {
|
||||||
if (this.isPort(terminal)) {
|
if (this.isPort(terminal)) {
|
||||||
terminal = this.graph.model.getParent(terminal);
|
terminal = terminal.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
terminalCache.put(edge, terminal);
|
terminalCache.put(edge, terminal);
|
||||||
}
|
}
|
||||||
|
|
||||||
return terminal;
|
return terminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +575,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
|
||||||
const { model } = this.graph;
|
const { model } = this.graph;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
model.isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
cell !== this.parent &&
|
cell !== this.parent &&
|
||||||
this.graph.isCellVisible(cell)
|
this.graph.isCellVisible(cell)
|
||||||
) {
|
) {
|
||||||
|
@ -588,10 +586,10 @@ class mxHierarchicalLayout extends mxGraphLayout {
|
||||||
this.traverseAncestors ||
|
this.traverseAncestors ||
|
||||||
(cell === this.parent && this.graph.isCellVisible(cell))
|
(cell === this.parent && this.graph.isCellVisible(cell))
|
||||||
) {
|
) {
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(cell, i);
|
const child = cell.getChildAt(i);
|
||||||
|
|
||||||
// Ignore ports in the layout vertex list, they are dealt with
|
// Ignore ports in the layout vertex list, they are dealt with
|
||||||
// in the traversal mechanisms
|
// in the traversal mechanisms
|
||||||
|
|
|
@ -241,7 +241,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
parent = model.getParent(swimlanes[0]);
|
parent = swimlanes[0].getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maintaining parent location
|
// Maintaining parent location
|
||||||
|
@ -250,7 +250,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
parent !== this.root &&
|
parent !== this.root &&
|
||||||
model.isVertex(parent) != null &&
|
parent.isVertex() != null &&
|
||||||
this.maintainParentLocation
|
this.maintainParentLocation
|
||||||
) {
|
) {
|
||||||
const geo = this.graph.getCellGeometry(parent);
|
const geo = this.graph.getCellGeometry(parent);
|
||||||
|
@ -428,7 +428,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
cell != null &&
|
cell != null &&
|
||||||
model.isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
this.graph.isCellVisible(cell) &&
|
this.graph.isCellVisible(cell) &&
|
||||||
model.isAncestor(parent, cell)
|
model.isAncestor(parent, cell)
|
||||||
) {
|
) {
|
||||||
|
@ -491,10 +491,10 @@ class mxSwimlaneLayout extends mxGraphLayout {
|
||||||
const { model } = this.graph;
|
const { model } = this.graph;
|
||||||
let edges = [];
|
let edges = [];
|
||||||
const isCollapsed = this.graph.isCellCollapsed(cell);
|
const isCollapsed = this.graph.isCellCollapsed(cell);
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(cell, i);
|
const child = cell.getChildAt(i);
|
||||||
|
|
||||||
if (this.isPort(child)) {
|
if (this.isPort(child)) {
|
||||||
edges = edges.concat(model.getEdges(child, true, true));
|
edges = edges.concat(model.getEdges(child, true, true));
|
||||||
|
@ -576,12 +576,10 @@ class mxSwimlaneLayout extends mxGraphLayout {
|
||||||
|
|
||||||
if (terminal != null) {
|
if (terminal != null) {
|
||||||
if (this.isPort(terminal)) {
|
if (this.isPort(terminal)) {
|
||||||
terminal = this.graph.model.getParent(terminal);
|
terminal = terminal.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
terminalCache.put(edge, terminal);
|
terminalCache.put(edge, terminal);
|
||||||
}
|
}
|
||||||
|
|
||||||
return terminal;
|
return terminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,9 +710,9 @@ class mxSwimlaneLayout extends mxGraphLayout {
|
||||||
const { model } = this.graph;
|
const { model } = this.graph;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
model.isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
cell !== this.parent &&
|
cell !== this.parent &&
|
||||||
model.getParent(cell) !== this.parent &&
|
cell.getParent() !== this.parent &&
|
||||||
this.graph.isCellVisible(cell)
|
this.graph.isCellVisible(cell)
|
||||||
) {
|
) {
|
||||||
result[mxObjectIdentity.get(cell)] = cell;
|
result[mxObjectIdentity.get(cell)] = cell;
|
||||||
|
@ -724,10 +722,10 @@ class mxSwimlaneLayout extends mxGraphLayout {
|
||||||
this.traverseAncestors ||
|
this.traverseAncestors ||
|
||||||
(cell === this.parent && this.graph.isCellVisible(cell))
|
(cell === this.parent && this.graph.isCellVisible(cell))
|
||||||
) {
|
) {
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(cell, i);
|
const child = cell.getChildAt(i);
|
||||||
|
|
||||||
// Ignore ports in the layout vertex list, they are dealt with
|
// Ignore ports in the layout vertex list, they are dealt with
|
||||||
// in the traversal mechanisms
|
// in the traversal mechanisms
|
||||||
|
|
|
@ -1370,11 +1370,11 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
|
||||||
y += jetty;
|
y += jetty;
|
||||||
let x = jettys[parallelEdgeCount * 4 + arrayOffset];
|
let x = jettys[parallelEdgeCount * 4 + arrayOffset];
|
||||||
|
|
||||||
const modelSource = graph.model.getTerminal(realEdge, true);
|
const modelSource = realEdge.getTerminal(true);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.layout.isPort(modelSource) &&
|
this.layout.isPort(modelSource) &&
|
||||||
graph.model.getParent(modelSource) === realSource
|
modelSource.getParent() === realSource
|
||||||
) {
|
) {
|
||||||
const state = graph.view.getState(modelSource);
|
const state = graph.view.getState(modelSource);
|
||||||
|
|
||||||
|
@ -1477,12 +1477,12 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
|
||||||
const y = rankY - jetty;
|
const y = rankY - jetty;
|
||||||
let x = jettys[parallelEdgeCount * 4 + 2 - arrayOffset];
|
let x = jettys[parallelEdgeCount * 4 + 2 - arrayOffset];
|
||||||
|
|
||||||
const modelTarget = graph.model.getTerminal(realEdge, false);
|
const modelTarget = realEdge.getTerminal(false);
|
||||||
const realTarget = this.layout.getVisibleTerminal(realEdge, false);
|
const realTarget = this.layout.getVisibleTerminal(realEdge, false);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.layout.isPort(modelTarget) &&
|
this.layout.isPort(modelTarget) &&
|
||||||
graph.model.getParent(modelTarget) === realTarget
|
modelTarget.getParent() === realTarget
|
||||||
) {
|
) {
|
||||||
const state = graph.view.getState(modelTarget);
|
const state = graph.view.getState(modelTarget);
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,10 @@ class mxCircleLayout extends mxGraphLayout {
|
||||||
let top = null;
|
let top = null;
|
||||||
let left = null;
|
let left = null;
|
||||||
const vertices = [];
|
const vertices = [];
|
||||||
const childCount = model.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const cell = model.getChildAt(parent, i);
|
const cell = parent.getChildAt(i);
|
||||||
|
|
||||||
if (!this.isVertexIgnored(cell)) {
|
if (!this.isVertexIgnored(cell)) {
|
||||||
vertices.push(cell);
|
vertices.push(cell);
|
||||||
|
|
|
@ -254,7 +254,7 @@ class mxCompactTreeLayout extends mxGraphLayout {
|
||||||
if (
|
if (
|
||||||
this.graph.getEdges(
|
this.graph.getEdges(
|
||||||
parent,
|
parent,
|
||||||
model.getParent(parent),
|
parent.getParent(),
|
||||||
this.invert,
|
this.invert,
|
||||||
!this.invert,
|
!this.invert,
|
||||||
false
|
false
|
||||||
|
@ -303,7 +303,7 @@ class mxCompactTreeLayout extends mxGraphLayout {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
parent !== this.root &&
|
parent !== this.root &&
|
||||||
model.isVertex(parent) != null &&
|
parent.isVertex() != null &&
|
||||||
this.maintainParentLocation
|
this.maintainParentLocation
|
||||||
) {
|
) {
|
||||||
const geo = this.graph.getCellGeometry(parent);
|
const geo = this.graph.getCellGeometry(parent);
|
||||||
|
@ -536,7 +536,7 @@ class mxCompactTreeLayout extends mxGraphLayout {
|
||||||
: view.getVisibleTerminal(edge, this.invert);
|
: view.getVisibleTerminal(edge, this.invert);
|
||||||
const tmp = this.dfs(target, parent);
|
const tmp = this.dfs(target, parent);
|
||||||
|
|
||||||
if (tmp != null && model.getGeometry(target) != null) {
|
if (tmp != null && target.getGeometry() != null) {
|
||||||
if (prev == null) {
|
if (prev == null) {
|
||||||
node.child = tmp;
|
node.child = tmp;
|
||||||
} else {
|
} else {
|
||||||
|
@ -853,14 +853,14 @@ class mxCompactTreeLayout extends mxGraphLayout {
|
||||||
apply(node, bounds) {
|
apply(node, bounds) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const { cell } = node;
|
const { cell } = node;
|
||||||
let g = model.getGeometry(cell);
|
let g = cell.getGeometry();
|
||||||
|
|
||||||
if (cell != null && g != null) {
|
if (cell != null && g != null) {
|
||||||
if (this.isVertexMovable(cell)) {
|
if (this.isVertexMovable(cell)) {
|
||||||
g = this.setVertexLocation(cell, node.x, node.y);
|
g = this.setVertexLocation(cell, node.x, node.y);
|
||||||
|
|
||||||
if (this.resizeParent) {
|
if (this.resizeParent) {
|
||||||
const parent = model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
const id = mxCellPath.create(parent);
|
const id = mxCellPath.create(parent);
|
||||||
|
|
||||||
// Implements set semantic
|
// Implements set semantic
|
||||||
|
|
|
@ -37,10 +37,10 @@ class mxEdgeLabelLayout extends mxGraphLayout {
|
||||||
// Gets all vertices and edges inside the parent
|
// Gets all vertices and edges inside the parent
|
||||||
const edges = [];
|
const edges = [];
|
||||||
const vertices = [];
|
const vertices = [];
|
||||||
const childCount = model.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const cell = model.getChildAt(parent, i);
|
const cell = parent.getChildAt(i);
|
||||||
const state = view.getState(cell);
|
const state = view.getState(cell);
|
||||||
|
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
|
@ -117,7 +117,7 @@ class mxEdgeLabelLayout extends mxGraphLayout {
|
||||||
dx = 0;
|
dx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let g = model.getGeometry(edge.cell);
|
let g = edge.cell.getGeometry();
|
||||||
|
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
g = g.clone();
|
g = g.clone();
|
||||||
|
|
|
@ -150,12 +150,12 @@ class mxGraphLayout {
|
||||||
const result = func(vertex, edge);
|
const result = func(vertex, edge);
|
||||||
|
|
||||||
if (result == null || result) {
|
if (result == null || result) {
|
||||||
const edgeCount = this.graph.model.getEdgeCount(vertex);
|
const edgeCount = vertex.getEdgeCount();
|
||||||
|
|
||||||
if (edgeCount > 0) {
|
if (edgeCount > 0) {
|
||||||
for (let i = 0; i < edgeCount; i += 1) {
|
for (let i = 0; i < edgeCount; i += 1) {
|
||||||
const e = this.graph.model.getEdgeAt(vertex, i);
|
const e = vertex.getEdgeAt(i);
|
||||||
const isSource = this.graph.model.getTerminal(e, true) === vertex;
|
const isSource = e.getTerminal(true) === vertex;
|
||||||
|
|
||||||
if (!directed || isSource) {
|
if (!directed || isSource) {
|
||||||
const next = this.graph.view.getVisibleTerminal(e, !isSource);
|
const next = this.graph.view.getVisibleTerminal(e, !isSource);
|
||||||
|
@ -178,7 +178,7 @@ class mxGraphLayout {
|
||||||
// isAncestor(parent: mxCell, child: mxCell, traverseAncestors?: boolean): boolean;
|
// isAncestor(parent: mxCell, child: mxCell, traverseAncestors?: boolean): boolean;
|
||||||
isAncestor(parent, child, traverseAncestors) {
|
isAncestor(parent, child, traverseAncestors) {
|
||||||
if (!traverseAncestors) {
|
if (!traverseAncestors) {
|
||||||
return this.graph.model.getParent(child) === parent;
|
return child.getParent() === parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child === parent) {
|
if (child === parent) {
|
||||||
|
@ -186,7 +186,7 @@ class mxGraphLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (child != null && child !== parent) {
|
while (child != null && child !== parent) {
|
||||||
child = this.graph.model.getParent(child);
|
child = child.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return child === parent;
|
return child === parent;
|
||||||
|
@ -213,7 +213,7 @@ class mxGraphLayout {
|
||||||
// isVertexIgnored(vertex: mxCell): boolean;
|
// isVertexIgnored(vertex: mxCell): boolean;
|
||||||
isVertexIgnored(vertex) {
|
isVertexIgnored(vertex) {
|
||||||
return (
|
return (
|
||||||
!this.graph.getModel().isVertex(vertex) ||
|
!vertex.isVertex() ||
|
||||||
!this.graph.isCellVisible(vertex)
|
!this.graph.isCellVisible(vertex)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -229,10 +229,10 @@ class mxGraphLayout {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
!model.isEdge(edge) ||
|
!edge.isEdge() ||
|
||||||
!this.graph.isCellVisible(edge) ||
|
!this.graph.isCellVisible(edge) ||
|
||||||
model.getTerminal(edge, true) == null ||
|
edge.getTerminal(true) == null ||
|
||||||
model.getTerminal(edge, false) == null
|
edge.getTerminal(false) == null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,15 +268,15 @@ class mxGraphLayout {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
|
|
||||||
if (model.isAncestor(this.parent, parent)) {
|
if (model.isAncestor(this.parent, parent)) {
|
||||||
let parentGeo = model.getGeometry(parent);
|
let parentGeo = parent.getGeometry();
|
||||||
|
|
||||||
while (parent !== this.parent) {
|
while (parent !== this.parent) {
|
||||||
result.x += parentGeo.x;
|
result.x += parentGeo.x;
|
||||||
result.y += parentGeo.y;
|
result.y += parentGeo.y;
|
||||||
|
|
||||||
parent = model.getParent(parent);
|
parent = parent.getParent();
|
||||||
|
|
||||||
parentGeo = model.getGeometry(parent);
|
parentGeo = parent.getGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ class mxGraphLayout {
|
||||||
setEdgePoints(edge, points) {
|
setEdgePoints(edge, points) {
|
||||||
if (edge != null) {
|
if (edge != null) {
|
||||||
const { model } = this.graph;
|
const { model } = this.graph;
|
||||||
let geometry = model.getGeometry(edge);
|
let geometry = edge.getGeometry();
|
||||||
|
|
||||||
if (geometry == null) {
|
if (geometry == null) {
|
||||||
geometry = new mxGeometry();
|
geometry = new mxGeometry();
|
||||||
|
@ -302,7 +302,7 @@ class mxGraphLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parent != null && points != null) {
|
if (this.parent != null && points != null) {
|
||||||
const parent = model.getParent(edge);
|
const parent = edge.getParent();
|
||||||
|
|
||||||
const parentOffset = this.getParentOffset(parent);
|
const parentOffset = this.getParentOffset(parent);
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ class mxGraphLayout {
|
||||||
// setVertexLocation(cell: mxCell, x: number, y: number): mxRectangle;
|
// setVertexLocation(cell: mxCell, x: number, y: number): mxRectangle;
|
||||||
setVertexLocation(cell, x, y) {
|
setVertexLocation(cell, x, y) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
let geometry = model.getGeometry(cell);
|
let geometry = cell.getGeometry();
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
if (geometry != null) {
|
if (geometry != null) {
|
||||||
|
@ -363,7 +363,7 @@ class mxGraphLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parent != null) {
|
if (this.parent != null) {
|
||||||
const parent = model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
|
|
||||||
if (parent != null && parent !== this.parent) {
|
if (parent != null && parent !== this.parent) {
|
||||||
const parentOffset = this.getParentOffset(parent);
|
const parentOffset = this.getParentOffset(parent);
|
||||||
|
@ -391,7 +391,7 @@ class mxGraphLayout {
|
||||||
*/
|
*/
|
||||||
// getVertexBounds(cell: mxCell): mxRectangle;
|
// getVertexBounds(cell: mxCell): mxRectangle;
|
||||||
getVertexBounds(cell) {
|
getVertexBounds(cell) {
|
||||||
let geo = this.graph.getModel().getGeometry(cell);
|
let geo = cell.getGeometry();
|
||||||
|
|
||||||
// Checks for oversize label bounding box and corrects
|
// Checks for oversize label bounding box and corrects
|
||||||
// the return value accordingly
|
// the return value accordingly
|
||||||
|
@ -424,7 +424,7 @@ class mxGraphLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parent != null) {
|
if (this.parent != null) {
|
||||||
const parent = this.graph.getModel().getParent(cell);
|
const parent = this.cell.getParent();
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
|
||||||
if (parent != null && parent !== this.parent) {
|
if (parent != null && parent !== this.parent) {
|
||||||
|
|
|
@ -122,10 +122,10 @@ class mxParallelEdgeLayout extends mxGraphLayout {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const childCount = model.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
addCell(model.getChildAt(parent, i));
|
addCell(parent.getChildAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ class mxParallelEdgeLayout extends mxGraphLayout {
|
||||||
const edge = parallels[0];
|
const edge = parallels[0];
|
||||||
const view = this.graph.getView();
|
const view = this.graph.getView();
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const src = model.getGeometry(view.getVisibleTerminal(edge, true));
|
const src = view.getVisibleTerminal(edge, true).getGeometry();
|
||||||
const trg = model.getGeometry(view.getVisibleTerminal(edge, false));
|
const trg = view.getVisibleTerminal(edge, false).getGeometry();
|
||||||
|
|
||||||
let x0;
|
let x0;
|
||||||
let y0;
|
let y0;
|
||||||
|
|
|
@ -79,17 +79,17 @@ class mxPartitionLayout extends mxGraphLayout {
|
||||||
// moveCell(cell: mxCell, x: number, y: number): void;
|
// moveCell(cell: mxCell, x: number, y: number): void;
|
||||||
moveCell(cell, x, y) {
|
moveCell(cell, x, y) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const parent = model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
|
|
||||||
if (cell != null && parent != null) {
|
if (cell != null && parent != null) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let last = 0;
|
let last = 0;
|
||||||
const childCount = model.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
|
|
||||||
// Finds index of the closest swimlane
|
// Finds index of the closest swimlane
|
||||||
// TODO: Take into account the orientation
|
// TODO: Take into account the orientation
|
||||||
for (i = 0; i < childCount; i += 1) {
|
for (i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(parent, i);
|
const child = parent.getChildAt(i);
|
||||||
const bounds = this.getVertexBounds(child);
|
const bounds = this.getVertexBounds(child);
|
||||||
|
|
||||||
if (bounds != null) {
|
if (bounds != null) {
|
||||||
|
@ -119,7 +119,7 @@ class mxPartitionLayout extends mxGraphLayout {
|
||||||
execute(parent) {
|
execute(parent) {
|
||||||
const horizontal = this.isHorizontal();
|
const horizontal = this.isHorizontal();
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
let pgeo = model.getGeometry(parent);
|
let pgeo = parent.getGeometry();
|
||||||
|
|
||||||
// Handles special case where the parent is either a layer with no
|
// Handles special case where the parent is either a layer with no
|
||||||
// geometry or the current root of the view in which case the size
|
// geometry or the current root of the view in which case the size
|
||||||
|
@ -136,10 +136,10 @@ class mxPartitionLayout extends mxGraphLayout {
|
||||||
|
|
||||||
if (pgeo != null) {
|
if (pgeo != null) {
|
||||||
const children = [];
|
const children = [];
|
||||||
const childCount = model.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(parent, i);
|
const child = parent.getChildAt(i);
|
||||||
|
|
||||||
if (!this.isVertexIgnored(child) && this.isVertexMovable(child)) {
|
if (!this.isVertexIgnored(child) && this.isVertexMovable(child)) {
|
||||||
children.push(child);
|
children.push(child);
|
||||||
|
@ -174,7 +174,7 @@ class mxPartitionLayout extends mxGraphLayout {
|
||||||
try {
|
try {
|
||||||
for (let i = 0; i < n; i += 1) {
|
for (let i = 0; i < n; i += 1) {
|
||||||
const child = children[i];
|
const child = children[i];
|
||||||
let geo = model.getGeometry(child);
|
let geo = child.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
|
|
@ -160,13 +160,13 @@ class mxStackLayout extends mxGraphLayout {
|
||||||
// moveCell(cell: mxCell, x: number, y: number): void;
|
// moveCell(cell: mxCell, x: number, y: number): void;
|
||||||
moveCell(cell, x, y) {
|
moveCell(cell, x, y) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const parent = model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
const horizontal = this.isHorizontal();
|
const horizontal = this.isHorizontal();
|
||||||
|
|
||||||
if (cell != null && parent != null) {
|
if (cell != null && parent != null) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let last = 0;
|
let last = 0;
|
||||||
const childCount = model.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
let value = horizontal ? x : y;
|
let value = horizontal ? x : y;
|
||||||
const pstate = this.graph.getView().getState(parent);
|
const pstate = this.graph.getView().getState(parent);
|
||||||
|
|
||||||
|
@ -177,10 +177,10 @@ class mxStackLayout extends mxGraphLayout {
|
||||||
value /= this.graph.view.scale;
|
value /= this.graph.view.scale;
|
||||||
|
|
||||||
for (i = 0; i < childCount; i += 1) {
|
for (i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(parent, i);
|
const child = parent.getChildAt(i);
|
||||||
|
|
||||||
if (child !== cell) {
|
if (child !== cell) {
|
||||||
const bounds = model.getGeometry(child);
|
const bounds = child.getGeometry();
|
||||||
|
|
||||||
if (bounds != null) {
|
if (bounds != null) {
|
||||||
const tmp = horizontal
|
const tmp = horizontal
|
||||||
|
@ -210,7 +210,7 @@ class mxStackLayout extends mxGraphLayout {
|
||||||
// getParentSize(): void;
|
// getParentSize(): void;
|
||||||
getParentSize(parent) {
|
getParentSize(parent) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
let pgeo = model.getGeometry(parent);
|
let pgeo = parent.getGeometry();
|
||||||
|
|
||||||
// Handles special case where the parent is either a layer with no
|
// Handles special case where the parent is either a layer with no
|
||||||
// geometry or the current root of the view in which case the size
|
// geometry or the current root of the view in which case the size
|
||||||
|
@ -234,11 +234,11 @@ class mxStackLayout extends mxGraphLayout {
|
||||||
// getLayoutCells(parent: mxCell): Array<mxCell>;
|
// getLayoutCells(parent: mxCell): Array<mxCell>;
|
||||||
getLayoutCells(parent) {
|
getLayoutCells(parent) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const childCount = model.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
const cells = [];
|
const cells = [];
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(parent, i);
|
const child = parent.getChildAt(i);
|
||||||
|
|
||||||
if (!this.isVertexIgnored(child) && this.isVertexMovable(child)) {
|
if (!this.isVertexIgnored(child) && this.isVertexMovable(child)) {
|
||||||
cells.push(child);
|
cells.push(child);
|
||||||
|
@ -346,7 +346,7 @@ class mxStackLayout extends mxGraphLayout {
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
const child = cells[i];
|
const child = cells[i];
|
||||||
let geo = model.getGeometry(child);
|
let geo = child.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
|
|
@ -58,10 +58,10 @@ class mxGraphViewCodec extends mxObjectCodec {
|
||||||
encodeCell(enc, view, cell) {
|
encodeCell(enc, view, cell) {
|
||||||
const model = view.graph.getModel();
|
const model = view.graph.getModel();
|
||||||
const state = view.getState(cell);
|
const state = view.getState(cell);
|
||||||
const parent = model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
|
|
||||||
if (parent == null || state != null) {
|
if (parent == null || state != null) {
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
const geo = view.graph.getCellGeometry(cell);
|
const geo = view.graph.getCellGeometry(cell);
|
||||||
let name = null;
|
let name = null;
|
||||||
|
|
||||||
|
@ -69,11 +69,11 @@ class mxGraphViewCodec extends mxObjectCodec {
|
||||||
name = 'layer';
|
name = 'layer';
|
||||||
} else if (parent == null) {
|
} else if (parent == null) {
|
||||||
name = 'graph';
|
name = 'graph';
|
||||||
} else if (model.isEdge(cell)) {
|
} else if (cell.isEdge()) {
|
||||||
name = 'edge';
|
name = 'edge';
|
||||||
} else if (childCount > 0 && geo != null) {
|
} else if (childCount > 0 && geo != null) {
|
||||||
name = 'group';
|
name = 'group';
|
||||||
} else if (model.isVertex(cell)) {
|
} else if (cell.isVertex()) {
|
||||||
name = 'vertex';
|
name = 'vertex';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ class mxGraphViewCodec extends mxObjectCodec {
|
||||||
const childNode = this.encodeCell(
|
const childNode = this.encodeCell(
|
||||||
enc,
|
enc,
|
||||||
view,
|
view,
|
||||||
model.getChildAt(cell, i)
|
cell.getChildAt(i)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (childNode != null) {
|
if (childNode != null) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ class mxEffects {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
change.constructor !== mxGeometryChange ||
|
change.constructor !== mxGeometryChange ||
|
||||||
graph.model.isEdge(change.cell)
|
change.cell.isEdge()
|
||||||
) {
|
) {
|
||||||
mxUtils.setOpacity(state.shape.node, (100 * step) / maxStep);
|
mxUtils.setOpacity(state.shape.node, (100 * step) / maxStep);
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,10 +126,10 @@ class mxEffects {
|
||||||
// static cascadeOpacity(graph: mxGraph, cell: mxCell, opacity: number): void;
|
// static cascadeOpacity(graph: mxGraph, cell: mxCell, opacity: number): void;
|
||||||
static cascadeOpacity(graph, cell, opacity) {
|
static cascadeOpacity(graph, cell, opacity) {
|
||||||
// Fades all children
|
// Fades all children
|
||||||
const childCount = graph.model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = graph.model.getChildAt(cell, i);
|
const child = cell.getChildAt(i);
|
||||||
const childState = graph.getView().getState(child);
|
const childState = graph.getView().getState(child);
|
||||||
|
|
||||||
if (childState != null) {
|
if (childState != null) {
|
||||||
|
|
|
@ -142,7 +142,7 @@ class mxMorphing extends mxAnimation {
|
||||||
delta = this.getDelta(state);
|
delta = this.getDelta(state);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.graph.getModel().isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
(delta.x != 0 || delta.y != 0)
|
(delta.x != 0 || delta.y != 0)
|
||||||
) {
|
) {
|
||||||
const translate = this.graph.view.getTranslate();
|
const translate = this.graph.view.getTranslate();
|
||||||
|
@ -156,11 +156,11 @@ class mxMorphing extends mxAnimation {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recurse && !this.stopRecursion(state, delta)) {
|
if (recurse && !this.stopRecursion(state, delta)) {
|
||||||
const childCount = this.graph.getModel().getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.animateCell(
|
this.animateCell(
|
||||||
this.graph.getModel().getChildAt(cell, i),
|
cell.getChildAt(i),
|
||||||
move,
|
move,
|
||||||
recurse
|
recurse
|
||||||
);
|
);
|
||||||
|
@ -205,7 +205,7 @@ class mxMorphing extends mxAnimation {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
const parent = this.graph.getModel().getParent(cell);
|
const parent = this.cell.getParent();
|
||||||
const geo = this.graph.getCellGeometry(cell);
|
const geo = this.graph.getCellGeometry(cell);
|
||||||
result = this.getOriginForCell(parent);
|
result = this.getOriginForCell(parent);
|
||||||
|
|
||||||
|
|
|
@ -1075,9 +1075,9 @@ class mxEdgeStyle {
|
||||||
) {
|
) {
|
||||||
const { graph } = state.view;
|
const { graph } = state.view;
|
||||||
const sourceEdge =
|
const sourceEdge =
|
||||||
source == null ? false : graph.getModel().isEdge(source.cell);
|
source == null ? false : source.cell.isEdge();
|
||||||
const targetEdge =
|
const targetEdge =
|
||||||
target == null ? false : graph.getModel().isEdge(target.cell);
|
target == null ? false : target.cell.isEdge();
|
||||||
|
|
||||||
const pts = mxEdgeStyle.scalePointArray(
|
const pts = mxEdgeStyle.scalePointArray(
|
||||||
state.absolutePoints,
|
state.absolutePoints,
|
||||||
|
|
|
@ -69,11 +69,11 @@ class mxImageExport {
|
||||||
visitor(state, canvas);
|
visitor(state, canvas);
|
||||||
|
|
||||||
const { graph } = state.view;
|
const { graph } = state.view;
|
||||||
const childCount = graph.model.getChildCount(state.cell);
|
const childCount = state.cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const childState = graph.view.getState(
|
const childState = graph.view.getState(
|
||||||
graph.model.getChildAt(state.cell, i)
|
state.cell.getChildAt(i)
|
||||||
);
|
);
|
||||||
this.visitStatesRecursive(childState, canvas, visitor);
|
this.visitStatesRecursive(childState, canvas, visitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1964,7 +1964,7 @@ const mxUtils = {
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
if (cells[i] != null) {
|
if (cells[i] != null) {
|
||||||
const style = mxUtils.setStyle(
|
const style = mxUtils.setStyle(
|
||||||
model.getStyle(cells[i]),
|
cells[i].getStyle(),
|
||||||
key,
|
key,
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
|
@ -2067,7 +2067,7 @@ const mxUtils = {
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
if (cells[i] != null) {
|
if (cells[i] != null) {
|
||||||
const style = mxUtils.setStyleFlag(
|
const style = mxUtils.setStyleFlag(
|
||||||
model.getStyle(cells[i]),
|
cells[i].getStyle(),
|
||||||
key,
|
key,
|
||||||
flag,
|
flag,
|
||||||
value
|
value
|
||||||
|
|
|
@ -71,6 +71,11 @@ class mxCell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Document me!!!
|
||||||
|
getChildren(): mxCell[] {
|
||||||
|
return this.children || [];
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Document me!
|
// TODO: Document me!
|
||||||
// used by invalidate() of mxGraphView
|
// used by invalidate() of mxGraphView
|
||||||
invalidating: boolean = false;
|
invalidating: boolean = false;
|
||||||
|
|
|
@ -548,7 +548,7 @@ class mxCellEditor {
|
||||||
if (state == null) {
|
if (state == null) {
|
||||||
this.stopEditing(true);
|
this.stopEditing(true);
|
||||||
} else if (this.textarea != null) {
|
} else if (this.textarea != null) {
|
||||||
const isEdge = this.graph.getModel().isEdge(state.cell);
|
const isEdge = state.cell.isEdge();
|
||||||
const { scale } = this.graph.getView();
|
const { scale } = this.graph.getView();
|
||||||
let m = null;
|
let m = null;
|
||||||
|
|
||||||
|
@ -1106,7 +1106,7 @@ class mxCellEditor {
|
||||||
*/
|
*/
|
||||||
// getEditorBounds(state: mxCellState): mxRectangle;
|
// getEditorBounds(state: mxCellState): mxRectangle;
|
||||||
getEditorBounds(state: mxCellState): mxRectangle | null {
|
getEditorBounds(state: mxCellState): mxRectangle | null {
|
||||||
const isEdge = this.graph.getModel().isEdge(state.cell);
|
const isEdge = state.cell.isEdge();
|
||||||
const { scale } = this.graph.getView();
|
const { scale } = this.graph.getView();
|
||||||
const minSize = this.getMinimumSize(state);
|
const minSize = this.getMinimumSize(state);
|
||||||
const minWidth = minSize.width;
|
const minWidth = minSize.width;
|
||||||
|
@ -1196,7 +1196,7 @@ class mxCellEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Applies the horizontal and vertical label positions
|
// Applies the horizontal and vertical label positions
|
||||||
if (this.graph.getModel().isVertex(state.cell)) {
|
if (state.cell.isVertex()) {
|
||||||
const horizontal: string = <string>mxUtils.getStringValue(
|
const horizontal: string = <string>mxUtils.getStringValue(
|
||||||
state.style,
|
state.style,
|
||||||
mxConstants.STYLE_LABEL_POSITION,
|
mxConstants.STYLE_LABEL_POSITION,
|
||||||
|
|
|
@ -177,7 +177,7 @@ class mxCellOverlay extends mxEventSource {
|
||||||
*/
|
*/
|
||||||
// getBounds(state: mxCellState): mxRectangle;
|
// getBounds(state: mxCellState): mxRectangle;
|
||||||
getBounds(state: mxCellState) {
|
getBounds(state: mxCellState) {
|
||||||
const isEdge = state.view.graph.getModel().isEdge(state.cell);
|
const isEdge = state.cell.isEdge();
|
||||||
const s = state.view.scale;
|
const s = state.view.scale;
|
||||||
let pt = null;
|
let pt = null;
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ class mxCellRenderer {
|
||||||
getShapeConstructor(state: mxCellState) {
|
getShapeConstructor(state: mxCellState) {
|
||||||
let ctor = this.getShape(state.style[mxConstants.STYLE_SHAPE]);
|
let ctor = this.getShape(state.style[mxConstants.STYLE_SHAPE]);
|
||||||
if (ctor == null) {
|
if (ctor == null) {
|
||||||
ctor = <typeof mxShape>(state.view.graph.getModel().isEdge(state.cell)
|
ctor = <typeof mxShape>(state.cell.isEdge()
|
||||||
? this.defaultEdgeShape
|
? this.defaultEdgeShape
|
||||||
: this.defaultVertexShape);
|
: this.defaultVertexShape);
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ class mxCellRenderer {
|
||||||
// createLabel(state: mxCellState, value: string): void;
|
// createLabel(state: mxCellState, value: string): void;
|
||||||
createLabel(state: mxCellState, value: any) {
|
createLabel(state: mxCellState, value: any) {
|
||||||
const { graph } = state.view;
|
const { graph } = state.view;
|
||||||
const isEdge = graph.getModel().isEdge(state.cell);
|
const isEdge = state.cell.isEdge();
|
||||||
|
|
||||||
if (state.style.fontSize > 0 || state.style.fontSize == null) {
|
if (state.style.fontSize > 0 || state.style.fontSize == null) {
|
||||||
// Avoids using DOM node for empty labels
|
// Avoids using DOM node for empty labels
|
||||||
|
@ -1138,7 +1138,7 @@ class mxCellRenderer {
|
||||||
getLabelBounds(state: mxCellState): mxRectangle {
|
getLabelBounds(state: mxCellState): mxRectangle {
|
||||||
const { graph } = state.view;
|
const { graph } = state.view;
|
||||||
const { scale } = state.view;
|
const { scale } = state.view;
|
||||||
const isEdge = graph.getModel().isEdge(state.cell);
|
const isEdge = state.cell.isEdge();
|
||||||
let bounds = new mxRectangle(
|
let bounds = new mxRectangle(
|
||||||
state.absoluteOffset.x,
|
state.absoluteOffset.x,
|
||||||
state.absoluteOffset.y
|
state.absoluteOffset.y
|
||||||
|
@ -1339,7 +1339,7 @@ class mxCellRenderer {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const bounds = shape.overlay.getBounds(state);
|
const bounds = shape.overlay.getBounds(state);
|
||||||
|
|
||||||
if (!state.view.graph.getModel().isEdge(state.cell)) {
|
if (!state.cell.isEdge()) {
|
||||||
if (state.shape != null && rot !== 0) {
|
if (state.shape != null && rot !== 0) {
|
||||||
let cx = bounds.getCenterX();
|
let cx = bounds.getCenterX();
|
||||||
let cy = bounds.getCenterY();
|
let cy = bounds.getCenterY();
|
||||||
|
@ -1423,7 +1423,7 @@ class mxCellRenderer {
|
||||||
let cx = state.getCenterX();
|
let cx = state.getCenterX();
|
||||||
let cy = state.getCenterY();
|
let cy = state.getCenterY();
|
||||||
|
|
||||||
if (!state.view.graph.getModel().isEdge(state.cell)) {
|
if (!state.cell.isEdge()) {
|
||||||
cx = state.x + w * s;
|
cx = state.x + w * s;
|
||||||
cy = state.y + h * s;
|
cy = state.y + h * s;
|
||||||
|
|
||||||
|
@ -1456,7 +1456,7 @@ class mxCellRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return state.view.graph.getModel().isEdge(state.cell)
|
return state.cell.isEdge()
|
||||||
? new mxRectangle(
|
? new mxRectangle(
|
||||||
Math.round(cx - (w / 2) * s),
|
Math.round(cx - (w / 2) * s),
|
||||||
Math.round(cy - (h / 2) * s),
|
Math.round(cy - (h / 2) * s),
|
||||||
|
@ -1649,7 +1649,7 @@ class mxCellRenderer {
|
||||||
state.shape == null &&
|
state.shape == null &&
|
||||||
state.view.graph.container != null &&
|
state.view.graph.container != null &&
|
||||||
state.cell !== state.view.currentRoot &&
|
state.cell !== state.view.currentRoot &&
|
||||||
(model.isVertex(state.cell) || model.isEdge(state.cell))
|
(state.cell.isVertex() || state.cell.isEdge())
|
||||||
) {
|
) {
|
||||||
state.shape = this.createShape(state);
|
state.shape = this.createShape(state);
|
||||||
|
|
||||||
|
|
|
@ -125,9 +125,9 @@ class mxCellStatePreview {
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
|
|
||||||
if (model.isVertex(state.cell)) {
|
if (state.cell.isVertex()) {
|
||||||
(<mxGraphView>state.view).updateCellState(state);
|
(<mxGraphView>state.view).updateCellState(state);
|
||||||
const geo = model.getGeometry(state.cell);
|
const geo = state.cell.getGeometry();
|
||||||
|
|
||||||
// Moves selection cells and non-relative vertices in
|
// Moves selection cells and non-relative vertices in
|
||||||
// the first phase so that edge terminal points will
|
// the first phase so that edge terminal points will
|
||||||
|
@ -142,11 +142,11 @@ class mxCellStatePreview {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const childCount = model.getChildCount(state.cell);
|
const childCount = state.cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.translateState(
|
this.translateState(
|
||||||
<mxCellState>(state.view).getState(model.getChildAt(state.cell, i)),
|
<mxCellState>(state.view).getState(state.cell.getChildAt(i)),
|
||||||
dx,
|
dx,
|
||||||
dy
|
dy
|
||||||
);
|
);
|
||||||
|
@ -175,21 +175,21 @@ class mxCellStatePreview {
|
||||||
|
|
||||||
// Updates the edge terminal points and restores the
|
// Updates the edge terminal points and restores the
|
||||||
// (relative) positions of any (relative) children
|
// (relative) positions of any (relative) children
|
||||||
if (model.isEdge(state.cell)) {
|
if (state.cell.isEdge()) {
|
||||||
state.view.updateCellState(state);
|
state.view.updateCellState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
const geo = this.graph.getCellGeometry(<mxCell>state.cell);
|
const geo = this.graph.getCellGeometry(<mxCell>state.cell);
|
||||||
const pState = state.view.getState(model.getParent(<mxCell>state.cell));
|
const pState = state.view.getState(<mxCell>state.cell.getParent());
|
||||||
|
|
||||||
// Moves selection vertices which are relative
|
// Moves selection vertices which are relative
|
||||||
if (
|
if (
|
||||||
(dx !== 0 || dy !== 0) &&
|
(dx !== 0 || dy !== 0) &&
|
||||||
geo != null &&
|
geo != null &&
|
||||||
geo.relative &&
|
geo.relative &&
|
||||||
model.isVertex(state.cell) &&
|
state.cell.isVertex() &&
|
||||||
(pState == null ||
|
(pState == null ||
|
||||||
model.isVertex(pState.cell) ||
|
pState.cell.isVertex() ||
|
||||||
this.deltas.get(state.cell) != null)
|
this.deltas.get(state.cell) != null)
|
||||||
) {
|
) {
|
||||||
state.x += dx;
|
state.x += dx;
|
||||||
|
@ -203,11 +203,11 @@ class mxCellStatePreview {
|
||||||
visitor(state);
|
visitor(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
const childCount = model.getChildCount(state.cell);
|
const childCount = state.cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.revalidateState(
|
this.revalidateState(
|
||||||
this.graph.view.getState(model.getChildAt(state.cell, i)),
|
this.graph.view.getState(state.cell.getChildAt(i)),
|
||||||
dx,
|
dx,
|
||||||
dy,
|
dy,
|
||||||
visitor
|
visitor
|
||||||
|
@ -225,10 +225,10 @@ class mxCellStatePreview {
|
||||||
// addEdges(state: mxCellState): void;
|
// addEdges(state: mxCellState): void;
|
||||||
addEdges(state: mxCellState): void {
|
addEdges(state: mxCellState): void {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const edgeCount = model.getEdgeCount(<mxCell>state.cell);
|
const edgeCount = state.cell.getEdgeCount();
|
||||||
|
|
||||||
for (let i = 0; i < edgeCount; i += 1) {
|
for (let i = 0; i < edgeCount; i += 1) {
|
||||||
const s = state.view.getState(model.getEdgeAt(<mxCell>state.cell, i));
|
const s = state.view.getState(<mxCell>state.cell.getEdgeAt(i));
|
||||||
|
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
this.moveState(s, 0, 0);
|
this.moveState(s, 0, 0);
|
||||||
|
|
|
@ -178,8 +178,8 @@ class mxMultiplicity {
|
||||||
*/
|
*/
|
||||||
// checkNeighbors(graph: mxGraph, edge: mxCell, source: mxCell, target: mxCell): boolean;
|
// checkNeighbors(graph: mxGraph, edge: mxCell, source: mxCell, target: mxCell): boolean;
|
||||||
checkNeighbors(graph, edge, source, target) {
|
checkNeighbors(graph, edge, source, target) {
|
||||||
const sourceValue = graph.model.getValue(source);
|
const sourceValue = source.getValue();
|
||||||
const targetValue = graph.model.getValue(target);
|
const targetValue = target.getValue();
|
||||||
let isValid = !this.validNeighborsAllowed;
|
let isValid = !this.validNeighborsAllowed;
|
||||||
const valid = this.validNeighbors;
|
const valid = this.validNeighbors;
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ class mxMultiplicity {
|
||||||
*/
|
*/
|
||||||
// checkTerminal(graph: mxGraph, terminal: mxCell, edge: mxCell): boolean;
|
// checkTerminal(graph: mxGraph, terminal: mxCell, edge: mxCell): boolean;
|
||||||
checkTerminal(graph, terminal, edge) {
|
checkTerminal(graph, terminal, edge) {
|
||||||
const value = graph.model.getValue(terminal);
|
const value = terminal.getValue();
|
||||||
|
|
||||||
return this.checkType(graph, value, this.type, this.attr, this.value);
|
return this.checkType(graph, value, this.type, this.attr, this.value);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -406,9 +406,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visits the children of the cell
|
// Visits the children of the cell
|
||||||
const childCount = this.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = <mxCell>this.getChildAt(parent, i);
|
const child = <mxCell>parent.getChildAt(i);
|
||||||
result = result.concat(this.filterDescendants(filter, child));
|
result = result.concat(this.filterDescendants(filter, child));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
while (cell != null) {
|
while (cell != null) {
|
||||||
root = cell;
|
root = cell;
|
||||||
cell = this.getParent(cell);
|
cell = cell.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
|
@ -490,8 +490,8 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell that represents the possible layer.
|
* @param {mxCell} cell that represents the possible layer.
|
||||||
*/
|
*/
|
||||||
// isLayer(cell: mxCell): boolean;
|
// isLayer(cell: mxCell): boolean;
|
||||||
isLayer(cell: mxCell | null): boolean {
|
isLayer(cell: mxCell): boolean {
|
||||||
return this.isRoot(this.getParent(cell));
|
return this.isRoot(cell.getParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -502,11 +502,11 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} child that specifies the child.
|
* @param {mxCell} child that specifies the child.
|
||||||
*/
|
*/
|
||||||
// isAncestor(parent: mxCell, child: mxCell): boolean;
|
// isAncestor(parent: mxCell, child: mxCell): boolean;
|
||||||
isAncestor(parent: mxCell | null,
|
isAncestor(parent: mxCell,
|
||||||
child: mxCell | null): boolean {
|
child: mxCell): boolean {
|
||||||
|
|
||||||
while (child != null && child !== parent) {
|
while (child != null && child !== parent) {
|
||||||
child = this.getParent(child);
|
child = <mxCell>child.getParent();
|
||||||
}
|
}
|
||||||
return child === parent;
|
return child === parent;
|
||||||
}
|
}
|
||||||
|
@ -517,8 +517,8 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell that specifies the cell.
|
* @param {mxCell} cell that specifies the cell.
|
||||||
*/
|
*/
|
||||||
// contains(cell: mxCell): boolean;
|
// contains(cell: mxCell): boolean;
|
||||||
contains(cell: mxCell | null): boolean {
|
contains(cell: mxCell): boolean {
|
||||||
return this.isAncestor(this.root, cell);
|
return this.isAncestor(<mxCell>this.root, cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -527,8 +527,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose parent should be returned.
|
* @param {mxCell} cell whose parent should be returned.
|
||||||
*/
|
*/
|
||||||
// getParent(cell: mxCell): mxCell;
|
// getParent(cell: mxCell): mxCell;
|
||||||
getParent(cell: mxCell | null): mxCell | null {
|
getParent(cell: mxCell): mxCell | null {
|
||||||
return cell != null ? cell.getParent() : null;
|
// SLATED FOR DELETION
|
||||||
|
return cell.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -549,10 +550,10 @@ class mxGraphModel extends mxEventSource {
|
||||||
if (child !== parent && parent != null && child != null) {
|
if (child !== parent && parent != null && child != null) {
|
||||||
// Appends the child if no index was specified
|
// Appends the child if no index was specified
|
||||||
if (index == null) {
|
if (index == null) {
|
||||||
index = this.getChildCount(parent);
|
index = parent.getChildCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
const parentChanged = parent !== this.getParent(child);
|
const parentChanged = parent !== child.getParent();
|
||||||
this.execute(new mxChildChange(this, parent, child, index));
|
this.execute(new mxChildChange(this, parent, child, index));
|
||||||
|
|
||||||
// Maintains the edges parents by moving the edges
|
// Maintains the edges parents by moving the edges
|
||||||
|
@ -616,10 +617,10 @@ class mxGraphModel extends mxEventSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursively processes child cells
|
// Recursively processes child cells
|
||||||
const childCount = this.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.cellAdded(this.getChildAt(cell, i));
|
this.cellAdded(cell.getChildAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -645,25 +646,22 @@ class mxGraphModel extends mxEventSource {
|
||||||
*/
|
*/
|
||||||
// updateEdgeParents(cell: mxCell, root: mxCell): void;
|
// updateEdgeParents(cell: mxCell, root: mxCell): void;
|
||||||
updateEdgeParents(cell: mxCell,
|
updateEdgeParents(cell: mxCell,
|
||||||
root: mxCell | null=null): void {
|
root: mxCell=<mxCell>this.getRoot(cell)): void {
|
||||||
|
|
||||||
// Gets the topmost node of the hierarchy
|
|
||||||
root = root || this.getRoot(cell);
|
|
||||||
|
|
||||||
// Updates edges on children first
|
// Updates edges on children first
|
||||||
const childCount = this.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = <mxCell>this.getChildAt(cell, i);
|
const child = <mxCell>cell.getChildAt(i);
|
||||||
this.updateEdgeParents(child, root);
|
this.updateEdgeParents(child, root);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates the parents of all connected edges
|
// Updates the parents of all connected edges
|
||||||
const edgeCount = this.getEdgeCount(cell);
|
const edgeCount = cell.getEdgeCount();
|
||||||
const edges = [];
|
const edges = [];
|
||||||
|
|
||||||
for (let i = 0; i < edgeCount; i += 1) {
|
for (let i = 0; i < edgeCount; i += 1) {
|
||||||
edges.push(this.getEdgeAt(cell, i));
|
edges.push(<mxCell>cell.getEdgeAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < edges.length; i += 1) {
|
for (let i = 0; i < edges.length; i += 1) {
|
||||||
|
@ -686,50 +684,54 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} root that represents the current root of the model.
|
* @param {mxCell} root that represents the current root of the model.
|
||||||
*/
|
*/
|
||||||
// updateEdgeParent(edge: mxCell, root: mxCell): void;
|
// updateEdgeParent(edge: mxCell, root: mxCell): void;
|
||||||
updateEdgeParent(edge: mxCell | null,
|
updateEdgeParent(edge: mxCell,
|
||||||
root: mxCell | null): void {
|
root: mxCell): void {
|
||||||
|
|
||||||
let source = this.getTerminal(edge, true);
|
let source = edge.getTerminal(true);
|
||||||
let target = this.getTerminal(edge, false);
|
let target = edge.getTerminal(false);
|
||||||
let cell = null;
|
let cell = null;
|
||||||
|
|
||||||
// Uses the first non-relative descendants of the source terminal
|
// Uses the first non-relative descendants of the source terminal
|
||||||
while (
|
while (
|
||||||
source != null &&
|
source != null &&
|
||||||
!this.isEdge(source) &&
|
!source.isEdge() &&
|
||||||
source.geometry != null &&
|
source.geometry != null &&
|
||||||
source.geometry.relative
|
source.geometry.relative
|
||||||
) {
|
) {
|
||||||
source = this.getParent(source);
|
source = source.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uses the first non-relative descendants of the target terminal
|
// Uses the first non-relative descendants of the target terminal
|
||||||
while (
|
while (
|
||||||
target != null &&
|
target != null &&
|
||||||
this.ignoreRelativeEdgeParent &&
|
this.ignoreRelativeEdgeParent &&
|
||||||
!this.isEdge(target) &&
|
!target.isEdge() &&
|
||||||
target.geometry != null &&
|
target.geometry != null &&
|
||||||
target.geometry.relative
|
target.geometry.relative
|
||||||
) {
|
) {
|
||||||
target = this.getParent(target);
|
target = target.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!source || !target) {
|
||||||
|
throw new Error("Shouldn't get here!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isAncestor(root, source) && this.isAncestor(root, target)) {
|
if (this.isAncestor(root, source) && this.isAncestor(root, target)) {
|
||||||
if (source === target) {
|
if (source === target) {
|
||||||
cell = this.getParent(source);
|
cell = source ? source.getParent() : null;
|
||||||
} else {
|
} else {
|
||||||
cell = this.getNearestCommonAncestor(source, target);
|
cell = this.getNearestCommonAncestor(source, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
cell != null &&
|
cell != null &&
|
||||||
(this.getParent(cell) !== this.root || this.isAncestor(cell, edge)) &&
|
(cell.getParent() !== this.root || this.isAncestor(cell, edge)) &&
|
||||||
this.getParent(edge) !== cell
|
edge && edge.getParent() !== cell
|
||||||
) {
|
) {
|
||||||
let geo = this.getGeometry(edge);
|
let geo = edge.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
const origin1 = this.getOrigin(this.getParent(edge));
|
const origin1 = this.getOrigin(<mxCell>edge.getParent());
|
||||||
const origin2 = this.getOrigin(cell);
|
const origin2 = this.getOrigin(cell);
|
||||||
|
|
||||||
const dx = origin2.x - origin1.x;
|
const dx = origin2.x - origin1.x;
|
||||||
|
@ -740,7 +742,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
this.setGeometry(edge, geo);
|
this.setGeometry(edge, geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.add(cell, edge, this.getChildCount(cell));
|
this.add(cell, edge, cell.getChildCount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -750,14 +752,14 @@ class mxGraphModel extends mxEventSource {
|
||||||
* given parent as an {@link mxPoint}.
|
* given parent as an {@link mxPoint}.
|
||||||
*/
|
*/
|
||||||
// getOrigin(cell: mxCell): mxPoint;
|
// getOrigin(cell: mxCell): mxPoint;
|
||||||
getOrigin(cell: mxCell | null): mxPoint {
|
getOrigin(cell: mxCell): mxPoint {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
result = this.getOrigin(this.getParent(cell));
|
result = this.getOrigin(<mxCell>cell.getParent());
|
||||||
|
|
||||||
if (!this.isEdge(cell)) {
|
if (!cell.isEdge()) {
|
||||||
const geo = this.getGeometry(cell);
|
const geo = cell.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
result.x += geo.x;
|
result.x += geo.x;
|
||||||
|
@ -777,10 +779,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell2 that specifies the second cell in the tree.
|
* @param {mxCell} cell2 that specifies the second cell in the tree.
|
||||||
*/
|
*/
|
||||||
// getNearestCommonAncestor(cell1: mxCell, cell2: mxCell): mxCell;
|
// getNearestCommonAncestor(cell1: mxCell, cell2: mxCell): mxCell;
|
||||||
getNearestCommonAncestor(cell1: mxCell | null,
|
getNearestCommonAncestor(cell1: mxCell,
|
||||||
cell2: mxCell | null): mxCell | null {
|
cell2: mxCell): mxCell | null {
|
||||||
|
|
||||||
if (cell1 != null && cell2 != null) {
|
|
||||||
// Creates the cell path for the second cell
|
// Creates the cell path for the second cell
|
||||||
let path = mxCellPath.create(cell2);
|
let path = mxCellPath.create(cell2);
|
||||||
|
|
||||||
|
@ -799,7 +800,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (cell != null) {
|
while (cell != null) {
|
||||||
const parent = <mxCell>this.getParent(cell);
|
const parent = <mxCell>cell.getParent();
|
||||||
|
|
||||||
// Checks if the cell path is equal to the beginning of the given cell path
|
// Checks if the cell path is equal to the beginning of the given cell path
|
||||||
if (
|
if (
|
||||||
|
@ -813,7 +814,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
cell = parent;
|
cell = parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,10 +829,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
remove(cell: mxCell) {
|
remove(cell: mxCell) {
|
||||||
if (cell === this.root) {
|
if (cell === this.root) {
|
||||||
this.setRoot(null);
|
this.setRoot(null);
|
||||||
} else if (this.getParent(cell) != null) {
|
} else if (cell.getParent() != null) {
|
||||||
this.execute(new mxChildChange(this, null, cell));
|
this.execute(new mxChildChange(this, null, cell));
|
||||||
}
|
}
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -844,10 +844,10 @@ class mxGraphModel extends mxEventSource {
|
||||||
cellRemoved(cell: mxCell) {
|
cellRemoved(cell: mxCell) {
|
||||||
if (cell != null && this.cells != null) {
|
if (cell != null && this.cells != null) {
|
||||||
// Recursively processes child cells
|
// Recursively processes child cells
|
||||||
const childCount = this.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = childCount - 1; i >= 0; i--) {
|
for (let i = childCount - 1; i >= 0; i--) {
|
||||||
this.cellRemoved(<mxCell>this.getChildAt(cell, i));
|
this.cellRemoved(<mxCell>cell.getChildAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes the dictionary entry for the cell
|
// Removes the dictionary entry for the cell
|
||||||
|
@ -872,7 +872,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
parent: mxCell | null,
|
parent: mxCell | null,
|
||||||
index: number) {
|
index: number) {
|
||||||
|
|
||||||
const previous = <mxCell>this.getParent(cell);
|
const previous = <mxCell>cell.getParent();
|
||||||
|
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
if (parent !== previous || previous.getIndex(cell) !== index) {
|
if (parent !== previous || previous.getIndex(cell) !== index) {
|
||||||
|
@ -884,7 +884,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds or removes the cell from the model
|
// Adds or removes the cell from the model
|
||||||
const par = this.contains(parent);
|
const par = parent ? this.contains(parent) : null;
|
||||||
const pre = this.contains(previous);
|
const pre = this.contains(previous);
|
||||||
|
|
||||||
if (par && !pre) {
|
if (par && !pre) {
|
||||||
|
@ -901,8 +901,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose number of children should be returned.
|
* @param {mxCell} cell whose number of children should be returned.
|
||||||
*/
|
*/
|
||||||
// getChildCount(cell?: mxCell): number;
|
// getChildCount(cell?: mxCell): number;
|
||||||
getChildCount(cell: mxCell | null) {
|
getChildCount(cell: mxCell) {
|
||||||
return cell != null ? cell.getChildCount() : 0;
|
// SLATED FOR DELETION
|
||||||
|
return cell.getChildCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -912,9 +913,10 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param index Integer that specifies the index of the child to be returned.
|
* @param index Integer that specifies the index of the child to be returned.
|
||||||
*/
|
*/
|
||||||
// getChildAt(cell: mxCell, index: number): mxCell;
|
// getChildAt(cell: mxCell, index: number): mxCell;
|
||||||
getChildAt(cell: mxCell | null,
|
getChildAt(cell: mxCell,
|
||||||
index: number): mxCell | null {
|
index: number): mxCell | null {
|
||||||
return cell != null ? cell.getChildAt(index) : null;
|
// SLATED FOR DELETION
|
||||||
|
return cell.getChildAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -924,8 +926,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell the represents the parent.
|
* @param {mxCell} cell the represents the parent.
|
||||||
*/
|
*/
|
||||||
// getChildren(cell: mxCell): Array<mxCell>;
|
// getChildren(cell: mxCell): Array<mxCell>;
|
||||||
getChildren(cell: mxCell): mxCell[] | null {
|
getChildren(cell: mxCell): mxCell[] {
|
||||||
return cell != null ? cell.children : null;
|
// SLATED FOR DELETION
|
||||||
|
return cell.children || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -934,7 +937,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose child vertices should be returned.
|
* @param {mxCell} cell whose child vertices should be returned.
|
||||||
*/
|
*/
|
||||||
// getChildVertices(parent: mxCell): Array<mxCell>;
|
// getChildVertices(parent: mxCell): Array<mxCell>;
|
||||||
getChildVertices(parent: mxCell | null) {
|
getChildVertices(parent: mxCell) {
|
||||||
return this.getChildCells(parent, true, false);
|
return this.getChildCells(parent, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -944,7 +947,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose child edges should be returned.
|
* @param {mxCell} cell whose child edges should be returned.
|
||||||
*/
|
*/
|
||||||
// getChildEdges(parent: mxCell): Array<mxCell>;
|
// getChildEdges(parent: mxCell): Array<mxCell>;
|
||||||
getChildEdges(parent: mxCell | null): (mxCell | null)[] {
|
getChildEdges(parent: mxCell): mxCell[] {
|
||||||
return this.getChildCells(parent, false, true);
|
return this.getChildCells(parent, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -959,20 +962,20 @@ class mxGraphModel extends mxEventSource {
|
||||||
* Default is false.
|
* Default is false.
|
||||||
*/
|
*/
|
||||||
// getChildCells(parent: mxCell, vertices: boolean, edges: boolean): Array<mxCell>;
|
// getChildCells(parent: mxCell, vertices: boolean, edges: boolean): Array<mxCell>;
|
||||||
getChildCells(parent: mxCell | null,
|
getChildCells(parent: mxCell,
|
||||||
vertices: boolean=false,
|
vertices: boolean=false,
|
||||||
edges: boolean=false): (mxCell | null)[] {
|
edges: boolean=false): mxCell[] {
|
||||||
|
|
||||||
const childCount = this.getChildCount(parent);
|
const childCount = parent.getChildCount();
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = <mxCell>this.getChildAt(parent, i);
|
const child = <mxCell>parent.getChildAt(i);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(!edges && !vertices) ||
|
(!edges && !vertices) ||
|
||||||
(edges && this.isEdge(child)) ||
|
(edges && child.isEdge()) ||
|
||||||
(vertices && this.isVertex(child))
|
(vertices && child.isVertex())
|
||||||
) {
|
) {
|
||||||
result.push(child);
|
result.push(child);
|
||||||
}
|
}
|
||||||
|
@ -988,9 +991,10 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param isSource Boolean indicating which end of the edge should be returned.
|
* @param isSource Boolean indicating which end of the edge should be returned.
|
||||||
*/
|
*/
|
||||||
// getTerminal(edge: mxCell, isSource: boolean): mxCell;
|
// getTerminal(edge: mxCell, isSource: boolean): mxCell;
|
||||||
getTerminal(edge: mxCell | null,
|
getTerminal(edge: mxCell,
|
||||||
isSource: boolean=false): mxCell | null {
|
isSource: boolean=false): mxCell | null {
|
||||||
return edge != null ? edge.getTerminal(isSource) : null;
|
// SLATED FOR DELETION
|
||||||
|
return edge.getTerminal(isSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1005,15 +1009,15 @@ class mxGraphModel extends mxEventSource {
|
||||||
* target terminal of the edge.
|
* target terminal of the edge.
|
||||||
*/
|
*/
|
||||||
// setTerminal(edge: mxCell, terminal: mxCell, isSource: boolean): mxCell;
|
// setTerminal(edge: mxCell, terminal: mxCell, isSource: boolean): mxCell;
|
||||||
setTerminal(edge: mxCell | null,
|
setTerminal(edge: mxCell,
|
||||||
terminal: mxCell | null,
|
terminal: mxCell | null,
|
||||||
isSource: boolean): mxCell | null {
|
isSource: boolean): mxCell | null {
|
||||||
|
|
||||||
const terminalChanged = terminal !== this.getTerminal(edge, isSource);
|
const terminalChanged = terminal !== edge.getTerminal(isSource);
|
||||||
this.execute(new mxTerminalChange(this, edge, terminal, isSource));
|
this.execute(new mxTerminalChange(this, edge, terminal, isSource));
|
||||||
|
|
||||||
if (this.maintainEdgeParent && terminalChanged) {
|
if (this.maintainEdgeParent && terminalChanged) {
|
||||||
this.updateEdgeParent(edge, this.getRoot());
|
this.updateEdgeParent(edge, <mxCell>this.getRoot());
|
||||||
}
|
}
|
||||||
return terminal;
|
return terminal;
|
||||||
}
|
}
|
||||||
|
@ -1027,7 +1031,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} target that specifies the new target terminal.
|
* @param {mxCell} target that specifies the new target terminal.
|
||||||
*/
|
*/
|
||||||
// setTerminals(edge: mxCell, source: mxCell, target: mxCell): void;
|
// setTerminals(edge: mxCell, source: mxCell, target: mxCell): void;
|
||||||
setTerminals(edge: mxCell | null,
|
setTerminals(edge: mxCell,
|
||||||
source: mxCell | null,
|
source: mxCell | null,
|
||||||
target: mxCell | null): void {
|
target: mxCell | null): void {
|
||||||
|
|
||||||
|
@ -1050,11 +1054,11 @@ class mxGraphModel extends mxEventSource {
|
||||||
* target terminal of the edge.
|
* target terminal of the edge.
|
||||||
*/
|
*/
|
||||||
// terminalForCellChanged(edge: mxCell, terminal: mxCell, isSource: boolean): mxCell;
|
// terminalForCellChanged(edge: mxCell, terminal: mxCell, isSource: boolean): mxCell;
|
||||||
terminalForCellChanged(edge: mxCell | null,
|
terminalForCellChanged(edge: mxCell,
|
||||||
terminal: mxCell | null,
|
terminal: mxCell | null,
|
||||||
isSource: boolean=false): mxCell | null {
|
isSource: boolean=false): mxCell | null {
|
||||||
|
|
||||||
const previous = this.getTerminal(edge, isSource);
|
const previous = edge.getTerminal(isSource);
|
||||||
if (terminal != null) {
|
if (terminal != null) {
|
||||||
terminal.insertEdge(edge, isSource);
|
terminal.insertEdge(edge, isSource);
|
||||||
} else if (previous != null) {
|
} else if (previous != null) {
|
||||||
|
@ -1070,7 +1074,8 @@ class mxGraphModel extends mxEventSource {
|
||||||
*/
|
*/
|
||||||
// getEdgeCount(cell: mxCell): number;
|
// getEdgeCount(cell: mxCell): number;
|
||||||
getEdgeCount(cell: mxCell): number {
|
getEdgeCount(cell: mxCell): number {
|
||||||
return cell != null ? cell.getEdgeCount() : 0;
|
// SLATED FOR DELETION
|
||||||
|
return cell.getEdgeCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1083,7 +1088,8 @@ class mxGraphModel extends mxEventSource {
|
||||||
// getEdgeAt(cell: mxCell, index: number): mxCell;
|
// getEdgeAt(cell: mxCell, index: number): mxCell;
|
||||||
getEdgeAt(cell: mxCell,
|
getEdgeAt(cell: mxCell,
|
||||||
index: number): mxCell | null {
|
index: number): mxCell | null {
|
||||||
return cell != null ? cell.getEdgeAt(index) : null;
|
// SLATED FOR DELETION
|
||||||
|
return cell.getEdgeAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1100,11 +1106,11 @@ class mxGraphModel extends mxEventSource {
|
||||||
outgoing: boolean,
|
outgoing: boolean,
|
||||||
ignoredEdge: mxCell | null=null): number {
|
ignoredEdge: mxCell | null=null): number {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const edgeCount = this.getEdgeCount(cell);
|
const edgeCount = cell.getEdgeCount();
|
||||||
|
|
||||||
for (let i = 0; i < edgeCount; i += 1) {
|
for (let i = 0; i < edgeCount; i += 1) {
|
||||||
const edge = this.getEdgeAt(cell, i);
|
const edge = cell.getEdgeAt(i);
|
||||||
if (edge !== ignoredEdge && this.getTerminal(edge, outgoing) === cell) {
|
if (edge !== ignoredEdge && edge && edge.getTerminal(outgoing) === cell) {
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1129,7 +1135,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// getIncomingEdges(cell: mxCell): Array<mxCell>;
|
// getIncomingEdges(cell: mxCell): Array<mxCell>;
|
||||||
getIncomingEdges(cell: mxCell): (mxCell | null)[] {
|
getIncomingEdges(cell: mxCell): mxCell[] {
|
||||||
return this.getEdges(cell, true, false, false);
|
return this.getEdges(cell, true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1140,7 +1146,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// getOutgoingEdges(cell: mxCell): Array<mxCell>;
|
// getOutgoingEdges(cell: mxCell): Array<mxCell>;
|
||||||
getOutgoingEdges(cell: mxCell): (mxCell | null)[] {
|
getOutgoingEdges(cell: mxCell): mxCell[] {
|
||||||
return this.getEdges(cell, false, true, false);
|
return this.getEdges(cell, false, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,13 +1170,13 @@ class mxGraphModel extends mxEventSource {
|
||||||
outgoing: boolean=true,
|
outgoing: boolean=true,
|
||||||
includeLoops: boolean=true) {
|
includeLoops: boolean=true) {
|
||||||
|
|
||||||
const edgeCount = this.getEdgeCount(cell);
|
const edgeCount = cell.getEdgeCount();
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
for (let i = 0; i < edgeCount; i += 1) {
|
for (let i = 0; i < edgeCount; i += 1) {
|
||||||
const edge = this.getEdgeAt(cell, i);
|
const edge = <mxCell>cell.getEdgeAt(i);
|
||||||
const source = this.getTerminal(edge, true);
|
const source = edge.getTerminal(true);
|
||||||
const target = this.getTerminal(edge, false);
|
const target = edge.getTerminal(false);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(includeLoops && source === target) ||
|
(includeLoops && source === target) ||
|
||||||
|
@ -1201,8 +1207,8 @@ class mxGraphModel extends mxEventSource {
|
||||||
target: mxCell,
|
target: mxCell,
|
||||||
directed: boolean=false) {
|
directed: boolean=false) {
|
||||||
|
|
||||||
const tmp1 = this.getEdgeCount(source);
|
const tmp1 = source.getEdgeCount();
|
||||||
const tmp2 = this.getEdgeCount(target);
|
const tmp2 = target.getEdgeCount();
|
||||||
|
|
||||||
// Assumes the source has less connected edges
|
// Assumes the source has less connected edges
|
||||||
let terminal = source;
|
let terminal = source;
|
||||||
|
@ -1220,9 +1226,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
// Checks if the edge is connected to the correct
|
// Checks if the edge is connected to the correct
|
||||||
// cell and returns the first match
|
// cell and returns the first match
|
||||||
for (let i = 0; i < edgeCount; i += 1) {
|
for (let i = 0; i < edgeCount; i += 1) {
|
||||||
const edge = this.getEdgeAt(terminal, i);
|
const edge = <mxCell>terminal.getEdgeAt(i);
|
||||||
const src = this.getTerminal(edge, true);
|
const src = edge.getTerminal(true);
|
||||||
const trg = this.getTerminal(edge, false);
|
const trg = edge.getTerminal(false);
|
||||||
const directedMatch = src === source && trg === target;
|
const directedMatch = src === source && trg === target;
|
||||||
const oppositeMatch = trg === source && src === target;
|
const oppositeMatch = trg === source && src === target;
|
||||||
|
|
||||||
|
@ -1230,7 +1236,6 @@ class mxGraphModel extends mxEventSource {
|
||||||
result.push(edge);
|
result.push(edge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1254,10 +1259,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
|
|
||||||
const terminals = [];
|
const terminals = [];
|
||||||
|
|
||||||
if (edges != null) {
|
|
||||||
for (let i = 0; i < edges.length; i += 1) {
|
for (let i = 0; i < edges.length; i += 1) {
|
||||||
const source = this.getTerminal(edges[i], true);
|
const source = edges[i].getTerminal(true);
|
||||||
const target = this.getTerminal(edges[i], false);
|
const target = edges[i].getTerminal(false);
|
||||||
|
|
||||||
// Checks if the terminal is the source of
|
// Checks if the terminal is the source of
|
||||||
// the edge and if the target should be
|
// the edge and if the target should be
|
||||||
|
@ -1283,8 +1287,6 @@ class mxGraphModel extends mxEventSource {
|
||||||
terminals.push(source);
|
terminals.push(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return terminals;
|
return terminals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1307,22 +1309,20 @@ class mxGraphModel extends mxEventSource {
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
const cell = cells[i];
|
const cell = cells[i];
|
||||||
let topmost = true;
|
let topmost = true;
|
||||||
let parent = this.getParent(cell);
|
let parent = cell.getParent();
|
||||||
|
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
if (dict.get(parent)) {
|
if (dict.get(parent)) {
|
||||||
topmost = false;
|
topmost = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
parent = parent.getParent();
|
||||||
parent = this.getParent(parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topmost) {
|
if (topmost) {
|
||||||
tmp.push(cell);
|
tmp.push(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,8 +1332,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell that represents the possible vertex.
|
* @param {mxCell} cell that represents the possible vertex.
|
||||||
*/
|
*/
|
||||||
// isVertex(cell: mxCell): boolean;
|
// isVertex(cell: mxCell): boolean;
|
||||||
isVertex(cell: mxCell | null): boolean {
|
isVertex(cell: mxCell): boolean {
|
||||||
return cell != null ? cell.isVertex() : false;
|
// SLATED FOR DELETION
|
||||||
|
return cell.isVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1342,8 +1343,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell that represents the possible edge.
|
* @param {mxCell} cell that represents the possible edge.
|
||||||
*/
|
*/
|
||||||
// isEdge(cell: mxCell): boolean;
|
// isEdge(cell: mxCell): boolean;
|
||||||
isEdge(cell: mxCell | null): boolean {
|
isEdge(cell: mxCell): boolean {
|
||||||
return cell != null ? cell.isEdge() : false;
|
// SLATED FOR DELETION
|
||||||
|
return cell.isEdge();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1354,8 +1356,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose connectable state should be returned.
|
* @param {mxCell} cell whose connectable state should be returned.
|
||||||
*/
|
*/
|
||||||
// isConnectable(cell: mxCell): boolean;
|
// isConnectable(cell: mxCell): boolean;
|
||||||
isConnectable(cell: mxCell | null) {
|
isConnectable(cell: mxCell) {
|
||||||
return cell != null ? cell.isConnectable() : false;
|
// SLATED FOR DELECTION
|
||||||
|
return cell.isConnectable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1364,8 +1367,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose user object should be returned.
|
* @param {mxCell} cell whose user object should be returned.
|
||||||
*/
|
*/
|
||||||
// getValue(cell: mxCell): any;
|
// getValue(cell: mxCell): any;
|
||||||
getValue(cell: mxCell | null) {
|
getValue(cell: mxCell) {
|
||||||
return cell != null ? cell.getValue() : null;
|
// SLATED FOR DELETION
|
||||||
|
return cell.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1412,8 +1416,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose geometry should be returned.
|
* @param {mxCell} cell whose geometry should be returned.
|
||||||
*/
|
*/
|
||||||
// getGeometry(cell: mxCell): mxGeometry;
|
// getGeometry(cell: mxCell): mxGeometry;
|
||||||
getGeometry(cell: mxCell | null): mxGeometry | null {
|
getGeometry(cell: mxCell): mxGeometry | null {
|
||||||
return cell != null ? cell.getGeometry() : null;
|
// SLATED FOR DELETION
|
||||||
|
return cell.getGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1425,10 +1430,10 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxGeometry} geometry that defines the new geometry.
|
* @param {mxGeometry} geometry that defines the new geometry.
|
||||||
*/
|
*/
|
||||||
// setGeometry(cell: mxCell, geometry: mxGeometry): mxGeometry;
|
// setGeometry(cell: mxCell, geometry: mxGeometry): mxGeometry;
|
||||||
setGeometry(cell: mxCell | null,
|
setGeometry(cell: mxCell,
|
||||||
geometry: mxGeometry): mxGeometry {
|
geometry: mxGeometry): mxGeometry {
|
||||||
|
|
||||||
if (geometry !== this.getGeometry(cell)) {
|
if (geometry !== cell.getGeometry()) {
|
||||||
this.execute(new mxGeometryChange(this, cell, geometry));
|
this.execute(new mxGeometryChange(this, cell, geometry));
|
||||||
}
|
}
|
||||||
return geometry;
|
return geometry;
|
||||||
|
@ -1442,7 +1447,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
geometryForCellChanged(cell: mxCell,
|
geometryForCellChanged(cell: mxCell,
|
||||||
geometry: mxGeometry): mxGeometry | null {
|
geometry: mxGeometry): mxGeometry | null {
|
||||||
|
|
||||||
const previous = this.getGeometry(cell);
|
const previous = cell.getGeometry();
|
||||||
cell.setGeometry(geometry);
|
cell.setGeometry(geometry);
|
||||||
return previous;
|
return previous;
|
||||||
}
|
}
|
||||||
|
@ -1454,6 +1459,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
*/
|
*/
|
||||||
// getStyle(cell: mxCell): string | null;
|
// getStyle(cell: mxCell): string | null;
|
||||||
getStyle(cell: mxCell | null): any {
|
getStyle(cell: mxCell | null): any {
|
||||||
|
// SLATED FOR DELETION
|
||||||
return cell != null ? cell.getStyle() : null;
|
return cell != null ? cell.getStyle() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1469,7 +1475,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
setStyle(cell: mxCell,
|
setStyle(cell: mxCell,
|
||||||
style: any): any {
|
style: any): any {
|
||||||
|
|
||||||
if (style !== this.getStyle(cell)) {
|
if (style !== cell.getStyle()) {
|
||||||
this.execute(new mxStyleChange(this, cell, style));
|
this.execute(new mxStyleChange(this, cell, style));
|
||||||
}
|
}
|
||||||
return style;
|
return style;
|
||||||
|
@ -1487,7 +1493,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
styleForCellChanged(cell: mxCell,
|
styleForCellChanged(cell: mxCell,
|
||||||
style: any): mxCell | null {
|
style: any): mxCell | null {
|
||||||
|
|
||||||
const previous = this.getStyle(cell);
|
const previous = cell.getStyle();
|
||||||
cell.setStyle(style);
|
cell.setStyle(style);
|
||||||
return previous;
|
return previous;
|
||||||
}
|
}
|
||||||
|
@ -1498,8 +1504,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose collapsed state should be returned.
|
* @param {mxCell} cell whose collapsed state should be returned.
|
||||||
*/
|
*/
|
||||||
// isCollapsed(cell: mxCell): boolean;
|
// isCollapsed(cell: mxCell): boolean;
|
||||||
isCollapsed(cell: mxCell | null): boolean {
|
isCollapsed(cell: mxCell): boolean {
|
||||||
return cell != null ? cell.isCollapsed() : false;
|
// SLATED FOR DELETION
|
||||||
|
return cell.isCollapsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1513,7 +1520,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
setCollapsed(cell: mxCell,
|
setCollapsed(cell: mxCell,
|
||||||
collapsed: boolean): boolean {
|
collapsed: boolean): boolean {
|
||||||
|
|
||||||
if (collapsed !== this.isCollapsed(cell)) {
|
if (collapsed !== cell.isCollapsed()) {
|
||||||
this.execute(new mxCollapseChange(this, cell, collapsed));
|
this.execute(new mxCollapseChange(this, cell, collapsed));
|
||||||
}
|
}
|
||||||
return collapsed;
|
return collapsed;
|
||||||
|
@ -1531,7 +1538,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
collapsedStateForCellChanged(cell: mxCell,
|
collapsedStateForCellChanged(cell: mxCell,
|
||||||
collapsed: boolean): boolean {
|
collapsed: boolean): boolean {
|
||||||
|
|
||||||
const previous = this.isCollapsed(cell);
|
const previous = cell.isCollapsed();
|
||||||
cell.setCollapsed(collapsed);
|
cell.setCollapsed(collapsed);
|
||||||
return previous;
|
return previous;
|
||||||
}
|
}
|
||||||
|
@ -1542,8 +1549,9 @@ class mxGraphModel extends mxEventSource {
|
||||||
* @param {mxCell} cell whose visible state should be returned.
|
* @param {mxCell} cell whose visible state should be returned.
|
||||||
*/
|
*/
|
||||||
// isVisible(cell: mxCell): boolean;
|
// isVisible(cell: mxCell): boolean;
|
||||||
isVisible(cell: mxCell | null): boolean {
|
isVisible(cell: mxCell): boolean {
|
||||||
return cell != null ? cell.isVisible() : false;
|
// SLATED FOR DELETION
|
||||||
|
return cell.isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1557,7 +1565,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
setVisible(cell: mxCell,
|
setVisible(cell: mxCell,
|
||||||
visible: boolean) {
|
visible: boolean) {
|
||||||
|
|
||||||
if (visible !== this.isVisible(cell)) {
|
if (visible !== cell.isVisible()) {
|
||||||
this.execute(new mxVisibleChange(this, cell, visible));
|
this.execute(new mxVisibleChange(this, cell, visible));
|
||||||
}
|
}
|
||||||
return visible;
|
return visible;
|
||||||
|
@ -1574,7 +1582,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
// visibleStateForCellChanged(cell: mxCell, visible: boolean): boolean;
|
// visibleStateForCellChanged(cell: mxCell, visible: boolean): boolean;
|
||||||
visibleStateForCellChanged(cell: mxCell,
|
visibleStateForCellChanged(cell: mxCell,
|
||||||
visible: boolean): boolean {
|
visible: boolean): boolean {
|
||||||
const previous = this.isVisible(cell);
|
const previous = cell.isVisible();
|
||||||
cell.setVisible(visible);
|
cell.setVisible(visible);
|
||||||
return previous;
|
return previous;
|
||||||
}
|
}
|
||||||
|
@ -1740,14 +1748,14 @@ class mxGraphModel extends mxEventSource {
|
||||||
// cells in the target model
|
// cells in the target model
|
||||||
for (const key in mapping) {
|
for (const key in mapping) {
|
||||||
const cell = mapping[key];
|
const cell = mapping[key];
|
||||||
let terminal = this.getTerminal(cell, true);
|
let terminal = cell.getTerminal(true);
|
||||||
|
|
||||||
if (terminal != null) {
|
if (terminal != null) {
|
||||||
terminal = mapping[mxCellPath.create(terminal)];
|
terminal = mapping[mxCellPath.create(terminal)];
|
||||||
this.setTerminal(cell, terminal, true);
|
this.setTerminal(cell, terminal, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
terminal = this.getTerminal(cell, false);
|
terminal = cell.getTerminal(false);
|
||||||
|
|
||||||
if (terminal != null) {
|
if (terminal != null) {
|
||||||
terminal = mapping[mxCellPath.create(terminal)];
|
terminal = mapping[mxCellPath.create(terminal)];
|
||||||
|
@ -1781,7 +1789,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
if (typeof cell.getId === 'function') {
|
if (typeof cell.getId === 'function') {
|
||||||
const id: string = <string>cell.getId();
|
const id: string = <string>cell.getId();
|
||||||
let target =
|
let target =
|
||||||
id != null && (!this.isEdge(cell) || !cloneAllEdges)
|
id != null && (!cell.isEdge() || !cloneAllEdges)
|
||||||
? this.getCell(id)
|
? this.getCell(id)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
@ -1828,8 +1836,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
const dict = new mxDictionary();
|
const dict = new mxDictionary();
|
||||||
|
|
||||||
for (const cell of cells) {
|
for (const cell of cells) {
|
||||||
const parent = this.getParent(cell);
|
const parent = cell.getParent();
|
||||||
|
|
||||||
if (parent != null && !dict.get(parent)) {
|
if (parent != null && !dict.get(parent)) {
|
||||||
dict.put(parent, true);
|
dict.put(parent, true);
|
||||||
parents.push(parent);
|
parents.push(parent);
|
||||||
|
@ -1872,21 +1879,17 @@ class mxGraphModel extends mxEventSource {
|
||||||
// cloneCells(cells: Array<mxCell>, includeChildren?: boolean, mapping?: any): Array<mxCell>;
|
// cloneCells(cells: Array<mxCell>, includeChildren?: boolean, mapping?: any): Array<mxCell>;
|
||||||
cloneCells(cells: mxCell[],
|
cloneCells(cells: mxCell[],
|
||||||
includeChildren: boolean=true,
|
includeChildren: boolean=true,
|
||||||
mapping: any={}): (mxCell | null)[] {
|
mapping: any={}): mxCell[] {
|
||||||
|
|
||||||
const clones: (mxCell | null)[] = [];
|
const clones: mxCell[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
if (cells[i] != null) {
|
|
||||||
clones.push(this.cloneCellImpl(cells[i], mapping, includeChildren));
|
clones.push(this.cloneCellImpl(cells[i], mapping, includeChildren));
|
||||||
} else {
|
|
||||||
clones.push(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < clones.length; i += 1) {
|
for (let i = 0; i < clones.length; i += 1) {
|
||||||
if (clones[i] != null) {
|
if (clones[i] != null) {
|
||||||
this.restoreClone(clones[i], cells[i], mapping);
|
this.restoreClone(<mxCell>clones[i], cells[i], mapping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return clones;
|
return clones;
|
||||||
|
@ -1904,15 +1907,15 @@ class mxGraphModel extends mxEventSource {
|
||||||
let clone = mapping ? mapping[ident] : null;
|
let clone = mapping ? mapping[ident] : null;
|
||||||
|
|
||||||
if (clone == null) {
|
if (clone == null) {
|
||||||
clone = this.cellCloned(cell);
|
clone = cell.clone();
|
||||||
mapping[ident] = clone;
|
mapping[ident] = clone;
|
||||||
|
|
||||||
if (includeChildren) {
|
if (includeChildren) {
|
||||||
const childCount = this.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const cloneChild = this.cloneCellImpl(
|
const cloneChild = this.cloneCellImpl(
|
||||||
<mxCell>this.getChildAt(cell, i),
|
<mxCell>cell.getChildAt(i),
|
||||||
mapping,
|
mapping,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
@ -1929,6 +1932,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
*/
|
*/
|
||||||
// cellCloned(cell: mxCell): mxCell;
|
// cellCloned(cell: mxCell): mxCell;
|
||||||
cellCloned(cell: mxCell): mxCell {
|
cellCloned(cell: mxCell): mxCell {
|
||||||
|
// SLATED FOR DELETION
|
||||||
return cell.clone();
|
return cell.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1937,11 +1941,11 @@ class mxGraphModel extends mxEventSource {
|
||||||
* a network of cloned cells.
|
* a network of cloned cells.
|
||||||
*/
|
*/
|
||||||
// restoreClone(clone: mxCell, cell: mxCell, mapping?: any): void;
|
// restoreClone(clone: mxCell, cell: mxCell, mapping?: any): void;
|
||||||
restoreClone(clone: mxCell | null,
|
restoreClone(clone: mxCell,
|
||||||
cell: mxCell | null,
|
cell: mxCell,
|
||||||
mapping: any): void {
|
mapping: any): void {
|
||||||
|
|
||||||
const source = this.getTerminal(cell, true);
|
const source = cell.getTerminal(true);
|
||||||
|
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
const tmp = mapping[mxObjectIdentity.get(source)];
|
const tmp = mapping[mxObjectIdentity.get(source)];
|
||||||
|
@ -1950,7 +1954,7 @@ class mxGraphModel extends mxEventSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const target = this.getTerminal(cell, false);
|
const target = cell.getTerminal(false);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
const tmp = mapping[mxObjectIdentity.get(target)];
|
const tmp = mapping[mxObjectIdentity.get(target)];
|
||||||
if (tmp != null) {
|
if (tmp != null) {
|
||||||
|
@ -1958,11 +1962,11 @@ class mxGraphModel extends mxEventSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const childCount = this.getChildCount(clone);
|
const childCount = clone.getChildCount();
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.restoreClone(
|
this.restoreClone(
|
||||||
this.getChildAt(clone, i),
|
<mxCell>clone.getChildAt(i),
|
||||||
this.getChildAt(cell, i),
|
<mxCell>cell.getChildAt(i),
|
||||||
mapping
|
mapping
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import mxEventSource from '../../util/event/mxEventSource';
|
||||||
import mxEventObject from '../../util/event/mxEventObject';
|
import mxEventObject from '../../util/event/mxEventObject';
|
||||||
import mxClient from '../../mxClient';
|
import mxClient from '../../mxClient';
|
||||||
import mxUtils from '../../util/mxUtils';
|
import mxUtils from '../../util/mxUtils';
|
||||||
import mxSelectionChange from './mxSelectionChange';
|
import mxSelectionChange from '../../atomic_changes/mxSelectionChange';
|
||||||
import mxEvent from '../../util/event/mxEvent';
|
import mxEvent from '../../util/event/mxEvent';
|
||||||
import mxCell from '../cell/mxCell';
|
import mxCell from '../cell/mxCell';
|
||||||
import mxGraph from './mxGraph';
|
import mxGraph from './mxGraph';
|
||||||
|
|
|
@ -25,7 +25,7 @@ import mxStyleRegistry from '../../util/datatypes/style/mxStyleRegistry';
|
||||||
import mxGraph from './mxGraph';
|
import mxGraph from './mxGraph';
|
||||||
import mxCell from '../cell/mxCell';
|
import mxCell from '../cell/mxCell';
|
||||||
import mxImage from '../../util/image/mxImage';
|
import mxImage from '../../util/image/mxImage';
|
||||||
import mxCurrentRootChange from './mxCurrentRootChange';
|
import mxCurrentRootChange from '../../atomic_changes/mxCurrentRootChange';
|
||||||
import mxGraphModel from './mxGraphModel';
|
import mxGraphModel from './mxGraphModel';
|
||||||
import mxShape from '../../shape/mxShape';
|
import mxShape from '../../shape/mxShape';
|
||||||
import mxGeometry from "../../util/datatypes/mxGeometry";
|
import mxGeometry from "../../util/datatypes/mxGeometry";
|
||||||
|
@ -371,10 +371,8 @@ class mxGraphView extends mxEventSource {
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
if (cells != null && cells.length > 0) {
|
if (cells != null && cells.length > 0) {
|
||||||
const model = (<mxGraph>this.graph).getModel();
|
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
if (model.isVertex(cells[i]) || model.isEdge(cells[i])) {
|
if (cells[i].isVertex() || cells[i].isEdge()) {
|
||||||
const state = this.getState(cells[i]);
|
const state = this.getState(cells[i]);
|
||||||
|
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
|
@ -497,22 +495,20 @@ class mxGraphView extends mxEventSource {
|
||||||
* @param force Boolean indicating if the current root should be ignored for
|
* @param force Boolean indicating if the current root should be ignored for
|
||||||
* recursion.
|
* recursion.
|
||||||
*/
|
*/
|
||||||
// clear(cell?: mxCell, force?: boolean, recurse?: boolean): void;
|
// clear(cell: mxCell, force?: boolean, recurse?: boolean): void;
|
||||||
clear(
|
clear(
|
||||||
cell: mxCell | null = null,
|
cell: mxCell=<mxCell>(<mxGraph>this.graph).getModel().getRoot(),
|
||||||
force: boolean = false,
|
force: boolean = false,
|
||||||
recurse: boolean = true
|
recurse: boolean = true
|
||||||
) {
|
) {
|
||||||
const model: mxGraphModel = (<mxGraph>this.graph).getModel();
|
const model: mxGraphModel = (<mxGraph>this.graph).getModel();
|
||||||
cell = cell || model.getRoot();
|
|
||||||
|
|
||||||
this.removeState(<mxCell>cell);
|
this.removeState(<mxCell>cell);
|
||||||
|
|
||||||
if (recurse && (force || cell != this.currentRoot)) {
|
if (recurse && (force || cell != this.currentRoot)) {
|
||||||
const childCount: number = model.getChildCount(cell);
|
const childCount: number = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.clear(model.getChildAt(cell, i), force);
|
this.clear(<mxCell>cell.getChildAt(i), force);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.invalidate(cell);
|
this.invalidate(cell);
|
||||||
|
@ -547,20 +543,20 @@ class mxGraphView extends mxEventSource {
|
||||||
|
|
||||||
// Recursively invalidates all descendants
|
// Recursively invalidates all descendants
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = model.getChildAt(cell, i);
|
const child = cell.getChildAt(i);
|
||||||
this.invalidate(child, recurse, includeEdges);
|
this.invalidate(child, recurse, includeEdges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Propagates invalidation to all connected edges
|
// Propagates invalidation to all connected edges
|
||||||
if (includeEdges) {
|
if (includeEdges) {
|
||||||
const edgeCount = model.getEdgeCount(cell);
|
const edgeCount = cell.getEdgeCount();
|
||||||
|
|
||||||
for (let i = 0; i < edgeCount; i += 1) {
|
for (let i = 0; i < edgeCount; i += 1) {
|
||||||
this.invalidate(model.getEdgeAt(cell, i), recurse, includeEdges);
|
this.invalidate(cell.getEdgeAt(i), recurse, includeEdges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +573,7 @@ class mxGraphView extends mxEventSource {
|
||||||
* Default is {@link currentRoot} or the root of the model.
|
* Default is {@link currentRoot} or the root of the model.
|
||||||
*/
|
*/
|
||||||
// validate(cell?: mxCell): void;
|
// validate(cell?: mxCell): void;
|
||||||
validate(cell: mxCell | null = null) {
|
validate(cell: mxCell | null=null) {
|
||||||
const t0 = mxLog.enter('mxGraphView.validate');
|
const t0 = mxLog.enter('mxGraphView.validate');
|
||||||
window.status =
|
window.status =
|
||||||
mxResources.get(this.updatingDocumentResource) ||
|
mxResources.get(this.updatingDocumentResource) ||
|
||||||
|
@ -588,10 +584,10 @@ class mxGraphView extends mxEventSource {
|
||||||
const graphBounds = this.getBoundingBox(
|
const graphBounds = this.getBoundingBox(
|
||||||
this.validateCellState(
|
this.validateCellState(
|
||||||
<mxCell>this.validateCell(
|
<mxCell>this.validateCell(
|
||||||
cell ||
|
<mxCell>(cell ||
|
||||||
(this.currentRoot != null
|
(this.currentRoot != null
|
||||||
? this.currentRoot
|
? this.currentRoot
|
||||||
: (<mxGraph>this.graph).getModel().getRoot())
|
: (<mxGraph>this.graph).getModel().getRoot()))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -646,11 +642,11 @@ class mxGraphView extends mxEventSource {
|
||||||
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
const model = (<mxGraph>this.graph).getModel();
|
const model = (<mxGraph>this.graph).getModel();
|
||||||
const childCount = model.getChildCount(state.cell);
|
const childCount = state.cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const bounds = this.getBoundingBox(
|
const bounds = this.getBoundingBox(
|
||||||
this.getState(model.getChildAt(state.cell, i))
|
this.getState(state.cell.getChildAt(i))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (bounds != null) {
|
if (bounds != null) {
|
||||||
|
@ -847,28 +843,26 @@ class mxGraphView extends mxEventSource {
|
||||||
* is true.
|
* is true.
|
||||||
*/
|
*/
|
||||||
// validateCell(cell: mxCell, visible?: boolean): void;
|
// validateCell(cell: mxCell, visible?: boolean): void;
|
||||||
validateCell(cell: mxCell | null=null,
|
validateCell(cell: mxCell,
|
||||||
visible: boolean = true): mxCell | null {
|
visible: boolean = true): mxCell | null {
|
||||||
|
|
||||||
if (cell != null) {
|
visible = visible && cell.isVisible();
|
||||||
visible = visible && (<mxGraph>this.graph).isCellVisible(cell);
|
|
||||||
const state = this.getState(cell, visible);
|
const state = this.getState(cell, visible);
|
||||||
|
|
||||||
if (state != null && !visible) {
|
if (state != null && !visible) {
|
||||||
this.removeState(cell);
|
this.removeState(cell);
|
||||||
} else {
|
} else {
|
||||||
const model = (<mxGraph>this.graph).getModel();
|
const model = (<mxGraph>this.graph).getModel();
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.validateCell(
|
this.validateCell(
|
||||||
<mxCell>model.getChildAt(cell, i),
|
<mxCell>cell.getChildAt(i),
|
||||||
visible &&
|
visible &&
|
||||||
(!this.isCellCollapsed(cell) || cell === this.currentRoot)
|
(!this.isCellCollapsed(cell) || cell === this.currentRoot)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,7 +893,7 @@ class mxGraphView extends mxEventSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cell !== this.currentRoot) {
|
if (cell !== this.currentRoot) {
|
||||||
this.validateCellState(<mxCell>model.getParent(cell), false);
|
this.validateCellState(<mxCell>cell.getParent(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.setVisibleTerminalState(
|
state.setVisibleTerminalState(
|
||||||
|
@ -928,9 +922,9 @@ class mxGraphView extends mxEventSource {
|
||||||
this.stateValidated(state);
|
this.stateValidated(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
const childCount = model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
this.validateCellState(<mxCell>model.getChildAt(cell, i));
|
this.validateCellState(<mxCell>cell.getChildAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -957,7 +951,7 @@ class mxGraphView extends mxEventSource {
|
||||||
|
|
||||||
if (state.cell !== this.currentRoot) {
|
if (state.cell !== this.currentRoot) {
|
||||||
const model = (<mxGraph>this.graph).getModel();
|
const model = (<mxGraph>this.graph).getModel();
|
||||||
const pState = <mxCellState>this.getState(model.getParent(state.cell));
|
const pState = <mxCellState>this.getState(state.cell.getParent());
|
||||||
|
|
||||||
if (pState != null && pState.cell !== this.currentRoot) {
|
if (pState != null && pState.cell !== this.currentRoot) {
|
||||||
origin.x += (<mxPoint>pState.origin).x;
|
origin.x += (<mxPoint>pState.origin).x;
|
||||||
|
@ -974,11 +968,11 @@ class mxGraphView extends mxEventSource {
|
||||||
const geo = (<mxGraph>this.graph).getCellGeometry(<mxCell>state.cell);
|
const geo = (<mxGraph>this.graph).getCellGeometry(<mxCell>state.cell);
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
if (!model.isEdge(state.cell)) {
|
if (!state.cell.isEdge()) {
|
||||||
offset = <mxPoint>(geo.offset != null ? geo.offset : this.EMPTY_POINT);
|
offset = <mxPoint>(geo.offset != null ? geo.offset : this.EMPTY_POINT);
|
||||||
|
|
||||||
if (geo.relative && pState != null) {
|
if (geo.relative && pState != null) {
|
||||||
if (model.isEdge(pState.cell)) {
|
if (pState.cell.isEdge()) {
|
||||||
const origin = this.getPoint(pState, geo);
|
const origin = this.getPoint(pState, geo);
|
||||||
|
|
||||||
if (origin != null) {
|
if (origin != null) {
|
||||||
|
@ -1006,11 +1000,11 @@ class mxGraphView extends mxEventSource {
|
||||||
state.height = this.scale * geo.height;
|
state.height = this.scale * geo.height;
|
||||||
state.unscaledHeight = geo.height;
|
state.unscaledHeight = geo.height;
|
||||||
|
|
||||||
if (model.isVertex(state.cell)) {
|
if (state.cell.isVertex()) {
|
||||||
this.updateVertexState(state, geo);
|
this.updateVertexState(state, geo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.isEdge(state.cell)) {
|
if (state.cell.isEdge()) {
|
||||||
this.updateEdgeState(state, geo);
|
this.updateEdgeState(state, geo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1021,7 +1015,7 @@ class mxGraphView extends mxEventSource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the children of the given cell should not be visible in the
|
* Returns true if the children of the given cell should not be visible in the
|
||||||
* view. This implementation uses {@link mxGraph.isCellVisible} but it can be
|
* view. This implementation uses {@link mxCell.isCellVisible} but it can be
|
||||||
* overidden to use a separate condition.
|
* overidden to use a separate condition.
|
||||||
*/
|
*/
|
||||||
// isCellCollapsed(cell: mxCell): boolean;
|
// isCellCollapsed(cell: mxCell): boolean;
|
||||||
|
@ -1037,9 +1031,9 @@ class mxGraphView extends mxEventSource {
|
||||||
geo: mxGeometry) {
|
geo: mxGeometry) {
|
||||||
|
|
||||||
const model = (<mxGraph>this.graph).getModel();
|
const model = (<mxGraph>this.graph).getModel();
|
||||||
const pState = this.getState(model.getParent(state.cell));
|
const pState = this.getState(state.cell.getParent());
|
||||||
|
|
||||||
if (geo.relative && pState != null && !model.isEdge(pState.cell)) {
|
if (geo.relative && pState != null && !pState.cell.isEdge()) {
|
||||||
const alpha = mxUtils.toRadians(
|
const alpha = mxUtils.toRadians(
|
||||||
pState.style[mxConstants.STYLE_ROTATION] || '0'
|
pState.style[mxConstants.STYLE_ROTATION] || '0'
|
||||||
);
|
);
|
||||||
|
@ -1071,10 +1065,10 @@ class mxGraphView extends mxEventSource {
|
||||||
// as such edges are invalid and produce NPEs in the edge styles.
|
// as such edges are invalid and produce NPEs in the edge styles.
|
||||||
// Also removes connected edges that have no visible terminals.
|
// Also removes connected edges that have no visible terminals.
|
||||||
if (
|
if (
|
||||||
((<mxGraphModel>(<mxGraph>this.graph).model).getTerminal(state.cell, true) != null &&
|
(state.cell.getTerminal(true) != null &&
|
||||||
source == null) ||
|
source == null) ||
|
||||||
(source == null && geo.getTerminalPoint(true) == null) ||
|
(source == null && geo.getTerminalPoint(true) == null) ||
|
||||||
((<mxGraphModel>(<mxGraph>this.graph).model).getTerminal(state.cell, false) != null &&
|
(state.cell.getTerminal(false) != null &&
|
||||||
target == null) ||
|
target == null) ||
|
||||||
(target == null && geo.getTerminalPoint(false) == null)
|
(target == null && geo.getTerminalPoint(false) == null)
|
||||||
) {
|
) {
|
||||||
|
@ -1200,9 +1194,9 @@ class mxGraphView extends mxEventSource {
|
||||||
stateValidated(state: mxCellState): void {
|
stateValidated(state: mxCellState): void {
|
||||||
const graph = (<mxGraph>this.graph);
|
const graph = (<mxGraph>this.graph);
|
||||||
const fg =
|
const fg =
|
||||||
(graph.getModel().isEdge(state.cell) &&
|
(state.cell.isEdge() &&
|
||||||
graph.keepEdgesInForeground) ||
|
graph.keepEdgesInForeground) ||
|
||||||
(graph.getModel().isVertex(<mxCell>state.cell) &&
|
(state.cell.isVertex() &&
|
||||||
graph.keepEdgesInBackground);
|
graph.keepEdgesInBackground);
|
||||||
const htmlNode = fg
|
const htmlNode = fg
|
||||||
? this.lastForegroundHtmlNode || this.lastHtmlNode
|
? this.lastForegroundHtmlNode || this.lastHtmlNode
|
||||||
|
@ -1651,7 +1645,7 @@ class mxGraphView extends mxEventSource {
|
||||||
let flipH = false;
|
let flipH = false;
|
||||||
let flipV = false;
|
let flipV = false;
|
||||||
|
|
||||||
if ((<mxGraphModel>(<mxGraph>this.graph).model).isVertex(terminal.cell)) {
|
if (terminal.cell.isVertex()) {
|
||||||
flipH =
|
flipH =
|
||||||
mxUtils.getValue(terminal.style, mxConstants.STYLE_FLIPH, 0) == 1;
|
mxUtils.getValue(terminal.style, mxConstants.STYLE_FLIPH, 0) == 1;
|
||||||
flipV =
|
flipV =
|
||||||
|
@ -1835,26 +1829,26 @@ class mxGraphView extends mxEventSource {
|
||||||
* should be returned.
|
* should be returned.
|
||||||
*/
|
*/
|
||||||
// getVisibleTerminal(edge: mxCell, source: boolean): mxCell;
|
// getVisibleTerminal(edge: mxCell, source: boolean): mxCell;
|
||||||
getVisibleTerminal(edge: mxCell | null,
|
getVisibleTerminal(edge: mxCell,
|
||||||
source: boolean) {
|
source: boolean) {
|
||||||
|
|
||||||
const model = (<mxGraph>this.graph).getModel();
|
const model = (<mxGraph>this.graph).getModel();
|
||||||
let result = model.getTerminal(edge, source);
|
let result = edge.getTerminal(source);
|
||||||
let best = result;
|
let best = result;
|
||||||
|
|
||||||
while (result != null && result != this.currentRoot) {
|
while (result != null && result != this.currentRoot) {
|
||||||
if (!(<mxGraph>this.graph).isCellVisible(best) || this.isCellCollapsed(result)) {
|
if ((best && !best.isVisible()) || this.isCellCollapsed(result)) {
|
||||||
best = result;
|
best = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = model.getParent(result);
|
result = result.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if the result is valid for the current view state
|
// Checks if the result is valid for the current view state
|
||||||
if (
|
if (
|
||||||
best != null &&
|
best != null &&
|
||||||
(!model.contains(best) ||
|
(!model.contains(best) ||
|
||||||
model.getParent(best) === model.getRoot() ||
|
best.getParent() === model.getRoot() ||
|
||||||
best === this.currentRoot)
|
best === this.currentRoot)
|
||||||
) {
|
) {
|
||||||
best = null;
|
best = null;
|
||||||
|
@ -2007,7 +2001,7 @@ class mxGraphView extends mxEventSource {
|
||||||
y: number) {
|
y: number) {
|
||||||
|
|
||||||
const model = (<mxGraph>this.graph).getModel();
|
const model = (<mxGraph>this.graph).getModel();
|
||||||
const geometry = model.getGeometry(edgeState.cell);
|
const geometry = edgeState.cell.getGeometry();
|
||||||
|
|
||||||
if (geometry != null) {
|
if (geometry != null) {
|
||||||
const absolutePoints = (<mxPoint[]>edgeState.absolutePoints);
|
const absolutePoints = (<mxPoint[]>edgeState.absolutePoints);
|
||||||
|
@ -2168,7 +2162,7 @@ class mxGraphView extends mxEventSource {
|
||||||
if (
|
if (
|
||||||
create &&
|
create &&
|
||||||
(state == null || this.updateStyle) &&
|
(state == null || this.updateStyle) &&
|
||||||
(<mxGraph>this.graph).isCellVisible(cell)
|
cell.isVisible()
|
||||||
) {
|
) {
|
||||||
if (state == null) {
|
if (state == null) {
|
||||||
state = this.createState(cell);
|
state = this.createState(cell);
|
||||||
|
@ -2521,7 +2515,7 @@ class mxGraphView extends mxEventSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root != null && root.parentNode != null) {
|
if (root != null && root.parentNode != null) {
|
||||||
this.clear(this.currentRoot, true);
|
this.clear(<mxCell>this.currentRoot, true);
|
||||||
mxEvent.removeGestureListeners(
|
mxEvent.removeGestureListeners(
|
||||||
document,
|
document,
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -243,7 +243,7 @@ class mxLayoutManager extends mxEventSource {
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
const layout = this.getLayout(
|
const layout = this.getLayout(
|
||||||
model.getParent(cells[i]),
|
cells[i].getParent(),
|
||||||
mxEvent.MOVE_CELLS
|
mxEvent.MOVE_CELLS
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ class mxLayoutManager extends mxEventSource {
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i += 1) {
|
for (let i = 0; i < cells.length; i += 1) {
|
||||||
const layout = this.getLayout(
|
const layout = this.getLayout(
|
||||||
model.getParent(cells[i]),
|
cells[i].getParent(),
|
||||||
mxEvent.RESIZE_CELLS
|
mxEvent.RESIZE_CELLS
|
||||||
);
|
);
|
||||||
if (layout != null) {
|
if (layout != null) {
|
||||||
|
@ -349,7 +349,7 @@ class mxLayoutManager extends mxEventSource {
|
||||||
|
|
||||||
if (this.isBubbling()) {
|
if (this.isBubbling()) {
|
||||||
const model = (<mxGraph>this.getGraph()).getModel();
|
const model = (<mxGraph>this.getGraph()).getModel();
|
||||||
this.addAncestorsWithLayout(<mxCell>model.getParent(cell), result);
|
this.addAncestorsWithLayout(<mxCell>cell.getParent(), result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -363,8 +363,8 @@ class mxLayoutManager extends mxEventSource {
|
||||||
if (cell != null && this.hasLayout(cell)) {
|
if (cell != null && this.hasLayout(cell)) {
|
||||||
const model = (<mxGraph>this.getGraph()).getModel();
|
const model = (<mxGraph>this.getGraph()).getModel();
|
||||||
|
|
||||||
for (let i = 0; i < model.getChildCount(cell); i += 1) {
|
for (let i = 0; i < cell.getChildCount(); i += 1) {
|
||||||
const child = <mxCell>model.getChildAt(cell, i);
|
const child = <mxCell>cell.getChildAt(i);
|
||||||
|
|
||||||
if (this.hasLayout(child)) {
|
if (this.hasLayout(child)) {
|
||||||
result.push(child);
|
result.push(child);
|
||||||
|
|
|
@ -245,17 +245,16 @@ class mxSwimlaneManager extends mxEventSource {
|
||||||
*/
|
*/
|
||||||
// swimlaneAdded(swimlane: mxCell): void;
|
// swimlaneAdded(swimlane: mxCell): void;
|
||||||
swimlaneAdded(swimlane: mxCell): void {
|
swimlaneAdded(swimlane: mxCell): void {
|
||||||
const model = (<mxGraph>this.getGraph()).getModel();
|
const parent = <mxCell>swimlane.getParent();
|
||||||
const parent = model.getParent(swimlane);
|
const childCount = parent.getChildCount();
|
||||||
const childCount = model.getChildCount(parent);
|
|
||||||
let geo = null;
|
let geo = null;
|
||||||
|
|
||||||
// Finds the first valid sibling swimlane as reference
|
// Finds the first valid sibling swimlane as reference
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = <mxCell>model.getChildAt(parent, i);
|
const child = <mxCell>parent.getChildAt(i);
|
||||||
|
|
||||||
if (child !== swimlane && !this.isSwimlaneIgnored(child)) {
|
if (child !== swimlane && !this.isSwimlaneIgnored(child)) {
|
||||||
geo = model.getGeometry(child);
|
geo = child.getGeometry();
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +285,7 @@ class mxSwimlaneManager extends mxEventSource {
|
||||||
// Finds the top-level swimlanes and adds offsets
|
// Finds the top-level swimlanes and adds offsets
|
||||||
for (const cell of cells) {
|
for (const cell of cells) {
|
||||||
if (!this.isSwimlaneIgnored(cell)) {
|
if (!this.isSwimlaneIgnored(cell)) {
|
||||||
const geo = model.getGeometry(cell);
|
const geo = cell.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
const size = new mxRectangle(0, 0, geo.width, geo.height);
|
const size = new mxRectangle(0, 0, geo.width, geo.height);
|
||||||
|
@ -295,7 +294,7 @@ class mxSwimlaneManager extends mxEventSource {
|
||||||
|
|
||||||
while (current != null) {
|
while (current != null) {
|
||||||
top = current;
|
top = current;
|
||||||
current = <mxCell>model.getParent(current);
|
current = <mxCell>current.getParent();
|
||||||
const tmp = (<mxGraph>this.graph).isSwimlane(current)
|
const tmp = (<mxGraph>this.graph).isSwimlane(current)
|
||||||
? (<mxGraph>this.graph).getStartSize(current)
|
? (<mxGraph>this.graph).getStartSize(current)
|
||||||
: new mxRectangle();
|
: new mxRectangle();
|
||||||
|
@ -342,7 +341,7 @@ class mxSwimlaneManager extends mxEventSource {
|
||||||
const horizontal = this.isCellHorizontal(swimlane);
|
const horizontal = this.isCellHorizontal(swimlane);
|
||||||
|
|
||||||
if (!this.isSwimlaneIgnored(swimlane)) {
|
if (!this.isSwimlaneIgnored(swimlane)) {
|
||||||
let geo = <mxGeometry>model.getGeometry(swimlane);
|
let geo = <mxGeometry>swimlane.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
if (
|
if (
|
||||||
|
@ -368,10 +367,10 @@ class mxSwimlaneManager extends mxEventSource {
|
||||||
w -= tmp.width;
|
w -= tmp.width;
|
||||||
h -= tmp.height;
|
h -= tmp.height;
|
||||||
|
|
||||||
const childCount = model.getChildCount(swimlane);
|
const childCount = swimlane.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i += 1) {
|
for (let i = 0; i < childCount; i += 1) {
|
||||||
const child = <mxCell>model.getChildAt(swimlane, i);
|
const child = <mxCell>swimlane.getChildAt(i);
|
||||||
this.resizeSwimlane(child, w, h, horizontal);
|
this.resizeSwimlane(child, w, h, horizontal);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -57,7 +57,7 @@ class EdgeTolerance extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
const cell = this.getCellAt(me.graphX, me.graphY);
|
const cell = this.getCellAt(me.graphX, me.graphY);
|
||||||
if (this.getModel().isEdge(cell)) {
|
if (cell.isEdge()) {
|
||||||
me.state = this.view.getState(cell);
|
me.state = this.view.getState(cell);
|
||||||
|
|
||||||
if (me.state != null && me.state.shape != null) {
|
if (me.state != null && me.state.shape != null) {
|
||||||
|
|
|
@ -144,7 +144,7 @@ class FixedPoints extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllConnectionConstraints(terminal) {
|
getAllConnectionConstraints(terminal) {
|
||||||
if (terminal != null && this.model.isVertex(terminal.cell)) {
|
if (terminal != null && terminal.cell.isVertex()) {
|
||||||
return [
|
return [
|
||||||
new mxConnectionConstraint(new mxPoint(0, 0), true),
|
new mxConnectionConstraint(new mxPoint(0, 0), true),
|
||||||
new mxConnectionConstraint(new mxPoint(0.5, 0), true),
|
new mxConnectionConstraint(new mxPoint(0.5, 0), true),
|
||||||
|
|
|
@ -66,11 +66,11 @@ class HelloPort extends React.Component {
|
||||||
// Implements a tooltip that shows the actual
|
// Implements a tooltip that shows the actual
|
||||||
// source and target of an edge
|
// source and target of an edge
|
||||||
graph.getTooltipForCell = function(cell) {
|
graph.getTooltipForCell = function(cell) {
|
||||||
if (this.model.isEdge(cell)) {
|
if (cell.isEdge()) {
|
||||||
return `${this.convertValueToString(
|
return `${this.convertValueToString(
|
||||||
this.model.getTerminal(cell, true)
|
cell.getTerminal(true)
|
||||||
)} => ${this.convertValueToString(
|
)} => ${this.convertValueToString(
|
||||||
this.model.getTerminal(cell, false)
|
cell.getTerminal(false)
|
||||||
)}`;
|
)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ class PortRefs extends React.Component {
|
||||||
if (terminal.shape.stencil != null) {
|
if (terminal.shape.stencil != null) {
|
||||||
return terminal.shape.stencil.constraints;
|
return terminal.shape.stencil.constraints;
|
||||||
}
|
}
|
||||||
} else if (terminal != null && this.model.isVertex(terminal.cell)) {
|
} else if (terminal != null && terminal.cell.isVertex()) {
|
||||||
if (terminal.shape != null) {
|
if (terminal.shape != null) {
|
||||||
const ports = terminal.shape.getPorts();
|
const ports = terminal.shape.getPorts();
|
||||||
const cstrs = new Array();
|
const cstrs = new Array();
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Clipboard extends React.Component {
|
||||||
mxClipboard.cellsToString = function(cells) {
|
mxClipboard.cellsToString = function(cells) {
|
||||||
const codec = new mxCodec();
|
const codec = new mxCodec();
|
||||||
const model = new mxGraphModel();
|
const model = new mxGraphModel();
|
||||||
const parent = model.getChildAt(model.getRoot(), 0);
|
const parent = model.getRoot().getChildAt(0);
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++) {
|
for (let i = 0; i < cells.length; i++) {
|
||||||
model.add(parent, cells[i]);
|
model.add(parent, cells[i]);
|
||||||
|
@ -200,16 +200,14 @@ class Clipboard extends React.Component {
|
||||||
const codec = new mxCodec(node.ownerDocument);
|
const codec = new mxCodec(node.ownerDocument);
|
||||||
codec.decode(node, model);
|
codec.decode(node, model);
|
||||||
|
|
||||||
const childCount = model.getChildCount(model.getRoot());
|
const childCount = model.getRoot().getChildCount();
|
||||||
const targetChildCount = graph.model.getChildCount(
|
const targetChildCount = graph.model.getRoot().getChildCount();
|
||||||
graph.model.getRoot()
|
|
||||||
);
|
|
||||||
|
|
||||||
// Merges existing layers and adds new layers
|
// Merges existing layers and adds new layers
|
||||||
graph.model.beginUpdate();
|
graph.model.beginUpdate();
|
||||||
try {
|
try {
|
||||||
for (let i = 0; i < childCount; i++) {
|
for (let i = 0; i < childCount; i++) {
|
||||||
let parent = model.getChildAt(model.getRoot(), i);
|
let parent = model.getRoot().getChildAt(i);
|
||||||
|
|
||||||
// Adds cells to existing layers if not locked
|
// Adds cells to existing layers if not locked
|
||||||
if (targetChildCount > i) {
|
if (targetChildCount > i) {
|
||||||
|
@ -217,10 +215,10 @@ class Clipboard extends React.Component {
|
||||||
const target =
|
const target =
|
||||||
childCount === 1
|
childCount === 1
|
||||||
? graph.getDefaultParent()
|
? graph.getDefaultParent()
|
||||||
: graph.model.getChildAt(graph.model.getRoot(), i);
|
: graph.model.getRoot().getChildAt(i);
|
||||||
|
|
||||||
if (!graph.isCellLocked(target)) {
|
if (!graph.isCellLocked(target)) {
|
||||||
const children = model.getChildren(parent);
|
const children = parent.getChildren();
|
||||||
cells = cells.concat(
|
cells = cells.concat(
|
||||||
graph.importCells(children, dx, dy, target)
|
graph.importCells(children, dx, dy, target)
|
||||||
);
|
);
|
||||||
|
@ -233,7 +231,7 @@ class Clipboard extends React.Component {
|
||||||
0,
|
0,
|
||||||
graph.model.getRoot()
|
graph.model.getRoot()
|
||||||
)[0];
|
)[0];
|
||||||
const children = graph.model.getChildren(parent);
|
const children = parent.getChildren();
|
||||||
graph.moveCells(children, dx, dy);
|
graph.moveCells(children, dx, dy);
|
||||||
cells = cells.concat(children);
|
cells = cells.concat(children);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,10 +51,10 @@ class Boundary extends React.Component {
|
||||||
|
|
||||||
// Removes folding icon for relative children
|
// Removes folding icon for relative children
|
||||||
isCellFoldable(cell, collapse) {
|
isCellFoldable(cell, collapse) {
|
||||||
const childCount = this.model.getChildCount(cell);
|
const childCount = cell.getChildCount();
|
||||||
|
|
||||||
for (let i = 0; i < childCount; i++) {
|
for (let i = 0; i < childCount; i++) {
|
||||||
const child = this.model.getChildAt(cell, i);
|
const child = cell.getChildAt(i);
|
||||||
const geo = this.getCellGeometry(child);
|
const geo = this.getCellGeometry(child);
|
||||||
|
|
||||||
if (geo != null && geo.relative) {
|
if (geo != null && geo.relative) {
|
||||||
|
@ -69,12 +69,12 @@ class Boundary extends React.Component {
|
||||||
getRelativePosition(state, dx, dy) {
|
getRelativePosition(state, dx, dy) {
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
const model = graph.getModel();
|
const model = graph.getModel();
|
||||||
const geo = model.getGeometry(state.cell);
|
const geo = state.cell.getGeometry();
|
||||||
|
|
||||||
if (geo != null && geo.relative && !model.isEdge(state.cell)) {
|
if (geo != null && geo.relative && !state.cell.isEdge()) {
|
||||||
const parent = model.getParent(state.cell);
|
const parent = state.cell.getParent();
|
||||||
|
|
||||||
if (model.isVertex(parent)) {
|
if (parent.isVertex()) {
|
||||||
const pstate = graph.view.getState(parent);
|
const pstate = graph.view.getState(parent);
|
||||||
|
|
||||||
if (pstate != null) {
|
if (pstate != null) {
|
||||||
|
@ -116,7 +116,7 @@ class Boundary extends React.Component {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (rel != null) {
|
if (rel != null) {
|
||||||
let geo = this.model.getGeometry(cell);
|
let geo = cell.getGeometry();
|
||||||
|
|
||||||
if (geo != null && geo.relative) {
|
if (geo != null && geo.relative) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
@ -164,7 +164,7 @@ class Boundary extends React.Component {
|
||||||
|
|
||||||
if (rel != null) {
|
if (rel != null) {
|
||||||
const pstate = this.graph.view.getState(
|
const pstate = this.graph.view.getState(
|
||||||
this.graph.model.getParent(state.cell)
|
state.cell.getParent()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (pstate != null) {
|
if (pstate != null) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -161,7 +161,7 @@ class ContextIcons extends React.Component {
|
||||||
|
|
||||||
class MyCustomGraph extends mxGraph {
|
class MyCustomGraph extends mxGraph {
|
||||||
createHandler(state) {
|
createHandler(state) {
|
||||||
if (state != null && this.model.isVertex(state.cell)) {
|
if (state != null && state.cell.isVertex()) {
|
||||||
return new mxVertexToolHandler(state);
|
return new mxVertexToolHandler(state);
|
||||||
}
|
}
|
||||||
return super.createHandler(state);
|
return super.createHandler(state);
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Control extends React.Component {
|
||||||
|
|
||||||
const { graph } = state.view;
|
const { graph } = state.view;
|
||||||
|
|
||||||
if (graph.getModel().isVertex(state.cell)) {
|
if (state.cell.isVertex()) {
|
||||||
if (state.deleteControl == null) {
|
if (state.deleteControl == null) {
|
||||||
const b = new mxRectangle(
|
const b = new mxRectangle(
|
||||||
0,
|
0,
|
||||||
|
@ -91,7 +91,7 @@ class Control extends React.Component {
|
||||||
const h = state.deleteControl.bounds.height / oldScale;
|
const h = state.deleteControl.bounds.height / oldScale;
|
||||||
const s = state.view.scale;
|
const s = state.view.scale;
|
||||||
|
|
||||||
return state.view.graph.getModel().isEdge(state.cell)
|
return state.cell.isEdge()
|
||||||
? new mxRectangle(
|
? new mxRectangle(
|
||||||
state.x + state.width / 2 - (w / 2) * s,
|
state.x + state.width / 2 - (w / 2) * s,
|
||||||
state.y + state.height / 2 - (h / 2) * s,
|
state.y + state.height / 2 - (h / 2) * s,
|
||||||
|
|
|
@ -158,7 +158,7 @@ class HoverIcons extends React.Component {
|
||||||
// Ignore everything but vertices
|
// Ignore everything but vertices
|
||||||
if (
|
if (
|
||||||
graph.isMouseDown ||
|
graph.isMouseDown ||
|
||||||
(tmp != null && !graph.getModel().isVertex(tmp.cell))
|
(tmp != null && !tmp.cell.isVertex())
|
||||||
) {
|
) {
|
||||||
tmp = null;
|
tmp = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class Labels extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
graph.isCellResizable = function(cell) {
|
graph.isCellResizable = function(cell) {
|
||||||
const geo = this.model.getGeometry(cell);
|
const geo = cell.getGeometry();
|
||||||
|
|
||||||
return geo == null || !geo.relative;
|
return geo == null || !geo.relative;
|
||||||
};
|
};
|
||||||
|
@ -68,14 +68,14 @@ class Labels extends React.Component {
|
||||||
// Truncates the label to the size of the vertex
|
// Truncates the label to the size of the vertex
|
||||||
graph.getLabel = function(cell) {
|
graph.getLabel = function(cell) {
|
||||||
const label = this.labelsVisible ? this.convertValueToString(cell) : '';
|
const label = this.labelsVisible ? this.convertValueToString(cell) : '';
|
||||||
const geometry = this.model.getGeometry(cell);
|
const geometry = cell.getGeometry();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!this.model.isCollapsed(cell) &&
|
!cell.isCollapsed() &&
|
||||||
geometry != null &&
|
geometry != null &&
|
||||||
(geometry.offset == null ||
|
(geometry.offset == null ||
|
||||||
(geometry.offset.x == 0 && geometry.offset.y == 0)) &&
|
(geometry.offset.x == 0 && geometry.offset.y == 0)) &&
|
||||||
this.model.isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
geometry.width >= 2
|
geometry.width >= 2
|
||||||
) {
|
) {
|
||||||
const style = this.getCellStyle(cell);
|
const style = this.getCellStyle(cell);
|
||||||
|
@ -93,12 +93,12 @@ class Labels extends React.Component {
|
||||||
|
|
||||||
// Enables wrapping for vertex labels
|
// Enables wrapping for vertex labels
|
||||||
graph.isWrapping = function(cell) {
|
graph.isWrapping = function(cell) {
|
||||||
return this.model.isCollapsed(cell);
|
return cell.isCollapsed();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enables clipping of vertex labels if no offset is defined
|
// Enables clipping of vertex labels if no offset is defined
|
||||||
graph.isLabelClipped = function(cell) {
|
graph.isLabelClipped = function(cell) {
|
||||||
const geometry = this.model.getGeometry(cell);
|
const geometry = cell.getGeometry();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
geometry != null &&
|
geometry != null &&
|
||||||
|
|
|
@ -83,7 +83,7 @@ class SecondLabel extends React.Component {
|
||||||
|
|
||||||
// Hook for returning shape number for a given cell
|
// Hook for returning shape number for a given cell
|
||||||
graph.getSecondLabel = function(cell) {
|
graph.getSecondLabel = function(cell) {
|
||||||
if (!this.model.isEdge(cell)) {
|
if (!cell.isEdge()) {
|
||||||
// Possible to return any string here
|
// Possible to return any string here
|
||||||
return `The ID of this cell is ${cell.id}`;
|
return `The ID of this cell is ${cell.id}`;
|
||||||
}
|
}
|
||||||
|
@ -94,9 +94,9 @@ class SecondLabel extends React.Component {
|
||||||
let relativeChildVerticesVisible = true;
|
let relativeChildVerticesVisible = true;
|
||||||
|
|
||||||
// Overrides method to hide relative child vertices
|
// Overrides method to hide relative child vertices
|
||||||
graph.isCellVisible = function(cell) {
|
const isVisible = function() {
|
||||||
return (
|
return (
|
||||||
!this.model.isVertex(cell) ||
|
!cell.isVertex() ||
|
||||||
cell.geometry == null ||
|
cell.geometry == null ||
|
||||||
!cell.geometry.relative ||
|
!cell.geometry.relative ||
|
||||||
cell.geometry.relative == relativeChildVerticesVisible
|
cell.geometry.relative == relativeChildVerticesVisible
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Wrapping extends React.Component {
|
||||||
|
|
||||||
// Disables in-place editing for edges
|
// Disables in-place editing for edges
|
||||||
graph.isCellEditable = function(cell) {
|
graph.isCellEditable = function(cell) {
|
||||||
return !this.model.isEdge(cell);
|
return !cell.isEdge();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Gets the default parent for inserting new cells. This
|
// Gets the default parent for inserting new cells. This
|
||||||
|
|
|
@ -37,24 +37,19 @@ class Collapse extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
class MyCustomModel extends mxGraphModel {
|
const graph = new mxGraph(this.el);
|
||||||
getStyle(cell) {
|
const parent = graph.getDefaultParent();
|
||||||
|
|
||||||
|
const getStyle = function() {
|
||||||
// Extends mxGraphModel.getStyle to show an image when collapsed
|
// Extends mxGraphModel.getStyle to show an image when collapsed
|
||||||
if (cell != null) {
|
let style = super.getStyle();
|
||||||
let style = super.getStyle(cell);
|
if (this.isCollapsed()) {
|
||||||
if (this.isCollapsed(cell)) {
|
|
||||||
style =
|
style =
|
||||||
`${style};shape=image;image=http://www.jgraph.com/images/mxgraph.gif;` +
|
`${style};shape=image;image=http://www.jgraph.com/images/mxgraph.gif;` +
|
||||||
`noLabel=1;imageBackground=#C3D9FF;imageBorder=#6482B9`;
|
`noLabel=1;imageBackground=#C3D9FF;imageBorder=#6482B9`;
|
||||||
}
|
}
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const graph = new mxGraph(this.el, new MyCustomModel());
|
|
||||||
const parent = graph.getDefaultParent();
|
|
||||||
|
|
||||||
graph.batchUpdate(() => {
|
graph.batchUpdate(() => {
|
||||||
const v1 = graph.insertVertex({
|
const v1 = graph.insertVertex({
|
||||||
|
@ -65,6 +60,7 @@ class Collapse extends React.Component {
|
||||||
style: 'shape=swimlane;startSize=20;',
|
style: 'shape=swimlane;startSize=20;',
|
||||||
});
|
});
|
||||||
v1.geometry.alternateBounds = new mxRectangle(0, 0, 110, 70);
|
v1.geometry.alternateBounds = new mxRectangle(0, 0, 110, 70);
|
||||||
|
v1.getStyle = getStyle;
|
||||||
|
|
||||||
const v11 = graph.insertVertex({
|
const v11 = graph.insertVertex({
|
||||||
parent: v1,
|
parent: v1,
|
||||||
|
@ -72,6 +68,7 @@ class Collapse extends React.Component {
|
||||||
position: [10, 40],
|
position: [10, 40],
|
||||||
size: [120, 80],
|
size: [120, 80],
|
||||||
});
|
});
|
||||||
|
v11.getStyle = getStyle;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Constituent extends React.Component {
|
||||||
getInitialCellForEvent(me) {
|
getInitialCellForEvent(me) {
|
||||||
let cell = super.getInitialCellForEvent(me);
|
let cell = super.getInitialCellForEvent(me);
|
||||||
if (this.graph.isPart(cell)) {
|
if (this.graph.isPart(cell)) {
|
||||||
cell = this.graph.getModel().getParent(cell);
|
cell = this.cell.getParent();
|
||||||
}
|
}
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ class Constituent extends React.Component {
|
||||||
selectCellForEvent(cell, evt) {
|
selectCellForEvent(cell, evt) {
|
||||||
// Redirects selection to parent
|
// Redirects selection to parent
|
||||||
if (this.isPart(cell)) {
|
if (this.isPart(cell)) {
|
||||||
cell = this.model.getParent(cell);
|
cell = cell.getParent();
|
||||||
}
|
}
|
||||||
super.selectCellForEvent(cell, evt);
|
super.selectCellForEvent(cell, evt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,19 +59,19 @@ class Groups extends React.Component {
|
||||||
mxGraphHandler.prototype.getInitialCellForEvent;
|
mxGraphHandler.prototype.getInitialCellForEvent;
|
||||||
mxGraphHandler.prototype.getInitialCellForEvent = function(me) {
|
mxGraphHandler.prototype.getInitialCellForEvent = function(me) {
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const psel = model.getParent(this.graph.getSelectionCell());
|
const psel = this.graph.getSelectionCell().getParent();
|
||||||
let cell = graphHandlerGetInitialCellForEvent.apply(this, arguments);
|
let cell = graphHandlerGetInitialCellForEvent.apply(this, arguments);
|
||||||
let parent = model.getParent(cell);
|
let parent = cell.getParent();
|
||||||
|
|
||||||
if (psel == null || (psel != cell && psel != parent)) {
|
if (psel == null || (psel != cell && psel != parent)) {
|
||||||
while (
|
while (
|
||||||
!this.graph.isCellSelected(cell) &&
|
!this.graph.isCellSelected(cell) &&
|
||||||
!this.graph.isCellSelected(parent) &&
|
!this.graph.isCellSelected(parent) &&
|
||||||
model.isVertex(parent) &&
|
parent.isVertex() &&
|
||||||
!this.graph.isValidRoot(parent)
|
!this.graph.isValidRoot(parent)
|
||||||
) {
|
) {
|
||||||
cell = parent;
|
cell = parent;
|
||||||
parent = this.graph.getModel().getParent(cell);
|
parent = this.cell.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +84,13 @@ class Groups extends React.Component {
|
||||||
mxGraphHandler.prototype.isDelayedSelection = function(cell) {
|
mxGraphHandler.prototype.isDelayedSelection = function(cell) {
|
||||||
let result = graphHandlerIsDelayedSelection.apply(this, arguments);
|
let result = graphHandlerIsDelayedSelection.apply(this, arguments);
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
const psel = model.getParent(this.graph.getSelectionCell());
|
const psel = this.graph.getSelectionCell().getParent();
|
||||||
const parent = model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
|
|
||||||
if (psel == null || (psel != cell && psel != parent)) {
|
if (psel == null || (psel != cell && psel != parent)) {
|
||||||
if (
|
if (
|
||||||
!this.graph.isCellSelected(cell) &&
|
!this.graph.isCellSelected(cell) &&
|
||||||
model.isVertex(parent) &&
|
parent.isVertex() &&
|
||||||
!this.graph.isValidRoot(parent)
|
!this.graph.isValidRoot(parent)
|
||||||
) {
|
) {
|
||||||
result = true;
|
result = true;
|
||||||
|
@ -109,15 +109,15 @@ class Groups extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
let parent = model.getParent(cell);
|
let parent = cell.getParent();
|
||||||
|
|
||||||
while (
|
while (
|
||||||
this.graph.isCellSelected(cell) &&
|
this.graph.isCellSelected(cell) &&
|
||||||
model.isVertex(parent) &&
|
parent.isVertex() &&
|
||||||
!this.graph.isValidRoot(parent)
|
!this.graph.isValidRoot(parent)
|
||||||
) {
|
) {
|
||||||
cell = parent;
|
cell = parent;
|
||||||
parent = model.getParent(cell);
|
parent = cell.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.graph.selectCellForEvent(cell, me.getEvent());
|
this.graph.selectCellForEvent(cell, me.getEvent());
|
||||||
|
@ -127,16 +127,14 @@ class Groups extends React.Component {
|
||||||
mxPopupMenuHandler.prototype.getCellForPopupEvent = function(me) {
|
mxPopupMenuHandler.prototype.getCellForPopupEvent = function(me) {
|
||||||
let cell = me.getCell();
|
let cell = me.getCell();
|
||||||
const model = this.graph.getModel();
|
const model = this.graph.getModel();
|
||||||
let parent = model.getParent(cell);
|
let parent = cell.getParent();
|
||||||
|
|
||||||
while (model.isVertex(parent) && !this.graph.isValidRoot(parent)) {
|
while (parent.isVertex() && !this.graph.isValidRoot(parent)) {
|
||||||
if (this.graph.isCellSelected(parent)) {
|
if (this.graph.isCellSelected(parent)) {
|
||||||
cell = parent;
|
cell = parent;
|
||||||
}
|
}
|
||||||
|
parent = parent.getParent();
|
||||||
parent = model.getParent(parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -119,13 +119,13 @@ class Layers extends React.Component {
|
||||||
|
|
||||||
this.el2.appendChild(
|
this.el2.appendChild(
|
||||||
mxUtils.button('Layer 0', function() {
|
mxUtils.button('Layer 0', function() {
|
||||||
model.setVisible(layer0, !model.isVisible(layer0));
|
model.setVisible(layer0, !layer0.isVisible());
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.el2.appendChild(
|
this.el2.appendChild(
|
||||||
mxUtils.button('Layer 1', function() {
|
mxUtils.button('Layer 1', function() {
|
||||||
model.setVisible(layer1, !model.isVisible(layer1));
|
model.setVisible(layer1, !layer1.isVisible());
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ class OrgChart extends React.Component {
|
||||||
graph.cellRenderer.getLabelValue = function(state) {
|
graph.cellRenderer.getLabelValue = function(state) {
|
||||||
let result = state.cell.value;
|
let result = state.cell.value;
|
||||||
|
|
||||||
if (state.view.graph.getModel().isVertex(state.cell)) {
|
if (state.cell.isVertex()) {
|
||||||
if (state.view.scale > 1) {
|
if (state.view.scale > 1) {
|
||||||
result += '\nDetails 1';
|
result += '\nDetails 1';
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ class OrgChart extends React.Component {
|
||||||
const model = graph.getModel();
|
const model = graph.getModel();
|
||||||
|
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
if (model.isVertex(cell)) {
|
if (cell.isVertex()) {
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
'Add child',
|
'Add child',
|
||||||
'editors/images/overlays/check.png',
|
'editors/images/overlays/check.png',
|
||||||
|
@ -292,7 +292,7 @@ class OrgChart extends React.Component {
|
||||||
graph.startEditingAtCell(cell);
|
graph.startEditingAtCell(cell);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cell.id != 'treeRoot' && model.isVertex(cell)) {
|
if (cell.id != 'treeRoot' && cell.isVertex()) {
|
||||||
menu.addItem('Delete', 'editors/images/delete.gif', function() {
|
menu.addItem('Delete', 'editors/images/delete.gif', function() {
|
||||||
deleteSubtree(graph, cell);
|
deleteSubtree(graph, cell);
|
||||||
});
|
});
|
||||||
|
@ -371,7 +371,7 @@ class OrgChart extends React.Component {
|
||||||
model.beginUpdate();
|
model.beginUpdate();
|
||||||
try {
|
try {
|
||||||
vertex = graph.insertVertex(parent, null, 'Double click to set name');
|
vertex = graph.insertVertex(parent, null, 'Double click to set name');
|
||||||
const geometry = model.getGeometry(vertex);
|
const geometry = vertex.getGeometry();
|
||||||
|
|
||||||
// Updates the geometry of the vertex with the
|
// Updates the geometry of the vertex with the
|
||||||
// preferred size computed in the graph
|
// preferred size computed in the graph
|
||||||
|
|
|
@ -149,7 +149,7 @@ class SwimLanes extends React.Component {
|
||||||
|
|
||||||
graph.isValidSource = function(cell) {
|
graph.isValidSource = function(cell) {
|
||||||
if (previousIsValidSource.apply(this, arguments)) {
|
if (previousIsValidSource.apply(this, arguments)) {
|
||||||
const style = this.getModel().getStyle(cell);
|
const style = cell.getStyle();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
style == null || !(style == 'end' || style.indexOf('end') == 0)
|
style == null || !(style == 'end' || style.indexOf('end') == 0)
|
||||||
|
@ -166,10 +166,10 @@ class SwimLanes extends React.Component {
|
||||||
// the example below, so we use the state
|
// the example below, so we use the state
|
||||||
// style below
|
// style below
|
||||||
graph.isValidTarget = function(cell) {
|
graph.isValidTarget = function(cell) {
|
||||||
const style = this.getModel().getStyle(cell);
|
const style = cell.getStyle();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
!this.getModel().isEdge(cell) &&
|
!cell.isEdge() &&
|
||||||
!this.isSwimlane(cell) &&
|
!this.isSwimlane(cell) &&
|
||||||
(style == null || !(style == 'state' || style.indexOf('state') == 0))
|
(style == null || !(style == 'state' || style.indexOf('state') == 0))
|
||||||
);
|
);
|
||||||
|
@ -194,7 +194,7 @@ class SwimLanes extends React.Component {
|
||||||
|
|
||||||
// Checks if any lanes or pools are selected
|
// Checks if any lanes or pools are selected
|
||||||
for (let i = 0; i < cells.length; i++) {
|
for (let i = 0; i < cells.length; i++) {
|
||||||
const tmp = model.getParent(cells[i]);
|
const tmp = cells[i].getParent();
|
||||||
lane = lane || this.isPool(tmp);
|
lane = lane || this.isPool(tmp);
|
||||||
pool = pool || this.isPool(cells[i]);
|
pool = pool || this.isPool(cells[i]);
|
||||||
|
|
||||||
|
@ -205,33 +205,16 @@ class SwimLanes extends React.Component {
|
||||||
!pool &&
|
!pool &&
|
||||||
cell != lane &&
|
cell != lane &&
|
||||||
((lane && this.isPool(target)) ||
|
((lane && this.isPool(target)) ||
|
||||||
(cell && this.isPool(model.getParent(target))))
|
(cell && this.isPool(target.getParent())))
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Adds new method for identifying a pool
|
// Adds new method for identifying a pool
|
||||||
graph.isPool = function(cell) {
|
graph.isPool = function(cell) {
|
||||||
const model = this.getModel();
|
const model = this.getModel();
|
||||||
const parent = model.getParent(cell);
|
const parent = cell.getParent();
|
||||||
|
|
||||||
return parent != null && model.getParent(parent) == model.getRoot();
|
return parent != null && parent.getParent() == model.getRoot();
|
||||||
};
|
|
||||||
|
|
||||||
// Changes swimlane orientation while collapsed
|
|
||||||
graph.model.getStyle = function(cell) {
|
|
||||||
let style = mxGraphModel.prototype.getStyle.apply(this, arguments);
|
|
||||||
|
|
||||||
if (graph.isCellCollapsed(cell)) {
|
|
||||||
if (style != null) {
|
|
||||||
style += ';';
|
|
||||||
} else {
|
|
||||||
style = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
style += 'horizontal=1;align=left;spacingLeft=14;';
|
|
||||||
}
|
|
||||||
|
|
||||||
return style;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Keeps widths on collapse/expand
|
// Keeps widths on collapse/expand
|
||||||
|
@ -239,7 +222,7 @@ class SwimLanes extends React.Component {
|
||||||
const cells = evt.getProperty('cells');
|
const cells = evt.getProperty('cells');
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++) {
|
for (let i = 0; i < cells.length; i++) {
|
||||||
const geo = graph.model.getGeometry(cells[i]);
|
const geo = cells[i].getGeometry();
|
||||||
|
|
||||||
if (geo.alternateBounds != null) {
|
if (geo.alternateBounds != null) {
|
||||||
geo.width = geo.alternateBounds.width;
|
geo.width = geo.alternateBounds.width;
|
||||||
|
@ -250,6 +233,20 @@ class SwimLanes extends React.Component {
|
||||||
graph.addListener(mxEvent.FOLD_CELLS, foldingHandler);
|
graph.addListener(mxEvent.FOLD_CELLS, foldingHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Changes swimlane orientation while collapsed
|
||||||
|
const getStyle = function() {
|
||||||
|
let style = super.getStyle();
|
||||||
|
if (this.isCellCollapsed()) {
|
||||||
|
if (style != null) {
|
||||||
|
style += ';';
|
||||||
|
} else {
|
||||||
|
style = '';
|
||||||
|
}
|
||||||
|
style += 'horizontal=1;align=left;spacingLeft=14;';
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
};
|
||||||
|
|
||||||
// Applies size changes to siblings and parents
|
// Applies size changes to siblings and parents
|
||||||
new mxSwimlaneManager(graph);
|
new mxSwimlaneManager(graph);
|
||||||
|
|
||||||
|
@ -272,9 +269,9 @@ class SwimLanes extends React.Component {
|
||||||
|
|
||||||
layoutMgr.getLayout = function(cell) {
|
layoutMgr.getLayout = function(cell) {
|
||||||
if (
|
if (
|
||||||
!model.isEdge(cell) &&
|
!cell.isEdge() &&
|
||||||
graph.getModel().getChildCount(cell) > 0 &&
|
cell.getChildCount() > 0 &&
|
||||||
(model.getParent(cell) == model.getRoot() || graph.isPool(cell))
|
(cell.getParent() == model.getRoot() || graph.isPool(cell))
|
||||||
) {
|
) {
|
||||||
layout.fill = graph.isPool(cell);
|
layout.fill = graph.isPool(cell);
|
||||||
|
|
||||||
|
@ -288,229 +285,251 @@ class SwimLanes extends React.Component {
|
||||||
// is normally the first child of the root (ie. layer 0).
|
// is normally the first child of the root (ie. layer 0).
|
||||||
const parent = graph.getDefaultParent();
|
const parent = graph.getDefaultParent();
|
||||||
|
|
||||||
|
const insertVertex = options => {
|
||||||
|
const v = graph.insertVertex(options);
|
||||||
|
v.getStyle = getStyle;
|
||||||
|
return v;
|
||||||
|
};
|
||||||
|
|
||||||
|
const insertEdge = options => {
|
||||||
|
const e = graph.insertEdge(options);
|
||||||
|
e.getStyle = getStyle;
|
||||||
|
return e;
|
||||||
|
};
|
||||||
|
|
||||||
// Adds cells to the model in a single step
|
// Adds cells to the model in a single step
|
||||||
model.beginUpdate();
|
model.batchUpdate(() => {
|
||||||
try {
|
const pool1 = insertVertex({
|
||||||
const pool1 = graph.insertVertex(parent, null, 'Pool 1', 0, 0, 640, 0);
|
parent,
|
||||||
|
value: 'Pool 1',
|
||||||
|
position: [0, 0],
|
||||||
|
size: [640, 0],
|
||||||
|
});
|
||||||
pool1.setConnectable(false);
|
pool1.setConnectable(false);
|
||||||
|
|
||||||
const lane1a = graph.insertVertex(pool1, null, 'Lane A', 0, 0, 640, 110);
|
const lane1a = insertVertex({
|
||||||
|
parent: pool1,
|
||||||
|
value: 'Lane A',
|
||||||
|
position: [0, 0],
|
||||||
|
size: [640, 110],
|
||||||
|
});
|
||||||
lane1a.setConnectable(false);
|
lane1a.setConnectable(false);
|
||||||
|
|
||||||
const lane1b = graph.insertVertex(pool1, null, 'Lane B', 0, 0, 640, 110);
|
const lane1b = insertVertex({
|
||||||
|
parent: pool1,
|
||||||
|
value: 'Lane B',
|
||||||
|
position: [0, 0],
|
||||||
|
size: [640, 110],
|
||||||
|
});
|
||||||
lane1b.setConnectable(false);
|
lane1b.setConnectable(false);
|
||||||
|
|
||||||
const pool2 = graph.insertVertex(parent, null, 'Pool 2', 0, 0, 640, 0);
|
const pool2 = insertVertex({
|
||||||
|
parent,
|
||||||
|
value: 'Pool 2',
|
||||||
|
position: [0, 0],
|
||||||
|
size: [640, 0],
|
||||||
|
});
|
||||||
pool2.setConnectable(false);
|
pool2.setConnectable(false);
|
||||||
|
|
||||||
const lane2a = graph.insertVertex(pool2, null, 'Lane A', 0, 0, 640, 140);
|
const lane2a = insertVertex({
|
||||||
|
parent: pool2,
|
||||||
|
value: 'Lane A',
|
||||||
|
position: [0, 0],
|
||||||
|
size: [640, 140],
|
||||||
|
});
|
||||||
lane2a.setConnectable(false);
|
lane2a.setConnectable(false);
|
||||||
|
|
||||||
const lane2b = graph.insertVertex(pool2, null, 'Lane B', 0, 0, 640, 110);
|
const lane2b = insertVertex({
|
||||||
|
parent: pool2,
|
||||||
|
value: 'Lane B',
|
||||||
|
position: [0, 0],
|
||||||
|
size: [640, 110],
|
||||||
|
});
|
||||||
lane2b.setConnectable(false);
|
lane2b.setConnectable(false);
|
||||||
|
|
||||||
const start1 = graph.insertVertex(
|
const start1 = insertVertex({
|
||||||
lane1a,
|
parent: lane1a,
|
||||||
null,
|
position: [40, 40],
|
||||||
null,
|
size: [30, 30],
|
||||||
40,
|
style: 'state',
|
||||||
40,
|
});
|
||||||
30,
|
const end1 = insertVertex({
|
||||||
30,
|
parent: lane1a,
|
||||||
'state'
|
value: 'A',
|
||||||
);
|
position: [560, 40],
|
||||||
const end1 = graph.insertVertex(
|
size: [30, 30],
|
||||||
lane1a,
|
style: 'end',
|
||||||
null,
|
});
|
||||||
'A',
|
|
||||||
560,
|
|
||||||
40,
|
|
||||||
30,
|
|
||||||
30,
|
|
||||||
'end'
|
|
||||||
);
|
|
||||||
|
|
||||||
const step1 = graph.insertVertex(
|
const step1 = insertVertex({
|
||||||
lane1a,
|
parent: lane1a,
|
||||||
null,
|
value: 'Contact\nProvider',
|
||||||
'Contact\nProvider',
|
position: [90, 30],
|
||||||
90,
|
size: [80, 50],
|
||||||
30,
|
style: 'process',
|
||||||
80,
|
});
|
||||||
50,
|
const step11 = insertVertex({
|
||||||
'process'
|
parent: lane1a,
|
||||||
);
|
value: 'Complete\nAppropriate\nRequest',
|
||||||
const step11 = graph.insertVertex(
|
position: [190, 30],
|
||||||
lane1a,
|
size: [80, 50],
|
||||||
null,
|
style: 'process',
|
||||||
'Complete\nAppropriate\nRequest',
|
});
|
||||||
190,
|
const step111 = insertVertex({
|
||||||
30,
|
parent: lane1a,
|
||||||
80,
|
value: 'Receive and\nAcknowledge',
|
||||||
50,
|
position: [385, 30],
|
||||||
'process'
|
size: [80, 50],
|
||||||
);
|
style: 'process',
|
||||||
const step111 = graph.insertVertex(
|
});
|
||||||
lane1a,
|
|
||||||
null,
|
|
||||||
'Receive and\nAcknowledge',
|
|
||||||
385,
|
|
||||||
30,
|
|
||||||
80,
|
|
||||||
50,
|
|
||||||
'process'
|
|
||||||
);
|
|
||||||
|
|
||||||
const start2 = graph.insertVertex(
|
const start2 = insertVertex({
|
||||||
lane2b,
|
parent: lane2b,
|
||||||
null,
|
position: [40, 40],
|
||||||
null,
|
size: [30, 30],
|
||||||
40,
|
style: 'state',
|
||||||
40,
|
});
|
||||||
30,
|
|
||||||
30,
|
|
||||||
'state'
|
|
||||||
);
|
|
||||||
|
|
||||||
const step2 = graph.insertVertex(
|
const step2 = insertVertex({
|
||||||
lane2b,
|
parent: lane2b,
|
||||||
null,
|
value: 'Receive\nRequest',
|
||||||
'Receive\nRequest',
|
position: [90, 30],
|
||||||
90,
|
size: [80, 50],
|
||||||
30,
|
style: 'process',
|
||||||
80,
|
});
|
||||||
50,
|
const step22 = insertVertex({
|
||||||
'process'
|
parent: lane2b,
|
||||||
);
|
value: 'Refer to Tap\nSystems\nCoordinator',
|
||||||
const step22 = graph.insertVertex(
|
position: [190, 30],
|
||||||
lane2b,
|
size: [80, 50],
|
||||||
null,
|
style: 'process',
|
||||||
'Refer to Tap\nSystems\nCoordinator',
|
});
|
||||||
190,
|
|
||||||
30,
|
|
||||||
80,
|
|
||||||
50,
|
|
||||||
'process'
|
|
||||||
);
|
|
||||||
|
|
||||||
const step3 = graph.insertVertex(
|
const step3 = insertVertex({
|
||||||
lane1b,
|
parent: lane1b,
|
||||||
null,
|
value: 'Request 1st-\nGate\nInformation',
|
||||||
'Request 1st-\nGate\nInformation',
|
position: [190, 30],
|
||||||
190,
|
size: [80, 50],
|
||||||
30,
|
style: 'process',
|
||||||
80,
|
});
|
||||||
50,
|
const step33 = insertVertex({
|
||||||
'process'
|
parent: lane1b,
|
||||||
);
|
value: 'Receive 1st-\nGate\nInformation',
|
||||||
const step33 = graph.insertVertex(
|
position: [290, 30],
|
||||||
lane1b,
|
size: [80, 50],
|
||||||
null,
|
style: 'process',
|
||||||
'Receive 1st-\nGate\nInformation',
|
});
|
||||||
290,
|
|
||||||
30,
|
|
||||||
80,
|
|
||||||
50,
|
|
||||||
'process'
|
|
||||||
);
|
|
||||||
|
|
||||||
const step4 = graph.insertVertex(
|
const step4 = insertVertex({
|
||||||
lane2a,
|
parent: lane2a,
|
||||||
null,
|
value: 'Receive and\nAcknowledge',
|
||||||
'Receive and\nAcknowledge',
|
position: [290, 20],
|
||||||
290,
|
size: [80, 50],
|
||||||
20,
|
style: 'process',
|
||||||
80,
|
});
|
||||||
50,
|
const step44 = insertVertex({
|
||||||
'process'
|
parent: lane2a,
|
||||||
);
|
value: 'Contract\nConstraints?',
|
||||||
const step44 = graph.insertVertex(
|
position: [400, 20],
|
||||||
lane2a,
|
size: [50, 50],
|
||||||
null,
|
style: 'condition',
|
||||||
'Contract\nConstraints?',
|
});
|
||||||
400,
|
const step444 = insertVertex({
|
||||||
20,
|
parent: lane2a,
|
||||||
50,
|
value: 'Tap for gas\ndelivery?',
|
||||||
50,
|
position: [480, 20],
|
||||||
'condition'
|
size: [50, 50],
|
||||||
);
|
style: 'condition',
|
||||||
const step444 = graph.insertVertex(
|
});
|
||||||
lane2a,
|
|
||||||
null,
|
|
||||||
'Tap for gas\ndelivery?',
|
|
||||||
480,
|
|
||||||
20,
|
|
||||||
50,
|
|
||||||
50,
|
|
||||||
'condition'
|
|
||||||
);
|
|
||||||
|
|
||||||
const end2 = graph.insertVertex(
|
const end2 = insertVertex({
|
||||||
lane2a,
|
parent: lane2a,
|
||||||
null,
|
value: 'B',
|
||||||
'B',
|
position: [560, 30],
|
||||||
560,
|
size: [30, 30],
|
||||||
30,
|
style: 'end',
|
||||||
30,
|
});
|
||||||
30,
|
const end3 = insertVertex({
|
||||||
'end'
|
parent: lane2a,
|
||||||
);
|
value: 'C',
|
||||||
const end3 = graph.insertVertex(
|
position: [560, 84],
|
||||||
lane2a,
|
size: [30, 30],
|
||||||
null,
|
style: 'end',
|
||||||
'C',
|
});
|
||||||
560,
|
|
||||||
84,
|
|
||||||
30,
|
|
||||||
30,
|
|
||||||
'end'
|
|
||||||
);
|
|
||||||
|
|
||||||
let e = null;
|
let e = null;
|
||||||
|
|
||||||
graph.insertEdge(lane1a, null, null, start1, step1);
|
insertEdge({
|
||||||
graph.insertEdge(lane1a, null, null, step1, step11);
|
parent: lane1a,
|
||||||
graph.insertEdge(lane1a, null, null, step11, step111);
|
source: start1,
|
||||||
|
target: step1,
|
||||||
|
});
|
||||||
|
insertEdge({
|
||||||
|
parent: lane1a,
|
||||||
|
source: step1,
|
||||||
|
target: step11,
|
||||||
|
});
|
||||||
|
insertEdge({
|
||||||
|
parent: lane1a,
|
||||||
|
source: step11,
|
||||||
|
target: step111,
|
||||||
|
});
|
||||||
|
|
||||||
graph.insertEdge(lane2b, null, null, start2, step2);
|
insertEdge({
|
||||||
graph.insertEdge(lane2b, null, null, step2, step22);
|
parent: lane2b,
|
||||||
graph.insertEdge(parent, null, null, step22, step3);
|
source: start2,
|
||||||
|
target: step2,
|
||||||
graph.insertEdge(lane1b, null, null, step3, step33);
|
});
|
||||||
graph.insertEdge(lane2a, null, null, step4, step44);
|
insertEdge({
|
||||||
graph.insertEdge(
|
parent: lane2b,
|
||||||
lane2a,
|
source: step2,
|
||||||
null,
|
target: step22,
|
||||||
'No',
|
});
|
||||||
step44,
|
insertEdge({
|
||||||
step444,
|
|
||||||
'verticalAlign=bottom'
|
|
||||||
);
|
|
||||||
graph.insertEdge(
|
|
||||||
parent,
|
parent,
|
||||||
null,
|
source: step22,
|
||||||
'Yes',
|
target: step3,
|
||||||
step44,
|
});
|
||||||
step111,
|
|
||||||
'verticalAlign=bottom;horizontal=0;labelBackgroundColor=white;'
|
|
||||||
);
|
|
||||||
|
|
||||||
graph.insertEdge(
|
insertEdge({
|
||||||
lane2a,
|
parent: lane1b,
|
||||||
null,
|
source: step3,
|
||||||
'Yes',
|
target: step33,
|
||||||
step444,
|
});
|
||||||
end2,
|
insertEdge({
|
||||||
'verticalAlign=bottom'
|
parent: lane2a,
|
||||||
);
|
source: step4,
|
||||||
e = graph.insertEdge(
|
target: step44,
|
||||||
lane2a,
|
});
|
||||||
null,
|
insertEdge({
|
||||||
'No',
|
parent: lane2a,
|
||||||
step444,
|
value: 'No',
|
||||||
end3,
|
source: step44,
|
||||||
'verticalAlign=top'
|
target: step444,
|
||||||
);
|
style: 'verticalAlign=bottom',
|
||||||
|
});
|
||||||
|
insertEdge({
|
||||||
|
parent,
|
||||||
|
value: 'Yes',
|
||||||
|
source: step44,
|
||||||
|
target: step111,
|
||||||
|
style: 'verticalAlign=bottom;horizontal=0;labelBackgroundColor=white;',
|
||||||
|
});
|
||||||
|
|
||||||
|
insertEdge({
|
||||||
|
parent: lane2a,
|
||||||
|
value: 'Yes',
|
||||||
|
source: step444,
|
||||||
|
target: end2,
|
||||||
|
style: 'verticalAlign=bottom',
|
||||||
|
});
|
||||||
|
e = insertEdge({
|
||||||
|
parent: lane2a,
|
||||||
|
value: 'No',
|
||||||
|
source: step444,
|
||||||
|
target: end3,
|
||||||
|
style: 'verticalAlign=top',
|
||||||
|
});
|
||||||
e.geometry.points = [
|
e.geometry.points = [
|
||||||
new mxPoint(
|
new mxPoint(
|
||||||
step444.geometry.x + step444.geometry.width / 2,
|
step444.geometry.x + step444.geometry.width / 2,
|
||||||
|
@ -518,21 +537,41 @@ class SwimLanes extends React.Component {
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
graph.insertEdge(parent, null, null, step1, step2, 'crossover');
|
insertEdge({
|
||||||
graph.insertEdge(parent, null, null, step3, step11, 'crossover');
|
parent,
|
||||||
e = graph.insertEdge(lane1a, null, null, step11, step33, 'crossover');
|
source: step1,
|
||||||
|
target: step2,
|
||||||
|
style: 'crossover',
|
||||||
|
});
|
||||||
|
insertEdge({
|
||||||
|
parent,
|
||||||
|
source: step3,
|
||||||
|
target: step11,
|
||||||
|
style: 'crossover',
|
||||||
|
});
|
||||||
|
e = insertEdge({
|
||||||
|
parent: lane1a,
|
||||||
|
source: step11,
|
||||||
|
target: step33,
|
||||||
|
style: 'crossover',
|
||||||
|
});
|
||||||
e.geometry.points = [
|
e.geometry.points = [
|
||||||
new mxPoint(
|
new mxPoint(
|
||||||
step33.geometry.x + step33.geometry.width / 2 + 20,
|
step33.geometry.x + step33.geometry.width / 2 + 20,
|
||||||
step11.geometry.y + (step11.geometry.height * 4) / 5
|
step11.geometry.y + (step11.geometry.height * 4) / 5
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
graph.insertEdge(parent, null, null, step33, step4);
|
insertEdge({
|
||||||
graph.insertEdge(lane1a, null, null, step111, end1);
|
parent,
|
||||||
} finally {
|
source: step33,
|
||||||
// Updates the display
|
target: step4,
|
||||||
model.endUpdate();
|
});
|
||||||
}
|
insertEdge({
|
||||||
|
parent: lane1a,
|
||||||
|
source: step111,
|
||||||
|
target: end1,
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class DynamicLoading extends React.Component {
|
||||||
// by requesting the respective data in the server-side
|
// by requesting the respective data in the server-side
|
||||||
// (implemented for this demo using the server-function)
|
// (implemented for this demo using the server-function)
|
||||||
function load(graph, cell) {
|
function load(graph, cell) {
|
||||||
if (graph.getModel().isVertex(cell)) {
|
if (cell.isVertex()) {
|
||||||
const cx = graph.container.clientWidth / 2;
|
const cx = graph.container.clientWidth / 2;
|
||||||
const cy = graph.container.clientHeight / 2;
|
const cy = graph.container.clientHeight / 2;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ class DynamicLoading extends React.Component {
|
||||||
for (var key in graph.getModel().cells) {
|
for (var key in graph.getModel().cells) {
|
||||||
const tmp = graph.getModel().getCell(key);
|
const tmp = graph.getModel().getCell(key);
|
||||||
|
|
||||||
if (tmp != cell && graph.getModel().isVertex(tmp)) {
|
if (tmp != cell && tmp.isVertex()) {
|
||||||
graph.removeCells([tmp]);
|
graph.removeCells([tmp]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ class DynamicLoading extends React.Component {
|
||||||
graph.getModel().mergeChildren(model.getRoot().getChildAt(0), parent);
|
graph.getModel().mergeChildren(model.getRoot().getChildAt(0), parent);
|
||||||
|
|
||||||
// Moves the given cell to the center
|
// Moves the given cell to the center
|
||||||
let geo = graph.getModel().getGeometry(cell);
|
let geo = cell.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
@ -143,13 +143,13 @@ class DynamicLoading extends React.Component {
|
||||||
for (var key in graph.getModel().cells) {
|
for (var key in graph.getModel().cells) {
|
||||||
const tmp = graph.getModel().getCell(key);
|
const tmp = graph.getModel().getCell(key);
|
||||||
|
|
||||||
if (tmp != cell && model.isVertex(tmp)) {
|
if (tmp != cell && tmp.isVertex()) {
|
||||||
vertices.push(tmp);
|
vertices.push(tmp);
|
||||||
|
|
||||||
// Changes the initial location "in-place"
|
// Changes the initial location "in-place"
|
||||||
// to get a nice animation effect from the
|
// to get a nice animation effect from the
|
||||||
// center to the radius of the circle
|
// center to the radius of the circle
|
||||||
const geo = model.getGeometry(tmp);
|
const geo = tmp.getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo.x = cx - geo.width / 2;
|
geo.x = cx - geo.width / 2;
|
||||||
|
@ -167,7 +167,7 @@ class DynamicLoading extends React.Component {
|
||||||
);
|
);
|
||||||
|
|
||||||
for (let i = 0; i < cellCount; i++) {
|
for (let i = 0; i < cellCount; i++) {
|
||||||
let geo = graph.getModel().getGeometry(vertices[i]);
|
let geo = vertices[i].getGeometry();
|
||||||
|
|
||||||
if (geo != null) {
|
if (geo != null) {
|
||||||
geo = geo.clone();
|
geo = geo.clone();
|
||||||
|
|
|
@ -199,9 +199,9 @@ class Permissions extends React.Component {
|
||||||
graph.isCellEditable = function(cell) {
|
graph.isCellEditable = function(cell) {
|
||||||
return (
|
return (
|
||||||
(oldEditable.apply(this, arguments) &&
|
(oldEditable.apply(this, arguments) &&
|
||||||
this.getModel().isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
currentPermission.editVertices) ||
|
currentPermission.editVertices) ||
|
||||||
(this.getModel().isEdge(cell) && currentPermission.editEdges)
|
(cell.isEdge() && currentPermission.editEdges)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,9 +209,9 @@ class Permissions extends React.Component {
|
||||||
graph.isCellDeletable = function(cell) {
|
graph.isCellDeletable = function(cell) {
|
||||||
return (
|
return (
|
||||||
(oldDeletable.apply(this, arguments) &&
|
(oldDeletable.apply(this, arguments) &&
|
||||||
this.getModel().isVertex(cell) &&
|
cell.isVertex() &&
|
||||||
currentPermission.editVertices) ||
|
currentPermission.editVertices) ||
|
||||||
(this.getModel().isEdge(cell) && currentPermission.editEdges)
|
(cell.isEdge() && currentPermission.editEdges)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,16 +57,14 @@ class Visibility extends React.Component {
|
||||||
let showThree = true;
|
let showThree = true;
|
||||||
|
|
||||||
// Overridden to implement dynamic conditions
|
// Overridden to implement dynamic conditions
|
||||||
graph.isCellVisible = function(cell) {
|
const isVisible = function() {
|
||||||
let result = mxGraph.prototype.isCellVisible.apply(this, arguments);
|
let result = super.isVisible();
|
||||||
|
if (result && this.value != null) {
|
||||||
if (result && cell.value != null) {
|
|
||||||
result =
|
result =
|
||||||
(showOne && cell.value == '1') ||
|
(showOne && this.value == '1') ||
|
||||||
(showTwo && cell.value == '2') ||
|
(showTwo && this.value == '2') ||
|
||||||
(showThree && cell.value == '3');
|
(showThree && this.value == '3');
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,18 +77,23 @@ class Visibility extends React.Component {
|
||||||
position: [20, 20],
|
position: [20, 20],
|
||||||
size: [80, 30],
|
size: [80, 30],
|
||||||
});
|
});
|
||||||
|
v1.isVisible = isVisible;
|
||||||
|
|
||||||
const v2 = graph.insertVertex({
|
const v2 = graph.insertVertex({
|
||||||
parent,
|
parent,
|
||||||
value: '2',
|
value: '2',
|
||||||
position: [200, 150],
|
position: [200, 150],
|
||||||
size: [80, 30],
|
size: [80, 30],
|
||||||
});
|
});
|
||||||
|
v2.isVisible = isVisible;
|
||||||
|
|
||||||
const e1 = graph.insertEdge({
|
const e1 = graph.insertEdge({
|
||||||
parent,
|
parent,
|
||||||
value: '3',
|
value: '3',
|
||||||
source: v1,
|
source: v1,
|
||||||
target: v2,
|
target: v2,
|
||||||
});
|
});
|
||||||
|
e1.isVisible = isVisible;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dynamic conditions (requires refresh)
|
// Dynamic conditions (requires refresh)
|
||||||
|
@ -116,7 +119,7 @@ class Visibility extends React.Component {
|
||||||
// Explicit show/hide
|
// Explicit show/hide
|
||||||
this.el2.appendChild(
|
this.el2.appendChild(
|
||||||
mxUtils.button('Toggle cell', function() {
|
mxUtils.button('Toggle cell', function() {
|
||||||
graph.toggleCells(!graph.getModel().isVisible(v1), [v1], true);
|
graph.toggleCells(!v1.isVisible(), [v1], true);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,7 @@ class Stencils extends React.Component {
|
||||||
if (cell != null) {
|
if (cell != null) {
|
||||||
const style = mxUtils.prompt(
|
const style = mxUtils.prompt(
|
||||||
'Style',
|
'Style',
|
||||||
graph.getModel().getStyle(cell)
|
cell.getStyle()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (style != null) {
|
if (style != null) {
|
||||||
|
|
|
@ -50,17 +50,15 @@ class DynamicStyle extends React.Component {
|
||||||
// not explicitely changed using mxStyleChange
|
// not explicitely changed using mxStyleChange
|
||||||
graph.getView().updateStyle = true;
|
graph.getView().updateStyle = true;
|
||||||
|
|
||||||
// Overrides mxGraphModel.getStyle to return a specific style
|
// Overrides mxCell.getStyle to return a specific style
|
||||||
// for edges that reflects their target terminal (in this case
|
// for edges that reflects their target terminal (in this case
|
||||||
// the strokeColor will be equal to the target's fillColor).
|
// the strokeColor will be equal to the target's fillColor).
|
||||||
const previous = graph.model.getStyle;
|
|
||||||
|
|
||||||
graph.model.getStyle = function(cell) {
|
const getStyle = function() {
|
||||||
if (cell != null) {
|
let style = super.getStyle();
|
||||||
let style = previous.apply(this, arguments);
|
|
||||||
|
|
||||||
if (this.isEdge(cell)) {
|
if (this.isEdge()) {
|
||||||
const target = this.getTerminal(cell, false);
|
const target = this.getTerminal(false);
|
||||||
|
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
const targetStyle = graph.getCurrentCellStyle(target);
|
const targetStyle = graph.getCurrentCellStyle(target);
|
||||||
|
@ -73,18 +71,13 @@ class DynamicStyle extends React.Component {
|
||||||
style += `;strokeColor=${fill}`;
|
style += `;strokeColor=${fill}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.isVertex(cell)) {
|
} else if (this.isVertex()) {
|
||||||
const geometry = this.getGeometry(cell);
|
const geometry = this.getGeometry();
|
||||||
|
|
||||||
if (geometry != null && geometry.width > 80) {
|
if (geometry != null && geometry.width > 80) {
|
||||||
style += ';fillColor=green';
|
style += ';fillColor=green';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return style;
|
return style;
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Gets the default parent for inserting new cells. This
|
// Gets the default parent for inserting new cells. This
|
||||||
|
@ -100,6 +93,8 @@ class DynamicStyle extends React.Component {
|
||||||
size: [80, 30],
|
size: [80, 30],
|
||||||
style: 'fillColor=green',
|
style: 'fillColor=green',
|
||||||
});
|
});
|
||||||
|
v1.getStyle = getStyle;
|
||||||
|
|
||||||
const v2 = graph.insertVertex({
|
const v2 = graph.insertVertex({
|
||||||
parent,
|
parent,
|
||||||
value: 'World!',
|
value: 'World!',
|
||||||
|
@ -107,6 +102,8 @@ class DynamicStyle extends React.Component {
|
||||||
size: [80, 30],
|
size: [80, 30],
|
||||||
style: 'fillColor=blue',
|
style: 'fillColor=blue',
|
||||||
});
|
});
|
||||||
|
v2.getStyle = getStyle;
|
||||||
|
|
||||||
const v3 = graph.insertVertex({
|
const v3 = graph.insertVertex({
|
||||||
parent,
|
parent,
|
||||||
value: 'World!',
|
value: 'World!',
|
||||||
|
@ -114,6 +111,8 @@ class DynamicStyle extends React.Component {
|
||||||
size: [80, 30],
|
size: [80, 30],
|
||||||
style: 'fillColor=red',
|
style: 'fillColor=red',
|
||||||
});
|
});
|
||||||
|
v3.getStyle = getStyle;
|
||||||
|
|
||||||
const e1 = graph.insertEdge({
|
const e1 = graph.insertEdge({
|
||||||
parent,
|
parent,
|
||||||
value: 'Connect',
|
value: 'Connect',
|
||||||
|
@ -121,6 +120,7 @@ class DynamicStyle extends React.Component {
|
||||||
target: v2,
|
target: v2,
|
||||||
style: 'perimeterSpacing=4;strokeWidth=4;labelBackgroundColor=white;fontStyle=1',
|
style: 'perimeterSpacing=4;strokeWidth=4;labelBackgroundColor=white;fontStyle=1',
|
||||||
});
|
});
|
||||||
|
e1.getStyle = getStyle;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ class HoverStyle extends React.Component {
|
||||||
// Ignores everything but vertices
|
// Ignores everything but vertices
|
||||||
if (
|
if (
|
||||||
graph.isMouseDown ||
|
graph.isMouseDown ||
|
||||||
(tmp != null && !graph.getModel().isVertex(tmp.cell))
|
(tmp != null && !tmp.cell.isVertex())
|
||||||
) {
|
) {
|
||||||
tmp = null;
|
tmp = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Stylesheet extends React.Component {
|
||||||
graph.getLabel = function(cell) {
|
graph.getLabel = function(cell) {
|
||||||
const label = mxGraph.prototype.getLabel.apply(this, arguments);
|
const label = mxGraph.prototype.getLabel.apply(this, arguments);
|
||||||
|
|
||||||
if (this.getModel().isEdge(cell)) {
|
if (cell.isEdge()) {
|
||||||
return `Transfer ${label}`;
|
return `Transfer ${label}`;
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
|
@ -61,9 +61,9 @@ class Stylesheet extends React.Component {
|
||||||
const { cell } = state;
|
const { cell } = state;
|
||||||
const model = this.getModel();
|
const model = this.getModel();
|
||||||
|
|
||||||
if (model.isEdge(cell)) {
|
if (modcellel.isEdge()) {
|
||||||
const source = this.getLabel(model.getTerminal(cell, true));
|
const source = this.getLabel(cell.getTerminal(true));
|
||||||
const target = this.getLabel(model.getTerminal(cell, false));
|
const target = this.getLabel(cell.getTerminal(false));
|
||||||
|
|
||||||
return `${source} -> ${target}`;
|
return `${source} -> ${target}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ class UserObject extends React.Component {
|
||||||
|
|
||||||
// Overrides method to disallow edge label editing
|
// Overrides method to disallow edge label editing
|
||||||
graph.isCellEditable = function(cell) {
|
graph.isCellEditable = function(cell) {
|
||||||
return !this.getModel().isEdge(cell);
|
return !cell.isEdge();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Overrides method to provide a cell label in the display
|
// Overrides method to provide a cell label in the display
|
||||||
|
@ -174,9 +174,9 @@ class UserObject extends React.Component {
|
||||||
const { getTooltipForCell } = graph;
|
const { getTooltipForCell } = graph;
|
||||||
graph.getTooltipForCell = function(cell) {
|
graph.getTooltipForCell = function(cell) {
|
||||||
// Adds some relation details for edges
|
// Adds some relation details for edges
|
||||||
if (graph.getModel().isEdge(cell)) {
|
if (cell.isEdge()) {
|
||||||
const src = this.getLabel(this.getModel().getTerminal(cell, true));
|
const src = this.getLabel(cell.getTerminal(true));
|
||||||
const trg = this.getLabel(this.getModel().getTerminal(cell, false));
|
const trg = this.getLabel(cell.getTerminal(false));
|
||||||
|
|
||||||
return `${src} ${cell.value.nodeName} ${trg}`;
|
return `${src} ${cell.value.nodeName} ${trg}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class LOD extends React.Component {
|
||||||
graph.centerZoom = false;
|
graph.centerZoom = false;
|
||||||
|
|
||||||
// Links level of detail to zoom level but can be independent of zoom
|
// Links level of detail to zoom level but can be independent of zoom
|
||||||
graph.isCellVisible = function(cell) {
|
const isVisible = function(cell) {
|
||||||
return cell.lod == null || cell.lod / 2 < this.view.scale;
|
return cell.lod == null || cell.lod / 2 < this.view.scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,26 +54,35 @@ class LOD extends React.Component {
|
||||||
const parent = graph.getDefaultParent();
|
const parent = graph.getDefaultParent();
|
||||||
|
|
||||||
// Adds cells to the model in a single step
|
// Adds cells to the model in a single step
|
||||||
graph.getModel().beginUpdate();
|
graph.batchUpdate(() => {
|
||||||
try {
|
|
||||||
const v1 = graph.insertVertex(parent, null, '1', 20, 20, 80, 30);
|
const v1 = graph.insertVertex(parent, null, '1', 20, 20, 80, 30);
|
||||||
v1.lod = 1;
|
v1.lod = 1;
|
||||||
|
v1.isVisible = isVisible;
|
||||||
|
|
||||||
const v2 = graph.insertVertex(parent, null, '1', 200, 150, 80, 30);
|
const v2 = graph.insertVertex(parent, null, '1', 200, 150, 80, 30);
|
||||||
v2.lod = 1;
|
v2.lod = 1;
|
||||||
|
v2.isVisible = isVisible;
|
||||||
|
|
||||||
const v3 = graph.insertVertex(parent, null, '2', 20, 150, 40, 20);
|
const v3 = graph.insertVertex(parent, null, '2', 20, 150, 40, 20);
|
||||||
v3.lod = 2;
|
v3.lod = 2;
|
||||||
|
v3.isVisible = isVisible;
|
||||||
|
|
||||||
const v4 = graph.insertVertex(parent, null, '3', 200, 10, 20, 20);
|
const v4 = graph.insertVertex(parent, null, '3', 200, 10, 20, 20);
|
||||||
v4.lod = 3;
|
v4.lod = 3;
|
||||||
|
v4.isVisible = isVisible;
|
||||||
|
|
||||||
const e1 = graph.insertEdge(parent, null, '2', v1, v2, 'strokeWidth=2');
|
const e1 = graph.insertEdge(parent, null, '2', v1, v2, 'strokeWidth=2');
|
||||||
e1.lod = 2;
|
e1.lod = 2;
|
||||||
var e2 = graph.insertEdge(parent, null, '2', v3, v4, 'strokeWidth=2');
|
e1.isVisible = isVisible;
|
||||||
|
|
||||||
|
const e2 = graph.insertEdge(parent, null, '2', v3, v4, 'strokeWidth=2');
|
||||||
e2.lod = 2;
|
e2.lod = 2;
|
||||||
var e2 = graph.insertEdge(parent, null, '3', v1, v4, 'strokeWidth=1');
|
e2.isVisible = isVisible;
|
||||||
e2.lod = 3;
|
|
||||||
} finally {
|
const e3 = graph.insertEdge(parent, null, '3', v1, v4, 'strokeWidth=1');
|
||||||
// Updates the display
|
e3.lod = 3;
|
||||||
graph.getModel().endUpdate();
|
e3.isVisible = isVisible;
|
||||||
}
|
});
|
||||||
|
|
||||||
this.el2.appendChild(
|
this.el2.appendChild(
|
||||||
mxUtils.button('+', function() {
|
mxUtils.button('+', function() {
|
||||||
|
|
Loading…
Reference in New Issue