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.
package/dist/web.js CHANGED
@@ -268,7 +268,7 @@ var LeaferUI = function(exports) {
268
268
  return to;
269
269
  },
270
270
  setTemp(top, right, bottom, left) {
271
- return set$2(tempFour, top, right, bottom, left);
271
+ return set$3(tempFour, top, right, bottom, left);
272
272
  },
273
273
  toTempAB(a, b, change) {
274
274
  tempTo = change ? isNumber(a) ? b : a : [];
@@ -308,21 +308,21 @@ var LeaferUI = function(exports) {
308
308
  max(t, other, change) {
309
309
  if (isNumber(t) && isNumber(other)) return max$5(t, other);
310
310
  toTempAB(t, other, change);
311
- 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]));
311
+ 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]));
312
312
  },
313
313
  add(t, other, change) {
314
314
  if (isNumber(t) && isNumber(other)) return t + other;
315
315
  toTempAB(t, other, change);
316
- return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
316
+ return set$3(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
317
317
  },
318
318
  swapAndScale(t, scaleX, scaleY, change) {
319
319
  if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
320
320
  const to = change ? t : [];
321
321
  const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
322
- return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
322
+ return set$3(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
323
323
  }
324
324
  };
325
- const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
325
+ const {set: set$3, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
326
326
  const {round: round$3, pow: pow$1, max: max$4, floor: floor$2, PI: PI$3} = Math;
327
327
  const tempScaleData$1 = {};
328
328
  const MathHelper = {
@@ -434,7 +434,7 @@ var LeaferUI = function(exports) {
434
434
  }
435
435
  const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
436
436
  const {float: float$3} = MathHelper;
437
- const tempPoint$4 = {};
437
+ const tempPoint$5 = {};
438
438
  function getWorld() {
439
439
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
440
440
  scaleX: 1,
@@ -491,8 +491,8 @@ var LeaferUI = function(exports) {
491
491
  to.f = t.f * pixelRatio;
492
492
  },
493
493
  scaleOfOuter(t, origin, scaleX, scaleY) {
494
- M$6.toInnerPoint(t, origin, tempPoint$4);
495
- M$6.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
494
+ M$6.toInnerPoint(t, origin, tempPoint$5);
495
+ M$6.scaleOfInner(t, tempPoint$5, scaleX, scaleY);
496
496
  },
497
497
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
498
498
  M$6.translateInner(t, origin.x, origin.y);
@@ -510,8 +510,8 @@ var LeaferUI = function(exports) {
510
510
  t.d = c * sinR + d * cosR;
511
511
  },
512
512
  rotateOfOuter(t, origin, rotation) {
513
- M$6.toInnerPoint(t, origin, tempPoint$4);
514
- M$6.rotateOfInner(t, tempPoint$4, rotation);
513
+ M$6.toInnerPoint(t, origin, tempPoint$5);
514
+ M$6.rotateOfInner(t, tempPoint$5, rotation);
515
515
  },
516
516
  rotateOfInner(t, origin, rotation) {
517
517
  M$6.translateInner(t, origin.x, origin.y);
@@ -532,8 +532,8 @@ var LeaferUI = function(exports) {
532
532
  }
533
533
  },
534
534
  skewOfOuter(t, origin, skewX, skewY) {
535
- M$6.toInnerPoint(t, origin, tempPoint$4);
536
- M$6.skewOfInner(t, tempPoint$4, skewX, skewY);
535
+ M$6.toInnerPoint(t, origin, tempPoint$5);
536
+ M$6.skewOfInner(t, tempPoint$5, skewX, skewY);
537
537
  },
538
538
  skewOfInner(t, origin, skewX, skewY = 0) {
539
539
  M$6.translateInner(t, origin.x, origin.y);
@@ -730,7 +730,7 @@ var LeaferUI = function(exports) {
730
730
  const M$6 = MatrixHelper;
731
731
  const {float: float$2} = MathHelper;
732
732
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
733
- const {sin: sin$4, cos: cos$4, abs: abs$5, sqrt: sqrt$2, atan2: atan2$2, min: min$2, round: round$2} = Math;
733
+ const {sin: sin$4, cos: cos$4, abs: abs$6, sqrt: sqrt$2, atan2: atan2$2, min: min$2, round: round$2} = Math;
734
734
  const PointHelper = {
735
735
  defaultPoint: getPointData(),
736
736
  tempPoint: {},
@@ -766,15 +766,15 @@ var LeaferUI = function(exports) {
766
766
  t.x += (t.x - origin.x) * (scaleX - 1);
767
767
  t.y += (t.y - origin.y) * (scaleY - 1);
768
768
  },
769
- rotate(t, rotation, origin) {
769
+ rotate(t, rotation, origin, radiusX = 1, radiusY = 1) {
770
770
  if (!origin) origin = P$5.defaultPoint;
771
771
  rotation *= OneRadian;
772
772
  const cosR = cos$4(rotation);
773
773
  const sinR = sin$4(rotation);
774
- const rx = t.x - origin.x;
775
- const ry = t.y - origin.y;
776
- t.x = origin.x + rx * cosR - ry * sinR;
777
- t.y = origin.y + rx * sinR + ry * cosR;
774
+ const rx = (t.x - origin.x) / radiusX;
775
+ const ry = (t.y - origin.y) / radiusY;
776
+ t.x = origin.x + (rx * cosR - ry * sinR) * radiusX;
777
+ t.y = origin.y + (rx * sinR + ry * cosR) * radiusY;
778
778
  },
779
779
  tempToInnerOf(t, matrix) {
780
780
  const {tempPoint: temp} = P$5;
@@ -827,15 +827,15 @@ var LeaferUI = function(exports) {
827
827
  return getDistanceFrom(t.x, t.y, point.x, point.y);
828
828
  },
829
829
  getDistanceFrom(x1, y1, x2, y2) {
830
- const x = abs$5(x2 - x1);
831
- const y = abs$5(y2 - y1);
830
+ const x = abs$6(x2 - x1);
831
+ const y = abs$6(y2 - y1);
832
832
  return sqrt$2(x * x + y * y);
833
833
  },
834
834
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
835
835
  return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
836
836
  },
837
- getAngle(t, to) {
838
- return getAtan2(t, to) / OneRadian;
837
+ getAngle(t, to, radiusX, radiusY) {
838
+ return getAtan2(t, to, radiusX, radiusY) / OneRadian;
839
839
  },
840
840
  getRotation(t, origin, to, toOrigin) {
841
841
  if (!toOrigin) toOrigin = origin;
@@ -849,8 +849,8 @@ var LeaferUI = function(exports) {
849
849
  const d = toY - toOriginY;
850
850
  return Math.atan2(a * d - b * c, a * c + b * d);
851
851
  },
852
- getAtan2(t, to) {
853
- return atan2$2(to.y - t.y, to.x - t.x);
852
+ getAtan2(t, to, radiusX = 1, radiusY = 1) {
853
+ return atan2$2((to.y - t.y) / radiusY, (to.x - t.x) / radiusX);
854
854
  },
855
855
  getDistancePoint(t, to, distance, changeTo, fromTo) {
856
856
  const r = getAtan2(t, to);
@@ -904,12 +904,12 @@ var LeaferUI = function(exports) {
904
904
  PointHelper.scaleOf(this, origin, scaleX, scaleY);
905
905
  return this;
906
906
  }
907
- rotate(rotation, origin) {
908
- PointHelper.rotate(this, rotation, origin);
907
+ rotate(rotation, origin, radiusX, radiusY) {
908
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
909
909
  return this;
910
910
  }
911
- rotateOf(origin, rotation) {
912
- PointHelper.rotate(this, rotation, origin);
911
+ rotateOf(origin, rotation, radiusX, radiusY) {
912
+ PointHelper.rotate(this, rotation, origin, radiusX, radiusY);
913
913
  return this;
914
914
  }
915
915
  getRotation(origin, to, toOrigin) {
@@ -932,11 +932,11 @@ var LeaferUI = function(exports) {
932
932
  getDistancePoint(to, distance, changeTo, fromTo) {
933
933
  return new Point(PointHelper.getDistancePoint(this, to, distance, changeTo, fromTo));
934
934
  }
935
- getAngle(to) {
936
- return PointHelper.getAngle(this, to);
935
+ getAngle(to, radiusX, radiusY) {
936
+ return PointHelper.getAngle(this, to, radiusX, radiusY);
937
937
  }
938
- getAtan2(to) {
939
- return PointHelper.getAtan2(this, to);
938
+ getAtan2(to, radiusX, radiusY) {
939
+ return PointHelper.getAtan2(this, to, radiusX, radiusY);
940
940
  }
941
941
  isSame(point, quick) {
942
942
  return PointHelper.isSame(this, point, quick);
@@ -946,7 +946,7 @@ var LeaferUI = function(exports) {
946
946
  return this;
947
947
  }
948
948
  }
949
- const tempPoint$3 = new Point;
949
+ const tempPoint$4 = new Point;
950
950
  class Matrix {
951
951
  constructor(a, b, c, d, e, f) {
952
952
  this.set(a, b, c, d, e, f);
@@ -2520,11 +2520,11 @@ var LeaferUI = function(exports) {
2520
2520
  data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
2521
2521
  }
2522
2522
  };
2523
- 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;
2523
+ 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;
2524
2524
  const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
2525
- const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
2525
+ const {set: set$2, toNumberPoints: toNumberPoints} = PointHelper;
2526
2526
  const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
2527
- const tempPoint$2 = {};
2527
+ const tempPoint$3 = {};
2528
2528
  const BezierHelper = {
2529
2529
  points(data, originPoints, curve, close) {
2530
2530
  let points = toNumberPoints(originPoints);
@@ -2592,14 +2592,14 @@ var LeaferUI = function(exports) {
2592
2592
  const lenCB = hypot(CBx, CBy);
2593
2593
  let totalRadian = endRadian - startRadian;
2594
2594
  if (totalRadian < 0) totalRadian += PI2;
2595
- if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$4(totalRadian - PI$2) < 1e-12) {
2595
+ if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$5(totalRadian - PI$2) < 1e-12) {
2596
2596
  if (data) data.push(L$6, x1, y1);
2597
2597
  if (setPointBounds) {
2598
2598
  setPoint$1(setPointBounds, fromX, fromY);
2599
2599
  addPoint$1(setPointBounds, x1, y1);
2600
2600
  }
2601
- if (setStartPoint) set$1(setStartPoint, fromX, fromY);
2602
- if (setEndPoint) set$1(setEndPoint, x1, y1);
2601
+ if (setStartPoint) set$2(setStartPoint, fromX, fromY);
2602
+ if (setEndPoint) set$2(setEndPoint, x1, y1);
2603
2603
  return;
2604
2604
  }
2605
2605
  const anticlockwise = BAx * CBy - CBx * BAy < 0;
@@ -2625,7 +2625,7 @@ var LeaferUI = function(exports) {
2625
2625
  let totalRadian = endRadian - startRadian;
2626
2626
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2627
2627
  if (anticlockwise) totalRadian -= PI2;
2628
- const parts = ceil(abs$4(totalRadian / PI_2));
2628
+ const parts = ceil(abs$5(totalRadian / PI_2));
2629
2629
  const partRadian = totalRadian / parts;
2630
2630
  const partRadian4Sin = sin$3(partRadian / 4);
2631
2631
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
@@ -2639,7 +2639,7 @@ var LeaferUI = function(exports) {
2639
2639
  let fromX = cx + x, fromY = cy + y;
2640
2640
  if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
2641
2641
  if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
2642
- if (setStartPoint) set$1(setStartPoint, fromX, fromY);
2642
+ if (setStartPoint) set$2(setStartPoint, fromX, fromY);
2643
2643
  for (let i = 0; i < parts; i++) {
2644
2644
  endCos = cos$3(endRadian);
2645
2645
  endSin = sin$3(endRadian);
@@ -2658,7 +2658,7 @@ var LeaferUI = function(exports) {
2658
2658
  startRadian = endRadian;
2659
2659
  endRadian += partRadian;
2660
2660
  }
2661
- if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
2661
+ if (setEndPoint) set$2(setEndPoint, cx + x, cy + y);
2662
2662
  },
2663
2663
  quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
2664
2664
  data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
@@ -2694,8 +2694,8 @@ var LeaferUI = function(exports) {
2694
2694
  addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
2695
2695
  addPoint$1(pointBounds, toX, toY);
2696
2696
  for (let i = 0, len = tList.length; i < len; i++) {
2697
- getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
2698
- addPoint$1(pointBounds, tempPoint$2.x, tempPoint$2.y);
2697
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$3);
2698
+ addPoint$1(pointBounds, tempPoint$3.x, tempPoint$3.y);
2699
2699
  }
2700
2700
  },
2701
2701
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
@@ -3119,7 +3119,7 @@ var LeaferUI = function(exports) {
3119
3119
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
3120
3120
  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: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
3121
3121
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3122
- const {tan: tan, min: min$1, abs: abs$3} = Math;
3122
+ const {tan: tan, min: min$1, abs: abs$4} = Math;
3123
3123
  const startPoint = {};
3124
3124
  const PathCommandDataHelper = {
3125
3125
  beginPath(data) {
@@ -3177,7 +3177,7 @@ var LeaferUI = function(exports) {
3177
3177
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
3178
3178
  if (!isUndefined(lastX)) {
3179
3179
  const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
3180
- radius = min$1(radius, min$1(r, r * abs$3(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3180
+ radius = min$1(radius, min$1(r, r * abs$4(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3181
3181
  }
3182
3182
  data.push(U$2, x1, y1, x2, y2, radius);
3183
3183
  },
@@ -4310,7 +4310,9 @@ var LeaferUI = function(exports) {
4310
4310
  set(value) {
4311
4311
  if (this.__setAttr(key, value)) {
4312
4312
  this.waitParent(() => {
4313
- this.parent.__layout.childrenSortChange();
4313
+ const {parent: parent} = this;
4314
+ parent.__layout.childrenSortChange();
4315
+ if (parent.__.flow) parent.__layout.boxChange();
4314
4316
  });
4315
4317
  }
4316
4318
  }
@@ -4691,7 +4693,7 @@ var LeaferUI = function(exports) {
4691
4693
  p = p.parent;
4692
4694
  }
4693
4695
  },
4694
- animateMove(t, move, speed = .3) {
4696
+ animateMove(t, move, speed = .3, onAnimate) {
4695
4697
  if (!move.x && !move.y) return;
4696
4698
  if (Math.abs(move.x) < 1 && Math.abs(move.y) < 1) {
4697
4699
  t.move(move);
@@ -4699,8 +4701,9 @@ var LeaferUI = function(exports) {
4699
4701
  const x = move.x * speed, y = move.y * speed;
4700
4702
  move.x -= x, move.y -= y;
4701
4703
  t.move(x, y);
4702
- Platform.requestRender(() => L.animateMove(t, move, speed));
4704
+ Platform.requestRender(() => L.animateMove(t, move, speed, onAnimate));
4703
4705
  }
4706
+ onAnimate && onAnimate();
4704
4707
  }
4705
4708
  };
4706
4709
  const L = LeafHelper;
@@ -5649,7 +5652,7 @@ var LeaferUI = function(exports) {
5649
5652
  }
5650
5653
  };
5651
5654
  const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
5652
- const {toPoint: toPoint$3, tempPoint: tempPoint$1} = AroundHelper;
5655
+ const {toPoint: toPoint$3, tempPoint: tempPoint$2} = AroundHelper;
5653
5656
  const LeafMatrix = {
5654
5657
  __updateWorldMatrix() {
5655
5658
  const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
@@ -5669,8 +5672,8 @@ var LeaferUI = function(exports) {
5669
5672
  local.e = data.x + data.offsetX;
5670
5673
  local.f = data.y + data.offsetY;
5671
5674
  if (data.around || data.origin) {
5672
- toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
5673
- translateInner(local, -tempPoint$1.x, -tempPoint$1.y, !data.around);
5675
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$2);
5676
+ translateInner(local, -tempPoint$2.x, -tempPoint$2.y, !data.around);
5674
5677
  }
5675
5678
  }
5676
5679
  this.__layout.matrixChanged = undefined;
@@ -5774,6 +5777,7 @@ var LeaferUI = function(exports) {
5774
5777
  if (this.isBranch) {
5775
5778
  this.__extraUpdate();
5776
5779
  if (this.__.flow) {
5780
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
5777
5781
  if (this.__layout.boxChanged) this.__updateFlowLayout();
5778
5782
  updateAllMatrix$2(this);
5779
5783
  updateBounds$1(this, this);
@@ -5842,11 +5846,7 @@ var LeaferUI = function(exports) {
5842
5846
  const {excludeRenderBounds: excludeRenderBounds$1} = LeafBoundsHelper, {hasSize: hasSize} = BoundsHelper;
5843
5847
  const BranchRender = {
5844
5848
  __updateChange() {
5845
- const {__layout: layout} = this;
5846
- if (layout.childrenSortChanged) {
5847
- this.__updateSortChildren();
5848
- layout.childrenSortChanged = false;
5849
- }
5849
+ if (this.__layout.childrenSortChanged) this.__updateSortChildren();
5850
5850
  this.__.__checkSingle();
5851
5851
  },
5852
5852
  __render(canvas, options) {
@@ -6336,6 +6336,7 @@ var LeaferUI = function(exports) {
6336
6336
  children.sort(sort);
6337
6337
  this.__layout.affectChildrenSort = affectSort;
6338
6338
  }
6339
+ this.__layout.childrenSortChanged = false;
6339
6340
  }
6340
6341
  add(child, index) {
6341
6342
  if (child === this || child.destroyed) return debug$6.warn("add self or destroyed");
@@ -6567,7 +6568,7 @@ var LeaferUI = function(exports) {
6567
6568
  this.levelMap = null;
6568
6569
  }
6569
6570
  }
6570
- const version = "2.1.6";
6571
+ const version = "2.1.8";
6571
6572
  const debug$5 = Debug.get("LeaferCanvas");
6572
6573
  class LeaferCanvas extends LeaferCanvasBase {
6573
6574
  set zIndex(zIndex) {
@@ -7390,7 +7391,7 @@ var LeaferUI = function(exports) {
7390
7391
  }
7391
7392
  }
7392
7393
  Renderer.clipSpread = 10;
7393
- const tempPoint = {};
7394
+ const tempPoint$1 = {};
7394
7395
  const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
7395
7396
  const {hitRadiusPoint: hitRadiusPoint$1} = BoundsHelper;
7396
7397
  class Picker {
@@ -7522,7 +7523,7 @@ var LeaferUI = function(exports) {
7522
7523
  for (let i = len - 1; i > -1; i--) {
7523
7524
  child = children[i], data = child.__;
7524
7525
  if (!data.visible || hitMask && !data.mask) continue;
7525
- hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint, point, data.hitRadius) : point);
7526
+ hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$1, point, data.hitRadius) : point);
7526
7527
  if (child.isBranch) {
7527
7528
  if (hit || child.__ignoreHitWorld) {
7528
7529
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
@@ -8246,6 +8247,7 @@ var LeaferUI = function(exports) {
8246
8247
  this.set(keyframe);
8247
8248
  return Plugin.need("animate");
8248
8249
  }
8250
+ killAnimate(_type, _nextStyle) {}
8249
8251
  export(_filename, _options) {
8250
8252
  return Plugin.need("export");
8251
8253
  }
@@ -8893,31 +8895,55 @@ var LeaferUI = function(exports) {
8893
8895
  __decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
8894
8896
  __decorate([ affectRenderBoundsType("hide") ], exports.Frame.prototype, "overflow", void 0);
8895
8897
  exports.Frame = __decorate([ registerUI() ], exports.Frame);
8896
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper;
8898
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint, set: set$1, rotate: rotate$2} = PointHelper, {abs: abs$3} = Math, tempCenter = {};
8897
8899
  exports.Ellipse = class Ellipse extends exports.UI {
8898
8900
  get __tag() {
8899
8901
  return "Ellipse";
8900
8902
  }
8901
8903
  __updatePath() {
8902
- const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
8904
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle, closed: closed} = data;
8903
8905
  const rx = width / 2, ry = height / 2;
8904
8906
  const path = data.path = [];
8905
- let open;
8907
+ let open, hasAngle, closedAngle;
8908
+ if (startAngle || endAngle) hasAngle = true;
8909
+ if (hasAngle) closedAngle = abs$3(endAngle - startAngle) === 360;
8906
8910
  if (innerRadius) {
8907
- if (startAngle || endAngle) {
8908
- if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
8909
- ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
8911
+ const drawInnerEllipse = innerRadius < 1 || closed;
8912
+ let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
8913
+ if (hasAngle) {
8914
+ if (drawInnerEllipse) {
8915
+ ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
8916
+ if (closedAngle) {
8917
+ set$1(tempPoint, width, ry);
8918
+ set$1(tempCenter, rx, ry);
8919
+ rotate$2(tempPoint, endAngle, tempCenter, rx, ry);
8920
+ moveTo$3(path, tempPoint.x, tempPoint.y);
8921
+ }
8922
+ outerStartAngle = endAngle;
8923
+ outerEndAngle = startAngle;
8924
+ outerAnticlockwise = true;
8925
+ } else {
8926
+ if (!closedAngle) open = true;
8927
+ }
8910
8928
  } else {
8911
- if (innerRadius < 1) {
8929
+ if (drawInnerEllipse) {
8912
8930
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
8931
+ closePath$2(path);
8913
8932
  moveTo$3(path, width, ry);
8933
+ outerStartAngle = 360;
8934
+ outerAnticlockwise = true;
8935
+ } else {
8936
+ outerEndAngle = 360;
8914
8937
  }
8915
- ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
8916
8938
  }
8939
+ ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
8917
8940
  } else {
8918
- if (startAngle || endAngle) {
8919
- moveTo$3(path, rx, ry);
8920
- ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
8941
+ if (hasAngle) {
8942
+ if (!closedAngle) {
8943
+ if (!closed) open = true;
8944
+ if (!open) moveTo$3(path, rx, ry);
8945
+ }
8946
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
8921
8947
  } else {
8922
8948
  ellipse(path, rx, ry, rx, ry);
8923
8949
  }
@@ -9500,8 +9526,8 @@ var LeaferUI = function(exports) {
9500
9526
  if (!change) scale = Object.assign({}, scale);
9501
9527
  tempDragBounds.set(dragBounds);
9502
9528
  tempContent.set(content).scaleOf(origin, scale.x, scale.y);
9503
- const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
9504
- const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
9529
+ const originLeftScale = float((origin.x - content.x) / content.width), originRightScale = float(1 - originLeftScale);
9530
+ const originTopScale = float((origin.y - content.y) / content.height), originBottomScale = float(1 - originTopScale);
9505
9531
  let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
9506
9532
  if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
9507
9533
  if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
@@ -9512,7 +9538,13 @@ var LeaferUI = function(exports) {
9512
9538
  correctScaleX *= max$1(aScale, bScale);
9513
9539
  } else {
9514
9540
  if (scale.x < 0) {
9515
- if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9541
+ if (float(minX(content) - minX(dragBounds), 2) <= 0 || float(maxX(dragBounds) - maxX(content), 2) <= 0) {
9542
+ tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9543
+ if (tempContent.width > 1) {
9544
+ correctScaleX *= 1 / tempContent.width;
9545
+ tempContent.width = 1;
9546
+ }
9547
+ }
9516
9548
  tempContent.unsign();
9517
9549
  }
9518
9550
  aSize = float(tempDragBounds.minX - tempContent.minX);
@@ -9535,7 +9567,13 @@ var LeaferUI = function(exports) {
9535
9567
  }
9536
9568
  } else {
9537
9569
  if (scale.y < 0) {
9538
- if (float(minY(content) - minY(dragBounds)) <= 0 || float(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9570
+ if (float(minY(content) - minY(dragBounds), 2) <= 0 || float(maxY(dragBounds) - maxY(content), 2) <= 0) {
9571
+ tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9572
+ if (tempContent.height > 1) {
9573
+ correctScaleY *= 1 / tempContent.height;
9574
+ tempContent.height = 1;
9575
+ }
9576
+ }
9539
9577
  tempContent.unsign();
9540
9578
  }
9541
9579
  aSize = float(tempDragBounds.minY - tempContent.minY);
@@ -9632,6 +9670,7 @@ var LeaferUI = function(exports) {
9632
9670
  exports.DragEvent.OUT = "drag.out";
9633
9671
  exports.DragEvent.ENTER = "drag.enter";
9634
9672
  exports.DragEvent.LEAVE = "drag.leave";
9673
+ exports.DragEvent.ANIMATE = "drag.animate";
9635
9674
  exports.DragEvent = __decorate([ registerUIEvent() ], exports.DragEvent);
9636
9675
  const MyDragEvent = exports.DragEvent;
9637
9676
  exports.DropEvent = class DropEvent extends exports.PointerEvent {
@@ -9839,7 +9878,7 @@ var LeaferUI = function(exports) {
9839
9878
  x: totalX,
9840
9879
  y: totalY
9841
9880
  }, checkLimitMove || axisDrag);
9842
- if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else leaf.move(move);
9881
+ if (dragLimitAnimate && !axisDrag && isDragEnd) LeafHelper.animateMove(leaf, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3, () => leaf.emit(exports.DragEvent.ANIMATE)); else leaf.move(move);
9843
9882
  }
9844
9883
  });
9845
9884
  }
@@ -11392,6 +11431,7 @@ var LeaferUI = function(exports) {
11392
11431
  if (data.__autoSide) {
11393
11432
  ui.forceUpdate("width");
11394
11433
  LeafHelper.updateBounds(ui);
11434
+ ui.__layout.boundsChanged = true;
11395
11435
  if (ui.__proxyData) {
11396
11436
  ui.setProxyAttr("width", data.width);
11397
11437
  ui.setProxyAttr("height", data.height);
@@ -11399,7 +11439,7 @@ var LeaferUI = function(exports) {
11399
11439
  needUpdate = false;
11400
11440
  }
11401
11441
  }
11402
- if (paint.mode === "brush") PaintImage.brush(leafPaint, ui, attrName);
11442
+ if (paint.mode === "brush") PaintImage.brush(ui, attrName, leafPaint);
11403
11443
  if (!leafPaint.data) {
11404
11444
  PaintImage.createData(leafPaint, image, paint, boxBounds);
11405
11445
  const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
@@ -12727,7 +12767,7 @@ var LeaferUI = function(exports) {
12727
12767
  exports.surfaceType = surfaceType;
12728
12768
  exports.tempBounds = tempBounds$2;
12729
12769
  exports.tempMatrix = tempMatrix$2;
12730
- exports.tempPoint = tempPoint$3;
12770
+ exports.tempPoint = tempPoint$4;
12731
12771
  exports.tryToNumber = tryToNumber;
12732
12772
  exports.useCanvas = useCanvas;
12733
12773
  exports.useModule = useModule;