started making large-scale (but risky!) batch conversion of js syntax

development
mcyph 2021-03-19 22:38:25 +11:00
parent c3fdcf4676
commit 22aade3c1f
138 changed files with 4095 additions and 4171 deletions

View File

@ -470,7 +470,7 @@ class mxDefaultToolbar {
sprite.setAttribute('src', img.getAttribute('src'));
// Handles delayed loading of the images
let loader = mxUtils.bind(this, function(evt) {
let loader = mxUtils.bind(this, (evt)=> {
// Preview uses the image node with double size. Later this can be
// changed to use a separate preview and guides, but for this the
// dropHandler must use the additional x- and y-arguments and the

View File

@ -333,7 +333,7 @@ class mxEditor extends mxEventSource {
* graph, the following code can be used.
*
* (code)
* editor.addListener(mxEvent.AFTER_ADD_VERTEX, function(sender, evt)
* editor.addListener(mxEvent.AFTER_ADD_VERTEX, (sender, evt)=>
* {
* var vertex = evt.getProperty('vertex');
*
@ -561,7 +561,7 @@ class mxEditor extends mxEventSource {
* To handle a singleclick, use the following code.
*
* (code)
* editor.graph.addListener(mxEvent.CLICK, function(sender, evt)
* editor.graph.addListener(mxEvent.CLICK, (sender, evt)=>
* {
* var e = evt.getProperty('event');
* var cell = evt.getProperty('cell');
@ -1415,7 +1415,7 @@ class mxEditor extends mxEventSource {
*
* Example:
* (code)
* editor.addAction('test', function(editor, cell)
* editor.addAction('test', (editor, cell)=>
* {
* mxUtils.alert("test "+cell);
* });
@ -2094,7 +2094,7 @@ class mxEditor extends mxEventSource {
* following code.
*
* (code)
* editor.addListener(mxEvent.POST, function(sender, evt)
* editor.addListener(mxEvent.POST, (sender, evt)=>
* {
* // Process response (replace diagram)
* var req = evt.getProperty('request');
@ -2400,7 +2400,7 @@ class mxEditor extends mxEventSource {
*
* (code)
* var oldShowTasks = showTasks;
* showTasks = function()
* showTasks = ()=>
* {
* oldShowTasks.apply(this, arguments); // "supercall"
*

View File

@ -27,7 +27,7 @@ function mxCellHighlight(graph, highlightColor, strokeWidth, dashed)
this.opacity = mxConstants.HIGHLIGHT_OPACITY;
// Updates the marker if the graph changes
this.repaintHandler = mxUtils.bind(this, function()
this.repaintHandler = mxUtils.bind(this, ()=>{
{
// Updates reference to state
if (this.state != null)
@ -52,7 +52,7 @@ function mxCellHighlight(graph, highlightColor, strokeWidth, dashed)
this.graph.getModel().addListener(mxEvent.CHANGE, this.repaintHandler);
// Hides the marker if the current root changes
this.resetHandler = mxUtils.bind(this, function()
this.resetHandler = mxUtils.bind(this, ()=>{
{
this.hide();
});
@ -68,21 +68,21 @@ function mxCellHighlight(graph, highlightColor, strokeWidth, dashed)
* Specifies if the highlights should appear on top of everything
* else in the overlay pane. Default is false.
*/
mxCellHighlight.prototype.keepOnTop = false;
keepOnTop = false;
/**
* Variable: graph
*
* Reference to the enclosing <mxGraph>.
*/
mxCellHighlight.prototype.graph = null;
graph = null;
/**
* Variable: state
*
* Reference to the <mxCellState>.
*/
mxCellHighlight.prototype.state = null;
state = null;
/**
* Variable: spacing
@ -90,7 +90,7 @@ mxCellHighlight.prototype.state = null;
* Specifies the spacing between the highlight for vertices and the vertex.
* Default is 2.
*/
mxCellHighlight.prototype.spacing = 2;
spacing = 2;
/**
* Variable: resetHandler
@ -98,7 +98,7 @@ mxCellHighlight.prototype.spacing = 2;
* Holds the handler that automatically invokes reset if the highlight
* should be hidden.
*/
mxCellHighlight.prototype.resetHandler = null;
resetHandler = null;
/**
* Function: setHighlightColor
@ -109,7 +109,7 @@ mxCellHighlight.prototype.resetHandler = null;
*
* color - String that represents the new highlight color.
*/
mxCellHighlight.prototype.setHighlightColor = function(color)
setHighlightColor = (color)=>{
{
this.highlightColor = color;
@ -124,7 +124,7 @@ mxCellHighlight.prototype.setHighlightColor = function(color)
*
* Creates and returns the highlight shape for the given state.
*/
mxCellHighlight.prototype.drawHighlight = function()
drawHighlight = ()=>{
{
this.shape = this.createShape();
this.repaint();
@ -140,7 +140,7 @@ mxCellHighlight.prototype.drawHighlight = function()
*
* Creates and returns the highlight shape for the given state.
*/
mxCellHighlight.prototype.createShape = function()
createShape = ()=>{
{
var shape = this.graph.cellRenderer.createShape(this.state);
@ -173,7 +173,7 @@ mxCellHighlight.prototype.createShape = function()
*
* Returns the stroke width.
*/
mxCellHighlight.prototype.getStrokeWidth = function(state)
getStrokeWidth = (state)=>{
{
return this.strokeWidth;
};
@ -183,7 +183,7 @@ mxCellHighlight.prototype.getStrokeWidth = function(state)
*
* Updates the highlight after a change of the model or view.
*/
mxCellHighlight.prototype.repaint = function()
repaint = ()=>{
{
if (this.state != null && this.shape != null)
{
@ -237,7 +237,7 @@ mxCellHighlight.prototype.repaint = function()
*
* Resets the state of the cell marker.
*/
mxCellHighlight.prototype.hide = function()
hide = ()=>{
{
this.highlight(null);
};
@ -247,7 +247,7 @@ mxCellHighlight.prototype.hide = function()
*
* Marks the <markedState> and fires a <mark> event.
*/
mxCellHighlight.prototype.highlight = function(state)
highlight = (state)=>{
{
if (this.state != state)
{
@ -271,7 +271,7 @@ mxCellHighlight.prototype.highlight = function(state)
*
* Returns true if this highlight is at the given position.
*/
mxCellHighlight.prototype.isHighlightAt = function(x, y)
isHighlightAt = (x, y)=>{
{
var hit = false;
@ -300,7 +300,7 @@ mxCellHighlight.prototype.isHighlightAt = function(x, y)
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxCellHighlight.prototype.destroy = function()
destroy = ()=>{
{
this.graph.getView().removeListener(this.resetHandler);
this.graph.getView().removeListener(this.repaintHandler);

View File

@ -13,12 +13,12 @@
* (code)
* var marker = new mxCellMarker(graph);
* graph.addMouseListener({
* mouseDown: function() {},
* mouseMove: function(sender, me)
* mouseDown: ()=> {},
* mouseMove: (sender, me)=>
* {
* marker.process(me);
* },
* mouseUp: function() {}
* mouseUp: ()=> {}
* });
* (end)
*
@ -67,14 +67,14 @@ mxUtils.extend(mxCellMarker, mxEventSource);
*
* Reference to the enclosing <mxGraph>.
*/
mxCellMarker.prototype.graph = null;
graph = null;
/**
* Variable: enabled
*
* Specifies if the marker is enabled. Default is true.
*/
mxCellMarker.prototype.enabled = true;
enabled = true;
/**
* Variable: hotspot
@ -84,49 +84,49 @@ mxCellMarker.prototype.enabled = true;
* as the hotspot. Possible values are between 0 and 1. Default is
* mxConstants.DEFAULT_HOTSPOT.
*/
mxCellMarker.prototype.hotspot = mxConstants.DEFAULT_HOTSPOT;
hotspot = mxConstants.DEFAULT_HOTSPOT;
/**
* Variable: hotspotEnabled
*
* Specifies if the hotspot is enabled. Default is false.
*/
mxCellMarker.prototype.hotspotEnabled = false;
hotspotEnabled = false;
/**
* Variable: validColor
*
* Holds the valid marker color.
*/
mxCellMarker.prototype.validColor = null;
validColor = null;
/**
* Variable: invalidColor
*
* Holds the invalid marker color.
*/
mxCellMarker.prototype.invalidColor = null;
invalidColor = null;
/**
* Variable: currentColor
*
* Holds the current marker color.
*/
mxCellMarker.prototype.currentColor = null;
currentColor = null;
/**
* Variable: validState
*
* Holds the marked <mxCellState> if it is valid.
*/
mxCellMarker.prototype.validState = null;
validState = null;
/**
* Variable: markedState
*
* Holds the marked <mxCellState>.
*/
mxCellMarker.prototype.markedState = null;
markedState = null;
/**
* Function: setEnabled
@ -138,7 +138,7 @@ mxCellMarker.prototype.markedState = null;
*
* enabled - Boolean that specifies the new enabled state.
*/
mxCellMarker.prototype.setEnabled = function(enabled)
setEnabled = (enabled)=>
{
this.enabled = enabled;
};
@ -149,7 +149,7 @@ mxCellMarker.prototype.setEnabled = function(enabled)
* Returns true if events are handled. This implementation
* returns <enabled>.
*/
mxCellMarker.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -159,7 +159,7 @@ mxCellMarker.prototype.isEnabled = function()
*
* Sets the <hotspot>.
*/
mxCellMarker.prototype.setHotspot = function(hotspot)
setHotspot = (hotspot)=>
{
this.hotspot = hotspot;
};
@ -169,7 +169,7 @@ mxCellMarker.prototype.setHotspot = function(hotspot)
*
* Returns the <hotspot>.
*/
mxCellMarker.prototype.getHotspot = function()
getHotspot = ()=>
{
return this.hotspot;
};
@ -179,7 +179,7 @@ mxCellMarker.prototype.getHotspot = function()
*
* Specifies whether the hotspot should be used in <intersects>.
*/
mxCellMarker.prototype.setHotspotEnabled = function(enabled)
setHotspotEnabled = (enabled)=>
{
this.hotspotEnabled = enabled;
};
@ -189,7 +189,7 @@ mxCellMarker.prototype.setHotspotEnabled = function(enabled)
*
* Returns true if hotspot is used in <intersects>.
*/
mxCellMarker.prototype.isHotspotEnabled = function()
isHotspotEnabled = ()=>
{
return this.hotspotEnabled;
};
@ -199,7 +199,7 @@ mxCellMarker.prototype.isHotspotEnabled = function()
*
* Returns true if <validState> is not null.
*/
mxCellMarker.prototype.hasValidState = function()
hasValidState = ()=>
{
return this.validState != null;
};
@ -209,7 +209,7 @@ mxCellMarker.prototype.hasValidState = function()
*
* Returns the <validState>.
*/
mxCellMarker.prototype.getValidState = function()
getValidState = ()=>
{
return this.validState;
};
@ -219,7 +219,7 @@ mxCellMarker.prototype.getValidState = function()
*
* Returns the <markedState>.
*/
mxCellMarker.prototype.getMarkedState = function()
getMarkedState = ()=>
{
return this.markedState;
};
@ -229,7 +229,7 @@ mxCellMarker.prototype.getMarkedState = function()
*
* Resets the state of the cell marker.
*/
mxCellMarker.prototype.reset = function()
reset = ()=>
{
this.validState = null;
@ -250,7 +250,7 @@ mxCellMarker.prototype.reset = function()
* regardless of the marker color. The state is returned regardless of the
* marker color and valid state.
*/
mxCellMarker.prototype.process = function(me)
process = (me)=>
{
var state = null;
@ -268,7 +268,7 @@ mxCellMarker.prototype.process = function(me)
*
* Sets and marks the current valid state.
*/
mxCellMarker.prototype.setCurrentState = function(state, me, color)
setCurrentState = (state, me, color)=>
{
var isValid = (state != null) ? this.isValidState(state) : false;
color = (color != null) ? color : this.getMarkerColor(me.getEvent(), state, isValid);
@ -304,7 +304,7 @@ mxCellMarker.prototype.setCurrentState = function(state, me, color)
*
* Marks the given cell using the given color, or <validColor> if no color is specified.
*/
mxCellMarker.prototype.markCell = function(cell, color)
markCell = (cell, color)=>
{
var state = this.graph.getView().getState(cell);
@ -321,7 +321,7 @@ mxCellMarker.prototype.markCell = function(cell, color)
*
* Marks the <markedState> and fires a <mark> event.
*/
mxCellMarker.prototype.mark = function()
mark = ()=>
{
this.highlight.setHighlightColor(this.currentColor);
this.highlight.highlight(this.markedState);
@ -333,7 +333,7 @@ mxCellMarker.prototype.mark = function()
*
* Hides the marker and fires a <mark> event.
*/
mxCellMarker.prototype.unmark = function()
unmark = ()=>
{
this.mark();
};
@ -345,7 +345,7 @@ mxCellMarker.prototype.unmark = function()
* returns true, then the state is stored in <validState>. The return value
* of this method is used as the argument for <getMarkerColor>.
*/
mxCellMarker.prototype.isValidState = function(state)
isValidState = (state)=>
{
return true;
};
@ -356,7 +356,7 @@ mxCellMarker.prototype.isValidState = function(state)
* Returns the valid- or invalidColor depending on the value of isValid.
* The given <mxCellState> is ignored by this implementation.
*/
mxCellMarker.prototype.getMarkerColor = function(evt, state, isValid)
getMarkerColor = (evt, state, isValid)=>
{
return (isValid) ? this.validColor : this.invalidColor;
};
@ -367,7 +367,7 @@ mxCellMarker.prototype.getMarkerColor = function(evt, state, isValid)
* Uses <getCell>, <getStateToMark> and <intersects> to return the
* <mxCellState> for the given <mxMouseEvent>.
*/
mxCellMarker.prototype.getState = function(me)
getState = (me)=>
{
var view = this.graph.getView();
var cell = this.getCell(me);
@ -382,7 +382,7 @@ mxCellMarker.prototype.getState = function(me)
* Returns the <mxCell> for the given event and cell. This returns the
* given cell.
*/
mxCellMarker.prototype.getCell = function(me)
getCell = (me)=>
{
return me.getCell();
};
@ -393,7 +393,7 @@ mxCellMarker.prototype.getCell = function(me)
* Returns the <mxCellState> to be marked for the given <mxCellState> under
* the mouse. This returns the given state.
*/
mxCellMarker.prototype.getStateToMark = function(state)
getStateToMark = (state)=>
{
return state;
};
@ -405,7 +405,7 @@ mxCellMarker.prototype.getStateToMark = function(state)
* This returns true if the <hotspot> is 0 or the coordinates are inside
* the hotspot for the given cell state.
*/
mxCellMarker.prototype.intersects = function(state, me)
intersects = (state, me)=>
{
if (this.hotspotEnabled)
{
@ -422,7 +422,7 @@ mxCellMarker.prototype.intersects = function(state, me)
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxCellMarker.prototype.destroy = function()
destroy = ()=>
{
this.graph.getView().removeListener(this.resetHandler);
this.graph.getModel().removeListener(this.resetHandler);

View File

@ -20,8 +20,8 @@
* graph.addMouseListener(
* {
* cell: null,
* mouseDown: function(sender, me) { },
* mouseMove: function(sender, me)
* mouseDown: (sender, me)=> { },
* mouseMove: (sender, me)=>
* {
* var tmp = me.getCell();
*
@ -45,16 +45,16 @@
* this.dragOver(me.getEvent(), this.cell);
* }
* },
* mouseUp: function(sender, me) { },
* dragEnter: function(evt, cell)
* mouseUp: (sender, me)=> { },
* dragEnter: (evt, cell)=>
* {
* mxLog.debug('dragEnter', cell.value);
* },
* dragOver: function(evt, cell)
* dragOver: (evt, cell)=>
* {
* mxLog.debug('dragOver', cell.value);
* },
* dragLeave: function(evt, cell)
* dragLeave: (evt, cell)=>
* {
* mxLog.debug('dragLeave', cell.value);
* }
@ -86,7 +86,7 @@ function mxCellTracker(graph, color, funct)
// Automatic deallocation of memory
if (mxClient.IS_IE)
{
mxEvent.addListener(window, 'unload', mxUtils.bind(this, function()
mxEvent.addListener(window, 'unload', mxUtils.bind(this, ()=>
{
this.destroy();
}));
@ -103,7 +103,7 @@ mxUtils.extend(mxCellTracker, mxCellMarker);
*
* Ignores the event. The event is not consumed.
*/
mxCellTracker.prototype.mouseDown = function(sender, me) { };
mouseDown = (sender, me)=> { };
/**
* Function: mouseMove
@ -111,7 +111,7 @@ mxCellTracker.prototype.mouseDown = function(sender, me) { };
* Handles the event by highlighting the cell under the mousepointer if it
* is over the hotspot region of the cell.
*/
mxCellTracker.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
if (this.isEnabled())
{
@ -124,7 +124,7 @@ mxCellTracker.prototype.mouseMove = function(sender, me)
*
* Handles the event by reseting the highlight.
*/
mxCellTracker.prototype.mouseUp = function(sender, me) { };
mouseUp = (sender, me)=> { };
/**
* Function: destroy
@ -133,13 +133,13 @@ mxCellTracker.prototype.mouseUp = function(sender, me) { };
* normally need to be called. It is called automatically when the window
* unloads.
*/
mxCellTracker.prototype.destroy = function()
destroy = ()=>
{
if (!this.destroyed)
{
this.destroyed = true;
this.graph.removeMouseListener(this);
mxCellMarker.prototype.destroy.apply(this);
destroy.apply(this);
}
};

View File

@ -13,7 +13,7 @@
* Example:
*
* (code)
* new mxConnectionHandler(graph, function(source, target, style)
* new mxConnectionHandler(graph, (source, target, style)=>
* {
* edge = new mxCell('', new mxGeometry());
* edge.setEdge(true);
@ -27,8 +27,8 @@
* new edges by overriding <insertEdge>.
*
* (code)
* mxConnectionHandlerInsertEdge = mxConnectionHandler.prototype.insertEdge;
* mxConnectionHandler.prototype.insertEdge = function(parent, id, value, source, target, style)
* mxConnectionHandlerInsertEdge = insertEdge;
* insertEdge = (parent, id, value, source, target, style)=>
* {
* value = 'Test';
*
@ -88,7 +88,7 @@
* be assigned a new <mxImage> instance:
*
* (code)
* mxConnectionHandler.prototype.connectImage = new mxImage('images/green-dot.gif', 14, 14);
* connectImage = new mxImage('images/green-dot.gif', 14, 14);
* (end)
*
* This will use the green-dot.gif with a width and height of 14 pixels as the
@ -123,7 +123,7 @@
* the port IDs, use <mxGraphModel.getCell>.
*
* (code)
* graph.connectionHandler.addListener(mxEvent.CONNECT, function(sender, evt)
* graph.connectionHandler.addListener(mxEvent.CONNECT, (sender, evt)=>
* {
* var edge = evt.getProperty('cell');
* var source = graph.getModel().getTerminal(edge, true);
@ -169,7 +169,7 @@ function mxConnectionHandler(graph, factoryMethod)
this.init();
// Handles escape keystrokes
this.escapeHandler = mxUtils.bind(this, function(sender, evt)
this.escapeHandler = mxUtils.bind(this, (sender, evt)=>
{
this.reset();
});
@ -188,7 +188,7 @@ mxUtils.extend(mxConnectionHandler, mxEventSource);
*
* Reference to the enclosing <mxGraph>.
*/
mxConnectionHandler.prototype.graph = null;
graph = null;
/**
* Variable: factoryMethod
@ -197,7 +197,7 @@ mxConnectionHandler.prototype.graph = null;
* source and target <mxCell> as the first and second argument and returns
* a new <mxCell> that represents the edge. This is used in <createEdge>.
*/
mxConnectionHandler.prototype.factoryMethod = true;
factoryMethod = true;
/**
* Variable: moveIconFront
@ -207,7 +207,7 @@ mxConnectionHandler.prototype.factoryMethod = true;
* the connect icon. This has precendence over <moveIconBack> when set
* to true. Default is false.
*/
mxConnectionHandler.prototype.moveIconFront = false;
moveIconFront = false;
/**
* Variable: moveIconBack
@ -216,7 +216,7 @@ mxConnectionHandler.prototype.moveIconFront = false;
* be set to true if the icons of the connection handler conflict with other
* handles, such as the vertex label move handle. Default is false.
*/
mxConnectionHandler.prototype.moveIconBack = false;
moveIconBack = false;
/**
* Variable: connectImage
@ -224,7 +224,7 @@ mxConnectionHandler.prototype.moveIconBack = false;
* <mxImage> that is used to trigger the creation of a new connection. This
* is used in <createIcons>. Default is null.
*/
mxConnectionHandler.prototype.connectImage = null;
connectImage = null;
/**
* Variable: targetConnectImage
@ -232,21 +232,21 @@ mxConnectionHandler.prototype.connectImage = null;
* Specifies if the connect icon should be centered on the target state
* while connections are being previewed. Default is false.
*/
mxConnectionHandler.prototype.targetConnectImage = false;
targetConnectImage = false;
/**
* Variable: enabled
*
* Specifies if events are handled. Default is true.
*/
mxConnectionHandler.prototype.enabled = true;
enabled = true;
/**
* Variable: select
*
* Specifies if new edges should be selected. Default is true.
*/
mxConnectionHandler.prototype.select = true;
select = true;
/**
* Variable: createTarget
@ -258,14 +258,14 @@ mxConnectionHandler.prototype.select = true;
* the source cell and the newly created vertex in <createTargetVertex>, which
* can be overridden to create a new target. Default is false.
*/
mxConnectionHandler.prototype.createTarget = false;
createTarget = false;
/**
* Variable: marker
*
* Holds the <mxTerminalMarker> used for finding source and target cells.
*/
mxConnectionHandler.prototype.marker = null;
marker = null;
/**
* Variable: constraintHandler
@ -273,14 +273,14 @@ mxConnectionHandler.prototype.marker = null;
* Holds the <mxConstraintHandler> used for drawing and highlighting
* constraints.
*/
mxConnectionHandler.prototype.constraintHandler = null;
constraintHandler = null;
/**
* Variable: error
*
* Holds the current validation error while connections are being created.
*/
mxConnectionHandler.prototype.error = null;
error = null;
/**
* Variable: waypointsEnabled
@ -288,7 +288,7 @@ mxConnectionHandler.prototype.error = null;
* Specifies if single clicks should add waypoints on the new edge. Default is
* false.
*/
mxConnectionHandler.prototype.waypointsEnabled = false;
waypointsEnabled = false;
/**
* Variable: ignoreMouseDown
@ -297,7 +297,7 @@ mxConnectionHandler.prototype.waypointsEnabled = false;
* button when highlighting the source. Default is false, that is, the
* handler only highlights the source if no button is being pressed.
*/
mxConnectionHandler.prototype.ignoreMouseDown = false;
ignoreMouseDown = false;
/**
* Variable: first
@ -305,7 +305,7 @@ mxConnectionHandler.prototype.ignoreMouseDown = false;
* Holds the <mxPoint> where the mouseDown took place while the handler is
* active.
*/
mxConnectionHandler.prototype.first = null;
first = null;
/**
* Variable: connectIconOffset
@ -315,7 +315,7 @@ mxConnectionHandler.prototype.first = null;
* Note that placing the icon under the mouse pointer with an
* offset of (0,0) will affect hit detection.
*/
mxConnectionHandler.prototype.connectIconOffset = new mxPoint(0, mxConstants.TOOLTIP_VERTICAL_OFFSET);
connectIconOffset = new mxPoint(0, mxConstants.TOOLTIP_VERTICAL_OFFSET);
/**
* Variable: edgeState
@ -323,21 +323,21 @@ mxConnectionHandler.prototype.connectIconOffset = new mxPoint(0, mxConstants.TOO
* Optional <mxCellState> that represents the preview edge while the
* handler is active. This is created in <createEdgeState>.
*/
mxConnectionHandler.prototype.edgeState = null;
edgeState = null;
/**
* Variable: changeHandler
*
* Holds the change event listener for later removal.
*/
mxConnectionHandler.prototype.changeHandler = null;
changeHandler = null;
/**
* Variable: drillHandler
*
* Holds the drill event listener for later removal.
*/
mxConnectionHandler.prototype.drillHandler = null;
drillHandler = null;
/**
* Variable: mouseDownCounter
@ -345,7 +345,7 @@ mxConnectionHandler.prototype.drillHandler = null;
* Counts the number of mouseDown events since the start. The initial mouse
* down event counts as 1.
*/
mxConnectionHandler.prototype.mouseDownCounter = 0;
mouseDownCounter = 0;
/**
* Variable: movePreviewAway
@ -354,7 +354,7 @@ mxConnectionHandler.prototype.mouseDownCounter = 0;
* where the preview cannot be made transparent to events and if the built-in hit detection on
* the HTML elements in the page should be used. Default is the value of <mxClient.IS_VML>.
*/
mxConnectionHandler.prototype.movePreviewAway = mxClient.IS_VML;
movePreviewAway = mxClient.IS_VML;
/**
* Variable: outlineConnect
@ -363,7 +363,7 @@ mxConnectionHandler.prototype.movePreviewAway = mxClient.IS_VML;
* enabled. This will allow to place the connection point along the outline of
* the highlighted target. Default is false.
*/
mxConnectionHandler.prototype.outlineConnect = false;
outlineConnect = false;
/**
* Variable: livePreview
@ -371,14 +371,14 @@ mxConnectionHandler.prototype.outlineConnect = false;
* Specifies if the actual shape of the edge state should be used for the preview.
* Default is false. (Ignored if no edge state is created in <createEdgeState>.)
*/
mxConnectionHandler.prototype.livePreview = false;
livePreview = false;
/**
* Variable: cursor
*
* Specifies the cursor to be used while the handler is active. Default is null.
*/
mxConnectionHandler.prototype.cursor = null;
cursor = null;
/**
* Variable: insertBeforeSource
@ -386,7 +386,7 @@ mxConnectionHandler.prototype.cursor = null;
* Specifies if new edges should be inserted before the source vertex in the
* cell hierarchy. Default is false for backwards compatibility.
*/
mxConnectionHandler.prototype.insertBeforeSource = false;
insertBeforeSource = false;
/**
* Function: isEnabled
@ -394,7 +394,7 @@ mxConnectionHandler.prototype.insertBeforeSource = false;
* Returns true if events are handled. This implementation
* returns <enabled>.
*/
mxConnectionHandler.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -409,7 +409,7 @@ mxConnectionHandler.prototype.isEnabled = function()
*
* enabled - Boolean that specifies the new enabled state.
*/
mxConnectionHandler.prototype.setEnabled = function(enabled)
setEnabled = (enabled)=>
{
this.enabled = enabled;
};
@ -428,7 +428,7 @@ mxConnectionHandler.prototype.setEnabled = function(enabled)
* dropTarget - <mxCell> that represents the cell under the mouse when it was
* released.
*/
mxConnectionHandler.prototype.isInsertBefore = function(edge, source, target, evt, dropTarget)
isInsertBefore = (edge, source, target, evt, dropTarget)=>
{
return this.insertBeforeSource && source != target;
};
@ -442,7 +442,7 @@ mxConnectionHandler.prototype.isInsertBefore = function(edge, source, target, ev
*
* evt - Current active native pointer event.
*/
mxConnectionHandler.prototype.isCreateTarget = function(evt)
isCreateTarget = (evt)=>
{
return this.createTarget;
};
@ -452,7 +452,7 @@ mxConnectionHandler.prototype.isCreateTarget = function(evt)
*
* Sets <createTarget>.
*/
mxConnectionHandler.prototype.setCreateTarget = function(value)
setCreateTarget = (value)=>
{
this.createTarget = value;
};
@ -462,7 +462,7 @@ mxConnectionHandler.prototype.setCreateTarget = function(value)
*
* Creates the preview shape for new connections.
*/
mxConnectionHandler.prototype.createShape = function()
createShape = ()=>
{
// Creates the edge preview
var shape = (this.livePreview && this.edgeState != null) ?
@ -486,14 +486,14 @@ mxConnectionHandler.prototype.createShape = function()
* be invoked if <mxGraph.container> is assigned after the connection
* handler has been created.
*/
mxConnectionHandler.prototype.init = function()
init = ()=>
{
this.graph.addMouseListener(this);
this.marker = this.createMarker();
this.constraintHandler = new mxConstraintHandler(this.graph);
// Redraws the icons if the graph changes
this.changeHandler = mxUtils.bind(this, function(sender)
this.changeHandler = mxUtils.bind(this, (sender)=>
{
if (this.iconState != null)
{
@ -517,7 +517,7 @@ mxConnectionHandler.prototype.init = function()
this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE, this.changeHandler);
// Removes the icon if we step into/up or start editing
this.drillHandler = mxUtils.bind(this, function(sender)
this.drillHandler = mxUtils.bind(this, (sender)=>
{
this.reset();
});
@ -533,7 +533,7 @@ mxConnectionHandler.prototype.init = function()
* Returns true if the given cell is connectable. This is a hook to
* disable floating connections. This implementation returns true.
*/
mxConnectionHandler.prototype.isConnectableCell = function(cell)
isConnectableCell = (cell)=>
{
return true;
};
@ -543,16 +543,16 @@ mxConnectionHandler.prototype.isConnectableCell = function(cell)
*
* Creates and returns the <mxCellMarker> used in <marker>.
*/
mxConnectionHandler.prototype.createMarker = function()
createMarker = ()=>
{
var marker = new mxCellMarker(this.graph);
marker.hotspotEnabled = true;
// Overrides to return cell at location only if valid (so that
// there is no highlight for invalid cells)
marker.getCell = mxUtils.bind(this, function(me)
marker.getCell = mxUtils.bind(this, (me)=>
{
var cell = mxCellMarker.prototype.getCell.apply(marker, arguments);
var cell = getCell.apply(marker, arguments);
this.error = null;
// Checks for cell at preview point (with grid)
@ -614,7 +614,7 @@ mxConnectionHandler.prototype.createMarker = function()
});
// Sets the highlight color according to validateConnection
marker.isValidState = mxUtils.bind(this, function(state)
marker.isValidState = mxUtils.bind(this, (state)=>
{
if (this.isConnecting())
{
@ -622,29 +622,29 @@ mxConnectionHandler.prototype.createMarker = function()
}
else
{
return mxCellMarker.prototype.isValidState.apply(marker, arguments);
return isValidState.apply(marker, arguments);
}
});
// Overrides to use marker color only in highlight mode or for
// target selection
marker.getMarkerColor = mxUtils.bind(this, function(evt, state, isValid)
marker.getMarkerColor = mxUtils.bind(this, (evt, state, isValid)=>
{
return (this.connectImage == null || this.isConnecting()) ?
mxCellMarker.prototype.getMarkerColor.apply(marker, arguments) :
getMarkerColor.apply(marker, arguments) :
null;
});
// Overrides to use hotspot only for source selection otherwise
// intersects always returns true when over a cell
marker.intersects = mxUtils.bind(this, function(state, evt)
marker.intersects = mxUtils.bind(this, (state, evt)=>
{
if (this.connectImage != null || this.isConnecting())
{
return true;
}
return mxCellMarker.prototype.intersects.apply(marker, arguments);
return intersects.apply(marker, arguments);
});
return marker;
@ -655,7 +655,7 @@ mxConnectionHandler.prototype.createMarker = function()
*
* Starts a new connection for the given state and coordinates.
*/
mxConnectionHandler.prototype.start = function(state, x, y, edgeState)
start = (state, x, y, edgeState)=>
{
this.previous = state;
this.first = new mxPoint(x, y);
@ -675,7 +675,7 @@ mxConnectionHandler.prototype.start = function(state, x, y, edgeState)
* Returns true if the source terminal has been clicked and a new
* connection is currently being previewed.
*/
mxConnectionHandler.prototype.isConnecting = function()
isConnecting = ()=>
{
return this.first != null && this.shape != null;
};
@ -690,7 +690,7 @@ mxConnectionHandler.prototype.isConnecting = function()
* cell - <mxCell> that represents the source terminal.
* me - <mxMouseEvent> that is associated with this call.
*/
mxConnectionHandler.prototype.isValidSource = function(cell, me)
isValidSource = (cell, me)=>
{
return this.graph.isValidSource(cell);
};
@ -706,7 +706,7 @@ mxConnectionHandler.prototype.isValidSource = function(cell, me)
*
* cell - <mxCell> that represents the target terminal.
*/
mxConnectionHandler.prototype.isValidTarget = function(cell)
isValidTarget = (cell)=>
{
return true;
};
@ -723,7 +723,7 @@ mxConnectionHandler.prototype.isValidTarget = function(cell)
* source - <mxCell> that represents the source terminal.
* target - <mxCell> that represents the target terminal.
*/
mxConnectionHandler.prototype.validateConnection = function(source, target)
validateConnection = (source, target)=>
{
if (!this.isValidTarget(target))
{
@ -743,7 +743,7 @@ mxConnectionHandler.prototype.validateConnection = function(source, target)
*
* state - <mxCellState> whose connect image should be returned.
*/
mxConnectionHandler.prototype.getConnectImage = function(state)
getConnectImage = (state)=>
{
return this.connectImage;
};
@ -758,7 +758,7 @@ mxConnectionHandler.prototype.getConnectImage = function(state)
*
* state - <mxCellState> whose connect icons should be returned.
*/
mxConnectionHandler.prototype.isMoveIconToFrontForState = function(state)
isMoveIconToFrontForState = (state)=>
{
if (state.text != null && state.text.node.parentNode == this.graph.container)
{
@ -778,7 +778,7 @@ mxConnectionHandler.prototype.isMoveIconToFrontForState = function(state)
*
* state - <mxCellState> whose connect icons should be returned.
*/
mxConnectionHandler.prototype.createIcons = function(state)
createIcons = (state)=>
{
var image = this.getConnectImage(state);
@ -816,13 +816,13 @@ mxConnectionHandler.prototype.createIcons = function(state)
icon.node.style.cursor = mxConstants.CURSOR_CONNECT;
// Events transparency
var getState = mxUtils.bind(this, function()
var getState = mxUtils.bind(this, ()=>
{
return (this.currentState != null) ? this.currentState : state;
});
// Updates the local icon before firing the mouse down event.
var mouseDown = mxUtils.bind(this, function(evt)
var mouseDown = mxUtils.bind(this, (evt)=>
{
if (!mxEvent.isConsumed(evt))
{
@ -852,7 +852,7 @@ mxConnectionHandler.prototype.createIcons = function(state)
*
* icons - Optional array of <mxImageShapes> to be redrawn.
*/
mxConnectionHandler.prototype.redrawIcons = function(icons, state)
redrawIcons = (icons, state)=>
{
if (icons != null && icons[0] != null && state != null)
{
@ -873,7 +873,7 @@ mxConnectionHandler.prototype.redrawIcons = function(icons, state)
* icon - The connect icon of <mxImageShape> with the mouse.
* state - <mxCellState> under the mouse.
*/
mxConnectionHandler.prototype.getIconPosition = function(icon, state)
getIconPosition = (icon, state)=>
{
var scale = this.graph.getView().scale;
var cx = state.getCenterX();
@ -908,7 +908,7 @@ mxConnectionHandler.prototype.getIconPosition = function(icon, state)
*
* Destroys the connect icons and resets the respective state.
*/
mxConnectionHandler.prototype.destroyIcons = function()
destroyIcons = ()=>
{
if (this.icons != null)
{
@ -933,7 +933,7 @@ mxConnectionHandler.prototype.destroyIcons = function()
* <constraintHandler> are not null, or <previous> and <error> are not null and
* <icons> is null or <icons> and <icon> are not null.
*/
mxConnectionHandler.prototype.isStartEvent = function(me)
isStartEvent = (me)=>
{
return ((this.constraintHandler.currentFocus != null && this.constraintHandler.currentConstraint != null) ||
(this.previous != null && this.error == null && (this.icons == null || (this.icons != null &&
@ -945,7 +945,7 @@ mxConnectionHandler.prototype.isStartEvent = function(me)
*
* Handles the event by initiating a new connection.
*/
mxConnectionHandler.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
this.mouseDownCounter++;
@ -1003,7 +1003,7 @@ mxConnectionHandler.prototype.mouseDown = function(sender, me)
* connecting. This implementation returns true if the state is not movable
* in the graph.
*/
mxConnectionHandler.prototype.isImmediateConnectSource = function(state)
isImmediateConnectSource = (state)=>
{
return !this.graph.isCellMovable(state.cell);
};
@ -1017,7 +1017,7 @@ mxConnectionHandler.prototype.isImmediateConnectSource = function(state)
* Use the following code to create a preview for an existing edge style:
*
* (code)
* graph.connectionHandler.createEdgeState = function(me)
* graph.connectionHandler.createEdgeState = (me)=>
* {
* var edge = graph.createEdge(null, null, null, null, null, 'edgeStyle=elbowEdgeStyle');
*
@ -1025,7 +1025,7 @@ mxConnectionHandler.prototype.isImmediateConnectSource = function(state)
* };
* (end)
*/
mxConnectionHandler.prototype.createEdgeState = function(me)
createEdgeState = (me)=>
{
return null;
};
@ -1036,7 +1036,7 @@ mxConnectionHandler.prototype.createEdgeState = function(me)
* Returns true if <outlineConnect> is true and the source of the event is the outline shape
* or shift is pressed.
*/
mxConnectionHandler.prototype.isOutlineConnectEvent = function(me)
isOutlineConnectEvent = (me)=>
{
var offset = mxUtils.getOffset(this.graph.container);
var evt = me.getEvent();
@ -1065,7 +1065,7 @@ mxConnectionHandler.prototype.isOutlineConnectEvent = function(me)
* Updates the current state for a given mouse move event by using
* the <marker>.
*/
mxConnectionHandler.prototype.updateCurrentState = function(me, point)
updateCurrentState = (me, point)=>
{
this.constraintHandler.update(me, this.first == null, false, (this.first == null ||
me.isSource(this.marker.highlight.shape)) ? null : point);
@ -1186,7 +1186,7 @@ mxConnectionHandler.prototype.updateCurrentState = function(me, point)
* Returns true if the given cell allows new connections to be created. This implementation
* always returns true.
*/
mxConnectionHandler.prototype.isCellEnabled = function(cell)
isCellEnabled = (cell)=>
{
return true;
};
@ -1196,7 +1196,7 @@ mxConnectionHandler.prototype.isCellEnabled = function(cell)
*
* Converts the given point from screen coordinates to model coordinates.
*/
mxConnectionHandler.prototype.convertWaypoint = function(point)
convertWaypoint = (point)=>
{
var scale = this.graph.getView().getScale();
var tr = this.graph.getView().getTranslate();
@ -1211,7 +1211,7 @@ mxConnectionHandler.prototype.convertWaypoint = function(point)
* Called to snap the given point to the current preview. This snaps to the
* first point of the preview if alt is not pressed.
*/
mxConnectionHandler.prototype.snapToPreview = function(me, point)
snapToPreview = (me, point)=>
{
if (!mxEvent.isAltDown(me.getEvent()) && this.previous != null)
{
@ -1237,7 +1237,7 @@ mxConnectionHandler.prototype.snapToPreview = function(me, point)
* Handles the event by updating the preview edge or by highlighting
* a possible source or target terminal.
*/
mxConnectionHandler.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
if (!me.isConsumed() && (this.ignoreMouseDown || this.first != null || !this.graph.isMouseDown))
{
@ -1504,7 +1504,7 @@ mxConnectionHandler.prototype.mouseMove = function(sender, me)
*
* Updates <edgeState>.
*/
mxConnectionHandler.prototype.updateEdgeState = function(current, constraint)
updateEdgeState = (current, constraint)=>
{
// TODO: Use generic method for writing constraint to style
if (this.sourceConstraint != null && this.sourceConstraint.point != null)
@ -1567,7 +1567,7 @@ mxConnectionHandler.prototype.updateEdgeState = function(current, constraint)
* state - <mxCellState> that represents the target cell state.
* me - <mxMouseEvent> that represents the mouse move.
*/
mxConnectionHandler.prototype.getTargetPerimeterPoint = function(state, me)
getTargetPerimeterPoint = (state, me)=>
{
var result = null;
var view = state.view;
@ -1606,7 +1606,7 @@ mxConnectionHandler.prototype.getTargetPerimeterPoint = function(state, me)
* next - <mxPoint> that represents the next point along the previewed edge.
* me - <mxMouseEvent> that represents the mouse move.
*/
mxConnectionHandler.prototype.getSourcePerimeterPoint = function(state, next, me)
getSourcePerimeterPoint = (state, next, me)=>
{
var result = null;
var view = state.view;
@ -1656,7 +1656,7 @@ mxConnectionHandler.prototype.getSourcePerimeterPoint = function(state, next, me
* icons - Array of currently displayed icons.
* me - <mxMouseEvent> that contains the mouse event.
*/
mxConnectionHandler.prototype.updateIcons = function(state, icons, me)
updateIcons = (state, icons, me)=>
{
// empty
};
@ -1669,7 +1669,7 @@ mxConnectionHandler.prototype.updateIcons = function(state, icons, me)
* called if <waypointsEnabled> is true. This implemtation returns true
* if there is a cell state in the given event.
*/
mxConnectionHandler.prototype.isStopEvent = function(me)
isStopEvent = (me)=>
{
return me.getState() != null;
};
@ -1679,7 +1679,7 @@ mxConnectionHandler.prototype.isStopEvent = function(me)
*
* Adds the waypoint for the given event to <waypoints>.
*/
mxConnectionHandler.prototype.addWaypointForEvent = function(me)
addWaypointForEvent = (me)=>
{
var point = mxUtils.convertPoint(this.graph.container, me.getX(), me.getY());
var dx = Math.abs(point.x - this.first.x);
@ -1708,7 +1708,7 @@ mxConnectionHandler.prototype.addWaypointForEvent = function(me)
* implementation returns true if the constraints are not pointing to the
* same fixed connection point.
*/
mxConnectionHandler.prototype.checkConstraints = function(c1, c2)
checkConstraints = (c1, c2)=>
{
return (c1 == null || c2 == null || c1.point == null || c2.point == null ||
!c1.point.equals(c2.point) || c1.dx != c2.dx || c1.dy != c2.dy ||
@ -1720,7 +1720,7 @@ mxConnectionHandler.prototype.checkConstraints = function(c1, c2)
*
* Handles the event by inserting the new connection.
*/
mxConnectionHandler.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
if (!me.isConsumed() && this.isConnecting())
{
@ -1788,7 +1788,7 @@ mxConnectionHandler.prototype.mouseUp = function(sender, me)
*
* Resets the state of this handler.
*/
mxConnectionHandler.prototype.reset = function()
reset = ()=>
{
if (this.shape != null)
{
@ -1823,7 +1823,7 @@ mxConnectionHandler.prototype.reset = function()
* Redraws the preview edge using the color and width returned by
* <getEdgeColor> and <getEdgeWidth>.
*/
mxConnectionHandler.prototype.drawPreview = function()
drawPreview = ()=>
{
this.updatePreview(this.error == null);
this.shape.redraw();
@ -1840,7 +1840,7 @@ mxConnectionHandler.prototype.drawPreview = function()
* valid - Boolean indicating if the color for a valid edge should be
* returned.
*/
mxConnectionHandler.prototype.updatePreview = function(valid)
updatePreview = (valid)=>
{
this.shape.strokewidth = this.getEdgeWidth(valid);
this.shape.stroke = this.getEdgeColor(valid);
@ -1857,7 +1857,7 @@ mxConnectionHandler.prototype.updatePreview = function(valid)
* valid - Boolean indicating if the color for a valid edge should be
* returned.
*/
mxConnectionHandler.prototype.getEdgeColor = function(valid)
getEdgeColor = (valid)=>
{
return (valid) ? mxConstants.VALID_COLOR : mxConstants.INVALID_COLOR;
};
@ -1873,7 +1873,7 @@ mxConnectionHandler.prototype.getEdgeColor = function(valid)
* valid - Boolean indicating if the width for a valid edge should be
* returned.
*/
mxConnectionHandler.prototype.getEdgeWidth = function(valid)
getEdgeWidth = (valid)=>
{
return (valid) ? 3 : 1;
};
@ -1892,7 +1892,7 @@ mxConnectionHandler.prototype.getEdgeWidth = function(valid)
* dropTarget - <mxCell> that represents the cell under the mouse when it was
* released.
*/
mxConnectionHandler.prototype.connect = function(source, target, evt, dropTarget)
connect = (source, target, evt, dropTarget)=>
{
if (target != null || this.isCreateTarget(evt) || this.graph.allowDanglingEdges)
{
@ -2060,7 +2060,7 @@ mxConnectionHandler.prototype.connect = function(source, target, evt, dropTarget
* Selects the given edge after adding a new connection. The target argument
* contains the target vertex if one has been inserted.
*/
mxConnectionHandler.prototype.selectCells = function(edge, target)
selectCells = (edge, target)=>
{
this.graph.setSelectionCell(edge);
};
@ -2072,7 +2072,7 @@ mxConnectionHandler.prototype.selectCells = function(edge, target)
* implementation does only use <createEdge> if <factoryMethod> is defined,
* otherwise <mxGraph.insertEdge> will be used.
*/
mxConnectionHandler.prototype.insertEdge = function(parent, id, value, source, target, style)
insertEdge = (parent, id, value, source, target, style)=>
{
if (this.factoryMethod == null)
{
@ -2099,7 +2099,7 @@ mxConnectionHandler.prototype.insertEdge = function(parent, id, value, source, t
* evt - Mousedown event of the connect gesture.
* source - <mxCell> that represents the source terminal.
*/
mxConnectionHandler.prototype.createTargetVertex = function(evt, source)
createTargetVertex = (evt, source)=>
{
// Uses the first non-relative source
var geo = this.graph.getCellGeometry(source);
@ -2154,7 +2154,7 @@ mxConnectionHandler.prototype.createTargetVertex = function(evt, source)
*
* Returns the tolerance for aligning new targets to sources. This returns the grid size / 2.
*/
mxConnectionHandler.prototype.getAlignmentTolerance = function(evt)
getAlignmentTolerance = (evt)=>
{
return (this.graph.isGridEnabled()) ? this.graph.gridSize / 2 : this.graph.tolerance;
};
@ -2174,7 +2174,7 @@ mxConnectionHandler.prototype.getAlignmentTolerance = function(evt)
* target - <mxCell> that represents the target terminal.
* style - Optional style from the preview edge.
*/
mxConnectionHandler.prototype.createEdge = function(value, source, target, style)
createEdge = (value, source, target, style)=>
{
var edge = null;
@ -2205,7 +2205,7 @@ mxConnectionHandler.prototype.createEdge = function(value, source, target, style
* called on all instances. It is called automatically for the built-in
* instance created for each <mxGraph>.
*/
mxConnectionHandler.prototype.destroy = function()
destroy = ()=>
{
this.graph.removeMouseListener(this);

View File

@ -25,7 +25,7 @@ function mxConstraintHandler(graph)
this.graph = graph;
// Adds a graph model listener to update the current focus on changes
this.resetHandler = mxUtils.bind(this, function(sender, evt)
this.resetHandler = mxUtils.bind(this, (sender, evt)=>
{
if (this.currentFocus != null && this.graph.view.getState(this.currentFocus.cell) == null)
{
@ -49,28 +49,28 @@ function mxConstraintHandler(graph)
*
* <mxImage> to be used as the image for fixed connection points.
*/
mxConstraintHandler.prototype.pointImage = new mxImage(mxClient.imageBasePath + '/point.gif', 5, 5);
pointImage = new mxImage(mxClient.imageBasePath + '/point.gif', 5, 5);
/**
* Variable: graph
*
* Reference to the enclosing <mxGraph>.
*/
mxConstraintHandler.prototype.graph = null;
graph = null;
/**
* Variable: enabled
*
* Specifies if events are handled. Default is true.
*/
mxConstraintHandler.prototype.enabled = true;
enabled = true;
/**
* Variable: highlightColor
*
* Specifies the color for the highlight. Default is <mxConstants.DEFAULT_VALID_COLOR>.
*/
mxConstraintHandler.prototype.highlightColor = mxConstants.DEFAULT_VALID_COLOR;
highlightColor = mxConstants.DEFAULT_VALID_COLOR;
/**
* Function: isEnabled
@ -78,7 +78,7 @@ mxConstraintHandler.prototype.highlightColor = mxConstants.DEFAULT_VALID_COLOR;
* Returns true if events are handled. This implementation
* returns <enabled>.
*/
mxConstraintHandler.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -93,7 +93,7 @@ mxConstraintHandler.prototype.isEnabled = function()
*
* enabled - Boolean that specifies the new enabled state.
*/
mxConstraintHandler.prototype.setEnabled = function(enabled)
setEnabled = (enabled)=>
{
this.enabled = enabled;
};
@ -103,7 +103,7 @@ mxConstraintHandler.prototype.setEnabled = function(enabled)
*
* Resets the state of this handler.
*/
mxConstraintHandler.prototype.reset = function()
reset = ()=>
{
if (this.focusIcons != null)
{
@ -138,7 +138,7 @@ mxConstraintHandler.prototype.reset = function()
*
* me - <mxMouseEvent> whose tolerance should be returned.
*/
mxConstraintHandler.prototype.getTolerance = function(me)
getTolerance = (me)=>
{
return this.graph.getTolerance();
};
@ -148,7 +148,7 @@ mxConstraintHandler.prototype.getTolerance = function(me)
*
* Returns the tolerance to be used for intersecting connection points.
*/
mxConstraintHandler.prototype.getImageForConstraint = function(state, constraint, point)
getImageForConstraint = (state, constraint, point)=>
{
return this.pointImage;
};
@ -159,7 +159,7 @@ mxConstraintHandler.prototype.getImageForConstraint = function(state, constraint
* Returns true if the given <mxMouseEvent> should be ignored in <update>. This
* implementation always returns false.
*/
mxConstraintHandler.prototype.isEventIgnored = function(me, source)
isEventIgnored = (me, source)=>
{
return false;
};
@ -169,7 +169,7 @@ mxConstraintHandler.prototype.isEventIgnored = function(me, source)
*
* Returns true if the given state should be ignored. This always returns false.
*/
mxConstraintHandler.prototype.isStateIgnored = function(state, source)
isStateIgnored = (state, source)=>
{
return false;
};
@ -179,7 +179,7 @@ mxConstraintHandler.prototype.isStateIgnored = function(state, source)
*
* Destroys the <focusIcons> if they exist.
*/
mxConstraintHandler.prototype.destroyIcons = function()
destroyIcons = ()=>
{
if (this.focusIcons != null)
{
@ -198,7 +198,7 @@ mxConstraintHandler.prototype.destroyIcons = function()
*
* Destroys the <focusHighlight> if one exists.
*/
mxConstraintHandler.prototype.destroyFocusHighlight = function()
destroyFocusHighlight = ()=>
{
if (this.focusHighlight != null)
{
@ -213,7 +213,7 @@ mxConstraintHandler.prototype.destroyFocusHighlight = function()
* Returns true if the current focused state should not be changed for the given event.
* This returns true if shift and alt are pressed.
*/
mxConstraintHandler.prototype.isKeepFocusEvent = function(me)
isKeepFocusEvent = (me)=>
{
return mxEvent.isShiftDown(me.getEvent());
};
@ -223,7 +223,7 @@ mxConstraintHandler.prototype.isKeepFocusEvent = function(me)
*
* Returns the cell for the given event.
*/
mxConstraintHandler.prototype.getCellForEvent = function(me, point)
getCellForEvent = (me, point)=>
{
var cell = me.getCell();
@ -253,14 +253,14 @@ mxConstraintHandler.prototype.getCellForEvent = function(me, point)
* Updates the state of this handler based on the given <mxMouseEvent>.
* Source is a boolean indicating if the cell is a source or target.
*/
mxConstraintHandler.prototype.update = function(me, source, existingEdge, point)
update = (me, source, existingEdge, point)=>
{
if (this.isEnabled() && !this.isEventIgnored(me))
{
// Lazy installation of mouseleave handler
if (this.mouseleaveHandler == null && this.graph.container != null)
{
this.mouseleaveHandler = mxUtils.bind(this, function()
this.mouseleaveHandler = mxUtils.bind(this, ()=>
{
this.reset();
});
@ -324,7 +324,7 @@ mxConstraintHandler.prototype.update = function(me, source, existingEdge, point)
hl.init(this.graph.getView().getOverlayPane());
this.focusHighlight = hl;
var getState = mxUtils.bind(this, function()
var getState = mxUtils.bind(this, ()=>
{
return (this.currentFocus != null) ? this.currentFocus : state;
});
@ -358,7 +358,7 @@ mxConstraintHandler.prototype.update = function(me, source, existingEdge, point)
* the handler is not enabled then the outline is painted, but the constraints
* are ignored.
*/
mxConstraintHandler.prototype.redraw = function()
redraw = ()=>
{
if (this.currentFocus != null && this.constraints != null && this.focusIcons != null)
{
@ -388,7 +388,7 @@ mxConstraintHandler.prototype.redraw = function()
* the handler is not enabled then the outline is painted, but the constraints
* are ignored.
*/
mxConstraintHandler.prototype.setFocus = function(me, state, source)
setFocus = (me, state, source)=>
{
this.constraints = (state != null && !this.isStateIgnored(state, source) &&
this.graph.isCellConnectable(state.cell)) ? ((this.isEnabled()) ?
@ -431,7 +431,7 @@ mxConstraintHandler.prototype.setFocus = function(me, state, source)
// Fixes lost event tracking for images in quirks / IE8 standards
if (mxClient.IS_QUIRKS || document.documentMode == 8)
{
mxEvent.addListener(icon.node, 'dragstart', function(evt)
mxEvent.addListener(icon.node, 'dragstart', (evt)=>
{
mxEvent.consume(evt);
@ -445,7 +445,7 @@ mxConstraintHandler.prototype.setFocus = function(me, state, source)
icon.node.parentNode.insertBefore(icon.node, icon.node.parentNode.firstChild);
}
var getState = mxUtils.bind(this, function()
var getState = mxUtils.bind(this, ()=>
{
return (this.currentFocus != null) ? this.currentFocus : state;
});
@ -474,7 +474,7 @@ mxConstraintHandler.prototype.setFocus = function(me, state, source)
*
* Returns true if the given icon intersects the given point.
*/
mxConstraintHandler.prototype.createHighlightShape = function()
createHighlightShape = ()=>
{
var hl = new mxRectangleShape(null, this.highlightColor, this.highlightColor, mxConstants.HIGHLIGHT_STROKEWIDTH);
hl.opacity = mxConstants.HIGHLIGHT_OPACITY;
@ -487,7 +487,7 @@ mxConstraintHandler.prototype.createHighlightShape = function()
*
* Returns true if the given icon intersects the given rectangle.
*/
mxConstraintHandler.prototype.intersects = function(icon, mouse, source, existingEdge)
intersects = (icon, mouse, source, existingEdge)=>
{
return mxUtils.intersects(icon.bounds, mouse);
};
@ -497,7 +497,7 @@ mxConstraintHandler.prototype.intersects = function(icon, mouse, source, existin
*
* Destroy this handler.
*/
mxConstraintHandler.prototype.destroy = function()
destroy = ()=>
{
this.reset();

View File

@ -13,8 +13,8 @@
* To enable adding/removing control points, the following code can be used:
*
* (code)
* mxEdgeHandler.prototype.addEnabled = true;
* mxEdgeHandler.prototype.removeEnabled = true;
* addEnabled = true;
* removeEnabled = true;
* (end)
*
* Note: This experimental feature is not recommended for production use.
@ -35,7 +35,7 @@ function mxEdgeHandler(state)
this.init();
// Handles escape keystrokes
this.escapeHandler = mxUtils.bind(this, function(sender, evt)
this.escapeHandler = mxUtils.bind(this, (sender, evt)=>
{
var dirty = this.index != null;
this.reset();
@ -55,21 +55,21 @@ function mxEdgeHandler(state)
*
* Reference to the enclosing <mxGraph>.
*/
mxEdgeHandler.prototype.graph = null;
graph = null;
/**
* Variable: state
*
* Reference to the <mxCellState> being modified.
*/
mxEdgeHandler.prototype.state = null;
state = null;
/**
* Variable: marker
*
* Holds the <mxTerminalMarker> which is used for highlighting terminals.
*/
mxEdgeHandler.prototype.marker = null;
marker = null;
/**
* Variable: constraintHandler
@ -77,42 +77,42 @@ mxEdgeHandler.prototype.marker = null;
* Holds the <mxConstraintHandler> used for drawing and highlighting
* constraints.
*/
mxEdgeHandler.prototype.constraintHandler = null;
constraintHandler = null;
/**
* Variable: error
*
* Holds the current validation error while a connection is being changed.
*/
mxEdgeHandler.prototype.error = null;
error = null;
/**
* Variable: shape
*
* Holds the <mxShape> that represents the preview edge.
*/
mxEdgeHandler.prototype.shape = null;
shape = null;
/**
* Variable: bends
*
* Holds the <mxShapes> that represent the points.
*/
mxEdgeHandler.prototype.bends = null;
bends = null;
/**
* Variable: labelShape
*
* Holds the <mxShape> that represents the label position.
*/
mxEdgeHandler.prototype.labelShape = null;
labelShape = null;
/**
* Variable: cloneEnabled
*
* Specifies if cloning by control-drag is enabled. Default is true.
*/
mxEdgeHandler.prototype.cloneEnabled = true;
cloneEnabled = true;
/**
* Variable: addEnabled
@ -120,7 +120,7 @@ mxEdgeHandler.prototype.cloneEnabled = true;
* Specifies if adding bends by shift-click is enabled. Default is false.
* Note: This experimental feature is not recommended for production use.
*/
mxEdgeHandler.prototype.addEnabled = false;
addEnabled = false;
/**
* Variable: removeEnabled
@ -128,14 +128,14 @@ mxEdgeHandler.prototype.addEnabled = false;
* Specifies if removing bends by shift-click is enabled. Default is false.
* Note: This experimental feature is not recommended for production use.
*/
mxEdgeHandler.prototype.removeEnabled = false;
removeEnabled = false;
/**
* Variable: dblClickRemoveEnabled
*
* Specifies if removing bends by double click is enabled. Default is false.
*/
mxEdgeHandler.prototype.dblClickRemoveEnabled = false;
dblClickRemoveEnabled = false;
/**
* Variable: mergeRemoveEnabled
@ -143,7 +143,7 @@ mxEdgeHandler.prototype.dblClickRemoveEnabled = false;
* Specifies if removing bends by dropping them on other bends is enabled.
* Default is false.
*/
mxEdgeHandler.prototype.mergeRemoveEnabled = false;
mergeRemoveEnabled = false;
/**
* Variable: straightRemoveEnabled
@ -152,7 +152,7 @@ mxEdgeHandler.prototype.mergeRemoveEnabled = false;
* If enabled, this can be overridden by holding down the alt key while moving.
* Default is false.
*/
mxEdgeHandler.prototype.straightRemoveEnabled = false;
straightRemoveEnabled = false;
/**
* Variable: virtualBendsEnabled
@ -161,7 +161,7 @@ mxEdgeHandler.prototype.straightRemoveEnabled = false;
* segments. These bends can then be used to add new waypoints.
* Default is false.
*/
mxEdgeHandler.prototype.virtualBendsEnabled = false;
virtualBendsEnabled = false;
/**
* Variable: virtualBendOpacity
@ -169,7 +169,7 @@ mxEdgeHandler.prototype.virtualBendsEnabled = false;
* Opacity to be used for virtual bends (see <virtualBendsEnabled>).
* Default is 20.
*/
mxEdgeHandler.prototype.virtualBendOpacity = 20;
virtualBendOpacity = 20;
/**
* Variable: parentHighlightEnabled
@ -177,7 +177,7 @@ mxEdgeHandler.prototype.virtualBendOpacity = 20;
* Specifies if the parent should be highlighted if a child cell is selected.
* Default is false.
*/
mxEdgeHandler.prototype.parentHighlightEnabled = false;
parentHighlightEnabled = false;
/**
* Variable: preferHtml
@ -186,7 +186,7 @@ mxEdgeHandler.prototype.parentHighlightEnabled = false;
* in <init> based on whether the edge or one of its terminals has an HTML
* label in the container.
*/
mxEdgeHandler.prototype.preferHtml = false;
preferHtml = false;
/**
* Variable: allowHandleBoundsCheck
@ -194,7 +194,7 @@ mxEdgeHandler.prototype.preferHtml = false;
* Specifies if the bounds of handles should be used for hit-detection in IE
* Default is true.
*/
mxEdgeHandler.prototype.allowHandleBoundsCheck = true;
allowHandleBoundsCheck = true;
/**
* Variable: snapToTerminals
@ -202,21 +202,21 @@ mxEdgeHandler.prototype.allowHandleBoundsCheck = true;
* Specifies if waypoints should snap to the routing centers of terminals.
* Default is false.
*/
mxEdgeHandler.prototype.snapToTerminals = false;
snapToTerminals = false;
/**
* Variable: handleImage
*
* Optional <mxImage> to be used as handles. Default is null.
*/
mxEdgeHandler.prototype.handleImage = null;
handleImage = null;
/**
* Variable: tolerance
*
* Optional tolerance for hit-detection in <getHandleForEvent>. Default is 0.
*/
mxEdgeHandler.prototype.tolerance = 0;
tolerance = 0;
/**
* Variable: outlineConnect
@ -225,7 +225,7 @@ mxEdgeHandler.prototype.tolerance = 0;
* enabled. This will allow to place the connection point along the outline of
* the highlighted target. Default is false.
*/
mxEdgeHandler.prototype.outlineConnect = false;
outlineConnect = false;
/**
* Variable: manageLabelHandle
@ -233,14 +233,14 @@ mxEdgeHandler.prototype.outlineConnect = false;
* Specifies if the label handle should be moved if it intersects with another
* handle. Uses <checkLabelHandle> for checking and moving. Default is false.
*/
mxEdgeHandler.prototype.manageLabelHandle = false;
manageLabelHandle = false;
/**
* Function: init
*
* Initializes the shapes required for this edge handler.
*/
mxEdgeHandler.prototype.init = function()
init = ()=>
{
this.graph = this.state.view.graph;
this.marker = this.createMarker();
@ -291,8 +291,8 @@ mxEdgeHandler.prototype.init = function()
// Creates bends for the non-routed absolute points
// or bends that don't correspond to points
if (this.graph.getSelectionCount() < mxGraphHandler.prototype.maxCells ||
mxGraphHandler.prototype.maxCells <= 0)
if (this.graph.getSelectionCount() < maxCells ||
maxCells <= 0)
{
this.bends = this.createBends();
@ -321,21 +321,21 @@ mxEdgeHandler.prototype.init = function()
* Returns true if the parent highlight should be visible. This implementation
* always returns true.
*/
mxEdgeHandler.prototype.isParentHighlightVisible = mxVertexHandler.prototype.isParentHighlightVisible;
isParentHighlightVisible = isParentHighlightVisible;
/**
* Function: updateParentHighlight
*
* Updates the highlight of the parent if <parentHighlightEnabled> is true.
*/
mxEdgeHandler.prototype.updateParentHighlight = mxVertexHandler.prototype.updateParentHighlight;
updateParentHighlight = updateParentHighlight;
/**
* Function: createCustomHandles
*
* Returns an array of custom handles. This implementation returns null.
*/
mxEdgeHandler.prototype.createCustomHandles = function()
createCustomHandles = ()=>
{
return null;
};
@ -347,7 +347,7 @@ mxEdgeHandler.prototype.createCustomHandles = function()
* <virtualBendsEnabled> is true and the current style allows and
* renders custom waypoints.
*/
mxEdgeHandler.prototype.isVirtualBendsEnabled = function(evt)
isVirtualBendsEnabled = (evt)=>
{
return this.virtualBendsEnabled && (this.state.style[mxConstants.STYLE_EDGE] == null ||
this.state.style[mxConstants.STYLE_EDGE] == mxConstants.NONE ||
@ -361,7 +361,7 @@ mxEdgeHandler.prototype.isVirtualBendsEnabled = function(evt)
* Returns true if the given cell allows new connections to be created. This implementation
* always returns true.
*/
mxEdgeHandler.prototype.isCellEnabled = function(cell)
isCellEnabled = (cell)=>
{
return true;
};
@ -372,7 +372,7 @@ mxEdgeHandler.prototype.isCellEnabled = function(cell)
* Returns true if the given event is a trigger to add a new point. This
* implementation returns true if shift is pressed.
*/
mxEdgeHandler.prototype.isAddPointEvent = function(evt)
isAddPointEvent = (evt)=>
{
return mxEvent.isShiftDown(evt);
};
@ -383,7 +383,7 @@ mxEdgeHandler.prototype.isAddPointEvent = function(evt)
* Returns true if the given event is a trigger to remove a point. This
* implementation returns true if shift is pressed.
*/
mxEdgeHandler.prototype.isRemovePointEvent = function(evt)
isRemovePointEvent = (evt)=>
{
return mxEvent.isShiftDown(evt);
};
@ -393,7 +393,7 @@ mxEdgeHandler.prototype.isRemovePointEvent = function(evt)
*
* Returns the list of points that defines the selection stroke.
*/
mxEdgeHandler.prototype.getSelectionPoints = function(state)
getSelectionPoints = (state)=>
{
return state.absolutePoints;
};
@ -403,7 +403,7 @@ mxEdgeHandler.prototype.getSelectionPoints = function(state)
*
* Creates the shape used to draw the selection border.
*/
mxEdgeHandler.prototype.createParentHighlightShape = function(bounds)
createParentHighlightShape = (bounds)=>
{
var shape = new mxRectangleShape(mxRectangle.fromRectangle(bounds),
null, this.getSelectionColor());
@ -418,7 +418,7 @@ mxEdgeHandler.prototype.createParentHighlightShape = function(bounds)
*
* Creates the shape used to draw the selection border.
*/
mxEdgeHandler.prototype.createSelectionShape = function(points)
createSelectionShape = (points)=>
{
var shape = new this.state.shape.constructor();
shape.outline = true;
@ -436,7 +436,7 @@ mxEdgeHandler.prototype.createSelectionShape = function(points)
*
* Returns <mxConstants.EDGE_SELECTION_COLOR>.
*/
mxEdgeHandler.prototype.getSelectionColor = function()
getSelectionColor = ()=>
{
return mxConstants.EDGE_SELECTION_COLOR;
};
@ -446,7 +446,7 @@ mxEdgeHandler.prototype.getSelectionColor = function()
*
* Returns <mxConstants.EDGE_SELECTION_STROKEWIDTH>.
*/
mxEdgeHandler.prototype.getSelectionStrokeWidth = function()
getSelectionStrokeWidth = ()=>
{
return mxConstants.EDGE_SELECTION_STROKEWIDTH;
};
@ -456,7 +456,7 @@ mxEdgeHandler.prototype.getSelectionStrokeWidth = function()
*
* Returns <mxConstants.EDGE_SELECTION_DASHED>.
*/
mxEdgeHandler.prototype.isSelectionDashed = function()
isSelectionDashed = ()=>
{
return mxConstants.EDGE_SELECTION_DASHED;
};
@ -467,7 +467,7 @@ mxEdgeHandler.prototype.isSelectionDashed = function()
* Returns true if the given cell is connectable. This is a hook to
* disable floating connections. This implementation returns true.
*/
mxEdgeHandler.prototype.isConnectableCell = function(cell)
isConnectableCell = (cell)=>
{
return true;
};
@ -477,7 +477,7 @@ mxEdgeHandler.prototype.isConnectableCell = function(cell)
*
* Creates and returns the <mxCellMarker> used in <marker>.
*/
mxEdgeHandler.prototype.getCellAt = function(x, y)
getCellAt = (x, y)=>
{
return (!this.outlineConnect) ? this.graph.getCellAt(x, y) : null;
};
@ -487,16 +487,16 @@ mxEdgeHandler.prototype.getCellAt = function(x, y)
*
* Creates and returns the <mxCellMarker> used in <marker>.
*/
mxEdgeHandler.prototype.createMarker = function()
createMarker = ()=>
{
var marker = new mxCellMarker(this.graph);
var self = this; // closure
// Only returns edges if they are connectable and never returns
// the edge that is currently being modified
marker.getCell = function(me)
marker.getCell = (me)=>
{
var cell = mxCellMarker.prototype.getCell.apply(this, arguments);
var cell = getCell.apply(this, arguments);
// Checks for cell at preview point (with grid)
if ((cell == self.state.cell || cell == null) && self.currentPoint != null)
@ -535,7 +535,7 @@ mxEdgeHandler.prototype.createMarker = function()
};
// Sets the highlight color according to validateConnection
marker.isValidState = function(state)
marker.isValidState = (state)=>
{
var model = self.graph.getModel();
var other = self.graph.view.getTerminalPort(state,
@ -566,7 +566,7 @@ mxEdgeHandler.prototype.createMarker = function()
* source - <mxCell> that represents the source terminal.
* target - <mxCell> that represents the target terminal.
*/
mxEdgeHandler.prototype.validateConnection = function(source, target)
validateConnection = (source, target)=>
{
return this.graph.getEdgeValidationError(this.state.cell, source, target);
};
@ -577,7 +577,7 @@ mxEdgeHandler.prototype.validateConnection = function(source, target)
* Creates and returns the bends used for modifying the edge. This is
* typically an array of <mxRectangleShapes>.
*/
mxEdgeHandler.prototype.createBends = function()
createBends = ()=>
{
var cell = this.state.cell;
var bends = [];
@ -592,10 +592,10 @@ mxEdgeHandler.prototype.validateConnection = function(source, target)
if (terminal || this.graph.isCellBendable(cell))
{
(mxUtils.bind(this, function(index)
(mxUtils.bind(this, (index)=>
{
var bend = this.createHandleShape(index);
this.initBend(bend, mxUtils.bind(this, mxUtils.bind(this, function()
this.initBend(bend, mxUtils.bind(this, mxUtils.bind(this, ()=>
{
if (this.dblClickRemoveEnabled)
{
@ -629,7 +629,7 @@ mxEdgeHandler.prototype.validateConnection = function(source, target)
* Creates and returns the bends used for modifying the edge. This is
* typically an array of <mxRectangleShapes>.
*/
mxEdgeHandler.prototype.createVirtualBends = function()
createVirtualBends = ()=>
{
var cell = this.state.cell;
var last = this.abspoints[0];
@ -639,7 +639,7 @@ mxEdgeHandler.prototype.validateConnection = function(source, target)
{
for (var i = 1; i < this.abspoints.length; i++)
{
(mxUtils.bind(this, function(bend)
(mxUtils.bind(this, (bend)=>
{
this.initBend(bend);
bend.setCursor(mxConstants.CURSOR_VIRTUAL_BEND_HANDLE);
@ -656,7 +656,7 @@ mxEdgeHandler.prototype.validateConnection = function(source, target)
*
* Creates the shape used to display the given bend.
*/
mxEdgeHandler.prototype.isHandleEnabled = function(index)
isHandleEnabled = (index)=>
{
return true;
};
@ -666,7 +666,7 @@ mxEdgeHandler.prototype.isHandleEnabled = function(index)
*
* Returns true if the handle at the given index is visible.
*/
mxEdgeHandler.prototype.isHandleVisible = function(index)
isHandleVisible = (index)=>
{
var source = this.state.getVisibleTerminalState(true);
var target = this.state.getVisibleTerminalState(false);
@ -685,7 +685,7 @@ mxEdgeHandler.prototype.isHandleVisible = function(index)
* returned if support for HTML labels with not foreign objects is required.
* Index if null for virtual handles.
*/
mxEdgeHandler.prototype.createHandleShape = function(index)
createHandleShape = (index)=>
{
if (this.handleImage != null)
{
@ -714,7 +714,7 @@ mxEdgeHandler.prototype.createHandleShape = function(index)
*
* Creates the shape used to display the the label handle.
*/
mxEdgeHandler.prototype.createLabelHandleShape = function()
createLabelHandleShape = ()=>
{
if (this.labelHandleImage != null)
{
@ -741,7 +741,7 @@ mxEdgeHandler.prototype.createLabelHandleShape = function()
*
* bend - <mxShape> that represents the bend to be initialized.
*/
mxEdgeHandler.prototype.initBend = function(bend, dblClick)
initBend = (bend, dblClick)=>
{
if (this.preferHtml)
{
@ -761,7 +761,7 @@ mxEdgeHandler.prototype.initBend = function(bend, dblClick)
// Fixes lost event tracking for images in quirks / IE8 standards
if (mxClient.IS_QUIRKS || document.documentMode == 8)
{
mxEvent.addListener(bend.node, 'dragstart', function(evt)
mxEvent.addListener(bend.node, 'dragstart', (evt)=>
{
mxEvent.consume(evt);
@ -780,7 +780,7 @@ mxEdgeHandler.prototype.initBend = function(bend, dblClick)
*
* Returns the index of the handle for the given event.
*/
mxEdgeHandler.prototype.getHandleForEvent = function(me)
getHandleForEvent = (me)=>
{
var result = null;
@ -863,7 +863,7 @@ mxEdgeHandler.prototype.getHandleForEvent = function(me)
* Returns true if the given event allows virtual bends to be added. This
* implementation returns true.
*/
mxEdgeHandler.prototype.isAddVirtualBendEvent = function(me)
isAddVirtualBendEvent = (me)=>
{
return true;
};
@ -874,7 +874,7 @@ mxEdgeHandler.prototype.isAddVirtualBendEvent = function(me)
* Returns true if the given event allows custom handles to be changed. This
* implementation returns true.
*/
mxEdgeHandler.prototype.isCustomHandleEvent = function(me)
isCustomHandleEvent = (me)=>
{
return true;
};
@ -888,7 +888,7 @@ mxEdgeHandler.prototype.isCustomHandleEvent = function(me)
* control point. The source and target points are used for reconnecting
* the edge.
*/
mxEdgeHandler.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
var handle = this.getHandleForEvent(me);
@ -928,7 +928,7 @@ mxEdgeHandler.prototype.mouseDown = function(sender, me)
*
* Starts the handling of the mouse gesture.
*/
mxEdgeHandler.prototype.start = function(x, y, index)
start = (x, y, index)=>
{
this.startX = x;
this.startY = y;
@ -974,7 +974,7 @@ mxEdgeHandler.prototype.start = function(x, y, index)
*
* Returns a clone of the current preview state for the given point and terminal.
*/
mxEdgeHandler.prototype.clonePreviewState = function(point, terminal)
clonePreviewState = (point, terminal)=>
{
return this.state.clone();
};
@ -985,7 +985,7 @@ mxEdgeHandler.prototype.clonePreviewState = function(point, terminal)
* Returns the tolerance for the guides. Default value is
* gridSize * scale / 2.
*/
mxEdgeHandler.prototype.getSnapToTerminalTolerance = function()
getSnapToTerminalTolerance = ()=>
{
return this.graph.gridSize * this.graph.view.scale / 2;
};
@ -995,21 +995,21 @@ mxEdgeHandler.prototype.getSnapToTerminalTolerance = function()
*
* Hook for subclassers do show details while the handler is active.
*/
mxEdgeHandler.prototype.updateHint = function(me, point) { };
updateHint = (me, point)=> { };
/**
* Function: removeHint
*
* Hooks for subclassers to hide details when the handler gets inactive.
*/
mxEdgeHandler.prototype.removeHint = function() { };
removeHint = ()=> { };
/**
* Function: roundLength
*
* Hook for rounding the unscaled width or height. This uses Math.round.
*/
mxEdgeHandler.prototype.roundLength = function(length)
roundLength = (length)=>
{
return Math.round(length);
};
@ -1019,7 +1019,7 @@ mxEdgeHandler.prototype.roundLength = function(length)
*
* Returns true if <snapToTerminals> is true and if alt is not pressed.
*/
mxEdgeHandler.prototype.isSnapToTerminalsEvent = function(me)
isSnapToTerminalsEvent = (me)=>
{
return this.snapToTerminals && !mxEvent.isAltDown(me.getEvent());
};
@ -1029,7 +1029,7 @@ mxEdgeHandler.prototype.isSnapToTerminalsEvent = function(me)
*
* Returns the point for the given event.
*/
mxEdgeHandler.prototype.getPointForEvent = function(me)
getPointForEvent = (me)=>
{
var view = this.graph.getView();
var scale = view.scale;
@ -1109,7 +1109,7 @@ mxEdgeHandler.prototype.getPointForEvent = function(me)
*
* Updates the given preview state taking into account the state of the constraint handler.
*/
mxEdgeHandler.prototype.getPreviewTerminalState = function(me)
getPreviewTerminalState = (me)=>
{
this.constraintHandler.update(me, this.isSource, true, me.isSource(this.marker.highlight.shape) ? null : this.currentPoint);
@ -1188,7 +1188,7 @@ mxEdgeHandler.prototype.getPreviewTerminalState = function(me)
* pt - <mxPoint> that contains the current pointer position.
* me - Optional <mxMouseEvent> that contains the current event.
*/
mxEdgeHandler.prototype.getPreviewPoints = function(pt, me)
getPreviewPoints = (pt, me)=>
{
var geometry = this.graph.getCellGeometry(this.state.cell);
var points = (geometry.points != null) ? geometry.points.slice() : null;
@ -1307,7 +1307,7 @@ mxEdgeHandler.prototype.getPreviewPoints = function(pt, me)
* Returns true if <outlineConnect> is true and the source of the event is the outline shape
* or shift is pressed.
*/
mxEdgeHandler.prototype.isOutlineConnectEvent = function(me)
isOutlineConnectEvent = (me)=>
{
var offset = mxUtils.getOffset(this.graph.container);
var evt = me.getEvent();
@ -1335,7 +1335,7 @@ mxEdgeHandler.prototype.isOutlineConnectEvent = function(me)
*
* Updates the given preview state taking into account the state of the constraint handler.
*/
mxEdgeHandler.prototype.updatePreviewState = function(edge, point, terminalState, me, outline)
updatePreviewState = (edge, point, terminalState, me, outline)=>
{
// Computes the points for the edge style and terminals
var sourceState = (this.isSource) ? terminalState : this.state.getVisibleTerminalState(true);
@ -1444,7 +1444,7 @@ mxEdgeHandler.prototype.updatePreviewState = function(edge, point, terminalState
*
* Handles the event by updating the preview.
*/
mxEdgeHandler.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
if (this.index != null && this.marker != null)
{
@ -1550,7 +1550,7 @@ mxEdgeHandler.prototype.mouseMove = function(sender, me)
* Handles the event to applying the previewed changes on the edge by
* using <moveLabel>, <connect> or <changePoints>.
*/
mxEdgeHandler.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
// Workaround for wrong event source in Webkit
if (this.index != null && this.marker != null)
@ -1717,7 +1717,7 @@ mxEdgeHandler.prototype.mouseUp = function(sender, me)
*
* Resets the state of this handler.
*/
mxEdgeHandler.prototype.reset = function()
reset = ()=>
{
if (this.active)
{
@ -1773,7 +1773,7 @@ mxEdgeHandler.prototype.reset = function()
*
* Sets the color of the preview to the given value.
*/
mxEdgeHandler.prototype.setPreviewColor = function(color)
setPreviewColor = (color)=>
{
if (this.shape != null)
{
@ -1794,7 +1794,7 @@ mxEdgeHandler.prototype.setPreviewColor = function(color)
* point - <mxPoint> to be converted.
* gridEnabled - Boolean that specifies if the grid should be applied.
*/
mxEdgeHandler.prototype.convertPoint = function(point, gridEnabled)
convertPoint = (point, gridEnabled)=>
{
var scale = this.graph.getView().getScale();
var tr = this.graph.getView().getTranslate();
@ -1831,7 +1831,7 @@ mxEdgeHandler.prototype.convertPoint = function(point, gridEnabled)
* x - Integer that specifies the x-coordinate of the new location.
* y - Integer that specifies the y-coordinate of the new location.
*/
mxEdgeHandler.prototype.moveLabel = function(edgeState, x, y)
moveLabel = (edgeState, x, y)=>
{
var model = this.graph.getModel();
var geometry = model.getGeometry(edgeState.cell);
@ -1891,7 +1891,7 @@ mxEdgeHandler.prototype.moveLabel = function(edgeState, x, y)
* the old edge.
* me - <mxMouseEvent> that contains the mouse up event.
*/
mxEdgeHandler.prototype.connect = function(edge, terminal, isSource, isClone, me)
connect = (edge, terminal, isSource, isClone, me)=>
{
var model = this.graph.getModel();
var parent = model.getParent(edge);
@ -1921,7 +1921,7 @@ mxEdgeHandler.prototype.connect = function(edge, terminal, isSource, isClone, me
*
* Changes the terminal point of the given edge.
*/
mxEdgeHandler.prototype.changeTerminalPoint = function(edge, point, isSource, clone)
changeTerminalPoint = (edge, point, isSource, clone)=>
{
var model = this.graph.getModel();
@ -1960,7 +1960,7 @@ mxEdgeHandler.prototype.changeTerminalPoint = function(edge, point, isSource, cl
*
* Changes the control points of the given edge in the graph model.
*/
mxEdgeHandler.prototype.changePoints = function(edge, points, clone)
changePoints = (edge, points, clone)=>
{
var model = this.graph.getModel();
model.beginUpdate();
@ -2000,7 +2000,7 @@ mxEdgeHandler.prototype.changePoints = function(edge, points, clone)
*
* Adds a control point for the given state and event.
*/
mxEdgeHandler.prototype.addPoint = function(state, evt)
addPoint = (state, evt)=>
{
var pt = mxUtils.convertPoint(this.graph.container, mxEvent.getClientX(evt),
mxEvent.getClientY(evt));
@ -2015,7 +2015,7 @@ mxEdgeHandler.prototype.addPoint = function(state, evt)
*
* Adds a control point at the given point.
*/
mxEdgeHandler.prototype.addPointAt = function(state, x, y)
addPointAt = (state, x, y)=>
{
var geo = this.graph.getCellGeometry(state.cell);
var pt = new mxPoint(x, y);
@ -2057,7 +2057,7 @@ mxEdgeHandler.prototype.addPointAt = function(state, x, y)
*
* Removes the control point at the given index from the given state.
*/
mxEdgeHandler.prototype.removePoint = function(state, index)
removePoint = (state, index)=>
{
if (index > 0 && index < this.abspoints.length - 1)
{
@ -2079,7 +2079,7 @@ mxEdgeHandler.prototype.removePoint = function(state, index)
*
* Returns the fillcolor for the handle at the given index.
*/
mxEdgeHandler.prototype.getHandleFillColor = function(index)
getHandleFillColor = (index)=>
{
var isSource = index == 0;
var cell = this.state.cell;
@ -2104,7 +2104,7 @@ mxEdgeHandler.prototype.getHandleFillColor = function(index)
*
* Redraws the preview, and the bends- and label control points.
*/
mxEdgeHandler.prototype.redraw = function(ignoreHandles)
redraw = (ignoreHandles)=>
{
if (this.state != null)
{
@ -2149,7 +2149,7 @@ mxEdgeHandler.prototype.redraw = function(ignoreHandles)
*
* Redraws the handles.
*/
mxEdgeHandler.prototype.redrawHandles = function()
redrawHandles = ()=>
{
var cell = this.state.cell;
@ -2253,7 +2253,7 @@ mxEdgeHandler.prototype.redrawHandles = function()
*
* Returns true if the given custom handle is visible.
*/
mxEdgeHandler.prototype.isCustomHandleVisible = function(handle)
isCustomHandleVisible = (handle)=>
{
return !this.graph.isEditing() && this.state.view.graph.getSelectionCount() == 1;
};
@ -2263,7 +2263,7 @@ mxEdgeHandler.prototype.isCustomHandleVisible = function(handle)
*
* Shortcut to <hideSizers>.
*/
mxEdgeHandler.prototype.setHandlesVisible = function(visible)
setHandlesVisible = (visible)=>
{
if (this.bends != null)
{
@ -2305,7 +2305,7 @@ mxEdgeHandler.prototype.setHandlesVisible = function(visible)
* p0 - <mxPoint> that represents the location of the first point.
* pe - <mxPoint> that represents the location of the last point.
*/
mxEdgeHandler.prototype.redrawInnerBends = function(p0, pe)
redrawInnerBends = (p0, pe)=>
{
for (var i = 1; i < this.bends.length - 1; i++)
{
@ -2349,7 +2349,7 @@ mxEdgeHandler.prototype.redrawInnerBends = function(p0, pe)
* Checks if the label handle intersects the given bounds and moves it if it
* intersects.
*/
mxEdgeHandler.prototype.checkLabelHandle = function(b)
checkLabelHandle = (b)=>
{
if (this.labelShape != null)
{
@ -2374,7 +2374,7 @@ mxEdgeHandler.prototype.checkLabelHandle = function(b)
*
* Redraws the preview.
*/
mxEdgeHandler.prototype.drawPreview = function()
drawPreview = ()=>
{
try
{
@ -2416,7 +2416,7 @@ mxEdgeHandler.prototype.drawPreview = function()
*
* Refreshes the bends of this handler.
*/
mxEdgeHandler.prototype.refresh = function()
refresh = ()=>
{
if (this.state != null)
{
@ -2454,7 +2454,7 @@ mxEdgeHandler.prototype.refresh = function()
*
* Returns true if <destroy> was called.
*/
mxEdgeHandler.prototype.isDestroyed = function()
isDestroyed = ()=>
{
return this.shape == null;
};
@ -2464,7 +2464,7 @@ mxEdgeHandler.prototype.isDestroyed = function()
*
* Destroys all elements in <bends>.
*/
mxEdgeHandler.prototype.destroyBends = function(bends)
destroyBends = (bends)=>
{
if (bends != null)
{
@ -2485,7 +2485,7 @@ mxEdgeHandler.prototype.destroyBends = function(bends)
* normally not need to be called as handlers are destroyed automatically
* when the corresponding cell is deselected.
*/
mxEdgeHandler.prototype.destroy = function()
destroy = ()=>
{
if (this.escapeHandler != null)
{

View File

@ -17,7 +17,7 @@ mxUtils.extend(mxEdgeSegmentHandler, mxElbowEdgeHandler);
*
* Returns the current absolute points.
*/
mxEdgeSegmentHandler.prototype.getCurrentPoints = function()
getCurrentPoints = ()=>
{
var pts = this.state.absolutePoints;
@ -45,11 +45,11 @@ mxEdgeSegmentHandler.prototype.getCurrentPoints = function()
*
* Updates the given preview state taking into account the state of the constraint handler.
*/
mxEdgeSegmentHandler.prototype.getPreviewPoints = function(point)
getPreviewPoints = (point)=>
{
if (this.isSource || this.isTarget)
{
return mxElbowEdgeHandler.prototype.getPreviewPoints.apply(this, arguments);
return getPreviewPoints.apply(this, arguments);
}
else
{
@ -112,9 +112,9 @@ mxEdgeSegmentHandler.prototype.getPreviewPoints = function(point)
*
* Overridden to perform optimization of the edge style result.
*/
mxEdgeSegmentHandler.prototype.updatePreviewState = function(edge, point, terminalState, me)
updatePreviewState = (edge, point, terminalState, me)=>
{
mxEdgeHandler.prototype.updatePreviewState.apply(this, arguments);
updatePreviewState.apply(this, arguments);
// Checks and corrects preview by running edge style again
if (!this.isSource && !this.isTarget)
@ -206,7 +206,7 @@ mxEdgeSegmentHandler.prototype.updatePreviewState = function(edge, point, termin
/**
* Overriden to merge edge segments.
*/
mxEdgeSegmentHandler.prototype.connect = function(edge, terminal, isSource, isClone, me)
connect = (edge, terminal, isSource, isClone, me)=>
{
var model = this.graph.getModel();
var geo = model.getGeometry(edge);
@ -252,7 +252,7 @@ mxEdgeSegmentHandler.prototype.connect = function(edge, terminal, isSource, isCl
}
}
edge = mxEdgeHandler.prototype.connect.apply(this, arguments);
edge = connect.apply(this, arguments);
}
finally
{
@ -267,7 +267,7 @@ mxEdgeSegmentHandler.prototype.connect = function(edge, terminal, isSource, isCl
*
* Returns no tooltips.
*/
mxEdgeSegmentHandler.prototype.getTooltipForNode = function(node)
getTooltipForNode = (node)=>
{
return null;
};
@ -277,9 +277,9 @@ mxEdgeSegmentHandler.prototype.getTooltipForNode = function(node)
*
* Starts the handling of the mouse gesture.
*/
mxEdgeSegmentHandler.prototype.start = function(x, y, index)
start = (x, y, index)=>
{
mxEdgeHandler.prototype.start.apply(this, arguments);
start.apply(this, arguments);
if (this.bends != null && this.bends[index] != null &&
!this.isSource && !this.isTarget)
@ -293,7 +293,7 @@ mxEdgeSegmentHandler.prototype.start = function(x, y, index)
*
* Adds custom bends for the center of each segment.
*/
mxEdgeSegmentHandler.prototype.createBends = function()
createBends = ()=>
{
var bends = [];
@ -344,10 +344,10 @@ mxEdgeSegmentHandler.prototype.createBends = function()
*
* Overridden to invoke <refresh> before the redraw.
*/
mxEdgeSegmentHandler.prototype.redraw = function()
redraw = ()=>
{
this.refresh();
mxEdgeHandler.prototype.redraw.apply(this, arguments);
redraw.apply(this, arguments);
};
/**
@ -355,7 +355,7 @@ mxEdgeSegmentHandler.prototype.redraw = function()
*
* Updates the position of the custom bends.
*/
mxEdgeSegmentHandler.prototype.redrawInnerBends = function(p0, pe)
redrawInnerBends = (p0, pe)=>
{
if (this.graph.isCellBendable(this.state.cell))
{

View File

@ -32,7 +32,7 @@ mxUtils.extend(mxElbowEdgeHandler, mxEdgeHandler);
* Specifies if a double click on the middle handle should call
* <mxGraph.flipEdge>. Default is true.
*/
mxElbowEdgeHandler.prototype.flipEnabled = true;
flipEnabled = true;
/**
* Variable: doubleClickOrientationResource
@ -42,7 +42,7 @@ mxElbowEdgeHandler.prototype.flipEnabled = true;
* exist then the value is used as the error message. Default is
* 'doubleClickOrientation'.
*/
mxElbowEdgeHandler.prototype.doubleClickOrientationResource =
doubleClickOrientationResource =
(mxClient.language != 'none') ? 'doubleClickOrientation' : '';
/**
@ -50,7 +50,7 @@ mxElbowEdgeHandler.prototype.doubleClickOrientationResource =
*
* Overrides <mxEdgeHandler.createBends> to create custom bends.
*/
mxElbowEdgeHandler.prototype.createBends = function()
createBends = ()=>
{
var bends = [];
@ -61,7 +61,7 @@ mxElbowEdgeHandler.prototype.doubleClickOrientationResource =
bends.push(bend);
// Virtual
bends.push(this.createVirtualBend(mxUtils.bind(this, function(evt)
bends.push(this.createVirtualBend(mxUtils.bind(this, (evt)=>
{
if (!mxEvent.isConsumed(evt) && this.flipEnabled)
{
@ -87,7 +87,7 @@ mxElbowEdgeHandler.prototype.doubleClickOrientationResource =
* Creates a virtual bend that supports double clicking and calls
* <mxGraph.flipEdge>.
*/
mxElbowEdgeHandler.prototype.createVirtualBend = function(dblClickHandler)
createVirtualBend = (dblClickHandler)=>
{
var bend = this.createHandleShape();
this.initBend(bend, dblClickHandler);
@ -107,7 +107,7 @@ mxElbowEdgeHandler.prototype.createVirtualBend = function(dblClickHandler)
*
* Returns the cursor to be used for the bend.
*/
mxElbowEdgeHandler.prototype.getCursorForBend = function()
getCursorForBend = ()=>
{
return (this.state.style[mxConstants.STYLE_EDGE] == mxEdgeStyle.TopToBottom ||
this.state.style[mxConstants.STYLE_EDGE] == mxConstants.EDGESTYLE_TOPTOBOTTOM ||
@ -122,7 +122,7 @@ mxElbowEdgeHandler.prototype.getCursorForBend = function()
*
* Returns the tooltip for the given node.
*/
mxElbowEdgeHandler.prototype.getTooltipForNode = function(node)
getTooltipForNode = (node)=>
{
var tip = null;
@ -147,7 +147,7 @@ mxElbowEdgeHandler.prototype.getTooltipForNode = function(node)
* point - <mxPoint> to be converted.
* gridEnabled - Boolean that specifies if the grid should be applied.
*/
mxElbowEdgeHandler.prototype.convertPoint = function(point, gridEnabled)
convertPoint = (point, gridEnabled)=>
{
var scale = this.graph.getView().getScale();
var tr = this.graph.getView().getTranslate();
@ -175,7 +175,7 @@ mxElbowEdgeHandler.prototype.convertPoint = function(point, gridEnabled)
* p0 - <mxPoint> that represents the location of the first point.
* pe - <mxPoint> that represents the location of the last point.
*/
mxElbowEdgeHandler.prototype.redrawInnerBends = function(p0, pe)
redrawInnerBends = (p0, pe)=>
{
var g = this.graph.getModel().getGeometry(this.state.cell);
var pts = this.state.absolutePoints;

View File

@ -28,7 +28,7 @@ function mxGraphHandler(graph)
this.graph.addMouseListener(this);
// Repaints the handler after autoscroll
this.panHandler = mxUtils.bind(this, function()
this.panHandler = mxUtils.bind(this, ()=>
{
if (!this.suspended)
{
@ -40,7 +40,7 @@ function mxGraphHandler(graph)
this.graph.addListener(mxEvent.PAN, this.panHandler);
// Handles escape keystrokes
this.escapeHandler = mxUtils.bind(this, function(sender, evt)
this.escapeHandler = mxUtils.bind(this, (sender, evt)=>
{
this.reset();
});
@ -48,7 +48,7 @@ function mxGraphHandler(graph)
this.graph.addListener(mxEvent.ESCAPE, this.escapeHandler);
// Updates the preview box for remote changes
this.refreshHandler = mxUtils.bind(this, function(sender, evt)
this.refreshHandler = mxUtils.bind(this, (sender, evt)=>
{
// Merges multiple pending calls
if (this.refreshThread)
@ -57,7 +57,7 @@ function mxGraphHandler(graph)
}
// Waits for the states and handlers to be updated
this.refreshThread = window.setTimeout(mxUtils.bind(this, function()
this.refreshThread = window.setTimeout(mxUtils.bind(this, ()=>
{
this.refreshThread = null;
@ -100,7 +100,7 @@ function mxGraphHandler(graph)
this.graph.getModel().addListener(mxEvent.CHANGE, this.refreshHandler);
this.graph.addListener(mxEvent.REFRESH, this.refreshHandler);
this.keyHandler = mxUtils.bind(this, function(e)
this.keyHandler = mxUtils.bind(this, (e)=>
{
if (this.graph.container != null && this.graph.container.style.visibility != 'hidden' &&
this.first != null && !this.suspended)
@ -127,7 +127,7 @@ function mxGraphHandler(graph)
*
* Reference to the enclosing <mxGraph>.
*/
mxGraphHandler.prototype.graph = null;
graph = null;
/**
* Variable: maxCells
@ -139,14 +139,14 @@ mxGraphHandler.prototype.graph = null;
* cells in the graph is limited to a small number, eg.
* 500.
*/
mxGraphHandler.prototype.maxCells = (mxClient.IS_IE) ? 20 : 50;
maxCells = (mxClient.IS_IE) ? 20 : 50;
/**
* Variable: enabled
*
* Specifies if events are handled. Default is true.
*/
mxGraphHandler.prototype.enabled = true;
enabled = true;
/**
* Variable: highlightEnabled
@ -154,21 +154,21 @@ mxGraphHandler.prototype.enabled = true;
* Specifies if drop targets under the mouse should be enabled. Default is
* true.
*/
mxGraphHandler.prototype.highlightEnabled = true;
highlightEnabled = true;
/**
* Variable: cloneEnabled
*
* Specifies if cloning by control-drag is enabled. Default is true.
*/
mxGraphHandler.prototype.cloneEnabled = true;
cloneEnabled = true;
/**
* Variable: moveEnabled
*
* Specifies if moving is enabled. Default is true.
*/
mxGraphHandler.prototype.moveEnabled = true;
moveEnabled = true;
/**
* Variable: guidesEnabled
@ -176,35 +176,35 @@ mxGraphHandler.prototype.moveEnabled = true;
* Specifies if other cells should be used for snapping the right, center or
* left side of the current selection. Default is false.
*/
mxGraphHandler.prototype.guidesEnabled = false;
guidesEnabled = false;
/**
* Variable: handlesVisible
*
* Whether the handles of the selection are currently visible.
*/
mxGraphHandler.prototype.handlesVisible = true;
handlesVisible = true;
/**
* Variable: guide
*
* Holds the <mxGuide> instance that is used for alignment.
*/
mxGraphHandler.prototype.guide = null;
guide = null;
/**
* Variable: currentDx
*
* Stores the x-coordinate of the current mouse move.
*/
mxGraphHandler.prototype.currentDx = null;
currentDx = null;
/**
* Variable: currentDy
*
* Stores the y-coordinate of the current mouse move.
*/
mxGraphHandler.prototype.currentDy = null;
currentDy = null;
/**
* Variable: updateCursor
@ -212,21 +212,21 @@ mxGraphHandler.prototype.currentDy = null;
* Specifies if a move cursor should be shown if the mouse is over a movable
* cell. Default is true.
*/
mxGraphHandler.prototype.updateCursor = true;
updateCursor = true;
/**
* Variable: selectEnabled
*
* Specifies if selecting is enabled. Default is true.
*/
mxGraphHandler.prototype.selectEnabled = true;
selectEnabled = true;
/**
* Variable: removeCellsFromParent
*
* Specifies if cells may be moved out of their parents. Default is true.
*/
mxGraphHandler.prototype.removeCellsFromParent = true;
removeCellsFromParent = true;
/**
* Variable: removeEmptyParents
@ -234,7 +234,7 @@ mxGraphHandler.prototype.removeCellsFromParent = true;
* If empty parents should be removed from the model after all child cells
* have been moved out. Default is true.
*/
mxGraphHandler.prototype.removeEmptyParents = false;
removeEmptyParents = false;
/**
* Variable: connectOnDrop
@ -242,7 +242,7 @@ mxGraphHandler.prototype.removeEmptyParents = false;
* Specifies if drop events are interpreted as new connections if no other
* drop action is defined. Default is false.
*/
mxGraphHandler.prototype.connectOnDrop = false;
connectOnDrop = false;
/**
* Variable: scrollOnMove
@ -250,7 +250,7 @@ mxGraphHandler.prototype.connectOnDrop = false;
* Specifies if the view should be scrolled so that a moved cell is
* visible. Default is true.
*/
mxGraphHandler.prototype.scrollOnMove = true;
scrollOnMove = true;
/**
* Variable: minimumSize
@ -258,14 +258,14 @@ mxGraphHandler.prototype.scrollOnMove = true;
* Specifies the minimum number of pixels for the width and height of a
* selection border. Default is 6.
*/
mxGraphHandler.prototype.minimumSize = 6;
minimumSize = 6;
/**
* Variable: previewColor
*
* Specifies the color of the preview shape. Default is black.
*/
mxGraphHandler.prototype.previewColor = 'black';
previewColor = 'black';
/**
* Variable: htmlPreview
@ -274,28 +274,28 @@ mxGraphHandler.prototype.previewColor = 'black';
* then drop target detection relies entirely on <mxGraph.getCellAt> because
* the HTML preview does not "let events through". Default is false.
*/
mxGraphHandler.prototype.htmlPreview = false;
htmlPreview = false;
/**
* Variable: shape
*
* Reference to the <mxShape> that represents the preview.
*/
mxGraphHandler.prototype.shape = null;
shape = null;
/**
* Variable: scaleGrid
*
* Specifies if the grid should be scaled. Default is false.
*/
mxGraphHandler.prototype.scaleGrid = false;
scaleGrid = false;
/**
* Variable: rotationEnabled
*
* Specifies if the bounding box should allow for rotation. Default is true.
*/
mxGraphHandler.prototype.rotationEnabled = true;
rotationEnabled = true;
/**
* Variable: maxLivePreview
@ -303,7 +303,7 @@ mxGraphHandler.prototype.rotationEnabled = true;
* Maximum number of cells for which live preview should be used. Default is 0
* which means no live preview.
*/
mxGraphHandler.prototype.maxLivePreview = 0;
maxLivePreview = 0;
/**
* Variable: allowLivePreview
@ -311,14 +311,14 @@ mxGraphHandler.prototype.maxLivePreview = 0;
* If live preview is allowed on this system. Default is true for systems with
* SVG support.
*/
mxGraphHandler.prototype.allowLivePreview = mxClient.IS_SVG;
allowLivePreview = mxClient.IS_SVG;
/**
* Function: isEnabled
*
* Returns <enabled>.
*/
mxGraphHandler.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -328,7 +328,7 @@ mxGraphHandler.prototype.isEnabled = function()
*
* Sets <enabled>.
*/
mxGraphHandler.prototype.setEnabled = function(value)
setEnabled = (value)=>
{
this.enabled = value;
};
@ -338,7 +338,7 @@ mxGraphHandler.prototype.setEnabled = function(value)
*
* Returns <cloneEnabled>.
*/
mxGraphHandler.prototype.isCloneEnabled = function()
isCloneEnabled = ()=>
{
return this.cloneEnabled;
};
@ -352,7 +352,7 @@ mxGraphHandler.prototype.isCloneEnabled = function()
*
* value - Boolean that specifies the new clone enabled state.
*/
mxGraphHandler.prototype.setCloneEnabled = function(value)
setCloneEnabled = (value)=>
{
this.cloneEnabled = value;
};
@ -362,7 +362,7 @@ mxGraphHandler.prototype.setCloneEnabled = function(value)
*
* Returns <moveEnabled>.
*/
mxGraphHandler.prototype.isMoveEnabled = function()
isMoveEnabled = ()=>
{
return this.moveEnabled;
};
@ -372,7 +372,7 @@ mxGraphHandler.prototype.isMoveEnabled = function()
*
* Sets <moveEnabled>.
*/
mxGraphHandler.prototype.setMoveEnabled = function(value)
setMoveEnabled = (value)=>
{
this.moveEnabled = value;
};
@ -382,7 +382,7 @@ mxGraphHandler.prototype.setMoveEnabled = function(value)
*
* Returns <selectEnabled>.
*/
mxGraphHandler.prototype.isSelectEnabled = function()
isSelectEnabled = ()=>
{
return this.selectEnabled;
};
@ -392,7 +392,7 @@ mxGraphHandler.prototype.isSelectEnabled = function()
*
* Sets <selectEnabled>.
*/
mxGraphHandler.prototype.setSelectEnabled = function(value)
setSelectEnabled = (value)=>
{
this.selectEnabled = value;
};
@ -402,7 +402,7 @@ mxGraphHandler.prototype.setSelectEnabled = function(value)
*
* Returns <removeCellsFromParent>.
*/
mxGraphHandler.prototype.isRemoveCellsFromParent = function()
isRemoveCellsFromParent = ()=>
{
return this.removeCellsFromParent;
};
@ -412,7 +412,7 @@ mxGraphHandler.prototype.isRemoveCellsFromParent = function()
*
* Sets <removeCellsFromParent>.
*/
mxGraphHandler.prototype.setRemoveCellsFromParent = function(value)
setRemoveCellsFromParent = (value)=>
{
this.removeCellsFromParent = value;
};
@ -423,7 +423,7 @@ mxGraphHandler.prototype.setRemoveCellsFromParent = function(value)
* Returns true if the given cell and parent should propagate
* selection state to the parent.
*/
mxGraphHandler.prototype.isPropagateSelectionCell = function(cell, immediate, me)
isPropagateSelectionCell = (cell, immediate, me)=>
{
var parent = this.graph.model.getParent(cell);
@ -454,7 +454,7 @@ mxGraphHandler.prototype.isPropagateSelectionCell = function(cell, immediate, me
* Hook to return initial cell for the given event. This returns
* the topmost cell that is not a swimlane or is selected.
*/
mxGraphHandler.prototype.getInitialCellForEvent = function(me)
getInitialCellForEvent = (me)=>
{
var state = me.getState();
@ -481,7 +481,7 @@ mxGraphHandler.prototype.getInitialCellForEvent = function(me)
*
* Returns true if the cell or one of its ancestors is selected.
*/
mxGraphHandler.prototype.isDelayedSelection = function(cell, me)
isDelayedSelection = (cell, me)=>
{
if (!this.graph.isToggleEvent(me.getEvent()) || !mxEvent.isAltDown(me.getEvent()))
{
@ -504,7 +504,7 @@ mxGraphHandler.prototype.isDelayedSelection = function(cell, me)
*
* Implements the delayed selection for the given mouse event.
*/
mxGraphHandler.prototype.selectDelayed = function(me)
selectDelayed = (me)=>
{
if (!this.graph.popupMenuHandler.isPopupTrigger(me))
{
@ -524,7 +524,7 @@ mxGraphHandler.prototype.selectDelayed = function(me)
*
* Selects the given cell for the given <mxMouseEvent>.
*/
mxGraphHandler.prototype.selectCellForEvent = function(cell, me)
selectCellForEvent = (cell, me)=>
{
var state = this.graph.view.getState(cell);
@ -566,7 +566,7 @@ mxGraphHandler.prototype.selectCellForEvent = function(cell, me)
* touchStart disables firing the subsequent click event on the link.
*
* <code>
* mxGraphHandler.prototype.consumeMouseEvent = function(evtName, me)
* consumeMouseEvent = (evtName, me)=>
* {
* var source = mxEvent.getSource(me.getEvent());
*
@ -577,7 +577,7 @@ mxGraphHandler.prototype.selectCellForEvent = function(cell, me)
* }
* </code>
*/
mxGraphHandler.prototype.consumeMouseEvent = function(evtName, me)
consumeMouseEvent = (evtName, me)=>
{
me.consume();
};
@ -589,7 +589,7 @@ mxGraphHandler.prototype.consumeMouseEvent = function(evtName, me)
* it. By consuming the event all subsequent events of the gesture are
* redirected to this handler.
*/
mxGraphHandler.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
if (!me.isConsumed() && this.isEnabled() && this.graph.isEnabled() &&
me.getState() != null && !mxEvent.isMultiTouchEvent(me.getEvent()))
@ -631,12 +631,12 @@ mxGraphHandler.prototype.mouseDown = function(sender, me)
*
* Creates an array of cell states which should be used as guides.
*/
mxGraphHandler.prototype.getGuideStates = function()
getGuideStates = ()=>
{
var parent = this.graph.getDefaultParent();
var model = this.graph.getModel();
var filter = mxUtils.bind(this, function(cell)
var filter = mxUtils.bind(this, (cell)=>
{
return this.graph.view.getState(cell) != null &&
model.isVertex(cell) &&
@ -659,7 +659,7 @@ mxGraphHandler.prototype.getGuideStates = function()
*
* initialCell - <mxCell> that triggered this handler.
*/
mxGraphHandler.prototype.getCells = function(initialCell)
getCells = (initialCell)=>
{
if (!this.delayedSelection && this.graph.isCellMovable(initialCell))
{
@ -677,7 +677,7 @@ mxGraphHandler.prototype.getCells = function(initialCell)
* Returns the <mxRectangle> used as the preview bounds for
* moving the given cells.
*/
mxGraphHandler.prototype.getPreviewBounds = function(cells)
getPreviewBounds = (cells)=>
{
var bounds = this.getBoundingBox(cells);
@ -731,7 +731,7 @@ mxGraphHandler.prototype.getPreviewBounds = function(cells)
*
* cells - Array of <mxCells> whose bounding box should be returned.
*/
mxGraphHandler.prototype.getBoundingBox = function(cells)
getBoundingBox = (cells)=>
{
var result = null;
@ -775,7 +775,7 @@ mxGraphHandler.prototype.getBoundingBox = function(cells)
*
* Creates the shape used to draw the preview for the given bounds.
*/
mxGraphHandler.prototype.createPreviewShape = function(bounds)
createPreviewShape = (bounds)=>
{
var shape = new mxRectangleShape(bounds, null, this.previewColor);
shape.isDashed = true;
@ -798,7 +798,7 @@ mxGraphHandler.prototype.createPreviewShape = function(bounds)
// Workaround for artifacts on iOS
if (mxClient.IS_IOS)
{
shape.getSvgScreenOffset = function()
shape.getSvgScreenOffset = ()=>
{
return 0;
};
@ -813,7 +813,7 @@ mxGraphHandler.prototype.createPreviewShape = function(bounds)
*
* Starts the handling of the mouse gesture.
*/
mxGraphHandler.prototype.start = function(cell, x, y, cells)
start = (cell, x, y, cells)=>
{
this.cell = cell;
this.first = mxUtils.convertPoint(this.graph.container, x, y);
@ -849,7 +849,7 @@ mxGraphHandler.prototype.start = function(cell, x, y, cells)
}
}
this.guide.isStateIgnored = mxUtils.bind(this, function(state)
this.guide.isStateIgnored = mxUtils.bind(this, (state)=>
{
var p = this.graph.model.getParent(state.cell);
@ -868,7 +868,7 @@ mxGraphHandler.prototype.start = function(cell, x, y, cells)
*
* Adds the states for the given cell recursively to the given dictionary.
*/
mxGraphHandler.prototype.addStates = function(cell, dict)
addStates = (cell, dict)=>
{
var state = this.graph.view.getState(cell);
var count = 0;
@ -894,7 +894,7 @@ mxGraphHandler.prototype.addStates = function(cell, dict)
*
* Returns true if the given cell is currently being moved.
*/
mxGraphHandler.prototype.isCellMoving = function(cell)
isCellMoving = (cell)=>
{
return this.allCells.get(cell) != null;
};
@ -905,7 +905,7 @@ mxGraphHandler.prototype.isCellMoving = function(cell)
* Returns true if the guides should be used for the given <mxMouseEvent>.
* This implementation returns <mxGuide.isEnabledForEvent>.
*/
mxGraphHandler.prototype.useGuidesForEvent = function(me)
useGuidesForEvent = (me)=>
{
return (this.guide != null) ? this.guide.isEnabledForEvent(me.getEvent()) &&
!this.graph.isConstrainedEvent(me.getEvent()) : true;
@ -917,7 +917,7 @@ mxGraphHandler.prototype.useGuidesForEvent = function(me)
*
* Snaps the given vector to the grid and returns the given mxPoint instance.
*/
mxGraphHandler.prototype.snap = function(vector)
snap = (vector)=>
{
var scale = (this.scaleGrid) ? this.graph.view.scale : 1;
@ -933,7 +933,7 @@ mxGraphHandler.prototype.snap = function(vector)
* Returns an <mxPoint> that represents the vector for moving the cells
* for the given <mxMouseEvent>.
*/
mxGraphHandler.prototype.getDelta = function(me)
getDelta = (me)=>
{
var point = mxUtils.convertPoint(this.graph.container, me.getX(), me.getY());
@ -946,14 +946,14 @@ mxGraphHandler.prototype.getDelta = function(me)
*
* Hook for subclassers do show details while the handler is active.
*/
mxGraphHandler.prototype.updateHint = function(me) { };
updateHint = (me)=> { };
/**
* Function: removeHint
*
* Hooks for subclassers to hide details when the handler gets inactive.
*/
mxGraphHandler.prototype.removeHint = function() { };
removeHint = ()=> { };
/**
* Function: roundLength
@ -962,7 +962,7 @@ mxGraphHandler.prototype.removeHint = function() { };
* numbers coming in should be rounded if no half steps are allowed (ie for non
* aligned standard moving where pixel steps should be preferred).
*/
mxGraphHandler.prototype.roundLength = function(length)
roundLength = (length)=>
{
return Math.round(length * 100) / 100;
};
@ -972,7 +972,7 @@ mxGraphHandler.prototype.roundLength = function(length)
*
* Returns true if the given cell is a valid drop target.
*/
mxGraphHandler.prototype.isValidDropTarget = function(target, me)
isValidDropTarget = (target, me)=>
{
return this.graph.model.getParent(this.cell) != target;
};
@ -982,7 +982,7 @@ mxGraphHandler.prototype.isValidDropTarget = function(target, me)
*
* Updates the preview if cloning state has changed.
*/
mxGraphHandler.prototype.checkPreview = function()
checkPreview = ()=>
{
if (this.livePreviewActive && this.cloning)
{
@ -1009,7 +1009,7 @@ mxGraphHandler.prototype.checkPreview = function()
* Handles the event by highlighting possible drop targets and updating the
* preview.
*/
mxGraphHandler.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
var graph = this.graph;
@ -1168,7 +1168,7 @@ mxGraphHandler.prototype.mouseMove = function(sender, me)
*
* Updates the bounds of the preview shape.
*/
mxGraphHandler.prototype.updatePreview = function(remote)
updatePreview = (remote)=>
{
if (this.livePreviewUsed && !remote)
{
@ -1191,7 +1191,7 @@ mxGraphHandler.prototype.updatePreview = function(remote)
*
* Updates the bounds of the preview shape.
*/
mxGraphHandler.prototype.updatePreviewShape = function()
updatePreviewShape = ()=>
{
if (this.shape != null && this.pBounds != null)
{
@ -1206,7 +1206,7 @@ mxGraphHandler.prototype.updatePreviewShape = function()
*
* Updates the bounds of the preview shape.
*/
mxGraphHandler.prototype.updateLivePreview = function(dx, dy)
updateLivePreview = (dx, dy)=>
{
if (!this.suspended)
{
@ -1214,7 +1214,7 @@ mxGraphHandler.prototype.updateLivePreview = function(dx, dy)
if (this.allCells != null)
{
this.allCells.visit(mxUtils.bind(this, function(key, state)
this.allCells.visit(mxUtils.bind(this, (key, state)=>
{
var realState = this.graph.view.getState(state.cell);
@ -1392,7 +1392,7 @@ mxGraphHandler.prototype.updateLivePreview = function(dx, dy)
*
* Redraws the preview shape for the given states array.
*/
mxGraphHandler.prototype.redrawHandles = function(states)
redrawHandles = (states)=>
{
for (var i = 0; i < states.length; i++)
{
@ -1410,7 +1410,7 @@ mxGraphHandler.prototype.redrawHandles = function(states)
*
* Resets the given preview states array.
*/
mxGraphHandler.prototype.resetPreviewStates = function(states)
resetPreviewStates = (states)=>
{
for (var i = 0; i < states.length; i++)
{
@ -1423,7 +1423,7 @@ mxGraphHandler.prototype.resetPreviewStates = function(states)
*
* Suspends the livew preview.
*/
mxGraphHandler.prototype.suspend = function()
suspend = ()=>
{
if (!this.suspended)
{
@ -1451,7 +1451,7 @@ mxGraphHandler.prototype.suspend = function()
*
* Suspends the livew preview.
*/
mxGraphHandler.prototype.resume = function()
resume = ()=>
{
if (this.suspended)
{
@ -1479,11 +1479,11 @@ mxGraphHandler.prototype.resume = function()
*
* Resets the livew preview.
*/
mxGraphHandler.prototype.resetLivePreview = function()
resetLivePreview = ()=>
{
if (this.allCells != null)
{
this.allCells.visit(mxUtils.bind(this, function(key, state)
this.allCells.visit(mxUtils.bind(this, (key, state)=>
{
// Restores event handling
if (state.shape != null && state.shape.originalPointerEvents != null)
@ -1537,7 +1537,7 @@ mxGraphHandler.prototype.resetLivePreview = function()
* visible - Boolean that specifies if the handles should be visible.
* force - Forces an update of the handler regardless of the last used value.
*/
mxGraphHandler.prototype.setHandlesVisibleForCells = function(cells, visible, force)
setHandlesVisibleForCells = (cells, visible, force)=>
{
if (force || this.handlesVisible != visible)
{
@ -1569,7 +1569,7 @@ mxGraphHandler.prototype.setHandlesVisibleForCells = function(cells, visible, fo
*
* color - String that represents the new highlight color.
*/
mxGraphHandler.prototype.setHighlightColor = function(color)
setHighlightColor = (color)=>
{
if (this.highlight != null)
{
@ -1582,7 +1582,7 @@ mxGraphHandler.prototype.setHighlightColor = function(color)
*
* Handles the event by applying the changes to the selection cells.
*/
mxGraphHandler.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
if (!me.isConsumed())
{
@ -1641,7 +1641,7 @@ mxGraphHandler.prototype.mouseUp = function(sender, me)
*
* Resets the state of this handler.
*/
mxGraphHandler.prototype.reset = function()
reset = ()=>
{
if (this.livePreviewUsed)
{
@ -1678,7 +1678,7 @@ mxGraphHandler.prototype.reset = function()
* Returns true if the given cells should be removed from the parent for the specified
* mousereleased event.
*/
mxGraphHandler.prototype.shouldRemoveCellsFromParent = function(parent, cells, evt)
shouldRemoveCellsFromParent = (parent, cells, evt)=>
{
if (this.graph.getModel().isVertex(parent))
{
@ -1710,7 +1710,7 @@ mxGraphHandler.prototype.shouldRemoveCellsFromParent = function(parent, cells, e
*
* Moves the given cells by the specified amount.
*/
mxGraphHandler.prototype.moveCells = function(cells, dx, dy, clone, target, evt)
moveCells = (cells, dx, dy, clone, target, evt)=>
{
if (clone)
{
@ -1797,7 +1797,7 @@ mxGraphHandler.prototype.moveCells = function(cells, dx, dy, clone, target, evt)
*
* Returns true if the given parent should be removed after removal of child cells.
*/
mxGraphHandler.prototype.shouldRemoveParent = function(parent)
shouldRemoveParent = (parent)=>
{
var state = this.graph.view.getState(parent);
@ -1811,7 +1811,7 @@ mxGraphHandler.prototype.shouldRemoveParent = function(parent)
*
* Destroy the preview and highlight shapes.
*/
mxGraphHandler.prototype.destroyShapes = function()
destroyShapes = ()=>
{
// Destroys the preview dashed rectangle
if (this.shape != null)
@ -1839,7 +1839,7 @@ mxGraphHandler.prototype.destroyShapes = function()
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxGraphHandler.prototype.destroy = function()
destroy = ()=>
{
this.graph.removeMouseListener(this);
this.graph.removeListener(this.panHandler);

View File

@ -30,49 +30,49 @@ function mxHandle(state, cursor, image, shape)
*
* Specifies the cursor to be used for this handle. Default is 'default'.
*/
mxHandle.prototype.cursor = 'default';
cursor = 'default';
/**
* Variable: image
*
* Specifies the <mxImage> to be used to render the handle. Default is null.
*/
mxHandle.prototype.image = null;
image = null;
/**
* Variable: ignoreGrid
*
* Default is false.
*/
mxHandle.prototype.ignoreGrid = false;
ignoreGrid = false;
/**
* Function: getPosition
*
* Hook for subclassers to return the current position of the handle.
*/
mxHandle.prototype.getPosition = function(bounds) { };
getPosition = (bounds)=> { };
/**
* Function: setPosition
*
* Hooks for subclassers to update the style in the <state>.
*/
mxHandle.prototype.setPosition = function(bounds, pt, me) { };
setPosition = (bounds, pt, me)=> { };
/**
* Function: execute
*
* Hook for subclassers to execute the handle.
*/
mxHandle.prototype.execute = function(me) { };
execute = (me)=> { };
/**
* Function: copyStyle
*
* Sets the cell style with the given name to the corresponding value in <state>.
*/
mxHandle.prototype.copyStyle = function(key)
copyStyle = (key)=>
{
this.graph.setCellStyles(key, this.state.style[key], [this.state.cell]);
};
@ -82,7 +82,7 @@ mxHandle.prototype.copyStyle = function(key)
*
* Processes the given <mxMouseEvent> and invokes <setPosition>.
*/
mxHandle.prototype.processEvent = function(me)
processEvent = (me)=>
{
var scale = this.graph.view.scale;
var tr = this.graph.view.translate;
@ -110,7 +110,7 @@ mxHandle.prototype.processEvent = function(me)
* Should be called after <setPosition> in <processEvent>.
* This repaints the state using <mxCellRenderer>.
*/
mxHandle.prototype.positionChanged = function()
positionChanged = ()=>
{
if (this.state.text != null)
{
@ -130,7 +130,7 @@ mxHandle.prototype.positionChanged = function()
*
* Returns the rotation defined in the style of the cell.
*/
mxHandle.prototype.getRotation = function()
getRotation = ()=>
{
if (this.state.shape != null)
{
@ -146,7 +146,7 @@ mxHandle.prototype.getRotation = function()
* Returns the rotation from the style and the rotation from the direction of
* the cell.
*/
mxHandle.prototype.getTotalRotation = function()
getTotalRotation = ()=>
{
if (this.state.shape != null)
{
@ -161,7 +161,7 @@ mxHandle.prototype.getTotalRotation = function()
*
* Creates and initializes the shapes required for this handle.
*/
mxHandle.prototype.init = function()
init = ()=>
{
var html = this.isHtmlRequired();
@ -183,7 +183,7 @@ mxHandle.prototype.init = function()
*
* Creates and returns the shape for this handle.
*/
mxHandle.prototype.createShape = function(html)
createShape = (html)=>
{
var bounds = new mxRectangle(0, 0, mxConstants.HANDLE_SIZE, mxConstants.HANDLE_SIZE);
@ -195,7 +195,7 @@ mxHandle.prototype.createShape = function(html)
*
* Initializes <shape> and sets its cursor.
*/
mxHandle.prototype.initShape = function(html)
initShape = (html)=>
{
if (html && this.shape.isHtmlAllowed())
{
@ -222,7 +222,7 @@ mxHandle.prototype.initShape = function(html)
*
* Renders the shape for this handle.
*/
mxHandle.prototype.redraw = function()
redraw = ()=>
{
if (this.shape != null && this.state.shape != null)
{
@ -250,7 +250,7 @@ mxHandle.prototype.redraw = function()
* Returns true if this handle should be rendered in HTML. This returns true if
* the text node is in the graph container.
*/
mxHandle.prototype.isHtmlRequired = function()
isHtmlRequired = ()=>
{
return this.state.text != null && this.state.text.node.parentNode == this.graph.container;
};
@ -260,7 +260,7 @@ mxHandle.prototype.isHtmlRequired = function()
*
* Rotates the point by the given angle.
*/
mxHandle.prototype.rotatePoint = function(pt, alpha)
rotatePoint = (pt, alpha)=>
{
var bounds = this.state.getCellBounds();
var cx = new mxPoint(bounds.getCenterX(), bounds.getCenterY());
@ -275,7 +275,7 @@ mxHandle.prototype.rotatePoint = function(pt, alpha)
*
* Flips the given point vertically and/or horizontally.
*/
mxHandle.prototype.flipPoint = function(pt)
flipPoint = (pt)=>
{
if (this.state.shape != null)
{
@ -301,7 +301,7 @@ mxHandle.prototype.flipPoint = function(pt)
* Snaps the given point to the grid if ignore is false. This modifies
* the given point in-place and also returns it.
*/
mxHandle.prototype.snapPoint = function(pt, ignore)
snapPoint = (pt, ignore)=>
{
if (!ignore)
{
@ -317,7 +317,7 @@ mxHandle.prototype.snapPoint = function(pt, ignore)
*
* Shows or hides this handle.
*/
mxHandle.prototype.setVisible = function(visible)
setVisible = (visible)=>
{
if (this.shape != null && this.shape.node != null)
{
@ -330,7 +330,7 @@ mxHandle.prototype.setVisible = function(visible)
*
* Resets the state of this handle by setting its visibility to true.
*/
mxHandle.prototype.reset = function()
reset = ()=>
{
this.setVisible(true);
this.state.style = this.graph.getCellStyle(this.state.cell);
@ -342,7 +342,7 @@ mxHandle.prototype.reset = function()
*
* Destroys this handle.
*/
mxHandle.prototype.destroy = function()
destroy = ()=>
{
if (this.shape != null)
{

View File

@ -21,7 +21,7 @@
*
* (code)
* var keyHandler = new mxKeyHandler(graph);
* keyHandler.bindKey(46, function(evt)
* keyHandler.bindKey(46, (evt)=>
* {
* if (graph.isEnabled())
* {
@ -40,7 +40,7 @@
* code can be used.
*
* (code)
* keyHandler.getFunction = function(evt)
* keyHandler.getFunction = (evt)=>
* {
* if (evt != null)
* {
@ -76,7 +76,7 @@ function mxKeyHandler(graph, target)
this.controlKeys = [];
this.controlShiftKeys = [];
this.keydownHandler = mxUtils.bind(this, function(evt)
this.keydownHandler = mxUtils.bind(this, (evt)=>
{
this.keyDown(evt);
});
@ -88,7 +88,7 @@ function mxKeyHandler(graph, target)
if (mxClient.IS_IE)
{
mxEvent.addListener(window, 'unload',
mxUtils.bind(this, function()
mxUtils.bind(this, ()=>
{
this.destroy();
})
@ -102,7 +102,7 @@ function mxKeyHandler(graph, target)
*
* Reference to the <mxGraph> associated with this handler.
*/
mxKeyHandler.prototype.graph = null;
graph = null;
/**
* Variable: target
@ -110,42 +110,42 @@ mxKeyHandler.prototype.graph = null;
* Reference to the target DOM, that is, the DOM node where the key event
* listeners are installed.
*/
mxKeyHandler.prototype.target = null;
target = null;
/**
* Variable: normalKeys
*
* Maps from keycodes to functions for non-pressed control keys.
*/
mxKeyHandler.prototype.normalKeys = null;
normalKeys = null;
/**
* Variable: shiftKeys
*
* Maps from keycodes to functions for pressed shift keys.
*/
mxKeyHandler.prototype.shiftKeys = null;
shiftKeys = null;
/**
* Variable: controlKeys
*
* Maps from keycodes to functions for pressed control keys.
*/
mxKeyHandler.prototype.controlKeys = null;
controlKeys = null;
/**
* Variable: controlShiftKeys
*
* Maps from keycodes to functions for pressed control and shift keys.
*/
mxKeyHandler.prototype.controlShiftKeys = null;
controlShiftKeys = null;
/**
* Variable: enabled
*
* Specifies if events are handled. Default is true.
*/
mxKeyHandler.prototype.enabled = true;
enabled = true;
/**
* Function: isEnabled
@ -153,7 +153,7 @@ mxKeyHandler.prototype.enabled = true;
* Returns true if events are handled. This implementation returns
* <enabled>.
*/
mxKeyHandler.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -167,7 +167,7 @@ mxKeyHandler.prototype.isEnabled = function()
*
* enabled - Boolean that specifies the new enabled state.
*/
mxKeyHandler.prototype.setEnabled = function(enabled)
setEnabled = (enabled)=>
{
this.enabled = enabled;
};
@ -183,7 +183,7 @@ mxKeyHandler.prototype.setEnabled = function(enabled)
* code - Integer that specifies the keycode.
* funct - JavaScript function that takes the key event as an argument.
*/
mxKeyHandler.prototype.bindKey = function(code, funct)
bindKey = (code, funct)=>
{
this.normalKeys[code] = funct;
};
@ -199,7 +199,7 @@ mxKeyHandler.prototype.bindKey = function(code, funct)
* code - Integer that specifies the keycode.
* funct - JavaScript function that takes the key event as an argument.
*/
mxKeyHandler.prototype.bindShiftKey = function(code, funct)
bindShiftKey = (code, funct)=>
{
this.shiftKeys[code] = funct;
};
@ -215,7 +215,7 @@ mxKeyHandler.prototype.bindShiftKey = function(code, funct)
* code - Integer that specifies the keycode.
* funct - JavaScript function that takes the key event as an argument.
*/
mxKeyHandler.prototype.bindControlKey = function(code, funct)
bindControlKey = (code, funct)=>
{
this.controlKeys[code] = funct;
};
@ -231,7 +231,7 @@ mxKeyHandler.prototype.bindControlKey = function(code, funct)
* code - Integer that specifies the keycode.
* funct - JavaScript function that takes the key event as an argument.
*/
mxKeyHandler.prototype.bindControlShiftKey = function(code, funct)
bindControlShiftKey = (code, funct)=>
{
this.controlShiftKeys[code] = funct;
};
@ -245,7 +245,7 @@ mxKeyHandler.prototype.bindControlShiftKey = function(code, funct)
*
* evt - Key event whose control key pressed state should be returned.
*/
mxKeyHandler.prototype.isControlDown = function(evt)
isControlDown = (evt)=>
{
return mxEvent.isControlDown(evt);
};
@ -260,7 +260,7 @@ mxKeyHandler.prototype.isControlDown = function(evt)
*
* evt - Key event whose associated function should be returned.
*/
mxKeyHandler.prototype.getFunction = function(evt)
getFunction = (evt)=>
{
if (evt != null && !mxEvent.isAltDown(evt))
{
@ -303,7 +303,7 @@ mxKeyHandler.prototype.getFunction = function(evt)
*
* evt - Key event that represents the keystroke.
*/
mxKeyHandler.prototype.isGraphEvent = function(evt)
isGraphEvent = (evt)=>
{
var source = mxEvent.getSource(evt);
@ -331,7 +331,7 @@ mxKeyHandler.prototype.isGraphEvent = function(evt)
*
* evt - Key event that represents the keystroke.
*/
mxKeyHandler.prototype.keyDown = function(evt)
keyDown = (evt)=>
{
if (this.isEnabledForEvent(evt))
{
@ -368,7 +368,7 @@ mxKeyHandler.prototype.keyDown = function(evt)
*
* evt - Key event that represents the keystroke.
*/
mxKeyHandler.prototype.isEnabledForEvent = function(evt)
isEnabledForEvent = (evt)=>
{
return (this.graph.isEnabled() && !mxEvent.isConsumed(evt) &&
this.isGraphEvent(evt) && this.isEnabled());
@ -384,7 +384,7 @@ mxKeyHandler.prototype.isEnabledForEvent = function(evt)
*
* evt - Key event that represents the keystroke.
*/
mxKeyHandler.prototype.isEventIgnored = function(evt)
isEventIgnored = (evt)=>
{
return this.graph.isEditing();
};
@ -401,7 +401,7 @@ mxKeyHandler.prototype.isEventIgnored = function(evt)
* evt - Key event that represents the keystroke. Possible keycode in this
* case is 27 (ESCAPE).
*/
mxKeyHandler.prototype.escape = function(evt)
escape = (evt)=>
{
if (this.graph.isEscapeEnabled())
{
@ -416,7 +416,7 @@ mxKeyHandler.prototype.escape = function(evt)
* normally not need to be called, it is called automatically when the
* window unloads (in IE).
*/
mxKeyHandler.prototype.destroy = function()
destroy = ()=>
{
if (this.target != null && this.keydownHandler != null)
{

View File

@ -39,7 +39,7 @@ function mxPanningHandler(graph)
this.graph.addMouseListener(this);
// Handles force panning event
this.forcePanningHandler = mxUtils.bind(this, function(sender, evt)
this.forcePanningHandler = mxUtils.bind(this, (sender, evt)=>
{
var evtName = evt.getProperty('eventName');
var me = evt.getProperty('event');
@ -56,7 +56,7 @@ function mxPanningHandler(graph)
this.graph.addListener(mxEvent.FIRE_MOUSE_EVENT, this.forcePanningHandler);
// Handles pinch gestures
this.gestureHandler = mxUtils.bind(this, function(sender, eo)
this.gestureHandler = mxUtils.bind(this, (sender, eo)=>
{
if (this.isPinchEnabled())
{
@ -87,7 +87,7 @@ function mxPanningHandler(graph)
this.graph.addListener(mxEvent.GESTURE, this.gestureHandler);
this.mouseUpListener = mxUtils.bind(this, function()
this.mouseUpListener = mxUtils.bind(this, ()=>
{
if (this.active)
{
@ -104,14 +104,14 @@ function mxPanningHandler(graph)
* Extends mxEventSource.
*/
mxPanningHandler.prototype = new mxEventSource();
mxPanningHandler.prototype.constructor = mxPanningHandler;
constructor = mxPanningHandler;
/**
* Variable: graph
*
* Reference to the enclosing <mxGraph>.
*/
mxPanningHandler.prototype.graph = null;
graph = null;
/**
* Variable: useLeftButtonForPanning
@ -119,14 +119,14 @@ mxPanningHandler.prototype.graph = null;
* Specifies if panning should be active for the left mouse button.
* Setting this to true may conflict with <mxRubberband>. Default is false.
*/
mxPanningHandler.prototype.useLeftButtonForPanning = false;
useLeftButtonForPanning = false;
/**
* Variable: usePopupTrigger
*
* Specifies if <mxEvent.isPopupTrigger> should also be used for panning.
*/
mxPanningHandler.prototype.usePopupTrigger = true;
usePopupTrigger = true;
/**
* Variable: ignoreCell
@ -134,14 +134,14 @@ mxPanningHandler.prototype.usePopupTrigger = true;
* Specifies if panning should be active even if there is a cell under the
* mousepointer. Default is false.
*/
mxPanningHandler.prototype.ignoreCell = false;
ignoreCell = false;
/**
* Variable: previewEnabled
*
* Specifies if the panning should be previewed. Default is true.
*/
mxPanningHandler.prototype.previewEnabled = true;
previewEnabled = true;
/**
* Variable: useGrid
@ -149,70 +149,70 @@ mxPanningHandler.prototype.previewEnabled = true;
* Specifies if the panning steps should be aligned to the grid size.
* Default is false.
*/
mxPanningHandler.prototype.useGrid = false;
useGrid = false;
/**
* Variable: panningEnabled
*
* Specifies if panning should be enabled. Default is true.
*/
mxPanningHandler.prototype.panningEnabled = true;
panningEnabled = true;
/**
* Variable: pinchEnabled
*
* Specifies if pinch gestures should be handled as zoom. Default is true.
*/
mxPanningHandler.prototype.pinchEnabled = true;
pinchEnabled = true;
/**
* Variable: maxScale
*
* Specifies the maximum scale. Default is 8.
*/
mxPanningHandler.prototype.maxScale = 8;
maxScale = 8;
/**
* Variable: minScale
*
* Specifies the minimum scale. Default is 0.01.
*/
mxPanningHandler.prototype.minScale = 0.01;
minScale = 0.01;
/**
* Variable: dx
*
* Holds the current horizontal offset.
*/
mxPanningHandler.prototype.dx = null;
dx = null;
/**
* Variable: dy
*
* Holds the current vertical offset.
*/
mxPanningHandler.prototype.dy = null;
dy = null;
/**
* Variable: startX
*
* Holds the x-coordinate of the start point.
*/
mxPanningHandler.prototype.startX = 0;
startX = 0;
/**
* Variable: startY
*
* Holds the y-coordinate of the start point.
*/
mxPanningHandler.prototype.startY = 0;
startY = 0;
/**
* Function: isActive
*
* Returns true if the handler is currently active.
*/
mxPanningHandler.prototype.isActive = function()
isActive = ()=>
{
return this.active || this.initialScale != null;
};
@ -222,7 +222,7 @@ mxPanningHandler.prototype.isActive = function()
*
* Returns <panningEnabled>.
*/
mxPanningHandler.prototype.isPanningEnabled = function()
isPanningEnabled = ()=>
{
return this.panningEnabled;
};
@ -232,7 +232,7 @@ mxPanningHandler.prototype.isPanningEnabled = function()
*
* Sets <panningEnabled>.
*/
mxPanningHandler.prototype.setPanningEnabled = function(value)
setPanningEnabled = (value)=>
{
this.panningEnabled = value;
};
@ -242,7 +242,7 @@ mxPanningHandler.prototype.setPanningEnabled = function(value)
*
* Returns <pinchEnabled>.
*/
mxPanningHandler.prototype.isPinchEnabled = function()
isPinchEnabled = ()=>
{
return this.pinchEnabled;
};
@ -252,7 +252,7 @@ mxPanningHandler.prototype.isPinchEnabled = function()
*
* Sets <pinchEnabled>.
*/
mxPanningHandler.prototype.setPinchEnabled = function(value)
setPinchEnabled = (value)=>
{
this.pinchEnabled = value;
};
@ -264,7 +264,7 @@ mxPanningHandler.prototype.setPinchEnabled = function(value)
* given cell. This returns true if control-shift is pressed or if
* <usePopupTrigger> is true and the event is a popup trigger.
*/
mxPanningHandler.prototype.isPanningTrigger = function(me)
isPanningTrigger = (me)=>
{
var evt = me.getEvent();
@ -280,7 +280,7 @@ mxPanningHandler.prototype.isPanningTrigger = function(me)
* implementation always returns true if <ignoreCell> is true or for
* multi touch events.
*/
mxPanningHandler.prototype.isForcePanningEvent = function(me)
isForcePanningEvent = (me)=>
{
return this.ignoreCell || mxEvent.isMultiTouchEvent(me.getEvent());
};
@ -291,7 +291,7 @@ mxPanningHandler.prototype.isForcePanningEvent = function(me)
* Handles the event by initiating the panning. By consuming the event all
* subsequent events of the gesture are redirected to this handler.
*/
mxPanningHandler.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
this.mouseDownEvent = me;
@ -307,7 +307,7 @@ mxPanningHandler.prototype.mouseDown = function(sender, me)
*
* Starts panning at the given event.
*/
mxPanningHandler.prototype.start = function(me)
start = (me)=>
{
this.dx0 = -this.graph.container.scrollLeft;
this.dy0 = -this.graph.container.scrollTop;
@ -331,7 +331,7 @@ mxPanningHandler.prototype.start = function(me)
* Safari and/or on the Mac, then use the following code:
*
* (code)
* mxPanningHandler.prototype.consumePanningTrigger = function(me)
* consumePanningTrigger = (me)=>
* {
* if (me.evt.preventDefault)
* {
@ -349,7 +349,7 @@ mxPanningHandler.prototype.start = function(me)
* };
* (end)
*/
mxPanningHandler.prototype.consumePanningTrigger = function(me)
consumePanningTrigger = (me)=>
{
me.consume();
};
@ -359,7 +359,7 @@ mxPanningHandler.prototype.consumePanningTrigger = function(me)
*
* Handles the event by updating the panning on the graph.
*/
mxPanningHandler.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
this.dx = me.getX() - this.startX;
this.dy = me.getY() - this.startY;
@ -406,7 +406,7 @@ mxPanningHandler.prototype.mouseMove = function(sender, me)
* Handles the event by setting the translation on the view or showing the
* popupmenu.
*/
mxPanningHandler.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
if (this.active)
{
@ -435,7 +435,7 @@ mxPanningHandler.prototype.mouseUp = function(sender, me)
*
* Zooms the graph to the given value and consumed the event if needed.
*/
mxPanningHandler.prototype.zoomGraph = function(evt)
zoomGraph = (evt)=>
{
var value = Math.round(this.initialScale * evt.scale * 100) / 100;
@ -461,7 +461,7 @@ mxPanningHandler.prototype.zoomGraph = function(evt)
*
* Resets the state of this handler.
*/
mxPanningHandler.prototype.reset = function()
reset = ()=>
{
this.panningTrigger = false;
this.mouseDownEvent = null;
@ -475,7 +475,7 @@ mxPanningHandler.prototype.reset = function()
*
* Pans <graph> by the given amount.
*/
mxPanningHandler.prototype.panGraph = function(dx, dy)
panGraph = (dx, dy)=>
{
this.graph.getView().setTranslate(dx, dy);
};
@ -485,7 +485,7 @@ mxPanningHandler.prototype.panGraph = function(dx, dy)
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxPanningHandler.prototype.destroy = function()
destroy = ()=>
{
this.graph.removeMouseListener(this);
this.graph.removeListener(this.forcePanningHandler);

View File

@ -20,7 +20,7 @@ function mxPopupMenuHandler(graph, factoryMethod)
this.graph.addMouseListener(this);
// Does not show menu if any touch gestures take place after the trigger
this.gestureHandler = mxUtils.bind(this, function(sender, eo)
this.gestureHandler = mxUtils.bind(this, (sender, eo)=>
{
this.inTolerance = false;
});
@ -35,14 +35,14 @@ function mxPopupMenuHandler(graph, factoryMethod)
* Extends mxPopupMenu.
*/
mxPopupMenuHandler.prototype = new mxPopupMenu();
mxPopupMenuHandler.prototype.constructor = mxPopupMenuHandler;
constructor = mxPopupMenuHandler;
/**
* Variable: graph
*
* Reference to the enclosing <mxGraph>.
*/
mxPopupMenuHandler.prototype.graph = null;
graph = null;
/**
* Variable: selectOnPopup
@ -50,7 +50,7 @@ mxPopupMenuHandler.prototype.graph = null;
* Specifies if cells should be selected if a popupmenu is displayed for
* them. Default is true.
*/
mxPopupMenuHandler.prototype.selectOnPopup = true;
selectOnPopup = true;
/**
* Variable: clearSelectionOnBackground
@ -58,49 +58,49 @@ mxPopupMenuHandler.prototype.selectOnPopup = true;
* Specifies if cells should be deselected if a popupmenu is displayed for
* the diagram background. Default is true.
*/
mxPopupMenuHandler.prototype.clearSelectionOnBackground = true;
clearSelectionOnBackground = true;
/**
* Variable: triggerX
*
* X-coordinate of the mouse down event.
*/
mxPopupMenuHandler.prototype.triggerX = null;
triggerX = null;
/**
* Variable: triggerY
*
* Y-coordinate of the mouse down event.
*/
mxPopupMenuHandler.prototype.triggerY = null;
triggerY = null;
/**
* Variable: screenX
*
* Screen X-coordinate of the mouse down event.
*/
mxPopupMenuHandler.prototype.screenX = null;
screenX = null;
/**
* Variable: screenY
*
* Screen Y-coordinate of the mouse down event.
*/
mxPopupMenuHandler.prototype.screenY = null;
screenY = null;
/**
* Function: init
*
* Initializes the shapes required for this vertex handler.
*/
mxPopupMenuHandler.prototype.init = function()
init = ()=>
{
// Supercall
mxPopupMenu.prototype.init.apply(this);
init.apply(this);
// Hides the tooltip if the mouse is over
// the context menu
mxEvent.addGestureListeners(this.div, mxUtils.bind(this, function(evt)
mxEvent.addGestureListeners(this.div, mxUtils.bind(this, (evt)=>
{
this.graph.tooltipHandler.hide();
}));
@ -112,7 +112,7 @@ mxPopupMenuHandler.prototype.init = function()
* Hook for returning if a cell should be selected for a given <mxMouseEvent>.
* This implementation returns <selectOnPopup>.
*/
mxPopupMenuHandler.prototype.isSelectOnPopup = function(me)
isSelectOnPopup = (me)=>
{
return this.selectOnPopup;
};
@ -123,7 +123,7 @@ mxPopupMenuHandler.prototype.isSelectOnPopup = function(me)
* Handles the event by initiating the panning. By consuming the event all
* subsequent events of the gesture are redirected to this handler.
*/
mxPopupMenuHandler.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
if (this.isEnabled() && !mxEvent.isMultiTouchEvent(me.getEvent()))
{
@ -143,7 +143,7 @@ mxPopupMenuHandler.prototype.mouseDown = function(sender, me)
*
* Handles the event by updating the panning on the graph.
*/
mxPopupMenuHandler.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
// Popup trigger may change on mouseUp so ignore it
if (this.inTolerance && this.screenX != null && this.screenY != null)
@ -162,7 +162,7 @@ mxPopupMenuHandler.prototype.mouseMove = function(sender, me)
* Handles the event by setting the translation on the view or showing the
* popupmenu.
*/
mxPopupMenuHandler.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
if (this.popupTrigger && this.inTolerance && this.triggerX != null && this.triggerY != null)
{
@ -198,7 +198,7 @@ mxPopupMenuHandler.prototype.mouseUp = function(sender, me)
*
* Hook to return the cell for the mouse up popup trigger handling.
*/
mxPopupMenuHandler.prototype.getCellForPopupEvent = function(me)
getCellForPopupEvent = (me)=>
{
return me.getCell();
};
@ -208,11 +208,11 @@ mxPopupMenuHandler.prototype.getCellForPopupEvent = function(me)
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxPopupMenuHandler.prototype.destroy = function()
destroy = ()=>
{
this.graph.removeMouseListener(this);
this.graph.removeListener(this.gestureHandler);
// Supercall
mxPopupMenu.prototype.destroy.apply(this);
destroy.apply(this);
};

View File

@ -27,7 +27,7 @@ function mxRubberband(graph)
this.graph.addMouseListener(this);
// Handles force rubberband event
this.forceRubberbandHandler = mxUtils.bind(this, function(sender, evt)
this.forceRubberbandHandler = mxUtils.bind(this, (sender, evt)=>
{
var evtName = evt.getProperty('eventName');
var me = evt.getProperty('event');
@ -46,7 +46,7 @@ function mxRubberband(graph)
this.graph.addListener(mxEvent.FIRE_MOUSE_EVENT, this.forceRubberbandHandler);
// Repaints the marquee after autoscroll
this.panHandler = mxUtils.bind(this, function()
this.panHandler = mxUtils.bind(this, ()=>
{
this.repaint();
});
@ -54,7 +54,7 @@ function mxRubberband(graph)
this.graph.addListener(mxEvent.PAN, this.panHandler);
// Does not show menu if any touch gestures take place after the trigger
this.gestureHandler = mxUtils.bind(this, function(sender, eo)
this.gestureHandler = mxUtils.bind(this, (sender, eo)=>
{
if (this.first != null)
{
@ -68,7 +68,7 @@ function mxRubberband(graph)
if (mxClient.IS_IE)
{
mxEvent.addListener(window, 'unload',
mxUtils.bind(this, function()
mxUtils.bind(this, ()=>
{
this.destroy();
})
@ -83,49 +83,49 @@ function mxRubberband(graph)
* Specifies the default opacity to be used for the rubberband div. Default
* is 20.
*/
mxRubberband.prototype.defaultOpacity = 20;
defaultOpacity = 20;
/**
* Variable: enabled
*
* Specifies if events are handled. Default is true.
*/
mxRubberband.prototype.enabled = true;
enabled = true;
/**
* Variable: div
*
* Holds the DIV element which is currently visible.
*/
mxRubberband.prototype.div = null;
div = null;
/**
* Variable: sharedDiv
*
* Holds the DIV element which is used to display the rubberband.
*/
mxRubberband.prototype.sharedDiv = null;
sharedDiv = null;
/**
* Variable: currentX
*
* Holds the value of the x argument in the last call to <update>.
*/
mxRubberband.prototype.currentX = 0;
currentX = 0;
/**
* Variable: currentY
*
* Holds the value of the y argument in the last call to <update>.
*/
mxRubberband.prototype.currentY = 0;
currentY = 0;
/**
* Variable: fadeOut
*
* Optional fade out effect. Default is false.
*/
mxRubberband.prototype.fadeOut = false;
fadeOut = false;
/**
* Function: isEnabled
@ -133,7 +133,7 @@ mxRubberband.prototype.fadeOut = false;
* Returns true if events are handled. This implementation returns
* <enabled>.
*/
mxRubberband.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -144,7 +144,7 @@ mxRubberband.prototype.isEnabled = function()
* Enables or disables event handling. This implementation updates
* <enabled>.
*/
mxRubberband.prototype.setEnabled = function(enabled)
setEnabled = (enabled)=>
{
this.enabled = enabled;
};
@ -155,7 +155,7 @@ mxRubberband.prototype.setEnabled = function(enabled)
* Returns true if the given <mxMouseEvent> should start rubberband selection.
* This implementation returns true if the alt key is pressed.
*/
mxRubberband.prototype.isForceRubberbandEvent = function(me)
isForceRubberbandEvent = (me)=>
{
return mxEvent.isAltDown(me.getEvent());
};
@ -167,7 +167,7 @@ mxRubberband.prototype.isForceRubberbandEvent = function(me)
* event all subsequent events of the gesture are redirected to this
* handler.
*/
mxRubberband.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
if (!me.isConsumed() && this.isEnabled() && this.graph.isEnabled() &&
me.getState() == null && !mxEvent.isMultiTouchEvent(me.getEvent()))
@ -192,7 +192,7 @@ mxRubberband.prototype.mouseDown = function(sender, me)
*
* Sets the start point for the rubberband selection.
*/
mxRubberband.prototype.start = function(x, y)
start = (x, y)=>
{
this.first = new mxPoint(x, y);
@ -209,12 +209,12 @@ mxRubberband.prototype.start = function(x, y)
return me;
};
this.dragHandler = mxUtils.bind(this, function(evt)
this.dragHandler = mxUtils.bind(this, (evt)=>
{
this.mouseMove(this.graph, createMouseEvent(evt));
});
this.dropHandler = mxUtils.bind(this, function(evt)
this.dropHandler = mxUtils.bind(this, (evt)=>
{
this.mouseUp(this.graph, createMouseEvent(evt));
});
@ -231,7 +231,7 @@ mxRubberband.prototype.start = function(x, y)
*
* Handles the event by updating therubberband selection.
*/
mxRubberband.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
if (!me.isConsumed() && this.first != null)
{
@ -267,7 +267,7 @@ mxRubberband.prototype.mouseMove = function(sender, me)
*
* Creates the rubberband selection shape.
*/
mxRubberband.prototype.createShape = function()
createShape = ()=>
{
if (this.sharedDiv == null)
{
@ -292,7 +292,7 @@ mxRubberband.prototype.createShape = function()
*
* Returns true if this handler is active.
*/
mxRubberband.prototype.isActive = function(sender, me)
isActive = (sender, me)=>
{
return this.div != null && this.div.style.display != 'none';
};
@ -303,7 +303,7 @@ mxRubberband.prototype.isActive = function(sender, me)
* Handles the event by selecting the region of the rubberband using
* <mxGraph.selectRegion>.
*/
mxRubberband.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
var active = this.isActive();
this.reset();
@ -321,7 +321,7 @@ mxRubberband.prototype.mouseUp = function(sender, me)
* Resets the state of this handler and selects the current region
* for the given event.
*/
mxRubberband.prototype.execute = function(evt)
execute = (evt)=>
{
var rect = new mxRectangle(this.x, this.y, this.width, this.height);
this.graph.selectRegion(rect, evt);
@ -332,7 +332,7 @@ mxRubberband.prototype.execute = function(evt)
*
* Resets the state of the rubberband selection.
*/
mxRubberband.prototype.reset = function()
reset = ()=>
{
if (this.div != null)
{
@ -343,7 +343,7 @@ mxRubberband.prototype.reset = function()
temp.style.pointerEvents = 'none';
temp.style.opacity = 0;
window.setTimeout(function()
window.setTimeout(()=>
{
temp.parentNode.removeChild(temp);
}, 200);
@ -369,7 +369,7 @@ mxRubberband.prototype.reset = function()
*
* Sets <currentX> and <currentY> and calls <repaint>.
*/
mxRubberband.prototype.update = function(x, y)
update = (x, y)=>
{
this.currentX = x;
this.currentY = y;
@ -382,7 +382,7 @@ mxRubberband.prototype.update = function(x, y)
*
* Computes the bounding box and updates the style of the <div>.
*/
mxRubberband.prototype.repaint = function()
repaint = ()=>
{
if (this.div != null)
{
@ -411,7 +411,7 @@ mxRubberband.prototype.repaint = function()
* normally not need to be called, it is called automatically when the
* window unloads.
*/
mxRubberband.prototype.destroy = function()
destroy = ()=>
{
if (!this.destroyed)
{

View File

@ -32,7 +32,7 @@ function mxSelectionCellsHandler(graph)
this.handlers = new mxDictionary();
this.graph.addMouseListener(this);
this.refreshHandler = mxUtils.bind(this, function(sender, evt)
this.refreshHandler = mxUtils.bind(this, (sender, evt)=>
{
if (this.isEnabled())
{
@ -59,42 +59,42 @@ mxUtils.extend(mxSelectionCellsHandler, mxEventSource);
*
* Reference to the enclosing <mxGraph>.
*/
mxSelectionCellsHandler.prototype.graph = null;
graph = null;
/**
* Variable: enabled
*
* Specifies if events are handled. Default is true.
*/
mxSelectionCellsHandler.prototype.enabled = true;
enabled = true;
/**
* Variable: refreshHandler
*
* Keeps a reference to an event listener for later removal.
*/
mxSelectionCellsHandler.prototype.refreshHandler = null;
refreshHandler = null;
/**
* Variable: maxHandlers
*
* Defines the maximum number of handlers to paint individually. Default is 100.
*/
mxSelectionCellsHandler.prototype.maxHandlers = 100;
maxHandlers = 100;
/**
* Variable: handlers
*
* <mxDictionary> that maps from cells to handlers.
*/
mxSelectionCellsHandler.prototype.handlers = null;
handlers = null;
/**
* Function: isEnabled
*
* Returns <enabled>.
*/
mxSelectionCellsHandler.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -104,7 +104,7 @@ mxSelectionCellsHandler.prototype.isEnabled = function()
*
* Sets <enabled>.
*/
mxSelectionCellsHandler.prototype.setEnabled = function(value)
setEnabled = (value)=>
{
this.enabled = value;
};
@ -114,7 +114,7 @@ mxSelectionCellsHandler.prototype.setEnabled = function(value)
*
* Returns the handler for the given cell.
*/
mxSelectionCellsHandler.prototype.getHandler = function(cell)
getHandler = (cell)=>
{
return this.handlers.get(cell);
};
@ -124,7 +124,7 @@ mxSelectionCellsHandler.prototype.getHandler = function(cell)
*
* Returns true if the given cell has a handler.
*/
mxSelectionCellsHandler.prototype.isHandled = function(cell)
isHandled = (cell)=>
{
return this.getHandler(cell) != null;
};
@ -134,9 +134,9 @@ mxSelectionCellsHandler.prototype.isHandled = function(cell)
*
* Resets all handlers.
*/
mxSelectionCellsHandler.prototype.reset = function()
reset = ()=>
{
this.handlers.visit(function(key, handler)
this.handlers.visit((key, handler)=>
{
handler.reset.apply(handler);
});
@ -147,7 +147,7 @@ mxSelectionCellsHandler.prototype.reset = function()
*
* Reloads or updates all handlers.
*/
mxSelectionCellsHandler.prototype.getHandledSelectionCells = function()
getHandledSelectionCells = ()=>
{
return this.graph.getSelectionCells();
};
@ -157,7 +157,7 @@ mxSelectionCellsHandler.prototype.getHandledSelectionCells = function()
*
* Reloads or updates all handlers.
*/
mxSelectionCellsHandler.prototype.refresh = function()
refresh = ()=>
{
// Removes all existing handlers
var oldHandlers = this.handlers;
@ -201,7 +201,7 @@ mxSelectionCellsHandler.prototype.refresh = function()
}
// Destroys unused handlers
oldHandlers.visit(mxUtils.bind(this, function(key, handler)
oldHandlers.visit(mxUtils.bind(this, (key, handler)=>
{
this.fireEvent(new mxEventObject(mxEvent.REMOVE, 'state', handler.state));
handler.destroy();
@ -235,7 +235,7 @@ mxSelectionCellsHandler.prototype.refresh = function()
*
* Returns true if the given handler is active and should not be redrawn.
*/
mxSelectionCellsHandler.prototype.isHandlerActive = function(handler)
isHandlerActive = (handler)=>
{
return handler.index != null;
};
@ -245,7 +245,7 @@ mxSelectionCellsHandler.prototype.isHandlerActive = function(handler)
*
* Updates the handler for the given shape if one exists.
*/
mxSelectionCellsHandler.prototype.updateHandler = function(state)
updateHandler = (state)=>
{
var handler = this.handlers.remove(state.cell);
@ -276,13 +276,13 @@ mxSelectionCellsHandler.prototype.updateHandler = function(state)
*
* Redirects the given event to the handlers.
*/
mxSelectionCellsHandler.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
if (this.graph.isEnabled() && this.isEnabled())
{
var args = [sender, me];
this.handlers.visit(function(key, handler)
this.handlers.visit((key, handler)=>
{
handler.mouseDown.apply(handler, args);
});
@ -294,13 +294,13 @@ mxSelectionCellsHandler.prototype.mouseDown = function(sender, me)
*
* Redirects the given event to the handlers.
*/
mxSelectionCellsHandler.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
if (this.graph.isEnabled() && this.isEnabled())
{
var args = [sender, me];
this.handlers.visit(function(key, handler)
this.handlers.visit((key, handler)=>
{
handler.mouseMove.apply(handler, args);
});
@ -312,13 +312,13 @@ mxSelectionCellsHandler.prototype.mouseMove = function(sender, me)
*
* Redirects the given event to the handlers.
*/
mxSelectionCellsHandler.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
if (this.graph.isEnabled() && this.isEnabled())
{
var args = [sender, me];
this.handlers.visit(function(key, handler)
this.handlers.visit((key, handler)=>
{
handler.mouseUp.apply(handler, args);
});
@ -330,7 +330,7 @@ mxSelectionCellsHandler.prototype.mouseUp = function(sender, me)
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxSelectionCellsHandler.prototype.destroy = function()
destroy = ()=>
{
this.graph.removeMouseListener(this);

View File

@ -41,28 +41,28 @@ function mxTooltipHandler(graph, delay)
*
* Specifies the zIndex for the tooltip and its shadow. Default is 10005.
*/
mxTooltipHandler.prototype.zIndex = 10005;
zIndex = 10005;
/**
* Variable: graph
*
* Reference to the enclosing <mxGraph>.
*/
mxTooltipHandler.prototype.graph = null;
graph = null;
/**
* Variable: delay
*
* Delay to show the tooltip in milliseconds. Default is 500.
*/
mxTooltipHandler.prototype.delay = null;
delay = null;
/**
* Variable: ignoreTouchEvents
*
* Specifies if touch and pen events should be ignored. Default is true.
*/
mxTooltipHandler.prototype.ignoreTouchEvents = true;
ignoreTouchEvents = true;
/**
* Variable: hideOnHover
@ -70,21 +70,21 @@ mxTooltipHandler.prototype.ignoreTouchEvents = true;
* Specifies if the tooltip should be hidden if the mouse is moved over the
* current cell. Default is false.
*/
mxTooltipHandler.prototype.hideOnHover = false;
hideOnHover = false;
/**
* Variable: destroyed
*
* True if this handler was destroyed using <destroy>.
*/
mxTooltipHandler.prototype.destroyed = false;
destroyed = false;
/**
* Variable: enabled
*
* Specifies if events are handled. Default is true.
*/
mxTooltipHandler.prototype.enabled = true;
enabled = true;
/**
* Function: isEnabled
@ -92,7 +92,7 @@ mxTooltipHandler.prototype.enabled = true;
* Returns true if events are handled. This implementation
* returns <enabled>.
*/
mxTooltipHandler.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -103,7 +103,7 @@ mxTooltipHandler.prototype.isEnabled = function()
* Enables or disables event handling. This implementation
* updates <enabled>.
*/
mxTooltipHandler.prototype.setEnabled = function(enabled)
setEnabled = (enabled)=>
{
this.enabled = enabled;
};
@ -113,7 +113,7 @@ mxTooltipHandler.prototype.setEnabled = function(enabled)
*
* Returns <hideOnHover>.
*/
mxTooltipHandler.prototype.isHideOnHover = function()
isHideOnHover = ()=>
{
return this.hideOnHover;
};
@ -123,7 +123,7 @@ mxTooltipHandler.prototype.isHideOnHover = function()
*
* Sets <hideOnHover>.
*/
mxTooltipHandler.prototype.setHideOnHover = function(value)
setHideOnHover = (value)=>
{
this.hideOnHover = value;
};
@ -133,7 +133,7 @@ mxTooltipHandler.prototype.setHideOnHover = function(value)
*
* Initializes the DOM nodes required for this tooltip handler.
*/
mxTooltipHandler.prototype.init = function()
init = ()=>
{
if (document.body != null)
{
@ -143,7 +143,7 @@ mxTooltipHandler.prototype.init = function()
document.body.appendChild(this.div);
mxEvent.addGestureListeners(this.div, mxUtils.bind(this, function(evt)
mxEvent.addGestureListeners(this.div, mxUtils.bind(this, (evt)=>
{
var source = mxEvent.getSource(evt);
@ -160,7 +160,7 @@ mxTooltipHandler.prototype.init = function()
*
* Returns the <mxCellState> to be used for showing a tooltip for this event.
*/
mxTooltipHandler.prototype.getStateForEvent = function(me)
getStateForEvent = (me)=>
{
return me.getState();
};
@ -172,7 +172,7 @@ mxTooltipHandler.prototype.getStateForEvent = function(me)
* event all subsequent events of the gesture are redirected to this
* handler.
*/
mxTooltipHandler.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
this.reset(me, false);
this.hideTooltip();
@ -183,7 +183,7 @@ mxTooltipHandler.prototype.mouseDown = function(sender, me)
*
* Handles the event by updating the rubberband selection.
*/
mxTooltipHandler.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
if (me.getX() != this.lastX || me.getY() != this.lastY)
{
@ -208,7 +208,7 @@ mxTooltipHandler.prototype.mouseMove = function(sender, me)
* Handles the event by resetting the tooltip timer or hiding the existing
* tooltip.
*/
mxTooltipHandler.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
this.reset(me, true);
this.hideTooltip();
@ -220,7 +220,7 @@ mxTooltipHandler.prototype.mouseUp = function(sender, me)
*
* Resets the timer.
*/
mxTooltipHandler.prototype.resetTimer = function()
resetTimer = ()=>
{
if (this.thread != null)
{
@ -234,7 +234,7 @@ mxTooltipHandler.prototype.resetTimer = function()
*
* Resets and/or restarts the timer to trigger the display of the tooltip.
*/
mxTooltipHandler.prototype.reset = function(me, restart, state)
reset = (me, restart, state)=>
{
if (!this.ignoreTouchEvents || mxEvent.isMouseEvent(me.getEvent()))
{
@ -249,7 +249,7 @@ mxTooltipHandler.prototype.reset = function(me, restart, state)
var y = me.getY();
var stateSource = me.isSource(state.shape) || me.isSource(state.text);
this.thread = window.setTimeout(mxUtils.bind(this, function()
this.thread = window.setTimeout(mxUtils.bind(this, ()=>
{
if (!this.graph.isEditing() && !this.graph.popupMenuHandler.isMenuShowing() && !this.graph.isMouseDown)
{
@ -272,7 +272,7 @@ mxTooltipHandler.prototype.reset = function(me, restart, state)
*
* Hides the tooltip and resets the timer.
*/
mxTooltipHandler.prototype.hide = function()
hide = ()=>
{
this.resetTimer();
this.hideTooltip();
@ -283,7 +283,7 @@ mxTooltipHandler.prototype.hide = function()
*
* Hides the tooltip.
*/
mxTooltipHandler.prototype.hideTooltip = function()
hideTooltip = ()=>
{
if (this.div != null)
{
@ -298,7 +298,7 @@ mxTooltipHandler.prototype.hideTooltip = function()
* Shows the tooltip for the specified cell and optional index at the
* specified location (with a vertical offset of 10 pixels).
*/
mxTooltipHandler.prototype.show = function(tip, x, y)
show = (tip, x, y)=>
{
if (!this.destroyed && tip != null && tip.length > 0)
{
@ -335,7 +335,7 @@ mxTooltipHandler.prototype.show = function(tip, x, y)
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxTooltipHandler.prototype.destroy = function()
destroy = ()=>
{
if (!this.destroyed)
{

View File

@ -25,7 +25,7 @@ function mxVertexHandler(state)
this.init();
// Handles escape keystrokes
this.escapeHandler = mxUtils.bind(this, function(sender, evt)
this.escapeHandler = mxUtils.bind(this, (sender, evt)=>
{
if (this.livePreview && this.index != null)
{
@ -50,14 +50,14 @@ function mxVertexHandler(state)
*
* Reference to the enclosing <mxGraph>.
*/
mxVertexHandler.prototype.graph = null;
graph = null;
/**
* Variable: state
*
* Reference to the <mxCellState> being modified.
*/
mxVertexHandler.prototype.state = null;
state = null;
/**
* Variable: singleSizer
@ -65,14 +65,14 @@ mxVertexHandler.prototype.state = null;
* Specifies if only one sizer handle at the bottom, right corner should be
* used. Default is false.
*/
mxVertexHandler.prototype.singleSizer = false;
singleSizer = false;
/**
* Variable: index
*
* Holds the index of the current handle.
*/
mxVertexHandler.prototype.index = null;
index = null;
/**
* Variable: allowHandleBoundsCheck
@ -80,35 +80,35 @@ mxVertexHandler.prototype.index = null;
* Specifies if the bounds of handles should be used for hit-detection in IE or
* if <tolerance> > 0. Default is true.
*/
mxVertexHandler.prototype.allowHandleBoundsCheck = true;
allowHandleBoundsCheck = true;
/**
* Variable: handleImage
*
* Optional <mxImage> to be used as handles. Default is null.
*/
mxVertexHandler.prototype.handleImage = null;
handleImage = null;
/**
* Variable: handlesVisible
*
* If handles are currently visible.
*/
mxVertexHandler.prototype.handlesVisible = true;
handlesVisible = true;
/**
* Variable: tolerance
*
* Optional tolerance for hit-detection in <getHandleForEvent>. Default is 0.
*/
mxVertexHandler.prototype.tolerance = 0;
tolerance = 0;
/**
* Variable: rotationEnabled
*
* Specifies if a rotation handle should be visible. Default is false.
*/
mxVertexHandler.prototype.rotationEnabled = false;
rotationEnabled = false;
/**
* Variable: parentHighlightEnabled
@ -116,7 +116,7 @@ mxVertexHandler.prototype.rotationEnabled = false;
* Specifies if the parent should be highlighted if a child cell is selected.
* Default is false.
*/
mxVertexHandler.prototype.parentHighlightEnabled = false;
parentHighlightEnabled = false;
/**
* Variable: rotationRaster
@ -124,14 +124,14 @@ mxVertexHandler.prototype.parentHighlightEnabled = false;
* Specifies if rotation steps should be "rasterized" depening on the distance
* to the handle. Default is true.
*/
mxVertexHandler.prototype.rotationRaster = true;
rotationRaster = true;
/**
* Variable: rotationCursor
*
* Specifies the cursor for the rotation handle. Default is 'crosshair'.
*/
mxVertexHandler.prototype.rotationCursor = 'crosshair';
rotationCursor = 'crosshair';
/**
* Variable: livePreview
@ -139,14 +139,14 @@ mxVertexHandler.prototype.rotationCursor = 'crosshair';
* Specifies if resize should change the cell in-place. This is an experimental
* feature for non-touch devices. Default is false.
*/
mxVertexHandler.prototype.livePreview = false;
livePreview = false;
/**
* Variable: movePreviewToFront
*
* Specifies if the live preview should be moved to the front.
*/
mxVertexHandler.prototype.movePreviewToFront = false;
movePreviewToFront = false;
/**
* Variable: manageSizers
@ -154,7 +154,7 @@ mxVertexHandler.prototype.movePreviewToFront = false;
* Specifies if sizers should be hidden and spaced if the vertex is small.
* Default is false.
*/
mxVertexHandler.prototype.manageSizers = false;
manageSizers = false;
/**
* Variable: constrainGroupByChildren
@ -162,14 +162,14 @@ mxVertexHandler.prototype.manageSizers = false;
* Specifies if the size of groups should be constrained by the children.
* Default is false.
*/
mxVertexHandler.prototype.constrainGroupByChildren = false;
constrainGroupByChildren = false;
/**
* Variable: rotationHandleVSpacing
*
* Vertical spacing for rotation icon. Default is -16.
*/
mxVertexHandler.prototype.rotationHandleVSpacing = -16;
rotationHandleVSpacing = -16;
/**
* Variable: horizontalOffset
@ -177,7 +177,7 @@ mxVertexHandler.prototype.rotationHandleVSpacing = -16;
* The horizontal offset for the handles. This is updated in <redrawHandles>
* if <manageSizers> is true and the sizers are offset horizontally.
*/
mxVertexHandler.prototype.horizontalOffset = 0;
horizontalOffset = 0;
/**
* Variable: verticalOffset
@ -185,14 +185,14 @@ mxVertexHandler.prototype.horizontalOffset = 0;
* The horizontal offset for the handles. This is updated in <redrawHandles>
* if <manageSizers> is true and the sizers are offset vertically.
*/
mxVertexHandler.prototype.verticalOffset = 0;
verticalOffset = 0;
/**
* Function: init
*
* Initializes the shapes required for this vertex handler.
*/
mxVertexHandler.prototype.init = function()
init = ()=>
{
this.graph = this.state.view.graph;
this.selectionBounds = this.getSelectionBounds(this.state);
@ -211,7 +211,7 @@ mxVertexHandler.prototype.init = function()
}
// Adds the sizer handles
if (mxGraphHandler.prototype.maxCells <= 0 || this.graph.getSelectionCount() < mxGraphHandler.prototype.maxCells)
if (maxCells <= 0 || this.graph.getSelectionCount() < maxCells)
{
var resizable = this.graph.isCellResizable(this.state.cell);
this.sizers = [];
@ -279,10 +279,10 @@ mxVertexHandler.prototype.init = function()
*
* Returns true if the rotation handle should be showing.
*/
mxVertexHandler.prototype.isRotationHandleVisible = function()
isRotationHandleVisible = ()=>
{
return this.graph.isEnabled() && this.rotationEnabled && this.graph.isCellRotatable(this.state.cell) &&
(mxGraphHandler.prototype.maxCells <= 0 || this.graph.getSelectionCount() < mxGraphHandler.prototype.maxCells);
(maxCells <= 0 || this.graph.getSelectionCount() < maxCells);
};
/**
@ -290,7 +290,7 @@ mxVertexHandler.prototype.isRotationHandleVisible = function()
*
* Returns true if the aspect ratio if the cell should be maintained.
*/
mxVertexHandler.prototype.isConstrainedEvent = function(me)
isConstrainedEvent = (me)=>
{
return mxEvent.isShiftDown(me.getEvent()) || this.state.style[mxConstants.STYLE_ASPECT] == 'fixed';
};
@ -300,7 +300,7 @@ mxVertexHandler.prototype.isConstrainedEvent = function(me)
*
* Returns true if the center of the vertex should be maintained during the resize.
*/
mxVertexHandler.prototype.isCenteredEvent = function(state, me)
isCenteredEvent = (state, me)=>
{
return false;
};
@ -310,7 +310,7 @@ mxVertexHandler.prototype.isCenteredEvent = function(state, me)
*
* Returns an array of custom handles. This implementation returns null.
*/
mxVertexHandler.prototype.createCustomHandles = function()
createCustomHandles = ()=>
{
return null;
};
@ -320,7 +320,7 @@ mxVertexHandler.prototype.createCustomHandles = function()
*
* Initializes the shapes required for this vertex handler.
*/
mxVertexHandler.prototype.updateMinBounds = function()
updateMinBounds = ()=>
{
var children = this.graph.getChildCells(this.state.cell);
@ -351,7 +351,7 @@ mxVertexHandler.prototype.updateMinBounds = function()
* Returns the mxRectangle that defines the bounds of the selection
* border.
*/
mxVertexHandler.prototype.getSelectionBounds = function(state)
getSelectionBounds = (state)=>
{
return new mxRectangle(Math.round(state.x), Math.round(state.y), Math.round(state.width), Math.round(state.height));
};
@ -361,7 +361,7 @@ mxVertexHandler.prototype.getSelectionBounds = function(state)
*
* Creates the shape used to draw the selection border.
*/
mxVertexHandler.prototype.createParentHighlightShape = function(bounds)
createParentHighlightShape = (bounds)=>
{
return this.createSelectionShape(bounds);
};
@ -371,7 +371,7 @@ mxVertexHandler.prototype.createParentHighlightShape = function(bounds)
*
* Creates the shape used to draw the selection border.
*/
mxVertexHandler.prototype.createSelectionShape = function(bounds)
createSelectionShape = (bounds)=>
{
var shape = new mxRectangleShape(
mxRectangle.fromRectangle(bounds),
@ -387,7 +387,7 @@ mxVertexHandler.prototype.createSelectionShape = function(bounds)
*
* Returns <mxConstants.VERTEX_SELECTION_COLOR>.
*/
mxVertexHandler.prototype.getSelectionColor = function()
getSelectionColor = ()=>
{
return mxConstants.VERTEX_SELECTION_COLOR;
};
@ -397,7 +397,7 @@ mxVertexHandler.prototype.getSelectionColor = function()
*
* Returns <mxConstants.VERTEX_SELECTION_STROKEWIDTH>.
*/
mxVertexHandler.prototype.getSelectionStrokeWidth = function()
getSelectionStrokeWidth = ()=>
{
return mxConstants.VERTEX_SELECTION_STROKEWIDTH;
};
@ -407,7 +407,7 @@ mxVertexHandler.prototype.getSelectionStrokeWidth = function()
*
* Returns <mxConstants.VERTEX_SELECTION_DASHED>.
*/
mxVertexHandler.prototype.isSelectionDashed = function()
isSelectionDashed = ()=>
{
return mxConstants.VERTEX_SELECTION_DASHED;
};
@ -418,7 +418,7 @@ mxVertexHandler.prototype.isSelectionDashed = function()
* Creates a sizer handle for the specified cursor and index and returns
* the new <mxRectangleShape> that represents the handle.
*/
mxVertexHandler.prototype.createSizer = function(cursor, index, size, fillColor)
createSizer = (cursor, index, size, fillColor)=>
{
size = size || mxConstants.HANDLE_SIZE;
@ -460,7 +460,7 @@ mxVertexHandler.prototype.createSizer = function(cursor, index, size, fillColor)
* Returns true if the sizer for the given index is visible.
* This returns true for all given indices.
*/
mxVertexHandler.prototype.isSizerVisible = function(index)
isSizerVisible = (index)=>
{
return true;
};
@ -472,7 +472,7 @@ mxVertexHandler.prototype.isSizerVisible = function(index)
* index. Only images and rectangles should be returned if support for HTML
* labels with not foreign objects is required.
*/
mxVertexHandler.prototype.createSizerShape = function(bounds, index, fillColor)
createSizerShape = (bounds, index, fillColor)=>
{
if (this.handleImage != null)
{
@ -500,7 +500,7 @@ mxVertexHandler.prototype.createSizerShape = function(bounds, index, fillColor)
* Helper method to create an <mxRectangle> around the given centerpoint
* with a width and height of 2*s or 6, if no s is given.
*/
mxVertexHandler.prototype.moveSizerTo = function(shape, x, y)
moveSizerTo = (shape, x, y)=>
{
if (shape != null)
{
@ -521,14 +521,14 @@ mxVertexHandler.prototype.moveSizerTo = function(shape, x, y)
* Returns the index of the handle for the given event. This returns the index
* of the sizer from where the event originated or <mxEvent.LABEL_INDEX>.
*/
mxVertexHandler.prototype.getHandleForEvent = function(me)
getHandleForEvent = (me)=>
{
// Connection highlight may consume events before they reach sizer handle
var tol = (!mxEvent.isMouseEvent(me.getEvent())) ? this.tolerance : 1;
var hit = (this.allowHandleBoundsCheck && (mxClient.IS_IE || tol > 0)) ?
new mxRectangle(me.getGraphX() - tol, me.getGraphY() - tol, 2 * tol, 2 * tol) : null;
var checkShape = mxUtils.bind(this, function(shape)
var checkShape = mxUtils.bind(this, (shape)=>
{
var st = (shape != null && shape.constructor != mxImageShape &&
this.allowHandleBoundsCheck) ? shape.strokewidth + shape.svgStrokeTolerance : null;
@ -581,7 +581,7 @@ mxVertexHandler.prototype.getHandleForEvent = function(me)
* Returns true if the given event allows custom handles to be changed. This
* implementation returns true.
*/
mxVertexHandler.prototype.isCustomHandleEvent = function(me)
isCustomHandleEvent = (me)=>
{
return true;
};
@ -593,7 +593,7 @@ mxVertexHandler.prototype.isCustomHandleEvent = function(me)
* event all subsequent events of the gesture are redirected to this
* handler.
*/
mxVertexHandler.prototype.mouseDown = function(sender, me)
mouseDown = (sender, me)=>
{
if (!me.isConsumed() && this.graph.isEnabled())
{
@ -613,7 +613,7 @@ mxVertexHandler.prototype.mouseDown = function(sender, me)
* Called if <livePreview> is enabled to check if a border should be painted.
* This implementation returns true if the shape is transparent.
*/
mxVertexHandler.prototype.isLivePreviewBorder = function()
isLivePreviewBorder = ()=>
{
return this.state.shape != null && this.state.shape.fill == null && this.state.shape.stroke == null;
};
@ -623,7 +623,7 @@ mxVertexHandler.prototype.isLivePreviewBorder = function()
*
* Starts the handling of the mouse gesture.
*/
mxVertexHandler.prototype.start = function(x, y, index)
start = (x, y, index)=>
{
if (this.selectionBorder != null)
{
@ -729,7 +729,7 @@ mxVertexHandler.prototype.start = function(x, y, index)
*
* Starts the handling of the mouse gesture.
*/
mxVertexHandler.prototype.createGhostPreview = function()
createGhostPreview = ()=>
{
var shape = this.graph.cellRenderer.createShape(this.state);
shape.init(this.graph.view.getOverlayPane());
@ -745,7 +745,7 @@ mxVertexHandler.prototype.createGhostPreview = function()
*
* Shortcut to <hideSizers>.
*/
mxVertexHandler.prototype.setHandlesVisible = function(visible)
setHandlesVisible = (visible)=>
{
this.handlesVisible = visible;
@ -773,7 +773,7 @@ mxVertexHandler.prototype.setHandlesVisible = function(visible)
*
* Starts the handling of the mouse gesture.
*/
mxVertexHandler.prototype.hideSizers = function()
hideSizers = ()=>
{
this.setHandlesVisible(false);
};
@ -785,7 +785,7 @@ mxVertexHandler.prototype.hideSizers = function()
* <mxGraph.tolerance>. If the event is a mouse event then the tolerance is
* ignored.
*/
mxVertexHandler.prototype.checkTolerance = function(me)
checkTolerance = (me)=>
{
if (this.inTolerance && this.startX != null && this.startY != null)
{
@ -803,21 +803,21 @@ mxVertexHandler.prototype.checkTolerance = function(me)
*
* Hook for subclassers do show details while the handler is active.
*/
mxVertexHandler.prototype.updateHint = function(me) { };
updateHint = (me)=> { };
/**
* Function: removeHint
*
* Hooks for subclassers to hide details when the handler gets inactive.
*/
mxVertexHandler.prototype.removeHint = function() { };
removeHint = ()=> { };
/**
* Function: roundAngle
*
* Hook for rounding the angle. This uses Math.round.
*/
mxVertexHandler.prototype.roundAngle = function(angle)
roundAngle = (angle)=>
{
return Math.round(angle * 10) / 10;
};
@ -827,7 +827,7 @@ mxVertexHandler.prototype.roundAngle = function(angle)
*
* Hook for rounding the unscaled width or height. This uses Math.round.
*/
mxVertexHandler.prototype.roundLength = function(length)
roundLength = (length)=>
{
return Math.round(length * 100) / 100;
};
@ -837,7 +837,7 @@ mxVertexHandler.prototype.roundLength = function(length)
*
* Handles the event by updating the preview.
*/
mxVertexHandler.prototype.mouseMove = function(sender, me)
mouseMove = (sender, me)=>
{
if (!me.isConsumed() && this.index != null)
{
@ -911,7 +911,7 @@ mxVertexHandler.prototype.mouseMove = function(sender, me)
*
* Returns true if a ghost preview should be used for custom handles.
*/
mxVertexHandler.prototype.isGhostPreview = function()
isGhostPreview = ()=>
{
return this.state.view.graph.model.getChildCount(this.state.cell) > 0;
};
@ -921,7 +921,7 @@ mxVertexHandler.prototype.isGhostPreview = function()
*
* Moves the label.
*/
mxVertexHandler.prototype.moveLabel = function(me)
moveLabel = (me)=>
{
var point = new mxPoint(me.getGraphX(), me.getGraphY());
var tr = this.graph.view.translate;
@ -942,7 +942,7 @@ mxVertexHandler.prototype.moveLabel = function(me)
*
* Rotates the vertex.
*/
mxVertexHandler.prototype.rotateVertex = function(me)
rotateVertex = (me)=>
{
var point = new mxPoint(me.getGraphX(), me.getGraphY());
var dx = this.state.x + this.state.width / 2 - point.x;
@ -997,7 +997,7 @@ mxVertexHandler.prototype.rotateVertex = function(me)
*
* Risizes the vertex.
*/
mxVertexHandler.prototype.resizeVertex = function(me)
resizeVertex = (me)=>
{
var ct = new mxPoint(this.state.getCenterX(), this.state.getCenterY());
var alpha = mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION] || '0');
@ -1170,7 +1170,7 @@ mxVertexHandler.prototype.resizeVertex = function(me)
*
* Repaints the live preview.
*/
mxVertexHandler.prototype.updateLivePreview = function(me)
updateLivePreview = (me)=>
{
// TODO: Apply child offset to children in live preview
var scale = this.graph.view.scale;
@ -1238,7 +1238,7 @@ mxVertexHandler.prototype.updateLivePreview = function(me)
*
* Handles the event by applying the changes to the geometry.
*/
mxVertexHandler.prototype.moveToFront = function()
moveToFront = ()=>
{
if ((this.state.text != null && this.state.text.node != null &&
this.state.text.node.nextSibling != null) ||
@ -1263,7 +1263,7 @@ mxVertexHandler.prototype.moveToFront = function()
*
* Handles the event by applying the changes to the geometry.
*/
mxVertexHandler.prototype.mouseUp = function(sender, me)
mouseUp = (sender, me)=>
{
if (this.index != null && this.state != null)
{
@ -1362,7 +1362,7 @@ mxVertexHandler.prototype.mouseUp = function(sender, me)
* the value of this state.
* me - the mouse event.
*/
mxVertexHandler.prototype.isRecursiveResize = function(state, me)
isRecursiveResize = (state, me)=>
{
return this.graph.isRecursiveResize(this.state);
};
@ -1374,7 +1374,7 @@ mxVertexHandler.prototype.isRecursiveResize = function(state, me)
* This code is executed as part of the model transaction. This implementation
* is empty.
*/
mxVertexHandler.prototype.rotateClick = function() { };
rotateClick = ()=> { };
/**
* Function: rotateCell
@ -1386,7 +1386,7 @@ mxVertexHandler.prototype.rotateClick = function() { };
* cell - <mxCell> to be rotated.
* angle - Angle in degrees.
*/
mxVertexHandler.prototype.rotateCell = function(cell, angle, parent)
rotateCell = (cell, angle, parent)=>
{
if (angle != 0)
{
@ -1434,7 +1434,7 @@ mxVertexHandler.prototype.rotateCell = function(cell, angle, parent)
*
* Resets the state of this handler.
*/
mxVertexHandler.prototype.reset = function()
reset = ()=>
{
if (this.sizers != null && this.index != null && this.sizers[this.index] != null &&
this.sizers[this.index].node.style.display == 'none')
@ -1516,7 +1516,7 @@ mxVertexHandler.prototype.reset = function()
* Uses the given vector to change the bounds of the given cell
* in the graph using <mxGraph.resizeCell>.
*/
mxVertexHandler.prototype.resizeCell = function(cell, dx, dy, index, gridEnabled, constrained, recurse)
resizeCell = (cell, dx, dy, index, gridEnabled, constrained, recurse)=>
{
var geo = this.graph.model.getGeometry(cell);
@ -1566,7 +1566,7 @@ mxVertexHandler.prototype.resizeCell = function(cell, dx, dy, index, gridEnabled
*
* Moves the children of the given cell by the given vector.
*/
mxVertexHandler.prototype.moveChildren = function(cell, dx, dy)
moveChildren = (cell, dx, dy)=>
{
var model = this.graph.getModel();
var childCount = model.getChildCount(cell);
@ -1594,8 +1594,8 @@ mxVertexHandler.prototype.moveChildren = function(cell, dx, dy)
* the following code can be used.
*
* (code)
* var vertexHandlerUnion = mxVertexHandler.prototype.union;
* mxVertexHandler.prototype.union = function(bounds, dx, dy, index, gridEnabled, scale, tr, constrained)
* var vertexHandlerUnion = union;
* union = (bounds, dx, dy, index, gridEnabled, scale, tr, constrained)=>
* {
* var result = vertexHandlerUnion.apply(this, arguments);
*
@ -1616,8 +1616,8 @@ mxVertexHandler.prototype.moveChildren = function(cell, dx, dy)
* changed, the following can be used.
*
* (code)
* var mxVertexHandlerUnion = mxVertexHandler.prototype.union;
* mxVertexHandler.prototype.union = function(bounds, dx, dy, index, gridEnabled, scale, tr, constrained)
* var mxVertexHandlerUnion = union;
* union = (bounds, dx, dy, index, gridEnabled, scale, tr, constrained)=>
* {
* var result = mxVertexHandlerUnion.apply(this, arguments);
* var s = this.state;
@ -1636,7 +1636,7 @@ mxVertexHandler.prototype.moveChildren = function(cell, dx, dy)
* };
* (end)
*/
mxVertexHandler.prototype.union = function(bounds, dx, dy, index, gridEnabled, scale, tr, constrained, centered)
union = (bounds, dx, dy, index, gridEnabled, scale, tr, constrained, centered)=>
{
gridEnabled = (gridEnabled != null) ? gridEnabled && this.graph.gridEnabled : this.graph.gridEnabled;
@ -1797,7 +1797,7 @@ mxVertexHandler.prototype.union = function(bounds, dx, dy, index, gridEnabled, s
*
* Redraws the handles and the preview.
*/
mxVertexHandler.prototype.redraw = function(ignoreHandles)
redraw = (ignoreHandles)=>
{
this.selectionBounds = this.getSelectionBounds(this.state);
this.bounds = new mxRectangle(this.selectionBounds.x, this.selectionBounds.y,
@ -1813,7 +1813,7 @@ mxVertexHandler.prototype.redraw = function(ignoreHandles)
/**
* Returns the padding to be used for drawing handles for the current <bounds>.
*/
mxVertexHandler.prototype.getHandlePadding = function()
getHandlePadding = ()=>
{
// KNOWN: Tolerance depends on event type (eg. 0 for mouse events)
var result = new mxPoint(0, 0);
@ -1837,7 +1837,7 @@ mxVertexHandler.prototype.getHandlePadding = function()
*
* Returns the bounds used to paint the resize handles.
*/
mxVertexHandler.prototype.getSizerBounds = function()
getSizerBounds = ()=>
{
return this.bounds;
};
@ -1848,7 +1848,7 @@ mxVertexHandler.prototype.getSizerBounds = function()
* Redraws the handles. To hide certain handles the following code can be used.
*
* (code)
* mxVertexHandler.prototype.redrawHandles = function()
* redrawHandles = ()=>
* {
* mxVertexHandlerRedrawHandles.apply(this, arguments);
*
@ -1860,7 +1860,7 @@ mxVertexHandler.prototype.getSizerBounds = function()
* };
* (end)
*/
mxVertexHandler.prototype.redrawHandles = function()
redrawHandles = ()=>
{
var s = this.getSizerBounds();
var tol = this.tolerance;
@ -2052,7 +2052,7 @@ mxVertexHandler.prototype.redrawHandles = function()
*
* Returns true if the given custom handle is visible.
*/
mxVertexHandler.prototype.isCustomHandleVisible = function(handle)
isCustomHandleVisible = (handle)=>
{
return !this.graph.isEditing() && this.state.view.graph.getSelectionCount() == 1;
};
@ -2062,7 +2062,7 @@ mxVertexHandler.prototype.isCustomHandleVisible = function(handle)
*
* Returns an <mxPoint> that defines the rotation handle position.
*/
mxVertexHandler.prototype.getRotationHandlePosition = function()
getRotationHandlePosition = ()=>
{
return new mxPoint(this.bounds.x + this.bounds.width / 2, this.bounds.y + this.rotationHandleVSpacing)
};
@ -2073,7 +2073,7 @@ mxVertexHandler.prototype.getRotationHandlePosition = function()
* Returns true if the parent highlight should be visible. This implementation
* always returns true.
*/
mxVertexHandler.prototype.isParentHighlightVisible = function()
isParentHighlightVisible = ()=>
{
return !this.graph.isCellSelected(this.graph.model.getParent(this.state.cell));
};
@ -2083,7 +2083,7 @@ mxVertexHandler.prototype.isParentHighlightVisible = function()
*
* Updates the highlight of the parent if <parentHighlightEnabled> is true.
*/
mxVertexHandler.prototype.updateParentHighlight = function()
updateParentHighlight = ()=>
{
if (!this.isDestroyed())
{
@ -2140,7 +2140,7 @@ mxVertexHandler.prototype.updateParentHighlight = function()
*
* Redraws the preview.
*/
mxVertexHandler.prototype.drawPreview = function()
drawPreview = ()=>
{
if (this.preview != null)
{
@ -2166,7 +2166,7 @@ mxVertexHandler.prototype.drawPreview = function()
*
* Returns the bounds for the selection border.
*/
mxVertexHandler.prototype.getSelectionBorderBounds = function()
getSelectionBorderBounds = ()=>
{
return this.bounds;
};
@ -2176,7 +2176,7 @@ mxVertexHandler.prototype.getSelectionBorderBounds = function()
*
* Returns true if this handler was destroyed or not initialized.
*/
mxVertexHandler.prototype.isDestroyed = function()
isDestroyed = ()=>
{
return this.selectionBorder == null;
};
@ -2186,7 +2186,7 @@ mxVertexHandler.prototype.isDestroyed = function()
*
* Destroys the handler and all its resources and DOM nodes.
*/
mxVertexHandler.prototype.destroy = function()
destroy = ()=>
{
if (this.escapeHandler != null)
{

View File

@ -107,17 +107,17 @@ Built-in Images:
which you can change to reflect your environment. The image variables can
also be changed individually.
- mxGraph.prototype.collapsedImage
- mxGraph.prototype.expandedImage
- mxGraph.prototype.warningImage
- mxWindow.prototype.closeImage
- mxWindow.prototype.minimizeImage
- mxWindow.prototype.normalizeImage
- mxWindow.prototype.maximizeImage
- mxWindow.prototype.resizeImage
- mxPopupMenu.prototype.submenuImage
- collapsedImage
- expandedImage
- warningImage
- closeImage
- minimizeImage
- normalizeImage
- maximizeImage
- resizeImage
- submenuImage
- mxUtils.errorImage
- mxConstraintHandler.prototype.pointImage
- pointImage
The basename of the warning image (images/warning without extension) used in
<mxGraph.setCellWarning> is defined in <mxGraph.warningImage>.
@ -204,8 +204,8 @@ Subclassing:
represented in JavaScript by first "inheriting" all fields and methods from
the superclass by assigning the prototype to an instance of the superclass,
eg. mxEditor.prototype = new mxEventSource() and redefining the constructor
field using mxEditor.prototype.constructor = mxEditor. The latter rule is
applied so that the type of an object can be retrieved via the name of its
field using constructor = mxEditor. The latter rule is
applied so that the type of an object can be retrieved via the name of it<EFBFBD>s
constructor using mxUtils.getFunctionName(obj.constructor).
Constructor:
@ -228,7 +228,7 @@ Constructor:
(code)
MyGraph.prototype = new mxGraph();
MyGraph.prototype.constructor = MyGraph;
constructor = MyGraph;
(end)
You may want to define the codec associated for the class after the above
@ -247,9 +247,9 @@ Functions:
follows.
(code)
MyGraph.prototype.isCellSelectable = function(cell)
isCellSelectable = (cell)=>
{
var selectable = mxGraph.prototype.isSelectable.apply(this, arguments);
var selectable = isSelectable.apply(this, arguments);
var geo = this.model.getGeometry(cell);
return selectable && (geo == null || !geo.relative);
@ -260,10 +260,10 @@ Functions:
function on the isSelectable function object of the mxGraph prototype, using
the special this and arguments variables as parameters. Calls to the
superclass function are only possible if the function is not replaced in the
superclass as follows, which is another way of “subclassing” in JavaScript.
superclass as follows, which is another way of <EFBFBD>subclassing<EFBFBD> in JavaScript.
(code)
mxGraph.prototype.isCellSelectable = function(cell)
isCellSelectable = (cell)=>
{
var geo = this.model.getGeometry(cell);
return selectable &&
@ -280,7 +280,7 @@ Functions:
representation of the graph model:
(code)
MyGraph.prototype.getXml = function()
getXml = ()=>
{
var enc = new mxCodec();
return enc.encode(this.getModel());
@ -292,7 +292,7 @@ Variables:
Likewise, a new field is declared and defined as follows.
(code)
MyGraph.prototype.myField = 'Hello, World!';
myField = 'Hello, World!';
(end)
Note that the value assigned to myField is created only once, that is, all

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxCellCodec
@ -52,7 +52,7 @@ mxCodecRegistry.register(function()
*
* Returns true since this is a cell codec.
*/
codec.isCellCodec = function()
codec.isCellCodec = ()=>
{
return true;
};
@ -60,9 +60,9 @@ mxCodecRegistry.register(function()
/**
* Overidden to disable conversion of value to number.
*/
codec.isNumericAttribute = function(dec, attr, obj)
codec.isNumericAttribute = (dec, attr, obj)=>
{
return attr.nodeName !== 'value' && mxObjectCodec.prototype.isNumericAttribute.apply(this, arguments);
return attr.nodeName !== 'value' && isNumericAttribute.apply(this, arguments);
};
/**
@ -70,9 +70,9 @@ mxCodecRegistry.register(function()
*
* Excludes user objects that are XML nodes.
*/
codec.isExcluded = function(obj, attr, value, isWrite)
codec.isExcluded = (obj, attr, value, isWrite)=>
{
return mxObjectCodec.prototype.isExcluded.apply(this, arguments) ||
return isExcluded.apply(this, arguments) ||
(isWrite && attr == 'value' &&
value.nodeType == mxConstants.NODETYPE_ELEMENT);
};
@ -83,7 +83,7 @@ mxCodecRegistry.register(function()
* Encodes an <mxCell> and wraps the XML up inside the
* XML of the user object (inversion).
*/
codec.afterEncode = function(enc, obj, node)
codec.afterEncode = (enc, obj, node)=>
{
if (obj.value != null && obj.value.nodeType == mxConstants.NODETYPE_ELEMENT)
{
@ -110,7 +110,7 @@ mxCodecRegistry.register(function()
* Decodes an <mxCell> and uses the enclosing XML node as
* the user object for the cell (inversion).
*/
codec.beforeDecode = function(dec, node, obj)
codec.beforeDecode = (dec, node, obj)=>
{
var inner = node.cloneNode(true);
var classname = this.getName();

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxChildChangeCodec
@ -34,7 +34,7 @@ mxCodecRegistry.register(function()
* child as an attribute rather than a child node, in
* which case it's always a reference.
*/
codec.isReference = function(obj, attr, value, isWrite)
codec.isReference = (obj, attr, value, isWrite)=>
{
if (attr == 'child' && (!isWrite || obj.model.contains(obj.previous)))
{
@ -49,9 +49,9 @@ mxCodecRegistry.register(function()
*
* Excludes references to parent or previous if not in the model.
*/
codec.isExcluded = function(obj, attr, value, write)
codec.isExcluded = (obj, attr, value, write)=>
{
return mxObjectCodec.prototype.isExcluded.apply(this, arguments) ||
return isExcluded.apply(this, arguments) ||
(write && value != null && (attr == 'previous' ||
attr == 'parent') && !obj.model.contains(value));
};
@ -62,7 +62,7 @@ mxCodecRegistry.register(function()
* Encodes the child recusively and adds the result
* to the given node.
*/
codec.afterEncode = function(enc, obj, node)
codec.afterEncode = (enc, obj, node)=>
{
if (this.isReference(obj, 'child', obj.child, true))
{
@ -88,7 +88,7 @@ mxCodecRegistry.register(function()
* Decodes the any child nodes as using the respective
* codec from the registry.
*/
codec.beforeDecode = function(dec, node, obj)
codec.beforeDecode = (dec, node, obj)=>
{
if (node.firstChild != null &&
node.firstChild.nodeType == mxConstants.NODETYPE_ELEMENT)
@ -140,7 +140,7 @@ mxCodecRegistry.register(function()
*
* Restores object state in the child change.
*/
codec.afterDecode = function(dec, node, obj)
codec.afterDecode = (dec, node, obj)=>
{
// Cells are decoded here after a complete transaction so the previous
// parent must be restored on the cell for the case where the cell was

View File

@ -80,8 +80,8 @@
* encoded objects:
*
* (code)
* var oldEncode = mxCodec.prototype.encode;
* mxCodec.prototype.encode = function(obj)
* var oldEncode = encode;
* encode = (obj)=>
* {
* mxLog.show();
* mxLog.debug('mxCodec.encode: obj='+mxUtils.getFunctionName(obj.constructor));
@ -94,7 +94,7 @@
* decoding those objects, the constructor should be written as follows:
*
* (code)
* var MyObj = function(name)
* var MyObj = (name)=>
* {
* // ...
* };
@ -122,28 +122,28 @@ function mxCodec(document)
*
* The owner document of the codec.
*/
mxCodec.prototype.document = null;
document = null;
/**
* Variable: objects
*
* Maps from IDs to objects.
*/
mxCodec.prototype.objects = null;
objects = null;
/**
* Variable: elements
*
* Lookup table for resolving IDs to elements.
*/
mxCodec.prototype.elements = null;
elements = null;
/**
* Variable: encodeDefaults
*
* Specifies if default values should be encoded. Default is false.
*/
mxCodec.prototype.encodeDefaults = false;
encodeDefaults = false;
/**
@ -156,7 +156,7 @@ mxCodec.prototype.encodeDefaults = false;
* id - ID for the object to be associated with.
* obj - Object to be associated with the ID.
*/
mxCodec.prototype.putObject = function(id, obj)
putObject = (id, obj)=>
{
this.objects[id] = obj;
@ -171,7 +171,7 @@ mxCodec.prototype.putObject = function(id, obj)
* object. If no object is found, then the element with the respective ID
* from the document is parsed using <decode>.
*/
mxCodec.prototype.getObject = function(id)
getObject = (id)=>
{
var obj = null;
@ -208,7 +208,7 @@ mxCodec.prototype.getObject = function(id)
*
* (code)
* var codec = new mxCodec();
* codec.lookup = function(id)
* codec.lookup = (id)=>
* {
* return model.getCell(id);
* };
@ -218,7 +218,7 @@ mxCodec.prototype.getObject = function(id)
*
* id - ID of the object to be returned.
*/
mxCodec.prototype.lookup = function(id)
lookup = (id)=>
{
return null;
};
@ -232,7 +232,7 @@ mxCodec.prototype.lookup = function(id)
*
* id - String that contains the ID.
*/
mxCodec.prototype.getElementById = function(id)
getElementById = (id)=>
{
this.updateElements();
@ -248,7 +248,7 @@ mxCodec.prototype.getElementById = function(id)
*
* id - String that contains the ID.
*/
mxCodec.prototype.updateElements = function()
updateElements = ()=>
{
if (this.elements == null)
{
@ -266,7 +266,7 @@ mxCodec.prototype.updateElements = function()
*
* Adds the given element to <elements> if it has an ID.
*/
mxCodec.prototype.addElement = function(node)
addElement = (node)=>
{
if (node.nodeType == mxConstants.NODETYPE_ELEMENT)
{
@ -307,7 +307,7 @@ mxCodec.prototype.addElement = function(node)
*
* obj - Object to return the ID for.
*/
mxCodec.prototype.getId = function(obj)
getId = (obj)=>
{
var id = null;
@ -346,7 +346,7 @@ mxCodec.prototype.getId = function(obj)
*
* (code)
* var codec = new mxCodec();
* codec.reference = function(obj)
* codec.reference = (obj)=>
* {
* return obj.getCustomId();
* };
@ -356,7 +356,7 @@ mxCodec.prototype.getId = function(obj)
*
* obj - Object whose ID should be returned.
*/
mxCodec.prototype.reference = function(obj)
reference = (obj)=>
{
return null;
};
@ -371,7 +371,7 @@ mxCodec.prototype.reference = function(obj)
*
* obj - Object to be encoded.
*/
mxCodec.prototype.encode = function(obj)
encode = (obj)=>
{
var node = null;
@ -415,7 +415,7 @@ mxCodec.prototype.encode = function(obj)
* node - XML node to be decoded.
* into - Optional object to be decodec into.
*/
mxCodec.prototype.decode = function(node, into)
decode = (node, into)=>
{
this.updateElements();
var obj = null;
@ -469,7 +469,7 @@ mxCodec.prototype.decode = function(node, into)
* includeChildren - Optional boolean indicating if the
* function should include all descendents. Default is true.
*/
mxCodec.prototype.encodeCell = function(cell, node, includeChildren)
encodeCell = (cell, node, includeChildren)=>
{
node.appendChild(this.encode(cell));
@ -491,7 +491,7 @@ mxCodec.prototype.encodeCell = function(cell, node, includeChildren)
* <mxCellCodec.isCellCodec> to check if the codec is of the
* given type.
*/
mxCodec.prototype.isCellCodec = function(codec)
isCellCodec = (codec)=>
{
if (codec != null && typeof(codec.isCellCodec) == 'function')
{
@ -518,7 +518,7 @@ mxCodec.prototype.isCellCodec = function(codec)
* and insertEdge on the parent and terminals, respectively.
* Default is true.
*/
mxCodec.prototype.decodeCell = function(node, restoreStructures)
decodeCell = (node, restoreStructures)=>
{
restoreStructures = (restoreStructures != null) ? restoreStructures : true;
var cell = null;
@ -565,7 +565,7 @@ mxCodec.prototype.decodeCell = function(node, restoreStructures)
*
* Inserts the given cell into its parent and terminal cells.
*/
mxCodec.prototype.insertIntoGraph = function(cell)
insertIntoGraph = (cell)=>
{
var parent = cell.parent;
var source = cell.getTerminal(true);
@ -612,7 +612,7 @@ mxCodec.prototype.insertIntoGraph = function(cell)
* attributes - Attributename to be set.
* value - New value of the attribute.
*/
mxCodec.prototype.setAttribute = function(node, attribute, value)
setAttribute = (node, attribute, value)=>
{
if (attribute != null && value != null)
{

View File

@ -22,8 +22,8 @@ var mxCodecRegistry =
* objects.
*
* (code)
* codec.encode = function(enc, obj) { ... }
* codec.decode = function(dec, node, into) { ... }
* codec.encode = (enc, obj)=> { ... }
* codec.decode = (dec, node, into)=> { ... }
* (end)
*
* 3. Register the codec in the <mxCodecRegistry>.
@ -61,7 +61,7 @@ var mxCodecRegistry =
*
* codec - <mxObjectCodec> to be registered.
*/
register: function(codec)
register: (codec)=>
{
if (codec != null)
{
@ -84,7 +84,7 @@ var mxCodecRegistry =
*
* Adds an alias for mapping a classname to a codecname.
*/
addAlias: function(classname, codecname)
addAlias: (classname, codecname)=>
{
mxCodecRegistry.aliases[classname] = codecname;
},
@ -99,7 +99,7 @@ var mxCodecRegistry =
*
* ctor - JavaScript constructor function.
*/
getCodec: function(ctor)
getCodec: (ctor)=>
{
var codec = null;

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxDefaultKeyHandlerCodec
@ -19,7 +19,7 @@ mxCodecRegistry.register(function()
*
* Returns null.
*/
codec.encode = function(enc, obj)
codec.encode = (enc, obj)=>
{
return null;
};
@ -56,7 +56,7 @@ mxCodecRegistry.register(function()
* See also: <mxDefaultKeyHandler.bindAction>,
* http://www.js-examples.com/page/tutorials__key_codes.html
*/
codec.decode = function(dec, node, into)
codec.decode = (dec, node, into)=>
{
if (into != null)
{

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxDefaultPopupMenuCodec
@ -22,7 +22,7 @@ mxCodecRegistry.register(function()
*
* Returns null.
*/
codec.encode = function(enc, obj)
codec.encode = (enc, obj)=>
{
return null;
};
@ -32,7 +32,7 @@ mxCodecRegistry.register(function()
*
* Uses the given node as the config for <mxDefaultPopupMenu>.
*/
codec.decode = function(dec, node, into)
codec.decode = (dec, node, into)=>
{
var inc = node.getElementsByTagName('include')[0];

View File

@ -10,7 +10,7 @@
* <mxCodec> and the <mxCodecRegistry>. This codec only reads configuration
* data for existing toolbars handlers, it does not encode or create toolbars.
*/
var mxDefaultToolbarCodec = mxCodecRegistry.register(function()
var mxDefaultToolbarCodec = mxCodecRegistry.register(()=>
{
var codec = new mxObjectCodec(new mxDefaultToolbar());
@ -19,7 +19,7 @@ var mxDefaultToolbarCodec = mxCodecRegistry.register(function()
*
* Returns null.
*/
codec.encode = function(enc, obj)
codec.encode = (enc, obj)=>
{
return null;
};
@ -116,7 +116,7 @@ var mxDefaultToolbarCodec = mxCodecRegistry.register(function()
* </mxDefaultToolbar>
* (end)
*/
codec.decode = function(dec, node, into)
codec.decode = (dec, node, into)=>
{
if (into != null)
{
@ -212,7 +212,7 @@ var mxDefaultToolbarCodec = mxCodecRegistry.register(function()
else
{
var select = null;
var create = function()
var create = ()=>
{
var template = editor.templates[select.value];
@ -241,9 +241,9 @@ var mxDefaultToolbarCodec = mxCodecRegistry.register(function()
// Selects the toolbar icon if a selection change
// is made in the corresponding combobox.
mxEvent.addListener(select, 'change', function()
mxEvent.addListener(select, 'change', ()=>
{
into.toolbar.selectMode(img, function(evt)
into.toolbar.selectMode(img, (evt)=>
{
var pt = mxUtils.convertPoint(editor.graph.container,
mxEvent.getClientX(evt), mxEvent.getClientY(evt));

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxEditorCodec
@ -78,7 +78,7 @@ mxCodecRegistry.register(function()
* </ui>
* (end)
*/
codec.afterDecode = function(dec, node, obj)
codec.afterDecode = (dec, node, obj)=>
{
// Assigns the specified templates for edges
var defaultEdge = node.getAttribute('defaultEdge');
@ -106,7 +106,7 @@ mxCodecRegistry.register(function()
*
* Overrides decode child to handle special child nodes.
*/
codec.decodeChild = function(dec, child, obj)
codec.decodeChild = (dec, child, obj)=>
{
if (child.nodeName == 'Array')
{
@ -124,7 +124,7 @@ mxCodecRegistry.register(function()
return;
}
mxObjectCodec.prototype.decodeChild.apply(this, arguments);
decodeChild.apply(this, arguments);
};
/**
@ -132,7 +132,7 @@ mxCodecRegistry.register(function()
*
* Decodes the ui elements from the given node.
*/
codec.decodeUi = function(dec, node, editor)
codec.decodeUi = (dec, node, editor)=>
{
var tmp = node.firstChild;
while (tmp != null)
@ -209,7 +209,7 @@ mxCodecRegistry.register(function()
*
* Decodes the cells from the given node as templates.
*/
codec.decodeTemplates = function(dec, node, editor)
codec.decodeTemplates = (dec, node, editor)=>
{
if (editor.templates == null)
{

View File

@ -29,7 +29,7 @@
* obj - An instance of the change object.
* variable - The fieldname for the change data.
*/
var mxGenericChangeCodec = function(obj, variable)
var mxGenericChangeCodec = (obj, variable)=>
{
var codec = new mxObjectCodec(obj, ['model', 'previous'], ['cell']);
@ -38,7 +38,7 @@ var mxGenericChangeCodec = function(obj, variable)
*
* Restores the state by assigning the previous value.
*/
codec.afterDecode = function(dec, node, obj)
codec.afterDecode = (dec, node, obj)=>
{
// Allows forward references in sessions. This is a workaround
// for the sequence of edits in mxGraph.moveCells and cellsAdded.

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxGraphCodec

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxGraphViewCodec
@ -23,7 +23,7 @@ mxCodecRegistry.register(function()
* starting at the model's root. This returns the
* top-level graph node of the recursive encoding.
*/
codec.encode = function(enc, view)
codec.encode = (enc, view)=>
{
return this.encodeCell(enc, view,
view.graph.getModel().getRoot());
@ -49,7 +49,7 @@ mxCodecRegistry.register(function()
* values from the cell style are added as attribute
* values to the node.
*/
codec.encodeCell = function(enc, view, cell)
codec.encodeCell = (enc, view, cell)=>
{
var model = view.graph.getModel();
var state = view.getState(cell);

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxModelCodec
@ -20,7 +20,7 @@ mxCodecRegistry.register(function()
* cell nodes as produced by the <mxCellCodec>. The sequence is
* wrapped-up in a node with the name root.
*/
codec.encodeObject = function(enc, obj, node)
codec.encodeObject = (enc, obj, node)=>
{
var rootNode = enc.document.createElement('root');
enc.encodeCell(obj.getRoot(), rootNode);
@ -32,7 +32,7 @@ mxCodecRegistry.register(function()
*
* Overrides decode child to handle special child nodes.
*/
codec.decodeChild = function(dec, child, obj)
codec.decodeChild = (dec, child, obj)=>
{
if (child.nodeName == 'root')
{
@ -40,7 +40,7 @@ mxCodecRegistry.register(function()
}
else
{
mxObjectCodec.prototype.decodeChild.apply(this, arguments);
decodeChild.apply(this, arguments);
}
};
@ -50,7 +50,7 @@ mxCodecRegistry.register(function()
* Reads the cells into the graph model. All cells
* are children of the root element in the node.
*/
codec.decodeRoot = function(dec, root, model)
codec.decodeRoot = (dec, root, model)=>
{
var rootCell = null;
var tmp = root.firstChild;

View File

@ -226,7 +226,7 @@ mxObjectCodec.allowEval = false;
*
* Holds the template object associated with this codec.
*/
mxObjectCodec.prototype.template = null;
template = null;
/**
* Variable: exclude
@ -234,7 +234,7 @@ mxObjectCodec.prototype.template = null;
* Array containing the variable names that should be
* ignored by the codec.
*/
mxObjectCodec.prototype.exclude = null;
exclude = null;
/**
* Variable: idrefs
@ -243,21 +243,21 @@ mxObjectCodec.prototype.exclude = null;
* turned into or converted from references. See
* <mxCodec.getId> and <mxCodec.getObject>.
*/
mxObjectCodec.prototype.idrefs = null;
idrefs = null;
/**
* Variable: mapping
*
* Maps from from fieldnames to XML attribute names.
*/
mxObjectCodec.prototype.mapping = null;
mapping = null;
/**
* Variable: reverse
*
* Maps from from XML attribute names to fieldnames.
*/
mxObjectCodec.prototype.reverse = null;
reverse = null;
/**
* Function: getName
@ -268,7 +268,7 @@ mxObjectCodec.prototype.reverse = null;
* if that is different than what this returns. The default implementation
* returns the classname of the template class.
*/
mxObjectCodec.prototype.getName = function()
getName = ()=>
{
return mxUtils.getFunctionName(this.template.constructor);
};
@ -278,7 +278,7 @@ mxObjectCodec.prototype.getName = function()
*
* Returns a new instance of the template for this codec.
*/
mxObjectCodec.prototype.cloneTemplate = function()
cloneTemplate = ()=>
{
return new this.template.constructor();
};
@ -291,7 +291,7 @@ mxObjectCodec.prototype.cloneTemplate = function()
* the input if there is no reverse mapping for the
* given name.
*/
mxObjectCodec.prototype.getFieldName = function(attributename)
getFieldName = (attributename)=>
{
if (attributename != null)
{
@ -314,7 +314,7 @@ mxObjectCodec.prototype.getFieldName = function(attributename)
* the input if there is no mapping for the
* given name.
*/
mxObjectCodec.prototype.getAttributeName = function(fieldname)
getAttributeName = (fieldname)=>
{
if (fieldname != null)
{
@ -344,7 +344,7 @@ mxObjectCodec.prototype.getAttributeName = function(fieldname)
* write - Boolean indicating if the field is being encoded or decoded.
* Write is true if the field is being encoded, else it is being decoded.
*/
mxObjectCodec.prototype.isExcluded = function(obj, attr, value, write)
isExcluded = (obj, attr, value, write)=>
{
return attr == mxObjectIdentity.FIELD_NAME ||
mxUtils.indexOf(this.exclude, attr) >= 0;
@ -365,7 +365,7 @@ mxObjectCodec.prototype.isExcluded = function(obj, attr, value, write)
* write - Boolean indicating if the field is being encoded or decoded.
* Write is true if the field is being encoded, else it is being decoded.
*/
mxObjectCodec.prototype.isReference = function(obj, attr, value, write)
isReference = (obj, attr, value, write)=>
{
return mxUtils.indexOf(this.idrefs, attr) >= 0;
};
@ -412,7 +412,7 @@ mxObjectCodec.prototype.isReference = function(obj, attr, value, write)
* enc - <mxCodec> that controls the encoding process.
* obj - Object to be encoded.
*/
mxObjectCodec.prototype.encode = function(enc, obj)
encode = (enc, obj)=>
{
var node = enc.document.createElement(this.getName());
@ -434,7 +434,7 @@ mxObjectCodec.prototype.encode = function(enc, obj)
* obj - Object to be encoded.
* node - XML node that contains the encoded object.
*/
mxObjectCodec.prototype.encodeObject = function(enc, obj, node)
encodeObject = (enc, obj, node)=>
{
enc.setAttribute(node, 'id', enc.getId(obj));
@ -470,7 +470,7 @@ mxObjectCodec.prototype.encodeObject = function(enc, obj, node)
* value - Value of the property to be encoded.
* node - XML node that contains the encoded object.
*/
mxObjectCodec.prototype.encodeValue = function(enc, obj, name, value, node)
encodeValue = (enc, obj, name, value, node)=>
{
if (value != null)
{
@ -506,7 +506,7 @@ mxObjectCodec.prototype.encodeValue = function(enc, obj, name, value, node)
* Writes the given value into node using <writePrimitiveAttribute>
* or <writeComplexAttribute> depending on the type of the value.
*/
mxObjectCodec.prototype.writeAttribute = function(enc, obj, name, value, node)
writeAttribute = (enc, obj, name, value, node)=>
{
if (typeof(value) != 'object' /* primitive type */)
{
@ -523,7 +523,7 @@ mxObjectCodec.prototype.writeAttribute = function(enc, obj, name, value, node)
*
* Writes the given value as an attribute of the given node.
*/
mxObjectCodec.prototype.writePrimitiveAttribute = function(enc, obj, name, value, node)
writePrimitiveAttribute = (enc, obj, name, value, node)=>
{
value = this.convertAttributeToXml(enc, obj, name, value, node);
@ -553,7 +553,7 @@ mxObjectCodec.prototype.writePrimitiveAttribute = function(enc, obj, name, value
*
* Writes the given value as a child node of the given node.
*/
mxObjectCodec.prototype.writeComplexAttribute = function(enc, obj, name, value, node)
writeComplexAttribute = (enc, obj, name, value, node)=>
{
var child = enc.encode(value);
@ -585,7 +585,7 @@ mxObjectCodec.prototype.writeComplexAttribute = function(enc, obj, name, value,
* name - Name of the attribute to be converted.
* value - Value to be converted.
*/
mxObjectCodec.prototype.convertAttributeToXml = function(enc, obj, name, value)
convertAttributeToXml = (enc, obj, name, value)=>
{
// Makes sure to encode boolean values as numeric values
if (this.isBooleanAttribute(enc, obj, name, value))
@ -610,7 +610,7 @@ mxObjectCodec.prototype.convertAttributeToXml = function(enc, obj, name, value)
* name - Name of the attribute to be converted.
* value - Value of the attribute to be converted.
*/
mxObjectCodec.prototype.isBooleanAttribute = function(enc, obj, name, value)
isBooleanAttribute = (enc, obj, name, value)=>
{
return (typeof(value.length) == 'undefined' && (value == true || value == false));
};
@ -627,7 +627,7 @@ mxObjectCodec.prototype.isBooleanAttribute = function(enc, obj, name, value)
* attr - XML attribute to be converted.
* obj - Objec to convert the attribute for.
*/
mxObjectCodec.prototype.convertAttributeFromXml = function(dec, attr, obj)
convertAttributeFromXml = (dec, attr, obj)=>
{
var value = attr.value;
@ -655,7 +655,7 @@ mxObjectCodec.prototype.convertAttributeFromXml = function(dec, attr, obj)
* attr - XML attribute to be converted.
* obj - Objec to convert the attribute for.
*/
mxObjectCodec.prototype.isNumericAttribute = function(dec, attr, obj)
isNumericAttribute = (dec, attr, obj)=>
{
// Handles known numeric attributes for generic objects
var result = (obj.constructor == mxGeometry &&
@ -682,7 +682,7 @@ mxObjectCodec.prototype.isNumericAttribute = function(dec, attr, obj)
* obj - Object to be encoded.
* node - XML node to encode the object into.
*/
mxObjectCodec.prototype.beforeEncode = function(enc, obj, node)
beforeEncode = (enc, obj, node)=>
{
return obj;
};
@ -702,7 +702,7 @@ mxObjectCodec.prototype.beforeEncode = function(enc, obj, node)
* obj - Object to be encoded.
* node - XML node that represents the default encoding.
*/
mxObjectCodec.prototype.afterEncode = function(enc, obj, node)
afterEncode = (enc, obj, node)=>
{
return node;
};
@ -742,7 +742,7 @@ mxObjectCodec.prototype.afterEncode = function(enc, obj, node)
* (code)
* <Object>
* <add as="hello"><![CDATA[
* function(arg1) {
* (arg1)=> {
* mxUtils.alert('Hello '+arg1);
* }
* ]]></add>
@ -761,7 +761,7 @@ mxObjectCodec.prototype.afterEncode = function(enc, obj, node)
* node - XML node to be decoded.
* into - Optional objec to encode the node into.
*/
mxObjectCodec.prototype.decode = function(dec, node, into)
decode = (dec, node, into)=>
{
var id = node.getAttribute('id');
var obj = dec.objects[id];
@ -793,7 +793,7 @@ mxObjectCodec.prototype.decode = function(dec, node, into)
* node - XML node to be decoded.
* obj - Objec to encode the node into.
*/
mxObjectCodec.prototype.decodeNode = function(dec, node, obj)
decodeNode = (dec, node, obj)=>
{
if (node != null)
{
@ -813,7 +813,7 @@ mxObjectCodec.prototype.decodeNode = function(dec, node, obj)
* node - XML node to be decoded.
* obj - Objec to encode the node into.
*/
mxObjectCodec.prototype.decodeAttributes = function(dec, node, obj)
decodeAttributes = (dec, node, obj)=>
{
var attrs = node.attributes;
@ -838,7 +838,7 @@ mxObjectCodec.prototype.decodeAttributes = function(dec, node, obj)
* attr - XML attribute to be decoded.
* obj - Objec to encode the attribute into.
*/
mxObjectCodec.prototype.isIgnoredAttribute = function(dec, attr, obj)
isIgnoredAttribute = (dec, attr, obj)=>
{
return attr.nodeName == 'as' || attr.nodeName == 'id';
};
@ -854,7 +854,7 @@ mxObjectCodec.prototype.isIgnoredAttribute = function(dec, attr, obj)
* attr - XML attribute to be decoded.
* obj - Objec to encode the attribute into.
*/
mxObjectCodec.prototype.decodeAttribute = function(dec, attr, obj)
decodeAttribute = (dec, attr, obj)=>
{
if (!this.isIgnoredAttribute(dec, attr, obj))
{
@ -900,7 +900,7 @@ mxObjectCodec.prototype.decodeAttribute = function(dec, attr, obj)
* node - XML node to be decoded.
* obj - Objec to encode the node into.
*/
mxObjectCodec.prototype.decodeChildren = function(dec, node, obj)
decodeChildren = (dec, node, obj)=>
{
var child = node.firstChild;
@ -929,7 +929,7 @@ mxObjectCodec.prototype.decodeChildren = function(dec, node, obj)
* child - XML child element to be decoded.
* obj - Objec to encode the node into.
*/
mxObjectCodec.prototype.decodeChild = function(dec, child, obj)
decodeChild = (dec, child, obj)=>
{
var fieldname = this.getFieldName(child.getAttribute('as'));
@ -973,7 +973,7 @@ mxObjectCodec.prototype.decodeChild = function(dec, child, obj)
* required to override this to return the correct collection instance
* based on the encoded child.
*/
mxObjectCodec.prototype.getFieldTemplate = function(obj, fieldname, child)
getFieldTemplate = (obj, fieldname, child)=>
{
var template = obj[fieldname];
@ -996,7 +996,7 @@ mxObjectCodec.prototype.getFieldTemplate = function(obj, fieldname, child)
* collection. For strongly typed languages it may be required to
* override this with the correct code to add an entry to an object.
*/
mxObjectCodec.prototype.addObjectValue = function(obj, fieldname, value, template)
addObjectValue = (obj, fieldname, value, template)=>
{
if (value != null && value != template)
{
@ -1025,7 +1025,7 @@ mxObjectCodec.prototype.addObjectValue = function(obj, fieldname, value, templat
* node - XML node to be checked.
* into - Optional object to pass-thru to the codec.
*/
mxObjectCodec.prototype.processInclude = function(dec, node, into)
processInclude = (dec, node, into)=>
{
if (node.nodeName == 'include')
{
@ -1072,7 +1072,7 @@ mxObjectCodec.prototype.processInclude = function(dec, node, into)
* node - XML node to be decoded.
* obj - Object to encode the node into.
*/
mxObjectCodec.prototype.beforeDecode = function(dec, node, obj)
beforeDecode = (dec, node, obj)=>
{
return node;
};
@ -1091,7 +1091,7 @@ mxObjectCodec.prototype.beforeDecode = function(dec, node, obj)
* node - XML node to be decoded.
* obj - Object that represents the default decoding.
*/
mxObjectCodec.prototype.afterDecode = function(dec, node, obj)
afterDecode = (dec, node, obj)=>
{
return obj;
};

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxRootChangeCodec
@ -25,7 +25,7 @@ mxCodecRegistry.register(function()
*
* Encodes the child recursively.
*/
codec.afterEncode = function(enc, obj, node)
codec.afterEncode = (enc, obj, node)=>
{
enc.encodeCell(obj.root, node);
@ -38,7 +38,7 @@ mxCodecRegistry.register(function()
* Decodes the optional children as cells
* using the respective decoder.
*/
codec.beforeDecode = function(dec, node, obj)
codec.beforeDecode = (dec, node, obj)=>
{
if (node.firstChild != null &&
node.firstChild.nodeType == mxConstants.NODETYPE_ELEMENT)
@ -70,7 +70,7 @@ mxCodecRegistry.register(function()
*
* Restores the state by assigning the previous value.
*/
codec.afterDecode = function(dec, node, obj)
codec.afterDecode = (dec, node, obj)=>
{
obj.previous = obj.root;

View File

@ -9,7 +9,7 @@
* dynamically at load time and used implicitly via <mxCodec>
* and the <mxCodecRegistry>.
*/
var mxStylesheetCodec = mxCodecRegistry.register(function()
var mxStylesheetCodec = mxCodecRegistry.register(()=>
{
var codec = new mxObjectCodec(new mxStylesheet());
@ -19,7 +19,7 @@ var mxStylesheetCodec = mxCodecRegistry.register(function()
* Encodes a stylesheet. See <decode> for a description of the
* format.
*/
codec.encode = function(enc, obj)
codec.encode = (enc, obj)=>
{
var node = enc.document.createElement(this.getName());
@ -60,7 +60,7 @@ var mxStylesheetCodec = mxCodecRegistry.register(function()
*
* Returns the string for encoding the given value.
*/
codec.getStringValue = function(key, value)
codec.getStringValue = (key, value)=>
{
var type = typeof(value);
@ -117,7 +117,7 @@ var mxStylesheetCodec = mxCodecRegistry.register(function()
* </mxStylesheet>
* (end)
*/
codec.decode = function(dec, node, into)
codec.decode = (dec, node, into)=>
{
var obj = into || new this.template.constructor();
var id = node.getAttribute('id');

View File

@ -2,7 +2,7 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
mxCodecRegistry.register(function()
mxCodecRegistry.register(()=>
{
/**
* Class: mxTerminalChangeCodec
@ -29,7 +29,7 @@ mxCodecRegistry.register(function()
*
* Restores the state by assigning the previous value.
*/
codec.afterDecode = function(dec, node, obj)
codec.afterDecode = (dec, node, obj)=>
{
obj.previous = obj.terminal;

View File

@ -23,56 +23,56 @@ function mxGraphAbstractHierarchyCell()
*
* The maximum rank this cell occupies. Default is -1.
*/
mxGraphAbstractHierarchyCell.prototype.maxRank = -1;
maxRank = -1;
/**
* Variable: minRank
*
* The minimum rank this cell occupies. Default is -1.
*/
mxGraphAbstractHierarchyCell.prototype.minRank = -1;
minRank = -1;
/**
* Variable: x
*
* The x position of this cell for each layer it occupies
*/
mxGraphAbstractHierarchyCell.prototype.x = null;
x = null;
/**
* Variable: y
*
* The y position of this cell for each layer it occupies
*/
mxGraphAbstractHierarchyCell.prototype.y = null;
y = null;
/**
* Variable: width
*
* The width of this cell. Default is 0.
*/
mxGraphAbstractHierarchyCell.prototype.width = 0;
width = 0;
/**
* Variable: height
*
* The height of this cell. Default is 0.
*/
mxGraphAbstractHierarchyCell.prototype.height = 0;
height = 0;
/**
* Variable: nextLayerConnectedCells
*
* A cached version of the cells this cell connects to on the next layer up
*/
mxGraphAbstractHierarchyCell.prototype.nextLayerConnectedCells = null;
nextLayerConnectedCells = null;
/**
* Variable: previousLayerConnectedCells
*
* A cached version of the cells this cell connects to on the next layer down
*/
mxGraphAbstractHierarchyCell.prototype.previousLayerConnectedCells = null;
previousLayerConnectedCells = null;
/**
* Variable: temp
@ -84,14 +84,14 @@ mxGraphAbstractHierarchyCell.prototype.previousLayerConnectedCells = null;
* be used for hashing the nodes in the model dfs and so hashCode
* was created
*/
mxGraphAbstractHierarchyCell.prototype.temp = null;
temp = null;
/**
* Function: getNextLayerConnectedCells
*
* Returns the cells this cell connects to on the next layer up
*/
mxGraphAbstractHierarchyCell.prototype.getNextLayerConnectedCells = function(layer)
getNextLayerConnectedCells = (layer)=>
{
return null;
};
@ -101,7 +101,7 @@ mxGraphAbstractHierarchyCell.prototype.getNextLayerConnectedCells = function(lay
*
* Returns the cells this cell connects to on the next layer down
*/
mxGraphAbstractHierarchyCell.prototype.getPreviousLayerConnectedCells = function(layer)
getPreviousLayerConnectedCells = (layer)=>
{
return null;
};
@ -111,7 +111,7 @@ mxGraphAbstractHierarchyCell.prototype.getPreviousLayerConnectedCells = function
*
* Returns whether or not this cell is an edge
*/
mxGraphAbstractHierarchyCell.prototype.isEdge = function()
isEdge = ()=>
{
return false;
};
@ -121,7 +121,7 @@ mxGraphAbstractHierarchyCell.prototype.isEdge = function()
*
* Returns whether or not this cell is a node
*/
mxGraphAbstractHierarchyCell.prototype.isVertex = function()
isVertex = ()=>
{
return false;
};
@ -131,7 +131,7 @@ mxGraphAbstractHierarchyCell.prototype.isVertex = function()
*
* Gets the value of temp for the specified layer
*/
mxGraphAbstractHierarchyCell.prototype.getGeneralPurposeVariable = function(layer)
getGeneralPurposeVariable = (layer)=>
{
return null;
};
@ -141,7 +141,7 @@ mxGraphAbstractHierarchyCell.prototype.getGeneralPurposeVariable = function(laye
*
* Set the value of temp for the specified layer
*/
mxGraphAbstractHierarchyCell.prototype.setGeneralPurposeVariable = function(layer, value)
setGeneralPurposeVariable = (layer, value)=>
{
return null;
};
@ -151,7 +151,7 @@ mxGraphAbstractHierarchyCell.prototype.setGeneralPurposeVariable = function(laye
*
* Set the value of x for the specified layer
*/
mxGraphAbstractHierarchyCell.prototype.setX = function(layer, value)
setX = (layer, value)=>
{
if (this.isVertex())
{
@ -168,7 +168,7 @@ mxGraphAbstractHierarchyCell.prototype.setX = function(layer, value)
*
* Gets the value of x on the specified layer
*/
mxGraphAbstractHierarchyCell.prototype.getX = function(layer)
getX = (layer)=>
{
if (this.isVertex())
{
@ -187,7 +187,7 @@ mxGraphAbstractHierarchyCell.prototype.getX = function(layer)
*
* Set the value of y for the specified layer
*/
mxGraphAbstractHierarchyCell.prototype.setY = function(layer, value)
setY = (layer, value)=>
{
if (this.isVertex())
{

View File

@ -31,7 +31,7 @@ function mxGraphHierarchyEdge(edges)
* Extends mxGraphAbstractHierarchyCell.
*/
mxGraphHierarchyEdge.prototype = new mxGraphAbstractHierarchyCell();
mxGraphHierarchyEdge.prototype.constructor = mxGraphHierarchyEdge;
constructor = mxGraphHierarchyEdge;
/**
* Variable: edges
@ -39,28 +39,28 @@ mxGraphHierarchyEdge.prototype.constructor = mxGraphHierarchyEdge;
* The graph edge(s) this object represents. Parallel edges are all grouped
* together within one hierarchy edge.
*/
mxGraphHierarchyEdge.prototype.edges = null;
edges = null;
/**
* Variable: ids
*
* The object identities of the wrapped cells
*/
mxGraphHierarchyEdge.prototype.ids = null;
ids = null;
/**
* Variable: source
*
* The node this edge is sourced at
*/
mxGraphHierarchyEdge.prototype.source = null;
source = null;
/**
* Variable: target
*
* The node this edge targets
*/
mxGraphHierarchyEdge.prototype.target = null;
target = null;
/**
* Variable: isReversed
@ -68,14 +68,14 @@ mxGraphHierarchyEdge.prototype.target = null;
* Whether or not the direction of this edge has been reversed
* internally to create a DAG for the hierarchical layout
*/
mxGraphHierarchyEdge.prototype.isReversed = false;
isReversed = false;
/**
* Function: invert
*
* Inverts the direction of this internal edge(s)
*/
mxGraphHierarchyEdge.prototype.invert = function(layer)
invert = (layer)=>
{
var temp = this.source;
this.source = this.target;
@ -88,7 +88,7 @@ mxGraphHierarchyEdge.prototype.invert = function(layer)
*
* Returns the cells this cell connects to on the next layer up
*/
mxGraphHierarchyEdge.prototype.getNextLayerConnectedCells = function(layer)
getNextLayerConnectedCells = (layer)=>
{
if (this.nextLayerConnectedCells == null)
{
@ -117,7 +117,7 @@ mxGraphHierarchyEdge.prototype.getNextLayerConnectedCells = function(layer)
*
* Returns the cells this cell connects to on the next layer down
*/
mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells = function(layer)
getPreviousLayerConnectedCells = (layer)=>
{
if (this.previousLayerConnectedCells == null)
{
@ -146,7 +146,7 @@ mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells = function(layer)
*
* Returns true.
*/
mxGraphHierarchyEdge.prototype.isEdge = function()
isEdge = ()=>
{
return true;
};
@ -156,7 +156,7 @@ mxGraphHierarchyEdge.prototype.isEdge = function()
*
* Gets the value of temp for the specified layer
*/
mxGraphHierarchyEdge.prototype.getGeneralPurposeVariable = function(layer)
getGeneralPurposeVariable = (layer)=>
{
return this.temp[layer - this.minRank - 1];
};
@ -166,7 +166,7 @@ mxGraphHierarchyEdge.prototype.getGeneralPurposeVariable = function(layer)
*
* Set the value of temp for the specified layer
*/
mxGraphHierarchyEdge.prototype.setGeneralPurposeVariable = function(layer, value)
setGeneralPurposeVariable = (layer, value)=>
{
this.temp[layer - this.minRank - 1] = value;
};
@ -176,7 +176,7 @@ mxGraphHierarchyEdge.prototype.setGeneralPurposeVariable = function(layer, value
*
* Gets the first core edge associated with this wrapper
*/
mxGraphHierarchyEdge.prototype.getCoreCell = function()
getCoreCell = ()=>
{
if (this.edges != null && this.edges.length > 0)
{

View File

@ -112,28 +112,28 @@ function mxGraphHierarchyModel(layout, vertices, roots, parent, tightenToSource)
*
* Stores the largest rank number allocated
*/
mxGraphHierarchyModel.prototype.maxRank = null;
maxRank = null;
/**
* Variable: vertexMapper
*
* Map from graph vertices to internal model nodes.
*/
mxGraphHierarchyModel.prototype.vertexMapper = null;
vertexMapper = null;
/**
* Variable: edgeMapper
*
* Map from graph edges to internal model edges
*/
mxGraphHierarchyModel.prototype.edgeMapper = null;
edgeMapper = null;
/**
* Variable: ranks
*
* Mapping from rank number to actual rank
*/
mxGraphHierarchyModel.prototype.ranks = null;
ranks = null;
/**
* Variable: roots
@ -141,28 +141,28 @@ mxGraphHierarchyModel.prototype.ranks = null;
* Store of roots of this hierarchy model, these are real graph cells, not
* internal cells
*/
mxGraphHierarchyModel.prototype.roots = null;
roots = null;
/**
* Variable: parent
*
* The parent cell whose children are being laid out
*/
mxGraphHierarchyModel.prototype.parent = null;
parent = null;
/**
* Variable: dfsCount
*
* Count of the number of times the ancestor dfs has been used.
*/
mxGraphHierarchyModel.prototype.dfsCount = 0;
dfsCount = 0;
/**
* Variable: SOURCESCANSTARTRANK
*
* High value to start source layering scan rank value from.
*/
mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK = 100000000;
SOURCESCANSTARTRANK = 100000000;
/**
* Variable: tightenToSource
@ -170,7 +170,7 @@ mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK = 100000000;
* Whether or not to tighten the assigned ranks of vertices up towards
* the source cells.
*/
mxGraphHierarchyModel.prototype.tightenToSource = false;
tightenToSource = false;
/**
* Function: createInternalCells
@ -185,7 +185,7 @@ mxGraphHierarchyModel.prototype.tightenToSource = false;
* internalVertices - The array of <mxGraphHierarchyNodes> to have their
* information filled in using the real vertices.
*/
mxGraphHierarchyModel.prototype.createInternalCells = function(layout, vertices, internalVertices)
createInternalCells = (layout, vertices, internalVertices)=>
{
var graph = layout.getGraph();
@ -274,7 +274,7 @@ mxGraphHierarchyModel.prototype.createInternalCells = function(layout, vertices,
* or sinks and working through each node in the relevant edge direction.
* Starting at the sinks is basically a longest path layering algorithm.
*/
mxGraphHierarchyModel.prototype.initialRank = function()
initialRank = ()=>
{
var startNodes = [];
@ -428,7 +428,7 @@ mxGraphHierarchyModel.prototype.initialRank = function()
* Fixes the layer assignments to the values stored in the nodes. Also needs
* to create dummy nodes for edges that cross layers.
*/
mxGraphHierarchyModel.prototype.fixRanks = function()
fixRanks = ()=>
{
var rankList = [];
this.ranks = [];
@ -457,7 +457,7 @@ mxGraphHierarchyModel.prototype.fixRanks = function()
}
}
this.visit(function(parent, node, edge, layer, seen)
this.visit((parent, node, edge, layer, seen)=>
{
if (seen == 0 && node.maxRank < 0 && node.minRank < 0)
{
@ -506,7 +506,7 @@ mxGraphHierarchyModel.prototype.fixRanks = function()
* trackAncestors - Whether or not the search is to keep track all nodes
* directly above this one in the search path.
*/
mxGraphHierarchyModel.prototype.visit = function(visitor, dfsRoots, trackAncestors, seenNodes)
visit = (visitor, dfsRoots, trackAncestors, seenNodes)=>
{
// Run dfs through on all roots
if (dfsRoots != null)
@ -558,7 +558,7 @@ mxGraphHierarchyModel.prototype.visit = function(visitor, dfsRoots, trackAncesto
* ancestor node of the current node
* layer - the layer on the dfs tree ( not the same as the model ranks )
*/
mxGraphHierarchyModel.prototype.dfs = function(parent, root, connectingEdge, visitor, seen, layer)
dfs = (parent, root, connectingEdge, visitor, seen, layer)=>
{
if (root != null)
{
@ -611,7 +611,7 @@ mxGraphHierarchyModel.prototype.dfs = function(parent, root, connectingEdge, vis
* childHash - the new hash code for this node
* layer - the layer on the dfs tree ( not the same as the model ranks )
*/
mxGraphHierarchyModel.prototype.extendedDfs = function(parent, root, connectingEdge, visitor, seen, ancestors, childHash, layer)
extendedDfs = (parent, root, connectingEdge, visitor, seen, ancestors, childHash, layer)=>
{
// Explanation of custom hash set. Previously, the ancestors variable
// was passed through the dfs as a HashSet. The ancestors were copied

View File

@ -28,35 +28,35 @@ function mxGraphHierarchyNode(cell)
* Extends mxGraphAbstractHierarchyCell.
*/
mxGraphHierarchyNode.prototype = new mxGraphAbstractHierarchyCell();
mxGraphHierarchyNode.prototype.constructor = mxGraphHierarchyNode;
constructor = mxGraphHierarchyNode;
/**
* Variable: cell
*
* The graph cell this object represents.
*/
mxGraphHierarchyNode.prototype.cell = null;
cell = null;
/**
* Variable: id
*
* The object identity of the wrapped cell
*/
mxGraphHierarchyNode.prototype.id = null;
id = null;
/**
* Variable: connectsAsTarget
*
* Collection of hierarchy edges that have this node as a target
*/
mxGraphHierarchyNode.prototype.connectsAsTarget = null;
connectsAsTarget = null;
/**
* Variable: connectsAsSource
*
* Collection of hierarchy edges that have this node as a source
*/
mxGraphHierarchyNode.prototype.connectsAsSource = null;
connectsAsSource = null;
/**
* Variable: hashCode
@ -64,14 +64,14 @@ mxGraphHierarchyNode.prototype.connectsAsSource = null;
* Assigns a unique hashcode for each node. Used by the model dfs instead
* of copying HashSets
*/
mxGraphHierarchyNode.prototype.hashCode = false;
hashCode = false;
/**
* Function: getRankValue
*
* Returns the integer value of the layer that this node resides in
*/
mxGraphHierarchyNode.prototype.getRankValue = function(layer)
getRankValue = (layer)=>
{
return this.maxRank;
};
@ -81,7 +81,7 @@ mxGraphHierarchyNode.prototype.getRankValue = function(layer)
*
* Returns the cells this cell connects to on the next layer up
*/
mxGraphHierarchyNode.prototype.getNextLayerConnectedCells = function(layer)
getNextLayerConnectedCells = (layer)=>
{
if (this.nextLayerConnectedCells == null)
{
@ -114,7 +114,7 @@ mxGraphHierarchyNode.prototype.getNextLayerConnectedCells = function(layer)
*
* Returns the cells this cell connects to on the next layer down
*/
mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells = function(layer)
getPreviousLayerConnectedCells = (layer)=>
{
if (this.previousLayerConnectedCells == null)
{
@ -146,7 +146,7 @@ mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells = function(layer)
*
* Returns true.
*/
mxGraphHierarchyNode.prototype.isVertex = function()
isVertex = ()=>
{
return true;
};
@ -156,7 +156,7 @@ mxGraphHierarchyNode.prototype.isVertex = function()
*
* Gets the value of temp for the specified layer
*/
mxGraphHierarchyNode.prototype.getGeneralPurposeVariable = function(layer)
getGeneralPurposeVariable = (layer)=>
{
return this.temp[0];
};
@ -166,7 +166,7 @@ mxGraphHierarchyNode.prototype.getGeneralPurposeVariable = function(layer)
*
* Set the value of temp for the specified layer
*/
mxGraphHierarchyNode.prototype.setGeneralPurposeVariable = function(layer, value)
setGeneralPurposeVariable = (layer, value)=>
{
this.temp[0] = value;
};
@ -174,7 +174,7 @@ mxGraphHierarchyNode.prototype.setGeneralPurposeVariable = function(layer, value
/**
* Function: isAncestor
*/
mxGraphHierarchyNode.prototype.isAncestor = function(otherNode)
isAncestor = (otherNode)=>
{
// Firstly, the hash code of this node needs to be shorter than the
// other node
@ -214,7 +214,7 @@ mxGraphHierarchyNode.prototype.isAncestor = function(otherNode)
*
* Gets the core vertex associated with this wrapper
*/
mxGraphHierarchyNode.prototype.getCoreCell = function()
getCoreCell = ()=>
{
return this.cell;
};

View File

@ -112,28 +112,28 @@ function mxSwimlaneModel(layout, vertices, roots, parent, tightenToSource)
*
* Stores the largest rank number allocated
*/
mxSwimlaneModel.prototype.maxRank = null;
maxRank = null;
/**
* Variable: vertexMapper
*
* Map from graph vertices to internal model nodes.
*/
mxSwimlaneModel.prototype.vertexMapper = null;
vertexMapper = null;
/**
* Variable: edgeMapper
*
* Map from graph edges to internal model edges
*/
mxSwimlaneModel.prototype.edgeMapper = null;
edgeMapper = null;
/**
* Variable: ranks
*
* Mapping from rank number to actual rank
*/
mxSwimlaneModel.prototype.ranks = null;
ranks = null;
/**
* Variable: roots
@ -141,28 +141,28 @@ mxSwimlaneModel.prototype.ranks = null;
* Store of roots of this hierarchy model, these are real graph cells, not
* internal cells
*/
mxSwimlaneModel.prototype.roots = null;
roots = null;
/**
* Variable: parent
*
* The parent cell whose children are being laid out
*/
mxSwimlaneModel.prototype.parent = null;
parent = null;
/**
* Variable: dfsCount
*
* Count of the number of times the ancestor dfs has been used.
*/
mxSwimlaneModel.prototype.dfsCount = 0;
dfsCount = 0;
/**
* Variable: SOURCESCANSTARTRANK
*
* High value to start source layering scan rank value from.
*/
mxSwimlaneModel.prototype.SOURCESCANSTARTRANK = 100000000;
SOURCESCANSTARTRANK = 100000000;
/**
* Variable: tightenToSource
@ -170,14 +170,14 @@ mxSwimlaneModel.prototype.SOURCESCANSTARTRANK = 100000000;
* Whether or not to tighten the assigned ranks of vertices up towards
* the source cells.
*/
mxSwimlaneModel.prototype.tightenToSource = false;
tightenToSource = false;
/**
* Variable: ranksPerGroup
*
* An array of the number of ranks within each swimlane
*/
mxSwimlaneModel.prototype.ranksPerGroup = null;
ranksPerGroup = null;
/**
* Function: createInternalCells
@ -192,7 +192,7 @@ mxSwimlaneModel.prototype.ranksPerGroup = null;
* internalVertices - The array of <mxGraphHierarchyNodes> to have their
* information filled in using the real vertices.
*/
mxSwimlaneModel.prototype.createInternalCells = function(layout, vertices, internalVertices)
createInternalCells = (layout, vertices, internalVertices)=>
{
var graph = layout.getGraph();
var swimlanes = layout.swimlanes;
@ -292,7 +292,7 @@ mxSwimlaneModel.prototype.createInternalCells = function(layout, vertices, inter
* or sinks and working through each node in the relevant edge direction.
* Starting at the sinks is basically a longest path layering algorithm.
*/
mxSwimlaneModel.prototype.initialRank = function()
initialRank = ()=>
{
this.ranksPerGroup = [];
@ -483,7 +483,7 @@ mxSwimlaneModel.prototype.initialRank = function()
* chainCount - the number of edges in the chain of vertices going through
* the current swimlane
*/
mxSwimlaneModel.prototype.maxChainDfs = function(parent, root, connectingEdge, seen, chainCount)
maxChainDfs = (parent, root, connectingEdge, seen, chainCount)=>
{
if (root != null)
{
@ -529,7 +529,7 @@ mxSwimlaneModel.prototype.maxChainDfs = function(parent, root, connectingEdge, s
* Fixes the layer assignments to the values stored in the nodes. Also needs
* to create dummy nodes for edges that cross layers.
*/
mxSwimlaneModel.prototype.fixRanks = function()
fixRanks = ()=>
{
var rankList = [];
this.ranks = [];
@ -558,7 +558,7 @@ mxSwimlaneModel.prototype.fixRanks = function()
}
}
this.visit(function(parent, node, edge, layer, seen)
this.visit((parent, node, edge, layer, seen)=>
{
if (seen == 0 && node.maxRank < 0 && node.minRank < 0)
{
@ -607,7 +607,7 @@ mxSwimlaneModel.prototype.fixRanks = function()
* trackAncestors - Whether or not the search is to keep track all nodes
* directly above this one in the search path.
*/
mxSwimlaneModel.prototype.visit = function(visitor, dfsRoots, trackAncestors, seenNodes)
visit = (visitor, dfsRoots, trackAncestors, seenNodes)=>
{
// Run dfs through on all roots
if (dfsRoots != null)
@ -659,7 +659,7 @@ mxSwimlaneModel.prototype.visit = function(visitor, dfsRoots, trackAncestors, se
* ancestor node of the current node
* layer - the layer on the dfs tree ( not the same as the model ranks )
*/
mxSwimlaneModel.prototype.dfs = function(parent, root, connectingEdge, visitor, seen, layer)
dfs = (parent, root, connectingEdge, visitor, seen, layer)=>
{
if (root != null)
{
@ -712,7 +712,7 @@ mxSwimlaneModel.prototype.dfs = function(parent, root, connectingEdge, visitor,
* childHash - the new hash code for this node
* layer - the layer on the dfs tree ( not the same as the model ranks )
*/
mxSwimlaneModel.prototype.extendedDfs = function(parent, root, connectingEdge, visitor, seen, ancestors, childHash, layer)
extendedDfs = (parent, root, connectingEdge, visitor, seen, ancestors, childHash, layer)=>
{
// Explanation of custom hash set. Previously, the ancestors variable
// was passed through the dfs as a HashSet. The ancestors were copied

View File

@ -38,14 +38,14 @@ var mxHierarchicalEdgeStyle =
* Extends mxGraphLayout.
*/
mxHierarchicalLayout.prototype = new mxGraphLayout();
mxHierarchicalLayout.prototype.constructor = mxHierarchicalLayout;
constructor = mxHierarchicalLayout;
/**
* Variable: roots
*
* Holds the array of <mxCell> that this layout contains.
*/
mxHierarchicalLayout.prototype.roots = null;
roots = null;
/**
* Variable: resizeParent
@ -53,7 +53,7 @@ mxHierarchicalLayout.prototype.roots = null;
* Specifies if the parent should be resized after the layout so that it
* contains all the child cells. Default is false. See also <parentBorder>.
*/
mxHierarchicalLayout.prototype.resizeParent = false;
resizeParent = false;
/**
* Variable: maintainParentLocation
@ -62,7 +62,7 @@ mxHierarchicalLayout.prototype.resizeParent = false;
* top, left corner stays the same before and after execution of
* the layout. Default is false for backwards compatibility.
*/
mxHierarchicalLayout.prototype.maintainParentLocation = false;
maintainParentLocation = false;
/**
* Variable: moveParent
@ -70,7 +70,7 @@ mxHierarchicalLayout.prototype.maintainParentLocation = false;
* Specifies if the parent should be moved if <resizeParent> is enabled.
* Default is false.
*/
mxHierarchicalLayout.prototype.moveParent = false;
moveParent = false;
/**
* Variable: parentBorder
@ -78,28 +78,28 @@ mxHierarchicalLayout.prototype.moveParent = false;
* The border to be added around the children if the parent is to be
* resized using <resizeParent>. Default is 0.
*/
mxHierarchicalLayout.prototype.parentBorder = 0;
parentBorder = 0;
/**
* Variable: intraCellSpacing
*
* The spacing buffer added between cells on the same layer. Default is 30.
*/
mxHierarchicalLayout.prototype.intraCellSpacing = 30;
intraCellSpacing = 30;
/**
* Variable: interRankCellSpacing
*
* The spacing buffer added between cell on adjacent layers. Default is 100.
*/
mxHierarchicalLayout.prototype.interRankCellSpacing = 100;
interRankCellSpacing = 100;
/**
* Variable: interHierarchySpacing
*
* The spacing buffer between unconnected hierarchies. Default is 60.
*/
mxHierarchicalLayout.prototype.interHierarchySpacing = 60;
interHierarchySpacing = 60;
/**
* Variable: parallelEdgeSpacing
@ -107,7 +107,7 @@ mxHierarchicalLayout.prototype.interHierarchySpacing = 60;
* The distance between each parallel edge on each ranks for long edges.
* Default is 10.
*/
mxHierarchicalLayout.prototype.parallelEdgeSpacing = 10;
parallelEdgeSpacing = 10;
/**
* Variable: orientation
@ -115,7 +115,7 @@ mxHierarchicalLayout.prototype.parallelEdgeSpacing = 10;
* The position of the root node(s) relative to the laid out graph in.
* Default is <mxConstants.DIRECTION_NORTH>.
*/
mxHierarchicalLayout.prototype.orientation = mxConstants.DIRECTION_NORTH;
orientation = mxConstants.DIRECTION_NORTH;
/**
* Variable: fineTuning
@ -123,7 +123,7 @@ mxHierarchicalLayout.prototype.orientation = mxConstants.DIRECTION_NORTH;
* Whether or not to perform local optimisations and iterate multiple times
* through the algorithm. Default is true.
*/
mxHierarchicalLayout.prototype.fineTuning = true;
fineTuning = true;
/**
*
@ -132,7 +132,7 @@ mxHierarchicalLayout.prototype.fineTuning = true;
* Whether or not to tighten the assigned ranks of vertices up towards
* the source cells. Default is true.
*/
mxHierarchicalLayout.prototype.tightenToSource = true;
tightenToSource = true;
/**
* Variable: disableEdgeStyle
@ -140,7 +140,7 @@ mxHierarchicalLayout.prototype.tightenToSource = true;
* Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are
* modified by the result. Default is true.
*/
mxHierarchicalLayout.prototype.disableEdgeStyle = true;
disableEdgeStyle = true;
/**
* Variable: traverseAncestors
@ -150,35 +150,35 @@ mxHierarchicalLayout.prototype.disableEdgeStyle = true;
* terminal vertices have different parents but are in the same
* ancestry chain. Default is true.
*/
mxHierarchicalLayout.prototype.traverseAncestors = true;
traverseAncestors = true;
/**
* Variable: model
*
* The internal <mxGraphHierarchyModel> formed of the layout.
*/
mxHierarchicalLayout.prototype.model = null;
model = null;
/**
* Variable: edgesSet
*
* A cache of edges whose source terminal is the key
*/
mxHierarchicalLayout.prototype.edgesCache = null;
edgesCache = null;
/**
* Variable: edgesSet
*
* A cache of edges whose source terminal is the key
*/
mxHierarchicalLayout.prototype.edgeSourceTermCache = null;
edgeSourceTermCache = null;
/**
* Variable: edgesSet
*
* A cache of edges whose source terminal is the key
*/
mxHierarchicalLayout.prototype.edgesTargetTermCache = null;
edgesTargetTermCache = null;
/**
* Variable: edgeStyle
@ -186,14 +186,14 @@ mxHierarchicalLayout.prototype.edgesTargetTermCache = null;
* The style to apply between cell layers to edge segments.
* Default is <mxHierarchicalEdgeStyle.POLYLINE>.
*/
mxHierarchicalLayout.prototype.edgeStyle = mxHierarchicalEdgeStyle.POLYLINE;
edgeStyle = mxHierarchicalEdgeStyle.POLYLINE;
/**
* Function: getModel
*
* Returns the internal <mxGraphHierarchyModel> for this layout algorithm.
*/
mxHierarchicalLayout.prototype.getModel = function()
getModel = ()=>
{
return this.model;
};
@ -208,7 +208,7 @@ mxHierarchicalLayout.prototype.getModel = function()
* parent - Parent <mxCell> that contains the children to be laid out.
* roots - Optional starting roots of the layout.
*/
mxHierarchicalLayout.prototype.execute = function(parent, roots)
execute = (parent, roots)=>
{
this.parent = parent;
var model = this.graph.model;
@ -310,7 +310,7 @@ mxHierarchicalLayout.prototype.execute = function(parent, roots)
* parent - <mxCell> whose children should be checked.
* vertices - array of vertices to limit search to
*/
mxHierarchicalLayout.prototype.findRoots = function(parent, vertices)
findRoots = (parent, vertices)=>
{
var roots = [];
@ -377,7 +377,7 @@ mxHierarchicalLayout.prototype.findRoots = function(parent, vertices)
*
* cell - <mxCell> whose edges should be returned.
*/
mxHierarchicalLayout.prototype.getEdges = function(cell)
getEdges = (cell)=>
{
var cachedEdges = this.edgesCache.get(cell);
@ -437,7 +437,7 @@ mxHierarchicalLayout.prototype.getEdges = function(cell)
* edge - <mxCell> whose edges should be returned.
* source - Boolean that specifies whether the source or target terminal is to be returned
*/
mxHierarchicalLayout.prototype.getVisibleTerminal = function(edge, source)
getVisibleTerminal = (edge, source)=>
{
var terminalCache = this.edgesTargetTermCache;
@ -483,7 +483,7 @@ mxHierarchicalLayout.prototype.getVisibleTerminal = function(edge, source)
* routing changes made. It runs each stage of the layout that has been
* created.
*/
mxHierarchicalLayout.prototype.run = function(parent)
run = (parent)=>
{
// Separate out unconnected hierarchies
var hierarchyVertices = [];
@ -589,7 +589,7 @@ mxHierarchicalLayout.prototype.run = function(parent)
*
* Creates an array of descendant cells
*/
mxHierarchicalLayout.prototype.filterDescendants = function(cell, result)
filterDescendants = (cell, result)=>
{
var model = this.graph.model;
@ -627,7 +627,7 @@ mxHierarchicalLayout.prototype.filterDescendants = function(cell, result)
*
* cell - <mxCell> that represents the port.
*/
mxHierarchicalLayout.prototype.isPort = function(cell)
isPort = (cell)=>
{
if (cell != null && cell.geometry != null)
{
@ -651,7 +651,7 @@ mxHierarchicalLayout.prototype.isPort = function(cell)
* target -
* directed -
*/
mxHierarchicalLayout.prototype.getEdgesBetween = function(source, target, directed)
getEdgesBetween = (source, target, directed)=>
{
directed = (directed != null) ? directed : false;
var edges = this.getEdges(source);
@ -689,7 +689,7 @@ mxHierarchicalLayout.prototype.getEdgesBetween = function(source, target, direct
* null for the first step of the traversal.
* allVertices - Array of cell paths for the visited cells.
*/
mxHierarchicalLayout.prototype.traverse = function(vertex, directed, edge, allVertices, currentComp,
traverse = function(vertex, directed, edge, allVertices, currentComp,
hierarchyVertices, filledVertexSet)
{
if (vertex != null && allVertices != null)
@ -806,7 +806,7 @@ mxHierarchicalLayout.prototype.traverse = function(vertex, directed, edge, allVe
*
* Executes the cycle stage using mxMinimumCycleRemover.
*/
mxHierarchicalLayout.prototype.cycleStage = function(parent)
cycleStage = (parent)=>
{
var cycleStage = new mxMinimumCycleRemover(this);
cycleStage.execute(parent);
@ -817,7 +817,7 @@ mxHierarchicalLayout.prototype.cycleStage = function(parent)
*
* Implements first stage of a Sugiyama layout.
*/
mxHierarchicalLayout.prototype.layeringStage = function()
layeringStage = ()=>
{
this.model.initialRank();
this.model.fixRanks();
@ -828,7 +828,7 @@ mxHierarchicalLayout.prototype.layeringStage = function()
*
* Executes the crossing stage using mxMedianHybridCrossingReduction.
*/
mxHierarchicalLayout.prototype.crossingStage = function(parent)
crossingStage = (parent)=>
{
var crossingStage = new mxMedianHybridCrossingReduction(this);
crossingStage.execute(parent);
@ -839,7 +839,7 @@ mxHierarchicalLayout.prototype.crossingStage = function(parent)
*
* Executes the placement stage using mxCoordinateAssignment.
*/
mxHierarchicalLayout.prototype.placementStage = function(initialX, parent)
placementStage = (initialX, parent)=>
{
var placementStage = new mxCoordinateAssignment(this, this.intraCellSpacing,
this.interRankCellSpacing, this.orientation, initialX,

View File

@ -30,28 +30,28 @@ function mxSwimlaneLayout(graph, orientation, deterministic)
* Extends mxGraphLayout.
*/
mxSwimlaneLayout.prototype = new mxGraphLayout();
mxSwimlaneLayout.prototype.constructor = mxSwimlaneLayout;
constructor = mxSwimlaneLayout;
/**
* Variable: roots
*
* Holds the array of <mxCell> that this layout contains.
*/
mxSwimlaneLayout.prototype.roots = null;
roots = null;
/**
* Variable: swimlanes
*
* Holds the array of <mxCell> of the ordered swimlanes to lay out
*/
mxSwimlaneLayout.prototype.swimlanes = null;
swimlanes = null;
/**
* Variable: dummyVertexWidth
*
* The cell width of any dummy vertices inserted
*/
mxSwimlaneLayout.prototype.dummyVertexWidth = 50;
dummyVertexWidth = 50;
/**
* Variable: resizeParent
@ -59,7 +59,7 @@ mxSwimlaneLayout.prototype.dummyVertexWidth = 50;
* Specifies if the parent should be resized after the layout so that it
* contains all the child cells. Default is false. See also <parentBorder>.
*/
mxSwimlaneLayout.prototype.resizeParent = false;
resizeParent = false;
/**
* Variable: maintainParentLocation
@ -68,7 +68,7 @@ mxSwimlaneLayout.prototype.resizeParent = false;
* top, left corner stays the same before and after execution of
* the layout. Default is false for backwards compatibility.
*/
mxSwimlaneLayout.prototype.maintainParentLocation = false;
maintainParentLocation = false;
/**
* Variable: moveParent
@ -76,7 +76,7 @@ mxSwimlaneLayout.prototype.maintainParentLocation = false;
* Specifies if the parent should be moved if <resizeParent> is enabled.
* Default is false.
*/
mxSwimlaneLayout.prototype.moveParent = false;
moveParent = false;
/**
* Variable: parentBorder
@ -84,28 +84,28 @@ mxSwimlaneLayout.prototype.moveParent = false;
* The border to be added around the children if the parent is to be
* resized using <resizeParent>. Default is 30.
*/
mxSwimlaneLayout.prototype.parentBorder = 30;
parentBorder = 30;
/**
* Variable: intraCellSpacing
*
* The spacing buffer added between cells on the same layer. Default is 30.
*/
mxSwimlaneLayout.prototype.intraCellSpacing = 30;
intraCellSpacing = 30;
/**
* Variable: interRankCellSpacing
*
* The spacing buffer added between cell on adjacent layers. Default is 100.
*/
mxSwimlaneLayout.prototype.interRankCellSpacing = 100;
interRankCellSpacing = 100;
/**
* Variable: interHierarchySpacing
*
* The spacing buffer between unconnected hierarchies. Default is 60.
*/
mxSwimlaneLayout.prototype.interHierarchySpacing = 60;
interHierarchySpacing = 60;
/**
* Variable: parallelEdgeSpacing
@ -113,7 +113,7 @@ mxSwimlaneLayout.prototype.interHierarchySpacing = 60;
* The distance between each parallel edge on each ranks for long edges.
* Default is 10.
*/
mxSwimlaneLayout.prototype.parallelEdgeSpacing = 10;
parallelEdgeSpacing = 10;
/**
* Variable: orientation
@ -121,7 +121,7 @@ mxSwimlaneLayout.prototype.parallelEdgeSpacing = 10;
* The position of the root node(s) relative to the laid out graph in.
* Default is <mxConstants.DIRECTION_NORTH>.
*/
mxSwimlaneLayout.prototype.orientation = mxConstants.DIRECTION_NORTH;
orientation = mxConstants.DIRECTION_NORTH;
/**
* Variable: fineTuning
@ -129,7 +129,7 @@ mxSwimlaneLayout.prototype.orientation = mxConstants.DIRECTION_NORTH;
* Whether or not to perform local optimisations and iterate multiple times
* through the algorithm. Default is true.
*/
mxSwimlaneLayout.prototype.fineTuning = true;
fineTuning = true;
/**
* Variable: tightenToSource
@ -137,7 +137,7 @@ mxSwimlaneLayout.prototype.fineTuning = true;
* Whether or not to tighten the assigned ranks of vertices up towards
* the source cells. Default is true.
*/
mxSwimlaneLayout.prototype.tightenToSource = true;
tightenToSource = true;
/**
* Variable: disableEdgeStyle
@ -145,7 +145,7 @@ mxSwimlaneLayout.prototype.tightenToSource = true;
* Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are
* modified by the result. Default is true.
*/
mxSwimlaneLayout.prototype.disableEdgeStyle = true;
disableEdgeStyle = true;
/**
* Variable: traverseAncestors
@ -155,35 +155,35 @@ mxSwimlaneLayout.prototype.disableEdgeStyle = true;
* terminal vertices have different parents but are in the same
* ancestry chain. Default is true.
*/
mxSwimlaneLayout.prototype.traverseAncestors = true;
traverseAncestors = true;
/**
* Variable: model
*
* The internal <mxSwimlaneModel> formed of the layout.
*/
mxSwimlaneLayout.prototype.model = null;
model = null;
/**
* Variable: edgesSet
*
* A cache of edges whose source terminal is the key
*/
mxSwimlaneLayout.prototype.edgesCache = null;
edgesCache = null;
/**
* Variable: edgesSet
*
* A cache of edges whose source terminal is the key
*/
mxHierarchicalLayout.prototype.edgeSourceTermCache = null;
edgeSourceTermCache = null;
/**
* Variable: edgesSet
*
* A cache of edges whose source terminal is the key
*/
mxHierarchicalLayout.prototype.edgesTargetTermCache = null;
edgesTargetTermCache = null;
/**
* Variable: edgeStyle
@ -191,14 +191,14 @@ mxHierarchicalLayout.prototype.edgesTargetTermCache = null;
* The style to apply between cell layers to edge segments.
* Default is <mxHierarchicalEdgeStyle.POLYLINE>.
*/
mxHierarchicalLayout.prototype.edgeStyle = mxHierarchicalEdgeStyle.POLYLINE;
edgeStyle = mxHierarchicalEdgeStyle.POLYLINE;
/**
* Function: getModel
*
* Returns the internal <mxSwimlaneModel> for this layout algorithm.
*/
mxSwimlaneLayout.prototype.getModel = function()
getModel = ()=>
{
return this.model;
};
@ -213,7 +213,7 @@ mxSwimlaneLayout.prototype.getModel = function()
* parent - Parent <mxCell> that contains the children to be laid out.
* swimlanes - Ordered array of swimlanes to be laid out
*/
mxSwimlaneLayout.prototype.execute = function(parent, swimlanes)
execute = (parent, swimlanes)=>
{
this.parent = parent;
var model = this.graph.model;
@ -308,7 +308,7 @@ mxSwimlaneLayout.prototype.execute = function(parent, swimlanes)
* all child vertices.
*
*/
mxSwimlaneLayout.prototype.updateGroupBounds = function()
updateGroupBounds = ()=>
{
// Get all vertices and edge in the layout
var cells = [];
@ -403,7 +403,7 @@ mxSwimlaneLayout.prototype.updateGroupBounds = function()
* parent - <mxCell> whose children should be checked.
* vertices - array of vertices to limit search to
*/
mxSwimlaneLayout.prototype.findRoots = function(parent, vertices)
findRoots = (parent, vertices)=>
{
var roots = [];
@ -476,7 +476,7 @@ mxSwimlaneLayout.prototype.findRoots = function(parent, vertices)
*
* cell - <mxCell> whose edges should be returned.
*/
mxSwimlaneLayout.prototype.getEdges = function(cell)
getEdges = (cell)=>
{
var cachedEdges = this.edgesCache.get(cell);
@ -535,7 +535,7 @@ mxSwimlaneLayout.prototype.getEdges = function(cell)
* edge - <mxCell> whose edges should be returned.
* source - Boolean that specifies whether the source or target terminal is to be returned
*/
mxSwimlaneLayout.prototype.getVisibleTerminal = function(edge, source)
getVisibleTerminal = (edge, source)=>
{
var terminalCache = this.edgesTargetTermCache;
@ -581,7 +581,7 @@ mxSwimlaneLayout.prototype.getVisibleTerminal = function(edge, source)
* routing changes made. It runs each stage of the layout that has been
* created.
*/
mxSwimlaneLayout.prototype.run = function(parent)
run = (parent)=>
{
// Separate out unconnected hierarchies
var hierarchyVertices = [];
@ -688,7 +688,7 @@ mxSwimlaneLayout.prototype.run = function(parent)
*
* Creates an array of descendant cells
*/
mxSwimlaneLayout.prototype.filterDescendants = function(cell, result)
filterDescendants = (cell, result)=>
{
var model = this.graph.model;
@ -726,7 +726,7 @@ mxSwimlaneLayout.prototype.filterDescendants = function(cell, result)
*
* cell - <mxCell> that represents the port.
*/
mxSwimlaneLayout.prototype.isPort = function(cell)
isPort = (cell)=>
{
if (cell.geometry.relative)
{
@ -748,7 +748,7 @@ mxSwimlaneLayout.prototype.isPort = function(cell)
* target -
* directed -
*/
mxSwimlaneLayout.prototype.getEdgesBetween = function(source, target, directed)
getEdgesBetween = (source, target, directed)=>
{
directed = (directed != null) ? directed : false;
var edges = this.getEdges(source);
@ -787,7 +787,7 @@ mxSwimlaneLayout.prototype.getEdgesBetween = function(source, target, directed)
* allVertices - Array of cell paths for the visited cells.
* swimlaneIndex - the laid out order index of the swimlane vertex is contained in
*/
mxSwimlaneLayout.prototype.traverse = function(vertex, directed, edge, allVertices, currentComp,
traverse = function(vertex, directed, edge, allVertices, currentComp,
hierarchyVertices, filledVertexSet, swimlaneIndex)
{
if (vertex != null && allVertices != null)
@ -888,7 +888,7 @@ mxSwimlaneLayout.prototype.traverse = function(vertex, directed, edge, allVertic
*
* Executes the cycle stage using mxMinimumCycleRemover.
*/
mxSwimlaneLayout.prototype.cycleStage = function(parent)
cycleStage = (parent)=>
{
var cycleStage = new mxSwimlaneOrdering(this);
cycleStage.execute(parent);
@ -899,7 +899,7 @@ mxSwimlaneLayout.prototype.cycleStage = function(parent)
*
* Implements first stage of a Sugiyama layout.
*/
mxSwimlaneLayout.prototype.layeringStage = function()
layeringStage = ()=>
{
this.model.initialRank();
this.model.fixRanks();
@ -910,7 +910,7 @@ mxSwimlaneLayout.prototype.layeringStage = function()
*
* Executes the crossing stage using mxMedianHybridCrossingReduction.
*/
mxSwimlaneLayout.prototype.crossingStage = function(parent)
crossingStage = (parent)=>
{
var crossingStage = new mxMedianHybridCrossingReduction(this);
crossingStage.execute(parent);
@ -921,7 +921,7 @@ mxSwimlaneLayout.prototype.crossingStage = function(parent)
*
* Executes the placement stage using mxCoordinateAssignment.
*/
mxSwimlaneLayout.prototype.placementStage = function(initialX, parent)
placementStage = (initialX, parent)=>
{
var placementStage = new mxCoordinateAssignment(this, this.intraCellSpacing,
this.interRankCellSpacing, this.orientation, initialX,

View File

@ -35,28 +35,28 @@ function mxCoordinateAssignment(layout, intraCellSpacing, interRankCellSpacing,
* Extends mxHierarchicalLayoutStage.
*/
mxCoordinateAssignment.prototype = new mxHierarchicalLayoutStage();
mxCoordinateAssignment.prototype.constructor = mxCoordinateAssignment;
constructor = mxCoordinateAssignment;
/**
* Variable: layout
*
* Reference to the enclosing <mxHierarchicalLayout>.
*/
mxCoordinateAssignment.prototype.layout = null;
layout = null;
/**
* Variable: intraCellSpacing
*
* The minimum buffer between cells on the same rank. Default is 30.
*/
mxCoordinateAssignment.prototype.intraCellSpacing = 30;
intraCellSpacing = 30;
/**
* Variable: interRankCellSpacing
*
* The minimum distance between cells on adjacent ranks. Default is 100.
*/
mxCoordinateAssignment.prototype.interRankCellSpacing = 100;
interRankCellSpacing = 100;
/**
* Variable: parallelEdgeSpacing
@ -64,35 +64,35 @@ mxCoordinateAssignment.prototype.interRankCellSpacing = 100;
* The distance between each parallel edge on each ranks for long edges.
* Default is 10.
*/
mxCoordinateAssignment.prototype.parallelEdgeSpacing = 10;
parallelEdgeSpacing = 10;
/**
* Variable: maxIterations
*
* The number of heuristic iterations to run. Default is 8.
*/
mxCoordinateAssignment.prototype.maxIterations = 8;
maxIterations = 8;
/**
* Variable: prefHozEdgeSep
*
* The preferred horizontal distance between edges exiting a vertex Default is 5.
*/
mxCoordinateAssignment.prototype.prefHozEdgeSep = 5;
prefHozEdgeSep = 5;
/**
* Variable: prefVertEdgeOff
*
* The preferred vertical offset between edges exiting a vertex Default is 2.
*/
mxCoordinateAssignment.prototype.prefVertEdgeOff = 2;
prefVertEdgeOff = 2;
/**
* Variable: minEdgeJetty
*
* The minimum distance for an edge jetty from a vertex Default is 12.
*/
mxCoordinateAssignment.prototype.minEdgeJetty = 12;
minEdgeJetty = 12;
/**
* Variable: channelBuffer
@ -100,7 +100,7 @@ mxCoordinateAssignment.prototype.minEdgeJetty = 12;
* The size of the vertical buffer in the center of inter-rank channels
* where edge control points should not be placed Default is 4.
*/
mxCoordinateAssignment.prototype.channelBuffer = 4;
channelBuffer = 4;
/**
* Variable: jettyPositions
@ -113,7 +113,7 @@ mxCoordinateAssignment.prototype.channelBuffer = 4;
* Note that the y co-ord is the offset of the jetty, not the
* absolute point
*/
mxCoordinateAssignment.prototype.jettyPositions = null;
jettyPositions = null;
/**
* Variable: orientation
@ -121,70 +121,70 @@ mxCoordinateAssignment.prototype.jettyPositions = null;
* The position of the root ( start ) node(s) relative to the rest of the
* laid out graph. Default is <mxConstants.DIRECTION_NORTH>.
*/
mxCoordinateAssignment.prototype.orientation = mxConstants.DIRECTION_NORTH;
orientation = mxConstants.DIRECTION_NORTH;
/**
* Variable: initialX
*
* The minimum x position node placement starts at
*/
mxCoordinateAssignment.prototype.initialX = null;
initialX = null;
/**
* Variable: limitX
*
* The maximum x value this positioning lays up to
*/
mxCoordinateAssignment.prototype.limitX = null;
limitX = null;
/**
* Variable: currentXDelta
*
* The sum of x-displacements for the current iteration
*/
mxCoordinateAssignment.prototype.currentXDelta = null;
currentXDelta = null;
/**
* Variable: widestRank
*
* The rank that has the widest x position
*/
mxCoordinateAssignment.prototype.widestRank = null;
widestRank = null;
/**
* Variable: rankTopY
*
* Internal cache of top-most values of Y for each rank
*/
mxCoordinateAssignment.prototype.rankTopY = null;
rankTopY = null;
/**
* Variable: rankBottomY
*
* Internal cache of bottom-most value of Y for each rank
*/
mxCoordinateAssignment.prototype.rankBottomY = null;
rankBottomY = null;
/**
* Variable: widestRankValue
*
* The X-coordinate of the edge of the widest rank
*/
mxCoordinateAssignment.prototype.widestRankValue = null;
widestRankValue = null;
/**
* Variable: rankWidths
*
* The width of all the ranks
*/
mxCoordinateAssignment.prototype.rankWidths = null;
rankWidths = null;
/**
* Variable: rankY
*
* The Y-coordinate of all the ranks
*/
mxCoordinateAssignment.prototype.rankY = null;
rankY = null;
/**
* Variable: fineTuning
@ -192,33 +192,33 @@ mxCoordinateAssignment.prototype.rankY = null;
* Whether or not to perform local optimisations and iterate multiple times
* through the algorithm. Default is true.
*/
mxCoordinateAssignment.prototype.fineTuning = true;
fineTuning = true;
/**
* Variable: nextLayerConnectedCache
*
* A store of connections to the layer above for speed
*/
mxCoordinateAssignment.prototype.nextLayerConnectedCache = null;
nextLayerConnectedCache = null;
/**
* Variable: previousLayerConnectedCache
*
* A store of connections to the layer below for speed
*/
mxCoordinateAssignment.prototype.previousLayerConnectedCache = null;
previousLayerConnectedCache = null;
/**
* Variable: groupPadding
*
* Padding added to resized parents Default is 10.
*/
mxCoordinateAssignment.prototype.groupPadding = 10;
groupPadding = 10;
/**
* Utility method to display current positions
*/
mxCoordinateAssignment.prototype.printStatus = function()
printStatus = ()=>
{
var model = this.layout.getModel();
mxLog.show();
@ -247,7 +247,7 @@ mxCoordinateAssignment.prototype.printStatus = function()
*
* A basic horizontal coordinate assignment algorithm
*/
mxCoordinateAssignment.prototype.execute = function(parent)
execute = (parent)=>
{
this.jettyPositions = Object();
var model = this.layout.getModel();
@ -324,7 +324,7 @@ mxCoordinateAssignment.prototype.execute = function(parent)
*
* Performs one median positioning sweep in both directions
*/
mxCoordinateAssignment.prototype.minNode = function(model)
minNode = (model)=>
{
// Queue all nodes
var nodeList = [];
@ -504,7 +504,7 @@ mxCoordinateAssignment.prototype.minNode = function(model)
* i - the iteration of the whole process
* model - an internal model of the hierarchical layout
*/
mxCoordinateAssignment.prototype.medianPos = function(i, model)
medianPos = (i, model)=>
{
// Reverse sweep direction each time through this method
var downwardSweep = (i % 2 == 0);
@ -537,7 +537,7 @@ mxCoordinateAssignment.prototype.medianPos = function(i, model)
* nextRankValue - the layer number whose connected cels are to be laid out
* relative to
*/
mxCoordinateAssignment.prototype.rankMedianPosition = function(rankValue, model, nextRankValue)
rankMedianPosition = (rankValue, model, nextRankValue)=>
{
var rank = model.ranks[rankValue];
@ -573,7 +573,7 @@ mxCoordinateAssignment.prototype.rankMedianPosition = function(rankValue, model,
currentCell, nextLayerConnectedCells);
}
weightedValues.sort(WeightedCellSorter.prototype.compare);
weightedValues.sort(compare);
// Set the new position of each node within the rank using
// its temp variable
@ -712,7 +712,7 @@ mxCoordinateAssignment.prototype.rankMedianPosition = function(rankValue, model,
* currentCell - the cell whose weight is to be calculated
* collection - the cells the specified cell is connected to
*/
mxCoordinateAssignment.prototype.calculatedWeightedValue = function(currentCell, collection)
calculatedWeightedValue = (currentCell, collection)=>
{
var totalWeight = 0;
@ -748,7 +748,7 @@ mxCoordinateAssignment.prototype.calculatedWeightedValue = function(currentCell,
* connectedCells - the cells the candidate connects to on this level
* rankValue - the layer number of this rank
*/
mxCoordinateAssignment.prototype.medianXValue = function(connectedCells, rankValue)
medianXValue = (connectedCells, rankValue)=>
{
if (connectedCells.length == 0)
{
@ -762,7 +762,7 @@ mxCoordinateAssignment.prototype.medianXValue = function(connectedCells, rankVal
medianValues[i] = connectedCells[i].getGeneralPurposeVariable(rankValue);
}
medianValues.sort(function(a,b){return a - b;});
medianValues.sort((a,b)=>{return a - b;});
if (connectedCells.length % 2 == 1)
{
@ -791,7 +791,7 @@ mxCoordinateAssignment.prototype.medianXValue = function(connectedCells, rankVal
* facade - the facade describing the input graph
* model - an internal model of the hierarchical layout
*/
mxCoordinateAssignment.prototype.initialCoords = function(facade, model)
initialCoords = (facade, model)=>
{
this.calculateWidestRank(facade, model);
@ -827,7 +827,7 @@ mxCoordinateAssignment.prototype.initialCoords = function(facade, model)
* graph - the facade describing the input graph
* model - an internal model of the hierarchical layout
*/
mxCoordinateAssignment.prototype.rankCoordinates = function(rankValue, graph, model)
rankCoordinates = (rankValue, graph, model)=>
{
var rank = model.ranks[rankValue];
var maxY = 0.0;
@ -910,7 +910,7 @@ mxCoordinateAssignment.prototype.rankCoordinates = function(rankValue, graph, mo
* graph - the facade describing the input graph
* model - an internal model of the hierarchical layout
*/
mxCoordinateAssignment.prototype.calculateWidestRank = function(graph, model)
calculateWidestRank = (graph, model)=>
{
// Starting y co-ordinate
var y = -this.interRankCellSpacing;
@ -1034,7 +1034,7 @@ mxCoordinateAssignment.prototype.calculateWidestRank = function(graph, model)
* graph - the facade describing the input graph
* model - an internal model of the hierarchical layout
*/
mxCoordinateAssignment.prototype.minPath = function(graph, model)
minPath = (graph, model)=>
{
// Work down and up each edge with at least 2 control points
// trying to straighten each one out. If the same number of
@ -1177,7 +1177,7 @@ mxCoordinateAssignment.prototype.minPath = function(graph, model)
* rank - the layer of the cell
* position - the x position being sought
*/
mxCoordinateAssignment.prototype.repositionValid = function(model, cell, rank, position)
repositionValid = (model, cell, rank, position)=>
{
var rankArray = model.ranks[rank];
var rankIndex = -1;
@ -1259,7 +1259,7 @@ mxCoordinateAssignment.prototype.repositionValid = function(model, cell, rank, p
* graph - the input graph
* model - the layout model
*/
mxCoordinateAssignment.prototype.setCellLocations = function(graph, model)
setCellLocations = (graph, model)=>
{
this.rankTopY = [];
this.rankBottomY = [];
@ -1307,7 +1307,7 @@ mxCoordinateAssignment.prototype.setCellLocations = function(graph, model)
*
* model - the layout model
*/
mxCoordinateAssignment.prototype.localEdgeProcessing = function(model)
localEdgeProcessing = (model)=>
{
// Iterate through each vertex, look at the edges connected in
// both directions.
@ -1342,7 +1342,7 @@ mxCoordinateAssignment.prototype.localEdgeProcessing = function(model)
sortedCells.push(sorter);
}
sortedCells.sort(WeightedCellSorter.prototype.compare);
sortedCells.sort(compare);
var leftLimit = cell.x[0] - cell.width / 2;
var rightLimit = leftLimit + cell.width;
@ -1459,7 +1459,7 @@ mxCoordinateAssignment.prototype.localEdgeProcessing = function(model)
*
* Fixes the control points
*/
mxCoordinateAssignment.prototype.setEdgePosition = function(cell)
setEdgePosition = (cell)=>
{
// For parallel edges we need to seperate out the points a
// little
@ -1704,7 +1704,7 @@ mxCoordinateAssignment.prototype.setEdgePosition = function(cell)
*
* cell - the vertex to position
*/
mxCoordinateAssignment.prototype.setVertexLocation = function(cell)
setVertexLocation = (cell)=>
{
var realCell = cell.cell;
var positionX = cell.x[0] - cell.width / 2;
@ -1737,7 +1737,7 @@ mxCoordinateAssignment.prototype.setVertexLocation = function(cell)
* edge - the hierarchical model edge
* realEdge - the real edge in the graph
*/
mxCoordinateAssignment.prototype.processReversedEdge = function(graph, model)
processReversedEdge = (graph, model)=>
{
// hook for subclassers
};

View File

@ -22,4 +22,4 @@ function mxHierarchicalLayoutStage() { };
* and creates the resulting laid out graph within that facade for further
* use.
*/
mxHierarchicalLayoutStage.prototype.execute = function(parent) { };
execute = (parent)=> { };

View File

@ -29,14 +29,14 @@ function mxMedianHybridCrossingReduction(layout)
* Extends mxMedianHybridCrossingReduction.
*/
mxMedianHybridCrossingReduction.prototype = new mxHierarchicalLayoutStage();
mxMedianHybridCrossingReduction.prototype.constructor = mxMedianHybridCrossingReduction;
constructor = mxMedianHybridCrossingReduction;
/**
* Variable: layout
*
* Reference to the enclosing <mxHierarchicalLayout>.
*/
mxMedianHybridCrossingReduction.prototype.layout = null;
layout = null;
/**
* Variable: maxIterations
@ -44,7 +44,7 @@ mxMedianHybridCrossingReduction.prototype.layout = null;
* The maximum number of iterations to perform whilst reducing edge
* crossings. Default is 24.
*/
mxMedianHybridCrossingReduction.prototype.maxIterations = 24;
maxIterations = 24;
/**
* Variable: nestedBestRanks
@ -52,28 +52,28 @@ mxMedianHybridCrossingReduction.prototype.maxIterations = 24;
* Stores each rank as a collection of cells in the best order found for
* each layer so far
*/
mxMedianHybridCrossingReduction.prototype.nestedBestRanks = null;
nestedBestRanks = null;
/**
* Variable: currentBestCrossings
*
* The total number of crossings found in the best configuration so far
*/
mxMedianHybridCrossingReduction.prototype.currentBestCrossings = 0;
currentBestCrossings = 0;
/**
* Variable: iterationsWithoutImprovement
*
* The total number of crossings found in the best configuration so far
*/
mxMedianHybridCrossingReduction.prototype.iterationsWithoutImprovement = 0;
iterationsWithoutImprovement = 0;
/**
* Variable: maxNoImprovementIterations
*
* The total number of crossings found in the best configuration so far
*/
mxMedianHybridCrossingReduction.prototype.maxNoImprovementIterations = 2;
maxNoImprovementIterations = 2;
/**
* Function: execute
@ -81,7 +81,7 @@ mxMedianHybridCrossingReduction.prototype.maxNoImprovementIterations = 2;
* Performs a vertex ordering within ranks as described by Gansner et al
* 1993
*/
mxMedianHybridCrossingReduction.prototype.execute = function(parent)
execute = (parent)=>
{
var model = this.layout.getModel();
@ -179,7 +179,7 @@ mxMedianHybridCrossingReduction.prototype.execute = function(parent)
*
* model - the internal model describing the hierarchy
*/
mxMedianHybridCrossingReduction.prototype.calculateCrossings = function(model)
calculateCrossings = (model)=>
{
var numRanks = model.ranks.length;
var totalCrossings = 0;
@ -204,7 +204,7 @@ mxMedianHybridCrossingReduction.prototype.calculateCrossings = function(model)
* i - the topmost rank of the pair ( higher rank value )
* model - the internal model describing the hierarchy
*/
mxMedianHybridCrossingReduction.prototype.calculateRankCrossing = function(i, model)
calculateRankCrossing = (i, model)=>
{
var totalCrossings = 0;
var rank = model.ranks[i];
@ -227,7 +227,7 @@ mxMedianHybridCrossingReduction.prototype.calculateRankCrossing = function(i, mo
nodeIndices.push(otherCellRankPosition);
}
nodeIndices.sort(function(x, y) { return x - y; });
nodeIndices.sort((x, y)=> { return x - y; });
tmpIndices[rankPosition] = nodeIndices;
}
@ -287,7 +287,7 @@ mxMedianHybridCrossingReduction.prototype.calculateRankCrossing = function(i, mo
* mainLoopIteration - the iteration number of the main loop
* model - the internal model describing the hierarchy
*/
mxMedianHybridCrossingReduction.prototype.transpose = function(mainLoopIteration, model)
transpose = (mainLoopIteration, model)=>
{
var improved = true;
@ -467,7 +467,7 @@ mxMedianHybridCrossingReduction.prototype.transpose = function(mainLoopIteration
* iteration - the iteration number of the main loop
* model - the internal model describing the hierarchy
*/
mxMedianHybridCrossingReduction.prototype.weightedMedian = function(iteration, model)
weightedMedian = (iteration, model)=>
{
// Reverse sweep direction each time through this method
var downwardSweep = (iteration % 2 == 0);
@ -498,7 +498,7 @@ mxMedianHybridCrossingReduction.prototype.weightedMedian = function(iteration, m
* rankValue - the layer number of this rank
* downwardSweep - whether or not this is a downward sweep through the graph
*/
mxMedianHybridCrossingReduction.prototype.medianRank = function(rankValue, downwardSweep)
medianRank = (rankValue, downwardSweep)=>
{
var numCellsForRank = this.nestedBestRanks[rankValue].length;
var medianValues = [];
@ -553,7 +553,7 @@ mxMedianHybridCrossingReduction.prototype.medianRank = function(rankValue, downw
}
}
medianValues.sort(MedianCellSorter.prototype.compare);
medianValues.sort(compare);
// Set the new position of each node within the rank using
// its temp variable
@ -580,7 +580,7 @@ mxMedianHybridCrossingReduction.prototype.medianRank = function(rankValue, downw
* specified cell
* rankValue - the rank that the connected cell lie upon
*/
mxMedianHybridCrossingReduction.prototype.medianValue = function(connectedCells, rankValue)
medianValue = (connectedCells, rankValue)=>
{
var medianValues = [];
var arrayCount = 0;
@ -593,7 +593,7 @@ mxMedianHybridCrossingReduction.prototype.medianValue = function(connectedCells,
// Sort() sorts lexicographically by default (i.e. 11 before 9) so force
// numerical order sort
medianValues.sort(function(a,b){return a - b;});
medianValues.sort((a,b)=>{return a - b;});
if (arrayCount % 2 == 1)
{
@ -637,21 +637,21 @@ function MedianCellSorter()
*
* The weighted value of the cell stored.
*/
MedianCellSorter.prototype.medianValue = 0;
medianValue = 0;
/**
* Variable: cell
*
* The cell whose median value is being calculated
*/
MedianCellSorter.prototype.cell = false;
cell = false;
/**
* Function: compare
*
* Compares two MedianCellSorters.
*/
MedianCellSorter.prototype.compare = function(a, b)
compare = (a, b)=>
{
if (a != null && b != null)
{

View File

@ -21,14 +21,14 @@ function mxMinimumCycleRemover(layout)
* Extends mxHierarchicalLayoutStage.
*/
mxMinimumCycleRemover.prototype = new mxHierarchicalLayoutStage();
mxMinimumCycleRemover.prototype.constructor = mxMinimumCycleRemover;
constructor = mxMinimumCycleRemover;
/**
* Variable: layout
*
* Reference to the enclosing <mxHierarchicalLayout>.
*/
mxMinimumCycleRemover.prototype.layout = null;
layout = null;
/**
* Function: execute
@ -37,7 +37,7 @@ mxMinimumCycleRemover.prototype.layout = null;
* and creates the resulting laid out graph within that facade for further
* use.
*/
mxMinimumCycleRemover.prototype.execute = function(parent)
execute = (parent)=>
{
var model = this.layout.getModel();
var seenNodes = new Object();
@ -64,7 +64,7 @@ mxMinimumCycleRemover.prototype.execute = function(parent)
}
}
model.visit(function(parent, node, connectingEdge, layer, seen)
model.visit((parent, node, connectingEdge, layer, seen)=>
{
// Check if the cell is in it's own ancestor list, if so
// invert the connecting edge and reverse the target/source
@ -88,7 +88,7 @@ mxMinimumCycleRemover.prototype.execute = function(parent)
var seenNodesCopy = mxUtils.clone(seenNodes, null, true);
// Pick a random cell and dfs from it
model.visit(function(parent, node, connectingEdge, layer, seen)
model.visit((parent, node, connectingEdge, layer, seen)=>
{
// Check if the cell is in it's own ancestor list, if so
// invert the connecting edge and reverse the target/source

View File

@ -21,14 +21,14 @@ function mxSwimlaneOrdering(layout)
* Extends mxHierarchicalLayoutStage.
*/
mxSwimlaneOrdering.prototype = new mxHierarchicalLayoutStage();
mxSwimlaneOrdering.prototype.constructor = mxSwimlaneOrdering;
constructor = mxSwimlaneOrdering;
/**
* Variable: layout
*
* Reference to the enclosing <mxHierarchicalLayout>.
*/
mxSwimlaneOrdering.prototype.layout = null;
layout = null;
/**
* Function: execute
@ -37,7 +37,7 @@ mxSwimlaneOrdering.prototype.layout = null;
* and creates the resulting laid out graph within that facade for further
* use.
*/
mxSwimlaneOrdering.prototype.execute = function(parent)
execute = (parent)=>
{
var model = this.layout.getModel();
var seenNodes = new Object();
@ -58,7 +58,7 @@ mxSwimlaneOrdering.prototype.execute = function(parent)
}
}
model.visit(function(parent, node, connectingEdge, layer, seen)
model.visit((parent, node, connectingEdge, layer, seen)=>
{
// Check if the cell is in it's own ancestor list, if so
// invert the connecting edge and reverse the target/source

View File

@ -2,202 +2,179 @@
* Copyright (c) 2006-2015, JGraph Ltd
* Copyright (c) 2006-2015, Gaudenz Alder
*/
/**
* Class: mxCircleLayout
*
* Extends <mxGraphLayout> to implement a circluar layout for a given radius.
* The vertices do not need to be connected for this layout to work and all
* connections between vertices are not taken into account.
*
* Example:
*
* (code)
* var layout = new mxCircleLayout(graph);
* layout.execute(graph.getDefaultParent());
* (end)
*
* Constructor: mxCircleLayout
*
* Constructs a new circular layout for the specified radius.
*
* Arguments:
*
* graph - <mxGraph> that contains the cells.
* radius - Optional radius as an int. Default is 100.
*/
function mxCircleLayout(graph, radius)
{
mxGraphLayout.call(this, graph);
this.radius = (radius != null) ? radius : 100;
};
/**
* Extends mxGraphLayout.
*/
mxCircleLayout.prototype = new mxGraphLayout();
mxCircleLayout.prototype.constructor = mxCircleLayout;
class mxCircleLayout extends mxGraphLayout {
/**
* Variable: radius
*
* Integer specifying the size of the radius. Default is 100.
*/
radius = null;
/**
* Variable: radius
*
* Integer specifying the size of the radius. Default is 100.
*/
mxCircleLayout.prototype.radius = null;
/**
* Variable: moveCircle
*
* Boolean specifying if the circle should be moved to the top,
* left corner specified by <x0> and <y0>. Default is false.
*/
moveCircle = false;
/**
* Variable: moveCircle
*
* Boolean specifying if the circle should be moved to the top,
* left corner specified by <x0> and <y0>. Default is false.
*/
mxCircleLayout.prototype.moveCircle = false;
/**
* Variable: x0
*
* Integer specifying the left coordinate of the circle.
* Default is 0.
*/
x0 = 0;
/**
* Variable: x0
*
* Integer specifying the left coordinate of the circle.
* Default is 0.
*/
mxCircleLayout.prototype.x0 = 0;
/**
* Variable: y0
*
* Integer specifying the top coordinate of the circle.
* Default is 0.
*/
y0 = 0;
/**
* Variable: y0
*
* Integer specifying the top coordinate of the circle.
* Default is 0.
*/
mxCircleLayout.prototype.y0 = 0;
/**
* Variable: resetEdges
*
* Specifies if all edge points of traversed edges should be removed.
* Default is true.
*/
resetEdges = true;
/**
* Variable: resetEdges
*
* Specifies if all edge points of traversed edges should be removed.
* Default is true.
*/
mxCircleLayout.prototype.resetEdges = true;
/**
* Variable: disableEdgeStyle
*
* Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are
* modified by the result. Default is true.
*/
disableEdgeStyle = true;
/**
* Variable: disableEdgeStyle
*
* Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are
* modified by the result. Default is true.
*/
mxCircleLayout.prototype.disableEdgeStyle = true;
/**
* Class: mxCircleLayout
*
* Extends <mxGraphLayout> to implement a circular layout for a given radius.
* The vertices do not need to be connected for this layout to work and all
* connections between vertices are not taken into account.
*
* Example:
*
* (code)
* let layout = new mxCircleLayout(graph);
* layout.execute(graph.getDefaultParent());
* (end)
*
* Constructor: mxCircleLayout
*
* Constructs a new circular layout for the specified radius.
*
* Arguments:
*
* graph - <mxGraph> that contains the cells.
* radius - Optional radius as an int. Default is 100.
*/
constructor(graph, radius) {
super(graph);
//mxGraphLayout.call(this, graph);
this.radius = (radius != null) ? radius : 100;
}
/**
* Function: execute
*
* Implements <mxGraphLayout.execute>.
*/
mxCircleLayout.prototype.execute = function(parent)
{
var model = this.graph.getModel();
/**
* Function: execute
*
* Implements <mxGraphLayout.execute>.
*/
execute = (parent) => {
let model = this.graph.getModel();
// Moves the vertices to build a circle. Makes sure the
// radius is large enough for the vertices to not
// overlap
model.beginUpdate();
try
{
// Gets all vertices inside the parent and finds
// the maximum dimension of the largest vertex
var max = 0;
var top = null;
var left = null;
var vertices = [];
var childCount = model.getChildCount(parent);
for (var i = 0; i < childCount; i++)
{
var cell = model.getChildAt(parent, i);
if (!this.isVertexIgnored(cell))
{
vertices.push(cell);
var bounds = this.getVertexBounds(cell);
if (top == null)
{
top = bounds.y;
// Moves the vertices to build a circle. Makes sure the
// radius is large enough for the vertices to not
// overlap
model.beginUpdate();
try {
// Gets all vertices inside the parent and finds
// the maximum dimension of the largest vertex
let max = 0;
let top = null;
let left = null;
let vertices = [];
let childCount = model.getChildCount(parent);
for (let i = 0; i < childCount; i++) {
let cell = model.getChildAt(parent, i);
if (!this.isVertexIgnored(cell)) {
vertices.push(cell);
let bounds = this.getVertexBounds(cell);
if (top == null) {
top = bounds.y;
} else {
top = Math.min(top, bounds.y);
}
if (left == null) {
left = bounds.x;
} else {
left = Math.min(left, bounds.x);
}
max = Math.max(max, Math.max(bounds.width, bounds.height));
} else if (!this.isEdgeIgnored(cell)) {
// Resets the points on the traversed edge
if (this.resetEdges) {
this.graph.resetEdge(cell);
}
if (this.disableEdgeStyle) {
this.setEdgeStyleEnabled(cell, false);
}
}
else
{
top = Math.min(top, bounds.y);
}
if (left == null)
{
left = bounds.x;
}
else
{
left = Math.min(left, bounds.x);
}
max = Math.max(max, Math.max(bounds.width, bounds.height));
}
else if (!this.isEdgeIgnored(cell))
{
// Resets the points on the traversed edge
if (this.resetEdges)
{
this.graph.resetEdge(cell);
}
if (this.disableEdgeStyle)
{
this.setEdgeStyleEnabled(cell, false);
}
let r = this.getRadius(vertices.length, max);
if (this.moveCircle) {
// Moves the circle to the specified origin
left = this.x0;
top = this.y0;
}
this.circle(vertices, r, left, top);
} finally {
model.endUpdate();
}
};
/**
* Function: getRadius
*
* Returns the radius to be used for the given vertex count. Max is the maximum
* width or height of all vertices in the layout.
*/
getRadius = (count, max) => {
return Math.max(count * max / Math.PI, this.radius);
};
/**
* Function: circle
*
* Executes the circular layout for the specified array
* of vertices and the given radius. This is called from
* <execute>.
*/
circle = (vertices, r, left, top) => {
let vertexCount = vertices.length;
let phi = 2 * Math.PI / vertexCount;
for (let i = 0; i < vertexCount; i++) {
if (this.isVertexMovable(vertices[i])) {
this.setVertexLocation(vertices[i],
Math.round(left + r + r * Math.sin(i * phi)),
Math.round(top + r + r * Math.cos(i * phi)));
}
}
var r = this.getRadius(vertices.length, max);
};
}
// Moves the circle to the specified origin
if (this.moveCircle)
{
left = this.x0;
top = this.y0;
}
this.circle(vertices, r, left, top);
}
finally
{
model.endUpdate();
}
};
/**
* Function: getRadius
*
* Returns the radius to be used for the given vertex count. Max is the maximum
* width or height of all vertices in the layout.
*/
mxCircleLayout.prototype.getRadius = function(count, max)
{
return Math.max(count * max / Math.PI, this.radius);
};
/**
* Function: circle
*
* Executes the circular layout for the specified array
* of vertices and the given radius. This is called from
* <execute>.
*/
mxCircleLayout.prototype.circle = function(vertices, r, left, top)
{
var vertexCount = vertices.length;
var phi = 2 * Math.PI / vertexCount;
for (var i = 0; i < vertexCount; i++)
{
if (this.isVertexMovable(vertices[i]))
{
this.setVertexLocation(vertices[i],
Math.round(left + r + r * Math.sin(i * phi)),
Math.round(top + r + r * Math.cos(i * phi)));
}
}
};
export default mxCircleLayout;

View File

@ -32,21 +32,21 @@ function mxCompactTreeLayout(graph, horizontal, invert)
* Extends mxGraphLayout.
*/
mxCompactTreeLayout.prototype = new mxGraphLayout();
mxCompactTreeLayout.prototype.constructor = mxCompactTreeLayout;
constructor = mxCompactTreeLayout;
/**
* Variable: horizontal
*
* Specifies the orientation of the layout. Default is true.
*/
mxCompactTreeLayout.prototype.horizontal = null;
horizontal = null;
/**
* Variable: invert
*
* Specifies if edge directions should be inverted. Default is false.
*/
mxCompactTreeLayout.prototype.invert = null;
invert = null;
/**
* Variable: resizeParent
@ -54,7 +54,7 @@ mxCompactTreeLayout.prototype.invert = null;
* If the parents should be resized to match the width/height of the
* children. Default is true.
*/
mxCompactTreeLayout.prototype.resizeParent = true;
resizeParent = true;
/**
* Variable: maintainParentLocation
@ -63,42 +63,42 @@ mxCompactTreeLayout.prototype.resizeParent = true;
* top, left corner stays the same before and after execution of
* the layout. Default is false for backwards compatibility.
*/
mxCompactTreeLayout.prototype.maintainParentLocation = false;
maintainParentLocation = false;
/**
* Variable: groupPadding
*
* Padding added to resized parents. Default is 10.
*/
mxCompactTreeLayout.prototype.groupPadding = 10;
groupPadding = 10;
/**
* Variable: groupPaddingTop
*
* Top padding added to resized parents. Default is 0.
*/
mxCompactTreeLayout.prototype.groupPaddingTop = 0;
groupPaddingTop = 0;
/**
* Variable: groupPaddingRight
*
* Right padding added to resized parents. Default is 0.
*/
mxCompactTreeLayout.prototype.groupPaddingRight = 0;
groupPaddingRight = 0;
/**
* Variable: groupPaddingBottom
*
* Bottom padding added to resized parents. Default is 0.
*/
mxCompactTreeLayout.prototype.groupPaddingBottom = 0;
groupPaddingBottom = 0;
/**
* Variable: groupPaddingLeft
*
* Left padding added to resized parents. Default is 0.
*/
mxCompactTreeLayout.prototype.groupPaddingLeft = 0;
groupPaddingLeft = 0;
/**
* Variable: parentsChanged
@ -106,7 +106,7 @@ mxCompactTreeLayout.prototype.groupPaddingLeft = 0;
* A set of the parents that need updating based on children
* process as part of the layout.
*/
mxCompactTreeLayout.prototype.parentsChanged = null;
parentsChanged = null;
/**
* Variable: moveTree
@ -114,7 +114,7 @@ mxCompactTreeLayout.prototype.parentsChanged = null;
* Specifies if the tree should be moved to the top, left corner
* if it is inside a top-level layer. Default is false.
*/
mxCompactTreeLayout.prototype.moveTree = false;
moveTree = false;
/**
* Variable: visited
@ -122,21 +122,21 @@ mxCompactTreeLayout.prototype.moveTree = false;
* Specifies if the tree should be moved to the top, left corner
* if it is inside a top-level layer. Default is false.
*/
mxCompactTreeLayout.prototype.visited = null;
visited = null;
/**
* Variable: levelDistance
*
* Holds the levelDistance. Default is 10.
*/
mxCompactTreeLayout.prototype.levelDistance = 10;
levelDistance = 10;
/**
* Variable: nodeDistance
*
* Holds the nodeDistance. Default is 20.
*/
mxCompactTreeLayout.prototype.nodeDistance = 20;
nodeDistance = 20;
/**
* Variable: resetEdges
@ -144,28 +144,28 @@ mxCompactTreeLayout.prototype.nodeDistance = 20;
* Specifies if all edge points of traversed edges should be removed.
* Default is true.
*/
mxCompactTreeLayout.prototype.resetEdges = true;
resetEdges = true;
/**
* Variable: prefHozEdgeSep
*
* The preferred horizontal distance between edges exiting a vertex.
*/
mxCompactTreeLayout.prototype.prefHozEdgeSep = 5;
prefHozEdgeSep = 5;
/**
* Variable: prefVertEdgeOff
*
* The preferred vertical offset between edges exiting a vertex.
*/
mxCompactTreeLayout.prototype.prefVertEdgeOff = 4;
prefVertEdgeOff = 4;
/**
* Variable: minEdgeJetty
*
* The minimum distance for an edge jetty from a vertex.
*/
mxCompactTreeLayout.prototype.minEdgeJetty = 8;
minEdgeJetty = 8;
/**
* Variable: channelBuffer
@ -173,14 +173,14 @@ mxCompactTreeLayout.prototype.minEdgeJetty = 8;
* The size of the vertical buffer in the center of inter-rank channels
* where edge control points should not be placed.
*/
mxCompactTreeLayout.prototype.channelBuffer = 4;
channelBuffer = 4;
/**
* Variable: edgeRouting
*
* Whether or not to apply the internal tree edge routing.
*/
mxCompactTreeLayout.prototype.edgeRouting = true;
edgeRouting = true;
/**
* Variable: sortEdges
@ -188,7 +188,7 @@ mxCompactTreeLayout.prototype.edgeRouting = true;
* Specifies if edges should be sorted according to the order of their
* opposite terminal cell in the model.
*/
mxCompactTreeLayout.prototype.sortEdges = false;
sortEdges = false;
/**
* Variable: alignRanks
@ -196,7 +196,7 @@ mxCompactTreeLayout.prototype.sortEdges = false;
* Whether or not the tops of cells in each rank should be aligned
* across the rank
*/
mxCompactTreeLayout.prototype.alignRanks = false;
alignRanks = false;
/**
* Variable: maxRankHeight
@ -204,14 +204,14 @@ mxCompactTreeLayout.prototype.alignRanks = false;
* An array of the maximum height of cells (relative to the layout direction)
* per rank
*/
mxCompactTreeLayout.prototype.maxRankHeight = null;
maxRankHeight = null;
/**
* Variable: root
*
* The cell to use as the root of the tree
*/
mxCompactTreeLayout.prototype.root = null;
root = null;
/**
* Variable: node
@ -219,7 +219,7 @@ mxCompactTreeLayout.prototype.root = null;
* The internal node representation of the root cell. Do not set directly
* , this value is only exposed to assist with post-processing functionality
*/
mxCompactTreeLayout.prototype.node = null;
node = null;
/**
* Function: isVertexIgnored
@ -231,9 +231,9 @@ mxCompactTreeLayout.prototype.node = null;
*
* vertex - <mxCell> whose ignored state should be returned.
*/
mxCompactTreeLayout.prototype.isVertexIgnored = function(vertex)
isVertexIgnored = (vertex)=>
{
return mxGraphLayout.prototype.isVertexIgnored.apply(this, arguments) ||
return isVertexIgnored.apply(this, arguments) ||
this.graph.getConnections(vertex).length == 0;
};
@ -242,7 +242,7 @@ mxCompactTreeLayout.prototype.isVertexIgnored = function(vertex)
*
* Returns <horizontal>.
*/
mxCompactTreeLayout.prototype.isHorizontal = function()
isHorizontal = ()=>
{
return this.horizontal;
};
@ -262,7 +262,7 @@ mxCompactTreeLayout.prototype.isHorizontal = function()
* root - Optional <mxCell> that will be used as the root of the tree.
* Overrides <root> if specified.
*/
mxCompactTreeLayout.prototype.execute = function(parent, root)
execute = (parent, root)=>
{
this.parent = parent;
var model = this.graph.getModel();
@ -429,7 +429,7 @@ mxCompactTreeLayout.prototype.execute = function(parent, root)
*
* Moves the specified node and all of its children by the given amount.
*/
mxCompactTreeLayout.prototype.moveNode = function(node, dx, dy)
moveNode = (node, dx, dy)=>
{
node.x += dx;
node.y += dy;
@ -450,11 +450,11 @@ mxCompactTreeLayout.prototype.moveNode = function(node, dx, dy)
*
* Called if <sortEdges> is true to sort the array of outgoing edges in place.
*/
mxCompactTreeLayout.prototype.sortOutgoingEdges = function(source, edges)
sortOutgoingEdges = (source, edges)=>
{
var lookup = new mxDictionary();
edges.sort(function(e1, e2)
edges.sort((e1, e2)=>
{
var end1 = e1.getTerminal(e1.getTerminal(false) == source);
var p1 = lookup.get(end1);
@ -484,7 +484,7 @@ mxCompactTreeLayout.prototype.sortOutgoingEdges = function(source, edges)
* Stores the maximum height (relative to the layout
* direction) of cells in each rank
*/
mxCompactTreeLayout.prototype.findRankHeights = function(node, rank)
findRankHeights = (node, rank)=>
{
if (this.maxRankHeight[rank] == null || this.maxRankHeight[rank] < node.height)
{
@ -506,7 +506,7 @@ mxCompactTreeLayout.prototype.findRankHeights = function(node, rank)
* Set the cells heights (relative to the layout
* direction) when the tops of each rank are to be aligned
*/
mxCompactTreeLayout.prototype.setCellHeights = function(node, rank)
setCellHeights = (node, rank)=>
{
if (this.maxRankHeight[rank] != null && this.maxRankHeight[rank] > node.height)
{
@ -529,7 +529,7 @@ mxCompactTreeLayout.prototype.setCellHeights = function(node, rank)
* Makes sure the specified parent is never left by the
* algorithm.
*/
mxCompactTreeLayout.prototype.dfs = function(cell, parent)
dfs = (cell, parent)=>
{
var id = mxCellPath.create(cell);
var node = null;
@ -598,7 +598,7 @@ mxCompactTreeLayout.prototype.dfs = function(cell, parent)
* Starts the actual compact tree layout algorithm
* at the given node.
*/
mxCompactTreeLayout.prototype.layout = function(node)
layout = (node)=>
{
if (node != null)
{
@ -624,7 +624,7 @@ mxCompactTreeLayout.prototype.layout = function(node)
/**
* Function: horizontalLayout
*/
mxCompactTreeLayout.prototype.horizontalLayout = function(node, x0, y0, bounds)
horizontalLayout = (node, x0, y0, bounds)=>
{
node.x += x0 + node.offsetX;
node.y += y0 + node.offsetY;
@ -651,7 +651,7 @@ mxCompactTreeLayout.prototype.horizontalLayout = function(node, x0, y0, bounds)
/**
* Function: verticalLayout
*/
mxCompactTreeLayout.prototype.verticalLayout = function(node, parent, x0, y0, bounds)
verticalLayout = (node, parent, x0, y0, bounds)=>
{
node.x += x0 + node.offsetY;
node.y += y0 + node.offsetX;
@ -678,7 +678,7 @@ mxCompactTreeLayout.prototype.verticalLayout = function(node, parent, x0, y0, bo
/**
* Function: attachParent
*/
mxCompactTreeLayout.prototype.attachParent = function(node, height)
attachParent = (node, height)=>
{
var x = this.nodeDistance + this.levelDistance;
var y2 = (height - node.width) / 2 - this.nodeDistance;
@ -696,7 +696,7 @@ mxCompactTreeLayout.prototype.attachParent = function(node, height)
/**
* Function: layoutLeaf
*/
mxCompactTreeLayout.prototype.layoutLeaf = function(node)
layoutLeaf = (node)=>
{
var dist = 2 * this.nodeDistance;
@ -712,7 +712,7 @@ mxCompactTreeLayout.prototype.layoutLeaf = function(node)
/**
* Function: join
*/
mxCompactTreeLayout.prototype.join = function(node)
join = (node)=>
{
var dist = 2 * this.nodeDistance;
@ -738,7 +738,7 @@ mxCompactTreeLayout.prototype.join = function(node)
/**
* Function: merge
*/
mxCompactTreeLayout.prototype.merge = function(p1, p2)
merge = (p1, p2)=>
{
var x = 0;
var y = 0;
@ -792,7 +792,7 @@ mxCompactTreeLayout.prototype.merge = function(p1, p2)
/**
* Function: offset
*/
mxCompactTreeLayout.prototype.offset = function(p1, p2, a1, a2, b1, b2)
offset = (p1, p2, a1, a2, b1, b2)=>
{
var d = 0;
@ -848,7 +848,7 @@ mxCompactTreeLayout.prototype.offset = function(p1, p2, a1, a2, b1, b2)
/**
* Function: bridge
*/
mxCompactTreeLayout.prototype.bridge = function(line1, x1, y1, line2, x2, y2)
bridge = (line1, x1, y1, line2, x2, y2)=>
{
var dx = x2 + line2.dx - x1;
var dy = 0;
@ -873,7 +873,7 @@ mxCompactTreeLayout.prototype.bridge = function(line1, x1, y1, line2, x2, y2)
/**
* Function: createNode
*/
mxCompactTreeLayout.prototype.createNode = function(cell)
createNode = (cell)=>
{
var node = new Object();
node.cell = cell;
@ -908,7 +908,7 @@ mxCompactTreeLayout.prototype.createNode = function(cell)
/**
* Function: apply
*/
mxCompactTreeLayout.prototype.apply = function(node, bounds)
apply = (node, bounds)=>
{
var model = this.graph.getModel();
var cell = node.cell;
@ -952,7 +952,7 @@ mxCompactTreeLayout.prototype.apply = function(node, bounds)
/**
* Function: createLine
*/
mxCompactTreeLayout.prototype.createLine = function(dx, dy, next)
createLine = (dx, dy, next)=>
{
var line = new Object();
line.dx = dx;
@ -969,7 +969,7 @@ mxCompactTreeLayout.prototype.createLine = function(dx, dy, next)
* implementation adjusts the group to just fit around the children with
* a padding.
*/
mxCompactTreeLayout.prototype.adjustParents = function()
adjustParents = ()=>
{
var tmp = [];
@ -987,7 +987,7 @@ mxCompactTreeLayout.prototype.adjustParents = function()
*
* Moves the specified node and all of its children by the given amount.
*/
mxCompactTreeLayout.prototype.localEdgeProcessing = function(node)
localEdgeProcessing = (node)=>
{
this.processNodeOutgoing(node);
var child = node.child;
@ -1004,7 +1004,7 @@ mxCompactTreeLayout.prototype.localEdgeProcessing = function(node)
*
* Separates the x position of edges as they connect to vertices
*/
mxCompactTreeLayout.prototype.processNodeOutgoing = function(node)
processNodeOutgoing = (node)=>
{
var child = node.child;
var parentCell = node.cell;
@ -1027,7 +1027,7 @@ mxCompactTreeLayout.prototype.processNodeOutgoing = function(node)
child = child.next;
}
sortedCells.sort(WeightedCellSorter.prototype.compare);
sortedCells.sort(compare);
var availableWidth = node.width;

View File

@ -41,14 +41,14 @@ function mxCompositeLayout(graph, layouts, master)
* Extends mxGraphLayout.
*/
mxCompositeLayout.prototype = new mxGraphLayout();
mxCompositeLayout.prototype.constructor = mxCompositeLayout;
constructor = mxCompositeLayout;
/**
* Variable: layouts
*
* Holds the array of <mxGraphLayouts> that this layout contains.
*/
mxCompositeLayout.prototype.layouts = null;
layouts = null;
/**
* Variable: master
@ -56,7 +56,7 @@ mxCompositeLayout.prototype.layouts = null;
* Reference to the <mxGraphLayouts> that handles moves. If this is null
* then the first layout in <layouts> is used.
*/
mxCompositeLayout.prototype.master = null;
master = null;
/**
* Function: moveCell
@ -64,7 +64,7 @@ mxCompositeLayout.prototype.master = null;
* Implements <mxGraphLayout.moveCell> by calling move on <master> or the first
* layout in <layouts>.
*/
mxCompositeLayout.prototype.moveCell = function(cell, x, y)
moveCell = (cell, x, y)=>
{
if (this.master != null)
{
@ -82,7 +82,7 @@ mxCompositeLayout.prototype.moveCell = function(cell, x, y)
* Implements <mxGraphLayout.execute> by executing all <layouts> in a
* single transaction.
*/
mxCompositeLayout.prototype.execute = function(parent)
execute = (parent)=>
{
var model = this.graph.getModel();

View File

@ -34,14 +34,14 @@ function mxEdgeLabelLayout(graph, radius)
* Extends mxGraphLayout.
*/
mxEdgeLabelLayout.prototype = new mxGraphLayout();
mxEdgeLabelLayout.prototype.constructor = mxEdgeLabelLayout;
constructor = mxEdgeLabelLayout;
/**
* Function: execute
*
* Implements <mxGraphLayout.execute>.
*/
mxEdgeLabelLayout.prototype.execute = function(parent)
execute = (parent)=>
{
var view = this.graph.view;
var model = this.graph.getModel();
@ -77,7 +77,7 @@ mxEdgeLabelLayout.prototype.execute = function(parent)
*
* Places the labels of the given edges.
*/
mxEdgeLabelLayout.prototype.placeLabels = function(v, e)
placeLabels = (v, e)=>
{
var model = this.graph.getModel();
@ -117,7 +117,7 @@ mxEdgeLabelLayout.prototype.placeLabels = function(v, e)
*
* Places the labels of the given edges.
*/
mxEdgeLabelLayout.prototype.avoid = function(edge, vertex)
avoid = (edge, vertex)=>
{
var model = this.graph.getModel();
var labRect = edge.text.boundingBox;

View File

@ -29,7 +29,7 @@ function mxFastOrganicLayout(graph)
* Extends mxGraphLayout.
*/
mxFastOrganicLayout.prototype = new mxGraphLayout();
mxFastOrganicLayout.prototype.constructor = mxFastOrganicLayout;
constructor = mxFastOrganicLayout;
/**
* Variable: useInputOrigin
@ -37,7 +37,7 @@ mxFastOrganicLayout.prototype.constructor = mxFastOrganicLayout;
* Specifies if the top left corner of the input cells should be the origin
* of the layout result. Default is true.
*/
mxFastOrganicLayout.prototype.useInputOrigin = true;
useInputOrigin = true;
/**
* Variable: resetEdges
@ -45,7 +45,7 @@ mxFastOrganicLayout.prototype.useInputOrigin = true;
* Specifies if all edge points of traversed edges should be removed.
* Default is true.
*/
mxFastOrganicLayout.prototype.resetEdges = true;
resetEdges = true;
/**
* Variable: disableEdgeStyle
@ -53,7 +53,7 @@ mxFastOrganicLayout.prototype.resetEdges = true;
* Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are
* modified by the result. Default is true.
*/
mxFastOrganicLayout.prototype.disableEdgeStyle = true;
disableEdgeStyle = true;
/**
* Variable: forceConstant
@ -62,14 +62,14 @@ mxFastOrganicLayout.prototype.disableEdgeStyle = true;
* replusive forces are multiple by the square of. The value equates to the
* average radius there is of free space around each node. Default is 50.
*/
mxFastOrganicLayout.prototype.forceConstant = 50;
forceConstant = 50;
/**
* Variable: forceConstantSquared
*
* Cache of <forceConstant>^2 for performance.
*/
mxFastOrganicLayout.prototype.forceConstantSquared = 0;
forceConstantSquared = 0;
/**
* Variable: minDistanceLimit
@ -77,7 +77,7 @@ mxFastOrganicLayout.prototype.forceConstantSquared = 0;
* Minimal distance limit. Default is 2. Prevents of
* dividing by zero.
*/
mxFastOrganicLayout.prototype.minDistanceLimit = 2;
minDistanceLimit = 2;
/**
* Variable: maxDistanceLimit
@ -85,105 +85,105 @@ mxFastOrganicLayout.prototype.minDistanceLimit = 2;
* Maximal distance limit. Default is 500. Prevents of
* dividing by zero.
*/
mxFastOrganicLayout.prototype.maxDistanceLimit = 500;
maxDistanceLimit = 500;
/**
* Variable: minDistanceLimitSquared
*
* Cached version of <minDistanceLimit> squared.
*/
mxFastOrganicLayout.prototype.minDistanceLimitSquared = 4;
minDistanceLimitSquared = 4;
/**
* Variable: initialTemp
*
* Start value of temperature. Default is 200.
*/
mxFastOrganicLayout.prototype.initialTemp = 200;
initialTemp = 200;
/**
* Variable: temperature
*
* Temperature to limit displacement at later stages of layout.
*/
mxFastOrganicLayout.prototype.temperature = 0;
temperature = 0;
/**
* Variable: maxIterations
*
* Total number of iterations to run the layout though.
*/
mxFastOrganicLayout.prototype.maxIterations = 0;
maxIterations = 0;
/**
* Variable: iteration
*
* Current iteration count.
*/
mxFastOrganicLayout.prototype.iteration = 0;
iteration = 0;
/**
* Variable: vertexArray
*
* An array of all vertices to be laid out.
*/
mxFastOrganicLayout.prototype.vertexArray;
vertexArray;
/**
* Variable: dispX
*
* An array of locally stored X co-ordinate displacements for the vertices.
*/
mxFastOrganicLayout.prototype.dispX;
dispX;
/**
* Variable: dispY
*
* An array of locally stored Y co-ordinate displacements for the vertices.
*/
mxFastOrganicLayout.prototype.dispY;
dispY;
/**
* Variable: cellLocation
*
* An array of locally stored co-ordinate positions for the vertices.
*/
mxFastOrganicLayout.prototype.cellLocation;
cellLocation;
/**
* Variable: radius
*
* The approximate radius of each cell, nodes only.
*/
mxFastOrganicLayout.prototype.radius;
radius;
/**
* Variable: radiusSquared
*
* The approximate radius squared of each cell, nodes only.
*/
mxFastOrganicLayout.prototype.radiusSquared;
radiusSquared;
/**
* Variable: isMoveable
*
* Array of booleans representing the movable states of the vertices.
*/
mxFastOrganicLayout.prototype.isMoveable;
isMoveable;
/**
* Variable: neighbours
*
* Local copy of cell neighbours.
*/
mxFastOrganicLayout.prototype.neighbours;
neighbours;
/**
* Variable: indices
*
* Hashtable from cells to local indices.
*/
mxFastOrganicLayout.prototype.indices;
indices;
/**
* Variable: allowedToRun
@ -191,7 +191,7 @@ mxFastOrganicLayout.prototype.indices;
* Boolean flag that specifies if the layout is allowed to run. If this is
* set to false, then the layout exits in the following iteration.
*/
mxFastOrganicLayout.prototype.allowedToRun = true;
allowedToRun = true;
/**
* Function: isVertexIgnored
@ -203,9 +203,9 @@ mxFastOrganicLayout.prototype.allowedToRun = true;
*
* vertex - <mxCell> whose ignored state should be returned.
*/
mxFastOrganicLayout.prototype.isVertexIgnored = function(vertex)
isVertexIgnored = (vertex)=>
{
return mxGraphLayout.prototype.isVertexIgnored.apply(this, arguments) ||
return isVertexIgnored.apply(this, arguments) ||
this.graph.getConnections(vertex).length == 0;
};
@ -215,7 +215,7 @@ mxFastOrganicLayout.prototype.isVertexIgnored = function(vertex)
* Implements <mxGraphLayout.execute>. This operates on all children of the
* given parent where <isVertexIgnored> returns false.
*/
mxFastOrganicLayout.prototype.execute = function(parent)
execute = (parent)=>
{
var model = this.graph.getModel();
this.vertexArray = [];
@ -426,7 +426,7 @@ mxFastOrganicLayout.prototype.execute = function(parent)
* local cache of cell positions. Limits the displacement to the current
* temperature.
*/
mxFastOrganicLayout.prototype.calcPositions = function()
calcPositions = ()=>
{
for (var index = 0; index < this.vertexArray.length; index++)
{
@ -467,7 +467,7 @@ mxFastOrganicLayout.prototype.calcPositions = function()
* Calculates the attractive forces between all laid out nodes linked by
* edges
*/
mxFastOrganicLayout.prototype.calcAttraction = function()
calcAttraction = ()=>
{
// Check the neighbours of each vertex and calculate the attractive
// force of the edge connecting them
@ -516,7 +516,7 @@ mxFastOrganicLayout.prototype.calcAttraction = function()
*
* Calculates the repulsive forces between all laid out nodes
*/
mxFastOrganicLayout.prototype.calcRepulsion = function()
calcRepulsion = ()=>
{
var vertexCount = this.vertexArray.length;
@ -585,7 +585,7 @@ mxFastOrganicLayout.prototype.calcRepulsion = function()
* Reduces the temperature of the layout from an initial setting in a linear
* fashion to zero.
*/
mxFastOrganicLayout.prototype.reduceTemperature = function()
reduceTemperature = ()=>
{
this.temperature = this.initialTemp * (1.0 - this.iteration / this.maxIterations);
};

View File

@ -33,7 +33,7 @@ function mxGraphLayout(graph)
*
* Reference to the enclosing <mxGraph>.
*/
mxGraphLayout.prototype.graph = null;
graph = null;
/**
* Variable: useBoundingBox
@ -41,14 +41,14 @@ mxGraphLayout.prototype.graph = null;
* Boolean indicating if the bounding box of the label should be used if
* its available. Default is true.
*/
mxGraphLayout.prototype.useBoundingBox = true;
useBoundingBox = true;
/**
* Variable: parent
*
* The parent cell of the layout, if any
*/
mxGraphLayout.prototype.parent = null;
parent = null;
/**
* Function: moveCell
@ -66,7 +66,7 @@ mxGraphLayout.prototype.parent = null;
* x - X-coordinate of the new cell location.
* y - Y-coordinate of the new cell location.
*/
mxGraphLayout.prototype.moveCell = function(cell, x, y) { };
moveCell = (cell, x, y)=> { };
/**
* Function: resizeCell
@ -81,7 +81,7 @@ mxGraphLayout.prototype.moveCell = function(cell, x, y) { };
* cell - <mxCell> which has been moved.
* bounds - <mxRectangle> that represents the new cell bounds.
*/
mxGraphLayout.prototype.resizeCell = function(cell, bounds) { };
resizeCell = (cell, bounds)=> { };
/**
* Function: execute
@ -92,14 +92,14 @@ mxGraphLayout.prototype.resizeCell = function(cell, bounds) { };
*
* parent - <mxCell> whose children should be layed out.
*/
mxGraphLayout.prototype.execute = function(parent) { };
execute = (parent)=> { };
/**
* Function: getGraph
*
* Returns the graph that this layout operates on.
*/
mxGraphLayout.prototype.getGraph = function()
getGraph = ()=>
{
return this.graph;
};
@ -121,7 +121,7 @@ mxGraphLayout.prototype.getGraph = function()
* source - Optional boolean that specifies if the connection is incoming
* or outgoing. Default is null.
*/
mxGraphLayout.prototype.getConstraint = function(key, cell, edge, source)
getConstraint = (key, cell, edge, source)=>
{
return this.graph.getCurrentCellStyle(cell)[key]
};
@ -140,7 +140,7 @@ mxGraphLayout.prototype.getConstraint = function(key, cell, edge, source)
* (code)
* mxLog.show();
* var cell = graph.getSelectionCell();
* graph.traverse(cell, false, function(vertex, edge)
* graph.traverse(cell, false, (vertex, edge)=>
* {
* mxLog.debug(graph.getLabel(vertex));
* });
@ -157,7 +157,7 @@ mxGraphLayout.prototype.getConstraint = function(key, cell, edge, source)
* null for the first step of the traversal.
* visited - Optional <mxDictionary> of cell paths for the visited cells.
*/
mxGraphLayout.traverse = function(vertex, directed, func, edge, visited)
mxGraphLayout.traverse = (vertex, directed, func, edge, visited)=>
{
if (func != null && vertex != null)
{
@ -203,7 +203,7 @@ mxGraphLayout.traverse = function(vertex, directed, func, edge, visited)
* child - <mxCell> that specifies the child.
* traverseAncestors - boolean whether to
*/
mxGraphLayout.prototype.isAncestor = function(parent, child, traverseAncestors)
isAncestor = (parent, child, traverseAncestors)=>
{
if (!traverseAncestors)
{
@ -234,7 +234,7 @@ mxGraphLayout.prototype.isAncestor = function(parent, child, traverseAncestors)
*
* cell - <mxCell> whose movable state should be returned.
*/
mxGraphLayout.prototype.isVertexMovable = function(cell)
isVertexMovable = (cell)=>
{
return this.graph.isCellMovable(cell);
};
@ -249,7 +249,7 @@ mxGraphLayout.prototype.isVertexMovable = function(cell)
*
* vertex - <mxCell> whose ignored state should be returned.
*/
mxGraphLayout.prototype.isVertexIgnored = function(vertex)
isVertexIgnored = (vertex)=>
{
return !this.graph.getModel().isVertex(vertex) ||
!this.graph.isCellVisible(vertex);
@ -265,7 +265,7 @@ mxGraphLayout.prototype.isVertexIgnored = function(vertex)
*
* cell - <mxCell> whose ignored state should be returned.
*/
mxGraphLayout.prototype.isEdgeIgnored = function(edge)
isEdgeIgnored = (edge)=>
{
var model = this.graph.getModel();
@ -280,7 +280,7 @@ mxGraphLayout.prototype.isEdgeIgnored = function(edge)
*
* Disables or enables the edge style of the given edge.
*/
mxGraphLayout.prototype.setEdgeStyleEnabled = function(edge, value)
setEdgeStyleEnabled = (edge, value)=>
{
this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE,
(value) ? '0' : '1', [edge]);
@ -291,7 +291,7 @@ mxGraphLayout.prototype.setEdgeStyleEnabled = function(edge, value)
*
* Disables or enables orthogonal end segments of the given edge.
*/
mxGraphLayout.prototype.setOrthogonalEdge = function(edge, value)
setOrthogonalEdge = (edge, value)=>
{
this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL,
(value) ? '1' : '0', [edge]);
@ -303,7 +303,7 @@ mxGraphLayout.prototype.setOrthogonalEdge = function(edge, value)
* Determines the offset of the given parent to the parent
* of the layout
*/
mxGraphLayout.prototype.getParentOffset = function(parent)
getParentOffset = (parent)=>
{
var result = new mxPoint();
@ -335,7 +335,7 @@ mxGraphLayout.prototype.getParentOffset = function(parent)
* Replaces the array of mxPoints in the geometry of the given edge
* with the given array of mxPoints.
*/
mxGraphLayout.prototype.setEdgePoints = function(edge, points)
setEdgePoints = (edge, points)=>
{
if (edge != null)
{
@ -385,7 +385,7 @@ mxGraphLayout.prototype.setEdgePoints = function(edge, points)
* x - Integer that defines the x-coordinate of the new location.
* y - Integer that defines the y-coordinate of the new location.
*/
mxGraphLayout.prototype.setVertexLocation = function(cell, x, y)
setVertexLocation = (cell, x, y)=>
{
var model = this.graph.getModel();
var geometry = model.getGeometry(cell);
@ -452,7 +452,7 @@ mxGraphLayout.prototype.setVertexLocation = function(cell, x, y)
* Returns an <mxRectangle> that defines the bounds of the given cell or
* the bounding box if <useBoundingBox> is true.
*/
mxGraphLayout.prototype.getVertexBounds = function(cell)
getVertexBounds = (cell)=>
{
var geo = this.graph.getModel().getGeometry(cell);
@ -498,7 +498,7 @@ mxGraphLayout.prototype.getVertexBounds = function(cell)
*
* Shortcut to <mxGraph.updateGroupBounds> with moveGroup set to true.
*/
mxGraphLayout.prototype.arrangeGroups = function(cells, border, topBorder, rightBorder, bottomBorder, leftBorder)
arrangeGroups = (cells, border, topBorder, rightBorder, bottomBorder, leftBorder)=>
{
return this.graph.updateGroupBounds(cells, border, true, topBorder, rightBorder, bottomBorder, leftBorder);
};
@ -525,42 +525,42 @@ function WeightedCellSorter(cell, weightedValue)
*
* The weighted value of the cell stored.
*/
WeightedCellSorter.prototype.weightedValue = 0;
weightedValue = 0;
/**
* Variable: nudge
*
* Whether or not to flip equal weight values.
*/
WeightedCellSorter.prototype.nudge = false;
nudge = false;
/**
* Variable: visited
*
* Whether or not this cell has been visited in the current assignment.
*/
WeightedCellSorter.prototype.visited = false;
visited = false;
/**
* Variable: rankIndex
*
* The index this cell is in the model rank.
*/
WeightedCellSorter.prototype.rankIndex = null;
rankIndex = null;
/**
* Variable: cell
*
* The cell whose median value is being calculated.
*/
WeightedCellSorter.prototype.cell = null;
cell = null;
/**
* Function: compare
*
* Compares two WeightedCellSorters.
*/
WeightedCellSorter.prototype.compare = function(a, b)
compare = (a, b)=>
{
if (a != null && b != null)
{

View File

@ -22,14 +22,14 @@
* (code)
* var layout = new mxParallelEdgeLayout(graph);
*
* graph.addListener(mxEvent.CELL_CONNECTED, function(sender, evt)
* graph.addListener(mxEvent.CELL_CONNECTED, (sender, evt)=>
* {
* var model = graph.getModel();
* var edge = evt.getProperty('edge');
* var src = model.getTerminal(edge, true);
* var trg = model.getTerminal(edge, false);
*
* layout.isEdgeIgnored = function(edge2)
* layout.isEdgeIgnored = (edge2)=>
* {
* var src2 = model.getTerminal(edge2, true);
* var trg2 = model.getTerminal(edge2, false);
@ -54,14 +54,14 @@ function mxParallelEdgeLayout(graph)
* Extends mxGraphLayout.
*/
mxParallelEdgeLayout.prototype = new mxGraphLayout();
mxParallelEdgeLayout.prototype.constructor = mxParallelEdgeLayout;
constructor = mxParallelEdgeLayout;
/**
* Variable: spacing
*
* Defines the spacing between the parallels. Default is 20.
*/
mxParallelEdgeLayout.prototype.spacing = 20;
spacing = 20;
/**
* Variable: checkOverlap
@ -69,14 +69,14 @@ mxParallelEdgeLayout.prototype.spacing = 20;
* Specifies if only overlapping edges should be considered
* parallel. Default is false.
*/
mxParallelEdgeLayout.prototype.checkOverlap = false;
checkOverlap = false;
/**
* Function: execute
*
* Implements <mxGraphLayout.execute>.
*/
mxParallelEdgeLayout.prototype.execute = function(parent, cells)
execute = (parent, cells)=>
{
var lookup = this.findParallels(parent, cells);
@ -104,11 +104,11 @@ mxParallelEdgeLayout.prototype.execute = function(parent, cells)
*
* Finds the parallel edges in the given parent.
*/
mxParallelEdgeLayout.prototype.findParallels = function(parent, cells)
findParallels = (parent, cells)=>
{
var lookup = [];
var addCell = mxUtils.bind(this, function(cell)
var addCell = mxUtils.bind(this, (cell)=>
{
if (!this.isEdgeIgnored(cell))
{
@ -154,7 +154,7 @@ mxParallelEdgeLayout.prototype.findParallels = function(parent, cells)
* edge direction and is built using the visible terminal of the given
* edge.
*/
mxParallelEdgeLayout.prototype.getEdgeId = function(edge)
getEdgeId = (edge)=>
{
var view = this.graph.getView();
@ -201,7 +201,7 @@ mxParallelEdgeLayout.prototype.getEdgeId = function(edge)
*
* Lays out the parallel edges in the given array.
*/
mxParallelEdgeLayout.prototype.layout = function(parallels)
layout = (parallels)=>
{
var edge = parallels[0];
var view = this.graph.getView();
@ -261,7 +261,7 @@ mxParallelEdgeLayout.prototype.layout = function(parallels)
*
* Routes the given edge via the given point.
*/
mxParallelEdgeLayout.prototype.route = function(edge, x, y)
route = (edge, x, y)=>
{
if (this.graph.isCellMovable(edge))
{

View File

@ -36,7 +36,7 @@ function mxPartitionLayout(graph, horizontal, spacing, border)
* Extends mxGraphLayout.
*/
mxPartitionLayout.prototype = new mxGraphLayout();
mxPartitionLayout.prototype.constructor = mxPartitionLayout;
constructor = mxPartitionLayout;
/**
* Variable: horizontal
@ -44,7 +44,7 @@ mxPartitionLayout.prototype.constructor = mxPartitionLayout;
* Boolean indicating the direction in which the space is partitioned.
* Default is true.
*/
mxPartitionLayout.prototype.horizontal = null;
horizontal = null;
/**
* Variable: spacing
@ -52,7 +52,7 @@ mxPartitionLayout.prototype.horizontal = null;
* Integer that specifies the absolute spacing in pixels between the
* children. Default is 0.
*/
mxPartitionLayout.prototype.spacing = null;
spacing = null;
/**
* Variable: border
@ -60,21 +60,21 @@ mxPartitionLayout.prototype.spacing = null;
* Integer that specifies the absolute inset in pixels for the parent that
* contains the children. Default is 0.
*/
mxPartitionLayout.prototype.border = null;
border = null;
/**
* Variable: resizeVertices
*
* Boolean that specifies if vertices should be resized. Default is true.
*/
mxPartitionLayout.prototype.resizeVertices = true;
resizeVertices = true;
/**
* Function: isHorizontal
*
* Returns <horizontal>.
*/
mxPartitionLayout.prototype.isHorizontal = function()
isHorizontal = ()=>
{
return this.horizontal;
};
@ -84,7 +84,7 @@ mxPartitionLayout.prototype.isHorizontal = function()
*
* Implements <mxGraphLayout.moveCell>.
*/
mxPartitionLayout.prototype.moveCell = function(cell, x, y)
moveCell = (cell, x, y)=>
{
var model = this.graph.getModel();
var parent = model.getParent(cell);
@ -130,7 +130,7 @@ mxPartitionLayout.prototype.moveCell = function(cell, x, y)
* Implements <mxGraphLayout.execute>. All children where <isVertexIgnored>
* returns false and <isVertexMovable> returns true are modified.
*/
mxPartitionLayout.prototype.execute = function(parent)
execute = (parent)=>
{
var horizontal = this.isHorizontal();
var model = this.graph.getModel();

View File

@ -35,42 +35,42 @@ mxUtils.extend(mxRadialTreeLayout, mxCompactTreeLayout);
*
* The initial offset to compute the angle position.
*/
mxRadialTreeLayout.prototype.angleOffset = 0.5;
angleOffset = 0.5;
/**
* Variable: rootx
*
* The X co-ordinate of the root cell
*/
mxRadialTreeLayout.prototype.rootx = 0;
rootx = 0;
/**
* Variable: rooty
*
* The Y co-ordinate of the root cell
*/
mxRadialTreeLayout.prototype.rooty = 0;
rooty = 0;
/**
* Variable: levelDistance
*
* Holds the levelDistance. Default is 120.
*/
mxRadialTreeLayout.prototype.levelDistance = 120;
levelDistance = 120;
/**
* Variable: nodeDistance
*
* Holds the nodeDistance. Default is 10.
*/
mxRadialTreeLayout.prototype.nodeDistance = 10;
nodeDistance = 10;
/**
* Variable: autoRadius
*
* Specifies if the radios should be computed automatically
*/
mxRadialTreeLayout.prototype.autoRadius = false;
autoRadius = false;
/**
* Variable: sortEdges
@ -78,49 +78,49 @@ mxRadialTreeLayout.prototype.autoRadius = false;
* Specifies if edges should be sorted according to the order of their
* opposite terminal cell in the model.
*/
mxRadialTreeLayout.prototype.sortEdges = false;
sortEdges = false;
/**
* Variable: rowMinX
*
* Array of leftmost x coordinate of each row
*/
mxRadialTreeLayout.prototype.rowMinX = [];
rowMinX = [];
/**
* Variable: rowMaxX
*
* Array of rightmost x coordinate of each row
*/
mxRadialTreeLayout.prototype.rowMaxX = [];
rowMaxX = [];
/**
* Variable: rowMinCenX
*
* Array of x coordinate of leftmost vertex of each row
*/
mxRadialTreeLayout.prototype.rowMinCenX = [];
rowMinCenX = [];
/**
* Variable: rowMaxCenX
*
* Array of x coordinate of rightmost vertex of each row
*/
mxRadialTreeLayout.prototype.rowMaxCenX = [];
rowMaxCenX = [];
/**
* Variable: rowRadi
*
* Array of y deltas of each row behind root vertex, also the radius in the tree
*/
mxRadialTreeLayout.prototype.rowRadi = [];
rowRadi = [];
/**
* Variable: row
*
* Array of vertices on each row
*/
mxRadialTreeLayout.prototype.row = [];
row = [];
/**
* Function: isVertexIgnored
@ -132,9 +132,9 @@ mxRadialTreeLayout.prototype.row = [];
*
* vertex - <mxCell> whose ignored state should be returned.
*/
mxRadialTreeLayout.prototype.isVertexIgnored = function(vertex)
isVertexIgnored = (vertex)=>
{
return mxGraphLayout.prototype.isVertexIgnored.apply(this, arguments) ||
return isVertexIgnored.apply(this, arguments) ||
this.graph.getConnections(vertex).length == 0;
};
@ -152,7 +152,7 @@ mxRadialTreeLayout.prototype.isVertexIgnored = function(vertex)
* parent - <mxCell> whose children should be laid out.
* root - Optional <mxCell> that will be used as the root of the tree.
*/
mxRadialTreeLayout.prototype.execute = function(parent, root)
execute = (parent, root)=>
{
this.parent = parent;
@ -160,7 +160,7 @@ mxRadialTreeLayout.prototype.execute = function(parent, root)
this.edgeRouting = false;
//this.horizontal = false;
mxCompactTreeLayout.prototype.execute.apply(this, arguments);
execute.apply(this, arguments);
var bounds = null;
var rootBounds = this.getVertexBounds(this.root);
@ -270,7 +270,7 @@ mxRadialTreeLayout.prototype.execute = function(parent, root)
* row - Array of internal nodes, the children of which are to be processed.
* rowNum - Integer indicating which row is being processed.
*/
mxRadialTreeLayout.prototype.calcRowDims = function(row, rowNum)
calcRowDims = (row, rowNum)=>
{
if (row == null || row.length == 0)
{

View File

@ -35,70 +35,70 @@ function mxStackLayout(graph, horizontal, spacing, x0, y0, border)
* Extends mxGraphLayout.
*/
mxStackLayout.prototype = new mxGraphLayout();
mxStackLayout.prototype.constructor = mxStackLayout;
constructor = mxStackLayout;
/**
* Variable: horizontal
*
* Specifies the orientation of the layout. Default is true.
*/
mxStackLayout.prototype.horizontal = null;
horizontal = null;
/**
* Variable: spacing
*
* Specifies the spacing between the cells. Default is 0.
*/
mxStackLayout.prototype.spacing = null;
spacing = null;
/**
* Variable: x0
*
* Specifies the horizontal origin of the layout. Default is 0.
*/
mxStackLayout.prototype.x0 = null;
x0 = null;
/**
* Variable: y0
*
* Specifies the vertical origin of the layout. Default is 0.
*/
mxStackLayout.prototype.y0 = null;
y0 = null;
/**
* Variable: border
*
* Border to be added if fill is true. Default is 0.
*/
mxStackLayout.prototype.border = 0;
border = 0;
/**
* Variable: marginTop
*
* Top margin for the child area. Default is 0.
*/
mxStackLayout.prototype.marginTop = 0;
marginTop = 0;
/**
* Variable: marginLeft
*
* Top margin for the child area. Default is 0.
*/
mxStackLayout.prototype.marginLeft = 0;
marginLeft = 0;
/**
* Variable: marginRight
*
* Top margin for the child area. Default is 0.
*/
mxStackLayout.prototype.marginRight = 0;
marginRight = 0;
/**
* Variable: marginBottom
*
* Top margin for the child area. Default is 0.
*/
mxStackLayout.prototype.marginBottom = 0;
marginBottom = 0;
/**
* Variable: keepFirstLocation
@ -106,7 +106,7 @@ mxStackLayout.prototype.marginBottom = 0;
* Boolean indicating if the location of the first cell should be
* kept, that is, it will not be moved to x0 or y0. Default is false.
*/
mxStackLayout.prototype.keepFirstLocation = false;
keepFirstLocation = false;
/**
* Variable: fill
@ -114,7 +114,7 @@ mxStackLayout.prototype.keepFirstLocation = false;
* Boolean indicating if dimension should be changed to fill out the parent
* cell. Default is false.
*/
mxStackLayout.prototype.fill = false;
fill = false;
/**
* Variable: resizeParent
@ -122,7 +122,7 @@ mxStackLayout.prototype.fill = false;
* If the parent should be resized to match the width/height of the
* stack. Default is false.
*/
mxStackLayout.prototype.resizeParent = false;
resizeParent = false;
/**
* Variable: resizeParentMax
@ -130,7 +130,7 @@ mxStackLayout.prototype.resizeParent = false;
* Use maximum of existing value and new value for resize of parent.
* Default is false.
*/
mxStackLayout.prototype.resizeParentMax = false;
resizeParentMax = false;
/**
* Variable: resizeLast
@ -138,42 +138,42 @@ mxStackLayout.prototype.resizeParentMax = false;
* If the last element should be resized to fill out the parent. Default is
* false. If <resizeParent> is true then this is ignored.
*/
mxStackLayout.prototype.resizeLast = false;
resizeLast = false;
/**
* Variable: wrap
*
* Value at which a new column or row should be created. Default is null.
*/
mxStackLayout.prototype.wrap = null;
wrap = null;
/**
* Variable: borderCollapse
*
* If the strokeWidth should be ignored. Default is true.
*/
mxStackLayout.prototype.borderCollapse = true;
borderCollapse = true;
/**
* Variable: allowGaps
*
* If gaps should be allowed in the stack. Default is false.
*/
mxStackLayout.prototype.allowGaps = false;
allowGaps = false;
/**
* Variable: gridSize
*
* Grid size for alignment of position and size. Default is 0.
*/
mxStackLayout.prototype.gridSize = 0;
gridSize = 0;
/**
* Function: isHorizontal
*
* Returns <horizontal>.
*/
mxStackLayout.prototype.isHorizontal = function()
isHorizontal = ()=>
{
return this.horizontal;
};
@ -183,7 +183,7 @@ mxStackLayout.prototype.isHorizontal = function()
*
* Implements <mxGraphLayout.moveCell>.
*/
mxStackLayout.prototype.moveCell = function(cell, x, y)
moveCell = (cell, x, y)=>
{
var model = this.graph.getModel();
var parent = model.getParent(cell);
@ -242,7 +242,7 @@ mxStackLayout.prototype.moveCell = function(cell, x, y)
* Returns the size for the parent container or the size of the graph
* container if the parent is a layer or the root of the model.
*/
mxStackLayout.prototype.getParentSize = function(parent)
getParentSize = (parent)=>
{
var model = this.graph.getModel();
var pgeo = model.getGeometry(parent);
@ -266,7 +266,7 @@ mxStackLayout.prototype.getParentSize = function(parent)
*
* Returns the cells to be layouted.
*/
mxStackLayout.prototype.getLayoutCells = function(parent)
getLayoutCells = (parent)=>
{
var model = this.graph.getModel();
var childCount = model.getChildCount(parent);
@ -284,7 +284,7 @@ mxStackLayout.prototype.getLayoutCells = function(parent)
if (this.allowGaps)
{
cells.sort(mxUtils.bind(this, function(c1, c2)
cells.sort(mxUtils.bind(this, (c1, c2)=>
{
var geo1 = this.graph.getCellGeometry(c1);
var geo2 = this.graph.getCellGeometry(c2);
@ -303,7 +303,7 @@ mxStackLayout.prototype.getLayoutCells = function(parent)
*
* Snaps the given value to the grid size.
*/
mxStackLayout.prototype.snap = function(value)
snap = (value)=>
{
if (this.gridSize != null && this.gridSize > 0)
{
@ -327,7 +327,7 @@ mxStackLayout.prototype.snap = function(value)
* Only children where <isVertexIgnored> returns false are taken into
* account.
*/
mxStackLayout.prototype.execute = function(parent)
execute = (parent)=>
{
if (parent != null)
{
@ -539,7 +539,7 @@ mxStackLayout.prototype.execute = function(parent)
* child - The given child of <mxCell>.
* geo - The specific geometry of <mxGeometry>.
*/
mxStackLayout.prototype.setChildGeometry = function(child, geo)
setChildGeometry = (child, geo)=>
{
var geo2 = this.graph.getCellGeometry(child);
@ -561,7 +561,7 @@ mxStackLayout.prototype.setChildGeometry = function(child, geo)
* pgeo - The new <mxGeometry> for parent.
* last - The last <mxGeometry>.
*/
mxStackLayout.prototype.updateParentGeometry = function(parent, pgeo, last)
updateParentGeometry = (parent, pgeo, last)=>
{
var horizontal = this.isHorizontal();
var model = this.graph.getModel();

View File

@ -26,7 +26,7 @@
* <mxGraph.cellLabelChanged> should be overridden as follows:
*
* (code)
* graph.convertValueToString = function(cell)
* graph.convertValueToString = (cell)=>
* {
* if (mxUtils.isNode(cell.value))
* {
@ -35,7 +35,7 @@
* };
*
* var cellLabelChanged = graph.cellLabelChanged;
* graph.cellLabelChanged = function(cell, newValue, autoSize)
* graph.cellLabelChanged = (cell, newValue, autoSize)=>
* {
* if (mxUtils.isNode(cell.value))
* {
@ -81,21 +81,21 @@ function mxCell(value, geometry, style)
*
* Holds the Id. Default is null.
*/
mxCell.prototype.id = null;
id = null;
/**
* Variable: value
*
* Holds the user object. Default is null.
*/
mxCell.prototype.value = null;
value = null;
/**
* Variable: geometry
*
* Holds the <mxGeometry>. Default is null.
*/
mxCell.prototype.geometry = null;
geometry = null;
/**
* Variable: style
@ -103,77 +103,77 @@ mxCell.prototype.geometry = null;
* Holds the style as a string of the form [(stylename|key=value);]. Default is
* null.
*/
mxCell.prototype.style = null;
style = null;
/**
* Variable: vertex
*
* Specifies whether the cell is a vertex. Default is false.
*/
mxCell.prototype.vertex = false;
vertex = false;
/**
* Variable: edge
*
* Specifies whether the cell is an edge. Default is false.
*/
mxCell.prototype.edge = false;
edge = false;
/**
* Variable: connectable
*
* Specifies whether the cell is connectable. Default is true.
*/
mxCell.prototype.connectable = true;
connectable = true;
/**
* Variable: visible
*
* Specifies whether the cell is visible. Default is true.
*/
mxCell.prototype.visible = true;
visible = true;
/**
* Variable: collapsed
*
* Specifies whether the cell is collapsed. Default is false.
*/
mxCell.prototype.collapsed = false;
collapsed = false;
/**
* Variable: parent
*
* Reference to the parent cell.
*/
mxCell.prototype.parent = null;
parent = null;
/**
* Variable: source
*
* Reference to the source terminal.
*/
mxCell.prototype.source = null;
source = null;
/**
* Variable: target
*
* Reference to the target terminal.
*/
mxCell.prototype.target = null;
target = null;
/**
* Variable: children
*
* Holds the child cells.
*/
mxCell.prototype.children = null;
children = null;
/**
* Variable: edges
*
* Holds the edges.
*/
mxCell.prototype.edges = null;
edges = null;
/**
* Variable: mxTransient
@ -184,7 +184,7 @@ mxCell.prototype.edges = null;
* to mark transient fields since transient modifiers are not supported by
* the language.
*/
mxCell.prototype.mxTransient = ['id', 'value', 'parent', 'source',
mxTransient = ['id', 'value', 'parent', 'source',
'target', 'children', 'edges'];
/**
@ -192,7 +192,7 @@ mxCell.prototype.mxTransient = ['id', 'value', 'parent', 'source',
*
* Returns the Id of the cell as a string.
*/
mxCell.prototype.getId = function()
getId = ()=>
{
return this.id;
};
@ -202,7 +202,7 @@ mxCell.prototype.getId = function()
*
* Sets the Id of the cell to the given string.
*/
mxCell.prototype.setId = function(id)
setId = (id)=>
{
this.id = id;
};
@ -213,7 +213,7 @@ mxCell.prototype.setId = function(id)
* Returns the user object of the cell. The user
* object is stored in <value>.
*/
mxCell.prototype.getValue = function()
getValue = ()=>
{
return this.value;
};
@ -224,7 +224,7 @@ mxCell.prototype.getValue = function()
* Sets the user object of the cell. The user object
* is stored in <value>.
*/
mxCell.prototype.setValue = function(value)
setValue = (value)=>
{
this.value = value;
};
@ -237,7 +237,7 @@ mxCell.prototype.setValue = function(value)
* replaces the user object with the given value and
* returns the old user object.
*/
mxCell.prototype.valueChanged = function(newValue)
valueChanged = (newValue)=>
{
var previous = this.getValue();
this.setValue(newValue);
@ -250,7 +250,7 @@ mxCell.prototype.valueChanged = function(newValue)
*
* Returns the <mxGeometry> that describes the <geometry>.
*/
mxCell.prototype.getGeometry = function()
getGeometry = ()=>
{
return this.geometry;
};
@ -260,7 +260,7 @@ mxCell.prototype.getGeometry = function()
*
* Sets the <mxGeometry> to be used as the <geometry>.
*/
mxCell.prototype.setGeometry = function(geometry)
setGeometry = (geometry)=>
{
this.geometry = geometry;
};
@ -270,7 +270,7 @@ mxCell.prototype.setGeometry = function(geometry)
*
* Returns a string that describes the <style>.
*/
mxCell.prototype.getStyle = function()
getStyle = ()=>
{
return this.style;
};
@ -280,7 +280,7 @@ mxCell.prototype.getStyle = function()
*
* Sets the string to be used as the <style>.
*/
mxCell.prototype.setStyle = function(style)
setStyle = (style)=>
{
this.style = style;
};
@ -290,7 +290,7 @@ mxCell.prototype.setStyle = function(style)
*
* Returns true if the cell is a vertex.
*/
mxCell.prototype.isVertex = function()
isVertex = ()=>
{
return this.vertex != 0;
};
@ -305,7 +305,7 @@ mxCell.prototype.isVertex = function()
*
* vertex - Boolean that specifies if the cell is a vertex.
*/
mxCell.prototype.setVertex = function(vertex)
setVertex = (vertex)=>
{
this.vertex = vertex;
};
@ -315,7 +315,7 @@ mxCell.prototype.setVertex = function(vertex)
*
* Returns true if the cell is an edge.
*/
mxCell.prototype.isEdge = function()
isEdge = ()=>
{
return this.edge != 0;
};
@ -330,7 +330,7 @@ mxCell.prototype.isEdge = function()
*
* edge - Boolean that specifies if the cell is an edge.
*/
mxCell.prototype.setEdge = function(edge)
setEdge = (edge)=>
{
this.edge = edge;
};
@ -340,7 +340,7 @@ mxCell.prototype.setEdge = function(edge)
*
* Returns true if the cell is connectable.
*/
mxCell.prototype.isConnectable = function()
isConnectable = ()=>
{
return this.connectable != 0;
};
@ -354,7 +354,7 @@ mxCell.prototype.isConnectable = function()
*
* connectable - Boolean that specifies the new connectable state.
*/
mxCell.prototype.setConnectable = function(connectable)
setConnectable = (connectable)=>
{
this.connectable = connectable;
};
@ -364,7 +364,7 @@ mxCell.prototype.setConnectable = function(connectable)
*
* Returns true if the cell is visibile.
*/
mxCell.prototype.isVisible = function()
isVisible = ()=>
{
return this.visible != 0;
};
@ -378,7 +378,7 @@ mxCell.prototype.isVisible = function()
*
* visible - Boolean that specifies the new visible state.
*/
mxCell.prototype.setVisible = function(visible)
setVisible = (visible)=>
{
this.visible = visible;
};
@ -388,7 +388,7 @@ mxCell.prototype.setVisible = function(visible)
*
* Returns true if the cell is collapsed.
*/
mxCell.prototype.isCollapsed = function()
isCollapsed = ()=>
{
return this.collapsed != 0;
};
@ -402,7 +402,7 @@ mxCell.prototype.isCollapsed = function()
*
* collapsed - Boolean that specifies the new collapsed state.
*/
mxCell.prototype.setCollapsed = function(collapsed)
setCollapsed = (collapsed)=>
{
this.collapsed = collapsed;
};
@ -412,7 +412,7 @@ mxCell.prototype.setCollapsed = function(collapsed)
*
* Returns the cell's parent.
*/
mxCell.prototype.getParent = function()
getParent = ()=>
{
return this.parent;
};
@ -426,7 +426,7 @@ mxCell.prototype.getParent = function()
*
* parent - <mxCell> that represents the new parent.
*/
mxCell.prototype.setParent = function(parent)
setParent = (parent)=>
{
this.parent = parent;
};
@ -441,7 +441,7 @@ mxCell.prototype.setParent = function(parent)
* source - Boolean that specifies if the source terminal should be
* returned.
*/
mxCell.prototype.getTerminal = function(source)
getTerminal = (source)=>
{
return (source) ? this.source : this.target;
};
@ -457,7 +457,7 @@ mxCell.prototype.getTerminal = function(source)
* isSource - Boolean that specifies if the source or target terminal
* should be set.
*/
mxCell.prototype.setTerminal = function(terminal, isSource)
setTerminal = (terminal, isSource)=>
{
if (isSource)
{
@ -476,7 +476,7 @@ mxCell.prototype.setTerminal = function(terminal, isSource)
*
* Returns the number of child cells.
*/
mxCell.prototype.getChildCount = function()
getChildCount = ()=>
{
return (this.children == null) ? 0 : this.children.length;
};
@ -490,7 +490,7 @@ mxCell.prototype.getChildCount = function()
*
* child - Child whose index should be returned.
*/
mxCell.prototype.getIndex = function(child)
getIndex = (child)=>
{
return mxUtils.indexOf(this.children, child);
};
@ -504,7 +504,7 @@ mxCell.prototype.getIndex = function(child)
*
* index - Integer that specifies the child to be returned.
*/
mxCell.prototype.getChildAt = function(index)
getChildAt = (index)=>
{
return (this.children == null) ? null : this.children[index];
};
@ -523,7 +523,7 @@ mxCell.prototype.getChildAt = function(index)
* index - Optional integer that specifies the index at which the child
* should be inserted into the child array.
*/
mxCell.prototype.insert = function(child, index)
insert = (child, index)=>
{
if (child != null)
{
@ -566,7 +566,7 @@ mxCell.prototype.insert = function(child, index)
* index - Integer that specifies the index of the child to be
* removed.
*/
mxCell.prototype.remove = function(index)
remove = (index)=>
{
var child = null;
@ -589,7 +589,7 @@ mxCell.prototype.remove = function(index)
*
* Removes the cell from its parent.
*/
mxCell.prototype.removeFromParent = function()
removeFromParent = ()=>
{
if (this.parent != null)
{
@ -603,7 +603,7 @@ mxCell.prototype.removeFromParent = function()
*
* Returns the number of edges in the edge array.
*/
mxCell.prototype.getEdgeCount = function()
getEdgeCount = ()=>
{
return (this.edges == null) ? 0 : this.edges.length;
};
@ -617,7 +617,7 @@ mxCell.prototype.getEdgeCount = function()
*
* edge - <mxCell> whose index in <edges> should be returned.
*/
mxCell.prototype.getEdgeIndex = function(edge)
getEdgeIndex = (edge)=>
{
return mxUtils.indexOf(this.edges, edge);
};
@ -631,7 +631,7 @@ mxCell.prototype.getEdgeIndex = function(edge)
*
* index - Integer that specifies the index of the edge to be returned.
*/
mxCell.prototype.getEdgeAt = function(index)
getEdgeAt = (index)=>
{
return (this.edges == null) ? null : this.edges[index];
};
@ -647,7 +647,7 @@ mxCell.prototype.getEdgeAt = function(index)
* edge - <mxCell> to be inserted into the edge array.
* isOutgoing - Boolean that specifies if the edge is outgoing.
*/
mxCell.prototype.insertEdge = function(edge, isOutgoing)
insertEdge = (edge, isOutgoing)=>
{
if (edge != null)
{
@ -681,7 +681,7 @@ mxCell.prototype.insertEdge = function(edge, isOutgoing)
* edge - <mxCell> to be removed from the edge array.
* isOutgoing - Boolean that specifies if the edge is outgoing.
*/
mxCell.prototype.removeEdge = function(edge, isOutgoing)
removeEdge = (edge, isOutgoing)=>
{
if (edge != null)
{
@ -712,7 +712,7 @@ mxCell.prototype.removeEdge = function(edge, isOutgoing)
* isSource - Boolean that specifies if the edge should be removed from its
* source or target terminal.
*/
mxCell.prototype.removeFromTerminal = function(isSource)
removeFromTerminal = (isSource)=>
{
var terminal = this.getTerminal(isSource);
@ -732,7 +732,7 @@ mxCell.prototype.removeFromTerminal = function(isSource)
*
* name - Name of the attribute.
*/
mxCell.prototype.hasAttribute = function(name)
hasAttribute = (name)=>
{
var userObject = this.getValue();
@ -753,7 +753,7 @@ mxCell.prototype.hasAttribute = function(name)
* defaultValue - Optional default value to use if the attribute has no
* value.
*/
mxCell.prototype.getAttribute = function(name, defaultValue)
getAttribute = (name, defaultValue)=>
{
var userObject = this.getValue();
@ -774,7 +774,7 @@ mxCell.prototype.getAttribute = function(name, defaultValue)
* name - Name of the attribute whose value should be set.
* value - New value of the attribute.
*/
mxCell.prototype.setAttribute = function(name, value)
setAttribute = (name, value)=>
{
var userObject = this.getValue();
@ -792,7 +792,7 @@ mxCell.prototype.setAttribute = function(name, value)
* the user object. All fields in <mxTransient> are ignored
* during the cloning.
*/
mxCell.prototype.clone = function()
clone = ()=>
{
var clone = mxUtils.clone(this, this.mxTransient);
clone.setValue(this.cloneValue());
@ -805,7 +805,7 @@ mxCell.prototype.clone = function()
*
* Returns a clone of the cell's user object.
*/
mxCell.prototype.cloneValue = function()
cloneValue = ()=>
{
var value = this.getValue();

View File

@ -27,7 +27,7 @@ var mxCellPath =
*
* cell - Cell whose path should be returned.
*/
create: function(cell)
create: (cell)=>
{
var result = '';
@ -66,7 +66,7 @@ var mxCellPath =
*
* path - Path whose parent path should be returned.
*/
getParentPath: function(path)
getParentPath: (path)=>
{
if (path != null)
{
@ -96,7 +96,7 @@ var mxCellPath =
* root - Root cell of the path to be resolved.
* path - String that defines the path.
*/
resolve: function(root, path)
resolve: (root, path)=>
{
var parent = root;
@ -119,7 +119,7 @@ var mxCellPath =
* Compares the given cell paths and returns -1 if p1 is smaller, 0 if
* p1 is equal and 1 if p1 is greater than p2.
*/
compare: function(p1, p2)
compare: (p1, p2)=>
{
var min = Math.min(p1.length, p2.length);
var comp = 0;

View File

@ -79,14 +79,14 @@ function mxGeometry(x, y, width, height)
* Extends mxRectangle.
*/
mxGeometry.prototype = new mxRectangle();
mxGeometry.prototype.constructor = mxGeometry;
constructor = mxGeometry;
/**
* Variable: TRANSLATE_CONTROL_POINTS
*
* Global switch to translate the points in translate. Default is true.
*/
mxGeometry.prototype.TRANSLATE_CONTROL_POINTS = true;
TRANSLATE_CONTROL_POINTS = true;
/**
* Variable: alternateBounds
@ -94,7 +94,7 @@ mxGeometry.prototype.TRANSLATE_CONTROL_POINTS = true;
* Stores alternate values for x, y, width and height in a rectangle. See
* <swap> to exchange the values. Default is null.
*/
mxGeometry.prototype.alternateBounds = null;
alternateBounds = null;
/**
* Variable: sourcePoint
@ -103,7 +103,7 @@ mxGeometry.prototype.alternateBounds = null;
* corresponding edge does not have a source vertex. Otherwise it is
* ignored. Default is null.
*/
mxGeometry.prototype.sourcePoint = null;
sourcePoint = null;
/**
* Variable: targetPoint
@ -112,7 +112,7 @@ mxGeometry.prototype.sourcePoint = null;
* corresponding edge does not have a target vertex. Otherwise it is
* ignored. Default is null.
*/
mxGeometry.prototype.targetPoint = null;
targetPoint = null;
/**
* Variable: points
@ -122,7 +122,7 @@ mxGeometry.prototype.targetPoint = null;
* use <targetPoint> and <sourcePoint> or set the terminals of the edge to
* a non-null value. Default is null.
*/
mxGeometry.prototype.points = null;
points = null;
/**
* Variable: offset
@ -133,7 +133,7 @@ mxGeometry.prototype.points = null;
* coordinates. For absolute geometries (for vertices), this defines the
* offset for the label. Default is null.
*/
mxGeometry.prototype.offset = null;
offset = null;
/**
* Variable: relative
@ -150,7 +150,7 @@ mxGeometry.prototype.offset = null;
*
* Default is false.
*/
mxGeometry.prototype.relative = false;
relative = false;
/**
* Function: swap
@ -163,7 +163,7 @@ mxGeometry.prototype.relative = false;
* calling this method and setting the geometry of the cell using
* <mxGraphModel.setGeometry>.
*/
mxGeometry.prototype.swap = function()
swap = ()=>
{
if (this.alternateBounds != null)
{
@ -190,7 +190,7 @@ mxGeometry.prototype.swap = function()
* isSource - Boolean that specifies if the source or target point
* should be returned.
*/
mxGeometry.prototype.getTerminalPoint = function(isSource)
getTerminalPoint = (isSource)=>
{
return (isSource) ? this.sourcePoint : this.targetPoint;
};
@ -207,7 +207,7 @@ mxGeometry.prototype.getTerminalPoint = function(isSource)
* isSource - Boolean that specifies if the source or target point
* should be set.
*/
mxGeometry.prototype.setTerminalPoint = function(point, isSource)
setTerminalPoint = (point, isSource)=>
{
if (isSource)
{
@ -234,7 +234,7 @@ mxGeometry.prototype.setTerminalPoint = function(point, isSource)
* angle - Number that specifies the rotation angle in degrees.
* cx - <mxPoint> that specifies the center of the rotation.
*/
mxGeometry.prototype.rotate = function(angle, cx)
rotate = (angle, cx)=>
{
var rad = mxUtils.toRadians(angle);
var cos = Math.cos(rad);
@ -295,7 +295,7 @@ mxGeometry.prototype.rotate = function(angle, cx)
* dx - Number that specifies the x-coordinate of the translation.
* dy - Number that specifies the y-coordinate of the translation.
*/
mxGeometry.prototype.translate = function(dx, dy)
translate = (dx, dy)=>
{
dx = parseFloat(dx);
dy = parseFloat(dy);
@ -350,7 +350,7 @@ mxGeometry.prototype.translate = function(dx, dy)
* sy - Number that specifies the vertical scale factor.
* fixedAspect - Optional boolean to keep the aspect ratio fixed.
*/
mxGeometry.prototype.scale = function(sx, sy, fixedAspect)
scale = (sx, sy, fixedAspect)=>
{
sx = parseFloat(sx);
sy = parseFloat(sy);
@ -403,9 +403,9 @@ mxGeometry.prototype.scale = function(sx, sy, fixedAspect)
*
* Returns true if the given object equals this geometry.
*/
mxGeometry.prototype.equals = function(obj)
equals = (obj)=>
{
return mxRectangle.prototype.equals.apply(this, arguments) &&
return equals.apply(this, arguments) &&
this.relative == obj.relative &&
((this.sourcePoint == null && obj.sourcePoint == null) || (this.sourcePoint != null && this.sourcePoint.equals(obj.sourcePoint))) &&
((this.targetPoint == null && obj.targetPoint == null) || (this.targetPoint != null && this.targetPoint.equals(obj.targetPoint))) &&

View File

@ -49,7 +49,7 @@
* each change from the given array of changes.
*
* (code)
* model.addListener(mxEvent.CHANGE, function(sender, evt)
* model.addListener(mxEvent.CHANGE, (sender, evt)=>
* {
* var changes = evt.getProperty('edit').changes;
* var nodes = [];
@ -68,7 +68,7 @@
*
* (code)
* var codec = new mxCodec();
* codec.lookup = function(id)
* codec.lookup = (id)=>
* {
* return model.getCell(id);
* }
@ -91,7 +91,7 @@
* var edit = new mxUndoableEdit(model, false);
* edit.changes = changes;
*
* edit.notify = function()
* edit.notify = ()=>
* {
* edit.source.fireEvent(new mxEventObject(mxEvent.CHANGE,
* 'edit', edit, 'changes', edit.changes));
@ -116,7 +116,7 @@
* For finding newly inserted cells, the following code can be used:
*
* (code)
* graph.model.addListener(mxEvent.CHANGE, function(sender, evt)
* graph.model.addListener(mxEvent.CHANGE, (sender, evt)=>
* {
* var changes = evt.getProperty('edit').changes;
*
@ -211,7 +211,7 @@ function mxGraphModel(root)
* Extends mxEventSource.
*/
mxGraphModel.prototype = new mxEventSource();
mxGraphModel.prototype.constructor = mxGraphModel;
constructor = mxGraphModel;
/**
* Variable: root
@ -220,14 +220,14 @@ mxGraphModel.prototype.constructor = mxGraphModel;
* layers of the diagram as child cells. That is, the actual elements of the
* diagram are supposed to live in the third generation of cells and below.
*/
mxGraphModel.prototype.root = null;
root = null;
/**
* Variable: cells
*
* Maps from Ids to cells.
*/
mxGraphModel.prototype.cells = null;
cells = null;
/**
* Variable: maintainEdgeParent
@ -235,7 +235,7 @@ mxGraphModel.prototype.cells = null;
* Specifies if edges should automatically be moved into the nearest common
* ancestor of their terminals. Default is true.
*/
mxGraphModel.prototype.maintainEdgeParent = true;
maintainEdgeParent = true;
/**
* Variable: ignoreRelativeEdgeParent
@ -243,7 +243,7 @@ mxGraphModel.prototype.maintainEdgeParent = true;
* Specifies if relative edge parents should be ignored for finding the nearest
* common ancestors of an edge's terminals. Default is true.
*/
mxGraphModel.prototype.ignoreRelativeEdgeParent = true;
ignoreRelativeEdgeParent = true;
/**
* Variable: createIds
@ -251,28 +251,28 @@ mxGraphModel.prototype.ignoreRelativeEdgeParent = true;
* Specifies if the model should automatically create Ids for new cells.
* Default is true.
*/
mxGraphModel.prototype.createIds = true;
createIds = true;
/**
* Variable: prefix
*
* Defines the prefix of new Ids. Default is an empty string.
*/
mxGraphModel.prototype.prefix = '';
prefix = '';
/**
* Variable: postfix
*
* Defines the postfix of new Ids. Default is an empty string.
*/
mxGraphModel.prototype.postfix = '';
postfix = '';
/**
* Variable: nextId
*
* Specifies the next Id to be created. Initial value is 0.
*/
mxGraphModel.prototype.nextId = 0;
nextId = 0;
/**
* Variable: currentEdit
@ -281,7 +281,7 @@ mxGraphModel.prototype.nextId = 0;
* closed then a new object is created for this variable using
* <createUndoableEdit>.
*/
mxGraphModel.prototype.currentEdit = null;
currentEdit = null;
/**
* Variable: updateLevel
@ -291,21 +291,21 @@ mxGraphModel.prototype.currentEdit = null;
* it. When the counter reaches 0, the transaction is closed and the
* respective events are fired. Initial value is 0.
*/
mxGraphModel.prototype.updateLevel = 0;
updateLevel = 0;
/**
* Variable: endingUpdate
*
* True if the program flow is currently inside endUpdate.
*/
mxGraphModel.prototype.endingUpdate = false;
endingUpdate = false;
/**
* Function: clear
*
* Sets a new root using <createRoot>.
*/
mxGraphModel.prototype.clear = function()
clear = ()=>
{
this.setRoot(this.createRoot());
};
@ -315,7 +315,7 @@ mxGraphModel.prototype.clear = function()
*
* Returns <createIds>.
*/
mxGraphModel.prototype.isCreateIds = function()
isCreateIds = ()=>
{
return this.createIds;
};
@ -325,7 +325,7 @@ mxGraphModel.prototype.isCreateIds = function()
*
* Sets <createIds>.
*/
mxGraphModel.prototype.setCreateIds = function(value)
setCreateIds = (value)=>
{
this.createIds = value;
};
@ -335,7 +335,7 @@ mxGraphModel.prototype.setCreateIds = function(value)
*
* Creates a new root cell with a default layer (child 0).
*/
mxGraphModel.prototype.createRoot = function()
createRoot = ()=>
{
var cell = new mxCell();
cell.insert(new mxCell());
@ -353,7 +353,7 @@ mxGraphModel.prototype.createRoot = function()
*
* id - A string representing the Id of the cell.
*/
mxGraphModel.prototype.getCell = function(id)
getCell = (id)=>
{
return (this.cells != null) ? this.cells[id] : null;
};
@ -364,7 +364,7 @@ mxGraphModel.prototype.getCell = function(id)
* Returns the cells from the given array where the given filter function
* returns true.
*/
mxGraphModel.prototype.filterCells = function(cells, filter)
filterCells = (cells, filter)=>
{
var result = null;
@ -393,7 +393,7 @@ mxGraphModel.prototype.filterCells = function(cells, filter)
*
* parent - <mxCell> whose descendants should be returned.
*/
mxGraphModel.prototype.getDescendants = function(parent)
getDescendants = (parent)=>
{
return this.filterDescendants(null, parent);
};
@ -409,7 +409,7 @@ mxGraphModel.prototype.getDescendants = function(parent)
* Example:
* The following example extracts all vertices from a given model:
* (code)
* var filter = function(cell)
* var filter = (cell)=>
* {
* return model.isVertex(cell);
* }
@ -422,7 +422,7 @@ mxGraphModel.prototype.getDescendants = function(parent)
* and returns a boolean.
* parent - Optional <mxCell> that is used as the root of the recursion.
*/
mxGraphModel.prototype.filterDescendants = function(filter, parent)
filterDescendants = (filter, parent)=>
{
// Creates a new array for storing the result
var result = [];
@ -458,7 +458,7 @@ mxGraphModel.prototype.filterDescendants = function(filter, parent)
*
* cell - Optional <mxCell> that specifies the child.
*/
mxGraphModel.prototype.getRoot = function(cell)
getRoot = (cell)=>
{
var root = cell || this.root;
@ -494,7 +494,7 @@ mxGraphModel.prototype.getRoot = function(cell)
*
* root - <mxCell> that specifies the new root.
*/
mxGraphModel.prototype.setRoot = function(root)
setRoot = (root)=>
{
this.execute(new mxRootChange(this, root));
@ -511,7 +511,7 @@ mxGraphModel.prototype.setRoot = function(root)
*
* root - <mxCell> that specifies the new root.
*/
mxGraphModel.prototype.rootChanged = function(root)
rootChanged = (root)=>
{
var oldRoot = this.root;
this.root = root;
@ -534,7 +534,7 @@ mxGraphModel.prototype.rootChanged = function(root)
*
* cell - <mxCell> that represents the possible root.
*/
mxGraphModel.prototype.isRoot = function(cell)
isRoot = (cell)=>
{
return cell != null && this.root == cell;
};
@ -548,7 +548,7 @@ mxGraphModel.prototype.isRoot = function(cell)
*
* cell - <mxCell> that represents the possible layer.
*/
mxGraphModel.prototype.isLayer = function(cell)
isLayer = (cell)=>
{
return this.isRoot(this.getParent(cell));
};
@ -564,7 +564,7 @@ mxGraphModel.prototype.isLayer = function(cell)
* parent - <mxCell> that specifies the parent.
* child - <mxCell> that specifies the child.
*/
mxGraphModel.prototype.isAncestor = function(parent, child)
isAncestor = (parent, child)=>
{
while (child != null && child != parent)
{
@ -583,7 +583,7 @@ mxGraphModel.prototype.isAncestor = function(parent, child)
*
* cell - <mxCell> that specifies the cell.
*/
mxGraphModel.prototype.contains = function(cell)
contains = (cell)=>
{
return this.isAncestor(this.root, cell);
};
@ -597,7 +597,7 @@ mxGraphModel.prototype.contains = function(cell)
*
* cell - <mxCell> whose parent should be returned.
*/
mxGraphModel.prototype.getParent = function(cell)
getParent = (cell)=>
{
return (cell != null) ? cell.getParent() : null;
};
@ -616,7 +616,7 @@ mxGraphModel.prototype.getParent = function(cell)
* child - <mxCell> that specifies the child to be inserted.
* index - Optional integer that specifies the index of the child.
*/
mxGraphModel.prototype.add = function(parent, child, index)
add = (parent, child, index)=>
{
if (child != parent && parent != null && child != null)
{
@ -662,7 +662,7 @@ mxGraphModel.prototype.add = function(parent, child, index)
*
* cell - <mxCell> that specifies the cell that has been added.
*/
mxGraphModel.prototype.cellAdded = function(cell)
cellAdded = (cell)=>
{
if (cell != null)
{
@ -724,7 +724,7 @@ mxGraphModel.prototype.cellAdded = function(cell)
*
* cell - <mxCell> to create the Id for.
*/
mxGraphModel.prototype.createId = function(cell)
createId = (cell)=>
{
var id = this.nextId;
this.nextId++;
@ -738,7 +738,7 @@ mxGraphModel.prototype.createId = function(cell)
* Updates the parent for all edges that are connected to cell or one of
* its descendants using <updateEdgeParent>.
*/
mxGraphModel.prototype.updateEdgeParents = function(cell, root)
updateEdgeParents = (cell, root)=>
{
// Gets the topmost node of the hierarchy
root = root || this.getRoot(cell);
@ -786,7 +786,7 @@ mxGraphModel.prototype.updateEdgeParents = function(cell, root)
* edge - <mxCell> that specifies the edge.
* root - <mxCell> that represents the current root of the model.
*/
mxGraphModel.prototype.updateEdgeParent = function(edge, root)
updateEdgeParent = (edge, root)=>
{
var source = this.getTerminal(edge, true);
var target = this.getTerminal(edge, false);
@ -847,7 +847,7 @@ mxGraphModel.prototype.updateEdgeParent = function(edge, root)
* Returns the absolute, accumulated origin for the children inside the
* given parent as an <mxPoint>.
*/
mxGraphModel.prototype.getOrigin = function(cell)
getOrigin = (cell)=>
{
var result = null;
@ -884,7 +884,7 @@ mxGraphModel.prototype.getOrigin = function(cell)
* cell1 - <mxCell> that specifies the first cell in the tree.
* cell2 - <mxCell> that specifies the second cell in the tree.
*/
mxGraphModel.prototype.getNearestCommonAncestor = function(cell1, cell2)
getNearestCommonAncestor = (cell1, cell2)=>
{
if (cell1 != null && cell2 != null)
{
@ -937,7 +937,7 @@ mxGraphModel.prototype.getNearestCommonAncestor = function(cell1, cell2)
*
* cell - <mxCell> that should be removed.
*/
mxGraphModel.prototype.remove = function(cell)
remove = (cell)=>
{
if (cell == this.root)
{
@ -960,7 +960,7 @@ mxGraphModel.prototype.remove = function(cell)
*
* cell - <mxCell> that specifies the cell that has been removed.
*/
mxGraphModel.prototype.cellRemoved = function(cell)
cellRemoved = (cell)=>
{
if (cell != null && this.cells != null)
{
@ -993,7 +993,7 @@ mxGraphModel.prototype.cellRemoved = function(cell)
* index - Optional integer that defines the index of the child
* in the parent's child array.
*/
mxGraphModel.prototype.parentForCellChanged = function(cell, parent, index)
parentForCellChanged = (cell, parent, index)=>
{
var previous = this.getParent(cell);
@ -1035,7 +1035,7 @@ mxGraphModel.prototype.parentForCellChanged = function(cell, parent, index)
*
* cell - <mxCell> whose number of children should be returned.
*/
mxGraphModel.prototype.getChildCount = function(cell)
getChildCount = (cell)=>
{
return (cell != null) ? cell.getChildCount() : 0;
};
@ -1050,7 +1050,7 @@ mxGraphModel.prototype.getChildCount = function(cell)
* cell - <mxCell> that represents the parent.
* index - Integer that specifies the index of the child to be returned.
*/
mxGraphModel.prototype.getChildAt = function(cell, index)
getChildAt = (cell, index)=>
{
return (cell != null) ? cell.getChildAt(index) : null;
};
@ -1065,7 +1065,7 @@ mxGraphModel.prototype.getChildAt = function(cell, index)
*
* cell - <mxCell> the represents the parent.
*/
mxGraphModel.prototype.getChildren = function(cell)
getChildren = (cell)=>
{
return (cell != null) ? cell.children : null;
};
@ -1079,7 +1079,7 @@ mxGraphModel.prototype.getChildren = function(cell)
*
* cell - <mxCell> whose child vertices should be returned.
*/
mxGraphModel.prototype.getChildVertices = function(parent)
getChildVertices = (parent)=>
{
return this.getChildCells(parent, true, false);
};
@ -1093,7 +1093,7 @@ mxGraphModel.prototype.getChildVertices = function(parent)
*
* cell - <mxCell> whose child edges should be returned.
*/
mxGraphModel.prototype.getChildEdges = function(parent)
getChildEdges = (parent)=>
{
return this.getChildCells(parent, false, true);
};
@ -1112,7 +1112,7 @@ mxGraphModel.prototype.getChildEdges = function(parent)
* edges - Boolean indicating if child edges should be returned.
* Default is false.
*/
mxGraphModel.prototype.getChildCells = function(parent, vertices, edges)
getChildCells = (parent, vertices, edges)=>
{
vertices = (vertices != null) ? vertices : false;
edges = (edges != null) ? edges : false;
@ -1145,7 +1145,7 @@ mxGraphModel.prototype.getChildCells = function(parent, vertices, edges)
* edge - <mxCell> that specifies the edge.
* isSource - Boolean indicating which end of the edge should be returned.
*/
mxGraphModel.prototype.getTerminal = function(edge, isSource)
getTerminal = (edge, isSource)=>
{
return (edge != null) ? edge.getTerminal(isSource) : null;
};
@ -1165,7 +1165,7 @@ mxGraphModel.prototype.getTerminal = function(edge, isSource)
* isSource - Boolean indicating if the terminal is the new source or
* target terminal of the edge.
*/
mxGraphModel.prototype.setTerminal = function(edge, terminal, isSource)
setTerminal = (edge, terminal, isSource)=>
{
var terminalChanged = terminal != this.getTerminal(edge, isSource);
this.execute(new mxTerminalChange(this, edge, terminal, isSource));
@ -1190,7 +1190,7 @@ mxGraphModel.prototype.setTerminal = function(edge, terminal, isSource)
* source - <mxCell> that specifies the new source terminal.
* target - <mxCell> that specifies the new target terminal.
*/
mxGraphModel.prototype.setTerminals = function(edge, source, target)
setTerminals = (edge, source, target)=>
{
this.beginUpdate();
try
@ -1217,7 +1217,7 @@ mxGraphModel.prototype.setTerminals = function(edge, source, target)
* isSource - Boolean indicating if the terminal is the new source or
* target terminal of the edge.
*/
mxGraphModel.prototype.terminalForCellChanged = function(edge, terminal, isSource)
terminalForCellChanged = (edge, terminal, isSource)=>
{
var previous = this.getTerminal(edge, isSource);
@ -1242,7 +1242,7 @@ mxGraphModel.prototype.terminalForCellChanged = function(edge, terminal, isSourc
*
* cell - <mxCell> that represents the vertex.
*/
mxGraphModel.prototype.getEdgeCount = function(cell)
getEdgeCount = (cell)=>
{
return (cell != null) ? cell.getEdgeCount() : 0;
};
@ -1258,7 +1258,7 @@ mxGraphModel.prototype.getEdgeCount = function(cell)
* index - Integer that specifies the index of the edge
* to return.
*/
mxGraphModel.prototype.getEdgeAt = function(cell, index)
getEdgeAt = (cell, index)=>
{
return (cell != null) ? cell.getEdgeAt(index) : null;
};
@ -1276,7 +1276,7 @@ mxGraphModel.prototype.getEdgeAt = function(cell, index)
* incoming edges should be returned.
* ignoredEdge - <mxCell> that represents an edge to be ignored.
*/
mxGraphModel.prototype.getDirectedEdgeCount = function(cell, outgoing, ignoredEdge)
getDirectedEdgeCount = (cell, outgoing, ignoredEdge)=>
{
var count = 0;
var edgeCount = this.getEdgeCount(cell);
@ -1304,7 +1304,7 @@ mxGraphModel.prototype.getDirectedEdgeCount = function(cell, outgoing, ignoredEd
* cell - <mxCell> whose edges should be returned.
*
*/
mxGraphModel.prototype.getConnections = function(cell)
getConnections = (cell)=>
{
return this.getEdges(cell, true, true, false);
};
@ -1319,7 +1319,7 @@ mxGraphModel.prototype.getConnections = function(cell)
* cell - <mxCell> whose incoming edges should be returned.
*
*/
mxGraphModel.prototype.getIncomingEdges = function(cell)
getIncomingEdges = (cell)=>
{
return this.getEdges(cell, true, false, false);
};
@ -1334,7 +1334,7 @@ mxGraphModel.prototype.getIncomingEdges = function(cell)
* cell - <mxCell> whose outgoing edges should be returned.
*
*/
mxGraphModel.prototype.getOutgoingEdges = function(cell)
getOutgoingEdges = (cell)=>
{
return this.getEdges(cell, false, true, false);
};
@ -1357,7 +1357,7 @@ mxGraphModel.prototype.getOutgoingEdges = function(cell)
* includeLoops - Optional boolean that specifies if loops should be returned.
* Default is true.
*/
mxGraphModel.prototype.getEdges = function(cell, incoming, outgoing, includeLoops)
getEdges = (cell, incoming, outgoing, includeLoops)=>
{
incoming = (incoming != null) ? incoming : true;
outgoing = (outgoing != null) ? outgoing : true;
@ -1398,7 +1398,7 @@ mxGraphModel.prototype.getEdges = function(cell, incoming, outgoing, includeLoop
* directed - Optional boolean that specifies if the direction of the
* edge should be taken into account. Default is false.
*/
mxGraphModel.prototype.getEdgesBetween = function(source, target, directed)
getEdgesBetween = (source, target, directed)=>
{
directed = (directed != null) ? directed : false;
@ -1454,7 +1454,7 @@ mxGraphModel.prototype.getEdgesBetween = function(source, target, directed)
* targets - Boolean that specifies if target terminals should be contained
* in the result. Default is true.
*/
mxGraphModel.prototype.getOpposites = function(edges, terminal, sources, targets)
getOpposites = (edges, terminal, sources, targets)=>
{
sources = (sources != null) ? sources : true;
targets = (targets != null) ? targets : true;
@ -1500,7 +1500,7 @@ mxGraphModel.prototype.getOpposites = function(edges, terminal, sources, targets
*
* cells - Array of <mxCells> whose topmost ancestors should be returned.
*/
mxGraphModel.prototype.getTopmostCells = function(cells)
getTopmostCells = (cells)=>
{
var dict = new mxDictionary();
var tmp = [];
@ -1545,7 +1545,7 @@ mxGraphModel.prototype.getTopmostCells = function(cells)
*
* cell - <mxCell> that represents the possible vertex.
*/
mxGraphModel.prototype.isVertex = function(cell)
isVertex = (cell)=>
{
return (cell != null) ? cell.isVertex() : false;
};
@ -1559,7 +1559,7 @@ mxGraphModel.prototype.isVertex = function(cell)
*
* cell - <mxCell> that represents the possible edge.
*/
mxGraphModel.prototype.isEdge = function(cell)
isEdge = (cell)=>
{
return (cell != null) ? cell.isEdge() : false;
};
@ -1575,7 +1575,7 @@ mxGraphModel.prototype.isEdge = function(cell)
*
* cell - <mxCell> whose connectable state should be returned.
*/
mxGraphModel.prototype.isConnectable = function(cell)
isConnectable = (cell)=>
{
return (cell != null) ? cell.isConnectable() : false;
};
@ -1589,7 +1589,7 @@ mxGraphModel.prototype.isConnectable = function(cell)
*
* cell - <mxCell> whose user object should be returned.
*/
mxGraphModel.prototype.getValue = function(cell)
getValue = (cell)=>
{
return (cell != null) ? cell.getValue() : null;
};
@ -1605,7 +1605,7 @@ mxGraphModel.prototype.getValue = function(cell)
* cell - <mxCell> whose user object should be changed.
* value - Object that defines the new user object.
*/
mxGraphModel.prototype.setValue = function(cell, value)
setValue = (cell, value)=>
{
this.execute(new mxValueChange(this, cell, value));
@ -1623,7 +1623,7 @@ mxGraphModel.prototype.setValue = function(cell, value)
* used.
*
* (code)
* graph.getModel().valueForCellChanged = function(cell, value)
* graph.getModel().valueForCellChanged = (cell, value)=>
* {
* var previous = cell.value.getAttribute('label');
* cell.value.setAttribute('label', value);
@ -1632,7 +1632,7 @@ mxGraphModel.prototype.setValue = function(cell, value)
* };
* (end)
*/
mxGraphModel.prototype.valueForCellChanged = function(cell, value)
valueForCellChanged = (cell, value)=>
{
return cell.valueChanged(value);
};
@ -1646,7 +1646,7 @@ mxGraphModel.prototype.valueForCellChanged = function(cell, value)
*
* cell - <mxCell> whose geometry should be returned.
*/
mxGraphModel.prototype.getGeometry = function(cell)
getGeometry = (cell)=>
{
return (cell != null) ? cell.getGeometry() : null;
};
@ -1663,7 +1663,7 @@ mxGraphModel.prototype.getGeometry = function(cell)
* cell - <mxCell> whose geometry should be changed.
* geometry - <mxGeometry> that defines the new geometry.
*/
mxGraphModel.prototype.setGeometry = function(cell, geometry)
setGeometry = (cell, geometry)=>
{
if (geometry != this.getGeometry(cell))
{
@ -1679,7 +1679,7 @@ mxGraphModel.prototype.setGeometry = function(cell, geometry)
* Inner callback to update the <mxGeometry> of the given <mxCell> using
* <mxCell.setGeometry> and return the previous <mxGeometry>.
*/
mxGraphModel.prototype.geometryForCellChanged = function(cell, geometry)
geometryForCellChanged = (cell, geometry)=>
{
var previous = this.getGeometry(cell);
cell.setGeometry(geometry);
@ -1696,7 +1696,7 @@ mxGraphModel.prototype.geometryForCellChanged = function(cell, geometry)
*
* cell - <mxCell> whose style should be returned.
*/
mxGraphModel.prototype.getStyle = function(cell)
getStyle = (cell)=>
{
return (cell != null) ? cell.getStyle() : null;
};
@ -1713,7 +1713,7 @@ mxGraphModel.prototype.getStyle = function(cell)
* style - String of the form [stylename;|key=value;] to specify
* the new cell style.
*/
mxGraphModel.prototype.setStyle = function(cell, style)
setStyle = (cell, style)=>
{
if (style != this.getStyle(cell))
{
@ -1735,7 +1735,7 @@ mxGraphModel.prototype.setStyle = function(cell, style)
* style - String of the form [stylename;|key=value;] to specify
* the new cell style.
*/
mxGraphModel.prototype.styleForCellChanged = function(cell, style)
styleForCellChanged = (cell, style)=>
{
var previous = this.getStyle(cell);
cell.setStyle(style);
@ -1752,7 +1752,7 @@ mxGraphModel.prototype.styleForCellChanged = function(cell, style)
*
* cell - <mxCell> whose collapsed state should be returned.
*/
mxGraphModel.prototype.isCollapsed = function(cell)
isCollapsed = (cell)=>
{
return (cell != null) ? cell.isCollapsed() : false;
};
@ -1768,7 +1768,7 @@ mxGraphModel.prototype.isCollapsed = function(cell)
* cell - <mxCell> whose collapsed state should be changed.
* collapsed - Boolean that specifies the new collpased state.
*/
mxGraphModel.prototype.setCollapsed = function(cell, collapsed)
setCollapsed = (cell, collapsed)=>
{
if (collapsed != this.isCollapsed(cell))
{
@ -1790,7 +1790,7 @@ mxGraphModel.prototype.setCollapsed = function(cell, collapsed)
* cell - <mxCell> that specifies the cell to be updated.
* collapsed - Boolean that specifies the new collpased state.
*/
mxGraphModel.prototype.collapsedStateForCellChanged = function(cell, collapsed)
collapsedStateForCellChanged = (cell, collapsed)=>
{
var previous = this.isCollapsed(cell);
cell.setCollapsed(collapsed);
@ -1807,7 +1807,7 @@ mxGraphModel.prototype.collapsedStateForCellChanged = function(cell, collapsed)
*
* cell - <mxCell> whose visible state should be returned.
*/
mxGraphModel.prototype.isVisible = function(cell)
isVisible = (cell)=>
{
return (cell != null) ? cell.isVisible() : false;
};
@ -1823,7 +1823,7 @@ mxGraphModel.prototype.isVisible = function(cell)
* cell - <mxCell> whose visible state should be changed.
* visible - Boolean that specifies the new visible state.
*/
mxGraphModel.prototype.setVisible = function(cell, visible)
setVisible = (cell, visible)=>
{
if (visible != this.isVisible(cell))
{
@ -1845,7 +1845,7 @@ mxGraphModel.prototype.setVisible = function(cell, visible)
* cell - <mxCell> that specifies the cell to be updated.
* visible - Boolean that specifies the new visible state.
*/
mxGraphModel.prototype.visibleStateForCellChanged = function(cell, visible)
visibleStateForCellChanged = (cell, visible)=>
{
var previous = this.isVisible(cell);
cell.setVisible(visible);
@ -1868,7 +1868,7 @@ mxGraphModel.prototype.visibleStateForCellChanged = function(cell, visible)
*
* change - Object that described the change.
*/
mxGraphModel.prototype.execute = function(change)
execute = (change)=>
{
change.execute();
this.beginUpdate();
@ -1918,7 +1918,7 @@ mxGraphModel.prototype.execute = function(change)
* graph.addCells([v1, v2]).
* (end)
*/
mxGraphModel.prototype.beginUpdate = function()
beginUpdate = ()=>
{
this.updateLevel++;
this.fireEvent(new mxEventObject(mxEvent.BEGIN_UPDATE));
@ -1943,7 +1943,7 @@ mxGraphModel.prototype.beginUpdate = function()
* function is invoked, that is, on undo and redo of
* the edit.
*/
mxGraphModel.prototype.endUpdate = function()
endUpdate = ()=>
{
this.updateLevel--;
@ -1987,11 +1987,11 @@ mxGraphModel.prototype.endUpdate = function()
* significant - Optional boolean that specifies if the edit to be created is
* significant. Default is true.
*/
mxGraphModel.prototype.createUndoableEdit = function(significant)
createUndoableEdit = (significant)=>
{
var edit = new mxUndoableEdit(this, (significant != null) ? significant : true);
edit.notify = function()
edit.notify = ()=>
{
// LATER: Remove changes property (deprecated)
edit.source.fireEvent(new mxEventObject(mxEvent.CHANGE,
@ -2015,7 +2015,7 @@ mxGraphModel.prototype.createUndoableEdit = function(significant)
* id in the target model are reconnected to reflect the terminals of the
* source edges.
*/
mxGraphModel.prototype.mergeChildren = function(from, to, cloneAllEdges)
mergeChildren = (from, to, cloneAllEdges)=>
{
cloneAllEdges = (cloneAllEdges != null) ? cloneAllEdges : true;
@ -2062,7 +2062,7 @@ mxGraphModel.prototype.mergeChildren = function(from, to, cloneAllEdges)
* cell to the target cell with the same id or the clone of the source cell
* that was inserted into this model.
*/
mxGraphModel.prototype.mergeChildrenImpl = function(from, to, cloneAllEdges, mapping)
mergeChildrenImpl = (from, to, cloneAllEdges, mapping)=>
{
this.beginUpdate();
try
@ -2121,7 +2121,7 @@ mxGraphModel.prototype.mergeChildrenImpl = function(from, to, cloneAllEdges, map
*
* cells - Array of cells whose parents should be returned.
*/
mxGraphModel.prototype.getParents = function(cells)
getParents = (cells)=>
{
var parents = [];
@ -2160,7 +2160,7 @@ mxGraphModel.prototype.getParents = function(cells)
* includeChildren - Optional boolean indicating if the cells should be cloned
* with all descendants. Default is true.
*/
mxGraphModel.prototype.cloneCell = function(cell, includeChildren)
cloneCell = (cell, includeChildren)=>
{
if (cell != null)
{
@ -2185,7 +2185,7 @@ mxGraphModel.prototype.cloneCell = function(cell, includeChildren)
* with all descendants. Default is true.
* mapping - Optional mapping for existing clones.
*/
mxGraphModel.prototype.cloneCells = function(cells, includeChildren, mapping)
cloneCells = (cells, includeChildren, mapping)=>
{
includeChildren = (includeChildren != null) ? includeChildren : true;
mapping = (mapping != null) ? mapping : new Object();
@ -2219,7 +2219,7 @@ mxGraphModel.prototype.cloneCells = function(cells, includeChildren, mapping)
*
* Inner helper method for cloning cells recursively.
*/
mxGraphModel.prototype.cloneCellImpl = function(cell, mapping, includeChildren)
cloneCellImpl = (cell, mapping, includeChildren)=>
{
var ident = mxObjectIdentity.get(cell);
var clone = mapping[ident];
@ -2251,7 +2251,7 @@ mxGraphModel.prototype.cloneCellImpl = function(cell, mapping, includeChildren)
* Hook for cloning the cell. This returns cell.clone() or
* any possible exceptions.
*/
mxGraphModel.prototype.cellCloned = function(cell)
cellCloned = (cell)=>
{
return cell.clone();
};
@ -2262,7 +2262,7 @@ mxGraphModel.prototype.cellCloned = function(cell)
* Inner helper method for restoring the connections in
* a network of cloned cells.
*/
mxGraphModel.prototype.restoreClone = function(clone, cell, mapping)
restoreClone = (clone, cell, mapping)=>
{
var source = this.getTerminal(cell, true);
@ -2324,7 +2324,7 @@ function mxRootChange(model, root)
* Carries out a change of the root using
* <mxGraphModel.rootChanged>.
*/
mxRootChange.prototype.execute = function()
execute = ()=>
{
this.root = this.previous;
this.previous = this.model.rootChanged(this.previous);
@ -2358,7 +2358,7 @@ function mxChildChange(model, parent, child, index)
* removes or restores the cell's
* connections.
*/
mxChildChange.prototype.execute = function()
execute = ()=>
{
if (this.child != null)
{
@ -2392,7 +2392,7 @@ mxChildChange.prototype.execute = function()
* terminals and stores the previous terminal in the
* cell's terminals.
*/
mxChildChange.prototype.connect = function(cell, isConnect)
connect = (cell, isConnect)=>
{
isConnect = (isConnect != null) ? isConnect : true;
@ -2459,7 +2459,7 @@ function mxTerminalChange(model, cell, terminal, source)
* Changes the terminal of <cell> to <previous> using
* <mxGraphModel.terminalForCellChanged>.
*/
mxTerminalChange.prototype.execute = function()
execute = ()=>
{
if (this.cell != null)
{
@ -2493,7 +2493,7 @@ function mxValueChange(model, cell, value)
* Changes the value of <cell> to <previous> using
* <mxGraphModel.valueForCellChanged>.
*/
mxValueChange.prototype.execute = function()
execute = ()=>
{
if (this.cell != null)
{
@ -2527,7 +2527,7 @@ function mxStyleChange(model, cell, style)
* Changes the style of <cell> to <previous> using
* <mxGraphModel.styleForCellChanged>.
*/
mxStyleChange.prototype.execute = function()
execute = ()=>
{
if (this.cell != null)
{
@ -2561,7 +2561,7 @@ function mxGeometryChange(model, cell, geometry)
* Changes the geometry of <cell> ro <previous> using
* <mxGraphModel.geometryForCellChanged>.
*/
mxGeometryChange.prototype.execute = function()
execute = ()=>
{
if (this.cell != null)
{
@ -2595,7 +2595,7 @@ function mxCollapseChange(model, cell, collapsed)
* Changes the collapsed state of <cell> to <previous> using
* <mxGraphModel.collapsedStateForCellChanged>.
*/
mxCollapseChange.prototype.execute = function()
execute = ()=>
{
if (this.cell != null)
{
@ -2629,7 +2629,7 @@ function mxVisibleChange(model, cell, visible)
* Changes the visible state of <cell> to <previous> using
* <mxGraphModel.visibleStateForCellChanged>.
*/
mxVisibleChange.prototype.execute = function()
execute = ()=>
{
if (this.cell != null)
{
@ -2685,7 +2685,7 @@ function mxCellAttributeChange(cell, attribute, value)
* Changes the attribute of the cell's user object by
* using <mxCell.setAttribute>.
*/
mxCellAttributeChange.prototype.execute = function()
execute = ()=>
{
if (this.cell != null)
{

View File

@ -265,7 +265,7 @@ var mxClient =
* }
* (end)
*/
isBrowserSupported: function()
isBrowserSupported: ()=>
{
return mxClient.IS_VML || mxClient.IS_SVG;
},
@ -290,7 +290,7 @@ var mxClient =
* doc - Optional parent document of the link node.
* id - unique id for the link element to check if it already exists
*/
link: function(rel, href, doc, id)
link: (rel, href, doc, id)=>
{
doc = doc || document;
@ -328,7 +328,7 @@ var mxClient =
* fn - Function to call after all resources have been loaded.
* lan - Optional string to pass to <mxResources.add>.
*/
loadResources: function(fn, lan)
loadResources: (fn, lan)=>
{
var pending = mxClient.defaultBundles.length;
@ -356,7 +356,7 @@ var mxClient =
* function should only be used in development environments, but not in
* production systems.
*/
include: function(src)
include: (src)=>
{
document.write('<script src="'+src+'"></script>');
}
@ -624,7 +624,7 @@ if (mxClient.IS_VML)
// Workaround for limited number of stylesheets in IE (does not work in standards mode)
if (mxClient.IS_QUIRKS && document.styleSheets.length >= 30)
{
(function()
(()=>
{
var node = document.createElement('style');
node.type = 'text/css';

View File

@ -14,10 +14,10 @@
* function SampleShape() { }
*
* SampleShape.prototype = new mxActor();
* SampleShape.prototype.constructor = vsAseShape;
* constructor = vsAseShape;
*
* mxCellRenderer.registerShape('sample', SampleShape);
* SampleShape.prototype.redrawPath = function(path, x, y, w, h)
* redrawPath = (path, x, y, w, h)=>
* {
* path.moveTo(0, 0);
* path.lineTo(w, h);
@ -61,7 +61,7 @@ mxUtils.extend(mxActor, mxShape);
*
* Redirects to redrawPath for subclasses to work.
*/
mxActor.prototype.paintVertexShape = function(c, x, y, w, h)
paintVertexShape = (c, x, y, w, h)=>
{
c.translate(x, y);
c.begin();
@ -74,7 +74,7 @@ mxActor.prototype.paintVertexShape = function(c, x, y, w, h)
*
* Draws the path for this shape.
*/
mxActor.prototype.redrawPath = function(c, x, y, w, h)
redrawPath = (c, x, y, w, h)=>
{
var width = w/3;
c.moveTo(0, h);

View File

@ -52,9 +52,9 @@ mxUtils.extend(mxArrow, mxShape);
*
* Augments the bounding box with the edge width and markers.
*/
mxArrow.prototype.augmentBoundingBox = function(bbox)
augmentBoundingBox = (bbox)=>
{
mxShape.prototype.augmentBoundingBox.apply(this, arguments);
augmentBoundingBox.apply(this, arguments);
var w = Math.max(this.arrowWidth, this.endSize);
bbox.grow((w / 2 + this.strokewidth) * this.scale);
@ -65,7 +65,7 @@ mxArrow.prototype.augmentBoundingBox = function(bbox)
*
* Paints the line shape.
*/
mxArrow.prototype.paintEdgeShape = function(c, pts)
paintEdgeShape = (c, pts)=>
{
// Geometry of arrow
var spacing = mxConstants.ARROW_SPACING;

View File

@ -54,14 +54,14 @@ mxUtils.extend(mxArrowConnector, mxShape);
* Allows to use the SVG bounding box in SVG. Default is false for performance
* reasons.
*/
mxArrowConnector.prototype.useSvgBoundingBox = true;
useSvgBoundingBox = true;
/**
* Function: isRoundable
*
* Hook for subclassers.
*/
mxArrowConnector.prototype.isRoundable = function()
isRoundable = ()=>
{
return true;
};
@ -71,9 +71,9 @@ mxArrowConnector.prototype.isRoundable = function()
*
* Overrides mxShape to reset spacing.
*/
mxArrowConnector.prototype.resetStyles = function()
resetStyles = ()=>
{
mxShape.prototype.resetStyles.apply(this, arguments);
resetStyles.apply(this, arguments);
this.arrowSpacing = mxConstants.ARROW_SPACING;
};
@ -81,9 +81,9 @@ mxArrowConnector.prototype.resetStyles = function()
/**
* Overrides apply to get smooth transition from default start- and endsize.
*/
mxArrowConnector.prototype.apply = function(state)
apply = (state)=>
{
mxShape.prototype.apply.apply(this, arguments);
apply.apply(this, arguments);
if (this.style != null)
{
@ -97,9 +97,9 @@ mxArrowConnector.prototype.apply = function(state)
*
* Augments the bounding box with the edge width and markers.
*/
mxArrowConnector.prototype.augmentBoundingBox = function(bbox)
augmentBoundingBox = (bbox)=>
{
mxShape.prototype.augmentBoundingBox.apply(this, arguments);
augmentBoundingBox.apply(this, arguments);
var w = this.getEdgeWidth();
@ -121,7 +121,7 @@ mxArrowConnector.prototype.augmentBoundingBox = function(bbox)
*
* Paints the line shape.
*/
mxArrowConnector.prototype.paintEdgeShape = function(c, pts)
paintEdgeShape = (c, pts)=>
{
// Geometry of arrow
var strokeWidth = this.strokewidth;
@ -203,7 +203,7 @@ mxArrowConnector.prototype.paintEdgeShape = function(c, pts)
{
c.moveTo(outStartX, outStartY);
fns.push(function()
fns.push(()=>
{
c.lineTo(inEndX, inEndY);
});
@ -263,9 +263,9 @@ mxArrowConnector.prototype.paintEdgeShape = function(c, pts)
// just draw straight to the intersection point
c.lineTo(outX, outY);
(function(x, y)
((x, y)=>
{
fns.push(function()
fns.push(()=>
{
c.lineTo(x, y);
});
@ -280,9 +280,9 @@ mxArrowConnector.prototype.paintEdgeShape = function(c, pts)
c.lineTo(c1x, c1y);
c.quadTo(outX, outY, c2x, c2y);
(function(x, y)
((x, y)=>
{
fns.push(function()
fns.push(()=>
{
c.lineTo(x, y);
});
@ -292,18 +292,18 @@ mxArrowConnector.prototype.paintEdgeShape = function(c, pts)
{
c.lineTo(outX, outY);
(function(x, y)
((x, y)=>
{
var c1x = outX - ny * edgeWidth;
var c1y = outY + nx * edgeWidth;
var c2x = outX - ny1 * edgeWidth;
var c2y = outY + nx1 * edgeWidth;
fns.push(function()
fns.push(()=>
{
c.quadTo(x, y, c1x, c1y);
});
fns.push(function()
fns.push(()=>
{
c.lineTo(c2x, c2y);
});
@ -338,7 +338,7 @@ mxArrowConnector.prototype.paintEdgeShape = function(c, pts)
{
c.moveTo(inStartX, inStartY);
fns.splice(0, 0, function()
fns.splice(0, 0, ()=>
{
c.moveTo(inStartX, inStartY);
});
@ -400,7 +400,7 @@ mxArrowConnector.prototype.paintEdgeShape = function(c, pts)
*
* Paints the marker.
*/
mxArrowConnector.prototype.paintMarker = function(c, ptX, ptY, nx, ny, size, arrowWidth, edgeWidth, spacing, initialMove)
paintMarker = (c, ptX, ptY, nx, ny, size, arrowWidth, edgeWidth, spacing, initialMove)=>
{
var widthArrowRatio = edgeWidth / arrowWidth;
var orthx = edgeWidth * ny / 2;
@ -429,7 +429,7 @@ mxArrowConnector.prototype.paintMarker = function(c, ptX, ptY, nx, ny, size, arr
*
* Returns wether the arrow is rounded
*/
mxArrowConnector.prototype.isArrowRounded = function()
isArrowRounded = ()=>
{
return this.isRounded;
};
@ -439,7 +439,7 @@ mxArrowConnector.prototype.isArrowRounded = function()
*
* Returns the width of the start arrow
*/
mxArrowConnector.prototype.getStartArrowWidth = function()
getStartArrowWidth = ()=>
{
return mxConstants.ARROW_WIDTH;
};
@ -449,7 +449,7 @@ mxArrowConnector.prototype.getStartArrowWidth = function()
*
* Returns the width of the end arrow
*/
mxArrowConnector.prototype.getEndArrowWidth = function()
getEndArrowWidth = ()=>
{
return mxConstants.ARROW_WIDTH;
};
@ -459,7 +459,7 @@ mxArrowConnector.prototype.getEndArrowWidth = function()
*
* Returns the width of the body of the edge
*/
mxArrowConnector.prototype.getEdgeWidth = function()
getEdgeWidth = ()=>
{
return mxConstants.ARROW_WIDTH / 3;
};
@ -469,7 +469,7 @@ mxArrowConnector.prototype.getEdgeWidth = function()
*
* Returns whether the ends of the shape are drawn
*/
mxArrowConnector.prototype.isOpenEnded = function()
isOpenEnded = ()=>
{
return false;
};
@ -479,7 +479,7 @@ mxArrowConnector.prototype.isOpenEnded = function()
*
* Returns whether the start marker is drawn
*/
mxArrowConnector.prototype.isMarkerStart = function()
isMarkerStart = ()=>
{
return (mxUtils.getValue(this.style, mxConstants.STYLE_STARTARROW, mxConstants.NONE) != mxConstants.NONE);
};
@ -489,7 +489,7 @@ mxArrowConnector.prototype.isMarkerStart = function()
*
* Returns whether the end marker is drawn
*/
mxArrowConnector.prototype.isMarkerEnd = function()
isMarkerEnd = ()=>
{
return (mxUtils.getValue(this.style, mxConstants.STYLE_ENDARROW, mxConstants.NONE) != mxConstants.NONE);
};

View File

@ -42,7 +42,7 @@ mxUtils.extend(mxCloud, mxActor);
*
* Draws the path for this shape.
*/
mxCloud.prototype.redrawPath = function(c, x, y, w, h)
redrawPath = (c, x, y, w, h)=>
{
c.moveTo(0.25 * w, 0.25 * h);
c.curveTo(0.05 * w, 0.25 * h, 0, 0.5 * h, 0.16 * w, 0.55 * h);

View File

@ -40,10 +40,10 @@ mxUtils.extend(mxConnector, mxPolyline);
* Updates the <boundingBox> for this shape using <createBoundingBox> and
* <augmentBoundingBox> and stores the result in <boundingBox>.
*/
mxConnector.prototype.updateBoundingBox = function()
updateBoundingBox = ()=>
{
this.useSvgBoundingBox = this.style != null && this.style[mxConstants.STYLE_CURVED] == 1;
mxShape.prototype.updateBoundingBox.apply(this, arguments);
updateBoundingBox.apply(this, arguments);
};
/**
@ -51,7 +51,7 @@ mxConnector.prototype.updateBoundingBox = function()
*
* Paints the line shape.
*/
mxConnector.prototype.paintEdgeShape = function(c, pts)
paintEdgeShape = (c, pts)=>
{
// The indirection via functions for markers is needed in
// order to apply the offsets before painting the line and
@ -59,7 +59,7 @@ mxConnector.prototype.paintEdgeShape = function(c, pts)
var sourceMarker = this.createMarker(c, pts, true);
var targetMarker = this.createMarker(c, pts, false);
mxPolyline.prototype.paintEdgeShape.apply(this, arguments);
paintEdgeShape.apply(this, arguments);
// Disables shadows, dashed styles and fixes fill color for markers
c.setFillColor(this.stroke);
@ -83,7 +83,7 @@ mxConnector.prototype.paintEdgeShape = function(c, pts)
* Prepares the marker by adding offsets in pts and returning a function to
* paint the marker.
*/
mxConnector.prototype.createMarker = function(c, pts, source)
createMarker = (c, pts, source)=>
{
var result = null;
var n = pts.length;
@ -128,9 +128,9 @@ mxConnector.prototype.createMarker = function(c, pts, source)
*
* Augments the bounding box with the strokewidth and shadow offsets.
*/
mxConnector.prototype.augmentBoundingBox = function(bbox)
augmentBoundingBox = (bbox)=>
{
mxShape.prototype.augmentBoundingBox.apply(this, arguments);
augmentBoundingBox.apply(this, arguments);
// Adds marker sizes
var size = 0;

View File

@ -44,21 +44,21 @@ mxUtils.extend(mxCylinder, mxShape);
* Defines the maximum height of the top and bottom part
* of the cylinder shape.
*/
mxCylinder.prototype.maxHeight = 40;
maxHeight = 40;
/**
* Variable: svgStrokeTolerance
*
* Sets stroke tolerance to 0 for SVG.
*/
mxCylinder.prototype.svgStrokeTolerance = 0;
svgStrokeTolerance = 0;
/**
* Function: paintVertexShape
*
* Redirects to redrawPath for subclasses to work.
*/
mxCylinder.prototype.paintVertexShape = function(c, x, y, w, h)
paintVertexShape = (c, x, y, w, h)=>
{
c.translate(x, y);
c.begin();
@ -80,7 +80,7 @@ mxCylinder.prototype.paintVertexShape = function(c, x, y, w, h)
*
* Returns the cylinder size.
*/
mxCylinder.prototype.getCylinderSize = function(x, y, w, h)
getCylinderSize = (x, y, w, h)=>
{
return Math.min(this.maxHeight, Math.round(h / 5));
};
@ -90,7 +90,7 @@ mxCylinder.prototype.getCylinderSize = function(x, y, w, h)
*
* Draws the path for this shape.
*/
mxCylinder.prototype.redrawPath = function(c, x, y, w, h, isForeground)
redrawPath = (c, x, y, w, h, isForeground)=>
{
var dy = this.getCylinderSize(x, y, w, h);

View File

@ -10,7 +10,7 @@
* Use the following override to only fill the inner ellipse in this shape:
*
* (code)
* mxDoubleEllipse.prototype.paintVertexShape = function(c, x, y, w, h)
* paintVertexShape = (c, x, y, w, h)=>
* {
* c.ellipse(x, y, w, h);
* c.stroke();
@ -62,14 +62,14 @@ mxUtils.extend(mxDoubleEllipse, mxShape);
*
* Scale for improving the precision of VML rendering. Default is 10.
*/
mxDoubleEllipse.prototype.vmlScale = 10;
vmlScale = 10;
/**
* Function: paintBackground
*
* Paints the background.
*/
mxDoubleEllipse.prototype.paintBackground = function(c, x, y, w, h)
paintBackground = (c, x, y, w, h)=>
{
c.ellipse(x, y, w, h);
c.fillAndStroke();
@ -80,7 +80,7 @@ mxDoubleEllipse.prototype.paintBackground = function(c, x, y, w, h)
*
* Paints the foreground.
*/
mxDoubleEllipse.prototype.paintForeground = function(c, x, y, w, h)
paintForeground = (c, x, y, w, h)=>
{
if (!this.outline)
{
@ -105,7 +105,7 @@ mxDoubleEllipse.prototype.paintForeground = function(c, x, y, w, h)
*
* Returns the bounds for the label.
*/
mxDoubleEllipse.prototype.getLabelBounds = function(rect)
getLabelBounds = (rect)=>
{
var margin = (mxUtils.getValue(this.style, mxConstants.STYLE_MARGIN, Math.min(3 + this.strokewidth,
Math.min(rect.width / 5 / this.scale, rect.height / 5 / this.scale)))) * this.scale;

View File

@ -41,7 +41,7 @@ mxUtils.extend(mxEllipse, mxShape);
*
* Paints the ellipse shape.
*/
mxEllipse.prototype.paintVertexShape = function(c, x, y, w, h)
paintVertexShape = (c, x, y, w, h)=>
{
c.ellipse(x, y, w, h);
c.fillAndStroke();

View File

@ -26,7 +26,7 @@ mxUtils.extend(mxHexagon, mxActor);
*
* Draws the path for this shape.
*/
mxHexagon.prototype.redrawPath = function(c, x, y, w, h)
redrawPath = (c, x, y, w, h)=>
{
var arcSize = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, mxConstants.LINE_ARCSIZE) / 2;
this.addPoints(c, [new mxPoint(0.25 * w, 0), new mxPoint(0.75 * w, 0), new mxPoint(w, 0.5 * h), new mxPoint(0.75 * w, h),

View File

@ -44,14 +44,14 @@ mxUtils.extend(mxImageShape, mxRectangleShape);
*
* Switch to preserve image aspect. Default is true.
*/
mxImageShape.prototype.preserveImageAspect = true;
preserveImageAspect = true;
/**
* Function: getSvgScreenOffset
*
* Disables offset in IE9 for crisper image output.
*/
mxImageShape.prototype.getSvgScreenOffset = function()
getSvgScreenOffset = ()=>
{
return 0;
};
@ -73,9 +73,9 @@ mxImageShape.prototype.getSvgScreenOffset = function()
*
* state - <mxCellState> of the corresponding cell.
*/
mxImageShape.prototype.apply = function(state)
apply = (state)=>
{
mxShape.prototype.apply.apply(this, arguments);
apply.apply(this, arguments);
this.fill = null;
this.stroke = null;
@ -97,7 +97,7 @@ mxImageShape.prototype.apply = function(state)
* Returns true if HTML is allowed for this shape. This implementation always
* returns false.
*/
mxImageShape.prototype.isHtmlAllowed = function()
isHtmlAllowed = ()=>
{
return !this.preserveImageAspect;
};
@ -109,7 +109,7 @@ mxImageShape.prototype.isHtmlAllowed = function()
* this shape. This implementation falls back to <createVml>
* so that the HTML creation is optional.
*/
mxImageShape.prototype.createHtml = function()
createHtml = ()=>
{
var node = document.createElement('div');
node.style.position = 'absolute';
@ -122,7 +122,7 @@ mxImageShape.prototype.createHtml = function()
*
* Disables inherited roundable support.
*/
mxImageShape.prototype.isRoundable = function(c, x, y, w, h)
isRoundable = (c, x, y, w, h)=>
{
return false;
};
@ -132,7 +132,7 @@ mxImageShape.prototype.isRoundable = function(c, x, y, w, h)
*
* Generic background painting implementation.
*/
mxImageShape.prototype.paintVertexShape = function(c, x, y, w, h)
paintVertexShape = (c, x, y, w, h)=>
{
if (this.image != null)
{
@ -163,7 +163,7 @@ mxImageShape.prototype.paintVertexShape = function(c, x, y, w, h)
}
else
{
mxRectangleShape.prototype.paintBackground.apply(this, arguments);
paintBackground.apply(this, arguments);
}
};
@ -172,7 +172,7 @@ mxImageShape.prototype.paintVertexShape = function(c, x, y, w, h)
*
* Overrides <mxShape.redraw> to preserve the aspect ratio of images.
*/
mxImageShape.prototype.redrawHtmlShape = function()
redrawHtmlShape = ()=>
{
this.node.style.left = Math.round(this.bounds.x) + 'px';
this.node.style.top = Math.round(this.bounds.y) + 'px';

View File

@ -38,37 +38,37 @@ mxUtils.extend(mxLabel, mxRectangleShape);
* Default width and height for the image. Default is
* <mxConstants.DEFAULT_IMAGESIZE>.
*/
mxLabel.prototype.imageSize = mxConstants.DEFAULT_IMAGESIZE;
imageSize = mxConstants.DEFAULT_IMAGESIZE;
/**
* Variable: spacing
*
* Default value for image spacing. Default is 2.
*/
mxLabel.prototype.spacing = 2;
spacing = 2;
/**
* Variable: indicatorSize
*
* Default width and height for the indicicator. Default is 10.
*/
mxLabel.prototype.indicatorSize = 10;
indicatorSize = 10;
/**
* Variable: indicatorSpacing
*
* Default spacing between image and indicator. Default is 2.
*/
mxLabel.prototype.indicatorSpacing = 2;
indicatorSpacing = 2;
/**
* Function: init
*
* Initializes the shape and the <indicator>.
*/
mxLabel.prototype.init = function(container)
init = (container)=>
{
mxShape.prototype.init.apply(this, arguments);
init.apply(this, arguments);
if (this.indicatorShape != null)
{
@ -84,7 +84,7 @@ mxLabel.prototype.init = function(container)
* Reconfigures this shape. This will update the colors of the indicator
* and reconfigure it if required.
*/
mxLabel.prototype.redraw = function()
redraw = ()=>
{
if (this.indicator != null)
{
@ -95,7 +95,7 @@ mxLabel.prototype.redraw = function()
this.indicator.redraw();
}
mxShape.prototype.redraw.apply(this, arguments);
redraw.apply(this, arguments);
};
/**
@ -104,9 +104,9 @@ mxLabel.prototype.redraw = function()
* Returns true for non-rounded, non-rotated shapes with no glass gradient and
* no indicator shape.
*/
mxLabel.prototype.isHtmlAllowed = function()
isHtmlAllowed = ()=>
{
return mxRectangleShape.prototype.isHtmlAllowed.apply(this, arguments) &&
return isHtmlAllowed.apply(this, arguments) &&
this.indicatorColor == null && this.indicatorShape == null;
};
@ -115,12 +115,12 @@ mxLabel.prototype.isHtmlAllowed = function()
*
* Generic background painting implementation.
*/
mxLabel.prototype.paintForeground = function(c, x, y, w, h)
paintForeground = (c, x, y, w, h)=>
{
this.paintImage(c, x, y, w, h);
this.paintIndicator(c, x, y, w, h);
mxRectangleShape.prototype.paintForeground.apply(this, arguments);
paintForeground.apply(this, arguments);
};
/**
@ -128,7 +128,7 @@ mxLabel.prototype.paintForeground = function(c, x, y, w, h)
*
* Generic background painting implementation.
*/
mxLabel.prototype.paintImage = function(c, x, y, w, h)
paintImage = (c, x, y, w, h)=>
{
if (this.image != null)
{
@ -142,7 +142,7 @@ mxLabel.prototype.paintImage = function(c, x, y, w, h)
*
* Generic background painting implementation.
*/
mxLabel.prototype.getImageBounds = function(x, y, w, h)
getImageBounds = (x, y, w, h)=>
{
var align = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_ALIGN, mxConstants.ALIGN_LEFT);
var valign = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE);
@ -184,7 +184,7 @@ mxLabel.prototype.getImageBounds = function(x, y, w, h)
*
* Generic background painting implementation.
*/
mxLabel.prototype.paintIndicator = function(c, x, y, w, h)
paintIndicator = (c, x, y, w, h)=>
{
if (this.indicator != null)
{
@ -203,7 +203,7 @@ mxLabel.prototype.paintIndicator = function(c, x, y, w, h)
*
* Generic background painting implementation.
*/
mxLabel.prototype.getIndicatorBounds = function(x, y, w, h)
getIndicatorBounds = (x, y, w, h)=>
{
var align = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_ALIGN, mxConstants.ALIGN_LEFT);
var valign = mxUtils.getValue(this.style, mxConstants.STYLE_IMAGE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE);
@ -244,9 +244,9 @@ mxLabel.prototype.getIndicatorBounds = function(x, y, w, h)
*
* Generic background painting implementation.
*/
mxLabel.prototype.redrawHtmlShape = function()
redrawHtmlShape = ()=>
{
mxRectangleShape.prototype.redrawHtmlShape.apply(this, arguments);
redrawHtmlShape.apply(this, arguments);
// Removes all children
while(this.node.hasChildNodes())

View File

@ -41,14 +41,14 @@ mxUtils.extend(mxLine, mxShape);
*
* Whether to paint a vertical line.
*/
mxLine.prototype.vertical = false;
vertical = false;
/**
* Function: paintVertexShape
*
* Redirects to redrawPath for subclasses to work.
*/
mxLine.prototype.paintVertexShape = function(c, x, y, w, h)
paintVertexShape = (c, x, y, w, h)=>
{
c.begin();

View File

@ -22,7 +22,7 @@ var mxMarker =
* Adds a factory method that updates a given endpoint and returns a
* function to paint the marker onto the given canvas.
*/
addMarker: function(type, funct)
addMarker: (type, funct)=>
{
mxMarker.markers[type] = funct;
},
@ -32,7 +32,7 @@ var mxMarker =
*
* Returns a function to paint the given marker.
*/
createMarker: function(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)
createMarker: (canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)=>
{
var funct = mxMarker.markers[type];
@ -44,13 +44,13 @@ var mxMarker =
/**
* Adds the classic and block marker factory method.
*/
(function()
(()=>
{
function createArrow(widthFactor)
{
widthFactor = (widthFactor != null) ? widthFactor : 2;
return function(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)
return (canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)=>
{
// The angle of the forward facing arrow sides against the x axis is
// 26.565 degrees, 1/sin(26.565) = 2.236 / 2 = 1.118 ( / 2 allows for
@ -69,7 +69,7 @@ var mxMarker =
pe.x += -unitX * f - endOffsetX;
pe.y += -unitY * f - endOffsetY;
return function()
return ()=>
{
canvas.begin();
canvas.moveTo(pt.x, pt.y);
@ -104,7 +104,7 @@ var mxMarker =
{
widthFactor = (widthFactor != null) ? widthFactor : 2;
return function(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)
return (canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)=>
{
// The angle of the forward facing arrow sides against the x axis is
// 26.565 degrees, 1/sin(26.565) = 2.236 / 2 = 1.118 ( / 2 allows for
@ -122,7 +122,7 @@ var mxMarker =
pe.x += -endOffsetX * 2;
pe.y += -endOffsetY * 2;
return function()
return ()=>
{
canvas.begin();
canvas.moveTo(pt.x - unitX - unitY / widthFactor, pt.y - unitY + unitX / widthFactor);
@ -136,7 +136,7 @@ var mxMarker =
mxMarker.addMarker('open', createOpenArrow(2));
mxMarker.addMarker('openThin', createOpenArrow(3));
mxMarker.addMarker('oval', function(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)
mxMarker.addMarker('oval', (canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)=>
{
var a = size / 2;
@ -144,7 +144,7 @@ var mxMarker =
pe.x -= unitX * a;
pe.y -= unitY * a;
return function()
return ()=>
{
canvas.ellipse(pt.x - a, pt.y - a, size, size);
@ -183,7 +183,7 @@ var mxMarker =
// thickness factor for diamond
var tk = ((type == mxConstants.ARROW_DIAMOND) ? 2 : 3.4);
return function()
return ()=>
{
canvas.begin();
canvas.moveTo(pt.x, pt.y);

View File

@ -40,7 +40,7 @@ mxUtils.extend(mxPolyline, mxShape);
*
* Returns 0.
*/
mxPolyline.prototype.getRotation = function()
getRotation = ()=>
{
return 0;
};
@ -50,7 +50,7 @@ mxPolyline.prototype.getRotation = function()
*
* Returns 0.
*/
mxPolyline.prototype.getShapeRotation = function()
getShapeRotation = ()=>
{
return 0;
};
@ -60,7 +60,7 @@ mxPolyline.prototype.getShapeRotation = function()
*
* Returns false.
*/
mxPolyline.prototype.isPaintBoundsInverted = function()
isPaintBoundsInverted = ()=>
{
return false;
};
@ -70,7 +70,7 @@ mxPolyline.prototype.isPaintBoundsInverted = function()
*
* Paints the line shape.
*/
mxPolyline.prototype.paintEdgeShape = function(c, pts)
paintEdgeShape = (c, pts)=>
{
var prev = c.pointerEventsValue;
c.pointerEventsValue = 'stroke';
@ -92,7 +92,7 @@ mxPolyline.prototype.paintEdgeShape = function(c, pts)
*
* Paints the line shape.
*/
mxPolyline.prototype.paintLine = function(c, pts, rounded)
paintLine = (c, pts, rounded)=>
{
var arcSize = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, mxConstants.LINE_ARCSIZE) / 2;
c.begin();
@ -105,7 +105,7 @@ mxPolyline.prototype.paintLine = function(c, pts, rounded)
*
* Paints a curved line.
*/
mxPolyline.prototype.paintCurvedLine = function(c, pts)
paintCurvedLine = (c, pts)=>
{
c.begin();

View File

@ -41,7 +41,7 @@ mxUtils.extend(mxRectangleShape, mxShape);
*
* Returns true for non-rounded, non-rotated shapes with no glass gradient.
*/
mxRectangleShape.prototype.isHtmlAllowed = function()
isHtmlAllowed = ()=>
{
var events = true;
@ -59,7 +59,7 @@ mxRectangleShape.prototype.isHtmlAllowed = function()
*
* Generic background painting implementation.
*/
mxRectangleShape.prototype.paintBackground = function(c, x, y, w, h)
paintBackground = (c, x, y, w, h)=>
{
var events = true;
@ -108,7 +108,7 @@ mxRectangleShape.prototype.paintBackground = function(c, x, y, w, h)
*
* Adds roundable support.
*/
mxRectangleShape.prototype.isRoundable = function(c, x, y, w, h)
isRoundable = (c, x, y, w, h)=>
{
return true;
};
@ -118,7 +118,7 @@ mxRectangleShape.prototype.isRoundable = function(c, x, y, w, h)
*
* Generic background painting implementation.
*/
mxRectangleShape.prototype.paintForeground = function(c, x, y, w, h)
paintForeground = (c, x, y, w, h)=>
{
if (this.glass && !this.outline && this.fill != null && this.fill != mxConstants.NONE)
{

View File

@ -41,7 +41,7 @@ mxUtils.extend(mxRhombus, mxShape);
*
* Adds roundable support.
*/
mxRhombus.prototype.isRoundable = function()
isRoundable = ()=>
{
return true;
};
@ -51,7 +51,7 @@ mxRhombus.prototype.isRoundable = function()
*
* Generic painting implementation.
*/
mxRhombus.prototype.paintVertexShape = function(c, x, y, w, h)
paintVertexShape = (c, x, y, w, h)=>
{
var hw = w / 2;
var hh = h / 2;

View File

@ -34,7 +34,7 @@
* function CustomShape() { }
*
* CustomShape.prototype = new mxShape();
* CustomShape.prototype.constructor = CustomShape;
* constructor = CustomShape;
* (end)
*
* To register a custom shape in an existing graph instance,
@ -72,63 +72,63 @@ function mxShape(stencil)
* Holds the dialect in which the shape is to be painted.
* This can be one of the DIALECT constants in <mxConstants>.
*/
mxShape.prototype.dialect = null;
dialect = null;
/**
* Variable: scale
*
* Holds the scale in which the shape is being painted.
*/
mxShape.prototype.scale = 1;
scale = 1;
/**
* Variable: antiAlias
*
* Rendering hint for configuring the canvas.
*/
mxShape.prototype.antiAlias = true;
antiAlias = true;
/**
* Variable: minSvgStrokeWidth
*
* Minimum stroke width for SVG output.
*/
mxShape.prototype.minSvgStrokeWidth = 1;
minSvgStrokeWidth = 1;
/**
* Variable: bounds
*
* Holds the <mxRectangle> that specifies the bounds of this shape.
*/
mxShape.prototype.bounds = null;
bounds = null;
/**
* Variable: points
*
* Holds the array of <mxPoints> that specify the points of this shape.
*/
mxShape.prototype.points = null;
points = null;
/**
* Variable: node
*
* Holds the outermost DOM node that represents this shape.
*/
mxShape.prototype.node = null;
node = null;
/**
* Variable: state
*
* Optional reference to the corresponding <mxCellState>.
*/
mxShape.prototype.state = null;
state = null;
/**
* Variable: style
*
* Optional reference to the style of the corresponding <mxCellState>.
*/
mxShape.prototype.style = null;
style = null;
/**
* Variable: boundingBox
@ -136,14 +136,14 @@ mxShape.prototype.style = null;
* Contains the bounding box of the shape, that is, the smallest rectangle
* that includes all pixels of the shape.
*/
mxShape.prototype.boundingBox = null;
boundingBox = null;
/**
* Variable: stencil
*
* Holds the <mxStencil> that defines the shape.
*/
mxShape.prototype.stencil = null;
stencil = null;
/**
* Variable: svgStrokeTolerance
@ -151,21 +151,21 @@ mxShape.prototype.stencil = null;
* Event-tolerance for SVG strokes (in px). Default is 8. This is only passed
* to the canvas in <createSvgCanvas> if <pointerEvents> is true.
*/
mxShape.prototype.svgStrokeTolerance = 8;
svgStrokeTolerance = 8;
/**
* Variable: pointerEvents
*
* Specifies if pointer events should be handled. Default is true.
*/
mxShape.prototype.pointerEvents = true;
pointerEvents = true;
/**
* Variable: svgPointerEvents
*
* Specifies if pointer events should be handled. Default is true.
*/
mxShape.prototype.svgPointerEvents = 'all';
svgPointerEvents = 'all';
/**
* Variable: shapePointerEvents
@ -173,7 +173,7 @@ mxShape.prototype.svgPointerEvents = 'all';
* Specifies if pointer events outside of shape should be handled. Default
* is false.
*/
mxShape.prototype.shapePointerEvents = false;
shapePointerEvents = false;
/**
* Variable: stencilPointerEvents
@ -181,14 +181,14 @@ mxShape.prototype.shapePointerEvents = false;
* Specifies if pointer events outside of stencils should be handled. Default
* is false. Set this to true for backwards compatibility with the 1.x branch.
*/
mxShape.prototype.stencilPointerEvents = false;
stencilPointerEvents = false;
/**
* Variable: vmlScale
*
* Scale for improving the precision of VML rendering. Default is 1.
*/
mxShape.prototype.vmlScale = 1;
vmlScale = 1;
/**
* Variable: outline
@ -198,14 +198,14 @@ mxShape.prototype.vmlScale = 1;
* not be painted for outlines. Default is false. This should be set before
* calling <apply>.
*/
mxShape.prototype.outline = false;
outline = false;
/**
* Variable: visible
*
* Specifies if the shape is visible. Default is true.
*/
mxShape.prototype.visible = true;
visible = true;
/**
* Variable: useSvgBoundingBox
@ -213,7 +213,7 @@ mxShape.prototype.visible = true;
* Allows to use the SVG bounding box in SVG. Default is false for performance
* reasons.
*/
mxShape.prototype.useSvgBoundingBox = false;
useSvgBoundingBox = false;
/**
* Function: init
@ -225,7 +225,7 @@ mxShape.prototype.useSvgBoundingBox = false;
*
* container - DOM node that will contain the shape.
*/
mxShape.prototype.init = function(container)
init = (container)=>
{
if (this.node == null)
{
@ -243,7 +243,7 @@ mxShape.prototype.init = function(container)
*
* Sets the styles to their default values.
*/
mxShape.prototype.initStyles = function(container)
initStyles = (container)=>
{
this.strokewidth = 1;
this.rotation = 0;
@ -261,7 +261,7 @@ mxShape.prototype.initStyles = function(container)
* is only needed in IE8 and only if the shape contains VML markup. This method
* returns true.
*/
mxShape.prototype.isParseVml = function()
isParseVml = ()=>
{
return true;
};
@ -272,7 +272,7 @@ mxShape.prototype.isParseVml = function()
* Returns true if HTML is allowed for this shape. This implementation always
* returns false.
*/
mxShape.prototype.isHtmlAllowed = function()
isHtmlAllowed = ()=>
{
return false;
};
@ -282,7 +282,7 @@ mxShape.prototype.isHtmlAllowed = function()
*
* Returns 0, or 0.5 if <strokewidth> % 2 == 1.
*/
mxShape.prototype.getSvgScreenOffset = function()
getSvgScreenOffset = ()=>
{
var sw = this.stencil && this.stencil.strokewidth != 'inherit' ? Number(this.stencil.strokewidth) : this.strokewidth;
@ -301,7 +301,7 @@ mxShape.prototype.getSvgScreenOffset = function()
*
* container - DOM node that will contain the shape.
*/
mxShape.prototype.create = function(container)
create = (container)=>
{
var node = null;
@ -327,7 +327,7 @@ mxShape.prototype.create = function(container)
*
* Creates and returns the SVG node(s) to represent this shape.
*/
mxShape.prototype.createSvg = function()
createSvg = ()=>
{
return document.createElementNS(mxConstants.NS_SVG, 'g');
};
@ -337,7 +337,7 @@ mxShape.prototype.createSvg = function()
*
* Creates and returns the VML node to represent this shape.
*/
mxShape.prototype.createVml = function()
createVml = ()=>
{
var node = document.createElement(mxClient.VML_PREFIX + ':group');
node.style.position = 'absolute';
@ -352,7 +352,7 @@ mxShape.prototype.createVml = function()
* this shape. This implementation falls back to <createVml>
* so that the HTML creation is optional.
*/
mxShape.prototype.createHtml = function()
createHtml = ()=>
{
var node = document.createElement('div');
node.style.position = 'absolute';
@ -366,7 +366,7 @@ mxShape.prototype.createHtml = function()
* Reconfigures this shape. This will update the colors etc in
* addition to the bounds or points.
*/
mxShape.prototype.reconfigure = function()
reconfigure = ()=>
{
this.redraw();
};
@ -376,7 +376,7 @@ mxShape.prototype.reconfigure = function()
*
* Creates and returns the SVG node(s) to represent this shape.
*/
mxShape.prototype.redraw = function()
redraw = ()=>
{
this.updateBoundsFromPoints();
@ -408,7 +408,7 @@ mxShape.prototype.redraw = function()
*
* Removes all child nodes and resets all CSS.
*/
mxShape.prototype.clear = function()
clear = ()=>
{
if (this.node.ownerSVGElement != null)
{
@ -430,7 +430,7 @@ mxShape.prototype.clear = function()
*
* Updates the bounds based on the points.
*/
mxShape.prototype.updateBoundsFromPoints = function()
updateBoundsFromPoints = ()=>
{
var pts = this.points;
@ -455,7 +455,7 @@ mxShape.prototype.updateBoundsFromPoints = function()
* given scaled and translated bounds of the shape. This method should not
* change the rectangle in-place. This implementation returns the given rect.
*/
mxShape.prototype.getLabelBounds = function(rect)
getLabelBounds = (rect)=>
{
var d = mxUtils.getValue(this.style, mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST);
var bounds = rect;
@ -506,7 +506,7 @@ mxShape.prototype.getLabelBounds = function(rect)
* computing the label bounds as an <mxRectangle>, where the bottom and right
* margin are defined in the width and height of the rectangle, respectively.
*/
mxShape.prototype.getLabelMargins= function(rect)
getLabelMargins= (rect)=>
{
return null;
};
@ -516,7 +516,7 @@ mxShape.prototype.getLabelMargins= function(rect)
*
* Returns true if the bounds are not null and all of its variables are numeric.
*/
mxShape.prototype.checkBounds = function()
checkBounds = ()=>
{
return (!isNaN(this.scale) && isFinite(this.scale) && this.scale > 0 &&
this.bounds != null && !isNaN(this.bounds.x) && !isNaN(this.bounds.y) &&
@ -529,7 +529,7 @@ mxShape.prototype.checkBounds = function()
*
* Returns the temporary element used for rendering in IE8 standards mode.
*/
mxShape.prototype.createVmlGroup = function()
createVmlGroup = ()=>
{
var node = document.createElement(mxClient.VML_PREFIX + ':group');
node.style.position = 'absolute';
@ -544,7 +544,7 @@ mxShape.prototype.createVmlGroup = function()
*
* Updates the SVG or VML shape.
*/
mxShape.prototype.redrawShape = function()
redrawShape = ()=>
{
var canvas = this.createCanvas();
@ -583,7 +583,7 @@ mxShape.prototype.redrawShape = function()
*
* Creates a new canvas for drawing this shape. May return null.
*/
mxShape.prototype.createCanvas = function()
createCanvas = ()=>
{
var canvas = null;
@ -608,12 +608,12 @@ mxShape.prototype.createCanvas = function()
canvas.setDashed(this.isDashed);
}
canvas.setStrokeWidth = function() {};
canvas.setStrokeColor = function() {};
canvas.setFillColor = function() {};
canvas.setGradient = function() {};
canvas.setDashed = function() {};
canvas.text = function() {};
canvas.setStrokeWidth = ()=> {};
canvas.setStrokeColor = ()=> {};
canvas.setFillColor = ()=> {};
canvas.setGradient = ()=> {};
canvas.setDashed = ()=> {};
canvas.text = ()=> {};
}
return canvas;
@ -624,7 +624,7 @@ mxShape.prototype.createCanvas = function()
*
* Creates and returns an <mxSvgCanvas2D> for rendering this shape.
*/
mxShape.prototype.createSvgCanvas = function()
createSvgCanvas = ()=>
{
var canvas = new mxSvgCanvas2D(this.node, false);
canvas.strokeTolerance = (this.pointerEvents) ? this.svgStrokeTolerance : 0;
@ -645,7 +645,7 @@ mxShape.prototype.createSvgCanvas = function()
if (!this.antiAlias)
{
// Rounds all numbers in the SVG output to integers
canvas.format = function(value)
canvas.format = (value)=>
{
return Math.round(parseFloat(value));
};
@ -659,7 +659,7 @@ mxShape.prototype.createSvgCanvas = function()
*
* Creates and returns an <mxVmlCanvas2D> for rendering this shape.
*/
mxShape.prototype.createVmlCanvas = function()
createVmlCanvas = ()=>
{
// Workaround for VML rendering bug in IE8 standards mode
var node = (document.documentMode == 8 && this.isParseVml()) ? this.createVmlGroup() : this.node;
@ -686,7 +686,7 @@ mxShape.prototype.createVmlCanvas = function()
*
* Updates the bounds of the VML container.
*/
mxShape.prototype.updateVmlContainer = function()
updateVmlContainer = ()=>
{
this.node.style.left = Math.round(this.bounds.x) + 'px';
this.node.style.top = Math.round(this.bounds.y) + 'px';
@ -702,7 +702,7 @@ mxShape.prototype.updateVmlContainer = function()
*
* Allow optimization by replacing VML with HTML.
*/
mxShape.prototype.redrawHtmlShape = function()
redrawHtmlShape = ()=>
{
// LATER: Refactor methods
this.updateHtmlBounds(this.node);
@ -715,7 +715,7 @@ mxShape.prototype.redrawHtmlShape = function()
*
* Allow optimization by replacing VML with HTML.
*/
mxShape.prototype.updateHtmlFilters = function(node)
updateHtmlFilters = (node)=>
{
var f = '';
@ -778,7 +778,7 @@ mxShape.prototype.updateHtmlFilters = function(node)
*
* Allow optimization by replacing VML with HTML.
*/
mxShape.prototype.updateHtmlColors = function(node)
updateHtmlColors = (node)=>
{
var color = this.stroke;
@ -828,7 +828,7 @@ mxShape.prototype.updateHtmlColors = function(node)
*
* Allow optimization by replacing VML with HTML.
*/
mxShape.prototype.updateHtmlBounds = function(node)
updateHtmlBounds = (node)=>
{
var sw = (document.documentMode >= 9) ? 0 : Math.ceil(this.strokewidth * this.scale);
node.style.borderWidth = Math.max(1, sw) + 'px';
@ -852,7 +852,7 @@ mxShape.prototype.updateHtmlBounds = function(node)
* Destroys the given canvas which was used for drawing. This implementation
* increments the reference counts on all shared gradients used in the canvas.
*/
mxShape.prototype.destroyCanvas = function(canvas)
destroyCanvas = (canvas)=>
{
// Manages reference counts
if (canvas instanceof mxSvgCanvas2D)
@ -878,21 +878,21 @@ mxShape.prototype.destroyCanvas = function(canvas)
*
* Invoked before paint is called.
*/
mxShape.prototype.beforePaint = function(c) { }
beforePaint = (c)=> { }
/**
* Function: afterPaint
*
* Invokes after paint was called.
*/
mxShape.prototype.afterPaint = function(c) { }
afterPaint = (c)=> { }
/**
* Function: paint
*
* Generic rendering code.
*/
mxShape.prototype.paint = function(c)
paint = (c)=>
{
var strokeDrawn = false;
@ -900,7 +900,7 @@ mxShape.prototype.paint = function(c)
{
var stroke = c.stroke;
c.stroke = function()
c.stroke = ()=>
{
strokeDrawn = true;
stroke.apply(this, arguments);
@ -908,7 +908,7 @@ mxShape.prototype.paint = function(c)
var fillAndStroke = c.fillAndStroke;
c.fillAndStroke = function()
c.fillAndStroke = ()=>
{
strokeDrawn = true;
fillAndStroke.apply(this, arguments);
@ -1006,7 +1006,7 @@ mxShape.prototype.paint = function(c)
*
* Sets the state of the canvas for drawing the shape.
*/
mxShape.prototype.configureCanvas = function(c, x, y, w, h)
configureCanvas = (c, x, y, w, h)=>
{
var dash = null;
@ -1055,7 +1055,7 @@ mxShape.prototype.configureCanvas = function(c, x, y, w, h)
*
* Returns the bounding box for the gradient box for this shape.
*/
mxShape.prototype.getGradientBounds = function(c, x, y, w, h)
getGradientBounds = (c, x, y, w, h)=>
{
return new mxRectangle(x, y, w, h);
};
@ -1065,7 +1065,7 @@ mxShape.prototype.getGradientBounds = function(c, x, y, w, h)
*
* Sets the scale and rotation on the given canvas.
*/
mxShape.prototype.updateTransform = function(c, x, y, w, h)
updateTransform = (c, x, y, w, h)=>
{
// NOTE: Currently, scale is implemented in state and canvas. This will
// move to canvas in a later version, so that the states are unscaled
@ -1079,7 +1079,7 @@ mxShape.prototype.updateTransform = function(c, x, y, w, h)
*
* Paints the vertex shape.
*/
mxShape.prototype.paintVertexShape = function(c, x, y, w, h)
paintVertexShape = (c, x, y, w, h)=>
{
this.paintBackground(c, x, y, w, h);
@ -1096,28 +1096,28 @@ mxShape.prototype.paintVertexShape = function(c, x, y, w, h)
*
* Hook for subclassers. This implementation is empty.
*/
mxShape.prototype.paintBackground = function(c, x, y, w, h) { };
paintBackground = (c, x, y, w, h)=> { };
/**
* Function: paintForeground
*
* Hook for subclassers. This implementation is empty.
*/
mxShape.prototype.paintForeground = function(c, x, y, w, h) { };
paintForeground = (c, x, y, w, h)=> { };
/**
* Function: paintEdgeShape
*
* Hook for subclassers. This implementation is empty.
*/
mxShape.prototype.paintEdgeShape = function(c, pts) { };
paintEdgeShape = (c, pts)=> { };
/**
* Function: getArcSize
*
* Returns the arc size for the given dimension.
*/
mxShape.prototype.getArcSize = function(w, h)
getArcSize = (w, h)=>
{
var r = 0;
@ -1141,7 +1141,7 @@ mxShape.prototype.getArcSize = function(w, h)
*
* Paints the glass gradient effect.
*/
mxShape.prototype.paintGlassEffect = function(c, x, y, w, h, arc)
paintGlassEffect = (c, x, y, w, h, arc)=>
{
var sw = Math.ceil(this.strokewidth / 2);
var size = 0.4;
@ -1176,7 +1176,7 @@ mxShape.prototype.paintGlassEffect = function(c, x, y, w, h, arc)
*
* Paints the given points with rounded corners.
*/
mxShape.prototype.addPoints = function(c, pts, rounded, arcSize, close, exclude, initialMove)
addPoints = (c, pts, rounded, arcSize, close, exclude, initialMove)=>
{
if (pts != null && pts.length > 0)
{
@ -1274,7 +1274,7 @@ mxShape.prototype.addPoints = function(c, pts, rounded, arcSize, close, exclude,
*
* Resets all styles.
*/
mxShape.prototype.resetStyles = function()
resetStyles = ()=>
{
this.initStyles();
@ -1330,7 +1330,7 @@ mxShape.prototype.resetStyles = function()
*
* state - <mxCellState> of the corresponding cell.
*/
mxShape.prototype.apply = function(state)
apply = (state)=>
{
this.state = state;
this.style = state.style;
@ -1400,7 +1400,7 @@ mxShape.prototype.apply = function(state)
*
* cursor - The cursor to be used.
*/
mxShape.prototype.setCursor = function(cursor)
setCursor = (cursor)=>
{
if (cursor == null)
{
@ -1420,7 +1420,7 @@ mxShape.prototype.setCursor = function(cursor)
*
* Returns the current cursor.
*/
mxShape.prototype.getCursor = function()
getCursor = ()=>
{
return this.cursor;
};
@ -1430,7 +1430,7 @@ mxShape.prototype.getCursor = function()
*
* Hook for subclassers.
*/
mxShape.prototype.isRoundable = function()
isRoundable = ()=>
{
return false;
};
@ -1441,7 +1441,7 @@ mxShape.prototype.isRoundable = function()
* Updates the <boundingBox> for this shape using <createBoundingBox> and
* <augmentBoundingBox> and stores the result in <boundingBox>.
*/
mxShape.prototype.updateBoundingBox = function()
updateBoundingBox = ()=>
{
// Tries to get bounding box from SVG subsystem
// LATER: Use getBoundingClientRect for fallback in VML
@ -1492,7 +1492,7 @@ mxShape.prototype.updateBoundingBox = function()
* Returns a new rectangle that represents the bounding box of the bare shape
* with no shadows or strokewidths.
*/
mxShape.prototype.createBoundingBox = function()
createBoundingBox = ()=>
{
var bb = this.bounds.clone();
@ -1510,7 +1510,7 @@ mxShape.prototype.createBoundingBox = function()
*
* Augments the bounding box with the strokewidth and shadow offsets.
*/
mxShape.prototype.augmentBoundingBox = function(bbox)
augmentBoundingBox = (bbox)=>
{
if (this.isShadow)
{
@ -1527,7 +1527,7 @@ mxShape.prototype.augmentBoundingBox = function(bbox)
*
* Returns true if the bounds should be inverted.
*/
mxShape.prototype.isPaintBoundsInverted = function()
isPaintBoundsInverted = ()=>
{
// Stencil implements inversion via aspect
return this.stencil == null && (this.direction == mxConstants.DIRECTION_NORTH ||
@ -1539,7 +1539,7 @@ mxShape.prototype.isPaintBoundsInverted = function()
*
* Returns the rotation from the style.
*/
mxShape.prototype.getRotation = function()
getRotation = ()=>
{
return (this.rotation != null) ? this.rotation : 0;
};
@ -1549,13 +1549,13 @@ mxShape.prototype.getRotation = function()
*
* Returns the rotation for the text label.
*/
mxShape.prototype.getTextRotation = function()
getTextRotation = ()=>
{
var rot = this.getRotation();
if (mxUtils.getValue(this.style, mxConstants.STYLE_HORIZONTAL, 1) != 1)
{
rot += mxText.prototype.verticalTextRotation;
rot += verticalTextRotation;
}
return rot;
@ -1566,7 +1566,7 @@ mxShape.prototype.getTextRotation = function()
*
* Returns the actual rotation of the shape.
*/
mxShape.prototype.getShapeRotation = function()
getShapeRotation = ()=>
{
var rot = this.getRotation();
@ -1594,7 +1594,7 @@ mxShape.prototype.getShapeRotation = function()
*
* Adds a transparent rectangle that catches all events.
*/
mxShape.prototype.createTransparentSvgRectangle = function(x, y, w, h)
createTransparentSvgRectangle = (x, y, w, h)=>
{
var rect = document.createElementNS(mxConstants.NS_SVG, 'rect');
rect.setAttribute('x', x);
@ -1615,7 +1615,7 @@ mxShape.prototype.createTransparentSvgRectangle = function(x, y, w, h)
*
* Paints the line shape.
*/
mxShape.prototype.setTransparentBackgroundImage = function(node)
setTransparentBackgroundImage = (node)=>
{
node.style.backgroundImage = 'url(\'' + mxClient.imageBasePath + '/transparent.gif\')';
};
@ -1625,7 +1625,7 @@ mxShape.prototype.setTransparentBackgroundImage = function(node)
*
* Paints the line shape.
*/
mxShape.prototype.releaseSvgGradients = function(grads)
releaseSvgGradients = (grads)=>
{
if (grads != null)
{
@ -1652,7 +1652,7 @@ mxShape.prototype.releaseSvgGradients = function(grads)
* Destroys the shape by removing it from the DOM and releasing the DOM
* node associated with the shape using <mxEvent.release>.
*/
mxShape.prototype.destroy = function()
destroy = ()=>
{
if (this.node != null)
{

View File

@ -235,63 +235,63 @@ mxStencil.allowEval = false;
*
* Holds the XML node with the stencil description.
*/
mxStencil.prototype.desc = null;
desc = null;
/**
* Variable: constraints
*
* Holds an array of <mxConnectionConstraints> as defined in the shape.
*/
mxStencil.prototype.constraints = null;
constraints = null;
/**
* Variable: aspect
*
* Holds the aspect of the shape. Default is 'auto'.
*/
mxStencil.prototype.aspect = null;
aspect = null;
/**
* Variable: w0
*
* Holds the width of the shape. Default is 100.
*/
mxStencil.prototype.w0 = null;
w0 = null;
/**
* Variable: h0
*
* Holds the height of the shape. Default is 100.
*/
mxStencil.prototype.h0 = null;
h0 = null;
/**
* Variable: bgNodes
*
* Holds the XML node with the stencil description.
*/
mxStencil.prototype.bgNode = null;
bgNode = null;
/**
* Variable: fgNodes
*
* Holds the XML node with the stencil description.
*/
mxStencil.prototype.fgNode = null;
fgNode = null;
/**
* Variable: strokewidth
*
* Holds the strokewidth direction from the description.
*/
mxStencil.prototype.strokewidth = null;
strokewidth = null;
/**
* Function: parseDescription
*
* Reads <w0>, <h0>, <aspect>, <bgNodes> and <fgNodes> from <desc>.
*/
mxStencil.prototype.parseDescription = function()
parseDescription = ()=>
{
// LATER: Preprocess nodes for faster painting
this.fgNode = this.desc.getElementsByTagName('foreground')[0];
@ -319,7 +319,7 @@ mxStencil.prototype.parseDescription = function()
* Reads the constraints from <desc> into <constraints> using
* <parseConstraint>.
*/
mxStencil.prototype.parseConstraints = function()
parseConstraints = ()=>
{
var conns = this.desc.getElementsByTagName('connections')[0];
@ -344,7 +344,7 @@ mxStencil.prototype.parseConstraints = function()
*
* Parses the given XML node and returns its <mxConnectionConstraint>.
*/
mxStencil.prototype.parseConstraint = function(node)
parseConstraint = (node)=>
{
var x = Number(node.getAttribute('x'));
var y = Number(node.getAttribute('y'));
@ -361,7 +361,7 @@ mxStencil.prototype.parseConstraint = function(node)
* is used as a key to <mxResources.get> if the localized attribute in the text
* node is 1 or if <defaultLocalized> is true.
*/
mxStencil.prototype.evaluateTextAttribute = function(node, attribute, shape)
evaluateTextAttribute = (node, attribute, shape)=>
{
var result = this.evaluateAttribute(node, attribute, shape);
var loc = node.getAttribute('localized');
@ -382,7 +382,7 @@ mxStencil.prototype.evaluateTextAttribute = function(node, attribute, shape)
* a function it is invoked with <shape> as the only argument and the return
* value is used as the attribute value to be returned.
*/
mxStencil.prototype.evaluateAttribute = function(node, attribute, shape)
evaluateAttribute = (node, attribute, shape)=>
{
var result = node.getAttribute(attribute);
@ -409,7 +409,7 @@ mxStencil.prototype.evaluateAttribute = function(node, attribute, shape)
*
* Draws this stencil inside the given bounds.
*/
mxStencil.prototype.drawShape = function(canvas, shape, x, y, w, h)
drawShape = (canvas, shape, x, y, w, h)=>
{
var stack = canvas.states.slice();
@ -453,7 +453,7 @@ mxStencil.prototype.drawShape = function(canvas, shape, x, y, w, h)
*
* Draws this stencil inside the given bounds.
*/
mxStencil.prototype.drawChildren = function(canvas, shape, x, y, w, h, node, aspect, disableShadow, paint)
drawChildren = (canvas, shape, x, y, w, h, node, aspect, disableShadow, paint)=>
{
if (node != null && w > 0 && h > 0)
{
@ -484,7 +484,7 @@ mxStencil.prototype.drawChildren = function(canvas, shape, x, y, w, h, node, asp
* bounds - <mxRectangle> that should contain the stencil.
* direction - Optional direction of the shape to be darwn.
*/
mxStencil.prototype.computeAspect = function(shape, x, y, w, h, direction)
computeAspect = (shape, x, y, w, h, direction)=>
{
var x0 = x;
var y0 = y;
@ -530,7 +530,7 @@ mxStencil.prototype.computeAspect = function(shape, x, y, w, h, direction)
*
* Draws this stencil inside the given bounds.
*/
mxStencil.prototype.drawNode = function(canvas, shape, node, aspect, disableShadow, paint)
drawNode = (canvas, shape, node, aspect, disableShadow, paint)=>
{
var name = node.nodeName;
var x0 = aspect.x;

View File

@ -35,7 +35,7 @@ var mxStencilRegistry =
*
* Adds the given <mxStencil>.
*/
addStencil: function(name, stencil)
addStencil: (name, stencil)=>
{
mxStencilRegistry.stencils[name] = stencil;
},
@ -45,7 +45,7 @@ var mxStencilRegistry =
*
* Returns the <mxStencil> for the given name.
*/
getStencil: function(name)
getStencil: (name)=>
{
return mxStencilRegistry.stencils[name];
}

View File

@ -47,14 +47,14 @@ mxUtils.extend(mxSwimlane, mxShape);
* Default imagewidth and imageheight if an image but no imagewidth
* and imageheight are defined in the style. Value is 16.
*/
mxSwimlane.prototype.imageSize = 16;
imageSize = 16;
/**
* Function: isRoundable
*
* Adds roundable support.
*/
mxSwimlane.prototype.isRoundable = function(c, x, y, w, h)
isRoundable = (c, x, y, w, h)=>
{
return true;
};
@ -64,7 +64,7 @@ mxSwimlane.prototype.isRoundable = function(c, x, y, w, h)
*
* Returns the title size.
*/
mxSwimlane.prototype.getTitleSize = function()
getTitleSize = ()=>
{
return Math.max(0, mxUtils.getValue(this.style, mxConstants.STYLE_STARTSIZE, mxConstants.DEFAULT_STARTSIZE));
};
@ -74,7 +74,7 @@ mxSwimlane.prototype.getTitleSize = function()
*
* Returns the bounding box for the label.
*/
mxSwimlane.prototype.getLabelBounds = function(rect)
getLabelBounds = (rect)=>
{
var start = this.getTitleSize();
var bounds = new mxRectangle(rect.x, rect.y, rect.width, rect.height);
@ -125,7 +125,7 @@ mxSwimlane.prototype.getLabelBounds = function(rect)
*
* Returns the bounding box for the gradient box for this shape.
*/
mxSwimlane.prototype.getGradientBounds = function(c, x, y, w, h)
getGradientBounds = (c, x, y, w, h)=>
{
var start = this.getTitleSize();
@ -146,7 +146,7 @@ mxSwimlane.prototype.getGradientBounds = function(c, x, y, w, h)
*
* Returns the arcsize for the swimlane.
*/
mxSwimlane.prototype.getSwimlaneArcSize = function(w, h, start)
getSwimlaneArcSize = (w, h, start)=>
{
if (mxUtils.getValue(this.style, mxConstants.STYLE_ABSOLUTE_ARCSIZE, 0) == '1')
{
@ -166,7 +166,7 @@ mxSwimlane.prototype.getSwimlaneArcSize = function(w, h, start)
*
* Paints the swimlane vertex shape.
*/
mxSwimlane.prototype.isHorizontal = function()
isHorizontal = ()=>
{
return mxUtils.getValue(this.style, mxConstants.STYLE_HORIZONTAL, 1) == 1;
};
@ -176,7 +176,7 @@ mxSwimlane.prototype.isHorizontal = function()
*
* Paints the swimlane vertex shape.
*/
mxSwimlane.prototype.paintVertexShape = function(c, x, y, w, h)
paintVertexShape = (c, x, y, w, h)=>
{
var start = this.getTitleSize();
var fill = mxUtils.getValue(this.style, mxConstants.STYLE_SWIMLANE_FILLCOLOR, mxConstants.NONE);
@ -227,7 +227,7 @@ mxSwimlane.prototype.paintVertexShape = function(c, x, y, w, h)
*
* Paints the swimlane vertex shape.
*/
mxSwimlane.prototype.paintSwimlane = function(c, x, y, w, h, start, fill, swimlaneLine)
paintSwimlane = (c, x, y, w, h, start, fill, swimlaneLine)=>
{
c.begin();
@ -327,7 +327,7 @@ mxSwimlane.prototype.paintSwimlane = function(c, x, y, w, h, start, fill, swimla
*
* Paints the swimlane vertex shape.
*/
mxSwimlane.prototype.paintRoundedSwimlane = function(c, x, y, w, h, start, r, fill, swimlaneLine)
paintRoundedSwimlane = (c, x, y, w, h, start, r, fill, swimlaneLine)=>
{
c.begin();
@ -435,7 +435,7 @@ mxSwimlane.prototype.paintRoundedSwimlane = function(c, x, y, w, h, start, r, fi
*
* Paints the divider between swimlane title and content area.
*/
mxSwimlane.prototype.paintDivider = function(c, x, y, w, h, start, shadow)
paintDivider = (c, x, y, w, h, start, shadow)=>
{
if (!shadow)
{
@ -463,7 +463,7 @@ mxSwimlane.prototype.paintDivider = function(c, x, y, w, h, start, shadow)
*
* Paints the vertical or horizontal separator line between swimlanes.
*/
mxSwimlane.prototype.paintSeparator = function(c, x, y, w, h, start, color)
paintSeparator = (c, x, y, w, h, start, color)=>
{
if (color != mxConstants.NONE)
{
@ -492,7 +492,7 @@ mxSwimlane.prototype.paintSeparator = function(c, x, y, w, h, start, color)
*
* Paints the swimlane vertex shape.
*/
mxSwimlane.prototype.getImageBounds = function(x, y, w, h)
getImageBounds = (x, y, w, h)=>
{
if (this.isHorizontal())
{

View File

@ -9,7 +9,7 @@
* bottom to top to top to bottom, the following code can be used:
*
* (code)
* mxText.prototype.verticalTextRotation = 90;
* verticalTextRotation = 90;
* (end)
*
* Constructor: mxText
@ -98,7 +98,7 @@ mxUtils.extend(mxText, mxShape);
* Specifies the spacing to be added to the top spacing. Default is 0. Use the
* value 5 here to get the same label positions as in mxGraph 1.x.
*/
mxText.prototype.baseSpacingTop = 0;
baseSpacingTop = 0;
/**
* Variable: baseSpacingBottom
@ -106,21 +106,21 @@ mxText.prototype.baseSpacingTop = 0;
* Specifies the spacing to be added to the bottom spacing. Default is 0. Use the
* value 1 here to get the same label positions as in mxGraph 1.x.
*/
mxText.prototype.baseSpacingBottom = 0;
baseSpacingBottom = 0;
/**
* Variable: baseSpacingLeft
*
* Specifies the spacing to be added to the left spacing. Default is 0.
*/
mxText.prototype.baseSpacingLeft = 0;
baseSpacingLeft = 0;
/**
* Variable: baseSpacingRight
*
* Specifies the spacing to be added to the right spacing. Default is 0.
*/
mxText.prototype.baseSpacingRight = 0;
baseSpacingRight = 0;
/**
* Variable: replaceLinefeeds
@ -128,14 +128,14 @@ mxText.prototype.baseSpacingRight = 0;
* Specifies if linefeeds in HTML labels should be replaced with BR tags.
* Default is true.
*/
mxText.prototype.replaceLinefeeds = true;
replaceLinefeeds = true;
/**
* Variable: verticalTextRotation
*
* Rotation for vertical text. Default is -90 (bottom to top).
*/
mxText.prototype.verticalTextRotation = -90;
verticalTextRotation = -90;
/**
* Variable: ignoreClippedStringSize
@ -145,7 +145,7 @@ mxText.prototype.verticalTextRotation = -90;
* true, then the bounding box will be set to <bounds>. Default is true.
* <ignoreStringSize> has precedence over this switch.
*/
mxText.prototype.ignoreClippedStringSize = true;
ignoreClippedStringSize = true;
/**
* Variable: ignoreStringSize
@ -154,7 +154,7 @@ mxText.prototype.ignoreClippedStringSize = true;
* boundingBox will not ignore the actual size of the string, otherwise
* <bounds> will be used instead. Default is false.
*/
mxText.prototype.ignoreStringSize = false;
ignoreStringSize = false;
/**
* Variable: textWidthPadding
@ -163,21 +163,21 @@ mxText.prototype.ignoreStringSize = false;
* This is needed to make sure no clipping is applied to borders. Default is 4
* for IE 8 standards mode and 3 for all others.
*/
mxText.prototype.textWidthPadding = (document.documentMode == 8 && !mxClient.IS_EM) ? 4 : 3;
textWidthPadding = (document.documentMode == 8 && !mxClient.IS_EM) ? 4 : 3;
/**
* Variable: lastValue
*
* Contains the last rendered text value. Used for caching.
*/
mxText.prototype.lastValue = null;
lastValue = null;
/**
* Variable: cacheEnabled
*
* Specifies if caching for HTML labels should be enabled. Default is true.
*/
mxText.prototype.cacheEnabled = true;
cacheEnabled = true;
/**
* Function: isParseVml
@ -185,7 +185,7 @@ mxText.prototype.cacheEnabled = true;
* Text shapes do not contain VML markup and do not need to be parsed. This
* method returns false to speed up rendering in IE8.
*/
mxText.prototype.isParseVml = function()
isParseVml = ()=>
{
return false;
};
@ -196,7 +196,7 @@ mxText.prototype.isParseVml = function()
* Returns true if HTML is allowed for this shape. This implementation returns
* true if the browser is not in IE8 standards mode.
*/
mxText.prototype.isHtmlAllowed = function()
isHtmlAllowed = ()=>
{
return document.documentMode != 8 || mxClient.IS_EM;
};
@ -206,7 +206,7 @@ mxText.prototype.isHtmlAllowed = function()
*
* Disables offset in IE9 for crisper image output.
*/
mxText.prototype.getSvgScreenOffset = function()
getSvgScreenOffset = ()=>
{
return 0;
};
@ -216,7 +216,7 @@ mxText.prototype.getSvgScreenOffset = function()
*
* Returns true if the bounds are not null and all of its variables are numeric.
*/
mxText.prototype.checkBounds = function()
checkBounds = ()=>
{
return (!isNaN(this.scale) && isFinite(this.scale) && this.scale > 0 &&
this.bounds != null && !isNaN(this.bounds.x) && !isNaN(this.bounds.y) &&
@ -228,7 +228,7 @@ mxText.prototype.checkBounds = function()
*
* Generic rendering code.
*/
mxText.prototype.paint = function(c, update)
paint = (c, update)=>
{
// Scale is passed-through to canvas
var s = this.scale;
@ -290,7 +290,7 @@ mxText.prototype.paint = function(c, update)
*
* Renders the text using the given DOM nodes.
*/
mxText.prototype.redraw = function()
redraw = ()=>
{
if (this.visible && this.checkBounds() && this.cacheEnabled && this.lastValue == this.value &&
(mxUtils.isNode(this.value) || this.dialect == mxConstants.DIALECT_STRICTHTML))
@ -333,13 +333,13 @@ mxText.prototype.redraw = function()
else
{
// Fallback if canvas does not support updateText (VML)
mxShape.prototype.redraw.apply(this, arguments);
redraw.apply(this, arguments);
}
}
}
else
{
mxShape.prototype.redraw.apply(this, arguments);
redraw.apply(this, arguments);
if (mxUtils.isNode(this.value) || this.dialect == mxConstants.DIALECT_STRICTHTML)
{
@ -357,9 +357,9 @@ mxText.prototype.redraw = function()
*
* Resets all styles.
*/
mxText.prototype.resetStyles = function()
resetStyles = ()=>
{
mxShape.prototype.resetStyles.apply(this, arguments);
resetStyles.apply(this, arguments);
this.color = 'black';
this.align = mxConstants.ALIGN_CENTER;
@ -388,10 +388,10 @@ mxText.prototype.resetStyles = function()
*
* state - <mxCellState> of the corresponding cell.
*/
mxText.prototype.apply = function(state)
apply = (state)=>
{
var old = this.spacing;
mxShape.prototype.apply.apply(this, arguments);
apply.apply(this, arguments);
if (this.style != null)
{
@ -426,7 +426,7 @@ mxText.prototype.apply = function(state)
* depending on the contents of <value>. This is not invoked for HTML, wrapped
* content or if <value> is a DOM node.
*/
mxText.prototype.getAutoDirection = function()
getAutoDirection = ()=>
{
// Looks for strong (directional) characters
var tmp = /[A-Za-z\u05d0-\u065f\u066a-\u06ef\u06fa-\u07ff\ufb1d-\ufdff\ufe70-\ufefc]/.exec(this.value);
@ -441,7 +441,7 @@ mxText.prototype.getAutoDirection = function()
*
* Returns the node that contains the rendered input.
*/
mxText.prototype.getContentNode = function()
getContentNode = ()=>
{
var result = this.node;
@ -467,7 +467,7 @@ mxText.prototype.getContentNode = function()
*
* Updates the <boundingBox> for this shape using the given node and position.
*/
mxText.prototype.updateBoundingBox = function()
updateBoundingBox = ()=>
{
var node = this.node;
this.boundingBox = this.bounds.clone();
@ -646,7 +646,7 @@ mxText.prototype.updateBoundingBox = function()
*
* Returns 0 to avoid using rotation in the canvas via updateTransform.
*/
mxText.prototype.getShapeRotation = function()
getShapeRotation = ()=>
{
return 0;
};
@ -656,7 +656,7 @@ mxText.prototype.getShapeRotation = function()
*
* Returns the rotation for the text label of the corresponding shape.
*/
mxText.prototype.getTextRotation = function()
getTextRotation = ()=>
{
return (this.state != null && this.state.shape != null) ? this.state.shape.getTextRotation() : 0;
};
@ -667,7 +667,7 @@ mxText.prototype.getTextRotation = function()
* Inverts the bounds if <mxShape.isBoundsInverted> returns true or if the
* horizontal style is false.
*/
mxText.prototype.isPaintBoundsInverted = function()
isPaintBoundsInverted = ()=>
{
return !this.horizontal && this.state != null && this.state.view.graph.model.isVertex(this.state.cell);
};
@ -677,9 +677,9 @@ mxText.prototype.isPaintBoundsInverted = function()
*
* Sets the state of the canvas for drawing the shape.
*/
mxText.prototype.configureCanvas = function(c, x, y, w, h)
configureCanvas = (c, x, y, w, h)=>
{
mxShape.prototype.configureCanvas.apply(this, arguments);
configureCanvas.apply(this, arguments);
c.setFontColor(this.color);
c.setFontBackgroundColor(this.background);
@ -694,7 +694,7 @@ mxText.prototype.configureCanvas = function(c, x, y, w, h)
*
* Sets the width and height of the container to 1px.
*/
mxText.prototype.updateVmlContainer = function()
updateVmlContainer = ()=>
{
this.node.style.left = Math.round(this.bounds.x) + 'px';
this.node.style.top = Math.round(this.bounds.y) + 'px';
@ -708,7 +708,7 @@ mxText.prototype.updateVmlContainer = function()
*
* Private helper function to create SVG elements
*/
mxText.prototype.getHtmlValue = function()
getHtmlValue = ()=>
{
var val = this.value;
@ -729,7 +729,7 @@ mxText.prototype.getHtmlValue = function()
*
* Private helper function to create SVG elements
*/
mxText.prototype.getTextCss = function()
getTextCss = ()=>
{
var lh = (mxConstants.ABSOLUTE_LINE_HEIGHT) ? (this.size * mxConstants.LINE_HEIGHT) + 'px' :
mxConstants.LINE_HEIGHT;
@ -773,7 +773,7 @@ mxText.prototype.getTextCss = function()
*
* Updates the HTML node(s) to reflect the latest bounds and scale.
*/
mxText.prototype.redrawHtmlShape = function()
redrawHtmlShape = ()=>
{
if (mxClient.IS_SVG)
{
@ -812,7 +812,7 @@ mxText.prototype.redrawHtmlShape = function()
*
* Updates the HTML node(s) to reflect the latest bounds and scale.
*/
mxText.prototype.redrawHtmlShapeWithCss3 = function()
redrawHtmlShapeWithCss3 = ()=>
{
var w = Math.max(0, Math.round(this.bounds.width / this.scale));
var h = Math.max(0, Math.round(this.bounds.height / this.scale));
@ -823,7 +823,7 @@ mxText.prototype.redrawHtmlShapeWithCss3 = function()
mxSvgCanvas2D.createCss(w + 2, h, this.align, this.valign, this.wrap, this.overflow, this.clipped,
(this.background != null) ? mxUtils.htmlEntities(this.background) : null,
(this.border != null) ? mxUtils.htmlEntities(this.border) : null,
flex, block, this.scale, mxUtils.bind(this, function(dx, dy, flex, item, block, ofl)
flex, block, this.scale, mxUtils.bind(this, (dx, dy, flex, item, block, ofl)=>
{
var r = this.getTextRotation();
var tr = ((this.scale != 1) ? 'scale(' + this.scale + ') ' : '') +
@ -876,7 +876,7 @@ mxText.prototype.redrawHtmlShapeWithCss3 = function()
*
* Returns the spacing as an <mxPoint>.
*/
mxText.prototype.updateHtmlTransform = function()
updateHtmlTransform = ()=>
{
var theta = this.getTextRotation();
var style = this.node.style;
@ -915,7 +915,7 @@ mxText.prototype.updateHtmlTransform = function()
*
* Sets the inner HTML of the given element to the <value>.
*/
mxText.prototype.updateInnerHtml = function(elt)
updateInnerHtml = (elt)=>
{
if (mxUtils.isNode(this.value))
{
@ -945,7 +945,7 @@ mxText.prototype.updateInnerHtml = function(elt)
*
* Rotated text rendering quality is bad for IE9 quirks/IE8 standards
*/
mxText.prototype.updateHtmlFilter = function()
updateHtmlFilter = ()=>
{
var style = this.node.style;
var dx = this.margin.x;
@ -1154,7 +1154,7 @@ mxText.prototype.updateHtmlFilter = function()
*
* Updates the HTML node(s) to reflect the latest bounds and scale.
*/
mxText.prototype.updateValue = function()
updateValue = ()=>
{
if (mxUtils.isNode(this.value))
{
@ -1242,7 +1242,7 @@ mxText.prototype.updateValue = function()
*
* Updates the HTML node(s) to reflect the latest bounds and scale.
*/
mxText.prototype.updateFont = function(node)
updateFont = (node)=>
{
var style = node.style;
@ -1303,7 +1303,7 @@ mxText.prototype.updateFont = function(node)
*
* Updates the HTML node(s) to reflect the latest bounds and scale.
*/
mxText.prototype.updateSize = function(node, enableWrap)
updateSize = (node, enableWrap)=>
{
var w = Math.max(0, Math.round(this.bounds.width / this.scale));
var h = Math.max(0, Math.round(this.bounds.height / this.scale));
@ -1392,7 +1392,7 @@ mxText.prototype.updateSize = function(node, enableWrap)
*
* Returns the spacing as an <mxPoint>.
*/
mxText.prototype.updateMargin = function()
updateMargin = ()=>
{
this.margin = mxUtils.getAlignmentAsPoint(this.align, this.valign);
};
@ -1402,7 +1402,7 @@ mxText.prototype.updateMargin = function()
*
* Returns the spacing as an <mxPoint>.
*/
mxText.prototype.getSpacing = function()
getSpacing = ()=>
{
var dx = 0;
var dy = 0;

View File

@ -26,7 +26,7 @@ mxUtils.extend(mxTriangle, mxActor);
*
* Adds roundable support.
*/
mxTriangle.prototype.isRoundable = function()
isRoundable = ()=>
{
return true;
};
@ -36,7 +36,7 @@ mxTriangle.prototype.isRoundable = function()
*
* Draws the path for this shape.
*/
mxTriangle.prototype.redrawPath = function(c, x, y, w, h)
redrawPath = (c, x, y, w, h)=>
{
var arcSize = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, mxConstants.LINE_ARCSIZE) / 2;
this.addPoints(c, [new mxPoint(0, 0), new mxPoint(w, 0.5 * h), new mxPoint(0, h)], this.isRounded, arcSize, true);

View File

@ -29,91 +29,91 @@ function mxAbstractCanvas2D()
*
* Holds the current state.
*/
mxAbstractCanvas2D.prototype.state = null;
mxAbstractCanvas2state = null;
/**
* Variable: states
*
* Stack of states.
*/
mxAbstractCanvas2D.prototype.states = null;
mxAbstractCanvas2states = null;
/**
* Variable: path
*
* Holds the current path as an array.
*/
mxAbstractCanvas2D.prototype.path = null;
mxAbstractCanvas2path = null;
/**
* Variable: rotateHtml
*
* Switch for rotation of HTML. Default is false.
*/
mxAbstractCanvas2D.prototype.rotateHtml = true;
mxAbstractCanvas2rotateHtml = true;
/**
* Variable: lastX
*
* Holds the last x coordinate.
*/
mxAbstractCanvas2D.prototype.lastX = 0;
mxAbstractCanvas2lastX = 0;
/**
* Variable: lastY
*
* Holds the last y coordinate.
*/
mxAbstractCanvas2D.prototype.lastY = 0;
mxAbstractCanvas2lastY = 0;
/**
* Variable: moveOp
*
* Contains the string used for moving in paths. Default is 'M'.
*/
mxAbstractCanvas2D.prototype.moveOp = 'M';
mxAbstractCanvas2moveOp = 'M';
/**
* Variable: lineOp
*
* Contains the string used for moving in paths. Default is 'L'.
*/
mxAbstractCanvas2D.prototype.lineOp = 'L';
mxAbstractCanvas2lineOp = 'L';
/**
* Variable: quadOp
*
* Contains the string used for quadratic paths. Default is 'Q'.
*/
mxAbstractCanvas2D.prototype.quadOp = 'Q';
mxAbstractCanvas2quadOp = 'Q';
/**
* Variable: curveOp
*
* Contains the string used for bezier curves. Default is 'C'.
*/
mxAbstractCanvas2D.prototype.curveOp = 'C';
mxAbstractCanvas2curveOp = 'C';
/**
* Variable: closeOp
*
* Holds the operator for closing curves. Default is 'Z'.
*/
mxAbstractCanvas2D.prototype.closeOp = 'Z';
mxAbstractCanvas2closeOp = 'Z';
/**
* Variable: pointerEvents
*
* Boolean value that specifies if events should be handled. Default is false.
*/
mxAbstractCanvas2D.prototype.pointerEvents = false;
mxAbstractCanvas2pointerEvents = false;
/**
* Function: createUrlConverter
*
* Create a new <mxUrlConverter> and returns it.
*/
mxAbstractCanvas2D.prototype.createUrlConverter = function()
mxAbstractCanvas2createUrlConverter = ()=>
{
return new mxUrlConverter();
};
@ -123,7 +123,7 @@ mxAbstractCanvas2D.prototype.createUrlConverter = function()
*
* Resets the state of this canvas.
*/
mxAbstractCanvas2D.prototype.reset = function()
mxAbstractCanvas2reset = ()=>
{
this.state = this.createState();
this.states = [];
@ -134,7 +134,7 @@ mxAbstractCanvas2D.prototype.reset = function()
*
* Creates the state of the this canvas.
*/
mxAbstractCanvas2D.prototype.createState = function()
mxAbstractCanvas2createState = ()=>
{
return {
dx: 0,
@ -178,7 +178,7 @@ mxAbstractCanvas2D.prototype.createState = function()
*
* Rounds all numbers to integers.
*/
mxAbstractCanvas2D.prototype.format = function(value)
mxAbstractCanvas2format = (value)=>
{
return Math.round(parseFloat(value));
};
@ -188,7 +188,7 @@ mxAbstractCanvas2D.prototype.format = function(value)
*
* Adds the given operation to the path.
*/
mxAbstractCanvas2D.prototype.addOp = function()
mxAbstractCanvas2addOp = ()=>
{
if (this.path != null)
{
@ -215,7 +215,7 @@ mxAbstractCanvas2D.prototype.addOp = function()
*
* Rotates the given point and returns the result as an <mxPoint>.
*/
mxAbstractCanvas2D.prototype.rotatePoint = function(x, y, theta, cx, cy)
mxAbstractCanvas2rotatePoint = (x, y, theta, cx, cy)=>
{
var rad = theta * (Math.PI / 180);
@ -228,7 +228,7 @@ mxAbstractCanvas2D.prototype.rotatePoint = function(x, y, theta, cx, cy)
*
* Saves the current state.
*/
mxAbstractCanvas2D.prototype.save = function()
mxAbstractCanvas2save = ()=>
{
this.states.push(this.state);
this.state = mxUtils.clone(this.state);
@ -239,7 +239,7 @@ mxAbstractCanvas2D.prototype.save = function()
*
* Restores the current state.
*/
mxAbstractCanvas2D.prototype.restore = function()
mxAbstractCanvas2restore = ()=>
{
if (this.states.length > 0)
{
@ -252,7 +252,7 @@ mxAbstractCanvas2D.prototype.restore = function()
*
* Sets the current link. Hook for subclassers.
*/
mxAbstractCanvas2D.prototype.setLink = function(link)
mxAbstractCanvas2setLink = (link)=>
{
// nop
};
@ -262,7 +262,7 @@ mxAbstractCanvas2D.prototype.setLink = function(link)
*
* Scales the current state.
*/
mxAbstractCanvas2D.prototype.scale = function(value)
mxAbstractCanvas2scale = (value)=>
{
this.state.scale *= value;
this.state.strokeWidth *= value;
@ -273,7 +273,7 @@ mxAbstractCanvas2D.prototype.scale = function(value)
*
* Translates the current state.
*/
mxAbstractCanvas2D.prototype.translate = function(dx, dy)
mxAbstractCanvas2translate = (dx, dy)=>
{
this.state.dx += dx;
this.state.dy += dy;
@ -284,7 +284,7 @@ mxAbstractCanvas2D.prototype.translate = function(dx, dy)
*
* Rotates the current state.
*/
mxAbstractCanvas2D.prototype.rotate = function(theta, flipH, flipV, cx, cy)
mxAbstractCanvas2rotate = (theta, flipH, flipV, cx, cy)=>
{
// nop
};
@ -294,7 +294,7 @@ mxAbstractCanvas2D.prototype.rotate = function(theta, flipH, flipV, cx, cy)
*
* Sets the current alpha.
*/
mxAbstractCanvas2D.prototype.setAlpha = function(value)
mxAbstractCanvas2setAlpha = (value)=>
{
this.state.alpha = value;
};
@ -304,7 +304,7 @@ mxAbstractCanvas2D.prototype.setAlpha = function(value)
*
* Sets the current solid fill alpha.
*/
mxAbstractCanvas2D.prototype.setFillAlpha = function(value)
mxAbstractCanvas2setFillAlpha = (value)=>
{
this.state.fillAlpha = value;
};
@ -314,7 +314,7 @@ mxAbstractCanvas2D.prototype.setFillAlpha = function(value)
*
* Sets the current stroke alpha.
*/
mxAbstractCanvas2D.prototype.setStrokeAlpha = function(value)
mxAbstractCanvas2setStrokeAlpha = (value)=>
{
this.state.strokeAlpha = value;
};
@ -324,7 +324,7 @@ mxAbstractCanvas2D.prototype.setStrokeAlpha = function(value)
*
* Sets the current fill color.
*/
mxAbstractCanvas2D.prototype.setFillColor = function(value)
mxAbstractCanvas2setFillColor = (value)=>
{
if (value == mxConstants.NONE)
{
@ -340,7 +340,7 @@ mxAbstractCanvas2D.prototype.setFillColor = function(value)
*
* Sets the current gradient.
*/
mxAbstractCanvas2D.prototype.setGradient = function(color1, color2, x, y, w, h, direction, alpha1, alpha2)
mxAbstractCanvas2setGradient = (color1, color2, x, y, w, h, direction, alpha1, alpha2)=>
{
var s = this.state;
s.fillColor = color1;
@ -355,7 +355,7 @@ mxAbstractCanvas2D.prototype.setGradient = function(color1, color2, x, y, w, h,
*
* Sets the current stroke color.
*/
mxAbstractCanvas2D.prototype.setStrokeColor = function(value)
mxAbstractCanvas2setStrokeColor = (value)=>
{
if (value == mxConstants.NONE)
{
@ -370,7 +370,7 @@ mxAbstractCanvas2D.prototype.setStrokeColor = function(value)
*
* Sets the current stroke width.
*/
mxAbstractCanvas2D.prototype.setStrokeWidth = function(value)
mxAbstractCanvas2setStrokeWidth = (value)=>
{
this.state.strokeWidth = value;
};
@ -380,7 +380,7 @@ mxAbstractCanvas2D.prototype.setStrokeWidth = function(value)
*
* Enables or disables dashed lines.
*/
mxAbstractCanvas2D.prototype.setDashed = function(value, fixDash)
mxAbstractCanvas2setDashed = (value, fixDash)=>
{
this.state.dashed = value;
this.state.fixDash = fixDash;
@ -391,7 +391,7 @@ mxAbstractCanvas2D.prototype.setDashed = function(value, fixDash)
*
* Sets the current dash pattern.
*/
mxAbstractCanvas2D.prototype.setDashPattern = function(value)
mxAbstractCanvas2setDashPattern = (value)=>
{
this.state.dashPattern = value;
};
@ -401,7 +401,7 @@ mxAbstractCanvas2D.prototype.setDashPattern = function(value)
*
* Sets the current line cap.
*/
mxAbstractCanvas2D.prototype.setLineCap = function(value)
mxAbstractCanvas2setLineCap = (value)=>
{
this.state.lineCap = value;
};
@ -411,7 +411,7 @@ mxAbstractCanvas2D.prototype.setLineCap = function(value)
*
* Sets the current line join.
*/
mxAbstractCanvas2D.prototype.setLineJoin = function(value)
mxAbstractCanvas2setLineJoin = (value)=>
{
this.state.lineJoin = value;
};
@ -421,7 +421,7 @@ mxAbstractCanvas2D.prototype.setLineJoin = function(value)
*
* Sets the current miter limit.
*/
mxAbstractCanvas2D.prototype.setMiterLimit = function(value)
mxAbstractCanvas2setMiterLimit = (value)=>
{
this.state.miterLimit = value;
};
@ -431,7 +431,7 @@ mxAbstractCanvas2D.prototype.setMiterLimit = function(value)
*
* Sets the current font color.
*/
mxAbstractCanvas2D.prototype.setFontColor = function(value)
mxAbstractCanvas2setFontColor = (value)=>
{
if (value == mxConstants.NONE)
{
@ -446,7 +446,7 @@ mxAbstractCanvas2D.prototype.setFontColor = function(value)
*
* Sets the current font background color.
*/
mxAbstractCanvas2D.prototype.setFontBackgroundColor = function(value)
mxAbstractCanvas2setFontBackgroundColor = (value)=>
{
if (value == mxConstants.NONE)
{
@ -461,7 +461,7 @@ mxAbstractCanvas2D.prototype.setFontBackgroundColor = function(value)
*
* Sets the current font border color.
*/
mxAbstractCanvas2D.prototype.setFontBorderColor = function(value)
mxAbstractCanvas2setFontBorderColor = (value)=>
{
if (value == mxConstants.NONE)
{
@ -476,7 +476,7 @@ mxAbstractCanvas2D.prototype.setFontBorderColor = function(value)
*
* Sets the current font size.
*/
mxAbstractCanvas2D.prototype.setFontSize = function(value)
mxAbstractCanvas2setFontSize = (value)=>
{
this.state.fontSize = parseFloat(value);
};
@ -486,7 +486,7 @@ mxAbstractCanvas2D.prototype.setFontSize = function(value)
*
* Sets the current font family.
*/
mxAbstractCanvas2D.prototype.setFontFamily = function(value)
mxAbstractCanvas2setFontFamily = (value)=>
{
this.state.fontFamily = value;
};
@ -496,7 +496,7 @@ mxAbstractCanvas2D.prototype.setFontFamily = function(value)
*
* Sets the current font style.
*/
mxAbstractCanvas2D.prototype.setFontStyle = function(value)
mxAbstractCanvas2setFontStyle = (value)=>
{
if (value == null)
{
@ -511,7 +511,7 @@ mxAbstractCanvas2D.prototype.setFontStyle = function(value)
*
* Enables or disables and configures the current shadow.
*/
mxAbstractCanvas2D.prototype.setShadow = function(enabled)
mxAbstractCanvas2setShadow = (enabled)=>
{
this.state.shadow = enabled;
};
@ -521,7 +521,7 @@ mxAbstractCanvas2D.prototype.setShadow = function(enabled)
*
* Enables or disables and configures the current shadow.
*/
mxAbstractCanvas2D.prototype.setShadowColor = function(value)
mxAbstractCanvas2setShadowColor = (value)=>
{
if (value == mxConstants.NONE)
{
@ -536,7 +536,7 @@ mxAbstractCanvas2D.prototype.setShadowColor = function(value)
*
* Enables or disables and configures the current shadow.
*/
mxAbstractCanvas2D.prototype.setShadowAlpha = function(value)
mxAbstractCanvas2setShadowAlpha = (value)=>
{
this.state.shadowAlpha = value;
};
@ -546,7 +546,7 @@ mxAbstractCanvas2D.prototype.setShadowAlpha = function(value)
*
* Enables or disables and configures the current shadow.
*/
mxAbstractCanvas2D.prototype.setShadowOffset = function(dx, dy)
mxAbstractCanvas2setShadowOffset = (dx, dy)=>
{
this.state.shadowDx = dx;
this.state.shadowDy = dy;
@ -557,7 +557,7 @@ mxAbstractCanvas2D.prototype.setShadowOffset = function(dx, dy)
*
* Starts a new path.
*/
mxAbstractCanvas2D.prototype.begin = function()
mxAbstractCanvas2begin = ()=>
{
this.lastX = 0;
this.lastY = 0;
@ -569,7 +569,7 @@ mxAbstractCanvas2D.prototype.begin = function()
*
* Moves the current path the given coordinates.
*/
mxAbstractCanvas2D.prototype.moveTo = function(x, y)
mxAbstractCanvas2moveTo = (x, y)=>
{
this.addOp(this.moveOp, x, y);
};
@ -579,7 +579,7 @@ mxAbstractCanvas2D.prototype.moveTo = function(x, y)
*
* Draws a line to the given coordinates. Uses moveTo with the op argument.
*/
mxAbstractCanvas2D.prototype.lineTo = function(x, y)
mxAbstractCanvas2lineTo = (x, y)=>
{
this.addOp(this.lineOp, x, y);
};
@ -589,7 +589,7 @@ mxAbstractCanvas2D.prototype.lineTo = function(x, y)
*
* Adds a quadratic curve to the current path.
*/
mxAbstractCanvas2D.prototype.quadTo = function(x1, y1, x2, y2)
mxAbstractCanvas2quadTo = (x1, y1, x2, y2)=>
{
this.addOp(this.quadOp, x1, y1, x2, y2);
};
@ -599,7 +599,7 @@ mxAbstractCanvas2D.prototype.quadTo = function(x1, y1, x2, y2)
*
* Adds a bezier curve to the current path.
*/
mxAbstractCanvas2D.prototype.curveTo = function(x1, y1, x2, y2, x3, y3)
mxAbstractCanvas2curveTo = (x1, y1, x2, y2, x3, y3)=>
{
this.addOp(this.curveOp, x1, y1, x2, y2, x3, y3);
};
@ -610,7 +610,7 @@ mxAbstractCanvas2D.prototype.curveTo = function(x1, y1, x2, y2, x3, y3)
* Adds the given arc to the current path. This is a synthetic operation that
* is broken down into curves.
*/
mxAbstractCanvas2D.prototype.arcTo = function(rx, ry, angle, largeArcFlag, sweepFlag, x, y)
mxAbstractCanvas2arcTo = (rx, ry, angle, largeArcFlag, sweepFlag, x, y)=>
{
var curves = mxUtils.arcToCurves(this.lastX, this.lastY, rx, ry, angle, largeArcFlag, sweepFlag, x, y);
@ -629,7 +629,7 @@ mxAbstractCanvas2D.prototype.arcTo = function(rx, ry, angle, largeArcFlag, sweep
*
* Closes the current path.
*/
mxAbstractCanvas2D.prototype.close = function(x1, y1, x2, y2, x3, y3)
mxAbstractCanvas2close = (x1, y1, x2, y2, x3, y3)=>
{
this.addOp(this.closeOp);
};
@ -639,4 +639,4 @@ mxAbstractCanvas2D.prototype.close = function(x1, y1, x2, y2, x3, y3)
*
* Empty implementation for backwards compatibility. This will be removed.
*/
mxAbstractCanvas2D.prototype.end = function() { };
mxAbstractCanvas2end = ()=> { };

View File

@ -25,28 +25,28 @@ function mxAnimation(delay)
* Extends mxEventSource.
*/
mxAnimation.prototype = new mxEventSource();
mxAnimation.prototype.constructor = mxAnimation;
constructor = mxAnimation;
/**
* Variable: delay
*
* Specifies the delay between the animation steps. Defaul is 30ms.
*/
mxAnimation.prototype.delay = null;
delay = null;
/**
* Variable: thread
*
* Reference to the thread while the animation is running.
*/
mxAnimation.prototype.thread = null;
thread = null;
/**
* Function: isRunning
*
* Returns true if the animation is running.
*/
mxAnimation.prototype.isRunning = function()
isRunning = ()=>
{
return this.thread != null;
};
@ -56,7 +56,7 @@ mxAnimation.prototype.isRunning = function()
*
* Starts the animation by repeatedly invoking updateAnimation.
*/
mxAnimation.prototype.startAnimation = function()
startAnimation = ()=>
{
if (this.thread == null)
{
@ -71,7 +71,7 @@ mxAnimation.prototype.startAnimation = function()
* when finished, startAnimation to resume. This is called whenever the
* timer fires and fires an mxEvent.EXECUTE event with no properties.
*/
mxAnimation.prototype.updateAnimation = function()
updateAnimation = ()=>
{
this.fireEvent(new mxEventObject(mxEvent.EXECUTE));
};
@ -81,7 +81,7 @@ mxAnimation.prototype.updateAnimation = function()
*
* Stops the animation by deleting the timer and fires an <mxEvent.DONE>.
*/
mxAnimation.prototype.stopAnimation = function()
stopAnimation = ()=>
{
if (this.thread != null)
{

View File

@ -12,7 +12,7 @@
*
* (code)
* var mgr = new mxAutoSaveManager(editor.graph);
* mgr.save = function()
* mgr.save = ()=>
* {
* mxLog.show();
* mxLog.debug('save');
@ -30,7 +30,7 @@
function mxAutoSaveManager(graph)
{
// Notifies the manager of a change
this.changeHandler = mxUtils.bind(this, function(sender, evt)
this.changeHandler = mxUtils.bind(this, (sender, evt)=>
{
if (this.isEnabled())
{
@ -45,14 +45,14 @@ function mxAutoSaveManager(graph)
* Extends mxEventSource.
*/
mxAutoSaveManager.prototype = new mxEventSource();
mxAutoSaveManager.prototype.constructor = mxAutoSaveManager;
constructor = mxAutoSaveManager;
/**
* Variable: graph
*
* Reference to the enclosing <mxGraph>.
*/
mxAutoSaveManager.prototype.graph = null;
graph = null;
/**
* Variable: autoSaveDelay
@ -61,7 +61,7 @@ mxAutoSaveManager.prototype.graph = null;
* value of 1 (s) means the graph is not stored more than once per second.
* Default is 10.
*/
mxAutoSaveManager.prototype.autoSaveDelay = 10;
autoSaveDelay = 10;
/**
* Variable: autoSaveThrottle
@ -72,7 +72,7 @@ mxAutoSaveManager.prototype.autoSaveDelay = 10;
* stored more than once per second even if there are more than
* <autoSaveThreshold> changes within that timespan. Default is 2.
*/
mxAutoSaveManager.prototype.autoSaveThrottle = 2;
autoSaveThrottle = 2;
/**
* Variable: autoSaveThreshold
@ -81,35 +81,35 @@ mxAutoSaveManager.prototype.autoSaveThrottle = 2;
* means after 2 change of the graph model the autosave will trigger if the
* condition below is true. Default is 5.
*/
mxAutoSaveManager.prototype.autoSaveThreshold = 5;
autoSaveThreshold = 5;
/**
* Variable: ignoredChanges
*
* Counter for ignored changes in autosave.
*/
mxAutoSaveManager.prototype.ignoredChanges = 0;
ignoredChanges = 0;
/**
* Variable: lastSnapshot
*
* Used for autosaving. See <autosave>.
*/
mxAutoSaveManager.prototype.lastSnapshot = 0;
lastSnapshot = 0;
/**
* Variable: enabled
*
* Specifies if event handling is enabled. Default is true.
*/
mxAutoSaveManager.prototype.enabled = true;
enabled = true;
/**
* Variable: changeHandler
*
* Holds the function that handles graph model changes.
*/
mxAutoSaveManager.prototype.changeHandler = null;
changeHandler = null;
/**
* Function: isEnabled
@ -117,7 +117,7 @@ mxAutoSaveManager.prototype.changeHandler = null;
* Returns true if events are handled. This implementation
* returns <enabled>.
*/
mxAutoSaveManager.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -132,7 +132,7 @@ mxAutoSaveManager.prototype.isEnabled = function()
*
* enabled - Boolean that specifies the new enabled state.
*/
mxAutoSaveManager.prototype.setEnabled = function(value)
setEnabled = (value)=>
{
this.enabled = value;
};
@ -142,7 +142,7 @@ mxAutoSaveManager.prototype.setEnabled = function(value)
*
* Sets the graph that the layouts operate on.
*/
mxAutoSaveManager.prototype.setGraph = function(graph)
setGraph = (graph)=>
{
if (this.graph != null)
{
@ -162,7 +162,7 @@ mxAutoSaveManager.prototype.setGraph = function(graph)
*
* Empty hook that is called if the graph should be saved.
*/
mxAutoSaveManager.prototype.save = function()
save = ()=>
{
// empty
};
@ -172,7 +172,7 @@ mxAutoSaveManager.prototype.save = function()
*
* Invoked when the graph model has changed.
*/
mxAutoSaveManager.prototype.graphModelChanged = function(changes)
graphModelChanged = (changes)=>
{
var now = new Date().getTime();
var dt = (now - this.lastSnapshot) / 1000;
@ -196,7 +196,7 @@ mxAutoSaveManager.prototype.graphModelChanged = function(changes)
*
* Resets all counters.
*/
mxAutoSaveManager.prototype.reset = function()
reset = ()=>
{
this.lastSnapshot = new Date().getTime();
this.ignoredChanges = 0;
@ -207,7 +207,7 @@ mxAutoSaveManager.prototype.reset = function()
*
* Removes all handlers from the <graph> and deletes the reference to it.
*/
mxAutoSaveManager.prototype.destroy = function()
destroy = ()=>
{
this.setGraph(null);
};

View File

@ -26,7 +26,7 @@ var mxClipboard =
* <copy> and <paste> can be changed as follows.
*
* (code)
* mxClipboard.copy = function(graph, cells)
* mxClipboard.copy = (graph, cells)=>
* {
* cells = cells || graph.getSelectionCells();
* var result = graph.getExportableCells(cells);
@ -44,7 +44,7 @@ var mxClipboard =
* return result;
* };
*
* mxClipboard.paste = function(graph)
* mxClipboard.paste = (graph)=>
* {
* if (!mxClipboard.isEmpty())
* {
@ -100,7 +100,7 @@ var mxClipboard =
*
* Sets the cells in the clipboard. Fires a <mxEvent.CHANGE> event.
*/
setCells: function(cells)
setCells: (cells)=>
{
mxClipboard.cells = cells;
},
@ -110,7 +110,7 @@ var mxClipboard =
*
* Returns the cells in the clipboard.
*/
getCells: function()
getCells: ()=>
{
return mxClipboard.cells;
},
@ -120,7 +120,7 @@ var mxClipboard =
*
* Returns true if the clipboard currently has not data stored.
*/
isEmpty: function()
isEmpty: ()=>
{
return mxClipboard.getCells() == null;
},
@ -137,7 +137,7 @@ var mxClipboard =
* graph - <mxGraph> that contains the cells to be cut.
* cells - Optional array of <mxCells> to be cut.
*/
cut: function(graph, cells)
cut: (graph, cells)=>
{
cells = mxClipboard.copy(graph, cells);
mxClipboard.insertCount = 0;
@ -157,7 +157,7 @@ var mxClipboard =
* graph - <mxGraph> that contains the cells to be cut.
* cells - Array of <mxCells> to be cut.
*/
removeCells: function(graph, cells)
removeCells: (graph, cells)=>
{
graph.removeCells(cells);
},
@ -174,7 +174,7 @@ var mxClipboard =
* graph - <mxGraph> that contains the cells to be copied.
* cells - Optional array of <mxCells> to be copied.
*/
copy: function(graph, cells)
copy: (graph, cells)=>
{
cells = cells || graph.getSelectionCells();
var result = graph.getExportableCells(graph.model.getTopmostCells(cells));
@ -199,7 +199,7 @@ var mxClipboard =
*
* graph - <mxGraph> to paste the <cells> into.
*/
paste: function(graph)
paste: (graph)=>
{
var cells = null;

View File

@ -22,14 +22,14 @@ function mxDictionary()
*
* Stores the (key, value) pairs in this dictionary.
*/
mxDictionary.prototype.map = null;
map = null;
/**
* Function: clear
*
* Clears the dictionary.
*/
mxDictionary.prototype.clear = function()
clear = ()=>
{
this.map = {};
};
@ -39,7 +39,7 @@ mxDictionary.prototype.clear = function()
*
* Returns the value for the given key.
*/
mxDictionary.prototype.get = function(key)
get = (key)=>
{
var id = mxObjectIdentity.get(key);
@ -52,7 +52,7 @@ mxDictionary.prototype.get = function(key)
* Stores the value under the given key and returns the previous
* value for that key.
*/
mxDictionary.prototype.put = function(key, value)
put = (key, value)=>
{
var id = mxObjectIdentity.get(key);
var previous = this.map[id];
@ -67,7 +67,7 @@ mxDictionary.prototype.put = function(key, value)
* Removes the value for the given key and returns the value that
* has been removed.
*/
mxDictionary.prototype.remove = function(key)
remove = (key)=>
{
var id = mxObjectIdentity.get(key);
var previous = this.map[id];
@ -81,7 +81,7 @@ mxDictionary.prototype.remove = function(key)
*
* Returns all keys as an array.
*/
mxDictionary.prototype.getKeys = function()
getKeys = ()=>
{
var result = [];
@ -98,7 +98,7 @@ mxDictionary.prototype.getKeys = function()
*
* Returns all values as an array.
*/
mxDictionary.prototype.getValues = function()
getValues = ()=>
{
var result = [];
@ -114,14 +114,14 @@ mxDictionary.prototype.getValues = function()
* Function: visit
*
* Visits all entries in the dictionary using the given function with the
* following signature: function(key, value) where key is a string and
* following signature: (key, value)=> where key is a string and
* value is an object.
*
* Parameters:
*
* visitor - A function that takes the key and value as arguments.
*/
mxDictionary.prototype.visit = function(visitor)
visit = (visitor)=>
{
for (var key in this.map)
{

View File

@ -13,11 +13,11 @@
*
* (code)
* var resizer = new mxDivResizer(background);
* resizer.getDocumentHeight = function()
* resizer.getDocumentHeight = ()=>
* {
* return document.body.scrollHeight;
* }
* resizer.getDocumentWidth = function()
* resizer.getDocumentWidth = ()=>
* {
* return document.body.scrollWidth;
* }
@ -56,7 +56,7 @@ function mxDivResizer(div, container)
}
mxEvent.addListener(container, 'resize',
mxUtils.bind(this, function(evt)
mxUtils.bind(this, (evt)=>
{
if (!this.handlingResize)
{
@ -76,28 +76,28 @@ function mxDivResizer(div, container)
*
* Boolean specifying if the width should be updated.
*/
mxDivResizer.prototype.resizeWidth = true;
resizeWidth = true;
/**
* Function: resizeHeight
*
* Boolean specifying if the height should be updated.
*/
mxDivResizer.prototype.resizeHeight = true;
resizeHeight = true;
/**
* Function: handlingResize
*
* Boolean specifying if the width should be updated.
*/
mxDivResizer.prototype.handlingResize = false;
handlingResize = false;
/**
* Function: resize
*
* Updates the style of the DIV after the window has been resized.
*/
mxDivResizer.prototype.resize = function()
resize = ()=>
{
var w = this.getDocumentWidth();
var h = this.getDocumentHeight();
@ -134,7 +134,7 @@ mxDivResizer.prototype.resize = function()
* Hook for subclassers to return the width of the document (without
* scrollbars).
*/
mxDivResizer.prototype.getDocumentWidth = function()
getDocumentWidth = ()=>
{
return document.body.clientWidth;
};
@ -145,7 +145,7 @@ mxDivResizer.prototype.getDocumentWidth = function()
* Hook for subclassers to return the height of the document (without
* scrollbars).
*/
mxDivResizer.prototype.getDocumentHeight = function()
getDocumentHeight = ()=>
{
return document.body.clientHeight;
};

View File

@ -21,18 +21,18 @@ function mxDragSource(element, dropHandler)
this.dropHandler = dropHandler;
// Handles a drag gesture on the element
mxEvent.addGestureListeners(element, mxUtils.bind(this, function(evt)
mxEvent.addGestureListeners(element, mxUtils.bind(this, (evt)=>
{
this.mouseDown(evt);
}));
// Prevents native drag and drop
mxEvent.addListener(element, 'dragstart', function(evt)
mxEvent.addListener(element, 'dragstart', (evt)=>
{
mxEvent.consume(evt);
});
this.eventConsumer = function(sender, evt)
this.eventConsumer = (sender, evt)=>
{
var evtName = evt.getProperty('eventName');
var me = evt.getProperty('event');
@ -49,7 +49,7 @@ function mxDragSource(element, dropHandler)
*
* Reference to the DOM node which was made draggable.
*/
mxDragSource.prototype.element = null;
element = null;
/**
* Variable: dropHandler
@ -57,14 +57,14 @@ mxDragSource.prototype.element = null;
* Holds the DOM node that is used to represent the drag preview. If this is
* null then the source element will be cloned and used for the drag preview.
*/
mxDragSource.prototype.dropHandler = null;
dropHandler = null;
/**
* Variable: dragOffset
*
* <mxPoint> that specifies the offset of the <dragElement>. Default is null.
*/
mxDragSource.prototype.dragOffset = null;
dragOffset = null;
/**
* Variable: dragElement
@ -72,105 +72,105 @@ mxDragSource.prototype.dragOffset = null;
* Holds the DOM node that is used to represent the drag preview. If this is
* null then the source element will be cloned and used for the drag preview.
*/
mxDragSource.prototype.dragElement = null;
dragElement = null;
/**
* Variable: previewElement
*
* Optional <mxRectangle> that specifies the unscaled size of the preview.
*/
mxDragSource.prototype.previewElement = null;
previewElement = null;
/**
* Variable: previewOffset
*
* Optional <mxPoint> that specifies the offset of the preview in pixels.
*/
mxDragSource.prototype.previewOffset = null;
previewOffset = null;
/**
* Variable: enabled
*
* Specifies if this drag source is enabled. Default is true.
*/
mxDragSource.prototype.enabled = true;
enabled = true;
/**
* Variable: currentGraph
*
* Reference to the <mxGraph> that is the current drop target.
*/
mxDragSource.prototype.currentGraph = null;
currentGraph = null;
/**
* Variable: currentDropTarget
*
* Holds the current drop target under the mouse.
*/
mxDragSource.prototype.currentDropTarget = null;
currentDropTarget = null;
/**
* Variable: currentPoint
*
* Holds the current drop location.
*/
mxDragSource.prototype.currentPoint = null;
currentPoint = null;
/**
* Variable: currentGuide
*
* Holds an <mxGuide> for the <currentGraph> if <dragPreview> is not null.
*/
mxDragSource.prototype.currentGuide = null;
currentGuide = null;
/**
* Variable: currentGuide
*
* Holds an <mxGuide> for the <currentGraph> if <dragPreview> is not null.
*/
mxDragSource.prototype.currentHighlight = null;
currentHighlight = null;
/**
* Variable: autoscroll
*
* Specifies if the graph should scroll automatically. Default is true.
*/
mxDragSource.prototype.autoscroll = true;
autoscroll = true;
/**
* Variable: guidesEnabled
*
* Specifies if <mxGuide> should be enabled. Default is true.
*/
mxDragSource.prototype.guidesEnabled = true;
guidesEnabled = true;
/**
* Variable: gridEnabled
*
* Specifies if the grid should be allowed. Default is true.
*/
mxDragSource.prototype.gridEnabled = true;
gridEnabled = true;
/**
* Variable: highlightDropTargets
*
* Specifies if drop targets should be highlighted. Default is true.
*/
mxDragSource.prototype.highlightDropTargets = true;
highlightDropTargets = true;
/**
* Variable: dragElementZIndex
*
* ZIndex for the drag element. Default is 100.
*/
mxDragSource.prototype.dragElementZIndex = 100;
dragElementZIndex = 100;
/**
* Variable: dragElementOpacity
*
* Opacity of the drag element in %. Default is 70.
*/
mxDragSource.prototype.dragElementOpacity = 70;
dragElementOpacity = 70;
/**
* Variable: checkEventSource
@ -178,14 +178,14 @@ mxDragSource.prototype.dragElementOpacity = 70;
* Whether the event source should be checked in <graphContainerEvent>. Default
* is true.
*/
mxDragSource.prototype.checkEventSource = true;
checkEventSource = true;
/**
* Function: isEnabled
*
* Returns <enabled>.
*/
mxDragSource.prototype.isEnabled = function()
isEnabled = ()=>
{
return this.enabled;
};
@ -195,7 +195,7 @@ mxDragSource.prototype.isEnabled = function()
*
* Sets <enabled>.
*/
mxDragSource.prototype.setEnabled = function(value)
setEnabled = (value)=>
{
this.enabled = value;
};
@ -205,7 +205,7 @@ mxDragSource.prototype.setEnabled = function(value)
*
* Returns <guidesEnabled>.
*/
mxDragSource.prototype.isGuidesEnabled = function()
isGuidesEnabled = ()=>
{
return this.guidesEnabled;
};
@ -215,7 +215,7 @@ mxDragSource.prototype.isGuidesEnabled = function()
*
* Sets <guidesEnabled>.
*/
mxDragSource.prototype.setGuidesEnabled = function(value)
setGuidesEnabled = (value)=>
{
this.guidesEnabled = value;
};
@ -225,7 +225,7 @@ mxDragSource.prototype.setGuidesEnabled = function(value)
*
* Returns <gridEnabled>.
*/
mxDragSource.prototype.isGridEnabled = function()
isGridEnabled = ()=>
{
return this.gridEnabled;
};
@ -235,7 +235,7 @@ mxDragSource.prototype.isGridEnabled = function()
*
* Sets <gridEnabled>.
*/
mxDragSource.prototype.setGridEnabled = function(value)
setGridEnabled = (value)=>
{
this.gridEnabled = value;
};
@ -246,7 +246,7 @@ mxDragSource.prototype.setGridEnabled = function(value)
* Returns the graph for the given mouse event. This implementation returns
* null.
*/
mxDragSource.prototype.getGraphForEvent = function(evt)
getGraphForEvent = (evt)=>
{
return null;
};
@ -257,7 +257,7 @@ mxDragSource.prototype.getGraphForEvent = function(evt)
* Returns the drop target for the given graph and coordinates. This
* implementation uses <mxGraph.getCellAt>.
*/
mxDragSource.prototype.getDropTarget = function(graph, x, y, evt)
getDropTarget = (graph, x, y, evt)=>
{
return graph.getCellAt(x, y);
};
@ -268,7 +268,7 @@ mxDragSource.prototype.getDropTarget = function(graph, x, y, evt)
* Creates and returns a clone of the <dragElementPrototype> or the <element>
* if the former is not defined.
*/
mxDragSource.prototype.createDragElement = function(evt)
createDragElement = (evt)=>
{
return this.element.cloneNode(true);
};
@ -279,7 +279,7 @@ mxDragSource.prototype.createDragElement = function(evt)
* Creates and returns an element which can be used as a preview in the given
* graph.
*/
mxDragSource.prototype.createPreviewElement = function(graph)
createPreviewElement = (graph)=>
{
return null;
};
@ -289,7 +289,7 @@ mxDragSource.prototype.createPreviewElement = function(graph)
*
* Returns true if this drag source is active.
*/
mxDragSource.prototype.isActive = function()
isActive = ()=>
{
return this.mouseMoveHandler != null;
};
@ -299,7 +299,7 @@ mxDragSource.prototype.isActive = function()
*
* Stops and removes everything and restores the state of the object.
*/
mxDragSource.prototype.reset = function()
reset = ()=>
{
if (this.currentGraph != null)
{
@ -324,7 +324,7 @@ mxDragSource.prototype.reset = function()
* (code)
* var mouseDown = dragSource.mouseDown;
*
* dragSource.mouseDown = function(evt)
* dragSource.mouseDown = (evt)=>
* {
* if (!mxEvent.isPopupTrigger(evt))
* {
@ -333,7 +333,7 @@ mxDragSource.prototype.reset = function()
* };
* (end)
*/
mxDragSource.prototype.mouseDown = function(evt)
mouseDown = (evt)=>
{
if (this.enabled && !mxEvent.isConsumed(evt) && this.mouseMoveHandler == null)
{
@ -355,7 +355,7 @@ mxDragSource.prototype.mouseDown = function(evt)
*
* Creates the <dragElement> using <createDragElement>.
*/
mxDragSource.prototype.startDrag = function(evt)
startDrag = (evt)=>
{
this.dragElement = this.createDragElement(evt);
this.dragElement.style.position = 'absolute';
@ -373,7 +373,7 @@ mxDragSource.prototype.startDrag = function(evt)
*
* Invokes <removeDragElement>.
*/
mxDragSource.prototype.stopDrag = function()
stopDrag = ()=>
{
// LATER: This used to have a mouse event. If that is still needed we need to add another
// final call to the DnD protocol to add a cleanup step in the case of escape press, which
@ -386,7 +386,7 @@ mxDragSource.prototype.stopDrag = function()
*
* Removes and destroys the <dragElement>.
*/
mxDragSource.prototype.removeDragElement = function()
removeDragElement = ()=>
{
if (this.dragElement != null)
{
@ -404,7 +404,7 @@ mxDragSource.prototype.removeDragElement = function()
*
* Returns the topmost element under the given event.
*/
mxDragSource.prototype.getElementForEvent = function(evt)
getElementForEvent = (evt)=>
{
return ((mxEvent.isTouchEvent(evt) || mxEvent.isPenEvent(evt)) ?
document.elementFromPoint(mxEvent.getClientX(evt), mxEvent.getClientY(evt)) :
@ -416,7 +416,7 @@ mxDragSource.prototype.getElementForEvent = function(evt)
*
* Returns true if the given graph contains the given event.
*/
mxDragSource.prototype.graphContainsEvent = function(graph, evt)
graphContainsEvent = (graph, evt)=>
{
var x = mxEvent.getClientX(evt);
var y = mxEvent.getClientY(evt);
@ -445,7 +445,7 @@ mxDragSource.prototype.graphContainsEvent = function(graph, evt)
* <currentGraph>, calling <dragEnter> and <dragExit> on the new and old graph,
* respectively, and invokes <dragOver> if <currentGraph> is not null.
*/
mxDragSource.prototype.mouseMove = function(evt)
mouseMove = (evt)=>
{
var graph = this.getGraphForEvent(evt);
@ -512,7 +512,7 @@ mxDragSource.prototype.mouseMove = function(evt)
* Processes the mouse up event and invokes <drop>, <dragExit> and <stopDrag>
* as required.
*/
mxDragSource.prototype.mouseUp = function(evt)
mouseUp = (evt)=>
{
if (this.currentGraph != null)
{
@ -542,7 +542,7 @@ mxDragSource.prototype.mouseUp = function(evt)
*
* Actives the given graph as a drop target.
*/
mxDragSource.prototype.removeListeners = function()
removeListeners = ()=>
{
if (this.eventSource != null)
{
@ -560,7 +560,7 @@ mxDragSource.prototype.removeListeners = function()
*
* Actives the given graph as a drop target.
*/
mxDragSource.prototype.dragEnter = function(graph, evt)
dragEnter = (graph, evt)=>
{
graph.isMouseDown = true;
graph.isMouseTrigger = mxEvent.isMouseEvent(evt);
@ -591,7 +591,7 @@ mxDragSource.prototype.dragEnter = function(graph, evt)
*
* Deactivates the given graph as a drop target.
*/
mxDragSource.prototype.dragExit = function(graph, evt)
dragExit = (graph, evt)=>
{
this.currentDropTarget = null;
this.currentPoint = null;
@ -629,7 +629,7 @@ mxDragSource.prototype.dragExit = function(graph, evt)
* Implements autoscroll, updates the <currentPoint>, highlights any drop
* targets and updates the preview.
*/
mxDragSource.prototype.dragOver = function(graph, evt)
dragOver = (graph, evt)=>
{
var offset = mxUtils.getOffset(graph.container);
var origin = mxUtils.getScrollOrigin(graph.container);
@ -710,7 +710,7 @@ mxDragSource.prototype.dragOver = function(graph, evt)
* Returns the drop target for the given graph and coordinates. This
* implementation uses <mxGraph.getCellAt>.
*/
mxDragSource.prototype.drop = function(graph, evt, dropTarget, x, y)
drop = (graph, evt, dropTarget, x, y)=>
{
this.dropHandler.apply(this, arguments);

View File

@ -19,7 +19,7 @@ var mxEffects =
* Example:
*
* (code)
* graph.model.addListener(mxEvent.CHANGE, function(sender, evt)
* graph.model.addListener(mxEvent.CHANGE, (sender, evt)=>
* {
* var changes = evt.getProperty('edit').changes;
*
@ -37,12 +37,12 @@ var mxEffects =
* done - Optional function argument that is invoked after the
* last step of the animation.
*/
animateChanges: function(graph, changes, done)
animateChanges: (graph, changes, done)=>
{
var maxStep = 10;
var step = 0;
var animate = function()
var animate = ()=>
{
var isRequired = false;
@ -126,7 +126,7 @@ var mxEffects =
* cell - <mxCell> to set the opacity for.
* opacity - New value for the opacity in %.
*/
cascadeOpacity: function(graph, cell, opacity)
cascadeOpacity: (graph, cell, opacity)=>
{
// Fades all children
var childCount = graph.model.getChildCount(cell);
@ -165,7 +165,7 @@ var mxEffects =
*
* Asynchronous fade-out operation.
*/
fadeOut: function(node, from, remove, step, delay, isEnabled)
fadeOut: (node, from, remove, step, delay, isEnabled)=>
{
step = step || 40;
delay = delay || 30;
@ -176,7 +176,7 @@ var mxEffects =
if (isEnabled || isEnabled == null)
{
var f = function()
var f = ()=>
{
opacity = Math.max(opacity-step, 0);
mxUtils.setOpacity(node, opacity);

View File

@ -25,9 +25,9 @@ var mxEvent =
* <mxUtils.bind> in order to bind the "this" keyword inside the function
* to a given execution scope.
*/
addListener: function()
addListener: ()=>
{
var updateListenerList = function(element, eventName, funct)
var updateListenerList = (element, eventName, funct)=>
{
if (element.mxListenerList == null)
{
@ -46,8 +46,8 @@ var mxEvent =
try
{
document.addEventListener('test', function() {}, Object.defineProperty &&
Object.defineProperty({}, 'passive', {get: function()
document.addEventListener('test', ()=> {}, Object.defineProperty &&
Object.defineProperty({}, 'passive', {get: ()=>
{supportsPassive = true;}}));
}
catch (e)
@ -55,7 +55,7 @@ var mxEvent =
// ignore
}
return function(element, eventName, funct)
return (element, eventName, funct)=>
{
element.addEventListener(eventName, funct,
(supportsPassive) ?
@ -65,7 +65,7 @@ var mxEvent =
}
else
{
return function(element, eventName, funct)
return (element, eventName, funct)=>
{
element.attachEvent('on' + eventName, funct);
updateListenerList(element, eventName, funct);
@ -78,9 +78,9 @@ var mxEvent =
*
* Removes the specified listener from the given element.
*/
removeListener: function()
removeListener: ()=>
{
var updateListener = function(element, eventName, funct)
var updateListener = (element, eventName, funct)=>
{
if (element.mxListenerList != null)
{
@ -106,7 +106,7 @@ var mxEvent =
if (window.removeEventListener)
{
return function(element, eventName, funct)
return (element, eventName, funct)=>
{
element.removeEventListener(eventName, funct, false);
updateListener(element, eventName, funct);
@ -114,7 +114,7 @@ var mxEvent =
}
else
{
return function(element, eventName, funct)
return (element, eventName, funct)=>
{
element.detachEvent('on' + eventName, funct);
updateListener(element, eventName, funct);
@ -127,7 +127,7 @@ var mxEvent =
*
* Removes all listeners from the given element.
*/
removeAllListeners: function(element)
removeAllListeners: (element)=>
{
var list = element.mxListenerList;
@ -150,7 +150,7 @@ var mxEvent =
* is false and <mxClient.IS_TOUCH> is true then the respective touch events
* will be registered as well as the mouse events.
*/
addGestureListeners: function(node, startListener, moveListener, endListener)
addGestureListeners: (node, startListener, moveListener, endListener)=>
{
if (startListener != null)
{
@ -192,7 +192,7 @@ var mxEvent =
* Removes the given listeners from mousedown, mousemove, mouseup and the
* respective touch events if <mxClient.IS_TOUCH> is true.
*/
removeGestureListeners: function(node, startListener, moveListener, endListener)
removeGestureListeners: (node, startListener, moveListener, endListener)=>
{
if (startListener != null)
{
@ -238,9 +238,9 @@ var mxEvent =
* functions that take the trigger event as arguments and replace the
* default behaviour.
*/
redirectMouseEvents: function(node, graph, state, down, move, up, dblClick)
redirectMouseEvents: (node, graph, state, down, move, up, dblClick)=>
{
var getState = function(evt)
var getState = (evt)=>
{
return (typeof(state) == 'function') ? state(evt) : state;
};
@ -302,7 +302,7 @@ var mxEvent =
*
* element - DOM node to remove the listeners from.
*/
release: function(element)
release: (element)=>
{
try
{
@ -357,11 +357,11 @@ var mxEvent =
* target - Target for installing the listener in Google Chrome. See
* https://www.chromestatus.com/features/6662647093133312.
*/
addMouseWheelListener: function(funct, target)
addMouseWheelListener: (funct, target)=>
{
if (funct != null)
{
var wheelHandler = function(evt)
var wheelHandler = (evt)=>
{
// IE does not give an event object but the
// global event object is the mousewheel event
@ -390,13 +390,13 @@ var mxEvent =
{
var scale = 1;
mxEvent.addListener(target, 'gesturestart', function(evt)
mxEvent.addListener(target, 'gesturestart', (evt)=>
{
mxEvent.consume(evt);
scale = 1;
});
mxEvent.addListener(target, 'gesturechange', function(evt)
mxEvent.addListener(target, 'gesturechange', (evt)=>
{
mxEvent.consume(evt);
var diff = scale - evt.scale;
@ -408,7 +408,7 @@ var mxEvent =
}
});
mxEvent.addListener(target, 'gestureend', function(evt)
mxEvent.addListener(target, 'gestureend', (evt)=>
{
mxEvent.consume(evt);
});
@ -420,14 +420,14 @@ var mxEvent =
var dy0 = 0;
// Adds basic listeners for graph event dispatching
mxEvent.addGestureListeners(target, mxUtils.bind(this, function(evt)
mxEvent.addGestureListeners(target, mxUtils.bind(this, (evt)=>
{
if (!mxEvent.isMouseEvent(evt) && evt.pointerId != null)
{
evtCache.push(evt);
}
}),
mxUtils.bind(this, function(evt)
mxUtils.bind(this, (evt)=>
{
if (!mxEvent.isMouseEvent(evt) && evtCache.length == 2)
{
@ -460,7 +460,7 @@ var mxEvent =
}
}
}),
mxUtils.bind(this, function(evt)
mxUtils.bind(this, (evt)=>
{
evtCache = [];
dx0 = 0;
@ -477,9 +477,9 @@ var mxEvent =
*
* Disables the context menu for the given element.
*/
disableContextMenu: function(element)
disableContextMenu: (element)=>
{
mxEvent.addListener(element, 'contextmenu', function(evt)
mxEvent.addListener(element, 'contextmenu', (evt)=>
{
if (evt.preventDefault)
{
@ -495,7 +495,7 @@ var mxEvent =
*
* Returns the event's target or srcElement depending on the browser.
*/
getSource: function(evt)
getSource: (evt)=>
{
return (evt.srcElement != null) ? evt.srcElement : evt.target;
},
@ -505,7 +505,7 @@ var mxEvent =
*
* Returns true if the event has been consumed using <consume>.
*/
isConsumed: function(evt)
isConsumed: (evt)=>
{
return evt.isConsumed != null && evt.isConsumed;
},
@ -515,7 +515,7 @@ var mxEvent =
*
* Returns true if the event was generated using a touch device (not a pen or mouse).
*/
isTouchEvent: function(evt)
isTouchEvent: (evt)=>
{
return (evt.pointerType != null) ? (evt.pointerType == 'touch' || evt.pointerType ===
evt.MSPOINTER_TYPE_TOUCH) : ((evt.mozInputSource != null) ?
@ -527,7 +527,7 @@ var mxEvent =
*
* Returns true if the event was generated using a pen (not a touch device or mouse).
*/
isPenEvent: function(evt)
isPenEvent: (evt)=>
{
return (evt.pointerType != null) ? (evt.pointerType == 'pen' || evt.pointerType ===
evt.MSPOINTER_TYPE_PEN) : ((evt.mozInputSource != null) ?
@ -539,7 +539,7 @@ var mxEvent =
*
* Returns true if the event was generated using a touch device (not a pen or mouse).
*/
isMultiTouchEvent: function(evt)
isMultiTouchEvent: (evt)=>
{
return (evt.type != null && evt.type.indexOf('touch') == 0 && evt.touches != null && evt.touches.length > 1);
},
@ -549,7 +549,7 @@ var mxEvent =
*
* Returns true if the event was generated using a mouse (not a pen or touch device).
*/
isMouseEvent: function(evt)
isMouseEvent: (evt)=>
{
return (evt.pointerType != null) ? (evt.pointerType == 'mouse' || evt.pointerType ===
evt.MSPOINTER_TYPE_MOUSE) : ((evt.mozInputSource != null) ?
@ -564,7 +564,7 @@ var mxEvent =
* <mxGraph.isMouseDown> property. Note that this returns true in Firefox
* for control+left-click on the Mac.
*/
isLeftMouseButton: function(evt)
isLeftMouseButton: (evt)=>
{
// Special case for mousemove and mousedown we check the buttons
// if it exists because which is 0 even if no button is pressed
@ -589,7 +589,7 @@ var mxEvent =
* To check if a button is pressed during a mouseMove you should use the
* <mxGraph.isMouseDown> property.
*/
isMiddleMouseButton: function(evt)
isMiddleMouseButton: (evt)=>
{
if ('which' in evt)
{
@ -608,7 +608,7 @@ var mxEvent =
* button might not be available on some systems. For handling a popup
* trigger <isPopupTrigger> should be used.
*/
isRightMouseButton: function(evt)
isRightMouseButton: (evt)=>
{
if ('which' in evt)
{
@ -627,7 +627,7 @@ var mxEvent =
* returns true if the right button or the left button and control was
* pressed on a Mac.
*/
isPopupTrigger: function(evt)
isPopupTrigger: (evt)=>
{
return mxEvent.isRightMouseButton(evt) || (mxClient.IS_MAC && mxEvent.isControlDown(evt) &&
!mxEvent.isShiftDown(evt) && !mxEvent.isMetaDown(evt) && !mxEvent.isAltDown(evt));
@ -638,7 +638,7 @@ var mxEvent =
*
* Returns true if the shift key is pressed for the given event.
*/
isShiftDown: function(evt)
isShiftDown: (evt)=>
{
return (evt != null) ? evt.shiftKey : false;
},
@ -648,7 +648,7 @@ var mxEvent =
*
* Returns true if the alt key is pressed for the given event.
*/
isAltDown: function(evt)
isAltDown: (evt)=>
{
return (evt != null) ? evt.altKey : false;
},
@ -658,7 +658,7 @@ var mxEvent =
*
* Returns true if the control key is pressed for the given event.
*/
isControlDown: function(evt)
isControlDown: (evt)=>
{
return (evt != null) ? evt.ctrlKey : false;
},
@ -668,7 +668,7 @@ var mxEvent =
*
* Returns true if the meta key is pressed for the given event.
*/
isMetaDown: function(evt)
isMetaDown: (evt)=>
{
return (evt != null) ? evt.metaKey : false;
},
@ -678,7 +678,7 @@ var mxEvent =
*
* Returns the touch or mouse event that contains the mouse coordinates.
*/
getMainEvent: function(e)
getMainEvent: (e)=>
{
if ((e.type == 'touchstart' || e.type == 'touchmove') && e.touches != null && e.touches[0] != null)
{
@ -697,7 +697,7 @@ var mxEvent =
*
* Returns true if the meta key is pressed for the given event.
*/
getClientX: function(e)
getClientX: (e)=>
{
return mxEvent.getMainEvent(e).clientX;
},
@ -707,7 +707,7 @@ var mxEvent =
*
* Returns true if the meta key is pressed for the given event.
*/
getClientY: function(e)
getClientY: (e)=>
{
return mxEvent.getMainEvent(e).clientY;
},
@ -725,7 +725,7 @@ var mxEvent =
* stopPropagation - Option boolean to stop event propagation. Default is
* true.
*/
consume: function(evt, preventDefault, stopPropagation)
consume: (evt, preventDefault, stopPropagation)=>
{
preventDefault = (preventDefault != null) ? preventDefault : true;
stopPropagation = (stopPropagation != null) ? stopPropagation : true;

View File

@ -44,28 +44,28 @@ function mxEventObject(name)
*
* Holds the name.
*/
mxEventObject.prototype.name = null;
name = null;
/**
* Variable: properties
*
* Holds the properties as an associative array.
*/
mxEventObject.prototype.properties = null;
properties = null;
/**
* Variable: consumed
*
* Holds the consumed state. Default is false.
*/
mxEventObject.prototype.consumed = false;
consumed = false;
/**
* Function: getName
*
* Returns <name>.
*/
mxEventObject.prototype.getName = function()
getName = ()=>
{
return this.name;
};
@ -75,7 +75,7 @@ mxEventObject.prototype.getName = function()
*
* Returns <properties>.
*/
mxEventObject.prototype.getProperties = function()
getProperties = ()=>
{
return this.properties;
};
@ -85,7 +85,7 @@ mxEventObject.prototype.getProperties = function()
*
* Returns the property for the given key.
*/
mxEventObject.prototype.getProperty = function(key)
getProperty = (key)=>
{
return this.properties[key];
};
@ -95,7 +95,7 @@ mxEventObject.prototype.getProperty = function(key)
*
* Returns true if the event has been consumed.
*/
mxEventObject.prototype.isConsumed = function()
isConsumed = ()=>
{
return this.consumed;
};
@ -105,7 +105,7 @@ mxEventObject.prototype.isConsumed = function()
*
* Consumes the event.
*/
mxEventObject.prototype.consume = function()
consume = ()=>
{
this.consumed = true;
};

View File

@ -12,7 +12,7 @@
* function MyClass() { };
*
* MyClass.prototype = new mxEventSource();
* MyClass.prototype.constructor = MyClass;
* constructor = MyClass;
* (end)
*
* Known Subclasses:
@ -36,28 +36,28 @@ function mxEventSource(eventSource)
* contains the event name followed by the respective listener for each
* registered listener.
*/
mxEventSource.prototype.eventListeners = null;
eventListeners = null;
/**
* Variable: eventsEnabled
*
* Specifies if events can be fired. Default is true.
*/
mxEventSource.prototype.eventsEnabled = true;
eventsEnabled = true;
/**
* Variable: eventSource
*
* Optional source for events. Default is null.
*/
mxEventSource.prototype.eventSource = null;
eventSource = null;
/**
* Function: isEventsEnabled
*
* Returns <eventsEnabled>.
*/
mxEventSource.prototype.isEventsEnabled = function()
isEventsEnabled = ()=>
{
return this.eventsEnabled;
};
@ -67,7 +67,7 @@ mxEventSource.prototype.isEventsEnabled = function()
*
* Sets <eventsEnabled>.
*/
mxEventSource.prototype.setEventsEnabled = function(value)
setEventsEnabled = (value)=>
{
this.eventsEnabled = value;
};
@ -77,7 +77,7 @@ mxEventSource.prototype.setEventsEnabled = function(value)
*
* Returns <eventSource>.
*/
mxEventSource.prototype.getEventSource = function()
getEventSource = ()=>
{
return this.eventSource;
};
@ -87,7 +87,7 @@ mxEventSource.prototype.getEventSource = function()
*
* Sets <eventSource>.
*/
mxEventSource.prototype.setEventSource = function(value)
setEventSource = (value)=>
{
this.eventSource = value;
};
@ -100,7 +100,7 @@ mxEventSource.prototype.setEventSource = function(value)
*
* The parameters of the listener are the sender and an <mxEventObject>.
*/
mxEventSource.prototype.addListener = function(name, funct)
addListener = (name, funct)=>
{
if (this.eventListeners == null)
{
@ -116,7 +116,7 @@ mxEventSource.prototype.addListener = function(name, funct)
*
* Removes all occurrences of the given listener from <eventListeners>.
*/
mxEventSource.prototype.removeListener = function(funct)
removeListener = (funct)=>
{
if (this.eventListeners != null)
{
@ -155,7 +155,7 @@ mxEventSource.prototype.removeListener = function(funct)
* sender - Optional sender to be passed to the listener. Default value is
* the return value of <getEventSource>.
*/
mxEventSource.prototype.fireEvent = function(evt, sender)
fireEvent = (evt, sender)=>
{
if (this.eventListeners != null && this.isEventsEnabled())
{

View File

@ -25,7 +25,7 @@ function mxForm(className)
*
* Holds the DOM node that represents the table.
*/
mxForm.prototype.table = null;
table = null;
/**
* Variable: body
@ -33,14 +33,14 @@ mxForm.prototype.table = null;
* Holds the DOM node that represents the tbody (table body). New rows
* can be added to this object using DOM API.
*/
mxForm.prototype.body = false;
body = false;
/**
* Function: getTable
*
* Returns the table that contains this form.
*/
mxForm.prototype.getTable = function()
getTable = ()=>
{
return this.table;
};
@ -51,7 +51,7 @@ mxForm.prototype.getTable = function()
* Helper method to add an OK and Cancel button using the respective
* functions.
*/
mxForm.prototype.addButtons = function(okFunct, cancelFunct)
addButtons = (okFunct, cancelFunct)=>
{
var tr = document.createElement('tr');
var td = document.createElement('td');
@ -63,7 +63,7 @@ mxForm.prototype.addButtons = function(okFunct, cancelFunct)
mxUtils.write(button, mxResources.get('ok') || 'OK');
td.appendChild(button);
mxEvent.addListener(button, 'click', function()
mxEvent.addListener(button, 'click', ()=>
{
okFunct();
});
@ -73,7 +73,7 @@ mxForm.prototype.addButtons = function(okFunct, cancelFunct)
mxUtils.write(button, mxResources.get('cancel') || 'Cancel');
td.appendChild(button);
mxEvent.addListener(button, 'click', function()
mxEvent.addListener(button, 'click', ()=>
{
cancelFunct();
});
@ -87,7 +87,7 @@ mxForm.prototype.addButtons = function(okFunct, cancelFunct)
*
* Adds an input for the given name, type and value and returns it.
*/
mxForm.prototype.addText = function(name, value, type)
addText = (name, value, type)=>
{
var input = document.createElement('input');
@ -102,7 +102,7 @@ mxForm.prototype.addText = function(name, value, type)
*
* Adds a checkbox for the given name and value and returns the textfield.
*/
mxForm.prototype.addCheckbox = function(name, value)
addCheckbox = (name, value)=>
{
var input = document.createElement('input');
@ -123,7 +123,7 @@ mxForm.prototype.addCheckbox = function(name, value)
*
* Adds a textarea for the given name and value and returns the textarea.
*/
mxForm.prototype.addTextarea = function(name, value, rows)
addTextarea = (name, value, rows)=>
{
var input = document.createElement('textarea');
@ -143,7 +143,7 @@ mxForm.prototype.addTextarea = function(name, value, rows)
*
* Adds a combo for the given name and returns the combo.
*/
mxForm.prototype.addCombo = function(name, isMultiSelect, size)
addCombo = (name, isMultiSelect, size)=>
{
var select = document.createElement('select');
@ -165,7 +165,7 @@ mxForm.prototype.addCombo = function(name, isMultiSelect, size)
*
* Adds an option for the given label to the specified combo.
*/
mxForm.prototype.addOption = function(combo, label, value, isSelected)
addOption = (combo, label, value, isSelected)=>
{
var option = document.createElement('option');
@ -186,7 +186,7 @@ mxForm.prototype.addOption = function(combo, label, value, isSelected)
* Adds a new row with the name and the input field in two columns and
* returns the given input.
*/
mxForm.prototype.addField = function(name, input)
addField = (name, input)=>
{
var tr = document.createElement('tr');
var td = document.createElement('td');

View File

@ -22,63 +22,63 @@ function mxGuide(graph, states)
*
* Reference to the enclosing <mxGraph> instance.
*/
mxGuide.prototype.graph = null;
graph = null;
/**
* Variable: states
*
* Contains the <mxCellStates> that are used for alignment.
*/
mxGuide.prototype.states = null;
states = null;
/**
* Variable: horizontal
*
* Specifies if horizontal guides are enabled. Default is true.
*/
mxGuide.prototype.horizontal = true;
horizontal = true;
/**
* Variable: vertical
*
* Specifies if vertical guides are enabled. Default is true.
*/
mxGuide.prototype.vertical = true;
vertical = true;
/**
* Variable: guideX
*
* Holds the <mxShape> for the horizontal guide.
*/
mxGuide.prototype.guideX = null;
guideX = null;
/**
* Variable: guideY
*
* Holds the <mxShape> for the vertical guide.
*/
mxGuide.prototype.guideY = null;
guideY = null;
/**
* Variable: rounded
*
* Specifies if rounded coordinates should be used. Default is false.
*/
mxGuide.prototype.rounded = false;
rounded = false;
/**
* Variable: tolerance
*
* Default tolerance in px if grid is disabled. Default is 2.
*/
mxGuide.prototype.tolerance = 2;
tolerance = 2;
/**
* Function: setStates
*
* Sets the <mxCellStates> that should be used for alignment.
*/
mxGuide.prototype.setStates = function(states)
setStates = (states)=>
{
this.states = states;
};
@ -89,7 +89,7 @@ mxGuide.prototype.setStates = function(states)
* Returns true if the guide should be enabled for the given native event. This
* implementation always returns true.
*/
mxGuide.prototype.isEnabledForEvent = function(evt)
isEnabledForEvent = (evt)=>
{
return true;
};
@ -99,7 +99,7 @@ mxGuide.prototype.isEnabledForEvent = function(evt)
*
* Returns the tolerance for the guides. Default value is gridSize / 2.
*/
mxGuide.prototype.getGuideTolerance = function(gridEnabled)
getGuideTolerance = (gridEnabled)=>
{
return (gridEnabled && this.graph.gridEnabled) ? this.graph.gridSize / 2 : this.tolerance;
};
@ -115,7 +115,7 @@ mxGuide.prototype.getGuideTolerance = function(gridEnabled)
*
* horizontal - Boolean that specifies which guide should be created.
*/
mxGuide.prototype.createGuideShape = function(horizontal)
createGuideShape = (horizontal)=>
{
var guide = new mxPolyline([], mxConstants.GUIDE_COLOR, mxConstants.GUIDE_STROKEWIDTH);
guide.isDashed = true;
@ -128,7 +128,7 @@ mxGuide.prototype.createGuideShape = function(horizontal)
*
* Returns true if the given state should be ignored.
*/
mxGuide.prototype.isStateIgnored = function(state)
isStateIgnored = (state)=>
{
return false;
};
@ -138,7 +138,7 @@ mxGuide.prototype.isStateIgnored = function(state)
*
* Moves the <bounds> by the given <mxPoint> and returnt the snapped point.
*/
mxGuide.prototype.move = function(bounds, delta, gridEnabled, clone)
move = (bounds, delta, gridEnabled, clone)=>
{
if (this.states != null && (this.horizontal || this.vertical) && bounds != null && delta != null)
{
@ -372,7 +372,7 @@ mxGuide.prototype.move = function(bounds, delta, gridEnabled, clone)
*
* Rounds to pixels for virtual states (eg. page guides)
*/
mxGuide.prototype.getDelta = function(bounds, stateX, dx, stateY, dy)
getDelta = (bounds, stateX, dx, stateY, dy)=>
{
var s = this.graph.view.scale;
@ -394,7 +394,7 @@ mxGuide.prototype.getDelta = function(bounds, stateX, dx, stateY, dy)
*
* Returns the color for the given state.
*/
mxGuide.prototype.getGuideColor = function(state, horizontal)
getGuideColor = (state, horizontal)=>
{
return mxConstants.GUIDE_COLOR;
};
@ -404,7 +404,7 @@ mxGuide.prototype.getGuideColor = function(state, horizontal)
*
* Hides all current guides.
*/
mxGuide.prototype.hide = function()
hide = ()=>
{
this.setVisible(false);
};
@ -414,7 +414,7 @@ mxGuide.prototype.hide = function()
*
* Shows or hides the current guides.
*/
mxGuide.prototype.setVisible = function(visible)
setVisible = (visible)=>
{
if (this.guideX != null)
{
@ -432,7 +432,7 @@ mxGuide.prototype.setVisible = function(visible)
*
* Destroys all resources that this object uses.
*/
mxGuide.prototype.destroy = function()
destroy = ()=>
{
if (this.guideX != null)
{

View File

@ -23,18 +23,18 @@ function mxImage(src, width, height)
*
* String that specifies the URL of the image.
*/
mxImage.prototype.src = null;
src = null;
/**
* Variable: width
*
* Integer that specifies the width of the image.
*/
mxImage.prototype.width = null;
width = null;
/**
* Variable: height
*
* Integer that specifies the height of the image.
*/
mxImage.prototype.height = null;
height = null;

View File

@ -58,14 +58,14 @@ function mxImageBundle(alt)
*
* Maps from keys to images.
*/
mxImageBundle.prototype.images = null;
images = null;
/**
* Variable: alt
*
* Specifies if the fallback representation should be returned.
*/
mxImageBundle.prototype.alt = null;
alt = null;
/**
* Function: putImage
@ -73,7 +73,7 @@ mxImageBundle.prototype.alt = null;
* Adds the specified entry to the map. The entry is an object with a value and
* fallback property as specified in the arguments.
*/
mxImageBundle.prototype.putImage = function(key, value, fallback)
putImage = (key, value, fallback)=>
{
this.images[key] = {value: value, fallback: fallback};
};
@ -85,7 +85,7 @@ mxImageBundle.prototype.putImage = function(key, value, fallback)
* or fallback, depending on <alt>. The fallback is returned if
* <alt> is true, the value is returned otherwise.
*/
mxImageBundle.prototype.getImage = function(key)
getImage = (key)=>
{
var result = null;

Some files were not shown because too many files have changed in this diff Show More