@leafer/worker 1.12.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/worker.js CHANGED
@@ -199,7 +199,7 @@ var LeaferUI = function(exports) {
199
199
  this.__input = this.__middle = null;
200
200
  }
201
201
  }
202
- const {floor: floor$3, max: max$6} = Math;
202
+ const {floor: floor$3, max: max$7} = Math;
203
203
  const Platform = {
204
204
  toURL(text, fileType) {
205
205
  let url = encodeURIComponent(text);
@@ -224,7 +224,7 @@ var LeaferUI = function(exports) {
224
224
  return url;
225
225
  },
226
226
  resize(image, width, height, xGap, yGap, clip, smooth, opacity, _filters) {
227
- const canvas = Platform.origin.createCanvas(max$6(floor$3(width + (xGap || 0)), 1), max$6(floor$3(height + (yGap || 0)), 1));
227
+ const canvas = Platform.origin.createCanvas(max$7(floor$3(width + (xGap || 0)), 1), max$7(floor$3(height + (yGap || 0)), 1));
228
228
  const ctx = canvas.getContext("2d");
229
229
  if (opacity) ctx.globalAlpha = opacity;
230
230
  ctx.imageSmoothingEnabled = smooth === false ? false : true;
@@ -266,7 +266,7 @@ var LeaferUI = function(exports) {
266
266
  };
267
267
  const I$2 = IncrementId;
268
268
  let tempA, tempB, tempTo;
269
- const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
269
+ const {max: max$6} = Math, tempFour = [ 0, 0, 0, 0 ];
270
270
  const FourNumberHelper = {
271
271
  zero: [ ...tempFour ],
272
272
  tempFour: tempFour,
@@ -317,9 +317,9 @@ var LeaferUI = function(exports) {
317
317
  return data;
318
318
  },
319
319
  max(t, other, change) {
320
- if (isNumber(t) && isNumber(other)) return max$5(t, other);
320
+ if (isNumber(t) && isNumber(other)) return max$6(t, other);
321
321
  toTempAB(t, other, change);
322
- 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]));
322
+ return set$2(tempTo, max$6(tempA[0], tempB[0]), max$6(tempA[1], tempB[1]), max$6(tempA[2], tempB[2]), max$6(tempA[3], tempB[3]));
323
323
  },
324
324
  add(t, other, change) {
325
325
  if (isNumber(t) && isNumber(other)) return t + other;
@@ -334,7 +334,7 @@ var LeaferUI = function(exports) {
334
334
  }
335
335
  };
336
336
  const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
337
- const {round: round$6, pow: pow$2, max: max$4, floor: floor$2, PI: PI$4} = Math;
337
+ const {round: round$6, pow: pow$2, max: max$5, floor: floor$2, PI: PI$4} = Math;
338
338
  const MathHelper = {
339
339
  within(value, min, max) {
340
340
  if (isObject(min)) max = min.max, min = min.min;
@@ -387,7 +387,7 @@ var LeaferUI = function(exports) {
387
387
  }
388
388
  },
389
389
  getFloorScale(num, min = 1) {
390
- return max$4(floor$2(num), min) / num;
390
+ return max$5(floor$2(num), min) / num;
391
391
  },
392
392
  randInt: randInt,
393
393
  randColor(opacity) {
@@ -425,8 +425,8 @@ var LeaferUI = function(exports) {
425
425
  };
426
426
  }
427
427
  const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
428
- const {float: float$3} = MathHelper;
429
- const tempPoint$4 = {};
428
+ const {float: float$5} = MathHelper;
429
+ const tempPoint$5 = {};
430
430
  function getWorld() {
431
431
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
432
432
  scaleX: 1,
@@ -483,8 +483,8 @@ var LeaferUI = function(exports) {
483
483
  to.f = t.f * pixelRatio;
484
484
  },
485
485
  scaleOfOuter(t, origin, scaleX, scaleY) {
486
- M$b.toInnerPoint(t, origin, tempPoint$4);
487
- M$b.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
486
+ M$b.toInnerPoint(t, origin, tempPoint$5);
487
+ M$b.scaleOfInner(t, tempPoint$5, scaleX, scaleY);
488
488
  },
489
489
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
490
490
  M$b.translateInner(t, origin.x, origin.y);
@@ -502,8 +502,8 @@ var LeaferUI = function(exports) {
502
502
  t.d = c * sinR + d * cosR;
503
503
  },
504
504
  rotateOfOuter(t, origin, rotation) {
505
- M$b.toInnerPoint(t, origin, tempPoint$4);
506
- M$b.rotateOfInner(t, tempPoint$4, rotation);
505
+ M$b.toInnerPoint(t, origin, tempPoint$5);
506
+ M$b.rotateOfInner(t, tempPoint$5, rotation);
507
507
  },
508
508
  rotateOfInner(t, origin, rotation) {
509
509
  M$b.translateInner(t, origin.x, origin.y);
@@ -524,8 +524,8 @@ var LeaferUI = function(exports) {
524
524
  }
525
525
  },
526
526
  skewOfOuter(t, origin, skewX, skewY) {
527
- M$b.toInnerPoint(t, origin, tempPoint$4);
528
- M$b.skewOfInner(t, tempPoint$4, skewX, skewY);
527
+ M$b.toInnerPoint(t, origin, tempPoint$5);
528
+ M$b.skewOfInner(t, tempPoint$5, skewX, skewY);
529
529
  },
530
530
  skewOfInner(t, origin, skewX, skewY = 0) {
531
531
  M$b.translateInner(t, origin.x, origin.y);
@@ -673,12 +673,12 @@ var LeaferUI = function(exports) {
673
673
  const cosR = c / scaleY;
674
674
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
675
675
  }
676
- const cosR = float$3(cos$6(rotation));
676
+ const cosR = float$5(cos$6(rotation));
677
677
  const sinR = sin$6(rotation);
678
- scaleX = float$3(scaleX), scaleY = float$3(scaleY);
679
- skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
680
- skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
681
- rotation = float$3(rotation / OneRadian);
678
+ scaleX = float$5(scaleX), scaleY = float$5(scaleY);
679
+ skewX = cosR ? float$5((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
680
+ skewY = cosR ? float$5((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
681
+ rotation = float$5(rotation / OneRadian);
682
682
  } else {
683
683
  scaleX = a;
684
684
  scaleY = d;
@@ -720,8 +720,9 @@ var LeaferUI = function(exports) {
720
720
  }
721
721
  };
722
722
  const M$b = MatrixHelper;
723
+ const {float: float$4} = MathHelper;
723
724
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
724
- const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$2, round: round$5} = Math;
725
+ const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
725
726
  const PointHelper = {
726
727
  defaultPoint: getPointData(),
727
728
  tempPoint: {},
@@ -769,22 +770,27 @@ var LeaferUI = function(exports) {
769
770
  },
770
771
  tempToInnerOf(t, matrix) {
771
772
  const {tempPoint: temp} = P$7;
772
- copy$d(temp, t);
773
+ copy$c(temp, t);
773
774
  toInnerPoint$2(matrix, temp, temp);
774
775
  return temp;
775
776
  },
776
777
  tempToOuterOf(t, matrix) {
777
778
  const {tempPoint: temp} = P$7;
778
- copy$d(temp, t);
779
+ copy$c(temp, t);
779
780
  toOuterPoint$3(matrix, temp, temp);
780
781
  return temp;
781
782
  },
782
783
  tempToInnerRadiusPointOf(t, matrix) {
783
784
  const {tempRadiusPoint: temp} = P$7;
784
- copy$d(temp, t);
785
+ copy$c(temp, t);
785
786
  P$7.toInnerRadiusPointOf(t, matrix, temp);
786
787
  return temp;
787
788
  },
789
+ copyRadiusPoint(t, point, x, y) {
790
+ copy$c(t, point);
791
+ setRadius(t, x, y);
792
+ return t;
793
+ },
788
794
  toInnerRadiusPointOf(t, matrix, to) {
789
795
  to || (to = t);
790
796
  toInnerPoint$2(matrix, t, to);
@@ -818,7 +824,7 @@ var LeaferUI = function(exports) {
818
824
  return sqrt$4(x * x + y * y);
819
825
  },
820
826
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
821
- return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
827
+ return min$3(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
822
828
  },
823
829
  getAngle(t, to) {
824
830
  return getAtan2(t, to) / OneRadian;
@@ -852,14 +858,14 @@ var LeaferUI = function(exports) {
852
858
  return points;
853
859
  },
854
860
  isSame(t, point) {
855
- return t.x === point.x && t.y === point.y;
861
+ return float$4(t.x) === float$4(point.x) && float$4(t.y) === float$4(point.y);
856
862
  },
857
863
  reset(t) {
858
864
  P$7.reset(t);
859
865
  }
860
866
  };
861
867
  const P$7 = PointHelper;
862
- const {getDistanceFrom: getDistanceFrom, copy: copy$d, getAtan2: getAtan2} = P$7;
868
+ const {getDistanceFrom: getDistanceFrom, copy: copy$c, setRadius: setRadius, getAtan2: getAtan2} = P$7;
863
869
  class Point {
864
870
  constructor(x, y) {
865
871
  this.set(x, y);
@@ -932,7 +938,7 @@ var LeaferUI = function(exports) {
932
938
  return this;
933
939
  }
934
940
  }
935
- const tempPoint$3 = new Point;
941
+ const tempPoint$4 = new Point;
936
942
  class Matrix {
937
943
  constructor(a, b, c, d, e, f) {
938
944
  this.set(a, b, c, d, e, f);
@@ -1186,7 +1192,7 @@ var LeaferUI = function(exports) {
1186
1192
  };
1187
1193
  const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
1188
1194
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1189
- const {float: float$2, fourNumber: fourNumber$1} = MathHelper;
1195
+ const {float: float$3, fourNumber: fourNumber$1} = MathHelper;
1190
1196
  const {floor: floor$1, ceil: ceil$2} = Math;
1191
1197
  let right$4, bottom$3, boundsRight, boundsBottom;
1192
1198
  const point$2 = {};
@@ -1245,7 +1251,7 @@ var LeaferUI = function(exports) {
1245
1251
  return t;
1246
1252
  },
1247
1253
  toOffsetOutBounds(t, to, offsetBounds) {
1248
- if (!to) to = t; else copy$c(to, t);
1254
+ if (!to) to = t; else copy$b(to, t);
1249
1255
  if (!offsetBounds) offsetBounds = t;
1250
1256
  to.offsetX = B.maxX(offsetBounds);
1251
1257
  to.offsetY = B.maxY(offsetBounds);
@@ -1355,10 +1361,10 @@ var LeaferUI = function(exports) {
1355
1361
  }
1356
1362
  },
1357
1363
  float(t, maxLength) {
1358
- t.x = float$2(t.x, maxLength);
1359
- t.y = float$2(t.y, maxLength);
1360
- t.width = float$2(t.width, maxLength);
1361
- t.height = float$2(t.height, maxLength);
1364
+ t.x = float$3(t.x, maxLength);
1365
+ t.y = float$3(t.y, maxLength);
1366
+ t.width = float$3(t.width, maxLength);
1367
+ t.height = float$3(t.height, maxLength);
1362
1368
  },
1363
1369
  add(t, bounds, isPoint) {
1364
1370
  right$4 = t.x + t.width;
@@ -1392,7 +1398,7 @@ var LeaferUI = function(exports) {
1392
1398
  if (bounds && (bounds.width || bounds.height)) {
1393
1399
  if (first) {
1394
1400
  first = false;
1395
- if (!addMode) copy$c(t, bounds);
1401
+ if (!addMode) copy$b(t, bounds);
1396
1402
  } else {
1397
1403
  add$2(t, bounds);
1398
1404
  }
@@ -1477,7 +1483,7 @@ var LeaferUI = function(exports) {
1477
1483
  }
1478
1484
  };
1479
1485
  const B = BoundsHelper;
1480
- const {add: add$2, copy: copy$c} = B;
1486
+ const {add: add$2, copy: copy$b} = B;
1481
1487
  class Bounds {
1482
1488
  get minX() {
1483
1489
  return BoundsHelper.minX(this);
@@ -2084,7 +2090,7 @@ var LeaferUI = function(exports) {
2084
2090
  __decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
2085
2091
  __decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
2086
2092
  __decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
2087
- const {copy: copy$b, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2093
+ const {copy: copy$a, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2088
2094
  const minSize = {
2089
2095
  width: 1,
2090
2096
  height: 1,
@@ -2241,7 +2247,7 @@ var LeaferUI = function(exports) {
2241
2247
  const {pixelRatio: pixelRatio} = this;
2242
2248
  this.filter = `blur(${blur * pixelRatio}px)`;
2243
2249
  }
2244
- copyWorld(canvas, from, to, blendMode, ceilPixel = true) {
2250
+ copyWorld(canvas, from, to, blendMode, ceilPixel) {
2245
2251
  if (blendMode) this.blendMode = blendMode;
2246
2252
  if (from) {
2247
2253
  this.setTempPixelBounds(from, ceilPixel);
@@ -2252,7 +2258,7 @@ var LeaferUI = function(exports) {
2252
2258
  }
2253
2259
  if (blendMode) this.blendMode = "source-over";
2254
2260
  }
2255
- copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel = true) {
2261
+ copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel) {
2256
2262
  if (fromWorld.b || fromWorld.c) {
2257
2263
  this.save();
2258
2264
  this.resetTransform();
@@ -2265,7 +2271,7 @@ var LeaferUI = function(exports) {
2265
2271
  if (blendMode) this.blendMode = "source-over";
2266
2272
  }
2267
2273
  }
2268
- copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel = true) {
2274
+ copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel) {
2269
2275
  this.resetTransform();
2270
2276
  this.copyWorld(canvas, from, to, blendMode, ceilPixel);
2271
2277
  if (!onlyResetTransform) this.useWorldTransform();
@@ -2335,7 +2341,7 @@ var LeaferUI = function(exports) {
2335
2341
  getSameCanvas(useSameWorldTransform, useSameSmooth) {
2336
2342
  const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2337
2343
  canvas.save();
2338
- if (useSameWorldTransform) copy$b(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2344
+ if (useSameWorldTransform) copy$a(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2339
2345
  if (useSameSmooth) canvas.smooth = this.smooth;
2340
2346
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
2341
2347
  return canvas;
@@ -2463,18 +2469,18 @@ var LeaferUI = function(exports) {
2463
2469
  data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
2464
2470
  }
2465
2471
  };
2466
- const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$9, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2472
+ const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$9, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
2467
2473
  const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
2468
2474
  const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
2469
2475
  const {M: M$a, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
2470
- const tempPoint$2 = {};
2476
+ const tempPoint$3 = {};
2471
2477
  const BezierHelper = {
2472
2478
  points(data, originPoints, curve, close) {
2473
2479
  let points = toNumberPoints$1(originPoints);
2474
2480
  data.push(M$a, points[0], points[1]);
2475
2481
  if (curve && points.length > 5) {
2476
2482
  let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
2477
- let ba, cb, d, len = points.length;
2483
+ let baX, baY, ba, cb, d, len = points.length;
2478
2484
  const t = curve === true ? .5 : curve;
2479
2485
  if (close) {
2480
2486
  points = [ points[len - 2], points[len - 1], ...points, points[0], points[1], points[2], points[3] ];
@@ -2487,7 +2493,9 @@ var LeaferUI = function(exports) {
2487
2493
  bY = points[i + 1];
2488
2494
  cX = points[i + 2];
2489
2495
  cY = points[i + 3];
2490
- ba = sqrt$3(pow$1(bX - aX, 2) + pow$1(bY - aY, 2));
2496
+ baX = bX - aX;
2497
+ baY = bY - aY;
2498
+ ba = sqrt$3(pow$1(baX, 2) + pow$1(baY, 2));
2491
2499
  cb = sqrt$3(pow$1(cX - bX, 2) + pow$1(cY - bY, 2));
2492
2500
  if (!ba && !cb) continue;
2493
2501
  d = ba + cb;
@@ -2500,7 +2508,7 @@ var LeaferUI = function(exports) {
2500
2508
  if (i === 2) {
2501
2509
  if (!close) data.push(Q$7, c1X, c1Y, bX, bY);
2502
2510
  } else {
2503
- data.push(C$8, c2X, c2Y, c1X, c1Y, bX, bY);
2511
+ if (baX || baY) data.push(C$8, c2X, c2Y, c1X, c1Y, bX, bY);
2504
2512
  }
2505
2513
  c2X = bX + cb * cX;
2506
2514
  c2Y = bY + cb * cY;
@@ -2529,8 +2537,8 @@ var LeaferUI = function(exports) {
2529
2537
  const CBy = toY - y1;
2530
2538
  let startRadian = atan2$1(BAy, BAx);
2531
2539
  let endRadian = atan2$1(CBy, CBx);
2532
- const lenBA = hypot(BAx, BAy);
2533
- const lenCB = hypot(CBx, CBy);
2540
+ const lenBA = hypot$1(BAx, BAy);
2541
+ const lenCB = hypot$1(CBx, CBy);
2534
2542
  let totalRadian = endRadian - startRadian;
2535
2543
  if (totalRadian < 0) totalRadian += PI2;
2536
2544
  if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$9(totalRadian - PI$3) < 1e-12) {
@@ -2635,8 +2643,8 @@ var LeaferUI = function(exports) {
2635
2643
  addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
2636
2644
  addPoint$2(pointBounds, toX, toY);
2637
2645
  for (let i = 0, len = tList.length; i < len; i++) {
2638
- getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
2639
- addPoint$2(pointBounds, tempPoint$2.x, tempPoint$2.y);
2646
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$3);
2647
+ addPoint$2(pointBounds, tempPoint$3.x, tempPoint$3.y);
2640
2648
  }
2641
2649
  },
2642
2650
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
@@ -3031,7 +3039,7 @@ var LeaferUI = function(exports) {
3031
3039
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
3032
3040
  const {M: M$8, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
3033
3041
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3034
- const {tan: tan, min: min$1, abs: abs$8} = Math;
3042
+ const {tan: tan, min: min$2, abs: abs$8} = Math;
3035
3043
  const startPoint = {};
3036
3044
  const PathCommandDataHelper = {
3037
3045
  beginPath(data) {
@@ -3068,6 +3076,7 @@ var LeaferUI = function(exports) {
3068
3076
  }
3069
3077
  },
3070
3078
  ellipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
3079
+ if (radiusX === radiusY) return arc$2(data, x, y, radiusX, startAngle, endAngle, anticlockwise);
3071
3080
  if (isNull(rotation)) {
3072
3081
  data.push(F$5, x, y, radiusX, radiusY);
3073
3082
  } else {
@@ -3080,6 +3089,7 @@ var LeaferUI = function(exports) {
3080
3089
  if (isNull(startAngle)) {
3081
3090
  data.push(P$4, x, y, radius);
3082
3091
  } else {
3092
+ if (isNull(startAngle)) startAngle = 0;
3083
3093
  if (isNull(endAngle)) endAngle = 360;
3084
3094
  data.push(O$5, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
3085
3095
  }
@@ -3087,7 +3097,7 @@ var LeaferUI = function(exports) {
3087
3097
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3088
3098
  if (!isUndefined(lastX)) {
3089
3099
  const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3090
- radius = min$1(radius, min$1(d / 2, d / 2 * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3100
+ radius = min$2(radius, min$2(d / 2, d / 2 * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3091
3101
  }
3092
3102
  data.push(U$4, x1, y1, x2, y2, radius);
3093
3103
  },
@@ -3280,7 +3290,7 @@ var LeaferUI = function(exports) {
3280
3290
  };
3281
3291
  const {M: M$6, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = PathCommandMap;
3282
3292
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3283
- const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3293
+ const {addPointBounds: addPointBounds, copy: copy$9, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3284
3294
  const debug$d = Debug.get("PathBounds");
3285
3295
  let radius, radiusX, radiusY;
3286
3296
  const tempPointBounds = {};
@@ -3356,7 +3366,7 @@ var LeaferUI = function(exports) {
3356
3366
 
3357
3367
  case G$2:
3358
3368
  ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
3359
- i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3369
+ i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3360
3370
  x = setEndPoint.x;
3361
3371
  y = setEndPoint.y;
3362
3372
  i += 9;
@@ -3374,7 +3384,7 @@ var LeaferUI = function(exports) {
3374
3384
 
3375
3385
  case O$3:
3376
3386
  arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
3377
- i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3387
+ i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3378
3388
  x = setEndPoint.x;
3379
3389
  y = setEndPoint.y;
3380
3390
  i += 7;
@@ -3391,7 +3401,7 @@ var LeaferUI = function(exports) {
3391
3401
 
3392
3402
  case U$2:
3393
3403
  arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
3394
- i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3404
+ i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3395
3405
  x = setEndPoint.x;
3396
3406
  y = setEndPoint.y;
3397
3407
  i += 6;
@@ -3411,6 +3421,7 @@ var LeaferUI = function(exports) {
3411
3421
  smooth(data, cornerRadius, _cornerSmoothing) {
3412
3422
  let command, lastCommand, commandLen;
3413
3423
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3424
+ if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
3414
3425
  const len = data.length;
3415
3426
  const smooth = [];
3416
3427
  while (i < len) {
@@ -3808,7 +3819,9 @@ var LeaferUI = function(exports) {
3808
3819
  const ImageManager = {
3809
3820
  maxRecycled: 10,
3810
3821
  recycledList: [],
3811
- patternTasker: new TaskProcessor,
3822
+ patternTasker: new TaskProcessor({
3823
+ parallel: 1
3824
+ }),
3812
3825
  get(config) {
3813
3826
  let image = Resource.get(config.url);
3814
3827
  if (!image) Resource.set(config.url, image = Creator.image(config));
@@ -4338,7 +4351,7 @@ var LeaferUI = function(exports) {
4338
4351
  EventCreator.register(target);
4339
4352
  };
4340
4353
  }
4341
- const {copy: copy$9, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
4354
+ const {copy: copy$8, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
4342
4355
  const matrix$3 = {}, {round: round$3} = Math;
4343
4356
  const LeafHelper = {
4344
4357
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
@@ -4434,7 +4447,7 @@ var LeaferUI = function(exports) {
4434
4447
  if (scaleY) transition = scaleY;
4435
4448
  scaleY = scaleX;
4436
4449
  }
4437
- copy$9(matrix$3, o);
4450
+ copy$8(matrix$3, o);
4438
4451
  scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
4439
4452
  if (L$4.hasHighPosition(t)) {
4440
4453
  L$4.setTransform(t, matrix$3, resize, transition);
@@ -4453,7 +4466,7 @@ var LeaferUI = function(exports) {
4453
4466
  },
4454
4467
  rotateOfLocal(t, origin, angle, transition) {
4455
4468
  const o = t.__localMatrix;
4456
- copy$9(matrix$3, o);
4469
+ copy$8(matrix$3, o);
4457
4470
  rotateOfOuter$2(matrix$3, origin, angle);
4458
4471
  if (L$4.hasHighPosition(t)) L$4.setTransform(t, matrix$3, false, transition); else t.set({
4459
4472
  x: t.x + matrix$3.e - o.e,
@@ -4465,18 +4478,18 @@ var LeaferUI = function(exports) {
4465
4478
  L$4.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4466
4479
  },
4467
4480
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4468
- copy$9(matrix$3, t.__localMatrix);
4481
+ copy$8(matrix$3, t.__localMatrix);
4469
4482
  skewOfOuter(matrix$3, origin, skewX, skewY);
4470
4483
  L$4.setTransform(t, matrix$3, resize, transition);
4471
4484
  },
4472
4485
  transformWorld(t, transform, resize, transition) {
4473
- copy$9(matrix$3, t.worldTransform);
4486
+ copy$8(matrix$3, t.worldTransform);
4474
4487
  multiplyParent$3(matrix$3, transform);
4475
4488
  if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
4476
4489
  L$4.setTransform(t, matrix$3, resize, transition);
4477
4490
  },
4478
4491
  transform(t, transform, resize, transition) {
4479
- copy$9(matrix$3, t.localTransform);
4492
+ copy$8(matrix$3, t.localTransform);
4480
4493
  multiplyParent$3(matrix$3, transform);
4481
4494
  L$4.setTransform(t, matrix$3, resize, transition);
4482
4495
  },
@@ -4514,7 +4527,7 @@ var LeaferUI = function(exports) {
4514
4527
  return innerOrigin;
4515
4528
  },
4516
4529
  getRelativeWorld(t, relative, temp) {
4517
- copy$9(matrix$3, t.worldTransform);
4530
+ copy$8(matrix$3, t.worldTransform);
4518
4531
  divideParent(matrix$3, relative.scrollWorldTransform);
4519
4532
  return temp ? matrix$3 : Object.assign({}, matrix$3);
4520
4533
  },
@@ -4652,9 +4665,52 @@ var LeaferUI = function(exports) {
4652
4665
  if (exclude && exclude === branch) continue;
4653
4666
  updateBounds$4(branch);
4654
4667
  }
4668
+ },
4669
+ move(branch, x, y) {
4670
+ let w;
4671
+ const {children: children} = branch;
4672
+ for (let i = 0, len = children.length; i < len; i++) {
4673
+ branch = children[i];
4674
+ w = branch.__world;
4675
+ w.e += x;
4676
+ w.f += y;
4677
+ w.x += x;
4678
+ w.y += y;
4679
+ if (branch.isBranch) move$9(branch, x, y);
4680
+ }
4681
+ },
4682
+ scale(branch, x, y, scaleX, scaleY, a, b) {
4683
+ let w;
4684
+ const {children: children} = branch;
4685
+ const changeScaleX = scaleX - 1;
4686
+ const changeScaleY = scaleY - 1;
4687
+ for (let i = 0, len = children.length; i < len; i++) {
4688
+ branch = children[i];
4689
+ w = branch.__world;
4690
+ w.a *= scaleX;
4691
+ w.d *= scaleY;
4692
+ if (w.b || w.c) {
4693
+ w.b *= scaleX;
4694
+ w.c *= scaleY;
4695
+ }
4696
+ if (w.e === w.x && w.f === w.y) {
4697
+ w.x = w.e += (w.e - a) * changeScaleX + x;
4698
+ w.y = w.f += (w.f - b) * changeScaleY + y;
4699
+ } else {
4700
+ w.e += (w.e - a) * changeScaleX + x;
4701
+ w.f += (w.f - b) * changeScaleY + y;
4702
+ w.x += (w.x - a) * changeScaleX + x;
4703
+ w.y += (w.y - b) * changeScaleY + y;
4704
+ }
4705
+ w.width *= scaleX;
4706
+ w.height *= scaleY;
4707
+ w.scaleX *= scaleX;
4708
+ w.scaleY *= scaleY;
4709
+ if (branch.isBranch) scale$2(branch, x, y, scaleX, scaleY, a, b);
4710
+ }
4655
4711
  }
4656
4712
  };
4657
- const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack} = BranchHelper;
4713
+ const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$2} = BranchHelper;
4658
4714
  const WaitHelper = {
4659
4715
  run(wait) {
4660
4716
  if (wait && wait.length) {
@@ -4667,7 +4723,7 @@ var LeaferUI = function(exports) {
4667
4723
  }
4668
4724
  };
4669
4725
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
4670
- const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$8} = BoundsHelper;
4726
+ const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$7} = BoundsHelper;
4671
4727
  const localContent = "_localContentBounds";
4672
4728
  const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
4673
4729
  class LeafLayout {
@@ -4903,7 +4959,7 @@ var LeaferUI = function(exports) {
4903
4959
  matrix = getRelativeWorld$1(leaf, relative, true);
4904
4960
  }
4905
4961
  if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
4906
- copy$8(layoutBounds, bounds);
4962
+ copy$7(layoutBounds, bounds);
4907
4963
  PointHelper.copy(layoutBounds, point);
4908
4964
  if (unscale) {
4909
4965
  const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
@@ -5448,7 +5504,7 @@ var LeaferUI = function(exports) {
5448
5504
  }
5449
5505
  };
5450
5506
  const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
5451
- const {toPoint: toPoint$4, tempPoint: tempPoint$1} = AroundHelper;
5507
+ const {toPoint: toPoint$4, tempPoint: tempPoint$2} = AroundHelper;
5452
5508
  const LeafMatrix = {
5453
5509
  __updateWorldMatrix() {
5454
5510
  const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
@@ -5467,8 +5523,8 @@ var LeaferUI = function(exports) {
5467
5523
  local.e = data.x + data.offsetX;
5468
5524
  local.f = data.y + data.offsetY;
5469
5525
  if (data.around || data.origin) {
5470
- toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$1);
5471
- translateInner(local, -tempPoint$1.x, -tempPoint$1.y, !data.around);
5526
+ toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$2);
5527
+ translateInner(local, -tempPoint$2.x, -tempPoint$2.y, !data.around);
5472
5528
  }
5473
5529
  }
5474
5530
  this.__layout.matrixChanged = undefined;
@@ -5476,7 +5532,7 @@ var LeaferUI = function(exports) {
5476
5532
  };
5477
5533
  const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
5478
5534
  const {updateBounds: updateBounds$2} = BranchHelper;
5479
- const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$7} = BoundsHelper;
5535
+ const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$6} = BoundsHelper;
5480
5536
  const {toBounds: toBounds$1} = PathBounds;
5481
5537
  const LeafBounds = {
5482
5538
  __updateWorldBounds() {
@@ -5585,7 +5641,7 @@ var LeaferUI = function(exports) {
5585
5641
  },
5586
5642
  __updateRenderBounds(_bounds) {
5587
5643
  const layout = this.__layout, {renderSpread: renderSpread} = layout;
5588
- isNumber(renderSpread) && renderSpread <= 0 ? copy$7(layout.renderBounds, layout.strokeBounds) : copyAndSpread$3(layout.renderBounds, layout.boxBounds, renderSpread);
5644
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$3(layout.renderBounds, layout.boxBounds, renderSpread);
5589
5645
  }
5590
5646
  };
5591
5647
  const LeafRender = {
@@ -5681,7 +5737,7 @@ var LeaferUI = function(exports) {
5681
5737
  const {stintSet: stintSet$4} = DataHelper;
5682
5738
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
5683
5739
  const {toOuterOf: toOuterOf$1} = BoundsHelper;
5684
- const {copy: copy$6, move: move$8} = PointHelper;
5740
+ const {copy: copy$5, move: move$8} = PointHelper;
5685
5741
  const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
5686
5742
  exports.Leaf = class Leaf {
5687
5743
  get tag() {
@@ -5998,14 +6054,14 @@ var LeaferUI = function(exports) {
5998
6054
  if (this.parent) {
5999
6055
  this.parent.worldToInner(world, to, distance, relative);
6000
6056
  } else {
6001
- if (to) copy$6(to, world);
6057
+ if (to) copy$5(to, world);
6002
6058
  }
6003
6059
  }
6004
6060
  localToWorld(local, to, distance, relative) {
6005
6061
  if (this.parent) {
6006
6062
  this.parent.innerToWorld(local, to, distance, relative);
6007
6063
  } else {
6008
- if (to) copy$6(to, local);
6064
+ if (to) copy$5(to, local);
6009
6065
  }
6010
6066
  }
6011
6067
  worldToInner(world, to, distance, relative) {
@@ -6118,10 +6174,10 @@ var LeaferUI = function(exports) {
6118
6174
  hit(_world, _hitRadius) {
6119
6175
  return true;
6120
6176
  }
6121
- __hitWorld(_point) {
6177
+ __hitWorld(_point, _forceHitFill) {
6122
6178
  return true;
6123
6179
  }
6124
- __hit(_local) {
6180
+ __hit(_local, _forceHitFill) {
6125
6181
  return true;
6126
6182
  }
6127
6183
  __hitFill(_inner) {
@@ -6470,7 +6526,7 @@ var LeaferUI = function(exports) {
6470
6526
  this.levelMap = null;
6471
6527
  }
6472
6528
  }
6473
- const version = "1.12.0";
6529
+ const version = "1.12.2";
6474
6530
  class LeaferCanvas extends LeaferCanvasBase {
6475
6531
  get allowBackgroundColor() {
6476
6532
  return true;
@@ -7090,6 +7146,8 @@ var LeaferUI = function(exports) {
7090
7146
  }
7091
7147
  }
7092
7148
  Renderer.clipSpread = 10;
7149
+ const tempPoint$1 = {};
7150
+ const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
7093
7151
  const {hitRadiusPoint: hitRadiusPoint$1} = BoundsHelper;
7094
7152
  class Picker {
7095
7153
  constructor(target, selector) {
@@ -7215,15 +7273,15 @@ var LeaferUI = function(exports) {
7215
7273
  this.eachFind(branch.children, branch.__onlyHitMask);
7216
7274
  }
7217
7275
  eachFind(children, hitMask) {
7218
- let child, hit;
7276
+ let child, hit, data;
7219
7277
  const {point: point} = this, len = children.length;
7220
7278
  for (let i = len - 1; i > -1; i--) {
7221
- child = children[i];
7222
- if (!child.__.visible || hitMask && !child.__.mask) continue;
7223
- hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
7279
+ child = children[i], data = child.__;
7280
+ if (!data.visible || hitMask && !data.mask) continue;
7281
+ hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$1, point, data.hitRadius) : point);
7224
7282
  if (child.isBranch) {
7225
7283
  if (hit || child.__ignoreHitWorld) {
7226
- if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point)) continue;
7284
+ if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
7227
7285
  if (child.topChildren) this.eachFind(child.topChildren, false);
7228
7286
  this.eachFind(child.children, child.__onlyHitMask);
7229
7287
  if (child.isBranchLeaf) this.hitChild(child, point);
@@ -7667,7 +7725,7 @@ var LeaferUI = function(exports) {
7667
7725
  return data;
7668
7726
  }
7669
7727
  }
7670
- const {max: max$3, add: add$1} = FourNumberHelper;
7728
+ const {max: max$4, add: add$1} = FourNumberHelper;
7671
7729
  const UIBounds = {
7672
7730
  __updateStrokeSpread() {
7673
7731
  let spread = 0, boxSpread = 0;
@@ -7682,7 +7740,7 @@ var LeaferUI = function(exports) {
7682
7740
  }
7683
7741
  if (data.__useArrow) spread += strokeWidth * 5;
7684
7742
  if (box) {
7685
- spread = max$3(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
7743
+ spread = max$4(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
7686
7744
  boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
7687
7745
  }
7688
7746
  this.__layout.strokeBoxSpread = boxSpread;
@@ -7692,15 +7750,15 @@ var LeaferUI = function(exports) {
7692
7750
  let spread = 0;
7693
7751
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
7694
7752
  if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
7695
- if (blur) spread = max$3(spread, blur);
7753
+ if (blur) spread = max$4(spread, blur);
7696
7754
  if (filter) spread = add$1(spread, Filter.getSpread(filter));
7697
7755
  if (renderSpread) spread = add$1(spread, renderSpread);
7698
7756
  if (strokeSpread) spread = add$1(spread, strokeSpread);
7699
7757
  let shapeSpread = spread;
7700
- if (innerShadow) shapeSpread = max$3(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
7701
- if (backgroundBlur) shapeSpread = max$3(shapeSpread, backgroundBlur);
7758
+ if (innerShadow) shapeSpread = max$4(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
7759
+ if (backgroundBlur) shapeSpread = max$4(shapeSpread, backgroundBlur);
7702
7760
  this.__layout.renderShapeSpread = shapeSpread;
7703
- return box ? max$3(box.__updateRenderSpread(), spread) : spread;
7761
+ return box ? max$4(box.__updateRenderSpread(), spread) : spread;
7704
7762
  }
7705
7763
  };
7706
7764
  const {stintSet: stintSet$2} = DataHelper;
@@ -7754,7 +7812,7 @@ var LeaferUI = function(exports) {
7754
7812
  if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
7755
7813
  }
7756
7814
  } else {
7757
- if (data.__pathInputed) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
7815
+ if (data.__pathForRender) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
7758
7816
  }
7759
7817
  },
7760
7818
  __drawShape(canvas, options) {
@@ -7874,7 +7932,7 @@ var LeaferUI = function(exports) {
7874
7932
  getPath(curve, pathForRender) {
7875
7933
  this.__layout.update();
7876
7934
  let path = pathForRender ? this.__.__pathForRender : this.__.path;
7877
- if (!path) pen.set(path = []), this.__drawPathByBox(pen);
7935
+ if (!path) pen.set(path = []), this.__drawPathByBox(pen, !pathForRender);
7878
7936
  return curve ? PathConvert.toCanvasData(path, true) : path;
7879
7937
  }
7880
7938
  getPathString(curve, pathForRender, floatLength) {
@@ -7902,17 +7960,18 @@ var LeaferUI = function(exports) {
7902
7960
  }
7903
7961
  __drawPath(canvas) {
7904
7962
  canvas.beginPath();
7905
- this.__drawPathByData(canvas, this.__.path);
7963
+ this.__drawPathByData(canvas, this.__.path, true);
7906
7964
  }
7907
- __drawPathByData(drawer, data) {
7908
- data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
7965
+ __drawPathByData(drawer, data, ignoreCornerRadius) {
7966
+ data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer, ignoreCornerRadius);
7909
7967
  }
7910
- __drawPathByBox(drawer) {
7968
+ __drawPathByBox(drawer, ignoreCornerRadius) {
7911
7969
  const {x: x, y: y, width: width, height: height} = this.__layout.boxBounds;
7912
- if (this.__.cornerRadius) {
7970
+ if (this.__.cornerRadius && !ignoreCornerRadius) {
7913
7971
  const {cornerRadius: cornerRadius} = this.__;
7914
7972
  drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
7915
7973
  } else drawer.rect(x, y, width, height);
7974
+ drawer.closePath();
7916
7975
  }
7917
7976
  drawImagePlaceholder(_paint, canvas, renderOptions) {
7918
7977
  Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
@@ -8099,6 +8158,9 @@ var LeaferUI = function(exports) {
8099
8158
  get layoutLocked() {
8100
8159
  return !this.layouter.running;
8101
8160
  }
8161
+ get view() {
8162
+ return this.canvas && this.canvas.view;
8163
+ }
8102
8164
  get FPS() {
8103
8165
  return this.renderer ? this.renderer.FPS : 60;
8104
8166
  }
@@ -8150,7 +8212,6 @@ var LeaferUI = function(exports) {
8150
8212
  this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
8151
8213
  if (this.isApp) this.__setApp();
8152
8214
  this.__checkAutoLayout();
8153
- this.view = canvas.view;
8154
8215
  if (!parentApp) {
8155
8216
  this.selector = Creator.selector(this);
8156
8217
  this.interaction = Creator.interaction(this, canvas, this.selector, config);
@@ -8430,7 +8491,7 @@ var LeaferUI = function(exports) {
8430
8491
  if (this.canvasManager) this.canvasManager.destroy();
8431
8492
  }
8432
8493
  if (this.canvas) this.canvas.destroy();
8433
- this.config.view = this.view = this.parentApp = null;
8494
+ this.config.view = this.parentApp = null;
8434
8495
  if (this.userConfig) this.userConfig.view = null;
8435
8496
  super.destroy();
8436
8497
  setTimeout(() => {
@@ -8582,7 +8643,6 @@ var LeaferUI = function(exports) {
8582
8643
  if (startAngle || endAngle) {
8583
8644
  if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
8584
8645
  ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
8585
- if (innerRadius < 1) closePath$2(path);
8586
8646
  } else {
8587
8647
  if (innerRadius < 1) {
8588
8648
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
@@ -8590,16 +8650,16 @@ var LeaferUI = function(exports) {
8590
8650
  }
8591
8651
  ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
8592
8652
  }
8593
- if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
8594
8653
  } else {
8595
8654
  if (startAngle || endAngle) {
8596
8655
  moveTo$3(path, rx, ry);
8597
8656
  ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
8598
- closePath$2(path);
8599
8657
  } else {
8600
8658
  ellipse(path, rx, ry, rx, ry);
8601
8659
  }
8602
8660
  }
8661
+ closePath$2(path);
8662
+ if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
8603
8663
  }
8604
8664
  };
8605
8665
  __decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
@@ -9160,7 +9220,7 @@ var LeaferUI = function(exports) {
9160
9220
  EventCreator.changeName(oldName, newName);
9161
9221
  }
9162
9222
  }
9163
- const {min: min, max: max$2, abs: abs$7} = Math, {float: float$1, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
9223
+ const {min: min$1, max: max$3, abs: abs$7} = Math, {float: float$2, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
9164
9224
  const tempContent = new Bounds, tempDragBounds = new Bounds;
9165
9225
  const DragBoundsHelper = {
9166
9226
  limitMove(leaf, move) {
@@ -9198,8 +9258,8 @@ var LeaferUI = function(exports) {
9198
9258
  } else {
9199
9259
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
9200
9260
  }
9201
- move.x = float$1(move.x);
9202
- move.y = float$1(move.y);
9261
+ move.x = float$2(move.x);
9262
+ move.y = float$2(move.y);
9203
9263
  return move;
9204
9264
  },
9205
9265
  getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
@@ -9211,44 +9271,44 @@ var LeaferUI = function(exports) {
9211
9271
  let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
9212
9272
  if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
9213
9273
  if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9214
- aSize = float$1(tempContent.minX - tempDragBounds.minX);
9215
- bSize = float$1(tempDragBounds.maxX - tempContent.maxX);
9274
+ aSize = float$2(tempContent.minX - tempDragBounds.minX);
9275
+ bSize = float$2(tempDragBounds.maxX - tempContent.maxX);
9216
9276
  aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
9217
9277
  bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
9218
- correctScaleX *= max$2(aScale, bScale);
9278
+ correctScaleX *= max$3(aScale, bScale);
9219
9279
  } else {
9220
9280
  if (scale.x < 0) {
9221
- if (float$1(minX(content) - minX(dragBounds)) <= 0 || float$1(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9281
+ if (float$2(minX(content) - minX(dragBounds)) <= 0 || float$2(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
9222
9282
  tempContent.unsign();
9223
9283
  }
9224
- aSize = float$1(tempDragBounds.minX - tempContent.minX);
9225
- bSize = float$1(tempContent.maxX - tempDragBounds.maxX);
9284
+ aSize = float$2(tempDragBounds.minX - tempContent.minX);
9285
+ bSize = float$2(tempContent.maxX - tempDragBounds.maxX);
9226
9286
  aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
9227
9287
  bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
9228
- correctScaleX *= min(aScale, bScale);
9288
+ correctScaleX *= min$1(aScale, bScale);
9229
9289
  }
9230
9290
  if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
9231
9291
  if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9232
- aSize = float$1(tempContent.minY - tempDragBounds.minY);
9233
- bSize = float$1(tempDragBounds.maxY - tempContent.maxY);
9292
+ aSize = float$2(tempContent.minY - tempDragBounds.minY);
9293
+ bSize = float$2(tempDragBounds.maxY - tempContent.maxY);
9234
9294
  aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
9235
9295
  bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
9236
- correctScaleY *= max$2(aScale, bScale);
9296
+ correctScaleY *= max$3(aScale, bScale);
9237
9297
  if (lockRatio) {
9238
- aScale = max$2(abs$7(correctScaleX), abs$7(correctScaleY));
9298
+ aScale = max$3(abs$7(correctScaleX), abs$7(correctScaleY));
9239
9299
  correctScaleX = sign$2(correctScaleX) * aScale;
9240
9300
  correctScaleY = sign$2(correctScaleY) * aScale;
9241
9301
  }
9242
9302
  } else {
9243
9303
  if (scale.y < 0) {
9244
- if (float$1(minY(content) - minY(dragBounds)) <= 0 || float$1(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9304
+ if (float$2(minY(content) - minY(dragBounds)) <= 0 || float$2(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
9245
9305
  tempContent.unsign();
9246
9306
  }
9247
- aSize = float$1(tempDragBounds.minY - tempContent.minY);
9248
- bSize = float$1(tempContent.maxY - tempDragBounds.maxY);
9307
+ aSize = float$2(tempDragBounds.minY - tempContent.minY);
9308
+ bSize = float$2(tempContent.maxY - tempDragBounds.maxY);
9249
9309
  aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
9250
9310
  bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
9251
- correctScaleY *= min(aScale, bScale);
9311
+ correctScaleY *= min$1(aScale, bScale);
9252
9312
  }
9253
9313
  scale.x *= isFinite$1(correctScaleX) ? correctScaleX : 1;
9254
9314
  scale.y *= isFinite$1(correctScaleY) ? correctScaleY : 1;
@@ -9354,6 +9414,7 @@ var LeaferUI = function(exports) {
9354
9414
  exports.MoveEvent.BEFORE_MOVE = "move.before_move";
9355
9415
  exports.MoveEvent.START = "move.start";
9356
9416
  exports.MoveEvent.MOVE = "move";
9417
+ exports.MoveEvent.DRAG_ANIMATE = "move.drag_animate";
9357
9418
  exports.MoveEvent.END = "move.end";
9358
9419
  exports.MoveEvent = __decorate([ registerUIEvent() ], exports.MoveEvent);
9359
9420
  exports.TouchEvent = class TouchEvent extends UIEvent {};
@@ -9421,6 +9482,7 @@ var LeaferUI = function(exports) {
9421
9482
  ctrlKey: e.ctrlKey,
9422
9483
  shiftKey: e.shiftKey,
9423
9484
  metaKey: e.metaKey,
9485
+ time: Date.now(),
9424
9486
  buttons: isUndefined(e.buttons) ? 1 : e.buttons === 0 ? pointerUpButtons : e.buttons,
9425
9487
  origin: e
9426
9488
  };
@@ -9452,6 +9514,7 @@ var LeaferUI = function(exports) {
9452
9514
  const {getDragEventData: getDragEventData, getDropEventData: getDropEventData, getSwipeEventData: getSwipeEventData} = InteractionHelper;
9453
9515
  class Dragger {
9454
9516
  constructor(interaction) {
9517
+ this.dragDataList = [];
9455
9518
  this.interaction = interaction;
9456
9519
  }
9457
9520
  setDragData(data) {
@@ -9514,6 +9577,7 @@ var LeaferUI = function(exports) {
9514
9577
  this.dragData = getDragEventData(downData, dragData, data);
9515
9578
  if (throughPath) this.dragData.throughPath = throughPath;
9516
9579
  this.dragData.path = path;
9580
+ this.dragDataList.push(this.dragData);
9517
9581
  if (this.moving) {
9518
9582
  data.moving = true;
9519
9583
  this.dragData.moveType = "drag";
@@ -9564,9 +9628,9 @@ var LeaferUI = function(exports) {
9564
9628
  interaction.emit(exports.DragEvent.ENTER, data, path, dragEnterPath);
9565
9629
  this.dragEnterPath = path;
9566
9630
  }
9567
- dragEnd(data, speed) {
9631
+ dragEnd(data) {
9568
9632
  if (!this.dragging && !this.moving) return;
9569
- if (this.checkDragEndAnimate(data, speed)) return;
9633
+ if (this.checkDragEndAnimate(data)) return;
9570
9634
  this.dragEndReal(data);
9571
9635
  }
9572
9636
  dragEndReal(data) {
@@ -9608,11 +9672,13 @@ var LeaferUI = function(exports) {
9608
9672
  }
9609
9673
  dragReset() {
9610
9674
  exports.DragEvent.list = exports.DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9675
+ this.dragDataList = [];
9611
9676
  }
9612
9677
  checkDragEndAnimate(_data, _speed) {
9613
9678
  return false;
9614
9679
  }
9615
9680
  animate(_func, _off) {}
9681
+ stopAnimate() {}
9616
9682
  checkDragOut(_data) {}
9617
9683
  autoMoveOnDragOut(_data) {}
9618
9684
  autoMoveCancel() {}
@@ -9997,6 +10063,9 @@ var LeaferUI = function(exports) {
9997
10063
  this.pointerHover(hoverData);
9998
10064
  }
9999
10065
  }
10066
+ stopDragAnimate() {
10067
+ this.dragger.stopAnimate();
10068
+ }
10000
10069
  updateDownData(data, options, merge) {
10001
10070
  const {downData: downData} = this;
10002
10071
  if (!data && downData) data = downData;
@@ -10175,28 +10244,27 @@ var LeaferUI = function(exports) {
10175
10244
  Platform.getSelector = function(leaf) {
10176
10245
  return leaf.leafer ? leaf.leafer.selector : Platform.selector || (Platform.selector = Creator.selector());
10177
10246
  };
10178
- const {toInnerRadiusPointOf: toInnerRadiusPointOf, copy: copy$5, setRadius: setRadius} = PointHelper;
10247
+ const {toInnerRadiusPointOf: toInnerRadiusPointOf, copyRadiusPoint: copyRadiusPoint} = PointHelper;
10179
10248
  const {hitRadiusPoint: hitRadiusPoint, hitPoint: hitPoint} = BoundsHelper;
10180
10249
  const inner = {}, worldRadiusPoint = {};
10181
10250
  const leaf$1 = exports.Leaf.prototype;
10182
10251
  leaf$1.hit = function(worldPoint, hitRadius = 0) {
10183
10252
  this.updateLayout();
10184
- copy$5(worldRadiusPoint, worldPoint);
10185
- setRadius(worldRadiusPoint, hitRadius);
10253
+ copyRadiusPoint(worldRadiusPoint, worldPoint, hitRadius);
10186
10254
  const world = this.__world;
10187
10255
  if (hitRadius ? !hitRadiusPoint(world, worldRadiusPoint) : !hitPoint(world, worldRadiusPoint)) return false;
10188
10256
  return this.isBranch ? Platform.getSelector(this).hitPoint(Object.assign({}, worldRadiusPoint), hitRadius, {
10189
10257
  target: this
10190
10258
  }) : this.__hitWorld(worldRadiusPoint);
10191
10259
  };
10192
- leaf$1.__hitWorld = function(point) {
10260
+ leaf$1.__hitWorld = function(point, forceHitFill) {
10193
10261
  const data = this.__;
10194
10262
  if (!data.hitSelf) return false;
10195
10263
  const world = this.__world, layout = this.__layout;
10196
10264
  const isSmall = world.width < 10 && world.height < 10;
10197
10265
  if (data.hitRadius) {
10198
- copy$5(inner, point), point = inner;
10199
- setRadius(point, data.hitRadius);
10266
+ copyRadiusPoint(inner, point, data.hitRadius);
10267
+ point = inner;
10200
10268
  }
10201
10269
  toInnerRadiusPointOf(point, world, inner);
10202
10270
  if (data.hitBox || isSmall) {
@@ -10207,7 +10275,7 @@ var LeaferUI = function(exports) {
10207
10275
  this.__updateHitCanvas();
10208
10276
  if (!layout.boundsChanged) layout.hitCanvasChanged = false;
10209
10277
  }
10210
- return this.__hit(inner);
10278
+ return this.__hit(inner, forceHitFill);
10211
10279
  };
10212
10280
  leaf$1.__hitFill = function(inner) {
10213
10281
  const h = this.__hitCanvas;
@@ -10266,12 +10334,12 @@ var LeaferUI = function(exports) {
10266
10334
  this.__drawHitPath(h);
10267
10335
  h.setStrokeOptions(data);
10268
10336
  };
10269
- ui$5.__hit = function(inner) {
10337
+ ui$5.__hit = function(inner, forceHitFill) {
10270
10338
  if (this.__box && this.__box.__hit(inner)) return true;
10271
10339
  const data = this.__;
10272
10340
  if (data.__isHitPixel && this.__hitPixel(inner)) return true;
10273
10341
  const {hitFill: hitFill} = data;
10274
- const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all";
10342
+ const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
10275
10343
  if (needHitFillPath && this.__hitFill(inner)) return true;
10276
10344
  const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
10277
10345
  const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
@@ -10938,10 +11006,12 @@ var LeaferUI = function(exports) {
10938
11006
  function createPatternTask(paint, ui, canvas, renderOptions) {
10939
11007
  if (!paint.patternTask) {
10940
11008
  paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
10941
- paint.patternTask = null;
10942
- if (canvas.bounds.hit(ui.__nowWorld)) PaintImage.createPattern(paint, ui, canvas, renderOptions);
11009
+ PaintImage.createPattern(paint, ui, canvas, renderOptions);
10943
11010
  ui.forceUpdate("surface");
10944
- }), 300);
11011
+ }), 0, () => {
11012
+ paint.patternTask = null;
11013
+ return canvas.bounds.hit(ui.__nowWorld);
11014
+ });
10945
11015
  }
10946
11016
  }
10947
11017
  function createPattern(paint, ui, canvas, renderOptions) {
@@ -11165,7 +11235,7 @@ var LeaferUI = function(exports) {
11165
11235
  conicGradient: conicGradient,
11166
11236
  getTransform: getTransform
11167
11237
  };
11168
- const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1, abs: abs$5} = Math;
11238
+ const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$5} = Math;
11169
11239
  const tempBounds = {}, tempMatrix = new Matrix;
11170
11240
  const offsetOutBounds$1 = {};
11171
11241
  function shadow$1(ui, current, shape) {
@@ -11206,10 +11276,10 @@ var LeaferUI = function(exports) {
11206
11276
  let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
11207
11277
  shadow.forEach(item => {
11208
11278
  x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$5(item.spread || 0);
11209
- top = max$1(top, spread + blur - y);
11210
- right = max$1(right, spread + blur + x);
11211
- bottom = max$1(bottom, spread + blur + y);
11212
- left = max$1(left, spread + blur - x);
11279
+ top = max$2(top, spread + blur - y);
11280
+ right = max$2(right, spread + blur + x);
11281
+ bottom = max$2(bottom, spread + blur + y);
11282
+ left = max$2(left, spread + blur - x);
11213
11283
  });
11214
11284
  return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
11215
11285
  }
@@ -11996,7 +12066,11 @@ var LeaferUI = function(exports) {
11996
12066
  matrix$1.half = strokeWidth % 2;
11997
12067
  canvas.setWorld(matrix$1, options.matrix);
11998
12068
  canvas.beginPath();
11999
- if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
12069
+ if (this.strokePathType === "path") {
12070
+ leaf.__drawPath(canvas);
12071
+ } else {
12072
+ if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
12073
+ }
12000
12074
  data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
12001
12075
  if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
12002
12076
  if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
@@ -12011,6 +12085,7 @@ var LeaferUI = function(exports) {
12011
12085
  }
12012
12086
  }
12013
12087
  __decorate([ targetAttr(onTarget$1) ], Stroker.prototype, "target", void 0);
12088
+ __decorate([ surfaceType("render-path") ], Stroker.prototype, "strokePathType", void 0);
12014
12089
  function onTarget$1(stroker) {
12015
12090
  const value = stroker.target;
12016
12091
  stroker.list = value ? isArray(value) ? value : [ value ] : [];
@@ -12120,10 +12195,11 @@ var LeaferUI = function(exports) {
12120
12195
  }
12121
12196
  update() {
12122
12197
  this.hoverStroker.update();
12123
- const {stroke: stroke, strokeWidth: strokeWidth, selectedStyle: selectedStyle} = this.editor.mergedConfig;
12198
+ const {stroke: stroke, strokeWidth: strokeWidth, selectedPathType: selectedPathType, selectedStyle: selectedStyle} = this.editor.mergedConfig;
12124
12199
  this.targetStroker.update(Object.assign({
12125
12200
  stroke: stroke,
12126
- strokeWidth: strokeWidth && Math.max(1, strokeWidth / 2)
12201
+ strokeWidth: strokeWidth && Math.max(1, strokeWidth / 2),
12202
+ strokePathType: selectedPathType
12127
12203
  }, selectedStyle || {}));
12128
12204
  }
12129
12205
  onPointerMove(e) {
@@ -13449,7 +13525,7 @@ var LeaferUI = function(exports) {
13449
13525
  const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
13450
13526
  let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
13451
13527
  if (e instanceof exports.ZoomEvent) {
13452
- around = target.getBoxPoint(e);
13528
+ if (!around) around = target.getBoxPoint(e);
13453
13529
  totalMove = e.totalScale;
13454
13530
  } else {
13455
13531
  totalMove = e.getInnerTotal(target);
@@ -14706,7 +14782,11 @@ var LeaferUI = function(exports) {
14706
14782
  addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
14707
14783
  if (leafer.isApp || custom) return;
14708
14784
  leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, e => {
14709
- leafer.zoomLayer.move(leafer.getValidMove(e.moveX, e.moveY, false));
14785
+ const move = leafer.getValidMove(e.moveX, e.moveY, false);
14786
+ leafer.zoomLayer.move(move);
14787
+ }), leafer.on_(exports.MoveEvent.DRAG_ANIMATE, () => {
14788
+ const move = leafer.getValidMove(0, 0);
14789
+ if (move.x || move.y) leafer.interaction.stopDragAnimate();
14710
14790
  }), leafer.on_(exports.MoveEvent.END, e => {
14711
14791
  LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
14712
14792
  }), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, e => {
@@ -14843,7 +14923,7 @@ var LeaferUI = function(exports) {
14843
14923
  }
14844
14924
  };
14845
14925
  const M$3 = MultiTouchHelper;
14846
- const {abs: abs$2, max: max} = Math, {sign: sign, within: within$2} = MathHelper;
14926
+ const {abs: abs$2, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
14847
14927
  const WheelEventHelper = {
14848
14928
  getMove(event, config) {
14849
14929
  let {moveSpeed: moveSpeed} = config;
@@ -14853,8 +14933,8 @@ var LeaferUI = function(exports) {
14853
14933
  deltaY = 0;
14854
14934
  }
14855
14935
  const absX = abs$2(deltaX), absY = abs$2(deltaY);
14856
- if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX);
14857
- if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY);
14936
+ if (absX > 50) deltaX = max$1(50, absX / 3) * sign(deltaX);
14937
+ if (absY > 50) deltaY = max$1(50, absY / 3) * sign(deltaY);
14858
14938
  return {
14859
14939
  x: -deltaX * moveSpeed * 2,
14860
14940
  y: -deltaY * moveSpeed * 2
@@ -14998,7 +15078,7 @@ var LeaferUI = function(exports) {
14998
15078
  if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0; else Math.abs(move$4.x) > Math.abs(move$4.y) ? move$4.y = 0 : move$4.x = 0;
14999
15079
  if (checkLimit && type.includes("limit")) {
15000
15080
  bounds.set(this.__world).addPoint(this.zoomLayer);
15001
- DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "inner", move$4, true);
15081
+ DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "auto", move$4, true);
15002
15082
  if (type.includes("x")) move$4.y = 0; else if (type.includes("y")) move$4.x = 0;
15003
15083
  }
15004
15084
  }
@@ -15092,21 +15172,51 @@ var LeaferUI = function(exports) {
15092
15172
  if (moving) this.move(getMoveEventData(gestureData.move, data));
15093
15173
  };
15094
15174
  const dragger = Dragger.prototype;
15095
- const {abs: abs$1} = Math;
15096
- dragger.checkDragEndAnimate = function(data, speed) {
15097
- const {moveX: moveX, moveY: moveY} = this.dragData;
15098
- const absMoveX = abs$1(moveX), absMoveY = abs$1(moveY), minMove = speed ? 1 : .1;
15099
- const dragAnimate = this.canAnimate && this.moving && (absMoveX > minMove || absMoveY > minMove) && this.interaction.m.dragAnimate;
15175
+ const {abs: abs$1, min: min, max: max, hypot: hypot} = Math;
15176
+ dragger.checkDragEndAnimate = function(data) {
15177
+ const {interaction: interaction} = this;
15178
+ const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate;
15100
15179
  if (dragAnimate) {
15101
- const inertia = data.pointerType === "touch" ? 3 : 1, maxMove = 70;
15102
- speed = speed ? isNumber(dragAnimate) ? dragAnimate : .95 : inertia;
15103
- if (absMoveX * speed > maxMove) speed = maxMove / absMoveX; else if (absMoveY * speed > maxMove) speed = maxMove / absMoveY;
15104
- data = Object.assign({}, data);
15105
- PointHelper.move(data, moveX * speed, moveY * speed);
15106
- this.drag(data);
15107
- this.animate(() => {
15108
- this.dragEnd(data, 1);
15109
- });
15180
+ const inertia = isNumber(dragAnimate) ? dragAnimate : .95;
15181
+ const stopMove = .15;
15182
+ const maxMove = 150;
15183
+ let moveX = 0, moveY = 0, flickSpeed = 0;
15184
+ let totalWeight = 0, weight, w = 3, s, frame;
15185
+ const {dragDataList: dragDataList} = this, len = dragDataList.length;
15186
+ for (let i = len - 1; i >= max(len - 3, 0); i--) {
15187
+ frame = dragDataList[i];
15188
+ if (frame.time && Date.now() - frame.time > 100) break;
15189
+ weight = w--;
15190
+ moveX += frame.moveX * weight;
15191
+ moveY += frame.moveY * weight;
15192
+ totalWeight += weight;
15193
+ s = hypot(frame.moveX, frame.moveY);
15194
+ if (s > flickSpeed) flickSpeed = s;
15195
+ }
15196
+ if (totalWeight) moveX /= totalWeight, moveY /= totalWeight;
15197
+ if (flickSpeed > 8) {
15198
+ const t = min((flickSpeed - 8) / 17, 1);
15199
+ const boost = 1.15 + t * (1.6 - 1.15);
15200
+ moveX *= boost;
15201
+ moveY *= boost;
15202
+ }
15203
+ const maxAbs = max(abs$1(moveX), abs$1(moveY));
15204
+ if (maxAbs > maxMove) {
15205
+ s = maxMove / maxAbs;
15206
+ moveX *= s;
15207
+ moveY *= s;
15208
+ }
15209
+ const step = () => {
15210
+ moveX *= inertia;
15211
+ moveY *= inertia;
15212
+ data = Object.assign({}, data);
15213
+ if (abs$1(moveX) < stopMove && abs$1(moveY) < stopMove) return this.dragEndReal(data);
15214
+ PointHelper.move(data, moveX, moveY);
15215
+ this.drag(data);
15216
+ this.animate(step);
15217
+ interaction.emit(exports.MoveEvent.DRAG_ANIMATE, data);
15218
+ };
15219
+ this.animate(step);
15110
15220
  }
15111
15221
  return dragAnimate;
15112
15222
  };
@@ -15115,6 +15225,12 @@ var LeaferUI = function(exports) {
15115
15225
  if (animateWait) this.interaction.target.nextRender(animateWait, null, off);
15116
15226
  this.animateWait = func;
15117
15227
  };
15228
+ dragger.stopAnimate = function() {
15229
+ this.animate(null, "off");
15230
+ this.interaction.target.nextRender(() => {
15231
+ if (this.dragData) this.dragEndReal(this.dragData);
15232
+ });
15233
+ };
15118
15234
  dragger.checkDragOut = function(data) {
15119
15235
  const {interaction: interaction} = this;
15120
15236
  this.autoMoveCancel();
@@ -15179,7 +15295,6 @@ var LeaferUI = function(exports) {
15179
15295
  }
15180
15296
  Plugin.add("view");
15181
15297
  exports.Leafer.prototype.zoom = function(zoomType, optionsOrPadding, scroll, transition) {
15182
- this.killAnimate();
15183
15298
  let padding;
15184
15299
  if (isData(optionsOrPadding)) {
15185
15300
  padding = optionsOrPadding.padding;
@@ -15192,8 +15307,9 @@ var LeaferUI = function(exports) {
15192
15307
  x: limitBounds.x + limitBounds.width / 2,
15193
15308
  y: limitBounds.y + limitBounds.height / 2
15194
15309
  };
15310
+ zoomLayer.killAnimate();
15195
15311
  let changeScale;
15196
- const {x: x, y: y, scaleX: scaleX, scaleY: scaleY} = zoomLayer.__;
15312
+ const {x: x, y: y, scaleX: scaleX, scaleY: scaleY} = zoomLayer.__, {boxBounds: boxBounds} = zoomLayer;
15197
15313
  if (isString(zoomType)) {
15198
15314
  switch (zoomType) {
15199
15315
  case "in":
@@ -15205,16 +15321,16 @@ var LeaferUI = function(exports) {
15205
15321
  break;
15206
15322
 
15207
15323
  case "fit":
15208
- zoomType = this.boxBounds;
15324
+ zoomType = boxBounds;
15209
15325
  break;
15210
15326
 
15211
15327
  case "fit-width":
15212
- zoomType = new Bounds(this.boxBounds);
15328
+ zoomType = new Bounds(boxBounds);
15213
15329
  zoomType.height = 0;
15214
15330
  break;
15215
15331
 
15216
15332
  case "fit-height":
15217
- zoomType = new Bounds(this.boxBounds);
15333
+ zoomType = new Bounds(boxBounds);
15218
15334
  zoomType.width = 0;
15219
15335
  break;
15220
15336
  }
@@ -16481,6 +16597,8 @@ var LeaferUI = function(exports) {
16481
16597
  }
16482
16598
  constructor(target, keyframe, options, isTemp) {
16483
16599
  super();
16600
+ this.nowIndex = 0;
16601
+ this.playedTotalTime = 0;
16484
16602
  if (keyframe) {
16485
16603
  if (keyframe.keyframes) options = keyframe, keyframe = keyframe.keyframes; else if (keyframe.style) options = keyframe,
16486
16604
  keyframe = keyframe.style;
@@ -16527,7 +16645,7 @@ var LeaferUI = function(exports) {
16527
16645
  play() {
16528
16646
  if (this.destroyed) return;
16529
16647
  this.running = true;
16530
- if (!this.started) this.clearTimer(), this.start(); else if (!this.timer) this.requestAnimate();
16648
+ if (!this.started) this.clearTimer(), this.start(); else if (!this.timer) this.startRequestAnimate();
16531
16649
  this.emitType(AnimateEvent.PLAY);
16532
16650
  }
16533
16651
  pause() {
@@ -16541,14 +16659,28 @@ var LeaferUI = function(exports) {
16541
16659
  this.complete();
16542
16660
  this.emitType(AnimateEvent.STOP);
16543
16661
  }
16544
- seek(time) {
16662
+ seek(time, includeDelay) {
16545
16663
  if (this.destroyed) return;
16546
- if (isObject(time)) time = UnitConvert.number(time, this.duration);
16664
+ const {delay: delay} = this;
16665
+ if (isObject(time)) time = UnitConvert.number(time, this.duration + (includeDelay ? delay : 0));
16666
+ if (includeDelay) time -= delay;
16547
16667
  if (time) time /= this.speed;
16548
- if (!this.started || time < this.time) this.start(true);
16668
+ let waitBeginTime;
16669
+ if (time < 0) {
16670
+ waitBeginTime = -time;
16671
+ time = 0;
16672
+ }
16673
+ if (!this.started || time < this.time || !time) this.start(true);
16549
16674
  this.time = time;
16550
- this.animate(0, true);
16551
- this.clearTimer(() => this.requestAnimate());
16675
+ if (!waitBeginTime) this.animate(0, true);
16676
+ this.clearTimer(() => {
16677
+ if (waitBeginTime) {
16678
+ this.timer = setTimeout(() => {
16679
+ this.timer = 0;
16680
+ this.begin();
16681
+ }, waitBeginTime * 1e3);
16682
+ } else this.startRequestAnimate();
16683
+ });
16552
16684
  this.emitType(AnimateEvent.SEEK);
16553
16685
  }
16554
16686
  kill(complete = true, killStyle) {
@@ -16631,14 +16763,24 @@ var LeaferUI = function(exports) {
16631
16763
  }
16632
16764
  }
16633
16765
  }
16634
- requestAnimate() {
16766
+ startRequestAnimate() {
16635
16767
  this.requestAnimateTime = Date.now();
16768
+ this.requestAnimatePageTime = 0;
16769
+ if (!this.waitRequestRender) this.requestAnimate();
16770
+ }
16771
+ requestAnimate() {
16772
+ this.waitRequestRender = true;
16636
16773
  Platform.requestRender(this.animate.bind(this));
16637
16774
  }
16638
- animate(_runtime, seek) {
16775
+ animate(pageTime, seek) {
16639
16776
  if (!seek) {
16777
+ this.waitRequestRender = false;
16640
16778
  if (!this.running) return;
16641
- this.time += (Date.now() - this.requestAnimateTime) / 1e3;
16779
+ let frameTime;
16780
+ if (pageTime && this.requestAnimatePageTime) frameTime = pageTime - this.requestAnimatePageTime; else frameTime = Date.now() - this.requestAnimateTime;
16781
+ this.time += frameTime / 1e3;
16782
+ this.requestAnimatePageTime = pageTime;
16783
+ this.requestAnimateTime = Date.now();
16642
16784
  }
16643
16785
  const {duration: duration} = this, realTime = this.time * this.speed;
16644
16786
  if (realTime < duration) {
@@ -16679,21 +16821,24 @@ var LeaferUI = function(exports) {
16679
16821
  }
16680
16822
  start(seek) {
16681
16823
  this.requestAnimateTime = 1;
16682
- const {reverse: reverse} = this;
16824
+ const {reverse: reverse, jump: jump} = this;
16683
16825
  if (reverse || this.mainReverse) this.mainReverse = reverse;
16684
16826
  if (this.looped) this.looped = 0;
16685
16827
  if (seek) this.begin(true); else {
16686
16828
  const {delay: delay} = this;
16687
- if (delay) this.timer = setTimeout(() => {
16688
- this.timer = 0;
16689
- this.begin();
16690
- }, delay / this.speed * 1e3); else this.begin();
16829
+ if (delay) {
16830
+ if (jump) this.begin(true);
16831
+ this.timer = setTimeout(() => {
16832
+ this.timer = 0;
16833
+ this.begin();
16834
+ }, delay / this.speed * 1e3);
16835
+ } else this.begin();
16691
16836
  }
16692
16837
  }
16693
16838
  begin(seek) {
16694
16839
  this.playedTotalTime = this.time = 0;
16695
16840
  this.mainReverse ? this.setTo() : this.setFrom();
16696
- if (!seek) this.requestAnimate();
16841
+ if (!seek) this.startRequestAnimate();
16697
16842
  }
16698
16843
  end() {
16699
16844
  this.mainReverse ? this.setFrom() : this.setTo();
@@ -16797,6 +16942,7 @@ var LeaferUI = function(exports) {
16797
16942
  __decorate([ animateAttr(1) ], exports.Animate.prototype, "speed", void 0);
16798
16943
  __decorate([ animateAttr(true) ], exports.Animate.prototype, "autoplay", void 0);
16799
16944
  __decorate([ animateAttr() ], exports.Animate.prototype, "join", void 0);
16945
+ __decorate([ animateAttr() ], exports.Animate.prototype, "jump", void 0);
16800
16946
  __decorate([ animateAttr() ], exports.Animate.prototype, "attrs", void 0);
16801
16947
  exports.Animate = __decorate([ useModule(LeafEventer) ], exports.Animate);
16802
16948
  exports.AnimateList = class AnimateList extends exports.Animate {
@@ -17026,7 +17172,7 @@ var LeaferUI = function(exports) {
17026
17172
  const rgbaMatch = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i;
17027
17173
  const hslMatch = /^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i;
17028
17174
  const hslaMatch = /^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i;
17029
- const int = parseInt, float = parseFloat, {round: round$1} = Math;
17175
+ const int = parseInt, float$1 = parseFloat, {round: round$1} = Math;
17030
17176
  let cache = {}, totalCache = 0;
17031
17177
  function colorToRGBA(color, opacity) {
17032
17178
  let RGBA;
@@ -17134,16 +17280,16 @@ var LeaferUI = function(exports) {
17134
17280
  r: int(match[1]),
17135
17281
  g: int(match[2]),
17136
17282
  b: int(match[3]),
17137
- a: float(match[4])
17283
+ a: float$1(match[4])
17138
17284
  };
17139
17285
  }
17140
17286
  function hslToRGBA(color) {
17141
17287
  const match = hslMatch.exec(color);
17142
- return hsla(float(match[1]), float(match[2]), float(match[3]), 1);
17288
+ return hsla(float$1(match[1]), float$1(match[2]), float$1(match[3]), 1);
17143
17289
  }
17144
17290
  function hslaToRGBA(color) {
17145
17291
  const match = hslaMatch.exec(color);
17146
- return hsla(float(match[1]), float(match[2]), float(match[3]), float(match[4]));
17292
+ return hsla(float$1(match[1]), float$1(match[2]), float$1(match[3]), float$1(match[4]));
17147
17293
  }
17148
17294
  const n1 = 1 / 6, n2 = .5, n3 = 2 / 3, n4 = 1 / 3;
17149
17295
  function hue(p, q, t) {
@@ -17346,7 +17492,7 @@ var LeaferUI = function(exports) {
17346
17492
  }
17347
17493
  };
17348
17494
  const {getDistance: getDistance} = HighBezierHelper;
17349
- const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
17495
+ const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
17350
17496
  const tempPoint = {}, tempFrom = {};
17351
17497
  const HighCurveHelper = {
17352
17498
  transform(data, matrix) {
@@ -17481,7 +17627,7 @@ var LeaferUI = function(exports) {
17481
17627
  getDistancePath(distanceData, motionDistance, motionPrecision) {
17482
17628
  const {segments: segments, data: data} = distanceData, path = [];
17483
17629
  motionDistance = UnitConvert.number(motionDistance, distanceData.total);
17484
- let total = 0, distance, to = {};
17630
+ let total = 0, distance, cutDistance, to = {};
17485
17631
  let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
17486
17632
  let x1, y1, x2, y2, t;
17487
17633
  const len = data.length;
@@ -17493,14 +17639,17 @@ var LeaferUI = function(exports) {
17493
17639
  toX = data[i + 1];
17494
17640
  toY = data[i + 2];
17495
17641
  distance = segments[index];
17496
- if (total + distance >= motionDistance || !distanceData.total) {
17642
+ if (total + distance > motionDistance || !distanceData.total) {
17497
17643
  if (!i) x = toX, y = toY;
17498
17644
  tempFrom.x = x;
17499
17645
  tempFrom.y = y;
17500
17646
  to.x = toX;
17501
17647
  to.y = toY;
17502
- PointHelper.getDistancePoint(tempFrom, to, motionDistance - total, true);
17503
- path.push(command, to.x, to.y);
17648
+ cutDistance = float(motionDistance - total);
17649
+ if (cutDistance) {
17650
+ PointHelper.getDistancePoint(tempFrom, to, cutDistance, true);
17651
+ path.push(command, to.x, to.y);
17652
+ }
17504
17653
  return path;
17505
17654
  }
17506
17655
  x = toX;
@@ -17514,9 +17663,12 @@ var LeaferUI = function(exports) {
17514
17663
  toX = data[i + 5];
17515
17664
  toY = data[i + 6];
17516
17665
  distance = segments[index];
17517
- if (total + distance >= motionDistance) {
17518
- t = HighBezierHelper.getT(motionDistance - total, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
17519
- HighBezierHelper.cut(path, t, x, y, x1, y1, x2, y2, toX, toY);
17666
+ if (total + distance > motionDistance) {
17667
+ cutDistance = float(motionDistance - total);
17668
+ if (cutDistance) {
17669
+ t = HighBezierHelper.getT(cutDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
17670
+ HighBezierHelper.cut(path, t, x, y, x1, y1, x2, y2, toX, toY);
17671
+ }
17520
17672
  return path;
17521
17673
  }
17522
17674
  x = toX;
@@ -18159,6 +18311,7 @@ var LeaferUI = function(exports) {
18159
18311
  for (let i = 0, len = children.length; i < len; i++) {
18160
18312
  child = children[i];
18161
18313
  result = method(child, options);
18314
+ if (typeof result === "boolean") result = result ? 1 : 0;
18162
18315
  if (result === Yes || result === YesAndSkip) {
18163
18316
  if (list) {
18164
18317
  list.push(child);
@@ -18704,7 +18857,7 @@ var LeaferUI = function(exports) {
18704
18857
  exports.surfaceType = surfaceType;
18705
18858
  exports.tempBounds = tempBounds$2;
18706
18859
  exports.tempMatrix = tempMatrix$2;
18707
- exports.tempPoint = tempPoint$3;
18860
+ exports.tempPoint = tempPoint$4;
18708
18861
  exports.tryToNumber = tryToNumber;
18709
18862
  exports.useCanvas = useCanvas;
18710
18863
  exports.useModule = useModule;