@leafer/miniapp 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.
@@ -253,7 +253,7 @@ const FourNumberHelper = {
253
253
  return to;
254
254
  },
255
255
  setTemp(top, right, bottom, left) {
256
- return set$2(tempFour, top, right, bottom, left);
256
+ return set$3(tempFour, top, right, bottom, left);
257
257
  },
258
258
  toTempAB(a, b, change) {
259
259
  tempTo = change ? isNumber(a) ? b : a : [];
@@ -293,22 +293,22 @@ const FourNumberHelper = {
293
293
  max(t, other, change) {
294
294
  if (isNumber(t) && isNumber(other)) return max$7(t, other);
295
295
  toTempAB(t, other, change);
296
- return set$2(tempTo, max$7(tempA[0], tempB[0]), max$7(tempA[1], tempB[1]), max$7(tempA[2], tempB[2]), max$7(tempA[3], tempB[3]));
296
+ return set$3(tempTo, max$7(tempA[0], tempB[0]), max$7(tempA[1], tempB[1]), max$7(tempA[2], tempB[2]), max$7(tempA[3], tempB[3]));
297
297
  },
298
298
  add(t, other, change) {
299
299
  if (isNumber(t) && isNumber(other)) return t + other;
300
300
  toTempAB(t, other, change);
301
- return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
301
+ return set$3(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
302
302
  },
303
303
  swapAndScale(t, scaleX, scaleY, change) {
304
304
  if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
305
305
  const to = change ? t : [];
306
306
  const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
307
- return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
307
+ return set$3(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
308
308
  }
309
309
  };
310
310
 
311
- const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
311
+ const {set: set$3, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
312
312
 
313
313
  const {round: round$6, pow: pow$2, max: max$6, floor: floor$3, PI: PI$4} = Math;
314
314
 
@@ -433,7 +433,7 @@ const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
433
433
 
434
434
  const {float: float$6} = MathHelper;
435
435
 
436
- const tempPoint$6 = {};
436
+ const tempPoint$7 = {};
437
437
 
438
438
  function getWorld() {
439
439
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
@@ -492,8 +492,8 @@ const MatrixHelper = {
492
492
  to.f = t.f * pixelRatio;
493
493
  },
494
494
  scaleOfOuter(t, origin, scaleX, scaleY) {
495
- M$c.toInnerPoint(t, origin, tempPoint$6);
496
- M$c.scaleOfInner(t, tempPoint$6, scaleX, scaleY);
495
+ M$c.toInnerPoint(t, origin, tempPoint$7);
496
+ M$c.scaleOfInner(t, tempPoint$7, scaleX, scaleY);
497
497
  },
498
498
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
499
499
  M$c.translateInner(t, origin.x, origin.y);
@@ -511,8 +511,8 @@ const MatrixHelper = {
511
511
  t.d = c * sinR + d * cosR;
512
512
  },
513
513
  rotateOfOuter(t, origin, rotation) {
514
- M$c.toInnerPoint(t, origin, tempPoint$6);
515
- M$c.rotateOfInner(t, tempPoint$6, rotation);
514
+ M$c.toInnerPoint(t, origin, tempPoint$7);
515
+ M$c.rotateOfInner(t, tempPoint$7, rotation);
516
516
  },
517
517
  rotateOfInner(t, origin, rotation) {
518
518
  M$c.translateInner(t, origin.x, origin.y);
@@ -533,8 +533,8 @@ const MatrixHelper = {
533
533
  }
534
534
  },
535
535
  skewOfOuter(t, origin, skewX, skewY) {
536
- M$c.toInnerPoint(t, origin, tempPoint$6);
537
- M$c.skewOfInner(t, tempPoint$6, skewX, skewY);
536
+ M$c.toInnerPoint(t, origin, tempPoint$7);
537
+ M$c.skewOfInner(t, tempPoint$7, skewX, skewY);
538
538
  },
539
539
  skewOfInner(t, origin, skewX, skewY = 0) {
540
540
  M$c.translateInner(t, origin.x, origin.y);
@@ -735,7 +735,7 @@ const {float: float$5} = MathHelper;
735
735
 
736
736
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$4} = MatrixHelper;
737
737
 
738
- const {sin: sin$5, cos: cos$5, abs: abs$b, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
738
+ const {sin: sin$5, cos: cos$5, abs: abs$c, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
739
739
 
740
740
  const PointHelper = {
741
741
  defaultPoint: getPointData(),
@@ -772,15 +772,15 @@ const PointHelper = {
772
772
  t.x += (t.x - origin.x) * (scaleX - 1);
773
773
  t.y += (t.y - origin.y) * (scaleY - 1);
774
774
  },
775
- rotate(t, rotation, origin) {
775
+ rotate(t, rotation, origin, radiusX = 1, radiusY = 1) {
776
776
  if (!origin) origin = P$7.defaultPoint;
777
777
  rotation *= OneRadian;
778
778
  const cosR = cos$5(rotation);
779
779
  const sinR = sin$5(rotation);
780
- const rx = t.x - origin.x;
781
- const ry = t.y - origin.y;
782
- t.x = origin.x + rx * cosR - ry * sinR;
783
- t.y = origin.y + rx * sinR + ry * cosR;
780
+ const rx = (t.x - origin.x) / radiusX;
781
+ const ry = (t.y - origin.y) / radiusY;
782
+ t.x = origin.x + (rx * cosR - ry * sinR) * radiusX;
783
+ t.y = origin.y + (rx * sinR + ry * cosR) * radiusY;
784
784
  },
785
785
  tempToInnerOf(t, matrix) {
786
786
  const {tempPoint: temp} = P$7;
@@ -833,15 +833,15 @@ const PointHelper = {
833
833
  return getDistanceFrom(t.x, t.y, point.x, point.y);
834
834
  },
835
835
  getDistanceFrom(x1, y1, x2, y2) {
836
- const x = abs$b(x2 - x1);
837
- const y = abs$b(y2 - y1);
836
+ const x = abs$c(x2 - x1);
837
+ const y = abs$c(y2 - y1);
838
838
  return sqrt$4(x * x + y * y);
839
839
  },
840
840
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
841
841
  return min$3(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
842
842
  },
843
- getAngle(t, to) {
844
- return getAtan2(t, to) / OneRadian;
843
+ getAngle(t, to, radiusX, radiusY) {
844
+ return getAtan2(t, to, radiusX, radiusY) / OneRadian;
845
845
  },
846
846
  getRotation(t, origin, to, toOrigin) {
847
847
  if (!toOrigin) toOrigin = origin;
@@ -855,8 +855,8 @@ const PointHelper = {
855
855
  const d = toY - toOriginY;
856
856
  return Math.atan2(a * d - b * c, a * c + b * d);
857
857
  },
858
- getAtan2(t, to) {
859
- return atan2$2(to.y - t.y, to.x - t.x);
858
+ getAtan2(t, to, radiusX = 1, radiusY = 1) {
859
+ return atan2$2((to.y - t.y) / radiusY, (to.x - t.x) / radiusX);
860
860
  },
861
861
  getDistancePoint(t, to, distance, changeTo, fromTo) {
862
862
  const r = getAtan2(t, to);
@@ -913,12 +913,12 @@ class Point {
913
913
  PointHelper.scaleOf(this, origin, scaleX, scaleY);
914
914
  return this;
915
915
  }
916
- rotate(rotation, origin) {
917
- PointHelper.rotate(this, rotation, origin);
916
+ rotate(rotation, origin, radiusX, radiusY) {
917
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
918
918
  return this;
919
919
  }
920
- rotateOf(origin, rotation) {
921
- PointHelper.rotate(this, rotation, origin);
920
+ rotateOf(origin, rotation, radiusX, radiusY) {
921
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
922
922
  return this;
923
923
  }
924
924
  getRotation(origin, to, toOrigin) {
@@ -941,11 +941,11 @@ class Point {
941
941
  getDistancePoint(to, distance, changeTo, fromTo) {
942
942
  return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
943
943
  }
944
- getAngle(to) {
945
- return PointHelper.getAngle(this, to);
944
+ getAngle(to, radiusX, radiusY) {
945
+ return PointHelper.getAngle(this, to, radiusX, radiusY);
946
946
  }
947
- getAtan2(to) {
948
- return PointHelper.getAtan2(this, to);
947
+ getAtan2(to, radiusX, radiusY) {
948
+ return PointHelper.getAtan2(this, to, radiusX, radiusY);
949
949
  }
950
950
  isSame(point, quick) {
951
951
  return PointHelper.isSame(this, point, quick);
@@ -956,7 +956,7 @@ class Point {
956
956
  }
957
957
  }
958
958
 
959
- const tempPoint$5 = new Point;
959
+ const tempPoint$6 = new Point;
960
960
 
961
961
  class Matrix {
962
962
  constructor(a, b, c, d, e, f) {
@@ -2702,15 +2702,15 @@ const RectHelper = {
2702
2702
  }
2703
2703
  };
2704
2704
 
2705
- const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$a, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2705
+ const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$b, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2706
2706
 
2707
2707
  const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
2708
2708
 
2709
- const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
2709
+ const {set: set$2, toNumberPoints: toNumberPoints$1} = PointHelper;
2710
2710
 
2711
2711
  const {M: M$b, L: L$b, C: C$9, Q: Q$7, Z: Z$9} = PathCommandMap;
2712
2712
 
2713
- const tempPoint$4 = {};
2713
+ const tempPoint$5 = {};
2714
2714
 
2715
2715
  const BezierHelper = {
2716
2716
  points(data, originPoints, curve, close) {
@@ -2779,14 +2779,14 @@ const BezierHelper = {
2779
2779
  const lenCB = hypot$1(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$a(totalRadian - PI$3) < 1e-12) {
2782
+ if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$b(totalRadian - PI$3) < 1e-12) {
2783
2783
  if (data) data.push(L$b, x1, y1);
2784
2784
  if (setPointBounds) {
2785
2785
  setPoint$4(setPointBounds, fromX, fromY);
2786
2786
  addPoint$2(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$1(abs$a(totalRadian / PI_2));
2815
+ const parts = ceil$1(abs$b(totalRadian / PI_2));
2816
2816
  const partRadian = totalRadian / parts;
2817
2817
  const partRadian4Sin = sin$4(partRadian / 4);
2818
2818
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(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$b : M$b, fromX, fromY);
2828
2828
  if (setPointBounds) setPoint$4(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$4(endRadian);
2832
2832
  endSin = sin$4(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$9, (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$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
2882
2882
  addPoint$2(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$4);
2885
- addPoint$2(pointBounds, tempPoint$4.x, tempPoint$4.y);
2884
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$5);
2885
+ addPoint$2(pointBounds, tempPoint$5.x, tempPoint$5.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$9, L: L$9, C: C$7, Q: Q$5, Z: Z$7, N: N$4, D: D$5, X: X$4, G: G$4, F
3321
3321
 
3322
3322
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3323
3323
 
3324
- const {tan: tan, min: min$2, abs: abs$9} = Math;
3324
+ const {tan: tan, min: min$2, abs: abs$a} = 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$2(radius, min$2(r, r * abs$9(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3384
+ radius = min$2(radius, min$2(r, r * abs$a(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3385
3385
  }
3386
3386
  data.push(U$4, 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$5.animateMove(t, move, speed));
5001
+ Platform.requestRender(() => L$5.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$4, tempPoint: tempPoint$3} = AroundHelper;
6044
+ const {toPoint: toPoint$4, tempPoint: tempPoint$4} = 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$4(data.around || data.origin, layout.boxBounds, tempPoint$3);
6063
- translateInner(local, -tempPoint$3.x, -tempPoint$3.y, !data.around);
6065
+ toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$4);
6066
+ translateInner(local, -tempPoint$4.x, -tempPoint$4.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$3(this);
6174
6178
  updateBounds$2(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$8.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
  class LeaferCanvas extends LeaferCanvasBase {
6989
6990
  get allowBackgroundColor() {
@@ -7799,7 +7800,7 @@ class Renderer {
7799
7800
 
7800
7801
  Renderer.clipSpread = 10;
7801
7802
 
7802
- const tempPoint$2 = {};
7803
+ const tempPoint$3 = {};
7803
7804
 
7804
7805
  const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
7805
7806
 
@@ -7934,7 +7935,7 @@ class Picker {
7934
7935
  for (let i = len - 1; i > -1; i--) {
7935
7936
  child = children[i], data = child.__;
7936
7937
  if (!data.visible || hitMask && !data.mask) continue;
7937
- hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$2, point, data.hitRadius) : point);
7938
+ hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$3, point, data.hitRadius) : point);
7938
7939
  if (child.isBranch) {
7939
7940
  if (hit || child.__ignoreHitWorld) {
7940
7941
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
@@ -8708,6 +8709,7 @@ let UI = UI_1 = class UI extends Leaf {
8708
8709
  this.set(keyframe);
8709
8710
  return Plugin.need("animate");
8710
8711
  }
8712
+ killAnimate(_type, _nextStyle) {}
8711
8713
  export(_filename, _options) {
8712
8714
  return Plugin.need("export");
8713
8715
  }
@@ -9467,32 +9469,56 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
9467
9469
 
9468
9470
  Frame = __decorate([ registerUI() ], Frame);
9469
9471
 
9470
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse$1} = PathCommandDataHelper;
9472
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse$1} = PathCommandDataHelper, {tempPoint: tempPoint$2, set: set$1, rotate: rotate$4} = PointHelper, {abs: abs$9} = Math, tempCenter = {};
9471
9473
 
9472
9474
  let Ellipse = class Ellipse extends UI {
9473
9475
  get __tag() {
9474
9476
  return "Ellipse";
9475
9477
  }
9476
9478
  __updatePath() {
9477
- const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
9479
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle, closed: closed} = data;
9478
9480
  const rx = width / 2, ry = height / 2;
9479
9481
  const path = data.path = [];
9480
- let open;
9482
+ let open, hasAngle, closedAngle;
9483
+ if (startAngle || endAngle) hasAngle = true;
9484
+ if (hasAngle) closedAngle = abs$9(endAngle - startAngle) === 360;
9481
9485
  if (innerRadius) {
9482
- if (startAngle || endAngle) {
9483
- if (innerRadius < 1) ellipse$1(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
9484
- ellipse$1(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
9486
+ const drawInnerEllipse = innerRadius < 1 || closed;
9487
+ let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9488
+ if (hasAngle) {
9489
+ if (drawInnerEllipse) {
9490
+ ellipse$1(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9491
+ if (closedAngle) {
9492
+ set$1(tempPoint$2, width, ry);
9493
+ set$1(tempCenter, rx, ry);
9494
+ rotate$4(tempPoint$2, endAngle, tempCenter, rx, ry);
9495
+ moveTo$3(path, tempPoint$2.x, tempPoint$2.y);
9496
+ }
9497
+ outerStartAngle = endAngle;
9498
+ outerEndAngle = startAngle;
9499
+ outerAnticlockwise = true;
9500
+ } else {
9501
+ if (!closedAngle) open = true;
9502
+ }
9485
9503
  } else {
9486
- if (innerRadius < 1) {
9504
+ if (drawInnerEllipse) {
9487
9505
  ellipse$1(path, rx, ry, rx * innerRadius, ry * innerRadius);
9506
+ closePath$2(path);
9488
9507
  moveTo$3(path, width, ry);
9508
+ outerStartAngle = 360;
9509
+ outerAnticlockwise = true;
9510
+ } else {
9511
+ outerEndAngle = 360;
9489
9512
  }
9490
- ellipse$1(path, rx, ry, rx, ry, 0, 360, 0, true);
9491
9513
  }
9514
+ ellipse$1(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9492
9515
  } else {
9493
- if (startAngle || endAngle) {
9494
- moveTo$3(path, rx, ry);
9495
- ellipse$1(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
9516
+ if (hasAngle) {
9517
+ if (!closedAngle) {
9518
+ if (!closed) open = true;
9519
+ if (!open) moveTo$3(path, rx, ry);
9520
+ }
9521
+ ellipse$1(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9496
9522
  } else {
9497
9523
  ellipse$1(path, rx, ry, rx, ry);
9498
9524
  }
@@ -10169,8 +10195,8 @@ const DragBoundsHelper = {
10169
10195
  if (!change) scale = Object.assign({}, scale);
10170
10196
  tempDragBounds.set(dragBounds);
10171
10197
  tempContent.set(content).scaleOf(origin, scale.x, scale.y);
10172
- const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
10173
- const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
10198
+ const originLeftScale = float$3((origin.x - content.x) / content.width), originRightScale = float$3(1 - originLeftScale);
10199
+ const originTopScale = float$3((origin.y - content.y) / content.height), originBottomScale = float$3(1 - originTopScale);
10174
10200
  let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
10175
10201
  if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
10176
10202
  if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
@@ -10181,7 +10207,13 @@ const DragBoundsHelper = {
10181
10207
  correctScaleX *= max$3(aScale, bScale);
10182
10208
  } else {
10183
10209
  if (scale.x < 0) {
10184
- if (float$3(minX(content) - minX(dragBounds)) <= 0 || float$3(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10210
+ if (float$3(minX(content) - minX(dragBounds), 2) <= 0 || float$3(maxX(dragBounds) - maxX(content), 2) <= 0) {
10211
+ tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
10212
+ if (tempContent.width > 1) {
10213
+ correctScaleX *= 1 / tempContent.width;
10214
+ tempContent.width = 1;
10215
+ }
10216
+ }
10185
10217
  tempContent.unsign();
10186
10218
  }
10187
10219
  aSize = float$3(tempDragBounds.minX - tempContent.minX);
@@ -10204,7 +10236,13 @@ const DragBoundsHelper = {
10204
10236
  }
10205
10237
  } else {
10206
10238
  if (scale.y < 0) {
10207
- if (float$3(minY(content) - minY(dragBounds)) <= 0 || float$3(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10239
+ if (float$3(minY(content) - minY(dragBounds), 2) <= 0 || float$3(maxY(dragBounds) - maxY(content), 2) <= 0) {
10240
+ tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
10241
+ if (tempContent.height > 1) {
10242
+ correctScaleY *= 1 / tempContent.height;
10243
+ tempContent.height = 1;
10244
+ }
10245
+ }
10208
10246
  tempContent.unsign();
10209
10247
  }
10210
10248
  aSize = float$3(tempDragBounds.minY - tempContent.minY);
@@ -10335,6 +10373,8 @@ DragEvent.ENTER = "drag.enter";
10335
10373
 
10336
10374
  DragEvent.LEAVE = "drag.leave";
10337
10375
 
10376
+ DragEvent.ANIMATE = "drag.animate";
10377
+
10338
10378
  DragEvent = __decorate([ registerUIEvent() ], DragEvent);
10339
10379
 
10340
10380
  const MyDragEvent = DragEvent;
@@ -10589,7 +10629,7 @@ class Dragger {
10589
10629
  x: totalX,
10590
10630
  y: totalY
10591
10631
  }, checkLimitMove || axisDrag);
10592
- if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
10632
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3, () => leaf.emit(DragEvent.ANIMATE)); else leaf.move(move);
10593
10633
  }
10594
10634
  });
10595
10635
  }
@@ -11987,6 +12027,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
11987
12027
  if (data.__autoSide) {
11988
12028
  ui.forceUpdate("width");
11989
12029
  LeafHelper.updateBounds(ui);
12030
+ ui.__layout.boundsChanged = true;
11990
12031
  if (ui.__proxyData) {
11991
12032
  ui.setProxyAttr("width", data.width);
11992
12033
  ui.setProxyAttr("height", data.height);
@@ -11994,7 +12035,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
11994
12035
  needUpdate = false;
11995
12036
  }
11996
12037
  }
11997
- if (paint.mode === "brush") PaintImage.brush(leafPaint, ui, attrName);
12038
+ if (paint.mode === "brush") PaintImage.brush(ui, attrName, leafPaint);
11998
12039
  if (!leafPaint.data) {
11999
12040
  PaintImage.createData(leafPaint, image, paint, boxBounds);
12000
12041
  const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
@@ -14810,10 +14851,11 @@ const registerInnerEditor = registerEditTool;
14810
14851
 
14811
14852
  const EditToolCreator = {
14812
14853
  list: {},
14813
- register(EditTool) {
14854
+ register(EditTool, name) {
14814
14855
  const {tag: tag} = EditTool.prototype;
14815
- list$1[tag] && debug$2.repeat(tag);
14816
- list$1[tag] = EditTool;
14856
+ name || (name = tag);
14857
+ list$1[name] && debug$2.repeat(name);
14858
+ list$1[name] = EditTool;
14817
14859
  },
14818
14860
  get(tag, editor) {
14819
14861
  return new list$1[tag](editor);
@@ -15628,8 +15670,8 @@ class InnerEditor {
15628
15670
  }
15629
15671
 
15630
15672
  let EditTool = class EditTool extends InnerEditor {
15631
- static registerEditTool() {
15632
- EditToolCreator.register(this);
15673
+ static registerEditTool(name) {
15674
+ EditToolCreator.register(this, name);
15633
15675
  }
15634
15676
  get tag() {
15635
15677
  return "EditTool";
@@ -15995,14 +16037,14 @@ leaf.__scaleResize = function(scaleX, scaleY) {
15995
16037
  scaleResize(this, scaleX, scaleY);
15996
16038
  };
15997
16039
 
15998
- leaf.resizeWidth = function(width) {
15999
- const scale = width / this.getBounds("box", "local").width || 1;
16000
- this.scaleOf(this.__layout.boxBounds, scale, this.__.lockRatio ? scale : 1, true);
16040
+ leaf.resizeWidth = function(width, relative = "inner") {
16041
+ const scale = width / this.getBounds("box", relative).width || 1;
16042
+ this.scaleOf("top-left", scale, this.__.lockRatio ? scale : 1, true);
16001
16043
  };
16002
16044
 
16003
- leaf.resizeHeight = function(height) {
16004
- const scale = height / this.getBounds("box", "local").height || 1;
16005
- this.scaleOf(this.__layout.boxBounds, this.__.lockRatio ? scale : 1, scale, true);
16045
+ leaf.resizeHeight = function(height, relative = "inner") {
16046
+ const scale = height / this.getBounds("box", relative).height || 1;
16047
+ this.scaleOf("top-left", this.__.lockRatio ? scale : 1, scale, true);
16006
16048
  };
16007
16049
 
16008
16050
  Text.prototype.__scaleResize = function(scaleX, scaleY) {
@@ -16067,7 +16109,7 @@ UI.addAttr("editConfig", undefined, dataType);
16067
16109
 
16068
16110
  UI.addAttr("editOuter", ui => {
16069
16111
  ui.updateLayout();
16070
- const name = (ui.tag === "Line" ? "" : ui.tag) + "EditTool";
16112
+ const name = (ui.tag === "Line" || ui.pathInputed ? "" : ui.points ? "Points" : ui.tag) + "EditTool";
16071
16113
  return ui.__.__isLinePath ? "LineEditTool" : EditToolCreator.list[name] ? name : "EditTool";
16072
16114
  }, dataType);
16073
16115
 
@@ -21023,4 +21065,4 @@ function isSame(a, b) {
21023
21065
 
21024
21066
  Plugin.add("corner");
21025
21067
 
21026
- export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$5 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
21068
+ export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$6 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };