diff --git a/src/mxgraph/shape/mxShape.js b/src/mxgraph/shape/mxShape.js index 86a4ddea6..24ca810f1 100644 --- a/src/mxgraph/shape/mxShape.js +++ b/src/mxgraph/shape/mxShape.js @@ -779,14 +779,14 @@ class mxShape { c.stroke = (...args) => { strokeDrawn = true; - stroke.apply(this, args); + stroke.apply(c, args); }; const { fillAndStroke } = c; c.fillAndStroke = (...args) => { strokeDrawn = true; - fillAndStroke.apply(this, args); + fillAndStroke.apply(c, args); }; } diff --git a/src/mxgraph/shape/mxSwimlane.js b/src/mxgraph/shape/mxSwimlane.js index 48c92c9a1..01911fefd 100644 --- a/src/mxgraph/shape/mxSwimlane.js +++ b/src/mxgraph/shape/mxSwimlane.js @@ -6,6 +6,7 @@ import mxShape from './mxShape'; import mxRectangle from '../util/mxRectangle'; import mxConstants from '../util/mxConstants'; +import mxUtils from "../util/mxUtils"; class mxSwimlane extends mxShape { /** @@ -89,20 +90,20 @@ class mxSwimlane extends mxShape { // East is default const shapeVertical = - this.direction == mxConstants.DIRECTION_NORTH || - this.direction == mxConstants.DIRECTION_SOUTH; + this.direction === mxConstants.DIRECTION_NORTH || + this.direction === mxConstants.DIRECTION_SOUTH; const realHorizontal = horizontal == !shapeVertical; const realFlipH = !realHorizontal && flipH != - (this.direction == mxConstants.DIRECTION_SOUTH || - this.direction == mxConstants.DIRECTION_WEST); + (this.direction === mxConstants.DIRECTION_SOUTH || + this.direction === mxConstants.DIRECTION_WEST); const realFlipV = realHorizontal && flipV != - (this.direction == mxConstants.DIRECTION_SOUTH || - this.direction == mxConstants.DIRECTION_WEST); + (this.direction === mxConstants.DIRECTION_SOUTH || + this.direction === mxConstants.DIRECTION_WEST); // Shape is horizontal if (!shapeVertical) { diff --git a/src/mxgraph/util/mxDragSource.js b/src/mxgraph/util/mxDragSource.js index b9eca8815..9b0598c89 100644 --- a/src/mxgraph/util/mxDragSource.js +++ b/src/mxgraph/util/mxDragSource.js @@ -6,6 +6,11 @@ import mxRectangle from './mxRectangle'; import mxCellHighlight from '../handler/mxCellHighlight'; import mxUtils from './mxUtils'; +import mxEvent from "./mxEvent"; +import mxClient from "../mxClient"; +import mxGuide from "./mxGuide"; +import mxConstants from "./mxConstants"; +import mxPoint from "./mxPoint"; class mxDragSource { /** @@ -175,7 +180,7 @@ class mxDragSource { const evtName = evt.getProperty('eventName'); const me = evt.getProperty('event'); - if (evtName != mxEvent.MOUSE_DOWN) { + if (evtName !== mxEvent.MOUSE_DOWN) { me.consume(); } }; @@ -419,7 +424,7 @@ class mxDragSource { let elt = this.getElementForEvent(evt); if (this.checkEventSource) { - while (elt != null && elt != graph.container) { + while (elt != null && elt !== graph.container) { elt = elt.parentNode; } } @@ -449,7 +454,7 @@ class mxDragSource { graph = null; } - if (graph != this.currentGraph) { + if (graph !== this.currentGraph) { if (this.currentGraph != null) { this.dragExit(this.currentGraph, evt); } @@ -468,7 +473,7 @@ class mxDragSource { if ( this.dragElement != null && (this.previewElement == null || - this.previewElement.style.visibility != 'visible') + this.previewElement.style.visibility !== 'visible') ) { let x = mxEvent.getClientX(evt); let y = mxEvent.getClientY(evt); @@ -506,7 +511,7 @@ class mxDragSource { if ( this.currentPoint != null && (this.previewElement == null || - this.previewElement.style.visibility != 'hidden') + this.previewElement.style.visibility !== 'hidden') ) { const { scale } = this.currentGraph.view; const tr = this.currentGraph.view.translate; diff --git a/src/pages/Boundary.js b/src/pages/Boundary.js index 604296578..cd943bf77 100644 --- a/src/pages/Boundary.js +++ b/src/pages/Boundary.js @@ -32,8 +32,8 @@ class Boundary extends React.Component { style={{ position: 'relative', overflow: 'hidden', - width: '821px', - height: '641px', + width: '321px', + height: '241px', background: 'url("editors/images/grid.gif")', cursor: 'default' }} diff --git a/src/pages/Collapse.js b/src/pages/Collapse.js index 36062b796..4a4e9cefc 100644 --- a/src/pages/Collapse.js +++ b/src/pages/Collapse.js @@ -1,16 +1,15 @@ - +/** + * Copyright (c) 2006-2013, JGraph Ltd + * + * Collapse example for mxGraph. This example demonstrates changing + * the style of a cell based on its collapsed state. + */ import React from 'react'; -import mxEvent from '../mxgraph/util/mxEvent'; import mxGraph from '../mxgraph/view/mxGraph'; -import mxRubberband from '../mxgraph/handler/mxRubberband'; +import mxRectangle from '../mxgraph/util/mxRectangle'; -class MYNAMEHERE extends React.Component { +class Collapse extends React.Component { constructor(props) { super(props); } @@ -19,14 +18,19 @@ class MYNAMEHERE extends React.Component { // A container for the graph return ( <> -
+