leafer-ui 2.1.6 → 2.1.8

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.
@@ -292,7 +292,7 @@ const FourNumberHelper = {
292
292
  return to;
293
293
  },
294
294
  setTemp(top, right, bottom, left) {
295
- return set$2(tempFour, top, right, bottom, left);
295
+ return set$3(tempFour, top, right, bottom, left);
296
296
  },
297
297
  toTempAB(a, b, change) {
298
298
  tempTo = change ? isNumber(a) ? b : a : [];
@@ -332,22 +332,22 @@ const FourNumberHelper = {
332
332
  max(t, other, change) {
333
333
  if (isNumber(t) && isNumber(other)) return max$5(t, other);
334
334
  toTempAB(t, other, change);
335
- return set$2(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
335
+ return set$3(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
336
336
  },
337
337
  add(t, other, change) {
338
338
  if (isNumber(t) && isNumber(other)) return t + other;
339
339
  toTempAB(t, other, change);
340
- return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
340
+ return set$3(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
341
341
  },
342
342
  swapAndScale(t, scaleX, scaleY, change) {
343
343
  if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
344
344
  const to = change ? t : [];
345
345
  const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
346
- return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
346
+ return set$3(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
347
347
  }
348
348
  };
349
349
 
350
- const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
350
+ const {set: set$3, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
351
351
 
352
352
  const {round: round$3, pow: pow$1, max: max$4, floor: floor$2, PI: PI$3} = Math;
353
353
 
@@ -472,7 +472,7 @@ const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
472
472
 
473
473
  const {float: float$3} = MathHelper;
474
474
 
475
- const tempPoint$4 = {};
475
+ const tempPoint$5 = {};
476
476
 
477
477
  function getWorld() {
478
478
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
@@ -531,8 +531,8 @@ const MatrixHelper = {
531
531
  to.f = t.f * pixelRatio;
532
532
  },
533
533
  scaleOfOuter(t, origin, scaleX, scaleY) {
534
- M$6.toInnerPoint(t, origin, tempPoint$4);
535
- M$6.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
534
+ M$6.toInnerPoint(t, origin, tempPoint$5);
535
+ M$6.scaleOfInner(t, tempPoint$5, scaleX, scaleY);
536
536
  },
537
537
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
538
538
  M$6.translateInner(t, origin.x, origin.y);
@@ -550,8 +550,8 @@ const MatrixHelper = {
550
550
  t.d = c * sinR + d * cosR;
551
551
  },
552
552
  rotateOfOuter(t, origin, rotation) {
553
- M$6.toInnerPoint(t, origin, tempPoint$4);
554
- M$6.rotateOfInner(t, tempPoint$4, rotation);
553
+ M$6.toInnerPoint(t, origin, tempPoint$5);
554
+ M$6.rotateOfInner(t, tempPoint$5, rotation);
555
555
  },
556
556
  rotateOfInner(t, origin, rotation) {
557
557
  M$6.translateInner(t, origin.x, origin.y);
@@ -572,8 +572,8 @@ const MatrixHelper = {
572
572
  }
573
573
  },
574
574
  skewOfOuter(t, origin, skewX, skewY) {
575
- M$6.toInnerPoint(t, origin, tempPoint$4);
576
- M$6.skewOfInner(t, tempPoint$4, skewX, skewY);
575
+ M$6.toInnerPoint(t, origin, tempPoint$5);
576
+ M$6.skewOfInner(t, tempPoint$5, skewX, skewY);
577
577
  },
578
578
  skewOfInner(t, origin, skewX, skewY = 0) {
579
579
  M$6.translateInner(t, origin.x, origin.y);
@@ -774,7 +774,7 @@ const {float: float$2} = MathHelper;
774
774
 
775
775
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
776
776
 
777
- const {sin: sin$4, cos: cos$4, abs: abs$5, sqrt: sqrt$2, atan2: atan2$2, min: min$2, round: round$2} = Math;
777
+ const {sin: sin$4, cos: cos$4, abs: abs$6, sqrt: sqrt$2, atan2: atan2$2, min: min$2, round: round$2} = Math;
778
778
 
779
779
  const PointHelper = {
780
780
  defaultPoint: getPointData(),
@@ -811,15 +811,15 @@ const PointHelper = {
811
811
  t.x += (t.x - origin.x) * (scaleX - 1);
812
812
  t.y += (t.y - origin.y) * (scaleY - 1);
813
813
  },
814
- rotate(t, rotation, origin) {
814
+ rotate(t, rotation, origin, radiusX = 1, radiusY = 1) {
815
815
  if (!origin) origin = P$5.defaultPoint;
816
816
  rotation *= OneRadian;
817
817
  const cosR = cos$4(rotation);
818
818
  const sinR = sin$4(rotation);
819
- const rx = t.x - origin.x;
820
- const ry = t.y - origin.y;
821
- t.x = origin.x + rx * cosR - ry * sinR;
822
- t.y = origin.y + rx * sinR + ry * cosR;
819
+ const rx = (t.x - origin.x) / radiusX;
820
+ const ry = (t.y - origin.y) / radiusY;
821
+ t.x = origin.x + (rx * cosR - ry * sinR) * radiusX;
822
+ t.y = origin.y + (rx * sinR + ry * cosR) * radiusY;
823
823
  },
824
824
  tempToInnerOf(t, matrix) {
825
825
  const {tempPoint: temp} = P$5;
@@ -872,15 +872,15 @@ const PointHelper = {
872
872
  return getDistanceFrom(t.x, t.y, point.x, point.y);
873
873
  },
874
874
  getDistanceFrom(x1, y1, x2, y2) {
875
- const x = abs$5(x2 - x1);
876
- const y = abs$5(y2 - y1);
875
+ const x = abs$6(x2 - x1);
876
+ const y = abs$6(y2 - y1);
877
877
  return sqrt$2(x * x + y * y);
878
878
  },
879
879
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
880
880
  return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
881
881
  },
882
- getAngle(t, to) {
883
- return getAtan2(t, to) / OneRadian;
882
+ getAngle(t, to, radiusX, radiusY) {
883
+ return getAtan2(t, to, radiusX, radiusY) / OneRadian;
884
884
  },
885
885
  getRotation(t, origin, to, toOrigin) {
886
886
  if (!toOrigin) toOrigin = origin;
@@ -894,8 +894,8 @@ const PointHelper = {
894
894
  const d = toY - toOriginY;
895
895
  return Math.atan2(a * d - b * c, a * c + b * d);
896
896
  },
897
- getAtan2(t, to) {
898
- return atan2$2(to.y - t.y, to.x - t.x);
897
+ getAtan2(t, to, radiusX = 1, radiusY = 1) {
898
+ return atan2$2((to.y - t.y) / radiusY, (to.x - t.x) / radiusX);
899
899
  },
900
900
  getDistancePoint(t, to, distance, changeTo, fromTo) {
901
901
  const r = getAtan2(t, to);
@@ -952,12 +952,12 @@ class Point {
952
952
  PointHelper.scaleOf(this, origin, scaleX, scaleY);
953
953
  return this;
954
954
  }
955
- rotate(rotation, origin) {
956
- PointHelper.rotate(this, rotation, origin);
955
+ rotate(rotation, origin, radiusX, radiusY) {
956
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
957
957
  return this;
958
958
  }
959
- rotateOf(origin, rotation) {
960
- PointHelper.rotate(this, rotation, origin);
959
+ rotateOf(origin, rotation, radiusX, radiusY) {
960
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
961
961
  return this;
962
962
  }
963
963
  getRotation(origin, to, toOrigin) {
@@ -980,11 +980,11 @@ class Point {
980
980
  getDistancePoint(to, distance, changeTo, fromTo) {
981
981
  return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
982
982
  }
983
- getAngle(to) {
984
- return PointHelper.getAngle(this, to);
983
+ getAngle(to, radiusX, radiusY) {
984
+ return PointHelper.getAngle(this, to, radiusX, radiusY);
985
985
  }
986
- getAtan2(to) {
987
- return PointHelper.getAtan2(this, to);
986
+ getAtan2(to, radiusX, radiusY) {
987
+ return PointHelper.getAtan2(this, to, radiusX, radiusY);
988
988
  }
989
989
  isSame(point, quick) {
990
990
  return PointHelper.isSame(this, point, quick);
@@ -995,7 +995,7 @@ class Point {
995
995
  }
996
996
  }
997
997
 
998
- const tempPoint$3 = new Point;
998
+ const tempPoint$4 = new Point;
999
999
 
1000
1000
  class Matrix {
1001
1001
  constructor(a, b, c, d, e, f) {
@@ -2702,15 +2702,15 @@ const RectHelper = {
2702
2702
  }
2703
2703
  };
2704
2704
 
2705
- const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil, abs: abs$4, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
2705
+ const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil, abs: abs$5, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
2706
2706
 
2707
2707
  const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
2708
2708
 
2709
- const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
2709
+ const {set: set$2, toNumberPoints: toNumberPoints} = PointHelper;
2710
2710
 
2711
2711
  const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
2712
2712
 
2713
- const tempPoint$2 = {};
2713
+ const tempPoint$3 = {};
2714
2714
 
2715
2715
  const BezierHelper = {
2716
2716
  points(data, originPoints, curve, close) {
@@ -2779,14 +2779,14 @@ const BezierHelper = {
2779
2779
  const lenCB = hypot(CBx, CBy);
2780
2780
  let totalRadian = endRadian - startRadian;
2781
2781
  if (totalRadian < 0) totalRadian += PI2;
2782
- if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$4(totalRadian - PI$2) < 1e-12) {
2782
+ if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$5(totalRadian - PI$2) < 1e-12) {
2783
2783
  if (data) data.push(L$6, x1, y1);
2784
2784
  if (setPointBounds) {
2785
2785
  setPoint$1(setPointBounds, fromX, fromY);
2786
2786
  addPoint$1(setPointBounds, x1, y1);
2787
2787
  }
2788
- if (setStartPoint) set$1(setStartPoint, fromX, fromY);
2789
- if (setEndPoint) set$1(setEndPoint, x1, y1);
2788
+ if (setStartPoint) set$2(setStartPoint, fromX, fromY);
2789
+ if (setEndPoint) set$2(setEndPoint, x1, y1);
2790
2790
  return;
2791
2791
  }
2792
2792
  const anticlockwise = BAx * CBy - CBx * BAy < 0;
@@ -2812,7 +2812,7 @@ const BezierHelper = {
2812
2812
  let totalRadian = endRadian - startRadian;
2813
2813
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2814
2814
  if (anticlockwise) totalRadian -= PI2;
2815
- const parts = ceil(abs$4(totalRadian / PI_2));
2815
+ const parts = ceil(abs$5(totalRadian / PI_2));
2816
2816
  const partRadian = totalRadian / parts;
2817
2817
  const partRadian4Sin = sin$3(partRadian / 4);
2818
2818
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
@@ -2826,7 +2826,7 @@ const BezierHelper = {
2826
2826
  let fromX = cx + x, fromY = cy + y;
2827
2827
  if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
2828
2828
  if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
2829
- if (setStartPoint) set$1(setStartPoint, fromX, fromY);
2829
+ if (setStartPoint) set$2(setStartPoint, fromX, fromY);
2830
2830
  for (let i = 0; i < parts; i++) {
2831
2831
  endCos = cos$3(endRadian);
2832
2832
  endSin = sin$3(endRadian);
@@ -2845,7 +2845,7 @@ const BezierHelper = {
2845
2845
  startRadian = endRadian;
2846
2846
  endRadian += partRadian;
2847
2847
  }
2848
- if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
2848
+ if (setEndPoint) set$2(setEndPoint, cx + x, cy + y);
2849
2849
  },
2850
2850
  quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
2851
2851
  data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
@@ -2881,8 +2881,8 @@ const BezierHelper = {
2881
2881
  addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
2882
2882
  addPoint$1(pointBounds, toX, toY);
2883
2883
  for (let i = 0, len = tList.length; i < len; i++) {
2884
- getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
2885
- addPoint$1(pointBounds, tempPoint$2.x, tempPoint$2.y);
2884
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$3);
2885
+ addPoint$1(pointBounds, tempPoint$3.x, tempPoint$3.y);
2886
2886
  }
2887
2887
  },
2888
2888
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
@@ -3321,7 +3321,7 @@ const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$3, X: X$2, G: G$2, F
3321
3321
 
3322
3322
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3323
3323
 
3324
- const {tan: tan, min: min$1, abs: abs$3} = Math;
3324
+ const {tan: tan, min: min$1, abs: abs$4} = Math;
3325
3325
 
3326
3326
  const startPoint = {};
3327
3327
 
@@ -3381,7 +3381,7 @@ const PathCommandDataHelper = {
3381
3381
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3382
3382
  if (!isUndefined(lastX)) {
3383
3383
  const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3384
- radius = min$1(radius, min$1(r, r * abs$3(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3384
+ radius = min$1(radius, min$1(r, r * abs$4(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3385
3385
  }
3386
3386
  data.push(U$2, x1, y1, x2, y2, radius);
3387
3387
  },
@@ -4586,7 +4586,9 @@ function sortType(defaultValue) {
4586
4586
  set(value) {
4587
4587
  if (this.__setAttr(key, value)) {
4588
4588
  this.waitParent(() => {
4589
- this.parent.__layout.childrenSortChange();
4589
+ const {parent: parent} = this;
4590
+ parent.__layout.childrenSortChange();
4591
+ if (parent.__.flow) parent.__layout.boxChange();
4590
4592
  });
4591
4593
  }
4592
4594
  }
@@ -4988,7 +4990,7 @@ const LeafHelper = {
4988
4990
  p = p.parent;
4989
4991
  }
4990
4992
  },
4991
- animateMove(t, move, speed = .3) {
4993
+ animateMove(t, move, speed = .3, onAnimate) {
4992
4994
  if (!move.x && !move.y) return;
4993
4995
  if (Math.abs(move.x) < 1 && Math.abs(move.y) < 1) {
4994
4996
  t.move(move);
@@ -4996,8 +4998,9 @@ const LeafHelper = {
4996
4998
  const x = move.x * speed, y = move.y * speed;
4997
4999
  move.x -= x, move.y -= y;
4998
5000
  t.move(x, y);
4999
- Platform.requestRender(() => L.animateMove(t, move, speed));
5001
+ Platform.requestRender(() => L.animateMove(t, move, speed, onAnimate));
5000
5002
  }
5003
+ onAnimate && onAnimate();
5001
5004
  }
5002
5005
  };
5003
5006
 
@@ -6038,7 +6041,7 @@ const LeafDataProxy = {
6038
6041
 
6039
6042
  const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
6040
6043
 
6041
- const {toPoint: toPoint$3, tempPoint: tempPoint$1} = AroundHelper;
6044
+ const {toPoint: toPoint$3, tempPoint: tempPoint$2} = AroundHelper;
6042
6045
 
6043
6046
  const LeafMatrix = {
6044
6047
  __updateWorldMatrix() {
@@ -6059,8 +6062,8 @@ const LeafMatrix = {
6059
6062
  local.e = data.x + data.offsetX;
6060
6063
  local.f = data.y + data.offsetY;
6061
6064
  if (data.around || data.origin) {
6062
- toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
6063
- translateInner(local, -tempPoint$1.x, -tempPoint$1.y, !data.around);
6065
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$2);
6066
+ translateInner(local, -tempPoint$2.x, -tempPoint$2.y, !data.around);
6064
6067
  }
6065
6068
  }
6066
6069
  this.__layout.matrixChanged = undefined;
@@ -6169,6 +6172,7 @@ const LeafBounds = {
6169
6172
  if (this.isBranch) {
6170
6173
  this.__extraUpdate();
6171
6174
  if (this.__.flow) {
6175
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6172
6176
  if (this.__layout.boxChanged) this.__updateFlowLayout();
6173
6177
  updateAllMatrix$2(this);
6174
6178
  updateBounds$1(this, this);
@@ -6240,11 +6244,7 @@ const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize:
6240
6244
 
6241
6245
  const BranchRender = {
6242
6246
  __updateChange() {
6243
- const {__layout: layout} = this;
6244
- if (layout.childrenSortChanged) {
6245
- this.__updateSortChildren();
6246
- layout.childrenSortChanged = false;
6247
- }
6247
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
6248
6248
  this.__.__checkSingle();
6249
6249
  },
6250
6250
  __render(canvas, options) {
@@ -6748,6 +6748,7 @@ let Branch = class Branch extends Leaf {
6748
6748
  children.sort(sort);
6749
6749
  this.__layout.affectChildrenSort = affectSort;
6750
6750
  }
6751
+ this.__layout.childrenSortChanged = false;
6751
6752
  }
6752
6753
  add(child, index) {
6753
6754
  if (child === this || child.destroyed) return debug$6.warn("add self or destroyed");
@@ -6983,7 +6984,7 @@ class LeafLevelList {
6983
6984
  }
6984
6985
  }
6985
6986
 
6986
- const version = "2.1.6";
6987
+ const version = "2.1.8";
6987
6988
 
6988
6989
  const debug$5 = Debug.get("LeaferCanvas");
6989
6990
 
@@ -7834,7 +7835,7 @@ class Renderer {
7834
7835
 
7835
7836
  Renderer.clipSpread = 10;
7836
7837
 
7837
- const tempPoint = {};
7838
+ const tempPoint$1 = {};
7838
7839
 
7839
7840
  const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
7840
7841
 
@@ -7969,7 +7970,7 @@ class Picker {
7969
7970
  for (let i = len - 1; i > -1; i--) {
7970
7971
  child = children[i], data = child.__;
7971
7972
  if (!data.visible || hitMask && !data.mask) continue;
7972
- hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint, point, data.hitRadius) : point);
7973
+ hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$1, point, data.hitRadius) : point);
7973
7974
  if (child.isBranch) {
7974
7975
  if (hit || child.__ignoreHitWorld) {
7975
7976
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
@@ -8743,6 +8744,7 @@ let UI = UI_1 = class UI extends Leaf {
8743
8744
  this.set(keyframe);
8744
8745
  return Plugin.need("animate");
8745
8746
  }
8747
+ killAnimate(_type, _nextStyle) {}
8746
8748
  export(_filename, _options) {
8747
8749
  return Plugin.need("export");
8748
8750
  }
@@ -9502,32 +9504,56 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
9502
9504
 
9503
9505
  Frame = __decorate([ registerUI() ], Frame);
9504
9506
 
9505
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper;
9507
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint, set: set$1, rotate: rotate$2} = PointHelper, {abs: abs$3} = Math, tempCenter = {};
9506
9508
 
9507
9509
  let Ellipse = class Ellipse extends UI {
9508
9510
  get __tag() {
9509
9511
  return "Ellipse";
9510
9512
  }
9511
9513
  __updatePath() {
9512
- const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
9514
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle, closed: closed} = data;
9513
9515
  const rx = width / 2, ry = height / 2;
9514
9516
  const path = data.path = [];
9515
- let open;
9517
+ let open, hasAngle, closedAngle;
9518
+ if (startAngle || endAngle) hasAngle = true;
9519
+ if (hasAngle) closedAngle = abs$3(endAngle - startAngle) === 360;
9516
9520
  if (innerRadius) {
9517
- if (startAngle || endAngle) {
9518
- if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
9519
- ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
9521
+ const drawInnerEllipse = innerRadius < 1 || closed;
9522
+ let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9523
+ if (hasAngle) {
9524
+ if (drawInnerEllipse) {
9525
+ ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9526
+ if (closedAngle) {
9527
+ set$1(tempPoint, width, ry);
9528
+ set$1(tempCenter, rx, ry);
9529
+ rotate$2(tempPoint, endAngle, tempCenter, rx, ry);
9530
+ moveTo$3(path, tempPoint.x, tempPoint.y);
9531
+ }
9532
+ outerStartAngle = endAngle;
9533
+ outerEndAngle = startAngle;
9534
+ outerAnticlockwise = true;
9535
+ } else {
9536
+ if (!closedAngle) open = true;
9537
+ }
9520
9538
  } else {
9521
- if (innerRadius < 1) {
9539
+ if (drawInnerEllipse) {
9522
9540
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
9541
+ closePath$2(path);
9523
9542
  moveTo$3(path, width, ry);
9543
+ outerStartAngle = 360;
9544
+ outerAnticlockwise = true;
9545
+ } else {
9546
+ outerEndAngle = 360;
9524
9547
  }
9525
- ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
9526
9548
  }
9549
+ ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9527
9550
  } else {
9528
- if (startAngle || endAngle) {
9529
- moveTo$3(path, rx, ry);
9530
- ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
9551
+ if (hasAngle) {
9552
+ if (!closedAngle) {
9553
+ if (!closed) open = true;
9554
+ if (!open) moveTo$3(path, rx, ry);
9555
+ }
9556
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9531
9557
  } else {
9532
9558
  ellipse(path, rx, ry, rx, ry);
9533
9559
  }
@@ -10204,8 +10230,8 @@ const DragBoundsHelper = {
10204
10230
  if (!change) scale = Object.assign({}, scale);
10205
10231
  tempDragBounds.set(dragBounds);
10206
10232
  tempContent.set(content).scaleOf(origin, scale.x, scale.y);
10207
- const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
10208
- const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
10233
+ const originLeftScale = float((origin.x - content.x) / content.width), originRightScale = float(1 - originLeftScale);
10234
+ const originTopScale = float((origin.y - content.y) / content.height), originBottomScale = float(1 - originTopScale);
10209
10235
  let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
10210
10236
  if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
10211
10237
  if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
@@ -10216,7 +10242,13 @@ const DragBoundsHelper = {
10216
10242
  correctScaleX *= max$1(aScale, bScale);
10217
10243
  } else {
10218
10244
  if (scale.x < 0) {
10219
- if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10245
+ if (float(minX(content) - minX(dragBounds), 2) <= 0 || float(maxX(dragBounds) - maxX(content), 2) <= 0) {
10246
+ tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10247
+ if (tempContent.width > 1) {
10248
+ correctScaleX *= 1 / tempContent.width;
10249
+ tempContent.width = 1;
10250
+ }
10251
+ }
10220
10252
  tempContent.unsign();
10221
10253
  }
10222
10254
  aSize = float(tempDragBounds.minX - tempContent.minX);
@@ -10239,7 +10271,13 @@ const DragBoundsHelper = {
10239
10271
  }
10240
10272
  } else {
10241
10273
  if (scale.y < 0) {
10242
- if (float(minY(content) - minY(dragBounds)) <= 0 || float(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10274
+ if (float(minY(content) - minY(dragBounds), 2) <= 0 || float(maxY(dragBounds) - maxY(content), 2) <= 0) {
10275
+ tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10276
+ if (tempContent.height > 1) {
10277
+ correctScaleY *= 1 / tempContent.height;
10278
+ tempContent.height = 1;
10279
+ }
10280
+ }
10243
10281
  tempContent.unsign();
10244
10282
  }
10245
10283
  aSize = float(tempDragBounds.minY - tempContent.minY);
@@ -10370,6 +10408,8 @@ DragEvent$1.ENTER = "drag.enter";
10370
10408
 
10371
10409
  DragEvent$1.LEAVE = "drag.leave";
10372
10410
 
10411
+ DragEvent$1.ANIMATE = "drag.animate";
10412
+
10373
10413
  DragEvent$1 = __decorate([ registerUIEvent() ], DragEvent$1);
10374
10414
 
10375
10415
  const MyDragEvent = DragEvent$1;
@@ -10624,7 +10664,7 @@ class Dragger {
10624
10664
  x: totalX,
10625
10665
  y: totalY
10626
10666
  }, checkLimitMove || axisDrag);
10627
- if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
10667
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3, () => leaf.emit(DragEvent$1.ANIMATE)); else leaf.move(move);
10628
10668
  }
10629
10669
  });
10630
10670
  }
@@ -12243,6 +12283,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
12243
12283
  if (data.__autoSide) {
12244
12284
  ui.forceUpdate("width");
12245
12285
  LeafHelper.updateBounds(ui);
12286
+ ui.__layout.boundsChanged = true;
12246
12287
  if (ui.__proxyData) {
12247
12288
  ui.setProxyAttr("width", data.width);
12248
12289
  ui.setProxyAttr("height", data.height);
@@ -12250,7 +12291,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
12250
12291
  needUpdate = false;
12251
12292
  }
12252
12293
  }
12253
- if (paint.mode === "brush") PaintImage.brush(leafPaint, ui, attrName);
12294
+ if (paint.mode === "brush") PaintImage.brush(ui, attrName, leafPaint);
12254
12295
  if (!leafPaint.data) {
12255
12296
  PaintImage.createData(leafPaint, image, paint, boxBounds);
12256
12297
  const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
@@ -13522,4 +13563,4 @@ Object.assign(Creator, {
13522
13563
 
13523
13564
  useCanvas();
13524
13565
 
13525
- export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
13566
+ export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };