@joint/core 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/joint.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.0.1 (2024-02-02) - JavaScript diagramming library
1
+ /*! JointJS v4.0.2 (2024-04-09) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -13762,6 +13762,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
13762
13762
  var ry2 = ry * ry;
13763
13763
 
13764
13764
  var k = ((large_arc_flag == sweep_flag) ? -1 : 1) * sqrt(abs(((rx2 * ry2) - (rx2 * y * y) - (ry2 * x * x)) / ((rx2 * y * y) + (ry2 * x * x))));
13765
+ if (!Number.isFinite(k)) {
13766
+ // Arc is a single point
13767
+ return [x1, y1, x2, y2, x2, y2];
13768
+ }
13765
13769
 
13766
13770
  var cx = ((k * rx * y) / ry) + ((x1 + x2) / 2);
13767
13771
  var cy = ((k * -ry * x) / rx) + ((y1 + y2) / 2);
@@ -17522,12 +17526,16 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
17522
17526
  if (text === undefined) { text = attrs.text; }
17523
17527
  if (text !== undefined) {
17524
17528
  var breakTextFn = value.breakText || breakText;
17529
+ var computedStyles = getComputedStyle(node);
17530
+
17525
17531
  wrappedText = breakTextFn('' + text, size, {
17526
- 'font-weight': attrs['font-weight'],
17527
- 'font-size': attrs['font-size'],
17528
- 'font-family': attrs['font-family'],
17532
+ 'font-weight': computedStyles.fontWeight,
17533
+ 'font-family': computedStyles.fontFamily,
17534
+ 'text-transform': computedStyles.textTransform,
17535
+ 'font-size': computedStyles.fontSize,
17536
+ 'letter-spacing': computedStyles.letterSpacing,
17537
+ // The `line-height` attribute in SVG is JoinJS specific.
17529
17538
  'lineHeight': attrs['line-height'],
17530
- 'letter-spacing': attrs['letter-spacing']
17531
17539
  }, {
17532
17540
  // Provide an existing SVG Document here
17533
17541
  // instead of creating a temporary one over again.
@@ -27322,8 +27330,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27322
27330
  var ty = target.y0;
27323
27331
 
27324
27332
  if (tx === ax && ty < sy0) { return Directions$2.BOTTOM; }
27325
- if (tx < ax && ty < smy0) { return Directions$2.RIGHT; }
27326
- if (tx > ax && ty < smy0) { return Directions$2.LEFT; }
27333
+ if (tx < ax && ty < smy0) {
27334
+ if (nextInLine.point.x === ax) { return Directions$2.BOTTOM; }
27335
+ return Directions$2.RIGHT;
27336
+ }
27337
+ if (tx > ax && ty < smy0) {
27338
+ if (nextInLine.point.x === ax) { return Directions$2.BOTTOM; }
27339
+ return Directions$2.LEFT;
27340
+ }
27327
27341
  if (tx < smx0 && ty >= sy0) { return Directions$2.TOP; }
27328
27342
  if (tx > smx1 && ty >= sy0) { return Directions$2.TOP; }
27329
27343
  if (tx >= smx0 && tx <= ax && ty > sy1) {
@@ -27362,8 +27376,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27362
27376
  var ty = target.y0;
27363
27377
 
27364
27378
  if (tx === ax && ty > sy1) { return Directions$2.TOP; }
27365
- if (tx < ax && ty > smy1) { return Directions$2.RIGHT; }
27366
- if (tx > ax && ty > smy1) { return Directions$2.LEFT; }
27379
+ if (tx < ax && ty > smy1) {
27380
+ if (nextInLine.point.x === ax) { return Directions$2.TOP; }
27381
+ return Directions$2.RIGHT;
27382
+ }
27383
+ if (tx > ax && ty > smy1) {
27384
+ if (nextInLine.point.x === ax) { return Directions$2.TOP; }
27385
+ return Directions$2.LEFT;
27386
+ }
27367
27387
  if (tx < smx0 && ty <= sy1) { return Directions$2.BOTTOM; }
27368
27388
  if (tx > smx1 && ty <= sy1) { return Directions$2.BOTTOM; }
27369
27389
  if (tx >= smx0 && tx <= ax && ty < sy0) {
@@ -27574,11 +27594,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27574
27594
  return outsidePoint;
27575
27595
  }
27576
27596
 
27577
- function routeBetweenPoints(source, target) {
27597
+ function routeBetweenPoints(source, target, opt) {
27598
+ if ( opt === void 0 ) opt = {};
27599
+
27578
27600
  var sourcePoint = source.point;
27579
27601
  var sx0 = source.x0;
27580
27602
  var sy0 = source.y0;
27581
- var sourceView = source.view;
27582
27603
  var sourceWidth = source.width;
27583
27604
  var sourceHeight = source.height;
27584
27605
  var sourceMargin = source.margin;
@@ -27588,14 +27609,13 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27588
27609
  var targetWidth = target.width;
27589
27610
  var targetHeight = target.height;
27590
27611
  var targetMargin = target.margin;
27612
+ var targetInSourceBBox = opt.targetInSourceBBox; if ( targetInSourceBBox === void 0 ) targetInSourceBBox = false;
27591
27613
 
27592
27614
  var tx1 = tx0 + targetWidth;
27593
27615
  var ty1 = ty0 + targetHeight;
27594
27616
  var sx1 = sx0 + sourceWidth;
27595
27617
  var sy1 = sy0 + sourceHeight;
27596
27618
 
27597
- var isSourceEl = sourceView && sourceView.model.isElement();
27598
-
27599
27619
  // Key coordinates including the margin
27600
27620
  var smx0 = sx0 - sourceMargin;
27601
27621
  var smx1 = sx1 + sourceMargin;
@@ -27625,10 +27645,15 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27625
27645
  var middleOfVerticalSides = (scx < tcx ? (sx1 + tx0) : (tx1 + sx0)) / 2;
27626
27646
  var middleOfHorizontalSides = (scy < tcy ? (sy1 + ty0) : (ty1 + sy0)) / 2;
27627
27647
 
27648
+ var sourceBBox = new Rect(sx0, sy0, sourceWidth, sourceHeight);
27649
+ var targetBBox = new Rect(tx0, ty0, targetWidth, targetHeight);
27650
+ var inflatedSourceBBox = sourceBBox.clone().inflate(sourceMargin);
27651
+ var inflatedTargetBBox = targetBBox.clone().inflate(targetMargin);
27652
+
27628
27653
  if (sourceSide === 'left' && targetSide === 'right') {
27629
27654
  if (smx0 <= tmx1) {
27630
27655
  var y = middleOfHorizontalSides;
27631
- if (sx1 <= tx0) {
27656
+ if (sox <= tmx0) {
27632
27657
  if (ty1 >= smy0 && toy < soy) {
27633
27658
  y = Math.min(tmy0, smy0);
27634
27659
  } else if (ty0 <= smy1 && toy >= soy) {
@@ -27649,7 +27674,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27649
27674
  { x: x, y: toy }
27650
27675
  ];
27651
27676
  } else if (sourceSide === 'right' && targetSide === 'left') {
27652
- if (smx1 >= tmx0) {
27677
+ if (sox >= tmx0) {
27653
27678
  var y$1 = middleOfHorizontalSides;
27654
27679
  if (sox > tx1) {
27655
27680
  if (ty1 >= smy0 && toy < soy) {
@@ -27673,16 +27698,20 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27673
27698
  { x: x$1, y: toy }
27674
27699
  ];
27675
27700
  } else if (sourceSide === 'top' && targetSide === 'bottom') {
27701
+ var isPointInsideSource = intersection.rectWithRect(inflatedSourceBBox, targetBBox);
27702
+
27676
27703
  if (soy < toy) {
27677
27704
  var x$2 = middleOfVerticalSides;
27678
27705
  var y$2 = soy;
27679
27706
 
27680
- if (soy < ty0) {
27681
- if (tx1 >= smx0 && tox < sox) {
27682
- x$2 = Math.min(tmx0, smx0);
27683
- } else if (tx0 <= smx1 && tox >= sox) {
27684
- x$2 = Math.max(tmx1, smx1);
27685
- }
27707
+ if (isPointInsideSource) {
27708
+ y$2 = Math.min(y$2, tmy0);
27709
+ }
27710
+
27711
+ if (tx1 >= smx0 && tox < sox) {
27712
+ x$2 = Math.min(tmx0, smx0);
27713
+ } else if (tx0 <= smx1 && tox >= sox) {
27714
+ x$2 = Math.max(tmx1, smx1);
27686
27715
  }
27687
27716
 
27688
27717
  return [
@@ -27698,16 +27727,20 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27698
27727
  { x: tox, y: y$3 }
27699
27728
  ];
27700
27729
  } else if (sourceSide === 'bottom' && targetSide === 'top') {
27701
- if (soy - sourceMargin > toy) {
27730
+ var isPointInsideSource$1 = intersection.rectWithRect(inflatedSourceBBox, targetBBox);
27731
+
27732
+ if (soy > toy) {
27702
27733
  var x$3 = middleOfVerticalSides;
27703
27734
  var y$4 = soy;
27704
27735
 
27705
- if (soy > ty1) {
27706
- if (tx1 >= smx0 && tox < sox) {
27707
- x$3 = Math.min(tmx0, smx0);
27708
- } else if (tx0 <= smx1 && tox >= sox) {
27709
- x$3 = Math.max(tmx1, smx1);
27710
- }
27736
+ if (isPointInsideSource$1) {
27737
+ y$4 = Math.max(y$4, tmy1);
27738
+ }
27739
+
27740
+ if (tx1 >= smx0 && tox < sox) {
27741
+ x$3 = Math.min(tmx0, smx0);
27742
+ } else if (tx0 <= smx1 && tox >= sox) {
27743
+ x$3 = Math.max(tmx1, smx1);
27711
27744
  }
27712
27745
 
27713
27746
  return [
@@ -27723,28 +27756,31 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27723
27756
  { x: tox, y: y$5 }
27724
27757
  ];
27725
27758
  } else if (sourceSide === 'top' && targetSide === 'top') {
27759
+ var useUShapeConnection =
27760
+ targetInSourceBBox ||
27761
+ intersection.rectWithRect(inflatedSourceBBox, targetBBox) ||
27762
+ (soy <= ty0 && (inflatedSourceBBox.bottomRight().x <= tox || inflatedSourceBBox.bottomLeft().x >= tox)) ||
27763
+ (soy >= ty0 && (inflatedTargetBBox.bottomRight().x <= sox || inflatedTargetBBox.bottomLeft().x >= sox));
27764
+
27765
+ if (useUShapeConnection) {
27766
+ return [
27767
+ { x: sox, y: Math.min(soy, toy) },
27768
+ { x: tox, y: Math.min(soy, toy) }
27769
+ ];
27770
+ }
27771
+
27726
27772
  var x$4;
27727
27773
  var y1 = Math.min((sy1 + ty0) / 2, toy);
27728
27774
  var y2 = Math.min((sy0 + ty1) / 2, soy);
27729
27775
 
27730
27776
  if (toy < soy) {
27731
- if (sox >= tmx1 || sox <= tmx0) {
27732
- return [
27733
- { x: sox, y: Math.min(soy, toy) },
27734
- { x: tox, y: Math.min(soy, toy) }
27735
- ];
27736
- } else if (tox > sox) {
27777
+ if (tox > sox) {
27737
27778
  x$4 = Math.min(sox, tmx0);
27738
27779
  } else {
27739
27780
  x$4 = Math.max(sox, tmx1);
27740
27781
  }
27741
27782
  } else {
27742
- if (tox >= smx1 || tox <= smx0) {
27743
- return [
27744
- { x: sox, y: Math.min(soy, toy) },
27745
- { x: tox, y: Math.min(soy, toy) }
27746
- ];
27747
- } else if (tox >= sox) {
27783
+ if (tox >= sox) {
27748
27784
  x$4 = Math.max(tox, smx1);
27749
27785
  } else {
27750
27786
  x$4 = Math.min(tox, smx0);
@@ -27758,28 +27794,31 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27758
27794
  { x: tox, y: y1 }
27759
27795
  ];
27760
27796
  } else if (sourceSide === 'bottom' && targetSide === 'bottom') {
27797
+ var useUShapeConnection$1 =
27798
+ targetInSourceBBox ||
27799
+ intersection.rectWithRect(inflatedSourceBBox, targetBBox) ||
27800
+ (soy >= toy && (inflatedSourceBBox.topRight().x <= tox || inflatedSourceBBox.topLeft().x >= tox)) ||
27801
+ (soy <= toy && (inflatedTargetBBox.topRight().x <= sox || inflatedTargetBBox.topLeft().x >= sox));
27802
+
27803
+ if (useUShapeConnection$1) {
27804
+ return [
27805
+ { x: sox, y: Math.max(soy, toy) },
27806
+ { x: tox, y: Math.max(soy, toy) }
27807
+ ];
27808
+ }
27809
+
27761
27810
  var x$5;
27762
27811
  var y1$1 = Math.max((sy0 + ty1) / 2, toy);
27763
27812
  var y2$1 = Math.max((sy1 + ty0) / 2, soy);
27764
27813
 
27765
27814
  if (toy > soy) {
27766
- if (sox >= tmx1 || sox <= tmx0) {
27767
- return [
27768
- { x: sox, y: Math.max(soy, toy) },
27769
- { x: tox, y: Math.max(soy, toy) }
27770
- ];
27771
- } else if (tox > sox) {
27815
+ if (tox > sox) {
27772
27816
  x$5 = Math.min(sox, tmx0);
27773
27817
  } else {
27774
27818
  x$5 = Math.max(sox, tmx1);
27775
27819
  }
27776
27820
  } else {
27777
- if (tox >= smx1 || tox <= smx0) {
27778
- return [
27779
- { x: sox, y: Math.max(soy, toy) },
27780
- { x: tox, y: Math.max(soy, toy) }
27781
- ];
27782
- } else if (tox >= sox) {
27821
+ if (tox >= sox) {
27783
27822
  x$5 = Math.max(tox, smx1);
27784
27823
  } else {
27785
27824
  x$5 = Math.min(tox, smx0);
@@ -27793,6 +27832,19 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27793
27832
  { x: tox, y: y1$1 }
27794
27833
  ];
27795
27834
  } else if (sourceSide === 'left' && targetSide === 'left') {
27835
+ var useUShapeConnection$2 =
27836
+ targetInSourceBBox ||
27837
+ intersection.rectWithRect(inflatedSourceBBox, targetBBox) ||
27838
+ (sox <= tox && (inflatedSourceBBox.bottomRight().y <= toy || inflatedSourceBBox.topRight().y >= toy)) ||
27839
+ (sox >= tox && (inflatedTargetBBox.bottomRight().y <= soy || inflatedTargetBBox.topRight().y >= soy));
27840
+
27841
+ if (useUShapeConnection$2) {
27842
+ return [
27843
+ { x: Math.min(sox, tox), y: soy },
27844
+ { x: Math.min(sox, tox), y: toy }
27845
+ ];
27846
+ }
27847
+
27796
27848
  var y$6;
27797
27849
  var x1 = Math.min((sx1 + tx0) / 2, tox);
27798
27850
  var x2 = Math.min((sx0 + tx1) / 2, sox);
@@ -27818,11 +27870,24 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27818
27870
  { x: x1, y: toy }
27819
27871
  ];
27820
27872
  } else if (sourceSide === 'right' && targetSide === 'right') {
27873
+ var useUShapeConnection$3 =
27874
+ targetInSourceBBox ||
27875
+ intersection.rectWithRect(inflatedSourceBBox, targetBBox) ||
27876
+ (sox >= tox && (inflatedSourceBBox.bottomLeft().y <= toy || inflatedSourceBBox.topLeft().y >= toy)) ||
27877
+ (sox <= tox && (inflatedTargetBBox.bottomLeft().y <= soy || inflatedTargetBBox.topLeft().y >= soy));
27878
+
27879
+ if (useUShapeConnection$3) {
27880
+ return [
27881
+ { x: Math.max(sox, tox), y: soy },
27882
+ { x: Math.max(sox, tox), y: toy }
27883
+ ];
27884
+ }
27885
+
27821
27886
  var y$7;
27822
27887
  var x1$1 = Math.max((sx0 + tx1) / 2, tox);
27823
27888
  var x2$1 = Math.max((sx1 + tx0) / 2, sox);
27824
27889
 
27825
- if (tox < sox) {
27890
+ if (tox <= sox) {
27826
27891
  if (toy <= soy) {
27827
27892
  y$7 = Math.min(smy0, toy);
27828
27893
  } else {
@@ -27843,16 +27908,44 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27843
27908
  { x: x1$1, y: toy }
27844
27909
  ];
27845
27910
  } else if (sourceSide === 'top' && targetSide === 'right') {
27846
- if (soy > toy) {
27911
+ var isPointInsideSource$2 = inflatedSourceBBox.containsPoint(targetPoint);
27912
+
27913
+ // The target point is inside the source element
27914
+ if (isPointInsideSource$2) {
27915
+ if (sox <= tmx1) {
27916
+ var x$6 = Math.max(sox + sourceMargin, tox);
27917
+ var y$8 = Math.min(smy0, tmy0);
27918
+
27919
+ // Target anchor is on the right side of the source anchor
27920
+ return [
27921
+ { x: sox, y: y$8 },
27922
+ { x: x$6, y: y$8 },
27923
+ { x: x$6, y: toy }
27924
+ ];
27925
+ }
27926
+
27927
+ // Target anchor is on the left side of the source anchor
27928
+ // Subtract the `sourceMargin` since the source anchor is on the right side of the target anchor
27929
+ var anchorMiddleX = (sox - sourceMargin + tox) / 2;
27930
+
27931
+ return [
27932
+ { x: sox, y: soy },
27933
+ { x: anchorMiddleX, y: soy },
27934
+ { x: anchorMiddleX, y: toy }
27935
+ ];
27936
+ }
27937
+
27938
+ if (smy0 > toy) {
27847
27939
  if (sox < tox) {
27848
- var y$8 = middleOfHorizontalSides;
27940
+ var y$9 = tmy0;
27849
27941
 
27850
- if ((y$8 > tcy || !isSourceEl) && y$8 < tmy1 && sox < tx0) {
27851
- y$8 = tmy0;
27942
+ if (tmy1 <= smy0 && tmx1 >= sox) {
27943
+ y$9 = middleOfHorizontalSides;
27852
27944
  }
27945
+
27853
27946
  return [
27854
- { x: sox, y: y$8 },
27855
- { x: tox, y: y$8 },
27947
+ { x: sox, y: y$9 },
27948
+ { x: tox, y: y$9 },
27856
27949
  { x: tox, y: toy }
27857
27950
  ];
27858
27951
  }
@@ -27860,273 +27953,523 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
27860
27953
  return [{ x: sox, y: toy }];
27861
27954
  }
27862
27955
 
27863
- var x$6 = Math.max(middleOfVerticalSides, tmx1);
27956
+ var x$7 = Math.max(middleOfVerticalSides, tmx1);
27864
27957
 
27865
- if (tox < sox && toy > sy0 && toy < sy1) {
27958
+ if (sox > tox && sy1 >= toy) {
27866
27959
  return [
27867
27960
  { x: sox, y: soy },
27868
- { x: x$6, y: soy },
27869
- { x: x$6, y: toy }
27961
+ { x: x$7, y: soy },
27962
+ { x: x$7, y: toy }
27870
27963
  ];
27871
27964
  }
27872
27965
 
27873
- if ((x$6 > smx0 && toy > sy0) || tx0 > sx1) {
27874
- var y$9 = Math.min(sy0 - sourceMargin, ty0 - targetMargin);
27875
- var x$7 = Math.max(sx1 + sourceMargin, tx1 + targetMargin);
27966
+ if (x$7 > smx0 && soy < ty1) {
27967
+ var y$10 = Math.min(smy0, tmy0);
27968
+ var x$8 = Math.max(smx1, tmx1);
27876
27969
  return [
27877
- { x: sox, y: y$9 },
27878
- { x: x$7, y: y$9 },
27879
- { x: x$7, y: toy }
27970
+ { x: sox, y: y$10 },
27971
+ { x: x$8, y: y$10 },
27972
+ { x: x$8, y: toy }
27880
27973
  ];
27881
27974
  }
27882
27975
 
27883
27976
  return [
27884
27977
  { x: sox, y: soy },
27885
- { x: Math.max(x$6, tox), y: soy },
27886
- { x: Math.max(x$6, tox), y: toy }
27978
+ { x: x$7, y: soy },
27979
+ { x: x$7, y: toy }
27887
27980
  ];
27888
27981
  } else if (sourceSide === 'top' && targetSide === 'left') {
27889
- if (soy > toy) {
27982
+ var isPointInsideSource$3 = inflatedSourceBBox.containsPoint(targetPoint);
27983
+
27984
+ // The target point is inside the source element
27985
+ if (isPointInsideSource$3) {
27986
+ if (sox >= tmx0) {
27987
+ var x$9 = Math.min(sox - sourceMargin, tox);
27988
+ var y$11 = Math.min(smy0, tmy0);
27989
+
27990
+ // Target anchor is on the left side of the source anchor
27991
+ return [
27992
+ { x: sox, y: y$11 },
27993
+ { x: x$9, y: y$11 },
27994
+ { x: x$9, y: toy }
27995
+ ];
27996
+ }
27997
+
27998
+ // Target anchor is on the right side of the source anchor
27999
+ // Add the `sourceMargin` since the source anchor is on the left side of the target anchor
28000
+ var anchorMiddleX$1 = (sox + sourceMargin + tox) / 2;
28001
+
28002
+ return [
28003
+ { x: sox, y: soy },
28004
+ { x: anchorMiddleX$1, y: soy },
28005
+ { x: anchorMiddleX$1, y: toy }
28006
+ ];
28007
+ }
28008
+
28009
+ if (smy0 > toy) {
27890
28010
  if (sox > tox) {
27891
- var y$10 = middleOfHorizontalSides;
28011
+ var y$12 = tmy0;
27892
28012
 
27893
- if ((y$10 > tcy || !isSourceEl) && y$10 < tmy1 && sox > tx1) {
27894
- y$10 = tmy0;
28013
+ if (tmy1 <= smy0 && tmx0 <= sox) {
28014
+ y$12 = middleOfHorizontalSides;
27895
28015
  }
28016
+
27896
28017
  return [
27897
- { x: sox, y: y$10 },
27898
- { x: tox, y: y$10 },
28018
+ { x: sox, y: y$12 },
28019
+ { x: tox, y: y$12 },
27899
28020
  { x: tox, y: toy }
27900
28021
  ];
27901
28022
  }
28023
+
27902
28024
  return [{ x: sox, y: toy }];
27903
28025
  }
27904
28026
 
27905
- var x$8 = Math.min(tmx0, middleOfVerticalSides);
28027
+ var x$10 = Math.min(tmx0, middleOfVerticalSides);
27906
28028
 
27907
28029
  if (sox < tox && sy1 >= toy) {
27908
28030
  return [
27909
28031
  { x: sox, y: soy },
27910
- { x: x$8, y: soy },
27911
- { x: x$8, y: toy }];
28032
+ { x: x$10, y: soy },
28033
+ { x: x$10, y: toy }];
27912
28034
  }
27913
28035
 
27914
- if (x$8 < smx1 && soy < ty1) {
27915
- var y$11 = Math.min(smy0, tmy0);
27916
- var x$9 = Math.min(smx0, tmx0);
28036
+ if (x$10 < smx1 && soy < ty1) {
28037
+ var y$13 = Math.min(smy0, tmy0);
28038
+ var x$11 = Math.min(smx0, tmx0);
27917
28039
  return [
27918
- { x: sox, y: y$11 },
27919
- { x: x$9, y: y$11 },
27920
- { x: x$9, y: toy }
28040
+ { x: sox, y: y$13 },
28041
+ { x: x$11, y: y$13 },
28042
+ { x: x$11, y: toy }
27921
28043
  ];
27922
28044
  }
28045
+
27923
28046
  return [
27924
28047
  { x: sox, y: soy },
27925
- { x: x$8, y: soy },
27926
- { x: x$8, y: toy }
28048
+ { x: x$10, y: soy },
28049
+ { x: x$10, y: toy }
27927
28050
  ];
27928
28051
  } else if (sourceSide === 'bottom' && targetSide === 'right') {
27929
- if (soy < toy) {
28052
+ var isPointInsideSource$4 = inflatedSourceBBox.containsPoint(targetPoint);
28053
+
28054
+ // The target point is inside the source element
28055
+ if (isPointInsideSource$4) {
28056
+ if (sox <= tmx1) {
28057
+ var x$12 = Math.max(sox + sourceMargin, tox);
28058
+ var y$14 = Math.max(smy1, tmy1);
28059
+
28060
+ // Target anchor is on the right side of the source anchor
28061
+ return [
28062
+ { x: sox, y: y$14 },
28063
+ { x: x$12, y: y$14 },
28064
+ { x: x$12, y: toy }
28065
+ ];
28066
+ }
28067
+
28068
+ // Target anchor is on the left side of the source anchor
28069
+ // Subtract the `sourceMargin` since the source anchor is on the right side of the target anchor
28070
+ var anchorMiddleX$2 = (sox - sourceMargin + tox) / 2;
28071
+
28072
+ return [
28073
+ { x: sox, y: soy },
28074
+ { x: anchorMiddleX$2, y: soy },
28075
+ { x: anchorMiddleX$2, y: toy }
28076
+ ];
28077
+ }
28078
+
28079
+ if (smy1 < toy) {
27930
28080
  if (sox < tox) {
27931
- var y$12 = middleOfHorizontalSides;
28081
+ var y$15 = tmy1;
27932
28082
 
27933
- if ((y$12 < tcy || !isSourceEl) && y$12 > tmy0 && sox < tx0) {
27934
- y$12 = tmy1;
28083
+ if (tmy0 >= smy1 && tmx1 >= sox) {
28084
+ y$15 = middleOfHorizontalSides;
27935
28085
  }
28086
+
27936
28087
  return [
27937
- { x: sox, y: y$12 },
27938
- { x: tox, y: y$12 },
28088
+ { x: sox, y: y$15 },
28089
+ { x: tox, y: y$15 },
27939
28090
  { x: tox, y: toy }
27940
28091
  ];
27941
28092
  }
28093
+
27942
28094
  return [{ x: sox, y: toy }];
27943
- } else {
27944
- if (sx0 < tox) {
27945
- var y$13 = Math.max(smy1, tmy1);
27946
- var x$10 = Math.max(smx1, tmx1);
27947
- return [
27948
- { x: sox, y: y$13 },
27949
- { x: x$10, y: y$13 },
27950
- { x: x$10, y: toy }
27951
- ];
27952
- }
27953
28095
  }
27954
28096
 
27955
- var x$11 = middleOfVerticalSides;
28097
+ var x$13 = Math.max(middleOfVerticalSides, tmx1);
28098
+
28099
+ if (sox > tox && sy0 <= toy) {
28100
+ return [
28101
+ { x: sox, y: soy },
28102
+ { x: x$13, y: soy },
28103
+ { x: x$13, y: toy }
28104
+ ];
28105
+ }
28106
+
28107
+ if (x$13 > smx0 && soy > ty0) {
28108
+ var y$16 = Math.max(smy1, tmy1);
28109
+ var x$14 = Math.max(smx1, tmx1);
28110
+ return [
28111
+ { x: sox, y: y$16 },
28112
+ { x: x$14, y: y$16 },
28113
+ { x: x$14, y: toy }
28114
+ ];
28115
+ }
27956
28116
 
27957
28117
  return [
27958
28118
  { x: sox, y: soy },
27959
- { x: x$11, y: soy },
27960
- { x: x$11, y: toy }
28119
+ { x: x$13, y: soy },
28120
+ { x: x$13, y: toy }
27961
28121
  ];
27962
28122
  } else if (sourceSide === 'bottom' && targetSide === 'left') {
27963
- if (soy < toy) {
28123
+ var isPointInsideSource$5 = inflatedSourceBBox.containsPoint(targetPoint);
28124
+
28125
+ // The target point is inside the source element
28126
+ if (isPointInsideSource$5) {
28127
+ if (sox >= tmx0) {
28128
+ var x$15 = Math.min(sox - sourceMargin, tox);
28129
+ var y$17 = Math.max(smy1, tmy1);
28130
+
28131
+ // Target anchor is on the left side of the source anchor
28132
+ return [
28133
+ { x: sox, y: y$17 },
28134
+ { x: x$15, y: y$17 },
28135
+ { x: x$15, y: toy }
28136
+ ];
28137
+ }
28138
+
28139
+ // Target anchor is on the right side of the source anchor
28140
+ // Add the `sourceMargin` since the source anchor is on the left side of the target anchor
28141
+ var anchorMiddleX$3 = (sox + sourceMargin + tox) / 2;
28142
+
28143
+ return [
28144
+ { x: sox, y: soy },
28145
+ { x: anchorMiddleX$3, y: soy },
28146
+ { x: anchorMiddleX$3, y: toy }
28147
+ ];
28148
+ }
28149
+
28150
+ if (smy1 < toy) {
27964
28151
  if (sox > tox) {
27965
- var y$14 = middleOfHorizontalSides;
28152
+ var y$18 = tmy1;
27966
28153
 
27967
- if ((y$14 < tcy || !isSourceEl) && y$14 > tmy0 && sox > tx1) {
27968
- y$14 = tmy1;
28154
+ if (tmy0 >= smy1 && tmx0 <= sox) {
28155
+ y$18 = middleOfHorizontalSides;
27969
28156
  }
28157
+
27970
28158
  return [
27971
- { x: sox, y: y$14 },
27972
- { x: tox, y: y$14 },
28159
+ { x: sox, y: y$18 },
28160
+ { x: tox, y: y$18 },
27973
28161
  { x: tox, y: toy }
27974
28162
  ];
27975
28163
  }
28164
+
27976
28165
  return [{ x: sox, y: toy }];
27977
- } else {
27978
- if (sx1 > tox) {
27979
- var y$15 = Math.max(smy1, tmy1);
27980
- var x$12 = Math.min(smx0, tmx0);
27981
- return [
27982
- { x: sox, y: y$15 },
27983
- { x: x$12, y: y$15 },
27984
- { x: x$12, y: toy }
27985
- ];
27986
- }
27987
28166
  }
27988
28167
 
27989
- var x$13 = middleOfVerticalSides;
28168
+ var x$16 = Math.min(tmx0, middleOfVerticalSides);
28169
+
28170
+ if (sox < tox && sy0 <= toy) {
28171
+ return [
28172
+ { x: sox, y: soy },
28173
+ { x: x$16, y: soy },
28174
+ { x: x$16, y: toy }
28175
+ ];
28176
+ }
28177
+
28178
+ if (x$16 < smx1 && soy > ty0) {
28179
+ var y$19 = Math.max(smy1, tmy1);
28180
+ var x$17 = Math.min(smx0, tmx0);
28181
+ return [
28182
+ { x: sox, y: y$19 },
28183
+ { x: x$17, y: y$19 },
28184
+ { x: x$17, y: toy }
28185
+ ];
28186
+ }
27990
28187
 
27991
28188
  return [
27992
28189
  { x: sox, y: soy },
27993
- { x: x$13, y: soy },
27994
- { x: x$13, y: toy }
28190
+ { x: x$16, y: soy },
28191
+ { x: x$16, y: toy }
27995
28192
  ];
27996
- }
27997
- else if (sourceSide === 'left' && targetSide === 'bottom') {
27998
- if (sox >= tox && soy >= tmy1) {
27999
- return [{ x: tox, y: soy }];
28000
- }
28193
+ } else if (sourceSide === 'left' && targetSide === 'bottom') {
28194
+ var isPointInsideSource$6 = inflatedSourceBBox.containsPoint(targetPoint);
28195
+
28196
+ // The target point is inside the source element
28197
+ if (isPointInsideSource$6) {
28198
+ if (soy <= tmy1) {
28199
+ var x$18 = Math.min(smx0, tmx0);
28200
+ var y$20 = Math.max(soy + sourceMargin, toy);
28201
+
28202
+ return [
28203
+ { x: x$18, y: soy },
28204
+ { x: x$18, y: y$20 },
28205
+ { x: tox, y: y$20 }
28206
+ ];
28207
+ }
28001
28208
 
28002
- if (sox >= tx1 && soy < toy) {
28003
- var x$14 = middleOfVerticalSides;
28209
+ // Target anchor is above the source anchor
28210
+ var anchorMiddleY = (soy - sourceMargin + toy) / 2;
28004
28211
 
28005
28212
  return [
28006
- { x: x$14, y: soy },
28007
- { x: x$14, y: toy },
28008
- { x: tox, y: toy }
28213
+ { x: sox, y: soy },
28214
+ { x: sox, y: anchorMiddleY },
28215
+ { x: tox, y: anchorMiddleY }
28009
28216
  ];
28010
28217
  }
28011
28218
 
28012
- if (tox < sx1 && ty1 <= sy0) {
28013
- var y$16 = middleOfHorizontalSides;
28219
+ if (smx0 > tox) {
28220
+ if (soy < toy) {
28221
+ var x$19 = tmx0;
28222
+
28223
+ if (tmx1 <= smx0 && tmy1 >= soy) {
28224
+ x$19 = middleOfVerticalSides;
28225
+ }
28226
+
28227
+ return [
28228
+ { x: x$19, y: soy },
28229
+ { x: x$19, y: toy },
28230
+ { x: tox, y: toy }
28231
+ ];
28232
+ }
28233
+
28234
+ return [{ x: tox, y: soy }];
28235
+ }
28236
+
28237
+ var y$21 = Math.max(tmy1, middleOfHorizontalSides);
28014
28238
 
28239
+ if (soy > toy && sx1 >= tox) {
28015
28240
  return [
28016
28241
  { x: sox, y: soy },
28017
- { x: sox, y: y$16 },
28018
- { x: tox, y: y$16 }
28242
+ { x: sox, y: y$21 },
28243
+ { x: tox, y: y$21 }
28019
28244
  ];
28020
28245
  }
28021
28246
 
28022
- var x$15 = Math.min(tmx0, sox);
28023
- var y$17 = Math.max(smy1, tmy1);
28247
+ if (y$21 > smy0 && sox < tx1) {
28248
+ var x$20 = Math.min(smx0, tmx0);
28249
+ var y$22 = Math.max(smy1, tmy1);
28250
+
28251
+ return [
28252
+ { x: x$20, y: soy },
28253
+ { x: x$20, y: y$22 },
28254
+ { x: tox, y: y$22 }
28255
+ ];
28256
+ }
28024
28257
 
28025
28258
  return [
28026
- { x: x$15, y: soy },
28027
- { x: x$15, y: y$17 },
28028
- { x: tox, y: y$17 }
28259
+ { x: sox, y: soy },
28260
+ { x: sox, y: y$21 },
28261
+ { x: tox, y: y$21 }
28029
28262
  ];
28030
28263
  } else if (sourceSide === 'left' && targetSide === 'top') {
28031
- if (sox > tox && soy < tmy0) {
28032
- return [{ x: tox, y: soy }];
28264
+ var isPointInsideSource$7 = inflatedSourceBBox.containsPoint(targetPoint);
28265
+
28266
+ // The target point is inside the source element
28267
+ if (isPointInsideSource$7) {
28268
+ if (soy >= tmy0) {
28269
+ var y$23 = Math.min(soy - sourceMargin, toy);
28270
+ var x$21 = Math.min(smx0, tmx0);
28271
+
28272
+ // Target anchor is on the top side of the source anchor
28273
+ return [
28274
+ { x: x$21, y: soy },
28275
+ { x: x$21, y: y$23 },
28276
+ { x: tox, y: y$23 }
28277
+ ];
28278
+ }
28279
+
28280
+ // Target anchor is below the source anchor
28281
+ // Add the `sourceMargin` since the source anchor is above the target anchor
28282
+ var anchorMiddleY$1 = (soy + sourceMargin + toy) / 2;
28283
+
28284
+ return [
28285
+ { x: sox, y: soy },
28286
+ { x: sox, y: anchorMiddleY$1 },
28287
+ { x: tox, y: anchorMiddleY$1 }
28288
+ ];
28033
28289
  }
28034
28290
 
28035
- if (sox >= tx1) {
28291
+ if (smx0 > tox) {
28036
28292
  if (soy > toy) {
28037
- var x$16 = middleOfVerticalSides;
28293
+ var x$22 = tmx0;
28294
+
28295
+ if (tmx1 <= smx0 && tmy0 <= soy) {
28296
+ x$22 = middleOfVerticalSides;
28297
+ }
28038
28298
 
28039
28299
  return [
28040
- { x: x$16, y: soy },
28041
- { x: x$16, y: toy },
28300
+ { x: x$22, y: soy },
28301
+ { x: x$22, y: toy },
28042
28302
  { x: tox, y: toy }
28043
28303
  ];
28044
28304
  }
28305
+
28306
+ return [{ x: tox, y: soy }];
28045
28307
  }
28046
28308
 
28047
- if (tox <= sx1 && toy > soy) {
28048
- var y$18 = middleOfHorizontalSides;
28309
+ var y$24 = Math.min(tmy0, middleOfHorizontalSides);
28049
28310
 
28311
+ if (soy < toy && sx1 >= tox) {
28050
28312
  return [
28051
28313
  { x: sox, y: soy },
28052
- { x: sox, y: y$18 },
28053
- { x: tox, y: y$18 } ];
28314
+ { x: sox, y: y$24 },
28315
+ { x: tox, y: y$24 }];
28054
28316
  }
28055
28317
 
28056
- var x$17 = toy < soy ? Math.min(smx0, tmx0) : smx0;
28057
- var y$19 = Math.min(smy0, tmy0);
28318
+ if (y$24 < smy1 && sox < tx1) {
28319
+ var x$23 = Math.min(smx0, tmx0);
28320
+ var y$25 = Math.min(smy0, tmy0);
28321
+ return [
28322
+ { x: x$23, y: soy },
28323
+ { x: x$23, y: y$25 },
28324
+ { x: tox, y: y$25 }
28325
+ ];
28326
+ }
28058
28327
 
28059
28328
  return [
28060
- { x: x$17, y: soy },
28061
- { x: x$17, y: y$19 },
28062
- { x: tox, y: y$19 }
28329
+ { x: sox, y: soy },
28330
+ { x: sox, y: y$24 },
28331
+ { x: tox, y: y$24 }
28063
28332
  ];
28064
-
28065
28333
  } else if (sourceSide === 'right' && targetSide === 'top') {
28066
- if (sox <= tox && soy < tmy0) {
28067
- return [{ x: tox, y: soy }];
28068
- }
28334
+ var isPointInsideSource$8 = inflatedSourceBBox.containsPoint(targetPoint);
28335
+
28336
+ // The target point is inside the source element
28337
+ if (isPointInsideSource$8) {
28338
+ if (soy >= tmy0) {
28339
+ var x$24 = Math.max(smx1, tmx1);
28340
+ var y$26 = Math.min(soy - sourceMargin, toy);
28341
+
28342
+ // Target anchor is on the top side of the source anchor
28343
+ return [
28344
+ { x: x$24, y: soy },
28345
+ { x: x$24, y: y$26 }, // Path adjustment for right side start
28346
+ { x: tox, y: y$26 }
28347
+ ];
28348
+ }
28069
28349
 
28070
- if (sx1 < tx0 && soy > toy) {
28071
- var x$18 = middleOfVerticalSides;
28350
+ // Target anchor is below the source anchor
28351
+ // Adjust sourceMargin calculation since the source anchor is now on the right
28352
+ var anchorMiddleY$2 = (soy + sourceMargin + toy) / 2;
28072
28353
 
28073
28354
  return [
28074
- { x: x$18, y: soy },
28075
- { x: x$18, y: toy },
28076
- { x: tox, y: toy }
28355
+ { x: sox, y: soy },
28356
+ { x: sox, y: anchorMiddleY$2 },
28357
+ { x: tox, y: anchorMiddleY$2 }
28077
28358
  ];
28078
28359
  }
28079
28360
 
28080
- if (tox < sox && ty0 > sy1) {
28081
- var y$20 = middleOfHorizontalSides;
28361
+ if (smx1 < tox) {
28362
+ if (soy > toy) {
28363
+ var x$25 = tmx1;
28364
+
28365
+ if (tmx0 >= smx1 && tmy0 <= soy) {
28366
+ x$25 = middleOfVerticalSides;
28367
+ }
28368
+
28369
+ return [
28370
+ { x: x$25, y: soy },
28371
+ { x: x$25, y: toy },
28372
+ { x: tox, y: toy }
28373
+ ];
28374
+ }
28375
+
28376
+ return [{ x: tox, y: soy }];
28377
+ }
28378
+
28379
+ var y$27 = Math.min(tmy0, middleOfHorizontalSides);
28082
28380
 
28381
+ if (soy < toy && sx0 <= tox) {
28083
28382
  return [
28084
28383
  { x: sox, y: soy },
28085
- { x: sox, y: y$20 },
28086
- { x: tox, y: y$20 }
28087
- ];
28384
+ { x: sox, y: y$27 },
28385
+ { x: tox, y: y$27 }];
28088
28386
  }
28089
28387
 
28090
- var x$19 = Math.max(smx1, tmx1);
28091
- var y$21 = Math.min(smy0, tmy0);
28388
+ if (y$27 < smy1 && sox > tx0) {
28389
+ var x$26 = Math.max(smx1, tmx1);
28390
+ var y$28 = Math.min(smy0, tmy0);
28391
+
28392
+ return [
28393
+ { x: x$26, y: soy },
28394
+ { x: x$26, y: y$28 },
28395
+ { x: tox, y: y$28 }
28396
+ ];
28397
+ }
28092
28398
 
28093
28399
  return [
28094
- { x: x$19, y: soy },
28095
- { x: x$19, y: y$21 },
28096
- { x: tox, y: y$21 }
28400
+ { x: sox, y: soy },
28401
+ { x: sox, y: y$27 },
28402
+ { x: tox, y: y$27 }
28097
28403
  ];
28098
28404
  } else if (sourceSide === 'right' && targetSide === 'bottom') {
28099
- if (sox <= tox && soy >= tmy1) {
28100
- return [{ x: tox, y: soy }];
28101
- }
28405
+ var isPointInsideSource$9 = inflatedSourceBBox.containsPoint(targetPoint);
28406
+
28407
+ // The target point is inside the source element
28408
+ if (isPointInsideSource$9) {
28409
+ if (soy <= tmy1) {
28410
+ var x$27 = Math.max(smx1, tmx1);
28411
+ var y$29 = Math.max(soy + sourceMargin, toy);
28412
+
28413
+ return [
28414
+ { x: x$27, y: soy },
28415
+ { x: x$27, y: y$29 },
28416
+ { x: tox, y: y$29 }
28417
+ ];
28418
+ }
28102
28419
 
28103
- if (sox <= tmx0 && soy < toy) {
28104
- var x$20 = middleOfVerticalSides;
28420
+ // Target anchor is above the source anchor
28421
+ var anchorMiddleY$3 = (soy - sourceMargin + toy) / 2;
28105
28422
 
28106
28423
  return [
28107
- { x: x$20, y: soy },
28108
- { x: x$20, y: toy },
28109
- { x: tox, y: toy }
28424
+ { x: sox, y: soy },
28425
+ { x: sox, y: anchorMiddleY$3 },
28426
+ { x: tox, y: anchorMiddleY$3 }
28110
28427
  ];
28111
28428
  }
28112
28429
 
28113
- if (tox > sx0 && ty1 < sy0) {
28114
- var y$22 = middleOfHorizontalSides;
28430
+ if (smx1 < tox) {
28431
+ if (soy < toy) {
28432
+ var x$28 = tmx1;
28433
+
28434
+ if (tmx0 >= smx1 && tmy1 >= soy) {
28435
+ x$28 = middleOfVerticalSides;
28436
+ }
28437
+
28438
+ return [
28439
+ { x: x$28, y: soy },
28440
+ { x: x$28, y: toy },
28441
+ { x: tox, y: toy }
28442
+ ];
28443
+ }
28444
+
28445
+ return [{ x: tox, y: soy }];
28446
+ }
28447
+
28448
+ var y$30 = Math.max(tmy1, middleOfHorizontalSides);
28115
28449
 
28450
+ if (soy > toy && sx0 <= tox) {
28116
28451
  return [
28117
28452
  { x: sox, y: soy },
28118
- { x: sox, y: y$22 },
28119
- { x: tox, y: y$22 }
28453
+ { x: sox, y: y$30 },
28454
+ { x: tox, y: y$30 }
28120
28455
  ];
28121
28456
  }
28122
28457
 
28123
- var x$21 = Math.max(tmx1, sox);
28124
- var y$23 = Math.max(smy1, tmy1);
28458
+ if (y$30 > smy0 && sox > tx0) {
28459
+ var x$29 = Math.max(smx1, tmx1);
28460
+ var y$31 = Math.max(smy1, tmy1);
28461
+
28462
+ return [
28463
+ { x: x$29, y: soy },
28464
+ { x: x$29, y: y$31 },
28465
+ { x: tox, y: y$31 }
28466
+ ];
28467
+ }
28125
28468
 
28126
28469
  return [
28127
- { x: x$21, y: soy },
28128
- { x: x$21, y: y$23 },
28129
- { x: tox, y: y$23 }
28470
+ { x: sox, y: soy },
28471
+ { x: sox, y: y$30 },
28472
+ { x: tox, y: y$30 }
28130
28473
  ];
28131
28474
  }
28132
28475
  }
@@ -28162,7 +28505,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
28162
28505
  dummySource.direction = fromDirection;
28163
28506
  firstVertex.direction = toDirection;
28164
28507
 
28165
- resultVertices.push.apply(resultVertices, routeBetweenPoints(dummySource, firstVertex).concat( [firstVertex.point] ));
28508
+ resultVertices.push.apply(resultVertices, routeBetweenPoints(dummySource, firstVertex, { targetInSourceBBox: true }).concat( [firstVertex.point] ));
28166
28509
  } else {
28167
28510
  // The first point responsible for the initial direction of the route
28168
28511
  var next = verticesData[1] || targetPoint;
@@ -34826,6 +35169,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
34826
35169
  },
34827
35170
 
34828
35171
  _resetUpdates: function() {
35172
+ if (this._updates && this._updates.id) { cancelFrame(this._updates.id); }
35173
+
34829
35174
  return this._updates = {
34830
35175
  id: null,
34831
35176
  priorities: [{}, {}, {}],
@@ -39579,7 +39924,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
39579
39924
  Control: Control
39580
39925
  });
39581
39926
 
39582
- var version = "4.0.1";
39927
+ var version = "4.0.2";
39583
39928
 
39584
39929
  var Vectorizer = V;
39585
39930
  var layout = { PortLabel: PortLabel, Port: Port };