Skip to content

Commit

Permalink
Release v3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kumilingus authored Jan 15, 2021
1 parent bd30bf8 commit fed63b3
Show file tree
Hide file tree
Showing 39 changed files with 5,202 additions and 1,821 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
15-01-2021 (v3.3.0)
* Prevent prototype pollution - lodash v4.17.20, fix util.setByPath()
* Prevent DoS - fix util.unsetByPath()
* demo.ELK - add Eclipse Layout Kernel demo
* demo.Container - add collapse/expand container demo
* demo.Typescript - show class style shape definition
* demo.HTML - implement z-index sorting
* add Element Tools tutorial
* dia.Paper - add snapLabels option
* dia.Paper - restrictTranslate option defined as function returning a function
* dia.Element - prevent unnecessary rounding errors in resize()
* dia.Link - fix order of points in getPolyline()
* dia.LinkView - prevent connection validation on magnets previously validated
* dia.CellView - fix update order of nodes when 'ref' in use
* dia.ToolsView - enable adding tool to a view, which has not been rendered
* util.breakText - fix height for a text with empty lines
* highlighters - new API, add mask highlighter
* highlighters.stroke - add useFirstSubpath option
* routers.manhattan - fix scan directions order
* dia.attributes - add magnetSelector & containerSelector
* dia.attributes - textWrap takes letter-spacing into account
* Vectorizer - add createSVGStyle() and createCDATASection() static methods
* Geometry - add getSubpaths() to Path
* Geometry - add round() methods

04-6-2020 (v3.2.0)
* add Sequence Diagram demo
* add HTML Elements demo
Expand Down
158 changes: 147 additions & 11 deletions dist/geometry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JointJS v3.2.0 (2020-06-04) - JavaScript diagramming library
/*! JointJS v3.3.0 (2021-01-15) - JavaScript diagramming library
This Source Code Form is subject to the terms of the Mozilla Public
Expand Down Expand Up @@ -885,6 +885,15 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Default precision
PRECISION: 3,

round: function(precision) {

this.start.round(precision);
this.controlPoint1.round(precision);
this.controlPoint2.round(precision);
this.end.round(precision);
return this;
},

scale: function(sx, sy, origin) {

this.start.scale(sx, sy, origin);
Expand Down Expand Up @@ -1281,6 +1290,25 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
return ((x0 - x) * (x0 - x)) / (a * a) + ((y0 - y) * (y0 - y)) / (b * b);
},

round: function(precision) {

var f = 1; // case 0
if (precision) {
switch (precision) {
case 1: f = 10; break;
case 2: f = 100; break;
case 3: f = 1000; break;
default: f = pow(10, precision); break;
}
}

this.x = round(this.x * f) / f;
this.y = round(this.y * f) / f;
this.a = round(this.a * f) / f;
this.b = round(this.b * f) / f;
return this;
},

/** Compute angle between tangent and x axis
* @param {g.Point} p Point of tangency, it has to be on ellipse boundaries.
* @returns {number} angle between tangent and x axis
Expand Down Expand Up @@ -1597,11 +1625,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.

round: function(precision) {

var f = pow(10, precision || 0);
this.start.x = round(this.start.x * f) / f;
this.start.y = round(this.start.y * f) / f;
this.end.x = round(this.end.x * f) / f;
this.end.y = round(this.end.y * f) / f;
this.start.round(precision);
this.end.round(precision);
return this;
},

Expand Down Expand Up @@ -2250,6 +2275,34 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
return segmentSubdivisions;
},

// Returns an array of subpaths of this path.
// Invalid paths are validated first.
// Returns `[]` if path has no segments.
getSubpaths: function() {

var validatedPath = this.clone().validate();

var segments = validatedPath.segments;
var numSegments = segments.length;

var subpaths = [];
for (var i = 0; i < numSegments; i++) {

var segment = segments[i];
if (segment.isSubpathStart) {
// we encountered a subpath start segment
// create a new path for segment, and push it to list of subpaths
subpaths.push(new Path(segment));

} else {
// append current segment to the last subpath
subpaths[subpaths.length - 1].appendSegment(segment);
}
}

return subpaths;
},

// Insert `arg` at given `index`.
// `index = 0` means insert at the beginning.
// `index = segments.length` means insert at the end.
Expand Down Expand Up @@ -2616,6 +2669,20 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
if (updateSubpathStart && nextSegment) { this.updateSubpathStartSegment(nextSegment); }
},

round: function(precision) {

var segments = this.segments;
var numSegments = segments.length;

for (var i = 0; i < numSegments; i++) {

var segment = segments[i];
segment.round(precision);
}

return this;
},

scale: function(sx, sy, origin) {

var segments = this.segments;
Expand Down Expand Up @@ -2899,6 +2966,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
previousSegment = segment;
segment = segment.nextSegment; // move on to the segment after etc.
}
},

// If the path is not valid, insert M 0 0 at the beginning.
// Path with no segments is considered valid, so nothing is inserted.
validate: function() {

if (!this.isValid()) { this.insertSegment(0, Path.createSegment('M', 0, 0)); }
return this;
}
};

Expand Down Expand Up @@ -2985,7 +3060,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// @param {point} [optional] Origin.
Point.fromPolar = function(distance, angle, origin) {

origin = (origin && new Point(origin)) || new Point(0, 0);
origin = new Point(origin);
var x = abs(distance * cos(angle));
var y = abs(distance * sin(angle));
var deg = normalizeAngle(toDeg(angle));
Expand Down Expand Up @@ -3181,6 +3256,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Angle is flipped because this is a left-handed coord system (y-axis points downward).
rotate: function(origin, angle) {

if (angle === 0) { return this; }

origin = origin || new Point(0, 0);

angle = toRad(normalizeAngle(-angle));
Expand All @@ -3197,7 +3274,16 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.

round: function(precision) {

var f = pow(10, precision || 0);
var f = 1; // case 0
if (precision) {
switch (precision) {
case 1: f = 10; break;
case 2: f = 100; break;
case 3: f = 1000; break;
default: f = pow(10, precision); break;
}
}

this.x = round(this.x * f) / f;
this.y = round(this.y * f) / f;
return this;
Expand Down Expand Up @@ -3808,11 +3894,22 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
return lastPoint.clone();
},

round: function(precision) {

var points = this.points;
var numPoints = points.length;

for (var i = 0; i < numPoints; i++) {
points[i].round(precision);
}

return this;
},

scale: function(sx, sy, origin) {

var points = this.points;
var numPoints = points.length;
if (numPoints === 0) { return this; } // if points array is empty

for (var i = 0; i < numPoints; i++) {
points[i].scale(sx, sy, origin);
Expand Down Expand Up @@ -3937,7 +4034,6 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.

var points = this.points;
var numPoints = points.length;
if (numPoints === 0) { return this; } // if points array is empty

for (var i = 0; i < numPoints; i++) {
points[i].translate(tx, ty);
Expand Down Expand Up @@ -4357,7 +4453,16 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.

round: function(precision) {

var f = pow(10, precision || 0);
var f = 1; // case 0
if (precision) {
switch (precision) {
case 1: f = 10; break;
case 2: f = 100; break;
case 3: f = 1000; break;
default: f = pow(10, precision); break;
}
}

this.x = round(this.x * f) / f;
this.y = round(this.y * f) / f;
this.width = round(this.width * f) / f;
Expand Down Expand Up @@ -4752,6 +4857,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.

previousSegment: null, // needed to get segment start property

// virtual
round: function() {

throw new Error('Declaration missing for virtual function.');
},

subpathStartSegment: null, // needed to get Closepath segment end property

// virtual
Expand Down Expand Up @@ -4946,6 +5057,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
return !this.start.equals(this.end);
},

round: function(precision) {

this.end.round(precision);
return this;
},

scale: function(sx, sy, origin) {

this.end.scale(sx, sy, origin);
Expand Down Expand Up @@ -5105,6 +5222,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
return !(start.equals(control1) && control1.equals(control2) && control2.equals(end));
},

round: function(precision) {

this.controlPoint1.round(precision);
this.controlPoint2.round(precision);
this.end.round(precision);
return this;
},

scale: function(sx, sy, origin) {

this.controlPoint1.scale(sx, sy, origin);
Expand Down Expand Up @@ -5320,6 +5445,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
return this.end.clone();
},

round: function(precision) {

this.end.round(precision);
return this;
},

scale: function(sx, sy, origin) {

this.end.scale(sx, sy, origin);
Expand Down Expand Up @@ -5444,6 +5575,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
return !this.start.equals(this.end);
},

round: function() {

return this;
},

scale: function() {

return this;
Expand Down
4 changes: 2 additions & 2 deletions dist/geometry.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/joint.core.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fed63b3

Please sign in to comment.