diff --git a/src/js/editor/mxDefaultPopupMenu.js b/src/js/editor/mxDefaultPopupMenu.js index 9f000ba86..25f1b79cd 100644 --- a/src/js/editor/mxDefaultPopupMenu.js +++ b/src/js/editor/mxDefaultPopupMenu.js @@ -2,6 +2,8 @@ * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxResources from "../util/mxResources"; +import mxUtils from "../util/mxUtils"; class mxDefaultPopupMenu { /** diff --git a/src/js/editor/mxDefaultToolbar.js b/src/js/editor/mxDefaultToolbar.js index e7a73bcb9..1aa77ff43 100644 --- a/src/js/editor/mxDefaultToolbar.js +++ b/src/js/editor/mxDefaultToolbar.js @@ -3,8 +3,10 @@ * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxClient from "../mxClient"; import mxToolbar from "../util/mxToolbar"; import mxGeometry from "../model/mxGeometry"; +import mxUtils from "../util/mxUtils"; class mxDefaultToolbar { /** diff --git a/src/js/editor/mxEditor.js b/src/js/editor/mxEditor.js index 3e66af47c..059094200 100644 --- a/src/js/editor/mxEditor.js +++ b/src/js/editor/mxEditor.js @@ -3,13 +3,23 @@ * Copyright (c) 2006-2019, draw.io AG */ -import mxDefaultPopupMenu from "FIXME"; +import mxDefaultPopupMenu from "./mxDefaultPopupMenu"; import mxUndoManager from "../util/mxUndoManager"; -import mxDefaultKeyHandler from "FIXME"; +import mxDefaultKeyHandler from "./mxDefaultKeyHandler"; import mxEventSource from "../util/mxEventSource"; import mxResources from "../util/mxResources"; import mxClient from "../mxClient"; -import mxDivResizer from "FIXME"; +import mxCompactTreeLayout from "../layout/mxCompactTreeLayout"; +import mxDefaultToolbar from "./mxDefaultToolbar"; +import mxStackLayout from "../layout/mxStackLayout"; +import mxEventObject from "../util/mxEventObject"; +import mxUtils from "../util/mxUtils"; +import mxCodec from "../io/mxCodec"; +import mxWindow from "../util/mxWindow"; +import mxForm from "../util/mxForm"; +import mxOutline from "../view/mxOutline"; +import mxCell from "../model/mxCell"; +import mxGeometry from "../model/mxGeometry"; /** * Installs the required language resources at class @@ -366,6 +376,8 @@ class mxEditor extends mxEventSource { * config - Optional XML node that contains the configuration. */ constructor(config) { + super(); + this.actions = []; this.addActions(); @@ -1557,7 +1569,7 @@ class mxEditor extends mxEventSource { var layoutMgr = new mxLayoutManager(graph); var self = this; // closure - layoutMgr.getLayout=(cell) { + layoutMgr.getLayout=(cell)=>{ var layout = null; var model = self.graph.getModel(); @@ -1653,7 +1665,7 @@ class mxEditor extends mxEventSource { graph.getView().addListener(mxEvent.UNDO, listener); // Keeps the selection state in sync - var undoHandler=(sender, evt) { + var undoHandler=(sender, evt)=>{ var changes = evt.getProperty('edit').changes; graph.setSelectionCells(graph.getSelectionCellsForChanges(changes)); }; @@ -1768,7 +1780,7 @@ class mxEditor extends mxEventSource { this.swimlaneSpacing, 2 * gs, 2 * gs); // Overrides isIgnored to only take into account swimlanes - layout.isVertexIgnored=(cell) { + layout.isVertexIgnored=(cell)=>{ return !layout.graph.isSwimlane(cell); }; @@ -2483,7 +2495,7 @@ class mxEditor extends mxEventSource { // Workaround for ignored iframe height 100% in FF if (mxClient.IS_NS) { - var handler=(sender) { + var handler=(sender)=>{ var h = wnd.div.offsetHeight; frame.setAttribute('height', (h - 26) + 'px'); }; diff --git a/src/js/handler/mxPanningHandler.js b/src/js/handler/mxPanningHandler.js index e93a40a3a..3bb144c2f 100644 --- a/src/js/handler/mxPanningHandler.js +++ b/src/js/handler/mxPanningHandler.js @@ -2,6 +2,9 @@ * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxEventSource from "../util/mxEventSource"; +import mxUtils from "../util/mxUtils"; +import mxEventObject from "../util/mxEventObject"; class mxPanningHandler extends mxEventSource { /** @@ -135,7 +138,8 @@ class mxPanningHandler extends mxEventSource { * event property contains the corresponding . */ constructor(graph) { - // super not called + super(); + if (graph != null) { this.graph = graph; this.graph.addMouseListener(this); @@ -160,7 +164,7 @@ class mxPanningHandler extends mxEventSource { if (this.isPinchEnabled()) { var evt = eo.getProperty('event'); - if (!mxEvent.isConsumed(evt) && evt.type == 'gesturestart') { + if (!mxEvent.isConsumed(evt) && evt.type === 'gesturestart') { this.initialScale = this.graph.view.scale; // Forces start of panning when pinch gesture starts @@ -168,7 +172,7 @@ class mxPanningHandler extends mxEventSource { this.start(this.mouseDownEvent); this.mouseDownEvent = null; } - } else if (evt.type == 'gestureend' && this.initialScale != null) { + } else if (evt.type === 'gestureend' && this.initialScale != null) { this.initialScale = null; } diff --git a/src/js/handler/mxPopupMenuHandler.js b/src/js/handler/mxPopupMenuHandler.js index d2eece206..01f6979d7 100644 --- a/src/js/handler/mxPopupMenuHandler.js +++ b/src/js/handler/mxPopupMenuHandler.js @@ -2,6 +2,7 @@ * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxPopupMenu from "../util/mxPopupMenu"; class mxPopupMenuHandler extends mxPopupMenu { /** @@ -65,7 +66,8 @@ class mxPopupMenuHandler extends mxPopupMenu { * Constructs an event handler that creates a . */ constructor(graph, factoryMethod) { - // super not called + //super(); + if (graph != null) { this.graph = graph; this.factoryMethod = factoryMethod; diff --git a/src/js/io/mxChildChangeCodec.js b/src/js/io/mxChildChangeCodec.js index c1202c655..9e1b7f2ec 100644 --- a/src/js/io/mxChildChangeCodec.js +++ b/src/js/io/mxChildChangeCodec.js @@ -3,7 +3,7 @@ * Copyright (c) 2006-2015, Gaudenz Alder */ -import mxObjectCodec from "FIXME"; +import mxObjectCodec from "./mxObjectCodec"; import mxChildChange from "FIXME"; import mxCodecRegistry from "./mxCodecRegistry"; diff --git a/src/js/io/mxCodec.js b/src/js/io/mxCodec.js index a98b4fb50..314e8c2a4 100644 --- a/src/js/io/mxCodec.js +++ b/src/js/io/mxCodec.js @@ -4,6 +4,7 @@ */ import mxUtils from "../util/mxUtils"; +import mxCellPath from "../model/mxCellPath"; class mxCodec { /** diff --git a/src/js/layout/hierarchical/stage/mxCoordinateAssignment.js b/src/js/layout/hierarchical/stage/mxCoordinateAssignment.js index 941da4deb..cc32b0ed4 100644 --- a/src/js/layout/hierarchical/stage/mxCoordinateAssignment.js +++ b/src/js/layout/hierarchical/stage/mxCoordinateAssignment.js @@ -2,6 +2,7 @@ * Copyright (c) 2006-2018, JGraph Ltd * Copyright (c) 2006-2018, Gaudenz Alder */ +import mxHierarchicalLayoutStage from "./mxHierarchicalLayoutStage"; class mxCoordinateAssignment extends mxHierarchicalLayoutStage { /** @@ -202,7 +203,8 @@ class mxCoordinateAssignment extends mxHierarchicalLayoutStage { */ constructor(layout, intraCellSpacing, interRankCellSpacing, orientation, initialX, parallelEdgeSpacing) { - // super not called + super(); + this.layout = layout; this.intraCellSpacing = intraCellSpacing; this.interRankCellSpacing = interRankCellSpacing; diff --git a/src/js/layout/hierarchical/stage/mxMedianHybridCrossingReduction.js b/src/js/layout/hierarchical/stage/mxMedianHybridCrossingReduction.js index 8d19a981d..0b3720e09 100644 --- a/src/js/layout/hierarchical/stage/mxMedianHybridCrossingReduction.js +++ b/src/js/layout/hierarchical/stage/mxMedianHybridCrossingReduction.js @@ -2,6 +2,7 @@ * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxHierarchicalLayoutStage from "./mxHierarchicalLayoutStage"; class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage { /** @@ -23,7 +24,8 @@ class mxMedianHybridCrossingReduction extends mxHierarchicalLayoutStage { * initialX - the leftmost coordinate node placement starts at */ constructor(layout) { - // super not called + super(); + this.layout = layout; }; diff --git a/src/js/layout/hierarchical/stage/mxMinimumCycleRemover.js b/src/js/layout/hierarchical/stage/mxMinimumCycleRemover.js index 2c8defa1e..168743554 100644 --- a/src/js/layout/hierarchical/stage/mxMinimumCycleRemover.js +++ b/src/js/layout/hierarchical/stage/mxMinimumCycleRemover.js @@ -2,6 +2,7 @@ * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxHierarchicalLayoutStage from "./mxHierarchicalLayoutStage"; class mxMinimumCycleRemover extends mxHierarchicalLayoutStage { /** @@ -22,7 +23,8 @@ class mxMinimumCycleRemover extends mxHierarchicalLayoutStage { * Creates a cycle remover for the given internal model. */ constructor(layout) { - // constructor not called + super(); + this.layout = layout; }; diff --git a/src/js/layout/hierarchical/stage/mxSwimlaneOrdering.js b/src/js/layout/hierarchical/stage/mxSwimlaneOrdering.js index 7c80816fb..d4d889c45 100644 --- a/src/js/layout/hierarchical/stage/mxSwimlaneOrdering.js +++ b/src/js/layout/hierarchical/stage/mxSwimlaneOrdering.js @@ -2,6 +2,7 @@ * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxHierarchicalLayoutStage from "./mxHierarchicalLayoutStage"; class mxSwimlaneOrdering extends mxHierarchicalLayoutStage { /** @@ -22,7 +23,8 @@ class mxSwimlaneOrdering extends mxHierarchicalLayoutStage { * Creates a cycle remover for the given internal model. */ constructor(layout) { - // super not called + super(); + this.layout = layout; }; diff --git a/src/js/layout/mxFastOrganicLayout.js b/src/js/layout/mxFastOrganicLayout.js index 8b690aea1..dac537275 100644 --- a/src/js/layout/mxFastOrganicLayout.js +++ b/src/js/layout/mxFastOrganicLayout.js @@ -2,30 +2,10 @@ * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxGraphLayout from "./mxGraphLayout"; +import mxObjectIdentity from "FIXME"; class mxFastOrganicLayout extends mxGraphLayout { - /** - * Class: mxFastOrganicLayout - * - * Extends to implement a fast organic layout algorithm. - * The vertices need to be connected for this layout to work, vertices - * with no connections are ignored. - * - * Example: - * - * (code) - * var layout = new mxFastOrganicLayout(graph); - * layout.execute(graph.getDefaultParent()); - * (end) - * - * Constructor: mxCompactTreeLayout - * - * Constructs a new fast organic layout for the specified graph. - */ - constructor(graph) { - super(graph); - }; - /** * Variable: useInputOrigin * @@ -188,6 +168,28 @@ class mxFastOrganicLayout extends mxGraphLayout { */ allowedToRun = true; + /** + * Class: mxFastOrganicLayout + * + * Extends to implement a fast organic layout algorithm. + * The vertices need to be connected for this layout to work, vertices + * with no connections are ignored. + * + * Example: + * + * (code) + * var layout = new mxFastOrganicLayout(graph); + * layout.execute(graph.getDefaultParent()); + * (end) + * + * Constructor: mxCompactTreeLayout + * + * Constructs a new fast organic layout for the specified graph. + */ + constructor(graph) { + super(graph); + }; + /** * Function: isVertexIgnored * @@ -199,7 +201,7 @@ class mxFastOrganicLayout extends mxGraphLayout { * vertex - whose ignored state should be returned. */ isVertexIgnored = (vertex) => { - return isVertexIgnored.apply(this, arguments) || + return super.isVertexIgnored(vertex) || this.graph.getConnections(vertex).length == 0; }; diff --git a/src/js/model/mxCellPath.js b/src/js/model/mxCellPath.js index 525f3ff0b..1f4dbd11a 100644 --- a/src/js/model/mxCellPath.js +++ b/src/js/model/mxCellPath.js @@ -2,9 +2,7 @@ * Copyright (c) 2006-2015, JGraph Ltd * Copyright (c) 2006-2015, Gaudenz Alder */ -var mxCellPath = -{ - +var mxCellPath = { /** * Class: mxCellPath * @@ -27,16 +25,13 @@ var mxCellPath = * * cell - Cell whose path should be returned. */ - create: (cell)=> - { + create: (cell) => { var result = ''; - if (cell != null) - { + if (cell != null) { var parent = cell.getParent(); - while (parent != null) - { + while (parent != null) { var index = parent.getIndex(cell); result = index + mxCellPath.PATH_SEPARATOR + result; @@ -48,8 +43,7 @@ var mxCellPath = // Removes trailing separator var n = result.length; - if (n > 1) - { + if (n > 1) { result = result.substring(0, n - 1); } @@ -66,18 +60,13 @@ var mxCellPath = * * path - Path whose parent path should be returned. */ - getParentPath: (path)=> - { - if (path != null) - { + getParentPath: (path) => { + if (path != null) { var index = path.lastIndexOf(mxCellPath.PATH_SEPARATOR); - if (index >= 0) - { + if (index >= 0) { return path.substring(0, index); - } - else if (path.length > 0) - { + } else if (path.length > 0) { return ''; } } @@ -96,16 +85,13 @@ var mxCellPath = * root - Root cell of the path to be resolved. * path - String that defines the path. */ - resolve: (root, path)=> - { + resolve: (root, path) => { var parent = root; - if (path != null) - { + if (path != null) { var tokens = path.split(mxCellPath.PATH_SEPARATOR); - for (var i=0; i - { + compare: (p1, p2) => { var min = Math.min(p1.length, p2.length); var comp = 0; - for (var i = 0; i < min; i++) - { - if (p1[i] != p2[i]) - { + for (var i = 0; i < min; i++) { + if (p1[i] != p2[i]) { if (p1[i].length == 0 || - p2[i].length == 0) - { + p2[i].length == 0) { comp = (p1[i] == p2[i]) ? 0 : ((p1[i] > p2[i]) ? 1 : -1); - } - else - { + } else { var t1 = parseInt(p1[i]); var t2 = parseInt(p2[i]); @@ -146,20 +126,17 @@ var mxCellPath = } // Compares path length if both paths are equal to this point - if (comp === 0) - { + if (comp === 0) { var t1 = p1.length; var t2 = p2.length; - if (t1 !== t2) - { + if (t1 !== t2) { comp = (t1 > t2) ? 1 : -1; } } return comp; } - }; export default mxCellPath; diff --git a/src/js/util/mxAnimation.js b/src/js/util/mxAnimation.js index d301f9685..fb111d583 100644 --- a/src/js/util/mxAnimation.js +++ b/src/js/util/mxAnimation.js @@ -36,6 +36,7 @@ class mxAnimation extends mxEventSource { * graph - Reference to the enclosing . */ constructor(delay) { + super(); this.delay = (delay != null) ? delay : 20; }; diff --git a/src/js/util/mxAutoSaveManager.js b/src/js/util/mxAutoSaveManager.js index 8a4624131..af72c1edc 100644 --- a/src/js/util/mxAutoSaveManager.js +++ b/src/js/util/mxAutoSaveManager.js @@ -96,6 +96,8 @@ class mxAutoSaveManager extends mxEventSource { * graph - Reference to the enclosing graph. */ constructor(graph) { + super(); + // Notifies the manager of a change this.changeHandler = mxUtils.bind(this, (sender, evt) => { if (this.isEnabled()) { diff --git a/src/js/util/mxPopupMenu.js b/src/js/util/mxPopupMenu.js index 07724bebe..7123404c4 100644 --- a/src/js/util/mxPopupMenu.js +++ b/src/js/util/mxPopupMenu.js @@ -34,6 +34,7 @@ class mxPopupMenu extends mxEventSource { * Fires after the menu has been shown in . */ constructor(factoryMethod) { + super(); this.factoryMethod = factoryMethod; if (factoryMethod != null) { diff --git a/src/js/util/mxSvgCanvas2D.js b/src/js/util/mxSvgCanvas2D.js index 26f4842fa..ac86c056f 100644 --- a/src/js/util/mxSvgCanvas2D.js +++ b/src/js/util/mxSvgCanvas2D.js @@ -5,6 +5,7 @@ import mxUtils from "./mxUtils"; import mxConstants from "./mxConstants"; +import mxAbstractCanvas2D from "./mxAbstractCanvas2D"; /** * Capability check for DOM parser and checks if base tag is used. @@ -28,7 +29,6 @@ let mxSvgCanvas2useAbsoluteIds = !mxClient.IS_CHROMEAPP && !mxClient.IS_EDGE && document.getElementsByTagName('base').length > 0; */ - */ class mxSvgCanvas2D extends mxAbstractCanvas2D { /** * Variable: path @@ -1181,9 +1181,7 @@ class mxSvgCanvas2D extends mxAbstractCanvas2D { /** * Updates existing DOM nodes for text rendering. */ - mxSvgCanvas2D -. - createCss = (w, h, align, valign, wrap, overflow, clip, bg, border, flex, block, s, callback) => { + static createCss = (w, h, align, valign, wrap, overflow, clip, bg, border, flex, block, s, callback) => { var item = 'box-sizing: border-box; font-size: 0; text-align: ' + ((align == mxConstants.ALIGN_LEFT) ? 'left' : ((align == mxConstants.ALIGN_RIGHT) ? 'right' : 'center')) + '; '; var pt = mxUtils.getAlignmentAsPoint(align, valign); diff --git a/src/js/util/mxToolbar.js b/src/js/util/mxToolbar.js index a3caaea75..ec55eab0e 100644 --- a/src/js/util/mxToolbar.js +++ b/src/js/util/mxToolbar.js @@ -4,6 +4,7 @@ */ import mxUtils from "./mxUtils"; +import mxEvent from "./mxEvent"; import mxPoint from "./mxPoint"; import mxPopupMenu from "./mxPopupMenu"; import mxEventSource from "./mxEventSource"; @@ -67,6 +68,7 @@ class mxToolbar extends mxEventSource { * container - DOM node that contains the toolbar. */ constructor(container) { + super(); this.container = container; }; diff --git a/src/js/util/mxUndoManager.js b/src/js/util/mxUndoManager.js index 3f3275f5c..bdeed02b3 100644 --- a/src/js/util/mxUndoManager.js +++ b/src/js/util/mxUndoManager.js @@ -3,6 +3,7 @@ * Copyright (c) 2006-2015, Gaudenz Alder */ +import mxEvent from "./mxEvent"; import mxEventObject from "./mxEventObject"; import mxEventSource from "./mxEventSource"; @@ -98,6 +99,7 @@ class mxUndoManager extends mxEventSource { * size is given, then a default size of 100 steps is used. */ constructor(size) { + super(); this.size = (size != null) ? size : 100; this.clear(); }; diff --git a/src/js/util/mxWindow.js b/src/js/util/mxWindow.js index a8f4336b0..81add3b58 100644 --- a/src/js/util/mxWindow.js +++ b/src/js/util/mxWindow.js @@ -265,6 +265,8 @@ class mxWindow extends mxEventSource { * mxWindow. */ constructor(title, content, x, y, width, height, minimizable, movable, replaceNode, style) { + super(); + if (content != null) { minimizable = (minimizable != null) ? minimizable : true; this.content = content; diff --git a/src/js/view/mxCellOverlay.js b/src/js/view/mxCellOverlay.js index 5160a5ce5..18a0ccde1 100644 --- a/src/js/view/mxCellOverlay.js +++ b/src/js/view/mxCellOverlay.js @@ -3,7 +3,7 @@ * Copyright (c) 2006-2015, Gaudenz Alder */ -import mxPoint from "FIXME"; +import mxPoint from "../util/mxPoint"; import mxRectangle from "../util/mxRectangle"; class mxCellOverlay extends mxEventSource { @@ -117,7 +117,8 @@ class mxCellOverlay extends mxEventSource { * (default). */ constructor(image, tooltip, align, verticalAlign, offset, cursor) { - // no super + super(); + this.image = image; this.tooltip = tooltip; this.align = (align != null) ? align : this.align; diff --git a/src/js/view/mxGraph.js b/src/js/view/mxGraph.js index 8b4ff32df..4eb6eafd6 100644 --- a/src/js/view/mxGraph.js +++ b/src/js/view/mxGraph.js @@ -1487,6 +1487,8 @@ class mxGraph extends mxEventSource { * stylesheet - Optional to be used in the graph. */ constructor(container, model, renderHint, stylesheet) { + super(); + // Initializes the variable in case the prototype has been // modified to hold some listeners (which is possible because // the createHandlers call is executed regardless of the diff --git a/src/js/view/mxGraphSelectionModel.js b/src/js/view/mxGraphSelectionModel.js index e2cf27c25..a2851b980 100644 --- a/src/js/view/mxGraphSelectionModel.js +++ b/src/js/view/mxGraphSelectionModel.js @@ -81,6 +81,8 @@ class mxGraphSelectionModel extends mxEventSource { * graph - Reference to the enclosing . */ constructor(graph) { + super(); + this.graph = graph; this.cells = []; }; diff --git a/src/js/view/mxGraphView.js b/src/js/view/mxGraphView.js index 6d6596855..c9c37b2b1 100644 --- a/src/js/view/mxGraphView.js +++ b/src/js/view/mxGraphView.js @@ -191,6 +191,8 @@ class mxGraphView extends mxEventSource { * graph - Reference to the enclosing . */ constructor(graph) { + super(); + this.graph = graph; this.translate = new mxPoint(); this.graphBounds = new mxRectangle(); diff --git a/src/js/view/mxLayoutManager.js b/src/js/view/mxLayoutManager.js index 971fb5e24..df526ce33 100644 --- a/src/js/view/mxLayoutManager.js +++ b/src/js/view/mxLayoutManager.js @@ -81,6 +81,8 @@ class mxLayoutManager extends mxEventSource { * graph - Reference to the enclosing graph. */ constructor(graph) { + super(); + // Executes the layout before the changes are dispatched this.undoHandler = (sender, evt) => { if (this.isEnabled()) { diff --git a/src/js/view/mxSwimlaneManager.js b/src/js/view/mxSwimlaneManager.js index 928187875..0cf67427a 100644 --- a/src/js/view/mxSwimlaneManager.js +++ b/src/js/view/mxSwimlaneManager.js @@ -71,6 +71,8 @@ class mxSwimlaneManager extends mxEventSource { * graph - Reference to the enclosing graph. */ constructor(graph, horizontal, addEnabled, resizeEnabled) { + super(); + this.horizontal = (horizontal != null) ? horizontal : true; this.addEnabled = (addEnabled != null) ? addEnabled : true; this.resizeEnabled = (resizeEnabled != null) ? resizeEnabled : true;