From 85c51d327e60f4c23689e74421ce96877c41aaac Mon Sep 17 00:00:00 2001 From: mcyph <20507948+mcyph@users.noreply.github.com> Date: Sun, 21 Mar 2021 23:04:36 +1100 Subject: [PATCH] removed more references to vml --- src/mxgraph/handler/mxCellHighlight.js | 13 +++++------- src/mxgraph/handler/mxConnectionHandler.js | 10 ++-------- src/mxgraph/handler/mxConstraintHandler.js | 5 +---- src/mxgraph/handler/mxEdgeHandler.js | 5 +---- src/mxgraph/handler/mxGraphHandler.js | 5 +---- src/mxgraph/handler/mxVertexHandler.js | 17 ++++------------ src/mxgraph/shape/mxDoubleEllipse.js | 7 ------- src/mxgraph/shape/mxMarker.js | 2 +- src/mxgraph/shape/mxShape.js | 18 ----------------- src/mxgraph/shape/mxText.js | 23 ---------------------- src/mxgraph/util/mxConstants.js | 7 ------- src/mxgraph/util/mxGuide.js | 16 ++++++--------- src/mxgraph/util/mxUtils.js | 13 ------------ src/mxgraph/view/mxOutline.js | 12 ----------- src/mxgraph/view/mxPrintPreview.js | 6 ------ 15 files changed, 21 insertions(+), 138 deletions(-) diff --git a/src/mxgraph/handler/mxCellHighlight.js b/src/mxgraph/handler/mxCellHighlight.js index a2a625374..f969e7be0 100644 --- a/src/mxgraph/handler/mxCellHighlight.js +++ b/src/mxgraph/handler/mxCellHighlight.js @@ -131,7 +131,7 @@ class mxCellHighlight { if ( !this.keepOnTop && - this.shape.node.parentNode.firstChild != this.shape.node + this.shape.node.parentNode.firstChild !== this.shape.node ) { this.shape.node.parentNode.insertBefore( this.shape.node, @@ -156,14 +156,11 @@ class mxCellHighlight { shape.isDashed = this.dashed; shape.isShadow = false; - shape.dialect = - this.graph.dialect != mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + shape.dialect = mxConstants.DIALECT_SVG; shape.init(this.graph.getView().getOverlayPane()); mxEvent.redirectMouseEvents(shape.node, this.graph, this.state); - if (this.graph.dialect != mxConstants.DIALECT_SVG) { + if (this.graph.dialect !== mxConstants.DIALECT_SVG) { shape.pointerEvents = false; } else { shape.svgPointerEvents = 'stroke'; @@ -232,7 +229,7 @@ class mxCellHighlight { * Marks the and fires a event. */ highlight = state => { - if (this.state != state) { + if (this.state !== state) { if (this.shape != null) { this.shape.destroy(); this.shape = null; @@ -258,7 +255,7 @@ class mxCellHighlight { let elt = document.elementFromPoint(x, y); while (elt != null) { - if (elt == this.shape.node) { + if (elt === this.shape.node) { hit = true; break; } diff --git a/src/mxgraph/handler/mxConnectionHandler.js b/src/mxgraph/handler/mxConnectionHandler.js index c53b551ae..86919429c 100644 --- a/src/mxgraph/handler/mxConnectionHandler.js +++ b/src/mxgraph/handler/mxConnectionHandler.js @@ -471,10 +471,7 @@ class mxConnectionHandler extends mxEventSource { this.livePreview && this.edgeState != null ? this.graph.cellRenderer.createShape(this.edgeState) : new mxPolyline([], mxConstants.INVALID_COLOR); - shape.dialect = - this.graph.dialect !== mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + shape.dialect = mxConstants.DIALECT_SVG; shape.scale = this.graph.view.scale; shape.pointerEvents = false; shape.isDashed = true; @@ -785,10 +782,7 @@ class mxConnectionHandler extends mxEventSource { icon.dialect = mxConstants.DIALECT_STRICTHTML; icon.init(this.graph.container); } else { - icon.dialect = - this.graph.dialect === mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_SVG - : mxConstants.DIALECT_VML; + icon.dialect = mxConstants.DIALECT_SVG; icon.init(this.graph.getView().getOverlayPane()); // Move the icon back in the overlay pane diff --git a/src/mxgraph/handler/mxConstraintHandler.js b/src/mxgraph/handler/mxConstraintHandler.js index c0eebe1f2..521b824ae 100644 --- a/src/mxgraph/handler/mxConstraintHandler.js +++ b/src/mxgraph/handler/mxConstraintHandler.js @@ -326,10 +326,7 @@ class mxConstraintHandler { if (this.focusHighlight == null) { const hl = this.createHighlightShape(); - hl.dialect = - this.graph.dialect == mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_SVG - : mxConstants.DIALECT_VML; + hl.dialect = mxConstants.DIALECT_SVG hl.pointerEvents = false; hl.init(this.graph.getView().getOverlayPane()); diff --git a/src/mxgraph/handler/mxEdgeHandler.js b/src/mxgraph/handler/mxEdgeHandler.js index 4a6b64695..cd03d3a85 100644 --- a/src/mxgraph/handler/mxEdgeHandler.js +++ b/src/mxgraph/handler/mxEdgeHandler.js @@ -257,10 +257,7 @@ class mxEdgeHandler { ) { this.parentHighlight = this.createParentHighlightShape(pstate); // VML dialect required here for event transparency in IE - this.parentHighlight.dialect = - this.graph.dialect !== mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + this.parentHighlight.dialect = mxConstants.DIALECT_SVG; this.parentHighlight.pointerEvents = false; this.parentHighlight.rotation = Number( pstate.style[mxConstants.STYLE_ROTATION] || '0' diff --git a/src/mxgraph/handler/mxGraphHandler.js b/src/mxgraph/handler/mxGraphHandler.js index 80c5b43b8..351053a67 100644 --- a/src/mxgraph/handler/mxGraphHandler.js +++ b/src/mxgraph/handler/mxGraphHandler.js @@ -774,10 +774,7 @@ class mxGraphHandler { // Makes sure to use either VML or SVG shapes in order to implement // event-transparency on the background area of the rectangle since // HTML shapes do not let mouseevents through even when transparent - shape.dialect = - this.graph.dialect !== mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + shape.dialect = mxConstants.DIALECT_SVG; shape.init(this.graph.getView().getOverlayPane()); shape.pointerEvents = false; diff --git a/src/mxgraph/handler/mxVertexHandler.js b/src/mxgraph/handler/mxVertexHandler.js index 60720e876..f7fb7fd80 100644 --- a/src/mxgraph/handler/mxVertexHandler.js +++ b/src/mxgraph/handler/mxVertexHandler.js @@ -209,10 +209,7 @@ class mxVertexHandler { ); this.selectionBorder = this.createSelectionShape(this.bounds); // VML dialect required here for event transparency in IE - this.selectionBorder.dialect = - this.graph.dialect !== mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + this.selectionBorder.dialect = mxConstants.DIALECT_SVG; this.selectionBorder.pointerEvents = false; this.selectionBorder.rotation = Number( this.state.style[mxConstants.STYLE_ROTATION] || '0' @@ -546,7 +543,7 @@ class mxVertexHandler { shape.bounds.y = Math.floor(y - shape.bounds.height / 2); // Fixes visible inactive handles in VML - if (shape.node != null && shape.node.style.display != 'none') { + if (shape.node != null && shape.node.style.display !== 'none') { shape.redraw(); } } @@ -718,10 +715,7 @@ class mxVertexHandler { this.preview.dialect = mxConstants.DIALECT_STRICTHTML; this.preview.init(this.graph.container); } else { - this.preview.dialect = - this.graph.dialect != mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + this.preview.dialect = mxConstants.DIALECT_SVG; this.preview.init(this.graph.view.getOverlayPane()); } } @@ -2149,10 +2143,7 @@ class mxVertexHandler { ) { this.parentHighlight = this.createParentHighlightShape(pstate); // VML dialect required here for event transparency in IE - this.parentHighlight.dialect = - this.graph.dialect !== mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + this.parentHighlight.dialect = mxConstants.DIALECT_SVG; this.parentHighlight.pointerEvents = false; this.parentHighlight.rotation = Number( pstate.style[mxConstants.STYLE_ROTATION] || '0' diff --git a/src/mxgraph/shape/mxDoubleEllipse.js b/src/mxgraph/shape/mxDoubleEllipse.js index 930f63e15..34703b5bc 100644 --- a/src/mxgraph/shape/mxDoubleEllipse.js +++ b/src/mxgraph/shape/mxDoubleEllipse.js @@ -10,13 +10,6 @@ import mxConstants from '../util/mxConstants'; import mxUtils from '../util/mxUtils'; class mxDoubleEllipse extends mxShape { - /** - * Variable: vmlScale - * - * Scale for improving the precision of VML rendering. Default is 10. - */ - vmlScale = 10; - /** * Class: mxDoubleEllipse * diff --git a/src/mxgraph/shape/mxMarker.js b/src/mxgraph/shape/mxMarker.js index e5b35f654..3b6ba939a 100644 --- a/src/mxgraph/shape/mxMarker.js +++ b/src/mxgraph/shape/mxMarker.js @@ -9,7 +9,7 @@ const mxMarker = { /** * Class: mxMarker * - * A static class that implements all markers for VML and SVG using a + * A static class that implements all markers for SVG using a * registry. NOTE: The signatures in this class will change. * * Variable: markers diff --git a/src/mxgraph/shape/mxShape.js b/src/mxgraph/shape/mxShape.js index 687f1b1bf..65f6fdbe0 100644 --- a/src/mxgraph/shape/mxShape.js +++ b/src/mxgraph/shape/mxShape.js @@ -128,13 +128,6 @@ class mxShape { */ stencilPointerEvents = false; - /** - * Variable: vmlScale - * - * Scale for improving the precision of VML rendering. Default is 1. - */ - vmlScale = 1; - /** * Variable: outline * @@ -259,17 +252,6 @@ class mxShape { this.flipV = false; }; - /** - * Function: isParseVml - * - * Specifies if any VML should be added via insertAdjacentHtml to the DOM. This - * is only needed in IE8 and only if the shape contains VML markup. This method - * returns true. - */ - isParseVml = () => { - return true; - }; - /** * Function: isHtmlAllowed * diff --git a/src/mxgraph/shape/mxText.js b/src/mxgraph/shape/mxText.js index 3282579f4..e1326afe5 100644 --- a/src/mxgraph/shape/mxText.js +++ b/src/mxgraph/shape/mxText.js @@ -203,16 +203,6 @@ class mxText extends mxShape { this.updateMargin(); } - /** - * Function: isParseVml - * - * Text shapes do not contain VML markup and do not need to be parsed. This - * method returns false to speed up rendering in IE8. - */ - isParseVml = () => { - return false; - }; - /** * Function: isHtmlAllowed * @@ -771,19 +761,6 @@ class mxText extends mxShape { c.setFontStyle(this.fontStyle); }; - /** - * Function: updateVmlContainer - * - * Sets the width and height of the container to 1px. - */ - updateVmlContainer = () => { - this.node.style.left = `${Math.round(this.bounds.x)}px`; - this.node.style.top = `${Math.round(this.bounds.y)}px`; - this.node.style.width = '1px'; - this.node.style.height = '1px'; - this.node.style.overflow = 'visible'; - }; - /** * Function: getHtmlValue * diff --git a/src/mxgraph/util/mxConstants.js b/src/mxgraph/util/mxConstants.js index 8e0324aa5..c264625bf 100644 --- a/src/mxgraph/util/mxConstants.js +++ b/src/mxgraph/util/mxConstants.js @@ -63,13 +63,6 @@ const mxConstants = { */ DIALECT_SVG: 'svg', - /** - * Variable: DIALECT_VML - * - * Defines the VML display dialect name. - */ - DIALECT_VML: 'vml', - /** * Variable: DIALECT_MIXEDHTML * diff --git a/src/mxgraph/util/mxGuide.js b/src/mxgraph/util/mxGuide.js index 36db6f56f..418d4bd41 100644 --- a/src/mxgraph/util/mxGuide.js +++ b/src/mxgraph/util/mxGuide.js @@ -3,6 +3,8 @@ * Copyright (c) 2006-2015, Gaudenz Alder * Updated to ES9 syntax by David Morrissey 2021 */ +import mxConstants from "./mxConstants"; + /** * Class: mxGuide * @@ -194,13 +196,10 @@ class mxGuide { if (this.guideX == null) { this.guideX = this.createGuideShape(true); - // Makes sure to use either VML or SVG shapes in order to implement + // Makes sure to use SVG shapes in order to implement // event-transparency on the background area of the rectangle since // HTML shapes do not let mouseevents through even when transparent - this.guideX.dialect = - this.graph.dialect != mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + this.guideX.dialect = mxConstants.DIALECT_SVG; this.guideX.pointerEvents = false; this.guideX.init(this.graph.getView().getOverlayPane()); } @@ -236,13 +235,10 @@ class mxGuide { if (this.guideY == null) { this.guideY = this.createGuideShape(false); - // Makes sure to use either VML or SVG shapes in order to implement + // Makes sure to use SVG shapes in order to implement // event-transparency on the background area of the rectangle since // HTML shapes do not let mouseevents through even when transparent - this.guideY.dialect = - this.graph.dialect != mxConstants.DIALECT_SVG - ? mxConstants.DIALECT_VML - : mxConstants.DIALECT_SVG; + this.guideY.dialect = mxConstants.DIALECT_SVG; this.guideY.pointerEvents = false; this.guideY.init(this.graph.getView().getOverlayPane()); } diff --git a/src/mxgraph/util/mxUtils.js b/src/mxgraph/util/mxUtils.js index 326548f45..ebe4a5275 100644 --- a/src/mxgraph/util/mxUtils.js +++ b/src/mxgraph/util/mxUtils.js @@ -637,19 +637,6 @@ const mxUtils = { return s; }, - /** - * Function: isVml - * - * Returns true if the given node is in the VML namespace. - * - * Parameters: - * - * node - DOM node whose tag urn should be checked. - */ - isVml: node => { - return node != null && node.tagUrn == 'urn:schemas-microsoft-com:vml'; - }, - /** * Function: getXml * diff --git a/src/mxgraph/view/mxOutline.js b/src/mxgraph/view/mxOutline.js index 6159eb984..5f1942222 100644 --- a/src/mxgraph/view/mxOutline.js +++ b/src/mxgraph/view/mxOutline.js @@ -261,12 +261,6 @@ class mxOutline { ); this.selectionBorder.dialect = this.outline.dialect; - if (this.forceVmlHandles) { - this.selectionBorder.isHtmlAllowed = () => { - return false; - }; - } - this.selectionBorder.init(this.outline.getView().getOverlayPane()); // Handles event by catching the initial pointer start and then listening to the @@ -294,12 +288,6 @@ class mxOutline { // Creates a small blue rectangle for sizing (sizer handle) this.sizer = this.createSizer(); - if (this.forceVmlHandles) { - this.sizer.isHtmlAllowed = () => { - return false; - }; - } - this.sizer.init(this.outline.getView().getOverlayPane()); if (this.enabled) { diff --git a/src/mxgraph/view/mxPrintPreview.js b/src/mxgraph/view/mxPrintPreview.js index 74c77dcbf..2a6a60805 100644 --- a/src/mxgraph/view/mxPrintPreview.js +++ b/src/mxgraph/view/mxPrintPreview.js @@ -822,10 +822,6 @@ class mxPrintPreview { innerDiv.style.top = `${this.border}px`; innerDiv.style.left = `${this.border}px`; - if (this.graph.dialect == mxConstants.DIALECT_VML) { - innerDiv.style.position = 'absolute'; - } - div.appendChild(innerDiv); document.body.appendChild(div); arg = innerDiv; @@ -910,8 +906,6 @@ class mxPrintPreview { dx = 0; dy = 0; } - } else if (this.graph.dialect == mxConstants.DIALECT_VML) { - view.createVml(); } else { view.createHtml(); }