From e28c111f48090a6a2762446bf4b30a7f391bb3ac Mon Sep 17 00:00:00 2001 From: ilexwg Date: Wed, 11 Dec 2019 15:06:19 +0800 Subject: [PATCH 1/2] fix: correct the typo complete the angle brackets: ... ... --- javascript/src/js/model/mxGeometry.js | 98 +++++++++++++-------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/javascript/src/js/model/mxGeometry.js b/javascript/src/js/model/mxGeometry.js index 8d9278a29..791b41804 100644 --- a/javascript/src/js/model/mxGeometry.js +++ b/javascript/src/js/model/mxGeometry.js @@ -4,36 +4,36 @@ */ /** * Class: mxGeometry - * + * * Extends to represent the geometry of a cell. - * + * * For vertices, the geometry consists of the x- and y-location, and the width * and height. For edges, the geometry consists of the optional terminal- and * control points. The terminal points are only required if an edge is - * unconnected, and are stored in the sourcePoint> and + * unconnected, and are stored in the and * variables, respectively. - * + * * Example: - * + * * If an edge is unconnected, that is, it has no source or target terminal, * then a geometry with terminal points for a new edge can be defined as * follows. - * + * * (code) * geometry.setTerminalPoint(new mxPoint(x1, y1), true); * geometry.points = [new mxPoint(x2, y2)]; * geometry.setTerminalPoint(new mxPoint(x3, y3), false); * (end) - * + * * Control points are used regardless of the connected state of an edge and may * be ignored or interpreted differently depending on the edge's . - * + * * To disable automatic reset of control points after a cell has been moved or * resized, the the and * may be used. * * Edge Labels: - * + * * Using the x- and y-coordinates of a cell's geometry, it is possible to * position the label on edges on a specific location on the actual edge shape * as it appears on the screen. The x-coordinate of an edge's geometry is used @@ -42,29 +42,29 @@ * edge's geometry is used to describe the absolute, orthogonal distance in * pixels from that point. In addition, the is used as an * absolute offset vector from the resulting point. - * + * * This coordinate system is applied if is true, otherwise the * offset defines the absolute vector from the edge's center point to the * label and the values for and are ignored. - * + * * The width and height parameter for edge geometries can be used to set the * label width and height (eg. for word wrapping). - * + * * Ports: - * + * * The term "port" refers to a relatively positioned, connectable child cell, * which is used to specify the connection between the parent and another cell * in the graph. Ports are typically modeled as vertices with relative * geometries. - * + * * Offsets: - * + * * The field is interpreted in 3 different ways, depending on the cell * and the geometry. For edges, the offset defines the absolute offset for the * edge label. For relative geometries, the offset defines the absolute offset * for the origin (top, left corner) of the vertex, otherwise the offset * defines the absolute offset for the label inside the vertex or group. - * + * * Constructor: mxGeometry * * Constructs a new object to describe the size and location of a vertex or @@ -83,7 +83,7 @@ mxGeometry.prototype.constructor = mxGeometry; /** * Variable: TRANSLATE_CONTROL_POINTS - * + * * Global switch to translate the points in translate. Default is true. */ mxGeometry.prototype.TRANSLATE_CONTROL_POINTS = true; @@ -143,18 +143,18 @@ mxGeometry.prototype.offset = null; * the edge label relative to the edge as rendered on the display. For * vertices, this specifies the relative location inside the bounds of the * parent cell. - * + * * If this is false, then the coordinates are relative to the origin of the * parent cell or, for edges, the edge label position is relative to the * center of the edge as rendered on screen. - * + * * Default is false. */ mxGeometry.prototype.relative = false; /** * Function: swap - * + * * Swaps the x, y, width and height with the values stored in * and puts the previous values into as * a rectangle. This operation is carried-out in-place, that is, using the @@ -181,12 +181,12 @@ mxGeometry.prototype.swap = function() /** * Function: getTerminalPoint - * + * * Returns the representing the source or target point of this * edge. This is only used if the edge has no source or target vertex. - * + * * Parameters: - * + * * isSource - Boolean that specifies if the source or target point * should be returned. */ @@ -197,12 +197,12 @@ mxGeometry.prototype.getTerminalPoint = function(isSource) /** * Function: setTerminalPoint - * + * * Sets the or to the given and * returns the new point. - * + * * Parameters: - * + * * point - Point to be used as the new source or target point. * isSource - Boolean that specifies if the source or target point * should be set. @@ -217,20 +217,20 @@ mxGeometry.prototype.setTerminalPoint = function(point, isSource) { this.targetPoint = point; } - + return point; }; /** * Function: rotate - * + * * Rotates the geometry by the given angle around the given center. That is, * and of the geometry, the , and all * are translated by the given amount. and are only * translated if is false. - * + * * Parameters: - * + * * angle - Number that specifies the rotation angle in degrees. * cx - that specifies the center of the rotation. */ @@ -239,13 +239,13 @@ mxGeometry.prototype.rotate = function(angle, cx) var rad = mxUtils.toRadians(angle); var cos = Math.cos(rad); var sin = Math.sin(rad); - + // Rotates the geometry if (!this.relative) { var ct = new mxPoint(this.getCenterX(), this.getCenterY()); var pt = mxUtils.getRotatedPoint(ct, cos, sin, cx); - + this.x = Math.round(pt.x - this.width / 2); this.y = Math.round(pt.y - this.height / 2); } @@ -257,15 +257,15 @@ mxGeometry.prototype.rotate = function(angle, cx) this.sourcePoint.x = Math.round(pt.x); this.sourcePoint.y = Math.round(pt.y); } - + // Translates the target point if (this.targetPoint != null) { var pt = mxUtils.getRotatedPoint(this.targetPoint, cos, sin, cx); this.targetPoint.x = Math.round(pt.x); - this.targetPoint.y = Math.round(pt.y); + this.targetPoint.y = Math.round(pt.y); } - + // Translate the control points if (this.points != null) { @@ -283,15 +283,15 @@ mxGeometry.prototype.rotate = function(angle, cx) /** * Function: translate - * + * * Translates the geometry by the specified amount. That is, and of the * geometry, the , and all are translated * by the given amount. and are only translated if is false. * If is false, then are not modified by * this function. - * + * * Parameters: - * + * * dx - Number that specifies the x-coordinate of the translation. * dy - Number that specifies the y-coordinate of the translation. */ @@ -299,7 +299,7 @@ mxGeometry.prototype.translate = function(dx, dy) { dx = parseFloat(dx); dy = parseFloat(dy); - + // Translates the geometry if (!this.relative) { @@ -313,12 +313,12 @@ mxGeometry.prototype.translate = function(dx, dy) this.sourcePoint.x = parseFloat(this.sourcePoint.x) + dx; this.sourcePoint.y = parseFloat(this.sourcePoint.y) + dy; } - + // Translates the target point if (this.targetPoint != null) { this.targetPoint.x = parseFloat(this.targetPoint.x) + dx; - this.targetPoint.y = parseFloat(this.targetPoint.y) + dy; + this.targetPoint.y = parseFloat(this.targetPoint.y) + dy; } // Translate the control points @@ -337,15 +337,15 @@ mxGeometry.prototype.translate = function(dx, dy) /** * Function: scale - * + * * Scales the geometry by the given amount. That is, and of the * geometry, the , and all are scaled * by the given amount. , , and are only scaled if * is false. If is true, then the smaller value * is used to scale the width and the height. - * + * * Parameters: - * + * * sx - Number that specifies the horizontal scale factor. * sy - Number that specifies the vertical scale factor. * fixedAspect - Optional boolean to keep the aspect ratio fixed. @@ -361,12 +361,12 @@ mxGeometry.prototype.scale = function(sx, sy, fixedAspect) this.sourcePoint.x = parseFloat(this.sourcePoint.x) * sx; this.sourcePoint.y = parseFloat(this.sourcePoint.y) * sy; } - + // Translates the target point if (this.targetPoint != null) { this.targetPoint.x = parseFloat(this.targetPoint.x) * sx; - this.targetPoint.y = parseFloat(this.targetPoint.y) * sy; + this.targetPoint.y = parseFloat(this.targetPoint.y) * sy; } // Translate the control points @@ -381,7 +381,7 @@ mxGeometry.prototype.scale = function(sx, sy, fixedAspect) } } } - + // Translates the geometry if (!this.relative) { @@ -392,7 +392,7 @@ mxGeometry.prototype.scale = function(sx, sy, fixedAspect) { sy = sx = Math.min(sx, sy); } - + this.width = parseFloat(this.width) * sx; this.height = parseFloat(this.height) * sy; } @@ -400,7 +400,7 @@ mxGeometry.prototype.scale = function(sx, sy, fixedAspect) /** * Function: equals - * + * * Returns true if the given object equals this geometry. */ mxGeometry.prototype.equals = function(obj) From 7f37080cf283f197f8ffe963e2c13f0d8c648d8d Mon Sep 17 00:00:00 2001 From: ilexwg Date: Thu, 12 Dec 2019 14:28:34 +0800 Subject: [PATCH 2/2] fix: Remove redundant code --- javascript/examples/anchors.html | 27 ++++++++++------------ javascript/examples/webpack/src/anchors.js | 5 +--- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/javascript/examples/anchors.html b/javascript/examples/anchors.html index 357631f90..06542221e 100644 --- a/javascript/examples/anchors.html +++ b/javascript/examples/anchors.html @@ -1,6 +1,6 @@ @@ -18,7 +18,7 @@