Skip to content

Commit

Permalink
Release v3.7.0 (#2103)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynekstara authored Apr 18, 2023
1 parent ce1f70a commit f774535
Show file tree
Hide file tree
Showing 37 changed files with 13,297 additions and 1,836 deletions.
59 changes: 59 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
18-04-2023 (v3.7.0)

* demo.CustomEmbedding - add new demo to illustrate custom embedding functionality
* demo.Flowchart - add new demo to illustrate `rightAngle` router and `straight` connector
* demo.ROI - add new demo to illustrate working with foreign objects
* demo.FTA - revamp demo to illustrate custom highlighter, `straight` connector, and alignment options of `dia.Paper.transformToFitContent()`
* dia.Paper - add `overflow` option
* dia.Paper - add `transformToFitContent()` method
* dia.Paper - change `scaleContentToFit()` into an alias of `transformToFitContent()`
* dia.Paper - add `verticalAlign` and `horizontalAlign` options to `transformToFitContent()`
* dia.Paper - add `element:magnet:pointerdown`, `element:magnet:pointermove` and `element:magnet:pointerup` events
* dia.Paper - improve event handling of form control elements inside <foreignObject> elements
* dia.Paper - add `preventDefaultViewAction` option
* dia.Paper - add `drawGridSize` option
* dia.Paper - add `autoFreeze` option
* dia.Paper - fix to trigger render callbacks and event when `requireView()` is called
* dia.Paper - fix to send `mousewheel` events when CTRL key is pressed while there are no `paper:pinch` subscribers
* dia.Paper - fix to auto-rotate target markers as expected when using `marker.markup`
* dia.Paper - fix event handlers to correctly receive `dia.Event` on touch screens
* dia.Paper - fix event handlers so that `originalEvent` always points to a native event
* dia.Paper - fix to trigger `element:magnet:pointerclick` when user clicks an invalid magnet
* dia.Paper - fix to hide tools and highlighters when associated cell view is detached
* dia.Paper - fix to throw an error when `unfreeze()` is called on a paper which has been removed
* dia.ElementView - fix to correctly update port nodes with `ref` on size change
* dia.ElementView - fix to prevent double rendering of ports when CSS selectors are enabled
* dia.LinkView - enable link label dragging on touch screens in async mode
* dia.LinkView - fix to take `defaultLabel.size` into account for link label size calculations
* dia.LinkView - fix to remember initial cursor offset from label anchor coordinates when dragging
* dia.LinkView - fix incorrect rotation of labels using `keepGradient` and `absoluteOffset` options
* dia.LinkView - fix to prevent label jumping while being dragged along straight-line Curve links
* dia.CellView - add `preventDefaultInteraction()` and `isDefaultInteractionPrevented()` methods
* dia.CellView - fix link update if connected element changes at the same time the connection is made
* dia.Element - add `fitToChildren()` and `fitParent()` methods
* dia.Element - change `fitEmbeds()` into an alias of `fitToChildren()`
* dia.Element - add `expandOnly` and `shrinkOnly` options to `fitToChildren()` and `fitParent()`
* dia.Cell - fix to always send `propertyPath` and `propertyValue` options when calling `prop()`
* dia.Cell - fix inconsistent merging behavior in `prop()`
* dia.Cell - fix to preserve stacking of nested cells when `toFront()`/`toBack()` is called
* linkTools.Anchor - fix to trigger `mouseleave` event after drag-and-drop interaction
* highlighters.mask - fix to prevent copying of `class` attribute to <mask> elements
* layout.PortLabel - fix to center position of labels in outside/inside oriented layouts
* layout.PortLabel - fix to correctly set vertical position of text labels
* layout.PortLabel - fix to stop sending redundant information for `manual` layout
* connectionPoints.boundary - add option to disable automatic magnet lookup within <g> elements
* connectors.straight - add new connector, and deprecate `normal` and `rounded` connectors
* routers.rightAngle - add new router, and deprecate `oneSide` router
* dia.attributes - add `props` special attribute for setting various HTML form control properties
* dia.ports - fix to apply port layout transformations before ref nodes bbox measuring
* dia.ports - fix to apply port layout attributes to text element
* util - remove lodash util functions
* util.breakText - support `lineHeight` in px units
* util.normalizeEvent - fix to always return a `dia.Event`
* util.parseDOMJSON - add logic to process JSON with string array items as HTML text nodes
* util.svg - keep correct order of HTML text nodes when parsing <foreignObject> to JSON
* util.svg - fix to use lowercase for `tagName` of HTML elements when parsing <foreignObject> to JSON
* util.svg - fix `textContent` to contain HTML text nodes from all descendants when parsing <foreignObject> to JSON
* util.svg - fix to prevent setting empty `textContent` when parsing <foreignObject> to JSON
* Geometry - fix `getSubdivisions()` method for straight-line Curve objects

15-12-2022 (v3.6.5)

* dia.Paper - remove element unprefixed user-drag property
Expand Down
61 changes: 43 additions & 18 deletions dist/geometry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! JointJS v3.6.5 (2022-12-15) - JavaScript diagramming library
/*! JointJS v3.7.0 (2023-04-18) - JavaScript diagramming library
This Source Code Form is subject to the terms of the Mozilla Public
Expand Down Expand Up @@ -2947,13 +2947,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Returns a list of curves whose flattened length is better than `opt.precision`.
// That is, observed difference in length between recursions is less than 10^(-3) = 0.001 = 0.1%
// (Observed difference is not real precision, but close enough as long as special cases are covered)
// (That is why skipping iteration 1 is important)
// As a rule of thumb, increasing `precision` by 1 requires two more division operations
// - Precision 0 (endpointDistance) - total of 2^0 - 1 = 0 operations (1 subdivision)
// - Precision 1 (<10% error) - total of 2^2 - 1 = 3 operations (4 subdivisions)
// - Precision 2 (<1% error) - total of 2^4 - 1 = 15 operations requires 4 division operations on all elements (15 operations total) (16 subdivisions)
// - Precision 3 (<0.1% error) - total of 2^6 - 1 = 63 operations - acceptable when drawing (64 subdivisions)
// - Precision 4 (<0.01% error) - total of 2^8 - 1 = 255 operations - high resolution, can be used to interpolate `t` (256 subdivisions)
// As a rule of thumb, increasing `precision` by 1 requires 2 more iterations (= levels of division operations)
// - Precision 0 (endpointDistance) - 0 iterations => total of 2^0 - 1 = 0 operations (1 subdivision)
// - Precision 1 (<10% error) - 2 iterations => total of 2^2 - 1 = 3 operations (4 subdivisions)
// - Precision 2 (<1% error) - 4 iterations => total of 2^4 - 1 = 15 operations requires 4 division operations on all elements (15 operations total) (16 subdivisions)
// - Precision 3 (<0.1% error) - 6 iterations => total of 2^6 - 1 = 63 operations - acceptable when drawing (64 subdivisions)
// - Precision 4 (<0.01% error) - 8 iterations => total of 2^8 - 1 = 255 operations - high resolution, can be used to interpolate `t` (256 subdivisions)
// (Variation of 1 recursion worse or better is possible depending on the curve, doubling/halving the number of operations accordingly)
getSubdivisions: function(opt) {

Expand All @@ -2962,15 +2961,41 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// not using opt.subdivisions
// not using localOpt

var subdivisions = [new Curve(this.start, this.controlPoint1, this.controlPoint2, this.end)];
var start = this.start;
var control1 = this.controlPoint1;
var control2 = this.controlPoint2;
var end = this.end;

var subdivisions = [new Curve(start, control1, control2, end)];
if (precision === 0) { return subdivisions; }

// special case #1: point-like curves
// - no need to calculate subdivisions, they would all be identical
var isPoint = !this.isDifferentiable();
if (isPoint) { return subdivisions; }

var previousLength = this.endpointDistance();

var precisionRatio = pow$3(10, -precision);

// special case #2: sine-like curves may have the same observed length in iteration 0 and 1 - skip iteration 1
// - not a problem for further iterations because cubic curves cannot have more than two local extrema
// - (i.e. cubic curves cannot intersect the baseline more than once)
// - therefore starting from iteration = 2 ensures that subsequent iterations do not produce sampling with equal length
// - (unless it's a straight-line curve, see below)
var minIterations = 2; // = 2*1

// special case #3: straight-line curves have the same observed length in all iterations
// - this causes observed precision ratio to always be 0 (= lower than `precisionRatio`, which is our exit condition)
// - we enforce the expected number of iterations = 2 * precision
var isLine = ((control1.cross(start, end) === 0) && (control2.cross(start, end) === 0));
if (isLine) {
minIterations = (2 * precision);
}

// recursively divide curve at `t = 0.5`
// until the difference between observed length at subsequent iterations is lower than precision
// until we reach `minIterations`
// and until the difference between observed length at subsequent iterations is lower than `precision`
var iteration = 0;
while (true) {
iteration += 1;
Expand All @@ -2994,14 +3019,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
length += currentNewSubdivision.endpointDistance();
}

// check if we have reached required observed precision
// sine-like curves may have the same observed length in iteration 0 and 1 - skip iteration 1
// not a problem for further iterations because cubic curves cannot have more than two local extrema
// (i.e. cubic curves cannot intersect the baseline more than once)
// therefore two subsequent iterations cannot produce sampling with equal length
var observedPrecisionRatio = ((length !== 0) ? ((length - previousLength) / length) : 0);
if (iteration > 1 && observedPrecisionRatio < precisionRatio) {
return newSubdivisions;
// check if we have reached minimum number of iterations
if (iteration >= minIterations) {

// check if we have reached required observed precision
var observedPrecisionRatio = ((length !== 0) ? ((length - previousLength) / length) : 0);
if (observedPrecisionRatio < precisionRatio) {
return newSubdivisions;
}
}

// otherwise, set up for next iteration
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 f774535

Please sign in to comment.