style updates

development
mcyph 2021-03-21 23:32:41 +11:00
parent 85c51d327e
commit 1763fa449f
72 changed files with 442 additions and 409 deletions

View File

@ -308,7 +308,7 @@ class mxDefaultPopupMenu {
// Evaluates dynamic conditions from config file
const condNodes = this.config.getElementsByTagName('condition');
for (let i = 0; i < condNodes.length; i++) {
for (let i = 0; i < condNodes.length; i += 1) {
const funct = mxUtils.eval(mxUtils.getTextContent(condNodes[i]));
const name = condNodes[i].getAttribute('name');

View File

@ -20,16 +20,27 @@ import mxForm from '../util/mxForm';
import mxOutline from '../view/mxOutline';
import mxCell from '../model/mxCell';
import mxGeometry from '../model/mxGeometry';
import mxConstants from '../util/mxConstants';
import mxGraph from '../view/mxGraph';
import mxSwimlaneManager from '../view/mxSwimlaneManager';
import mxLayoutManager from '../view/mxLayoutManager';
import mxRubberband from '../handler/mxRubberband';
import mxEvent from '../util/mxEvent';
import mxRootChange from '../model/atomic_changes/mxRootChange';
import mxValueChange from '../model/atomic_changes/mxValueChange';
import mxCellAttributeChange from '../model/atomic_changes/mxCellAttributeChange';
/**
* Installs the required language resources at class
* loading time.
*/
/*
if (mxLoadResources) {
mxResources.add(`${mxClient.basePath}/resources/editor`);
} else {
mxClient.defaultBundles.push(`${mxClient.basePath}/resources/editor`);
}
*/
class mxEditor extends mxEventSource {
/**
@ -1712,7 +1723,7 @@ class mxEditor extends mxEventSource {
// Checks if the root has been changed
const { changes } = evt.getProperty('edit');
for (let i = 0; i < changes.length; i++) {
for (let i = 0; i < changes.length; i += 1) {
const change = changes[i];
if (
@ -2319,14 +2330,14 @@ class mxEditor extends mxEventSource {
const attrs = value.attributes;
const texts = [];
for (let i = 0; i < attrs.length; i++) {
for (let i = 0; i < attrs.length; i += 1) {
// Creates a textarea with more lines for
// the cell label
const val = attrs[i].value;
texts[i] = form.addTextarea(
attrs[i].nodeName,
val,
attrs[i].nodeName == 'label' ? 4 : 2
attrs[i].nodeName === 'label' ? 4 : 2
);
}
@ -2366,7 +2377,7 @@ class mxEditor extends mxEventSource {
// attribute and executes it using the
// model, which will also make the change
// part of the current transaction
for (let i = 0; i < attrs.length; i++) {
for (let i = 0; i < attrs.length; i += 1) {
const edit = new mxCellAttributeChange(
cell,
attrs[i].nodeName,

View File

@ -886,7 +886,7 @@ class mxConnectionHandler extends mxEventSource {
*/
destroyIcons = () => {
if (this.icons != null) {
for (let i = 0; i < this.icons.length; i++) {
for (let i = 0; i < this.icons.length; i += 1) {
this.icons[i].destroy();
}
@ -1469,7 +1469,7 @@ class mxConnectionHandler extends mxEventSource {
let hitsIcon = false;
const target = me.getSource();
for (let i = 0; i < this.icons.length && !hitsIcon; i++) {
for (let i = 0; i < this.icons.length && !hitsIcon; i += 1) {
hitsIcon =
target === this.icons[i].node ||
target.parentNode === this.icons[i].node;
@ -1543,7 +1543,7 @@ class mxConnectionHandler extends mxEventSource {
if (this.waypoints != null) {
realPoints = [];
for (let i = 0; i < this.waypoints.length; i++) {
for (let i = 0; i < this.waypoints.length; i += 1) {
const pt = this.waypoints[i].clone();
this.convertWaypoint(pt);
realPoints[i] = pt;
@ -2050,7 +2050,7 @@ class mxConnectionHandler extends mxEventSource {
const tr = this.graph.view.translate;
geo.points = [];
for (let i = 0; i < this.waypoints.length; i++) {
for (let i = 0; i < this.waypoints.length; i += 1) {
const pt = this.waypoints[i];
geo.points.push(new mxPoint(pt.x / s - tr.x, pt.y / s - tr.y));
}

View File

@ -108,7 +108,7 @@ class mxConstraintHandler {
*/
reset = () => {
if (this.focusIcons != null) {
for (let i = 0; i < this.focusIcons.length; i++) {
for (let i = 0; i < this.focusIcons.length; i += 1) {
this.focusIcons[i].destroy();
}
@ -176,7 +176,7 @@ class mxConstraintHandler {
*/
destroyIcons = () => {
if (this.focusIcons != null) {
for (let i = 0; i < this.focusIcons.length; i++) {
for (let i = 0; i < this.focusIcons.length; i += 1) {
this.focusIcons[i].destroy();
}
@ -299,7 +299,7 @@ class mxConstraintHandler {
const cx = mouse.getCenterX();
const cy = mouse.getCenterY();
for (let i = 0; i < this.focusIcons.length; i++) {
for (let i = 0; i < this.focusIcons.length; i += 1) {
const dx = cx - this.focusIcons[i].bounds.getCenterX();
const dy = cy - this.focusIcons[i].bounds.getCenterY();
const tmp = dx * dx + dy * dy;
@ -377,7 +377,7 @@ class mxConstraintHandler {
state.height
);
for (let i = 0; i < this.constraints.length; i++) {
for (let i = 0; i < this.constraints.length; i += 1) {
const cp = this.graph.getConnectionPoint(state, this.constraints[i]);
const img = this.getImageForConstraint(state, this.constraints[i], cp);
@ -423,7 +423,7 @@ class mxConstraintHandler {
);
if (this.focusIcons != null) {
for (let i = 0; i < this.focusIcons.length; i++) {
for (let i = 0; i < this.focusIcons.length; i += 1) {
this.focusIcons[i].destroy();
}
@ -434,7 +434,7 @@ class mxConstraintHandler {
this.focusPoints = [];
this.focusIcons = [];
for (let i = 0; i < this.constraints.length; i++) {
for (let i = 0; i < this.constraints.length; i += 1) {
const cp = this.graph.getConnectionPoint(state, this.constraints[i]);
const img = this.getImageForConstraint(state, this.constraints[i], cp);

View File

@ -655,7 +655,7 @@ class mxEdgeHandler {
const { cell } = this.state;
const bends = [];
for (let i = 0; i < this.abspoints.length; i++) {
for (let i = 0; i < this.abspoints.length; i += 1) {
if (this.isHandleVisible(i)) {
const source = i === 0;
const target = i === this.abspoints.length - 1;
@ -704,7 +704,7 @@ class mxEdgeHandler {
const bends = [];
if (this.graph.isCellBendable(cell)) {
for (let i = 1; i < this.abspoints.length; i++) {
for (let i = 1; i < this.abspoints.length; i += 1) {
mxUtils.bind(this, bend => {
this.initBend(bend);
bend.setCursor(mxConstants.CURSOR_VIRTUAL_BEND_HANDLE);
@ -1026,7 +1026,7 @@ class mxEdgeHandler {
this.index > mxEvent.VIRTUAL_HANDLE
) {
if (this.customHandles != null) {
for (let i = 0; i < this.customHandles.length; i++) {
for (let i = 0; i < this.customHandles.length; i += 1) {
if (i !== mxEvent.CUSTOM_HANDLE - this.index) {
this.customHandles[i].setVisible(false);
}
@ -1139,7 +1139,7 @@ class mxEdgeHandler {
snapToTerminal.call(this, this.state.getVisibleTerminalState(false));
if (this.state.absolutePoints != null) {
for (let i = 0; i < this.state.absolutePoints.length; i++) {
for (let i = 0; i < this.state.absolutePoints.length; i += 1) {
snapToPoint.call(this, this.state.absolutePoints[i]);
}
}
@ -1275,7 +1275,7 @@ class mxEdgeHandler {
// Removes point if dragged on terminal point
if (!this.isSource && !this.isTarget) {
for (let i = 0; i < this.bends.length; i++) {
for (let i = 0; i < this.bends.length; i += 1) {
if (i !== this.index) {
const bend = this.bends[i];
@ -1673,7 +1673,7 @@ class mxEdgeHandler {
// Ignores event if mouse has not been moved
if (me.getX() !== this.startX || me.getY() !== this.startY) {
const clone =
let clone =
!this.graph.isIgnoreTerminalEvent(me.getEvent()) &&
this.graph.isCloneEvent(me.getEvent()) &&
this.cloneEnabled &&
@ -1736,7 +1736,7 @@ class mxEdgeHandler {
// Clones and adds the cell
if (clone) {
let geo = model.getGeometry(edge);
const clone = this.graph.cloneCell(edge);
clone = this.graph.cloneCell(edge);
model.add(parent, clone, model.getChildCount(parent));
if (geo != null) {
@ -1842,7 +1842,7 @@ class mxEdgeHandler {
}
if (this.customHandles != null) {
for (let i = 0; i < this.customHandles.length; i++) {
for (let i = 0; i < this.customHandles.length; i += 1) {
this.customHandles[i].reset();
}
}
@ -2184,7 +2184,7 @@ class mxEdgeHandler {
this.points = [];
}
for (let i = 1; i < this.bends.length - 1; i++) {
for (let i = 1; i < this.bends.length - 1; i += 1) {
if (this.bends[i] != null && this.abspoints[i] != null) {
this.points[i - 1] = pts[i - 1];
}
@ -2305,7 +2305,7 @@ class mxEdgeHandler {
}
if (this.customHandles != null) {
for (let i = 0; i < this.customHandles.length; i++) {
for (let i = 0; i < this.customHandles.length; i += 1) {
const temp = this.customHandles[i].shape.node.style.display;
this.customHandles[i].redraw();
this.customHandles[i].shape.node.style.display = temp;

View File

@ -64,7 +64,7 @@ class mxEdgeSegmentHandler extends mxElbowEdgeHandler {
point = this.convertPoint(point.clone(), false);
let result = [];
for (let i = 1; i < pts.length; i++) {
for (let i = 1; i < pts.length; i += 1) {
const pt = this.convertPoint(pts[i].clone(), false);
if (i === this.index) {
@ -124,7 +124,7 @@ class mxEdgeSegmentHandler extends mxElbowEdgeHandler {
let result = [];
for (let i = 2; i < pts.length; i++) {
for (let i = 2; i < pts.length; i += 1) {
const pt2 = pts[i];
// Merges adjacent segments only if more than 2 to allow for straight edges
@ -220,7 +220,7 @@ class mxEdgeSegmentHandler extends mxElbowEdgeHandler {
let pt1 = pts[1];
result = [];
for (let i = 2; i < pts.length; i++) {
for (let i = 2; i < pts.length; i += 1) {
const pt2 = pts[i];
// Merges adjacent segments only if more than 2 to allow for straight edges
@ -307,7 +307,7 @@ class mxEdgeSegmentHandler extends mxElbowEdgeHandler {
this.points = [];
}
for (let i = 0; i < pts.length - 1; i++) {
for (let i = 0; i < pts.length - 1; i += 1) {
bend = this.createVirtualBend();
bends.push(bend);
let horizontal = Math.round(pts[i].x - pts[i + 1].x) === 0;
@ -372,7 +372,7 @@ class mxEdgeSegmentHandler extends mxElbowEdgeHandler {
}
}
for (let i = 0; i < pts.length - 1; i++) {
for (let i = 0; i < pts.length - 1; i += 1) {
if (this.bends[i + 1] != null) {
const p0 = pts[i];
const pe = pts[i + 1];

View File

@ -730,7 +730,7 @@ class mxGraphHandler {
if (cells != null && cells.length > 0) {
const model = this.graph.getModel();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (model.isVertex(cells[i]) || model.isEdge(cells[i])) {
const state = this.graph.view.getState(cells[i]);
@ -804,7 +804,7 @@ class mxGraphHandler {
this.cloning = false;
this.cellCount = 0;
for (let i = 0; i < this.cells.length; i++) {
for (let i = 0; i < this.cells.length; i += 1) {
this.cellCount += this.addStates(this.cells[i], this.allCells);
}
@ -820,7 +820,7 @@ class mxGraphHandler {
this.cell
);
for (let i = 0; i < opps.length; i++) {
for (let i = 0; i < opps.length; i += 1) {
const state = this.graph.view.getState(opps[i]);
if (state != null && !connected.get(state)) {
@ -860,7 +860,7 @@ class mxGraphHandler {
const childCount = this.graph.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
count += this.addStates(this.graph.model.getChildAt(cell, i), dict);
}
}
@ -1279,7 +1279,7 @@ class mxGraphHandler {
// Redraws connected edges
const s = this.graph.view.scale;
for (let i = 0; i < states.length; i++) {
for (let i = 0; i < states.length; i += 1) {
const state = states[i][0];
if (this.graph.model.isEdge(state.cell)) {
@ -1360,7 +1360,7 @@ class mxGraphHandler {
* Redraws the preview shape for the given states array.
*/
redrawHandles = states => {
for (let i = 0; i < states.length; i++) {
for (let i = 0; i < states.length; i += 1) {
const handler = this.graph.selectionCellsHandler.getHandler(
states[i][0].cell
);
@ -1377,7 +1377,7 @@ class mxGraphHandler {
* Resets the given preview states array.
*/
resetPreviewStates = states => {
for (let i = 0; i < states.length; i++) {
for (let i = 0; i < states.length; i += 1) {
states[i][0].setState(states[i][1]);
}
};
@ -1490,7 +1490,7 @@ class mxGraphHandler {
if (force || this.handlesVisible != visible) {
this.handlesVisible = visible;
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const handler = this.graph.selectionCellsHandler.getHandler(cells[i]);
if (handler != null) {
@ -1704,12 +1704,12 @@ class mxGraphHandler {
// Collects all non-selected parents
const dict = new mxDictionary();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
dict.put(cells[i], true);
}
// LATER: Recurse up the cell hierarchy
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const par = this.graph.model.getParent(cells[i]);
if (par != null && !dict.get(par)) {
@ -1726,7 +1726,7 @@ class mxGraphHandler {
// Removes parent if all child cells are removed
const temp = [];
for (let i = 0; i < parents.length; i++) {
for (let i = 0; i < parents.length; i += 1) {
if (this.shouldRemoveParent(parents[i])) {
temp.push(parents[i]);
}

View File

@ -163,7 +163,7 @@ class mxSelectionCellsHandler extends mxEventSource {
const tmp = mxUtils.sortCells(this.getHandledSelectionCells(), false);
// Destroys or updates old handlers
for (let i = 0; i < tmp.length; i++) {
for (let i = 0; i < tmp.length; i += 1) {
const state = this.graph.view.getState(tmp[i]);
if (state != null) {
@ -199,7 +199,7 @@ class mxSelectionCellsHandler extends mxEventSource {
);
// Creates new handlers and updates parent highlight on existing handlers
for (let i = 0; i < tmp.length; i++) {
for (let i = 0; i < tmp.length; i += 1) {
const state = this.graph.view.getState(tmp[i]);
if (state != null) {

View File

@ -603,7 +603,7 @@ class mxVertexHandler {
}
if (this.sizers != null) {
for (let i = 0; i < this.sizers.length; i++) {
for (let i = 0; i < this.sizers.length; i += 1) {
if (checkShape(this.sizers[i])) {
return i;
}
@ -753,7 +753,7 @@ class mxVertexHandler {
const edges = this.graph.getEdges(this.state.cell);
this.edgeHandlers = [];
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const handler = this.graph.selectionCellsHandler.getHandler(
edges[i]
);
@ -791,13 +791,13 @@ class mxVertexHandler {
this.handlesVisible = visible;
if (this.sizers != null) {
for (let i = 0; i < this.sizers.length; i++) {
for (let i = 0; i < this.sizers.length; i += 1) {
this.sizers[i].node.style.display = visible ? '' : 'none';
}
}
if (this.customHandles != null) {
for (let i = 0; i < this.customHandles.length; i++) {
for (let i = 0; i < this.customHandles.length; i += 1) {
this.customHandles[i].setVisible(visible);
}
}
@ -1432,7 +1432,7 @@ class mxVertexHandler {
// Recursive rotation
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.rotateCell(model.getChildAt(cell, i), angle, cell);
}
}
@ -1472,7 +1472,7 @@ class mxVertexHandler {
}
if (this.livePreviewActive && this.sizers != null) {
for (let i = 0; i < this.sizers.length; i++) {
for (let i = 0; i < this.sizers.length; i += 1) {
if (this.sizers[i] != null) {
this.sizers[i].node.style.display = '';
}
@ -1485,7 +1485,7 @@ class mxVertexHandler {
}
if (this.customHandles != null) {
for (let i = 0; i < this.customHandles.length; i++) {
for (let i = 0; i < this.customHandles.length; i += 1) {
if (this.customHandles[i].active) {
this.customHandles[i].active = false;
this.customHandles[i].reset();
@ -1581,7 +1581,7 @@ class mxVertexHandler {
const model = this.graph.getModel();
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(cell, i);
let geo = this.graph.getCellGeometry(child);
@ -1871,7 +1871,7 @@ class mxVertexHandler {
this.verticalOffset = 0;
if (this.customHandles != null) {
for (let i = 0; i < this.customHandles.length; i++) {
for (let i = 0; i < this.customHandles.length; i += 1) {
const temp = this.customHandles[i].shape.node.style.display;
this.customHandles[i].redraw();
this.customHandles[i].shape.node.style.display = temp;
@ -2058,7 +2058,7 @@ class mxVertexHandler {
}
if (this.edgeHandlers != null) {
for (let i = 0; i < this.edgeHandlers.length; i++) {
for (let i = 0; i < this.edgeHandlers.length; i += 1) {
this.edgeHandlers[i].redraw();
}
}
@ -2246,7 +2246,7 @@ class mxVertexHandler {
this.removeHint();
if (this.sizers != null) {
for (let i = 0; i < this.sizers.length; i++) {
for (let i = 0; i < this.sizers.length; i += 1) {
this.sizers[i].destroy();
}
@ -2254,7 +2254,7 @@ class mxVertexHandler {
}
if (this.customHandles != null) {
for (let i = 0; i < this.customHandles.length; i++) {
for (let i = 0; i < this.customHandles.length; i += 1) {
this.customHandles[i].destroy();
}

View File

@ -156,7 +156,7 @@ class mxCellCodec extends mxObjectCodec {
// Preprocesses and removes all Id-references in order to use the
// correct encoder (this) for the known references to cells (all).
if (inner != null) {
for (let i = 0; i < this.idrefs.length; i++) {
for (let i = 0; i < this.idrefs.length; i += 1) {
const attr = this.idrefs[i];
const ref = inner.getAttribute(attr);

View File

@ -441,7 +441,7 @@ class mxCodec {
if (includeChildren == null || includeChildren) {
const childCount = cell.getChildCount();
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.encodeCell(cell.getChildAt(i), node);
}
}

View File

@ -192,7 +192,7 @@ class mxDefaultToolbarCodec extends mxObjectCodec {
if (icon == null) {
const combo = into.addActionCombo(as);
for (let i = 0; i < children.length; i++) {
for (let i = 0; i < children.length; i += 1) {
const child = children[i];
if (child.nodeName === 'separator') {
@ -251,7 +251,7 @@ class mxDefaultToolbarCodec extends mxObjectCodec {
});
// Adds the entries to the combobox
for (let i = 0; i < children.length; i++) {
for (let i = 0; i < children.length; i += 1) {
const child = children[i];
if (child.nodeName === 'separator') {

View File

@ -124,7 +124,7 @@ class mxGraphViewCodec extends mxObjectCodec {
if (abs != null && abs.length > 0) {
let pts = `${Math.round(abs[0].x)},${Math.round(abs[0].y)}`;
for (let i = 1; i < abs.length; i++) {
for (let i = 1; i < abs.length; i += 1) {
pts += ` ${Math.round(abs[i].x)},${Math.round(abs[i].y)}`;
}
@ -153,7 +153,7 @@ class mxGraphViewCodec extends mxObjectCodec {
}
}
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const childNode = this.encodeCell(
enc,
view,

View File

@ -778,7 +778,7 @@ class mxObjectCodec {
const attrs = node.attributes;
if (attrs != null) {
for (let i = 0; i < attrs.length; i++) {
for (let i = 0; i < attrs.length; i += 1) {
this.decodeAttribute(dec, attrs[i], obj);
}
}

View File

@ -60,7 +60,7 @@ class mxGraphHierarchyEdge extends mxGraphAbstractHierarchyCell {
this.edges = edges;
this.ids = [];
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
this.ids.push(mxObjectIdentity.get(edges[i]));
}
}
@ -86,7 +86,7 @@ class mxGraphHierarchyEdge extends mxGraphAbstractHierarchyCell {
if (this.nextLayerConnectedCells == null) {
this.nextLayerConnectedCells = [];
for (let i = 0; i < this.temp.length; i++) {
for (let i = 0; i < this.temp.length; i += 1) {
this.nextLayerConnectedCells[i] = [];
if (i === this.temp.length - 1) {
@ -109,7 +109,7 @@ class mxGraphHierarchyEdge extends mxGraphAbstractHierarchyCell {
if (this.previousLayerConnectedCells == null) {
this.previousLayerConnectedCells = [];
for (let i = 0; i < this.temp.length; i++) {
for (let i = 0; i < this.temp.length; i += 1) {
this.previousLayerConnectedCells[i] = [];
if (i === 0) {

View File

@ -121,7 +121,7 @@ class mxGraphHierarchyModel {
// Go through edges set their sink values. Also check the
// ordering if and invert edges if necessary
for (let i = 0; i < vertices.length; i++) {
for (let i = 0; i < vertices.length; i += 1) {
const edges = internalVertices[i].connectsAsSource;
for (let j = 0; j < edges.length; j++) {
@ -190,7 +190,7 @@ class mxGraphHierarchyModel {
const graph = layout.getGraph();
// Create internal edges
for (let i = 0; i < vertices.length; i++) {
for (let i = 0; i < vertices.length; i += 1) {
internalVertices[i] = new mxGraphHierarchyNode(vertices[i]);
this.vertexMapper.put(vertices[i], internalVertices[i]);
@ -283,7 +283,7 @@ class mxGraphHierarchyModel {
const startNodes = [];
if (this.roots != null) {
for (let i = 0; i < this.roots.length; i++) {
for (let i = 0; i < this.roots.length; i += 1) {
const internalNode = this.vertexMapper.get(this.roots[i]);
if (internalNode != null) {
@ -294,7 +294,7 @@ class mxGraphHierarchyModel {
const internalNodes = this.vertexMapper.getValues();
for (let i = 0; i < internalNodes.length; i++) {
for (let i = 0; i < internalNodes.length; i += 1) {
// Mark the node as not having had a layer assigned
internalNodes[i].temp[0] = -1;
}
@ -318,7 +318,7 @@ class mxGraphHierarchyModel {
// the layer determining edges variable
let minimumLayer = this.SOURCESCANSTARTRANK;
for (let i = 0; i < layerDeterminingEdges.length; i++) {
for (let i = 0; i < layerDeterminingEdges.length; i += 1) {
const internalEdge = layerDeterminingEdges[i];
if (internalEdge.temp[0] == 5270620) {
@ -340,7 +340,7 @@ class mxGraphHierarchyModel {
this.maxRank = Math.min(this.maxRank, minimumLayer);
if (edgesToBeMarked != null) {
for (let i = 0; i < edgesToBeMarked.length; i++) {
for (let i = 0; i < edgesToBeMarked.length; i += 1) {
const internalEdge = edgesToBeMarked[i];
// Assign unique stamp ( y/m/d/h )
@ -382,13 +382,13 @@ class mxGraphHierarchyModel {
// Normalize the ranks down from their large starting value to place
// at least 1 sink on layer 0
for (let i = 0; i < internalNodes.length; i++) {
for (let i = 0; i < internalNodes.length; i += 1) {
// Mark the node as not having had a layer assigned
internalNodes[i].temp[0] -= this.maxRank;
}
// Tighten the rank 0 nodes as far as possible
for (let i = 0; i < startNodesCopy.length; i++) {
for (let i = 0; i < startNodesCopy.length; i += 1) {
const internalNode = startNodesCopy[i];
let currentMaxLayer = 0;
const layerDeterminingEdges = internalNode.connectsAsSource;
@ -416,7 +416,7 @@ class mxGraphHierarchyModel {
const rankList = [];
this.ranks = [];
for (let i = 0; i < this.maxRank + 1; i++) {
for (let i = 0; i < this.maxRank + 1; i += 1) {
rankList[i] = [];
this.ranks[i] = rankList[i];
}
@ -430,7 +430,7 @@ class mxGraphHierarchyModel {
const oldRootsArray = this.roots;
rootsArray = [];
for (let i = 0; i < oldRootsArray.length; i++) {
for (let i = 0; i < oldRootsArray.length; i += 1) {
const cell = oldRootsArray[i];
const internalNode = this.vertexMapper.get(cell);
rootsArray[i] = internalNode;
@ -459,7 +459,7 @@ class mxGraphHierarchyModel {
edge.x = [];
edge.y = [];
for (let i = edge.minRank + 1; i < edge.maxRank; i++) {
for (let i = edge.minRank + 1; i < edge.maxRank; i += 1) {
// The connecting edge must be added to the
// appropriate ranks
rankList[i].push(edge);
@ -488,7 +488,7 @@ class mxGraphHierarchyModel {
visit = (visitor, dfsRoots, trackAncestors, seenNodes) => {
// Run dfs through on all roots
if (dfsRoots != null) {
for (let i = 0; i < dfsRoots.length; i++) {
for (let i = 0; i < dfsRoots.length; i += 1) {
const internalNode = dfsRoots[i];
if (internalNode != null) {
@ -549,7 +549,7 @@ class mxGraphHierarchyModel {
// can change the original for edge direction inversions
const outgoingEdges = root.connectsAsSource.slice();
for (let i = 0; i < outgoingEdges.length; i++) {
for (let i = 0; i < outgoingEdges.length; i += 1) {
const internalEdge = outgoingEdges[i];
const targetNode = internalEdge.target;
@ -637,7 +637,7 @@ class mxGraphHierarchyModel {
// can change the original for edge direction inversions
const outgoingEdges = root.connectsAsSource.slice();
for (let i = 0; i < outgoingEdges.length; i++) {
for (let i = 0; i < outgoingEdges.length; i += 1) {
const internalEdge = outgoingEdges[i];
const targetNode = internalEdge.target;

View File

@ -81,7 +81,7 @@ class mxGraphHierarchyNode extends mxGraphAbstractHierarchyCell {
this.nextLayerConnectedCells = [];
this.nextLayerConnectedCells[0] = [];
for (let i = 0; i < this.connectsAsTarget.length; i++) {
for (let i = 0; i < this.connectsAsTarget.length; i += 1) {
const edge = this.connectsAsTarget[i];
if (edge.maxRank == -1 || edge.maxRank == layer + 1) {
@ -108,7 +108,7 @@ class mxGraphHierarchyNode extends mxGraphAbstractHierarchyCell {
this.previousLayerConnectedCells = [];
this.previousLayerConnectedCells[0] = [];
for (let i = 0; i < this.connectsAsSource.length; i++) {
for (let i = 0; i < this.connectsAsSource.length; i += 1) {
const edge = this.connectsAsSource[i];
if (edge.minRank == -1 || edge.minRank == layer - 1) {
@ -175,7 +175,7 @@ class mxGraphHierarchyNode extends mxGraphAbstractHierarchyCell {
// node's hash code. Arrays.equals cannot be used here since
// the arrays are different length, and we do not want to
// perform another array copy.
for (let i = 0; i < this.hashCode.length; i++) {
for (let i = 0; i < this.hashCode.length; i += 1) {
if (this.hashCode[i] != otherNode.hashCode[i]) {
return false;
}

View File

@ -126,7 +126,7 @@ class mxSwimlaneModel {
// Go through edges set their sink values. Also check the
// ordering if and invert edges if necessary
for (let i = 0; i < vertices.length; i++) {
for (let i = 0; i < vertices.length; i += 1) {
const edges = internalVertices[i].connectsAsSource;
for (let j = 0; j < edges.length; j++) {
@ -196,7 +196,7 @@ class mxSwimlaneModel {
const { swimlanes } = layout;
// Create internal edges
for (let i = 0; i < vertices.length; i++) {
for (let i = 0; i < vertices.length; i += 1) {
internalVertices[i] = new mxGraphHierarchyNode(vertices[i]);
this.vertexMapper.put(vertices[i], internalVertices[i]);
internalVertices[i].swimlaneIndex = -1;
@ -300,7 +300,7 @@ class mxSwimlaneModel {
const seen = {};
if (this.roots != null) {
for (let i = 0; i < this.roots.length; i++) {
for (let i = 0; i < this.roots.length; i += 1) {
const internalNode = this.vertexMapper.get(this.roots[i]);
this.maxChainDfs(null, internalNode, null, seen, 0);
@ -328,7 +328,7 @@ class mxSwimlaneModel {
const internalNodes = this.vertexMapper.getValues();
for (let i = 0; i < internalNodes.length; i++) {
for (let i = 0; i < internalNodes.length; i += 1) {
// Mark the node as not having had a layer assigned
internalNodes[i].temp[0] = -1;
}
@ -352,7 +352,7 @@ class mxSwimlaneModel {
// the layer determining edges variable
let minimumLayer = upperRank[0];
for (let i = 0; i < layerDeterminingEdges.length; i++) {
for (let i = 0; i < layerDeterminingEdges.length; i += 1) {
const internalEdge = layerDeterminingEdges[i];
if (internalEdge.temp[0] == 5270620) {
@ -377,7 +377,7 @@ class mxSwimlaneModel {
internalNode.temp[0] = minimumLayer;
if (edgesToBeMarked != null) {
for (let i = 0; i < edgesToBeMarked.length; i++) {
for (let i = 0; i < edgesToBeMarked.length; i += 1) {
const internalEdge = edgesToBeMarked[i];
// Assign unique stamp ( y/m/d/h )
@ -427,7 +427,7 @@ class mxSwimlaneModel {
// }
// Tighten the rank 0 nodes as far as possible
// for ( let i = 0; i < startNodesCopy.length; i++)
// for ( let i = 0; i < startNodesCopy.length; i += 1)
// {
// let internalNode = startNodesCopy[i];
// let currentMaxLayer = 0;
@ -481,7 +481,7 @@ class mxSwimlaneModel {
// can change the original for edge direction inversions
const outgoingEdges = root.connectsAsSource.slice();
for (let i = 0; i < outgoingEdges.length; i++) {
for (let i = 0; i < outgoingEdges.length; i += 1) {
const internalEdge = outgoingEdges[i];
const targetNode = internalEdge.target;
@ -519,7 +519,7 @@ class mxSwimlaneModel {
const rankList = [];
this.ranks = [];
for (let i = 0; i < this.maxRank + 1; i++) {
for (let i = 0; i < this.maxRank + 1; i += 1) {
rankList[i] = [];
this.ranks[i] = rankList[i];
}
@ -533,7 +533,7 @@ class mxSwimlaneModel {
const oldRootsArray = this.roots;
rootsArray = [];
for (let i = 0; i < oldRootsArray.length; i++) {
for (let i = 0; i < oldRootsArray.length; i += 1) {
const cell = oldRootsArray[i];
const internalNode = this.vertexMapper.get(cell);
rootsArray[i] = internalNode;
@ -562,7 +562,7 @@ class mxSwimlaneModel {
edge.x = [];
edge.y = [];
for (let i = edge.minRank + 1; i < edge.maxRank; i++) {
for (let i = edge.minRank + 1; i < edge.maxRank; i += 1) {
// The connecting edge must be added to the
// appropriate ranks
rankList[i].push(edge);
@ -591,7 +591,7 @@ class mxSwimlaneModel {
visit = (visitor, dfsRoots, trackAncestors, seenNodes) => {
// Run dfs through on all roots
if (dfsRoots != null) {
for (let i = 0; i < dfsRoots.length; i++) {
for (let i = 0; i < dfsRoots.length; i += 1) {
const internalNode = dfsRoots[i];
if (internalNode != null) {
@ -652,7 +652,7 @@ class mxSwimlaneModel {
// can change the original for edge direction inversions
const outgoingEdges = root.connectsAsSource.slice();
for (let i = 0; i < outgoingEdges.length; i++) {
for (let i = 0; i < outgoingEdges.length; i += 1) {
const internalEdge = outgoingEdges[i];
const targetNode = internalEdge.target;
@ -741,7 +741,7 @@ class mxSwimlaneModel {
const outgoingEdges = root.connectsAsSource.slice();
const incomingEdges = root.connectsAsTarget.slice();
for (let i = 0; i < outgoingEdges.length; i++) {
for (let i = 0; i < outgoingEdges.length; i += 1) {
const internalEdge = outgoingEdges[i];
const targetNode = internalEdge.target;
@ -761,7 +761,7 @@ class mxSwimlaneModel {
}
}
for (let i = 0; i < incomingEdges.length; i++) {
for (let i = 0; i < incomingEdges.length; i += 1) {
const internalEdge = incomingEdges[i];
const targetNode = internalEdge.source;

View File

@ -239,7 +239,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
if (roots != null) {
const rootsCopy = [];
for (let i = 0; i < roots.length; i++) {
for (let i = 0; i < roots.length; i += 1) {
const ancestor =
parent != null ? model.isAncestor(parent, roots[i]) : true;
@ -361,7 +361,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
const isCollapsed = this.graph.isCellCollapsed(cell);
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(cell, i);
if (this.isPort(child)) {
@ -374,7 +374,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
edges = edges.concat(model.getEdges(cell, true, true));
const result = [];
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const source = this.getVisibleTerminal(edges[i], true);
const target = this.getVisibleTerminal(edges[i], false);
@ -480,7 +480,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
// the layout. We may need a custom set that holds such groups and forces
// them to be processed for resizing and/or moving.
for (let i = 0; i < candidateRoots.length; i++) {
for (let i = 0; i < candidateRoots.length; i += 1) {
const vertexSet = Object();
hierarchyVertices.push(vertexSet);
@ -495,7 +495,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
);
}
for (let i = 0; i < candidateRoots.length; i++) {
for (let i = 0; i < candidateRoots.length; i += 1) {
this.roots.push(candidateRoots[i]);
}
@ -512,7 +512,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
} else {
// Find vertex set as directed traversal from roots
for (let i = 0; i < this.roots.length; i++) {
for (let i = 0; i < this.roots.length; i += 1) {
const vertexSet = Object();
hierarchyVertices.push(vertexSet);
@ -534,7 +534,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
// Track initial coordinate x-positioning
let initialX = 0;
for (let i = 0; i < hierarchyVertices.length; i++) {
for (let i = 0; i < hierarchyVertices.length; i += 1) {
const vertexSet = hierarchyVertices[i];
const tmp = [];
@ -580,7 +580,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
) {
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(cell, i);
// Ignore ports in the layout vertex list, they are dealt with
@ -628,7 +628,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
// Checks if the edge is connected to the correct
// cell and returns the first match
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const src = this.getVisibleTerminal(edges[i], true);
const trg = this.getVisibleTerminal(edges[i], false);
@ -692,11 +692,11 @@ class mxHierarchicalLayout extends mxGraphLayout {
const edges = this.getEdges(vertex);
const edgeIsSource = [];
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
edgeIsSource[i] = this.getVisibleTerminal(edges[i], true) == vertex;
}
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
if (!directed || edgeIsSource[i]) {
const next = this.getVisibleTerminal(edges[i], !edgeIsSource[i]);
@ -740,7 +740,7 @@ class mxHierarchicalLayout extends mxGraphLayout {
// We've seen this vertex before, but not in the current component
// This component and the one it's in need to be merged
for (let i = 0; i < hierarchyVertices.length; i++) {
for (let i = 0; i < hierarchyVertices.length; i += 1) {
const comp = hierarchyVertices[i];
if (comp[vertexID] != null) {

View File

@ -253,7 +253,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
const dummyVertices = [];
// Check the swimlanes all have vertices
// in them
for (let i = 0; i < swimlanes.length; i++) {
for (let i = 0; i < swimlanes.length; i += 1) {
const children = this.graph.getChildCells(swimlanes[i]);
if (children == null || children.length == 0) {
@ -315,7 +315,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
for (const key in model.edgeMapper) {
const edge = model.edgeMapper[key];
for (let i = 0; i < edge.edges.length; i++) {
for (let i = 0; i < edge.edges.length; i += 1) {
cells.push(edge.edges[i]);
}
}
@ -323,7 +323,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
let layoutBounds = this.graph.getBoundingBoxFromGeometry(cells, true);
const childBounds = [];
for (let i = 0; i < this.swimlanes.length; i++) {
for (let i = 0; i < this.swimlanes.length; i += 1) {
const lane = this.swimlanes[i];
const geo = this.graph.getCellGeometry(lane);
@ -357,7 +357,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
}
}
for (let i = 0; i < this.swimlanes.length; i++) {
for (let i = 0; i < this.swimlanes.length; i += 1) {
const lane = this.swimlanes[i];
const geo = this.graph.getCellGeometry(lane);
@ -481,7 +481,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
const isCollapsed = this.graph.isCellCollapsed(cell);
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(cell, i);
if (this.isPort(child)) {
@ -494,7 +494,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
edges = edges.concat(model.getEdges(cell, true, true));
const result = [];
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const source = this.getVisibleTerminal(edges[i], true);
const target = this.getVisibleTerminal(edges[i], false);
@ -589,7 +589,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
if (this.swimlanes != null && this.swimlanes.length > 0 && parent != null) {
const filledVertexSet = Object();
for (let i = 0; i < this.swimlanes.length; i++) {
for (let i = 0; i < this.swimlanes.length; i += 1) {
this.filterDescendants(this.swimlanes[i], filledVertexSet);
}
@ -621,7 +621,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
// If the candidate root is an unconnected group cell, remove it from
// the layout. We may need a custom set that holds such groups and forces
// them to be processed for resizing and/or moving.
for (let i = 0; i < candidateRoots.length; i++) {
for (let i = 0; i < candidateRoots.length; i += 1) {
const vertexSet = Object();
hierarchyVertices.push(vertexSet);
@ -637,7 +637,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
);
}
for (let i = 0; i < candidateRoots.length; i++) {
for (let i = 0; i < candidateRoots.length; i += 1) {
this.roots.push(candidateRoots[i]);
}
@ -654,7 +654,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
} else {
// Find vertex set as directed traversal from roots
for (let i = 0; i < this.roots.length; i++) {
for (let i = 0; i < this.roots.length; i += 1) {
const vertexSet = Object();
hierarchyVertices.push(vertexSet);
@ -714,7 +714,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
) {
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(cell, i);
// Ignore ports in the layout vertex list, they are dealt with
@ -763,7 +763,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
// Checks if the edge is connected to the correct
// cell and returns the first match
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const src = this.getVisibleTerminal(edges[i], true);
const trg = this.getVisibleTerminal(edges[i], false);
@ -829,7 +829,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
const edges = this.getEdges(vertex);
const { model } = this.graph;
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
let otherVertex = this.getVisibleTerminal(edges[i], true);
const isSource = otherVertex == vertex;
@ -875,7 +875,7 @@ class mxSwimlaneLayout extends mxGraphLayout {
} else if (currentComp[vertexID] == null) {
// We've seen this vertex before, but not in the current component
// This component and the one it's in need to be merged
for (let i = 0; i < hierarchyVertices.length; i++) {
for (let i = 0; i < hierarchyVertices.length; i += 1) {
const comp = hierarchyVertices[i];
if (comp[vertexID] != null) {

View File

@ -265,7 +265,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
let bestXDelta = 100000000.0;
if (this.fineTuning) {
for (let i = 0; i < this.maxIterations; i++) {
for (let i = 0; i < this.maxIterations; i += 1) {
// this.printStatus();
// Median Heuristic
@ -322,7 +322,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
const map = new mxDictionary();
const rank = [];
for (let i = 0; i <= model.maxRank; i++) {
for (let i = 0; i <= model.maxRank; i += 1) {
rank[i] = model.ranks[i];
for (let j = 0; j < rank[i].length; j++) {
@ -441,7 +441,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
if (positionChanged) {
// Add connected nodes to map and list
for (let i = 0; i < nextLayerConnectedCells.length; i++) {
for (let i = 0; i < nextLayerConnectedCells.length; i += 1) {
const connectedCell = nextLayerConnectedCells[i];
const connectedCellWrapper = map.get(connectedCell);
@ -454,7 +454,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
}
// Add connected nodes to map and list
for (let i = 0; i < previousLayerConnectedCells.length; i++) {
for (let i = 0; i < previousLayerConnectedCells.length; i += 1) {
const connectedCell = previousLayerConnectedCells[i];
const connectedCellWrapper = map.get(connectedCell);
@ -518,7 +518,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
const weightedValues = [];
const cellMap = {};
for (let i = 0; i < rank.length; i++) {
for (let i = 0; i < rank.length; i += 1) {
const currentCell = rank[i];
weightedValues[i] = new WeightedCellSorter();
weightedValues[i].cell = currentCell;
@ -549,7 +549,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
// Set the new position of each node within the rank using
// its temp variable
for (let i = 0; i < weightedValues.length; i++) {
for (let i = 0; i < weightedValues.length; i += 1) {
let numConnectionsNextLevel = 0;
const { cell } = weightedValues[i];
let nextLayerConnectedCells = null;
@ -671,7 +671,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
calculatedWeightedValue = (currentCell, collection) => {
let totalWeight = 0;
for (let i = 0; i < collection.length; i++) {
for (let i = 0; i < collection.length; i += 1) {
const cell = collection[i];
if (currentCell.isVertex() && cell.isVertex()) {
@ -704,7 +704,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
const medianValues = [];
for (let i = 0; i < connectedCells.length; i++) {
for (let i = 0; i < connectedCells.length; i += 1) {
medianValues[i] = connectedCells[i].getGeneralPurposeVariable(rankValue);
}
@ -745,7 +745,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
}
}
for (let i = this.widestRank + 1; i <= model.maxRank; i++) {
for (let i = this.widestRank + 1; i <= model.maxRank; i += 1) {
if (i > 0) {
this.rankCoordinates(i, facade, model);
}
@ -776,7 +776,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
// to only issue the warning once for all cells
let boundsWarning = false;
for (let i = 0; i < rank.length; i++) {
for (let i = 0; i < rank.length; i += 1) {
const node = rank[i];
if (node.isVertex()) {
@ -856,7 +856,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
// to only issue the warning once for all cells
let boundsWarning = false;
for (let i = 0; i < rank.length; i++) {
for (let i = 0; i < rank.length; i += 1) {
const node = rank[i];
if (node.isVertex()) {
@ -927,7 +927,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
y -= distanceToNextRank;
}
for (let i = 0; i < rank.length; i++) {
for (let i = 0; i < rank.length; i += 1) {
const cell = rank[i];
cell.setY(rankValue, y);
}
@ -967,7 +967,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
let edgeStraight = true;
let refSegCount = 0;
for (let i = cell.minRank + 2; i < cell.maxRank; i++) {
for (let i = cell.minRank + 2; i < cell.maxRank; i += 1) {
const x = cell.getGeneralPurposeVariable(i);
if (referenceX != x) {
@ -986,7 +986,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
let currentX = cell.getGeneralPurposeVariable(cell.minRank + 1);
for (let i = cell.minRank + 1; i < cell.maxRank - 1; i++) {
for (let i = cell.minRank + 1; i < cell.maxRank - 1; i += 1) {
// Attempt to straight out the control point on the
// next segment up with the current control point.
const nextX = cell.getX(i + 1);
@ -1032,7 +1032,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
}
} else if (upSegCount > downSegCount) {
// Apply up calculation values
for (let i = cell.minRank + 2; i < cell.maxRank; i++) {
for (let i = cell.minRank + 2; i < cell.maxRank; i += 1) {
cell.setX(i, upXPositions[i - cell.minRank - 2]);
}
} else {
@ -1063,7 +1063,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
const rankArray = model.ranks[rank];
let rankIndex = -1;
for (let i = 0; i < rankArray.length; i++) {
for (let i = 0; i < rankArray.length; i += 1) {
if (cell == rankArray[i]) {
rankIndex = i;
break;
@ -1132,7 +1132,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
this.rankTopY = [];
this.rankBottomY = [];
for (let i = 0; i < model.ranks.length; i++) {
for (let i = 0; i < model.ranks.length; i += 1) {
this.rankTopY[i] = Number.MAX_VALUE;
this.rankBottomY[i] = -Number.MAX_VALUE;
}
@ -1143,7 +1143,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
// limits of each rank. Between these limits lie the channels
// where the edges can be routed across the graph
for (let i = 0; i < vertices.length; i++) {
for (let i = 0; i < vertices.length; i += 1) {
this.setVertexLocation(vertices[i]);
}
@ -1159,7 +1159,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
const edges = model.edgeMapper.getValues();
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
this.setEdgePosition(edges[i]);
}
};
@ -1331,7 +1331,7 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage {
this.orientation == mxConstants.DIRECTION_EAST ||
this.orientation == mxConstants.DIRECTION_SOUTH;
for (let i = 0; i < cell.edges.length; i++) {
for (let i = 0; i < cell.edges.length; i += 1) {
const realEdge = cell.edges[i];
const realSource = this.layout.getVisibleTerminal(realEdge, true);

View File

@ -112,7 +112,7 @@ class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage {
// Stores initial ordering as being the best one found so far
this.nestedBestRanks = [];
for (let i = 0; i < model.ranks.length; i++) {
for (let i = 0; i < model.ranks.length; i += 1) {
this.nestedBestRanks[i] = model.ranks[i].slice();
}
@ -168,12 +168,12 @@ class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage {
const ranks = [];
const rankList = [];
for (let i = 0; i < model.maxRank + 1; i++) {
for (let i = 0; i < model.maxRank + 1; i += 1) {
rankList[i] = [];
ranks[i] = rankList[i];
}
for (let i = 0; i < this.nestedBestRanks.length; i++) {
for (let i = 0; i < this.nestedBestRanks.length; i += 1) {
for (let j = 0; j < this.nestedBestRanks[i].length; j++) {
rankList[i].push(this.nestedBestRanks[i][j]);
}
@ -197,7 +197,7 @@ class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage {
const numRanks = model.ranks.length;
let totalCrossings = 0;
for (let i = 1; i < numRanks; i++) {
for (let i = 1; i < numRanks; i += 1) {
totalCrossings += this.calculateRankCrossing(i, model);
}
@ -307,7 +307,7 @@ class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage {
const nudge = mainLoopIteration % 2 == 1 && count % 2 == 1;
improved = false;
for (let i = 0; i < model.ranks.length; i++) {
for (let i = 0; i < model.ranks.length; i += 1) {
const rank = model.ranks[i];
const orderedCells = [];
@ -492,7 +492,7 @@ class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage {
const medianValues = [];
const reservedPositions = [];
for (let i = 0; i < numCellsForRank; i++) {
for (let i = 0; i < numCellsForRank; i += 1) {
const cell = this.nestedBestRanks[rankValue][i];
const sorterEntry = new MedianCellSorter();
sorterEntry.cell = cell;
@ -539,7 +539,7 @@ class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage {
// Set the new position of each node within the rank using
// its temp variable
for (let i = 0; i < numCellsForRank; i++) {
for (let i = 0; i < numCellsForRank; i += 1) {
if (reservedPositions[i] == null) {
const { cell } = medianValues.shift();
cell.setGeneralPurposeVariable(rankValue, i);
@ -564,7 +564,7 @@ class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage {
const medianValues = [];
let arrayCount = 0;
for (let i = 0; i < connectedCells.length; i++) {
for (let i = 0; i < connectedCells.length; i += 1) {
const cell = connectedCells[i];
medianValues[arrayCount++] = cell.getGeneralPurposeVariable(rankValue);
}

View File

@ -42,7 +42,7 @@ class mxMinimumCycleRemover extends mxHierarchicalLayoutStage {
const unseenNodesArray = model.vertexMapper.getValues();
const unseenNodes = {};
for (let i = 0; i < unseenNodesArray.length; i++) {
for (let i = 0; i < unseenNodesArray.length; i += 1) {
unseenNodes[unseenNodesArray[i].id] = unseenNodesArray[i];
}
@ -54,7 +54,7 @@ class mxMinimumCycleRemover extends mxHierarchicalLayoutStage {
const modelRoots = model.roots;
rootsArray = [];
for (let i = 0; i < modelRoots.length; i++) {
for (let i = 0; i < modelRoots.length; i += 1) {
rootsArray[i] = model.vertexMapper.get(modelRoots[i]);
}
}

View File

@ -49,7 +49,7 @@ class mxSwimlaneOrdering extends mxHierarchicalLayoutStage {
const modelRoots = model.roots;
rootsArray = [];
for (let i = 0; i < modelRoots.length; i++) {
for (let i = 0; i < modelRoots.length; i += 1) {
rootsArray[i] = model.vertexMapper.get(modelRoots[i]);
}
}

View File

@ -103,7 +103,7 @@ class mxCircleLayout extends mxGraphLayout {
const vertices = [];
const childCount = model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const cell = model.getChildAt(parent, i);
if (!this.isVertexIgnored(cell)) {
@ -168,7 +168,7 @@ class mxCircleLayout extends mxGraphLayout {
const vertexCount = vertices.length;
const phi = (2 * Math.PI) / vertexCount;
for (let i = 0; i < vertexCount; i++) {
for (let i = 0; i < vertexCount; i += 1) {
if (this.isVertexMovable(vertices[i])) {
this.setVertexLocation(
vertices[i],

View File

@ -285,7 +285,7 @@ class mxCompactTreeLayout extends mxGraphLayout {
const roots = this.graph.findTreeRoots(parent, true, this.invert);
if (roots.length > 0) {
for (let i = 0; i < roots.length; i++) {
for (let i = 0; i < roots.length; i += 1) {
if (
!this.isVertexIgnored(roots[i]) &&
this.graph.getEdges(
@ -534,7 +534,7 @@ class mxCompactTreeLayout extends mxGraphLayout {
this.sortOutgoingEdges(cell, out);
}
for (let i = 0; i < out.length; i++) {
for (let i = 0; i < out.length; i += 1) {
const edge = out[i];
if (!this.isEdgeIgnored(edge)) {
@ -999,7 +999,7 @@ class mxCompactTreeLayout extends mxGraphLayout {
let x = 0;
let y = 0;
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
if (this.horizontal) {
// Use opposite co-ords, calculation was done for
//

View File

@ -79,7 +79,7 @@ class mxCompositeLayout extends mxGraphLayout {
model.beginUpdate();
try {
for (let i = 0; i < this.layouts.length; i++) {
for (let i = 0; i < this.layouts.length; i += 1) {
this.layouts[i].execute.apply(this.layouts[i], [parent]);
}
} finally {

View File

@ -4,7 +4,9 @@
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxPoint from 'FIXME';
import mxPoint from "../util/mxPoint";
import mxGraphLayout from "./mxGraphLayout";
import mxUtils from "../util/mxUtils";
class mxEdgeLabelLayout extends mxGraphLayout {
/**
@ -48,7 +50,7 @@ class mxEdgeLabelLayout extends mxGraphLayout {
const vertices = [];
const childCount = model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const cell = model.getChildAt(parent, i);
const state = view.getState(cell);
@ -77,7 +79,7 @@ class mxEdgeLabelLayout extends mxGraphLayout {
// overlap
model.beginUpdate();
try {
for (let i = 0; i < e.length; i++) {
for (let i = 0; i < e.length; i += 1) {
const edge = e[i];
if (
@ -85,7 +87,7 @@ class mxEdgeLabelLayout extends mxGraphLayout {
edge.text != null &&
edge.text.boundingBox != null
) {
for (let j = 0; j < v.length; j++) {
for (let j = 0; j < v.length; j += 1) {
const vertex = v[j];
if (vertex != null) {

View File

@ -3,7 +3,7 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxObjectIdentity from 'FIXME';
import mxObjectIdentity from "../util/mxObjectIdentity";
import mxGraphLayout from './mxGraphLayout';
class mxFastOrganicLayout extends mxGraphLayout {
@ -217,9 +217,9 @@ class mxFastOrganicLayout extends mxGraphLayout {
execute = parent => {
const model = this.graph.getModel();
this.vertexArray = [];
const cells = this.graph.getChildVertices(parent);
let cells = this.graph.getChildVertices(parent);
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (!this.isVertexIgnored(cells[i])) {
this.vertexArray.push(cells[i]);
}
@ -249,7 +249,7 @@ class mxFastOrganicLayout extends mxGraphLayout {
// arrays called neighbours which holds, for each vertex, a list of
// ints which represents the neighbours cells to that vertex as
// the indices into vertexArray
for (let i = 0; i < this.vertexArray.length; i++) {
for (let i = 0; i < this.vertexArray.length; i += 1) {
const vertex = this.vertexArray[i];
this.cellLocation[i] = [];
@ -277,7 +277,7 @@ class mxFastOrganicLayout extends mxGraphLayout {
// algorithm, resetting the edge points is part of the transaction
model.beginUpdate();
try {
for (let i = 0; i < n; i++) {
for (let i = 0; i < n; i += 1) {
this.dispX[i] = 0;
this.dispY[i] = 0;
this.isMoveable[i] = this.isVertexMovable(this.vertexArray[i]);
@ -286,10 +286,10 @@ class mxFastOrganicLayout extends mxGraphLayout {
// obtained in indices into vertexArray and store as an array
// against the orginial cell index
const edges = this.graph.getConnections(this.vertexArray[i], parent);
const cells = this.graph.getOpposites(edges, this.vertexArray[i]);
cells = this.graph.getOpposites(edges, this.vertexArray[i]);
this.neighbours[i] = [];
for (let j = 0; j < cells.length; j++) {
for (let j = 0; j < cells.length; j += 1) {
// Resets the points on the traversed edge
if (this.resetEdges) {
this.graph.resetEdge(edges[j]);
@ -329,7 +329,7 @@ class mxFastOrganicLayout extends mxGraphLayout {
for (
this.iteration = 0;
this.iteration < this.maxIterations;
this.iteration++
this.iteration += 1
) {
if (!this.allowedToRun) {
return;
@ -348,7 +348,7 @@ class mxFastOrganicLayout extends mxGraphLayout {
let minx = null;
let miny = null;
for (let i = 0; i < this.vertexArray.length; i++) {
for (let i = 0; i < this.vertexArray.length; i += 1) {
const vertex = this.vertexArray[i];
if (this.isVertexMovable(vertex)) {
@ -403,7 +403,7 @@ class mxFastOrganicLayout extends mxGraphLayout {
* temperature.
*/
calcPositions = () => {
for (let index = 0; index < this.vertexArray.length; index++) {
for (let index = 0; index < this.vertexArray.length; index += 1) {
if (this.isMoveable[index]) {
// Get the distance of displacement for this node for this
// iteration
@ -446,8 +446,8 @@ class mxFastOrganicLayout extends mxGraphLayout {
calcAttraction = () => {
// Check the neighbours of each vertex and calculate the attractive
// force of the edge connecting them
for (let i = 0; i < this.vertexArray.length; i++) {
for (let k = 0; k < this.neighbours[i].length; k++) {
for (let i = 0; i < this.vertexArray.length; i += 1) {
for (let k = 0; k < this.neighbours[i].length; k += 1) {
// Get the index of the othe cell in the vertex array
const j = this.neighbours[i][k];
@ -491,22 +491,22 @@ class mxFastOrganicLayout extends mxGraphLayout {
calcRepulsion = () => {
const vertexCount = this.vertexArray.length;
for (let i = 0; i < vertexCount; i++) {
for (let j = i; j < vertexCount; j++) {
for (let i = 0; i < vertexCount; i += 1) {
for (let j = i; j < vertexCount; j += 1) {
// Exits if the layout is no longer allowed to run
if (!this.allowedToRun) {
return;
}
if (j != i && this.isMoveable[i] && this.isMoveable[j]) {
if (j !== i && this.isMoveable[i] && this.isMoveable[j]) {
let xDelta = this.cellLocation[i][0] - this.cellLocation[j][0];
let yDelta = this.cellLocation[i][1] - this.cellLocation[j][1];
if (xDelta == 0) {
if (xDelta === 0) {
xDelta = 0.01 + Math.random();
}
if (yDelta == 0) {
if (yDelta === 0) {
yDelta = 0.01 + Math.random();
}

View File

@ -4,8 +4,11 @@
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxDictionary from 'FIXME';
import mxDictionary from "../util/mxDictionary";
import mxRectangle from '../util/mxRectangle';
import mxGeometry from "../model/mxGeometry";
import mxPoint from "../util/mxPoint";
import mxConstants from "../util/mxConstants";
class mxGraphLayout {
/**
@ -173,7 +176,7 @@ class mxGraphLayout {
const edgeCount = this.graph.model.getEdgeCount(vertex);
if (edgeCount > 0) {
for (let i = 0; i < edgeCount; i++) {
for (let i = 0; i < edgeCount; i += 1) {
const e = this.graph.model.getEdgeAt(vertex, i);
const isSource = this.graph.model.getTerminal(e, true) == vertex;
@ -342,7 +345,7 @@ class mxGraphLayout {
const parentOffset = this.getParentOffset(parent);
for (let i = 0; i < points.length; i++) {
for (let i = 0; i < points.length; i += 1) {
points[i].x = points[i].x - parentOffset.x;
points[i].y = points[i].y - parentOffset.y;
}

View File

@ -4,7 +4,9 @@
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxPoint from 'FIXME';
import mxPoint from "../util/mxPoint";
import mxGraphLayout from "./mxGraphLayout";
import mxObjectIdentity from "../util/mxObjectIdentity";
class mxParallelEdgeLayout extends mxGraphLayout {
/**
@ -114,14 +116,14 @@ class mxParallelEdgeLayout extends mxGraphLayout {
};
if (cells != null) {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
addCell(cells[i]);
}
} else {
const model = this.graph.getModel();
const childCount = model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
addCell(model.getChildAt(parent, i));
}
}
@ -154,7 +156,7 @@ class mxParallelEdgeLayout extends mxGraphLayout {
if (state != null && state.absolutePoints != null) {
const tmp = [];
for (let i = 0; i < state.absolutePoints.length; i++) {
for (let i = 0; i < state.absolutePoints.length; i += 1) {
const pt = state.absolutePoints[i];
if (pt != null) {
@ -184,12 +186,15 @@ class mxParallelEdgeLayout extends mxGraphLayout {
const src = model.getGeometry(view.getVisibleTerminal(edge, true));
const trg = model.getGeometry(view.getVisibleTerminal(edge, false));
// Routes multiple loops
if (src == trg) {
var x0 = src.x + src.width + this.spacing;
var y0 = src.y + src.height / 2;
let x0;
let y0;
for (let i = 0; i < parallels.length; i++) {
// Routes multiple loops
if (src === trg) {
x0 = src.x + src.width + this.spacing;
y0 = src.y + src.height / 2;
for (let i = 0; i < parallels.length; i += 1) {
this.route(parallels[i], x0, y0);
x0 += this.spacing;
}
@ -207,8 +212,8 @@ class mxParallelEdgeLayout extends mxGraphLayout {
const len = Math.sqrt(dx * dx + dy * dy);
if (len > 0) {
var x0 = scx + dx / 2;
var y0 = scy + dy / 2;
x0 = scx + dx / 2;
y0 = scy + dy / 2;
const nx = (dy * this.spacing) / len;
const ny = (dx * this.spacing) / len;
@ -216,7 +221,7 @@ class mxParallelEdgeLayout extends mxGraphLayout {
x0 += (nx * (parallels.length - 1)) / 2;
y0 -= (ny * (parallels.length - 1)) / 2;
for (let i = 0; i < parallels.length; i++) {
for (let i = 0; i < parallels.length; i += 1) {
this.route(parallels[i], x0, y0);
x0 -= nx;
y0 += ny;

View File

@ -5,6 +5,7 @@
*/
import mxRectangle from '../util/mxRectangle';
import mxGraphLayout from "./mxGraphLayout";
class mxPartitionLayout extends mxGraphLayout {
/**
@ -92,7 +93,7 @@ class mxPartitionLayout extends mxGraphLayout {
// Finds index of the closest swimlane
// TODO: Take into account the orientation
for (i = 0; i < childCount; i++) {
for (i = 0; i < childCount; i += 1) {
const child = model.getChildAt(parent, i);
const bounds = this.getVertexBounds(child);
@ -132,7 +133,7 @@ class mxPartitionLayout extends mxGraphLayout {
if (
this.graph.container != null &&
((pgeo == null && model.isLayer(parent)) ||
parent == this.graph.getView().currentRoot)
parent === this.graph.getView().currentRoot)
) {
const width = this.graph.container.offsetWidth - 1;
const height = this.graph.container.offsetHeight - 1;
@ -143,7 +144,7 @@ class mxPartitionLayout extends mxGraphLayout {
const children = [];
const childCount = model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(parent, i);
if (!this.isVertexIgnored(child) && this.isVertexMovable(child)) {
@ -177,7 +178,7 @@ class mxPartitionLayout extends mxGraphLayout {
if (value > 0) {
model.beginUpdate();
try {
for (let i = 0; i < n; i++) {
for (let i = 0; i < n; i += 1) {
const child = children[i];
let geo = model.getGeometry(child);

View File

@ -178,7 +178,7 @@ class mxRadialTreeLayout extends mxCompactTreeLayout {
let maxRightGrad = 0;
// Find the steepest left and right gradients
for (let i = 0; i < this.row.length; i++) {
for (let i = 0; i < this.row.length; i += 1) {
const leftGrad =
(this.centerX - this.rowMinX[i] - this.nodeDistance) / this.rowRadi[i];
const rightGrad =
@ -189,7 +189,7 @@ class mxRadialTreeLayout extends mxCompactTreeLayout {
}
// Extend out row so they meet the maximum gradient and convert to polar co-ords
for (let i = 0; i < this.row.length; i++) {
for (let i = 0; i < this.row.length; i += 1) {
const xLeftLimit =
this.centerX - this.nodeDistance - maxLeftGrad * this.rowRadi[i];
const xRightLimit =
@ -238,7 +238,7 @@ class mxRadialTreeLayout extends mxCompactTreeLayout {
}
// Set locations
for (let i = 0; i < this.row.length; i++) {
for (let i = 0; i < this.row.length; i += 1) {
for (let j = 0; j < this.row[i].length; j++) {
const row = this.row[i];
const node = row[j];
@ -280,7 +280,7 @@ class mxRadialTreeLayout extends mxCompactTreeLayout {
let rowHasChildren = false;
for (let i = 0; i < row.length; i++) {
for (let i = 0; i < row.length; i += 1) {
let child = row[i] != null ? row[i].child : null;
while (child != null) {

View File

@ -196,7 +196,7 @@ class mxStackLayout extends mxGraphLayout {
value /= this.graph.view.scale;
for (i = 0; i < childCount; i++) {
for (i = 0; i < childCount; i += 1) {
const child = model.getChildAt(parent, i);
if (child != cell) {
@ -260,7 +260,7 @@ class mxStackLayout extends mxGraphLayout {
const childCount = model.getChildCount(parent);
const cells = [];
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(parent, i);
if (!this.isVertexIgnored(child) && this.isVertexMovable(child)) {
@ -372,7 +372,7 @@ class mxStackLayout extends mxGraphLayout {
let lastChild = null;
const cells = this.getLayoutCells(parent);
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const child = cells[i];
let geo = model.getGeometry(child);

View File

@ -86,7 +86,7 @@ class mxChildChange {
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.connect(this.model.getChildAt(cell, i), isConnect);
}
};

View File

@ -93,7 +93,7 @@ const mxCellPath = {
if (path != null) {
const tokens = path.split(mxCellPath.PATH_SEPARATOR);
for (let i = 0; i < tokens.length; i++) {
for (let i = 0; i < tokens.length; i += 1) {
parent = parent.getChildAt(parseInt(tokens[i]));
}
}
@ -111,7 +111,7 @@ const mxCellPath = {
const min = Math.min(p1.length, p2.length);
let comp = 0;
for (let i = 0; i < min; i++) {
for (let i = 0; i < min; i += 1) {
if (p1[i] != p2[i]) {
if (p1[i].length == 0 || p2[i].length == 0) {
comp = p1[i] == p2[i] ? 0 : p1[i] > p2[i] ? 1 : -1;

View File

@ -255,7 +255,7 @@ class mxGeometry extends mxRectangle {
// Translate the control points
if (this.points != null) {
for (let i = 0; i < this.points.length; i++) {
for (let i = 0; i < this.points.length; i += 1) {
if (this.points[i] != null) {
const pt = mxUtils.getRotatedPoint(this.points[i], cos, sin, cx);
this.points[i].x = Math.round(pt.x);
@ -303,7 +303,7 @@ class mxGeometry extends mxRectangle {
// Translate the control points
if (this.TRANSLATE_CONTROL_POINTS && this.points != null) {
for (let i = 0; i < this.points.length; i++) {
for (let i = 0; i < this.points.length; i += 1) {
if (this.points[i] != null) {
this.points[i].x = parseFloat(this.points[i].x) + dx;
this.points[i].y = parseFloat(this.points[i].y) + dy;
@ -345,7 +345,7 @@ class mxGeometry extends mxRectangle {
// Translate the control points
if (this.points != null) {
for (let i = 0; i < this.points.length; i++) {
for (let i = 0; i < this.points.length; i += 1) {
if (this.points[i] != null) {
this.points[i].x = parseFloat(this.points[i].x) * sx;
this.points[i].y = parseFloat(this.points[i].y) * sy;

View File

@ -165,7 +165,7 @@ class mxGraphModel extends mxEventSource {
* let nodes = [];
* let codec = new mxCodec();
*
* for (let i = 0; i < changes.length; i++)
* for (let i = 0; i < changes.length; i += 1)
* {
* nodes.push(codec.encode(changes[i]));
* }
@ -230,7 +230,7 @@ class mxGraphModel extends mxEventSource {
* {
* let changes = evt.getProperty('edit').changes;
*
* for (let i = 0; i < changes.length; i++)
* for (let i = 0; i < changes.length; i += 1)
* {
* let change = changes[i];
*
@ -379,7 +379,7 @@ class mxGraphModel extends mxEventSource {
if (cells != null) {
result = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (filter(cells[i])) {
result.push(cells[i]);
}
@ -442,7 +442,7 @@ class mxGraphModel extends mxEventSource {
// Visits the children of the cell
const childCount = this.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = this.getChildAt(parent, i);
result = result.concat(this.filterDescendants(filter, child));
}
@ -683,7 +683,7 @@ class mxGraphModel extends mxEventSource {
// Recursively processes child cells
const childCount = this.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.cellAdded(this.getChildAt(cell, i));
}
}
@ -721,7 +721,7 @@ class mxGraphModel extends mxEventSource {
// Updates edges on children first
const childCount = this.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = this.getChildAt(cell, i);
this.updateEdgeParents(child, root);
}
@ -1289,7 +1289,7 @@ class mxGraphModel extends mxEventSource {
const edgeCount = this.getEdgeCount(cell);
const result = [];
for (let i = 0; i < edgeCount; i++) {
for (let i = 0; i < edgeCount; i += 1) {
const edge = this.getEdgeAt(cell, i);
const source = this.getTerminal(edge, true);
const target = this.getTerminal(edge, false);
@ -1343,7 +1343,7 @@ class mxGraphModel extends mxEventSource {
// Checks if the edge is connected to the correct
// cell and returns the first match
for (let i = 0; i < edgeCount; i++) {
for (let i = 0; i < edgeCount; i += 1) {
const edge = this.getEdgeAt(terminal, i);
const src = this.getTerminal(edge, true);
const trg = this.getTerminal(edge, false);
@ -1381,7 +1381,7 @@ class mxGraphModel extends mxEventSource {
const terminals = [];
if (edges != null) {
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const source = this.getTerminal(edges[i], true);
const target = this.getTerminal(edges[i], false);
@ -1429,11 +1429,11 @@ class mxGraphModel extends mxEventSource {
const dict = new mxDictionary();
const tmp = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
dict.put(cells[i], true);
}
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const cell = cells[i];
let topmost = true;
let parent = this.getParent(cell);
@ -2009,7 +2009,7 @@ class mxGraphModel extends mxEventSource {
if (cells != null) {
const dict = new mxDictionary();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const parent = this.getParent(cells[i]);
if (parent != null && !dict.get(parent)) {
@ -2066,7 +2066,7 @@ class mxGraphModel extends mxEventSource {
mapping = mapping != null ? mapping : {};
const clones = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (cells[i] != null) {
clones.push(this.cloneCellImpl(cells[i], mapping, includeChildren));
} else {
@ -2074,7 +2074,7 @@ class mxGraphModel extends mxEventSource {
}
}
for (let i = 0; i < clones.length; i++) {
for (let i = 0; i < clones.length; i += 1) {
if (clones[i] != null) {
this.restoreClone(clones[i], cells[i], mapping);
}
@ -2099,7 +2099,7 @@ class mxGraphModel extends mxEventSource {
if (includeChildren) {
const childCount = this.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const cloneChild = this.cloneCellImpl(
this.getChildAt(cell, i),
mapping,
@ -2152,7 +2152,7 @@ class mxGraphModel extends mxEventSource {
const childCount = this.getChildCount(clone);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.restoreClone(
this.getChildAt(clone, i),
this.getChildAt(cell, i),

View File

@ -502,7 +502,7 @@ const mxClient = {
}
}
for (let i = 0; i < mxClient.defaultBundles.length; i++) {
for (let i = 0; i < mxClient.defaultBundles.length; i += 1) {
mxResources.add(mxClient.defaultBundles[i], lan, callback);
}
},

View File

@ -233,7 +233,7 @@ class mxArrowConnector extends mxShape {
let dy1 = 0;
let dist1 = 0;
for (let i = 0; i < pts.length - 2; i++) {
for (let i = 0; i < pts.length - 2; i += 1) {
// Work out in which direction the line is bending
const pos = mxUtils.relativeCcw(
pts[i].x,

View File

@ -110,7 +110,7 @@ class mxPolyline extends mxShape {
c.moveTo(pt.x, pt.y);
for (let i = 1; i < n - 2; i++) {
for (let i = 1; i < n - 2; i += 1) {
var p0 = pts[i];
var p1 = pts[i + 1];
const ix = (p0.x + p1.x) / 2;

View File

@ -389,7 +389,7 @@ class mxShape {
if (pts != null && pts.length > 0 && pts[0] != null) {
this.bounds = new mxRectangle(Number(pts[0].x), Number(pts[0].y), 1, 1);
for (let i = 1; i < this.points.length; i++) {
for (let i = 1; i < this.points.length; i += 1) {
if (pts[i] != null) {
this.bounds.add(
new mxRectangle(Number(pts[i].x), Number(pts[i].y), 1, 1)
@ -830,7 +830,7 @@ class mxShape {
// Paints edge shape
const pts = [];
for (let i = 0; i < this.points.length; i++) {
for (let i = 0; i < this.points.length; i += 1) {
if (this.points[i] != null) {
pts.push(new mxPoint(this.points[i].x / s, this.points[i].y / s));
}

View File

@ -329,7 +329,7 @@ class mxStencil extends mxShape {
if (tmp != null && tmp.length > 0) {
this.constraints = [];
for (let i = 0; i < tmp.length; i++) {
for (let i = 0; i < tmp.length; i += 1) {
this.constraints.push(this.parseConstraint(tmp[i]));
}
}
@ -612,7 +612,7 @@ class mxStencil extends mxShape {
}
if (!parseRegularly && pointCount > 0) {
for (let i = 0; i < segs.length; i++) {
for (let i = 0; i < segs.length; i += 1) {
let close = false;
const ps = segs[i][0];
const pe = segs[i][segs[i].length - 1];
@ -804,7 +804,7 @@ class mxStencil extends mxShape {
const tmp = value.split(' ');
const pat = [];
for (let i = 0; i < tmp.length; i++) {
for (let i = 0; i < tmp.length; i += 1) {
if (tmp[i].length > 0) {
pat.push(Number(tmp[i]) * minScale);
}

View File

@ -33,7 +33,7 @@ const mxClipboard = {
*
* mxClipboard.parents = {};
*
* for (let i = 0; i < result.length; i++)
* for (let i = 0; i < result.length; i += 1)
* {
* mxClipboard.parents[i] = graph.model.getParent(cells[i]);
* }
@ -55,7 +55,7 @@ const mxClipboard = {
* graph.model.beginUpdate();
* try
* {
* for (let i = 0; i < cells.length; i++)
* for (let i = 0; i < cells.length; i += 1)
* {
* let tmp = (mxClipboard.parents != null && graph.model.contains(mxClipboard.parents[i])) ?
* mxClipboard.parents[i] : parent;

View File

@ -45,7 +45,7 @@ const mxEffects = {
const animate = () => {
let isRequired = false;
for (let i = 0; i < changes.length; i++) {
for (let i = 0; i < changes.length; i += 1) {
const change = changes[i];
if (
@ -130,7 +130,7 @@ const mxEffects = {
// Fades all children
const childCount = graph.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = graph.model.getChildAt(cell, i);
const childState = graph.getView().getState(child);
@ -144,7 +144,7 @@ const mxEffects = {
const edges = graph.model.getEdges(cell);
if (edges != null) {
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const edgeState = graph.getView().getState(edges[i]);
if (edgeState != null) {

View File

@ -70,7 +70,7 @@ const mxEvent = {
if (element.mxListenerList != null) {
const listenerCount = element.mxListenerList.length;
for (let i = 0; i < listenerCount; i++) {
for (let i = 0; i < listenerCount; i += 1) {
const entry = element.mxListenerList[i];
if (entry.f === funct) {
@ -369,7 +369,7 @@ const mxEvent = {
evt => {
if (!mxEvent.isMouseEvent(evt) && evtCache.length == 2) {
// Find this event in the cache and update its record with this event
for (let i = 0; i < evtCache.length; i++) {
for (let i = 0; i < evtCache.length; i += 1) {
if (evt.pointerId == evtCache[i].pointerId) {
evtCache[i] = evt;
break;

View File

@ -247,7 +247,7 @@ class mxGuide {
overrideY = overrideY || override;
}
for (let i = 0; i < this.states.length; i++) {
for (let i = 0; i < this.states.length; i += 1) {
const state = this.states[i];
if (state != null && !this.isStateIgnored(state)) {

View File

@ -76,7 +76,7 @@ class mxImageExport {
const { graph } = state.view;
const childCount = graph.model.getChildCount(state.cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const childState = graph.view.getState(
graph.model.getChildAt(state.cell, i)
);

View File

@ -329,7 +329,7 @@ const mxLog = {
write() {
let string = '';
for (let i = 0; i < arguments.length; i++) {
for (let i = 0; i < arguments.length; i += 1) {
string += arguments[i];
if (i < arguments.length - 1) {
@ -364,7 +364,7 @@ const mxLog = {
writeln() {
let string = '';
for (let i = 0; i < arguments.length; i++) {
for (let i = 0; i < arguments.length; i += 1) {
string += arguments[i];
if (i < arguments.length - 1) {

View File

@ -100,7 +100,7 @@ class mxMorphing extends mxAnimation {
if (this.cells != null) {
// Animates the given cells individually without recursion
for (let i = 0; i < this.cells.length; i++) {
for (let i = 0; i < this.cells.length; i += 1) {
this.animateCell(this.cells[i], move, false);
}
} else {
@ -156,7 +156,7 @@ class mxMorphing extends mxAnimation {
if (recurse && !this.stopRecursion(state, delta)) {
const childCount = this.graph.getModel().getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.animateCell(
this.graph.getModel().getChildAt(cell, i),
move,

View File

@ -280,7 +280,7 @@ const mxResources = {
if (text != null) {
const lines = text.split('\n');
for (let i = 0; i < lines.length; i++) {
for (let i = 0; i < lines.length; i += 1) {
if (lines[i].charAt(0) !== '#') {
const index = lines[i].indexOf('=');
@ -364,7 +364,7 @@ const mxResources = {
const result = [];
let index = null;
for (let i = 0; i < value.length; i++) {
for (let i = 0; i < value.length; i += 1) {
const c = value.charAt(i);
if (c === '{') {

View File

@ -870,7 +870,7 @@ class mxSvgCanvas2D extends mxAbstractCanvas2D {
const dash = this.state.dashPattern.split(' ');
if (dash.length > 0) {
for (let i = 0; i < dash.length; i++) {
for (let i = 0; i < dash.length; i += 1) {
pat[i] = Number(dash[i]) * scale;
}
}
@ -1732,7 +1732,7 @@ class mxSvgCanvas2D extends mxAbstractCanvas2D {
}
}
for (let i = 0; i < lines.length; i++) {
for (let i = 0; i < lines.length; i += 1) {
// Workaround for bounding box of empty lines and spaces
if (lines[i].length > 0 && mxUtils.trim(lines[i]).length > 0) {
const text = this.createElement('text');

View File

@ -209,7 +209,7 @@ class mxUndoManager extends mxEventSource {
this.history.length - this.indexOfNextAdd
);
for (let i = 0; i < edits.length; i++) {
for (let i = 0; i < edits.length; i += 1) {
edits[i].die();
}
}

View File

@ -183,7 +183,7 @@ class mxUndoableEdit {
this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));
const count = this.changes.length;
for (let i = 0; i < count; i++) {
for (let i = 0; i < count; i += 1) {
const change = this.changes[i];
if (change.execute != null) {

View File

@ -282,7 +282,7 @@ const mxUtils = {
*/
indexOf: (array, obj) => {
if (array != null && obj != null) {
for (let i = 0; i < array.length; i++) {
for (let i = 0; i < array.length; i += 1) {
if (array[i] == obj) {
return i;
}
@ -305,7 +305,7 @@ const mxUtils = {
*/
forEach: (array, fn) => {
if (array != null && fn != null) {
for (let i = 0; i < array.length; i++) {
for (let i = 0; i < array.length; i += 1) {
fn(array[i]);
}
}
@ -474,7 +474,7 @@ const mxUtils = {
const newNode = doc.createElement(node.nodeName);
if (node.attributes && node.attributes.length > 0) {
for (let i = 0; i < node.attributes.length; i++) {
for (let i = 0; i < node.attributes.length; i += 1) {
newNode.setAttribute(
node.attributes[i].nodeName,
node.getAttribute(node.attributes[i].nodeName)
@ -483,7 +483,7 @@ const mxUtils = {
}
if (allChildren && node.childNodes && node.childNodes.length > 0) {
for (let i = 0; i < node.childNodes.length; i++) {
for (let i = 0; i < node.childNodes.length; i += 1) {
newNode.appendChild(
mxUtils.importNodeImplementation(
doc,
@ -742,7 +742,7 @@ const mxUtils = {
const attrs = node.attributes;
if (attrs != null) {
for (let i = 0; i < attrs.length; i++) {
for (let i = 0; i < attrs.length; i += 1) {
const val = mxUtils.htmlEntities(attrs[i].value);
result.push(` ${attrs[i].nodeName}="${val}"`);
}
@ -809,7 +809,7 @@ const mxUtils = {
return;
}
for (let i = 0; i < elts.length; i++) {
for (let i = 0; i < elts.length; i += 1) {
const elem = elts[i];
// DIV with a br or linefeed forces a linefeed
@ -993,7 +993,7 @@ const mxUtils = {
count = count || 1;
let br = null;
for (let i = 0; i < count; i++) {
for (let i = 0; i < count; i += 1) {
if (parent != null) {
br = parent.ownerDocument.createElement('br');
parent.appendChild(br);
@ -1340,7 +1340,7 @@ const mxUtils = {
errors++;
};
for (let i = 0; i < urls.length; i++) {
for (let i = 0; i < urls.length; i += 1) {
((url, index) => {
mxUtils.get(
url,
@ -1568,7 +1568,7 @@ const mxUtils = {
return false;
}
if (a != null && b != null) {
for (let i = 0; i < a.length; i++) {
for (let i = 0; i < a.length; i += 1) {
if (
(a[i] != null && b[i] == null) ||
(a[i] == null && b[i] != null) ||
@ -1635,7 +1635,7 @@ const mxUtils = {
const dict = new mxDictionary();
const result = [];
for (let i = 0; i < arr.length; i++) {
for (let i = 0; i < arr.length; i += 1) {
if (!dict.get(arr[i])) {
result.push(arr[i]);
dict.put(arr[i], true);
@ -2033,7 +2033,7 @@ const mxUtils = {
let last = state.absolutePoints[0];
let min = null;
for (let i = 1; i < state.absolutePoints.length; i++) {
for (let i = 1; i < state.absolutePoints.length; i += 1) {
const current = state.absolutePoints[i];
const dist = mxUtils.ptSegDistSq(
last.x,
@ -2142,7 +2142,7 @@ const mxUtils = {
getPerimeterPoint(pts, center, point) {
let min = null;
for (let i = 0; i < pts.length - 1; i++) {
for (let i = 0; i < pts.length - 1; i += 1) {
const pt = mxUtils.intersection(
pts[i].x,
pts[i].y,
@ -2904,7 +2904,7 @@ const mxUtils = {
if (style != null) {
const pairs = style.split(';');
for (let i = 0; i < pairs.length; i++) {
for (let i = 0; i < pairs.length; i += 1) {
if (pairs[i].indexOf('=') < 0) {
result.push(pairs[i]);
}
@ -2926,7 +2926,7 @@ const mxUtils = {
const tokens = style.split(';');
let pos = 0;
for (let i = 0; i < tokens.length; i++) {
for (let i = 0; i < tokens.length; i += 1) {
if (tokens[i] == stylename) {
return pos;
}
@ -2970,7 +2970,7 @@ const mxUtils = {
if (style != null) {
const tokens = style.split(';');
for (let i = 0; i < tokens.length; i++) {
for (let i = 0; i < tokens.length; i += 1) {
if (tokens[i] != stylename) {
result.push(tokens[i]);
}
@ -2992,7 +2992,7 @@ const mxUtils = {
if (style != null) {
const tokens = style.split(';');
for (let i = 0; i < tokens.length; i++) {
for (let i = 0; i < tokens.length; i += 1) {
// Keeps the key, value assignments
if (tokens[i].indexOf('=') >= 0) {
result.push(tokens[i]);
@ -3020,7 +3020,7 @@ const mxUtils = {
if (cells != null && cells.length > 0) {
model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (cells[i] != null) {
const style = mxUtils.setStyle(
model.getStyle(cells[i]),
@ -3123,7 +3123,7 @@ const mxUtils = {
if (cells != null && cells.length > 0) {
model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (cells[i] != null) {
const style = mxUtils.setStyleFlag(
model.getStyle(cells[i]),
@ -3567,19 +3567,19 @@ const mxUtils = {
const base = document.getElementsByTagName('base');
for (let i = 0; i < base.length; i++) {
for (let i = 0; i < base.length; i += 1) {
doc.writeln(mxUtils.getOuterHtml(base[i]));
}
const links = document.getElementsByTagName('link');
for (let i = 0; i < links.length; i++) {
for (let i = 0; i < links.length; i += 1) {
doc.writeln(mxUtils.getOuterHtml(links[i]));
}
const styles = document.getElementsByTagName('style');
for (let i = 0; i < styles.length; i++) {
for (let i = 0; i < styles.length; i += 1) {
doc.writeln(mxUtils.getOuterHtml(styles[i]));
}

View File

@ -396,7 +396,7 @@ class mxXmlRequest {
: this.params.split();
// Adds the parameters as textareas to the form
for (let i = 0; i < pars.length; i++) {
for (let i = 0; i < pars.length; i += 1) {
const pos = pars[i].indexOf('=');
if (pos > 0) {

View File

@ -843,17 +843,17 @@ class mxCellEditor {
);
const bold =
(mxUtils.getValue(state.style, mxConstants.STYLE_FONTSTYLE, 0) &
mxConstants.FONT_BOLD) ==
mxConstants.FONT_BOLD) ===
mxConstants.FONT_BOLD;
const italic =
(mxUtils.getValue(state.style, mxConstants.STYLE_FONTSTYLE, 0) &
mxConstants.FONT_ITALIC) ==
mxConstants.FONT_ITALIC) ===
mxConstants.FONT_ITALIC;
const txtDecor = [];
if (
(mxUtils.getValue(state.style, mxConstants.STYLE_FONTSTYLE, 0) &
mxConstants.FONT_UNDERLINE) ==
mxConstants.FONT_UNDERLINE) ===
mxConstants.FONT_UNDERLINE
) {
txtDecor.push('underline');
@ -861,7 +861,7 @@ class mxCellEditor {
if (
(mxUtils.getValue(state.style, mxConstants.STYLE_FONTSTYLE, 0) &
mxConstants.FONT_STRIKETHROUGH) ==
mxConstants.FONT_STRIKETHROUGH) ===
mxConstants.FONT_STRIKETHROUGH
) {
txtDecor.push('line-through');
@ -889,7 +889,6 @@ class mxCellEditor {
if (dir === mxConstants.TEXT_DIRECTION_AUTO) {
if (
state != null &&
state.text != null &&
state.text.dialect !== mxConstants.DIALECT_STRICTHTML &&
!mxUtils.isNode(state.text.value)
@ -922,7 +921,7 @@ class mxCellEditor {
this.clearOnChange = true;
} else {
this.clearOnChange =
this.textarea.innerHTML == this.getEmptyLabelText();
this.textarea.innerHTML === this.getEmptyLabelText();
}
this.graph.container.appendChild(this.textarea);
@ -1034,7 +1033,7 @@ class mxCellEditor {
if (
this.clearOnChange &&
this.textarea.innerHTML == this.getEmptyLabelText()
this.textarea.innerHTML === this.getEmptyLabelText()
) {
this.textarea.innerHTML = '';
this.clearOnChange = false;
@ -1042,7 +1041,7 @@ class mxCellEditor {
if (
state != null &&
(this.textarea.innerHTML != initial || this.align != null)
(this.textarea.innerHTML !== initial || this.align != null)
) {
this.prepareTextarea();
const value = this.getCurrentValue(state);

View File

@ -305,7 +305,7 @@ class mxCellRenderer {
mxConstants.STYLE_FONTCOLOR,
];
for (let i = 0; i < styles.length; i++) {
for (let i = 0; i < styles.length; i += 1) {
if (mxUtils.indexOf(values, state.style[styles[i]]) >= 0) {
return true;
}
@ -564,7 +564,7 @@ class mxCellRenderer {
if (overlays != null) {
dict = new mxDictionary();
for (let i = 0; i < overlays.length; i++) {
for (let i = 0; i < overlays.length; i += 1) {
const shape =
state.overlays != null ? state.overlays.remove(overlays[i]) : null;
@ -1436,7 +1436,7 @@ class mxCellRenderer {
insertStateAfter = (state, node, htmlNode) => {
const shapes = this.getShapesForState(state);
for (let i = 0; i < shapes.length; i++) {
for (let i = 0; i < shapes.length; i += 1) {
if (shapes[i] != null && shapes[i].node != null) {
const html =
shapes[i].node.parentNode != state.view.getDrawPane() &&

View File

@ -388,7 +388,7 @@ class mxCellState extends mxRectangle {
if (this.absolutePoints != null) {
clone.absolutePoints = [];
for (let i = 0; i < this.absolutePoints.length; i++) {
for (let i = 0; i < this.absolutePoints.length; i += 1) {
clone.absolutePoints[i] = this.absolutePoints[i].clone();
}
}

View File

@ -135,7 +135,7 @@ class mxCellStatePreview {
const childCount = model.getChildCount(state.cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.translateState(
state.view.getState(model.getChildAt(state.cell, i)),
dx,
@ -184,7 +184,7 @@ class mxCellStatePreview {
const childCount = model.getChildCount(state.cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.revalidateState(
this.graph.view.getState(model.getChildAt(state.cell, i)),
dx,
@ -202,7 +202,7 @@ class mxCellStatePreview {
const model = this.graph.getModel();
const edgeCount = model.getEdgeCount(state.cell);
for (let i = 0; i < edgeCount; i++) {
for (let i = 0; i < edgeCount; i += 1) {
const s = state.view.getState(model.getEdgeAt(state.cell, i));
if (s != null) {

View File

@ -237,7 +237,7 @@ const mxEdgeStyle = {
if (p0 != null && pe != null) {
if (points != null && points.length > 0) {
for (let i = 0; i < points.length; i++) {
for (let i = 0; i < points.length; i += 1) {
let pt = points[i];
pt = state.view.transformControlPoint(state, pt);
result.push(new mxPoint(pt.x, pt.y));
@ -604,7 +604,7 @@ const mxEdgeStyle = {
// Converts all hints and removes nulls
let hints = [];
for (let i = 0; i < controlHints.length; i++) {
for (let i = 0; i < controlHints.length; i += 1) {
const tmp = state.view.transformControlPoint(
state,
controlHints[i],
@ -657,7 +657,7 @@ const mxEdgeStyle = {
// Check for alignment with fixed points and with channels
// at source and target segments only
for (let i = 0; i < 2; i++) {
for (let i = 0; i < 2; i += 1) {
const fixedVertAlign =
currentPt != null && currentPt.x == currentHint.x;
const fixedHozAlign = currentPt != null && currentPt.y == currentHint.y;
@ -743,7 +743,7 @@ const mxEdgeStyle = {
pt.x = hint.x;
}
for (let i = 0; i < hints.length; i++) {
for (let i = 0; i < hints.length; i += 1) {
horizontal = !horizontal;
hint = hints[i];
@ -998,7 +998,7 @@ const mxEdgeStyle = {
let result = [];
if (points != null) {
for (let i = 0; i < points.length; i++) {
for (let i = 0; i < points.length; i += 1) {
if (points[i] != null) {
const pt = new mxPoint(
Math.round((points[i].x / scale) * 10) / 10,
@ -1200,7 +1200,7 @@ const mxEdgeStyle = {
];
const buffer = [sourceBuffer, targetBuffer];
for (let i = 0; i < 2; i++) {
for (let i = 0; i < 2; i += 1) {
mxEdgeStyle.limits[i][1] = geo[i][0] - buffer[i];
mxEdgeStyle.limits[i][2] = geo[i][1] - buffer[i];
mxEdgeStyle.limits[i][4] = geo[i][0] + geo[i][2] + buffer[i];
@ -1251,7 +1251,7 @@ const mxEdgeStyle = {
[0.5, 0.5],
];
for (let i = 0; i < 2; i++) {
for (let i = 0; i < 2; i += 1) {
if (currentTerm != null) {
constraint[i][0] = (currentTerm.x - geo[i][0]) / geo[i][2];
@ -1330,7 +1330,7 @@ const mxEdgeStyle = {
let preferredOrderSet = false;
// If the preferred port isn't available, switch it
for (let i = 0; i < 2; i++) {
for (let i = 0; i < 2; i += 1) {
if (dir[i] != 0x0) {
continue;
}
@ -1390,7 +1390,7 @@ const mxEdgeStyle = {
// the preferred port selections
// If the list contains gaps, compact it
for (let i = 0; i < 2; i++) {
for (let i = 0; i < 2; i += 1) {
if (dir[i] != 0x0) {
continue;
}
@ -1484,7 +1484,7 @@ const mxEdgeStyle = {
const initialOrientation = lastOrientation;
let currentOrientation = 0;
for (let i = 0; i < routePattern.length; i++) {
for (let i = 0; i < routePattern.length; i += 1) {
const nextDirection = routePattern[i] & 0xf;
// Rotate the index of this direction by the quad
@ -1576,7 +1576,7 @@ const mxEdgeStyle = {
}
}
for (let i = 0; i <= currentIndex; i++) {
for (let i = 0; i <= currentIndex; i += 1) {
if (i === currentIndex) {
// Last point can cause last segment to be in
// same direction as jetty/approach. If so,

View File

@ -1916,14 +1916,14 @@ class mxGraph extends mxEventSource {
} else {
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
addCell(this.model.getChildAt(cell, i));
}
}
}
};
for (let i = 0; i < changes.length; i++) {
for (let i = 0; i < changes.length; i += 1) {
const change = changes[i];
if (
@ -1958,7 +1958,7 @@ class mxGraph extends mxEventSource {
* changes - Array that contains the individual changes.
*/
graphModelChanged = changes => {
for (let i = 0; i < changes.length; i++) {
for (let i = 0; i < changes.length; i += 1) {
this.processChange(changes[i]);
}
@ -1976,7 +1976,7 @@ class mxGraph extends mxEventSource {
const cells = this.getSelectionCells();
const removed = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (!this.model.contains(cells[i]) || !this.isCellVisible(cells[i])) {
removed.push(cells[i]);
} else {
@ -2104,7 +2104,7 @@ class mxGraph extends mxEventSource {
removeStateForCell = cell => {
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.removeStateForCell(this.model.getChildAt(cell, i));
}
@ -2235,7 +2235,7 @@ class mxGraph extends mxEventSource {
this.cellRenderer.redraw(state);
}
for (let i = 0; i < overlays.length; i++) {
for (let i = 0; i < overlays.length; i += 1) {
this.fireEvent(
new mxEventObject(
mxEvent.REMOVE_OVERLAY,
@ -2271,7 +2271,7 @@ class mxGraph extends mxEventSource {
// Recursively removes all overlays from the children
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = this.model.getChildAt(cell, i);
this.clearCellOverlays(child); // recurse
}
@ -2606,7 +2606,7 @@ class mxGraph extends mxEventSource {
swimlanes.splice(0, 0, cell);
swimlanes.push(cell);
for (let i = 0; i < swimlanes.length - 1; i++) {
for (let i = 0; i < swimlanes.length - 1; i += 1) {
if (this.isCellSelected(swimlanes[i])) {
cell = swimlanes[this.isToggleEvent(evt) ? i : i + 1];
}
@ -2633,7 +2633,7 @@ class mxGraph extends mxEventSource {
const parent = model.getParent(cell);
const childCount = model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(parent, i);
if (cell !== child && this.isCellSelected(child)) {
@ -3235,7 +3235,7 @@ class mxGraph extends mxEventSource {
? horizontalCount
: verticalCount;
for (let i = 0; i <= count; i++) {
for (let i = 0; i <= count; i += 1) {
const pts =
breaks === this.horizontalPageBreaks
? [
@ -3274,7 +3274,7 @@ class mxGraph extends mxEventSource {
}
}
for (let i = count; i < breaks.length; i++) {
for (let i = count; i < breaks.length; i += 1) {
breaks[i].destroy();
}
@ -3410,7 +3410,7 @@ class mxGraph extends mxEventSource {
if (cells != null) {
this.model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
this.model.setStyle(cells[i], style);
}
} finally {
@ -3561,7 +3561,7 @@ class mxGraph extends mxEventSource {
if (cells != null && cells.length > 1) {
// Finds the required coordinate for the alignment
if (param == null) {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const state = this.view.getState(cells[i]);
if (state != null && !this.model.isEdge(cells[i])) {
@ -3600,7 +3600,7 @@ class mxGraph extends mxEventSource {
this.model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const state = this.view.getState(cells[i]);
if (state != null) {
@ -3715,7 +3715,7 @@ class mxGraph extends mxEventSource {
removeImageBundle = bundle => {
const tmp = [];
for (let i = 0; i < this.imageBundles.length; i++) {
for (let i = 0; i < this.imageBundles.length; i += 1) {
if (this.imageBundles[i] !== bundle) {
tmp.push(this.imageBundles[i]);
}
@ -3794,7 +3794,7 @@ class mxGraph extends mxEventSource {
if (cells != null) {
this.model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const parent = this.model.getParent(cells[i]);
if (back) {
@ -3922,7 +3922,7 @@ class mxGraph extends mxEventSource {
result.push(cells[0]);
// Filters selection cells with the same parent
for (let i = 1; i < cells.length; i++) {
for (let i = 1; i < cells.length; i += 1) {
if (this.model.getParent(cells[i]) === parent) {
result.push(cells[i]);
}
@ -4010,7 +4010,7 @@ class mxGraph extends mxEventSource {
if (cells != null && cells.length > 0) {
this.model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
let children = this.model.getChildren(cells[i]);
if (children != null && children.length > 0) {
@ -4061,7 +4061,7 @@ class mxGraph extends mxEventSource {
// Finds the cells with children
const tmp = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (
this.model.isVertex(cells[i]) &&
this.model.getChildCount(cells[i]) > 0
@ -4230,7 +4230,7 @@ class mxGraph extends mxEventSource {
let result = null;
if (cells != null && cells.length > 0) {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (this.model.isVertex(cells[i]) || this.model.isEdge(cells[i])) {
const bbox = this.view.getBoundingBox(
this.view.getState(cells[i]),
@ -4299,7 +4299,7 @@ class mxGraph extends mxEventSource {
const dict = new mxDictionary();
const tmp = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
dict.put(cells[i], true);
tmp.push(cells[i]);
}
@ -4309,7 +4309,7 @@ class mxGraph extends mxEventSource {
const trans = this.view.translate;
clones = this.model.cloneCells(cells, true, mapping);
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (
!allowInvalidEdges &&
this.model.isEdge(clones[i]) &&
@ -4686,7 +4686,7 @@ class mxGraph extends mxEventSource {
const o1 = parentState != null ? parentState.origin : null;
const zero = new mxPoint(0, 0);
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (cells[i] == null) {
index--;
} else {
@ -4801,7 +4801,7 @@ class mxGraph extends mxEventSource {
if (recurse) {
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.autoSizeCell(this.model.getChildAt(cell, i));
}
}
@ -4846,11 +4846,11 @@ class mxGraph extends mxEventSource {
const edges = this.getDeletableCells(this.getAllEdges(cells));
const dict = new mxDictionary();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
dict.put(cells[i], true);
}
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
if (this.view.getState(edges[i]) == null && !dict.get(edges[i])) {
dict.put(edges[i], true);
cells.push(edges[i]);
@ -4897,11 +4897,11 @@ class mxGraph extends mxEventSource {
// Creates hashtable for faster lookup
const dict = new mxDictionary();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
dict.put(cells[i], true);
}
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
// Disconnects edges which are not being removed
const edges = this.getAllEdges([cells[i]]);
@ -5144,7 +5144,7 @@ class mxGraph extends mxEventSource {
if (cells != null && cells.length > 0) {
this.model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
this.model.setVisible(cells[i], show);
}
} finally {
@ -5226,7 +5226,7 @@ class mxGraph extends mxEventSource {
if (cells != null && cells.length > 0) {
this.model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (
(!checkFoldable || this.isCellFoldable(cells[i], collapse)) &&
collapse !== this.isCellCollapsed(cells[i])
@ -5382,7 +5382,7 @@ class mxGraph extends mxEventSource {
let edges = [];
if (cells != null) {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const edgeCount = this.model.getEdgeCount(cells[i]);
for (let j = 0; j < edgeCount; j++) {
@ -5727,7 +5727,7 @@ class mxGraph extends mxEventSource {
*
* if (cells != null)
* {
* for (let i = 0; i < cells.length; i++)
* for (let i = 0; i < cells.length; i += 1)
* {
* if (graph.getModel().getChildCount(cells[i]) > 0)
* {
@ -5763,7 +5763,7 @@ class mxGraph extends mxEventSource {
if (cells != null && bounds != null && cells.length === bounds.length) {
this.model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
prev.push(this.cellResized(cells[i], bounds[i], false, recurse));
if (this.isExtendParent(cells[i])) {
@ -5878,7 +5878,7 @@ class mxGraph extends mxEventSource {
const dy = geo.height !== 0 ? newGeo.height / geo.height : 1;
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.scaleCell(this.model.getChildAt(cell, i), dx, dy, true);
}
};
@ -5895,7 +5895,7 @@ class mxGraph extends mxEventSource {
constrainChildCells = cell => {
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.constrainChild(this.model.getChildAt(cell, i));
}
};
@ -6057,7 +6057,7 @@ class mxGraph extends mxEventSource {
// terminals to avoid explicit and implicit move at same time
const dict = new mxDictionary();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
dict.put(cells[i], true);
}
@ -6076,7 +6076,7 @@ class mxGraph extends mxEventSource {
// Removes relative edge labels with selected terminals
const checked = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const geo = this.getCellGeometry(cells[i]);
const parent = this.model.getParent(cells[i]);
@ -6128,7 +6128,7 @@ class mxGraph extends mxEventSource {
// Restores parent edge on cloned edge labels
if (clone) {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const geo = this.getCellGeometry(cells[i]);
const parent = this.model.getParent(origCells[i]);
@ -6187,7 +6187,7 @@ class mxGraph extends mxEventSource {
this.disconnectGraph(cells);
}
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
this.translateCell(cells[i], dx, dy);
if (extend && this.isExtendParent(cells[i])) {
@ -6425,7 +6425,7 @@ class mxGraph extends mxEventSource {
if (!this.isCellCollapsed(cell)) {
const desc = this.model.getDescendants(cell);
for (let i = 0; i < desc.length; i++) {
for (let i = 0; i < desc.length; i += 1) {
if (this.isCellVisible(desc[i])) {
cells.push(desc[i]);
}
@ -6507,13 +6507,13 @@ class mxGraph extends mxEventSource {
// Prepares faster cells lookup
const dict = new mxDictionary();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
dict.put(cells[i], true);
}
this.model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const edges = this.model.getEdges(cells[i]);
if (edges != null) {
@ -7095,11 +7095,11 @@ class mxGraph extends mxEventSource {
// Fast lookup for finding cells in array
const dict = new mxDictionary();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
dict.put(cells[i], true);
}
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (this.model.isEdge(cells[i])) {
let geo = this.model.getGeometry(cells[i]);
@ -7419,7 +7419,7 @@ class mxGraph extends mxEventSource {
if (includeDescendants) {
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const tmp = this.getCellBounds(
this.model.getChildAt(cell, i),
includeEdges,
@ -7478,7 +7478,7 @@ class mxGraph extends mxEventSource {
let result = null;
if (cells != null) {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (includeEdges || this.model.isVertex(cells[i])) {
// Computes the bounding box for the points in the geometry
const geo = this.getCellGeometry(cells[i]);
@ -8509,7 +8509,7 @@ class mxGraph extends mxEventSource {
// Checks the change against each multiplicity rule
if (this.multiplicities != null) {
for (let i = 0; i < this.multiplicities.length; i++) {
for (let i = 0; i < this.multiplicities.length; i += 1) {
const err = this.multiplicities[i].check(
this,
edge,
@ -8577,7 +8577,7 @@ class mxGraph extends mxEventSource {
let isValid = true;
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const tmp = this.model.getChildAt(cell, i);
let ctx = context;
@ -8652,7 +8652,7 @@ class mxGraph extends mxEventSource {
let error = '';
if (this.multiplicities != null) {
for (let i = 0; i < this.multiplicities.length; i++) {
for (let i = 0; i < this.multiplicities.length; i += 1) {
const rule = this.multiplicities[i];
if (
@ -8819,7 +8819,7 @@ class mxGraph extends mxEventSource {
* {
* let cells = evt.getProperty('cells');
*
* for (let i = 0; i < cells.length; i++)
* for (let i = 0; i < cells.length; i += 1)
* {
* this.view.removeState(cells[i]);
* }
@ -10885,7 +10885,7 @@ class mxGraph extends mxEventSource {
*/
getDropTarget = (cells, evt, cell, clone) => {
if (!this.isSwimlaneNesting()) {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (this.isSwimlane(cells[i])) {
return null;
}
@ -11017,7 +11017,7 @@ class mxGraph extends mxEventSource {
if (parent != null) {
const childCount = this.model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = this.model.getChildAt(parent, i);
if (child != null) {
@ -11126,7 +11126,7 @@ class mxGraph extends mxEventSource {
const t2 = this.tolerance * this.tolerance;
let pt = pts[0];
for (let i = 1; i < pts.length; i++) {
for (let i = 1; i < pts.length; i += 1) {
const next = pts[i];
const dist = mxUtils.ptSegDistSq(pt.x, pt.y, next.x, next.y, x, y);
@ -11240,7 +11240,7 @@ class mxGraph extends mxEventSource {
const result = [];
// Filters out the non-visible child cells
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (this.isCellVisible(cells[i])) {
result.push(cells[i]);
}
@ -11332,7 +11332,7 @@ class mxGraph extends mxEventSource {
const isCollapsed = this.isCellCollapsed(cell);
const childCount = this.model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = this.model.getChildAt(cell, i);
if (isCollapsed || !this.isCellVisible(child)) {
@ -11343,7 +11343,7 @@ class mxGraph extends mxEventSource {
edges = edges.concat(this.model.getEdges(cell, incoming, outgoing));
const result = [];
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const state = this.view.getState(edges[i]);
const source =
@ -11420,7 +11420,7 @@ class mxGraph extends mxEventSource {
const dict = new mxDictionary();
if (edges != null) {
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const state = this.view.getState(edges[i]);
const source =
@ -11485,7 +11485,7 @@ class mxGraph extends mxEventSource {
// Checks if the edge is connected to the correct
// cell and returns the first match
for (let i = 0; i < edges.length; i++) {
for (let i = 0; i < edges.length; i += 1) {
const state = this.view.getState(edges[i]);
const src =
@ -11588,7 +11588,7 @@ class mxGraph extends mxEventSource {
if (parent != null) {
const childCount = model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const cell = model.getChildAt(parent, i);
const state = this.view.getState(cell);
@ -11670,7 +11670,7 @@ class mxGraph extends mxEventSource {
if (parent != null) {
const childCount = this.model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = this.model.getChildAt(parent, i);
const state = this.view.getState(child);
@ -11717,7 +11717,7 @@ class mxGraph extends mxEventSource {
let best = null;
let maxDiff = 0;
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const cell = model.getChildAt(parent, i);
if (this.model.isVertex(cell) && this.isCellVisible(cell)) {
@ -11806,7 +11806,7 @@ class mxGraph extends mxEventSource {
const edgeCount = this.model.getEdgeCount(vertex);
if (edgeCount > 0) {
for (let i = 0; i < edgeCount; i++) {
for (let i = 0; i < edgeCount; i += 1) {
const e = this.model.getEdgeAt(vertex, i);
const isSource = this.model.getTerminal(e, true) == vertex;
@ -12350,7 +12350,7 @@ class mxGraph extends mxEventSource {
*/
removeMouseListener = listener => {
if (this.mouseListeners != null) {
for (let i = 0; i < this.mouseListeners.length; i++) {
for (let i = 0; i < this.mouseListeners.length; i += 1) {
if (this.mouseListeners[i] === listener) {
this.mouseListeners.splice(i, 1);
break;
@ -12770,7 +12770,7 @@ class mxGraph extends mxEventSource {
me.getEvent().returnValue = true;
}
for (let i = 0; i < this.mouseListeners.length; i++) {
for (let i = 0; i < this.mouseListeners.length; i += 1) {
const l = this.mouseListeners[i];
if (evtName === mxEvent.MOUSE_DOWN) {

View File

@ -58,7 +58,7 @@ class mxGraphSelectionModel extends mxEventSource {
* {
* let cells = evt.getProperty('added');
*
* for (let i = 0; i < cells.length; i++)
* for (let i = 0; i < cells.length; i += 1)
* {
* // Handle cells[i]...
* }
@ -180,7 +180,7 @@ class mxGraphSelectionModel extends mxEventSource {
const tmp = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (this.graph.isCellSelectable(cells[i])) {
tmp.push(cells[i]);
}
@ -197,7 +197,7 @@ class mxGraphSelectionModel extends mxEventSource {
*/
getFirstSelectableCell = cells => {
if (cells != null) {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (this.graph.isCellSelectable(cells[i])) {
return cells[i];
}
@ -243,7 +243,7 @@ class mxGraphSelectionModel extends mxEventSource {
const tmp = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (
!this.isSelected(cells[i]) &&
this.graph.isCellSelectable(cells[i])
@ -279,7 +279,7 @@ class mxGraphSelectionModel extends mxEventSource {
if (cells != null) {
const tmp = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (this.isSelected(cells[i])) {
tmp.push(cells[i]);
}

View File

@ -251,7 +251,7 @@ class mxGraphView extends mxEventSource {
if (cells != null && cells.length > 0) {
const model = this.graph.getModel();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (model.isVertex(cells[i]) || model.isEdge(cells[i])) {
const state = this.getState(cells[i]);
@ -480,7 +480,7 @@ class mxGraphView extends mxEventSource {
if (recurse && (force || cell != this.currentRoot)) {
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.clear(model.getChildAt(cell, i), force);
}
} else {
@ -519,7 +519,7 @@ class mxGraphView extends mxEventSource {
if (recurse) {
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(cell, i);
this.invalidate(child, recurse, includeEdges);
}
@ -529,7 +529,7 @@ class mxGraphView extends mxEventSource {
if (includeEdges) {
const edgeCount = model.getEdgeCount(cell);
for (let i = 0; i < edgeCount; i++) {
for (let i = 0; i < edgeCount; i += 1) {
this.invalidate(model.getEdgeAt(cell, i), recurse, includeEdges);
}
}
@ -626,7 +626,7 @@ class mxGraphView extends mxEventSource {
const model = this.graph.getModel();
const childCount = model.getChildCount(state.cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const bounds = this.getBoundingBox(
this.getState(model.getChildAt(state.cell, i))
);
@ -850,7 +850,7 @@ class mxGraphView extends mxEventSource {
const model = this.graph.getModel();
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.validateCell(
model.getChildAt(cell, i),
visible && (!this.isCellCollapsed(cell) || cell == this.currentRoot)
@ -923,7 +923,7 @@ class mxGraphView extends mxEventSource {
const childCount = model.getChildCount(cell);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
this.validateCellState(model.getChildAt(cell, i));
}
}
@ -1389,7 +1389,7 @@ class mxGraphView extends mxEventSource {
);
}
} else if (points != null) {
for (let i = 0; i < points.length; i++) {
for (let i = 0; i < points.length; i += 1) {
if (points[i] != null) {
const pt = mxUtils.clone(points[i]);
pts.push(this.transformControlPoint(edge, pt));
@ -1899,7 +1899,7 @@ class mxGraphView extends mxEventSource {
let maxX = minX;
let maxY = minY;
for (let i = 1; i < points.length; i++) {
for (let i = 1; i < points.length; i += 1) {
const tmp = points[i];
if (tmp != null) {
@ -2030,7 +2030,7 @@ class mxGraphView extends mxEventSource {
let index = 0;
let tmp = 0;
for (let i = 2; i < pointCount; i++) {
for (let i = 2; i < pointCount; i += 1) {
p0 = pe;
pe = edgeState.absolutePoints[i];
const dist = mxUtils.ptSegDistSq(p0.x, p0.y, pe.x, pe.y, x, y);
@ -2260,7 +2260,7 @@ class mxGraphView extends mxEventSource {
}
const result = [];
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const state = this.getState(cells[i]);
if (state != null) {

View File

@ -5,6 +5,15 @@
*/
import mxEventSource from '../util/mxEventSource';
import mxEvent from '../util/mxEvent';
import mxUtils from '../util/mxUtils';
import mxRootChange from '../model/atomic_changes/mxRootChange';
import mxChildChange from '../model/atomic_changes/mxChildChange';
import mxTerminalChange from '../model/atomic_changes/mxTerminalChange';
import mxGeometryChange from '../model/atomic_changes/mxGeometryChange';
import mxVisibleChange from '../model/atomic_changes/mxVisibleChange';
import mxStyleChange from '../model/atomic_changes/mxStyleChange';
import mxEventObject from '../util/mxEventObject';
class mxLayoutManager extends mxEventSource {
/**
@ -249,7 +258,7 @@ class mxLayoutManager extends mxEventSource {
);
const model = this.getGraph().getModel();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const layout = this.getLayout(
model.getParent(cells[i]),
mxEvent.MOVE_CELLS
@ -276,7 +285,7 @@ class mxLayoutManager extends mxEventSource {
if (cells != null && bounds != null) {
const model = this.getGraph().getModel();
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const layout = this.getLayout(
model.getParent(cells[i]),
mxEvent.RESIZE_CELLS
@ -297,7 +306,7 @@ class mxLayoutManager extends mxEventSource {
getCellsForChanges = changes => {
let result = [];
for (let i = 0; i < changes.length; i++) {
for (let i = 0; i < changes.length; i += 1) {
const change = changes[i];
if (change instanceof mxRootChange) {
@ -382,7 +391,7 @@ class mxLayoutManager extends mxEventSource {
if (cell != null && this.hasLayout(cell)) {
const model = this.getGraph().getModel();
for (let i = 0; i < model.getChildCount(cell); i++) {
for (let i = 0; i < model.getChildCount(cell); i += 1) {
const child = model.getChildAt(cell, i);
if (this.hasLayout(child)) {
@ -423,8 +432,8 @@ class mxLayoutManager extends mxEventSource {
try {
let last = null;
for (let i = 0; i < cells.length; i++) {
if (cells[i] != model.getRoot() && cells[i] != last) {
for (let i = 0; i < cells.length; i += 1) {
if (cells[i] !== model.getRoot() && cells[i] !== last) {
this.executeLayout(cells[i], bubble);
last = cells[i];
}

View File

@ -3,6 +3,8 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxUtils from '../util/mxUtils';
import mxResources from '../util/mxResources';
class mxMultiplicity {
/**
@ -181,8 +183,8 @@ class mxMultiplicity {
) {
if (
this.countError != null &&
((this.source && (this.max == 0 || sourceOut >= this.max)) ||
(!this.source && (this.max == 0 || targetIn >= this.max)))
((this.source && (this.max === 0 || sourceOut >= this.max)) ||
(!this.source && (this.max === 0 || targetIn >= this.max)))
) {
error += `${this.countError}\n`;
}
@ -248,11 +250,11 @@ class mxMultiplicity {
*/
checkType = (graph, value, type, attr, attrValue) => {
if (value != null) {
if (!isNaN(value.nodeType)) {
if (!Number.isNaN(value.nodeType)) {
// Checks if value is a DOM node
return mxUtils.isNode(value, type, attr, attrValue);
}
return value == type;
return value === type;
}
return false;
};

View File

@ -11,8 +11,9 @@ import mxRectangle from '../util/mxRectangle';
import mxRectangleShape from '../shape/mxRectangleShape';
import mxGraph from './mxGraph';
import mxImageShape from '../shape/mxImageShape';
import mxEvent from "../util/mxEvent";
import mxUtils from "../util/mxUtils";
import mxEvent from '../util/mxEvent';
import mxUtils from '../util/mxUtils';
import mxClient from '../mxClient';
class mxOutline {
/**
@ -456,7 +457,7 @@ class mxOutline {
availableWidth / completeWidth,
availableHeight / completeHeight
);
let scale = isNaN(outlineScale)
let scale = Number.isNaN(outlineScale)
? this.minScale
: Math.max(this.minScale, outlineScale);

View File

@ -556,7 +556,7 @@ class mxPrintPreview {
);
if (cov != null) {
for (let i = 0; i < cov.length; i++) {
for (let i = 0; i < cov.length; i += 1) {
addPage(cov[i], true);
}
}
@ -568,7 +568,7 @@ class mxPrintPreview {
// Appends each page to the page output for printing, making
// sure there will be a page break after each page (ie. div)
for (let i = 0; i < vpages; i++) {
for (let i = 0; i < vpages; i += 1) {
const dy =
(i * availableHeight) / this.scale -
this.y0 / this.scale +
@ -608,7 +608,7 @@ class mxPrintPreview {
}
if (apx != null) {
for (let i = 0; i < apx.length; i++) {
for (let i = 0; i < apx.length; i += 1) {
addPage(apx[i], i < apx.length - 1);
}
}
@ -730,7 +730,7 @@ class mxPrintPreview {
const tbody = doc.createElement('tbody');
for (let i = 0; i < vpages; i++) {
for (let i = 0; i < vpages; i += 1) {
const row = doc.createElement('tr');
for (let j = 0; j < hpages; j++) {

View File

@ -31,13 +31,13 @@ class mxSelectionChange {
this.selectionModel.updatingSelectionResource;
if (this.removed != null) {
for (let i = 0; i < this.removed.length; i++) {
for (let i = 0; i < this.removed.length; i += 1) {
this.selectionModel.cellRemoved(this.removed[i]);
}
}
if (this.added != null) {
for (let i = 0; i < this.added.length; i++) {
for (let i = 0; i < this.added.length; i += 1) {
this.selectionModel.cellAdded(this.added[i]);
}
}

View File

@ -210,7 +210,7 @@ class mxStylesheet {
}
// Parses each key, value pair into the existing style
for (let i = 0; i < pairs.length; i++) {
for (let i = 0; i < pairs.length; i += 1) {
const tmp = pairs[i];
const pos = tmp.indexOf('=');

View File

@ -239,7 +239,7 @@ class mxSwimlaneManager extends mxEventSource {
model.beginUpdate();
try {
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (!this.isSwimlaneIgnored(cells[i])) {
this.swimlaneAdded(cells[i]);
}
@ -267,7 +267,7 @@ class mxSwimlaneManager extends mxEventSource {
let geo = null;
// Finds the first valid sibling swimlane as reference
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(parent, i);
if (child != swimlane && !this.isSwimlaneIgnored(child)) {
@ -304,7 +304,7 @@ class mxSwimlaneManager extends mxEventSource {
model.beginUpdate();
try {
// Finds the top-level swimlanes and adds offsets
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
if (!this.isSwimlaneIgnored(cells[i])) {
const geo = model.getGeometry(cells[i]);
@ -389,7 +389,7 @@ class mxSwimlaneManager extends mxEventSource {
const childCount = model.getChildCount(swimlane);
for (let i = 0; i < childCount; i++) {
for (let i = 0; i < childCount; i += 1) {
const child = model.getChildAt(swimlane, i);
this.resizeSwimlane(child, w, h, horizontal);
}

View File

@ -95,7 +95,7 @@ class mxTemporaryCellStates {
// Validates the vertices and edges without adding them to
// the model so that the original cells are not modified
for (let i = 0; i < cells.length; i++) {
for (let i = 0; i < cells.length; i += 1) {
const bounds = view.getBoundingBox(
view.validateCellState(view.validateCell(cells[i]))
);