@leafer-ui/worker 1.12.1 → 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
@@ -425,8 +425,8 @@ var LeaferUI = function(exports) {
425
425
  };
426
426
  }
427
427
  const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
428
- const {float: float$2} = MathHelper;
429
- const tempPoint$3 = {};
428
+ const {float: float$3} = MathHelper;
429
+ const tempPoint$4 = {};
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$6.toInnerPoint(t, origin, tempPoint$3);
487
- M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
486
+ M$6.toInnerPoint(t, origin, tempPoint$4);
487
+ M$6.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
488
488
  },
489
489
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
490
490
  M$6.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$6.toInnerPoint(t, origin, tempPoint$3);
506
- M$6.rotateOfInner(t, tempPoint$3, rotation);
505
+ M$6.toInnerPoint(t, origin, tempPoint$4);
506
+ M$6.rotateOfInner(t, tempPoint$4, rotation);
507
507
  },
508
508
  rotateOfInner(t, origin, rotation) {
509
509
  M$6.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$6.toInnerPoint(t, origin, tempPoint$3);
528
- M$6.skewOfInner(t, tempPoint$3, skewX, skewY);
527
+ M$6.toInnerPoint(t, origin, tempPoint$4);
528
+ M$6.skewOfInner(t, tempPoint$4, skewX, skewY);
529
529
  },
530
530
  skewOfInner(t, origin, skewX, skewY = 0) {
531
531
  M$6.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$2(cos$5(rotation));
676
+ const cosR = float$3(cos$5(rotation));
677
677
  const sinR = sin$5(rotation);
678
- scaleX = float$2(scaleX), scaleY = float$2(scaleY);
679
- skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
680
- skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
681
- rotation = float$2(rotation / OneRadian);
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);
682
682
  } else {
683
683
  scaleX = a;
684
684
  scaleY = d;
@@ -720,6 +720,7 @@ var LeaferUI = function(exports) {
720
720
  }
721
721
  };
722
722
  const M$6 = MatrixHelper;
723
+ const {float: float$2} = MathHelper;
723
724
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
724
725
  const {sin: sin$4, cos: cos$4, abs: abs$5, sqrt: sqrt$2, atan2: atan2$2, min: min$2, round: round$2} = Math;
725
726
  const PointHelper = {
@@ -769,22 +770,27 @@ var LeaferUI = function(exports) {
769
770
  },
770
771
  tempToInnerOf(t, matrix) {
771
772
  const {tempPoint: temp} = P$5;
772
- copy$a(temp, t);
773
+ copy$9(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$5;
778
- copy$a(temp, t);
779
+ copy$9(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$5;
784
- copy$a(temp, t);
785
+ copy$9(temp, t);
785
786
  P$5.toInnerRadiusPointOf(t, matrix, temp);
786
787
  return temp;
787
788
  },
789
+ copyRadiusPoint(t, point, x, y) {
790
+ copy$9(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);
@@ -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$2(t.x) === float$2(point.x) && float$2(t.y) === float$2(point.y);
856
862
  },
857
863
  reset(t) {
858
864
  P$5.reset(t);
859
865
  }
860
866
  };
861
867
  const P$5 = PointHelper;
862
- const {getDistanceFrom: getDistanceFrom, copy: copy$a, getAtan2: getAtan2} = P$5;
868
+ const {getDistanceFrom: getDistanceFrom, copy: copy$9, setRadius: setRadius, getAtan2: getAtan2} = P$5;
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$2 = new Point;
941
+ const tempPoint$3 = 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);
@@ -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$9(to, t);
1254
+ if (!to) to = t; else copy$8(to, t);
1249
1255
  if (!offsetBounds) offsetBounds = t;
1250
1256
  to.offsetX = B.maxX(offsetBounds);
1251
1257
  to.offsetY = B.maxY(offsetBounds);
@@ -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$9(t, bounds);
1401
+ if (!addMode) copy$8(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$9} = B;
1486
+ const {add: add$2, copy: copy$8} = 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$8, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2093
+ const {copy: copy$7, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = 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$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2344
+ if (useSameWorldTransform) copy$7(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;
@@ -2467,14 +2473,14 @@ var LeaferUI = function(exports) {
2467
2473
  const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
2468
2474
  const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
2469
2475
  const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
2470
- const tempPoint$1 = {};
2476
+ const tempPoint$2 = {};
2471
2477
  const BezierHelper = {
2472
2478
  points(data, originPoints, curve, close) {
2473
2479
  let points = toNumberPoints(originPoints);
2474
2480
  data.push(M$5, 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$1(pow(bX - aX, 2) + pow(bY - aY, 2));
2496
+ baX = bX - aX;
2497
+ baY = bY - aY;
2498
+ ba = sqrt$1(pow(baX, 2) + pow(baY, 2));
2491
2499
  cb = sqrt$1(pow(cX - bX, 2) + pow(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$4, c1X, c1Y, bX, bY);
2502
2510
  } else {
2503
- data.push(C$4, c2X, c2Y, c1X, c1Y, bX, bY);
2511
+ if (baX || baY) data.push(C$4, c2X, c2Y, c1X, c1Y, bX, bY);
2504
2512
  }
2505
2513
  c2X = bX + cb * cX;
2506
2514
  c2Y = bY + cb * cY;
@@ -2635,8 +2643,8 @@ var LeaferUI = function(exports) {
2635
2643
  addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
2636
2644
  addPoint$1(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$1);
2639
- addPoint$1(pointBounds, tempPoint$1.x, tempPoint$1.y);
2646
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
2647
+ addPoint$1(pointBounds, tempPoint$2.x, tempPoint$2.y);
2640
2648
  }
2641
2649
  },
2642
2650
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
@@ -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$3, 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$2, x, y, radius);
3082
3091
  } else {
3092
+ if (isNull(startAngle)) startAngle = 0;
3083
3093
  if (isNull(endAngle)) endAngle = 360;
3084
3094
  data.push(O$2, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
3085
3095
  }
@@ -3280,7 +3290,7 @@ var LeaferUI = function(exports) {
3280
3290
  };
3281
3291
  const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
3282
3292
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3283
- const {addPointBounds: addPointBounds, copy: copy$7, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
3293
+ const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
3284
3294
  const debug$a = 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:
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$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3369
+ i === 0 ? copy$6(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:
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$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3387
+ i === 0 ? copy$6(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:
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$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3404
+ i === 0 ? copy$6(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$6, 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$5, 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$1 = {}, {round: round} = 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$6(matrix$1, o);
4450
+ copy$5(matrix$1, o);
4438
4451
  scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4439
4452
  if (L.hasHighPosition(t)) {
4440
4453
  L.setTransform(t, matrix$1, 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$6(matrix$1, o);
4469
+ copy$5(matrix$1, o);
4457
4470
  rotateOfOuter$2(matrix$1, origin, angle);
4458
4471
  if (L.hasHighPosition(t)) L.setTransform(t, matrix$1, false, transition); else t.set({
4459
4472
  x: t.x + matrix$1.e - o.e,
@@ -4465,18 +4478,18 @@ var LeaferUI = function(exports) {
4465
4478
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4466
4479
  },
4467
4480
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4468
- copy$6(matrix$1, t.__localMatrix);
4481
+ copy$5(matrix$1, t.__localMatrix);
4469
4482
  skewOfOuter(matrix$1, origin, skewX, skewY);
4470
4483
  L.setTransform(t, matrix$1, resize, transition);
4471
4484
  },
4472
4485
  transformWorld(t, transform, resize, transition) {
4473
- copy$6(matrix$1, t.worldTransform);
4486
+ copy$5(matrix$1, t.worldTransform);
4474
4487
  multiplyParent$3(matrix$1, transform);
4475
4488
  if (t.parent) divideParent(matrix$1, t.parent.scrollWorldTransform);
4476
4489
  L.setTransform(t, matrix$1, resize, transition);
4477
4490
  },
4478
4491
  transform(t, transform, resize, transition) {
4479
- copy$6(matrix$1, t.localTransform);
4492
+ copy$5(matrix$1, t.localTransform);
4480
4493
  multiplyParent$3(matrix$1, transform);
4481
4494
  L.setTransform(t, matrix$1, 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$6(matrix$1, t.worldTransform);
4530
+ copy$5(matrix$1, t.worldTransform);
4518
4531
  divideParent(matrix$1, relative.scrollWorldTransform);
4519
4532
  return temp ? matrix$1 : Object.assign({}, matrix$1);
4520
4533
  },
@@ -4710,7 +4723,7 @@ var LeaferUI = function(exports) {
4710
4723
  }
4711
4724
  };
4712
4725
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
4713
- const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$5} = BoundsHelper;
4726
+ const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$4} = BoundsHelper;
4714
4727
  const localContent = "_localContentBounds";
4715
4728
  const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
4716
4729
  class LeafLayout {
@@ -4946,7 +4959,7 @@ var LeaferUI = function(exports) {
4946
4959
  matrix = getRelativeWorld$1(leaf, relative, true);
4947
4960
  }
4948
4961
  if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
4949
- copy$5(layoutBounds, bounds);
4962
+ copy$4(layoutBounds, bounds);
4950
4963
  PointHelper.copy(layoutBounds, point);
4951
4964
  if (unscale) {
4952
4965
  const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
@@ -5491,7 +5504,7 @@ var LeaferUI = function(exports) {
5491
5504
  }
5492
5505
  };
5493
5506
  const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
5494
- const {toPoint: toPoint$3, tempPoint: tempPoint} = AroundHelper;
5507
+ const {toPoint: toPoint$3, tempPoint: tempPoint$1} = AroundHelper;
5495
5508
  const LeafMatrix = {
5496
5509
  __updateWorldMatrix() {
5497
5510
  const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
@@ -5510,8 +5523,8 @@ var LeaferUI = function(exports) {
5510
5523
  local.e = data.x + data.offsetX;
5511
5524
  local.f = data.y + data.offsetY;
5512
5525
  if (data.around || data.origin) {
5513
- toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
5514
- translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
5526
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
5527
+ translateInner(local, -tempPoint$1.x, -tempPoint$1.y, !data.around);
5515
5528
  }
5516
5529
  }
5517
5530
  this.__layout.matrixChanged = undefined;
@@ -5519,7 +5532,7 @@ var LeaferUI = function(exports) {
5519
5532
  };
5520
5533
  const {updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2} = LeafHelper;
5521
5534
  const {updateBounds: updateBounds$1} = BranchHelper;
5522
- const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$4} = BoundsHelper;
5535
+ const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$3} = BoundsHelper;
5523
5536
  const {toBounds: toBounds} = PathBounds;
5524
5537
  const LeafBounds = {
5525
5538
  __updateWorldBounds() {
@@ -5628,7 +5641,7 @@ var LeaferUI = function(exports) {
5628
5641
  },
5629
5642
  __updateRenderBounds(_bounds) {
5630
5643
  const layout = this.__layout, {renderSpread: renderSpread} = layout;
5631
- isNumber(renderSpread) && renderSpread <= 0 ? copy$4(layout.renderBounds, layout.strokeBounds) : copyAndSpread$2(layout.renderBounds, layout.boxBounds, renderSpread);
5644
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$3(layout.renderBounds, layout.strokeBounds) : copyAndSpread$2(layout.renderBounds, layout.boxBounds, renderSpread);
5632
5645
  }
5633
5646
  };
5634
5647
  const LeafRender = {
@@ -5724,7 +5737,7 @@ var LeaferUI = function(exports) {
5724
5737
  const {stintSet: stintSet$4} = DataHelper;
5725
5738
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
5726
5739
  const {toOuterOf: toOuterOf$1} = BoundsHelper;
5727
- const {copy: copy$3, move: move$2} = PointHelper;
5740
+ const {copy: copy$2, move: move$2} = PointHelper;
5728
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;
5729
5742
  exports.Leaf = class Leaf {
5730
5743
  get tag() {
@@ -6041,14 +6054,14 @@ var LeaferUI = function(exports) {
6041
6054
  if (this.parent) {
6042
6055
  this.parent.worldToInner(world, to, distance, relative);
6043
6056
  } else {
6044
- if (to) copy$3(to, world);
6057
+ if (to) copy$2(to, world);
6045
6058
  }
6046
6059
  }
6047
6060
  localToWorld(local, to, distance, relative) {
6048
6061
  if (this.parent) {
6049
6062
  this.parent.innerToWorld(local, to, distance, relative);
6050
6063
  } else {
6051
- if (to) copy$3(to, local);
6064
+ if (to) copy$2(to, local);
6052
6065
  }
6053
6066
  }
6054
6067
  worldToInner(world, to, distance, relative) {
@@ -6513,7 +6526,7 @@ var LeaferUI = function(exports) {
6513
6526
  this.levelMap = null;
6514
6527
  }
6515
6528
  }
6516
- const version = "1.12.1";
6529
+ const version = "1.12.2";
6517
6530
  class LeaferCanvas extends LeaferCanvasBase {
6518
6531
  get allowBackgroundColor() {
6519
6532
  return true;
@@ -7133,6 +7146,8 @@ var LeaferUI = function(exports) {
7133
7146
  }
7134
7147
  }
7135
7148
  Renderer.clipSpread = 10;
7149
+ const tempPoint = {};
7150
+ const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
7136
7151
  const {hitRadiusPoint: hitRadiusPoint$1} = BoundsHelper;
7137
7152
  class Picker {
7138
7153
  constructor(target, selector) {
@@ -7258,15 +7273,15 @@ var LeaferUI = function(exports) {
7258
7273
  this.eachFind(branch.children, branch.__onlyHitMask);
7259
7274
  }
7260
7275
  eachFind(children, hitMask) {
7261
- let child, hit;
7276
+ let child, hit, data;
7262
7277
  const {point: point} = this, len = children.length;
7263
7278
  for (let i = len - 1; i > -1; i--) {
7264
- child = children[i];
7265
- if (!child.__.visible || hitMask && !child.__.mask) continue;
7266
- 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, point, data.hitRadius) : point);
7267
7282
  if (child.isBranch) {
7268
7283
  if (hit || child.__ignoreHitWorld) {
7269
- if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point, true)) continue;
7284
+ if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
7270
7285
  if (child.topChildren) this.eachFind(child.topChildren, false);
7271
7286
  this.eachFind(child.children, child.__onlyHitMask);
7272
7287
  if (child.isBranchLeaf) this.hitChild(child, point);
@@ -7797,7 +7812,7 @@ var LeaferUI = function(exports) {
7797
7812
  if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
7798
7813
  }
7799
7814
  } else {
7800
- 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);
7801
7816
  }
7802
7817
  },
7803
7818
  __drawShape(canvas, options) {
@@ -7917,7 +7932,7 @@ var LeaferUI = function(exports) {
7917
7932
  getPath(curve, pathForRender) {
7918
7933
  this.__layout.update();
7919
7934
  let path = pathForRender ? this.__.__pathForRender : this.__.path;
7920
- if (!path) pen.set(path = []), this.__drawPathByBox(pen);
7935
+ if (!path) pen.set(path = []), this.__drawPathByBox(pen, !pathForRender);
7921
7936
  return curve ? PathConvert.toCanvasData(path, true) : path;
7922
7937
  }
7923
7938
  getPathString(curve, pathForRender, floatLength) {
@@ -7945,17 +7960,18 @@ var LeaferUI = function(exports) {
7945
7960
  }
7946
7961
  __drawPath(canvas) {
7947
7962
  canvas.beginPath();
7948
- this.__drawPathByData(canvas, this.__.path);
7963
+ this.__drawPathByData(canvas, this.__.path, true);
7949
7964
  }
7950
- __drawPathByData(drawer, data) {
7951
- data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
7965
+ __drawPathByData(drawer, data, ignoreCornerRadius) {
7966
+ data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer, ignoreCornerRadius);
7952
7967
  }
7953
- __drawPathByBox(drawer) {
7968
+ __drawPathByBox(drawer, ignoreCornerRadius) {
7954
7969
  const {x: x, y: y, width: width, height: height} = this.__layout.boxBounds;
7955
- if (this.__.cornerRadius) {
7970
+ if (this.__.cornerRadius && !ignoreCornerRadius) {
7956
7971
  const {cornerRadius: cornerRadius} = this.__;
7957
7972
  drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
7958
7973
  } else drawer.rect(x, y, width, height);
7974
+ drawer.closePath();
7959
7975
  }
7960
7976
  drawImagePlaceholder(_paint, canvas, renderOptions) {
7961
7977
  Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
@@ -8142,6 +8158,9 @@ var LeaferUI = function(exports) {
8142
8158
  get layoutLocked() {
8143
8159
  return !this.layouter.running;
8144
8160
  }
8161
+ get view() {
8162
+ return this.canvas && this.canvas.view;
8163
+ }
8145
8164
  get FPS() {
8146
8165
  return this.renderer ? this.renderer.FPS : 60;
8147
8166
  }
@@ -8193,7 +8212,6 @@ var LeaferUI = function(exports) {
8193
8212
  this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
8194
8213
  if (this.isApp) this.__setApp();
8195
8214
  this.__checkAutoLayout();
8196
- this.view = canvas.view;
8197
8215
  if (!parentApp) {
8198
8216
  this.selector = Creator.selector(this);
8199
8217
  this.interaction = Creator.interaction(this, canvas, this.selector, config);
@@ -8473,7 +8491,7 @@ var LeaferUI = function(exports) {
8473
8491
  if (this.canvasManager) this.canvasManager.destroy();
8474
8492
  }
8475
8493
  if (this.canvas) this.canvas.destroy();
8476
- this.config.view = this.view = this.parentApp = null;
8494
+ this.config.view = this.parentApp = null;
8477
8495
  if (this.userConfig) this.userConfig.view = null;
8478
8496
  super.destroy();
8479
8497
  setTimeout(() => {
@@ -8625,7 +8643,6 @@ var LeaferUI = function(exports) {
8625
8643
  if (startAngle || endAngle) {
8626
8644
  if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
8627
8645
  ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
8628
- if (innerRadius < 1) closePath$2(path);
8629
8646
  } else {
8630
8647
  if (innerRadius < 1) {
8631
8648
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
@@ -8633,16 +8650,16 @@ var LeaferUI = function(exports) {
8633
8650
  }
8634
8651
  ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
8635
8652
  }
8636
- if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
8637
8653
  } else {
8638
8654
  if (startAngle || endAngle) {
8639
8655
  moveTo$3(path, rx, ry);
8640
8656
  ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
8641
- closePath$2(path);
8642
8657
  } else {
8643
8658
  ellipse(path, rx, ry, rx, ry);
8644
8659
  }
8645
8660
  }
8661
+ closePath$2(path);
8662
+ if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
8646
8663
  }
8647
8664
  };
8648
8665
  __decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
@@ -9397,6 +9414,7 @@ var LeaferUI = function(exports) {
9397
9414
  exports.MoveEvent.BEFORE_MOVE = "move.before_move";
9398
9415
  exports.MoveEvent.START = "move.start";
9399
9416
  exports.MoveEvent.MOVE = "move";
9417
+ exports.MoveEvent.DRAG_ANIMATE = "move.drag_animate";
9400
9418
  exports.MoveEvent.END = "move.end";
9401
9419
  exports.MoveEvent = __decorate([ registerUIEvent() ], exports.MoveEvent);
9402
9420
  exports.TouchEvent = class TouchEvent extends UIEvent {};
@@ -9464,6 +9482,7 @@ var LeaferUI = function(exports) {
9464
9482
  ctrlKey: e.ctrlKey,
9465
9483
  shiftKey: e.shiftKey,
9466
9484
  metaKey: e.metaKey,
9485
+ time: Date.now(),
9467
9486
  buttons: isUndefined(e.buttons) ? 1 : e.buttons === 0 ? pointerUpButtons : e.buttons,
9468
9487
  origin: e
9469
9488
  };
@@ -9495,6 +9514,7 @@ var LeaferUI = function(exports) {
9495
9514
  const {getDragEventData: getDragEventData, getDropEventData: getDropEventData, getSwipeEventData: getSwipeEventData} = InteractionHelper;
9496
9515
  class Dragger {
9497
9516
  constructor(interaction) {
9517
+ this.dragDataList = [];
9498
9518
  this.interaction = interaction;
9499
9519
  }
9500
9520
  setDragData(data) {
@@ -9557,6 +9577,7 @@ var LeaferUI = function(exports) {
9557
9577
  this.dragData = getDragEventData(downData, dragData, data);
9558
9578
  if (throughPath) this.dragData.throughPath = throughPath;
9559
9579
  this.dragData.path = path;
9580
+ this.dragDataList.push(this.dragData);
9560
9581
  if (this.moving) {
9561
9582
  data.moving = true;
9562
9583
  this.dragData.moveType = "drag";
@@ -9607,9 +9628,9 @@ var LeaferUI = function(exports) {
9607
9628
  interaction.emit(exports.DragEvent.ENTER, data, path, dragEnterPath);
9608
9629
  this.dragEnterPath = path;
9609
9630
  }
9610
- dragEnd(data, speed) {
9631
+ dragEnd(data) {
9611
9632
  if (!this.dragging && !this.moving) return;
9612
- if (this.checkDragEndAnimate(data, speed)) return;
9633
+ if (this.checkDragEndAnimate(data)) return;
9613
9634
  this.dragEndReal(data);
9614
9635
  }
9615
9636
  dragEndReal(data) {
@@ -9651,11 +9672,13 @@ var LeaferUI = function(exports) {
9651
9672
  }
9652
9673
  dragReset() {
9653
9674
  exports.DragEvent.list = exports.DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9675
+ this.dragDataList = [];
9654
9676
  }
9655
9677
  checkDragEndAnimate(_data, _speed) {
9656
9678
  return false;
9657
9679
  }
9658
9680
  animate(_func, _off) {}
9681
+ stopAnimate() {}
9659
9682
  checkDragOut(_data) {}
9660
9683
  autoMoveOnDragOut(_data) {}
9661
9684
  autoMoveCancel() {}
@@ -10040,6 +10063,9 @@ var LeaferUI = function(exports) {
10040
10063
  this.pointerHover(hoverData);
10041
10064
  }
10042
10065
  }
10066
+ stopDragAnimate() {
10067
+ this.dragger.stopAnimate();
10068
+ }
10043
10069
  updateDownData(data, options, merge) {
10044
10070
  const {downData: downData} = this;
10045
10071
  if (!data && downData) data = downData;
@@ -10218,14 +10244,13 @@ var LeaferUI = function(exports) {
10218
10244
  Platform.getSelector = function(leaf) {
10219
10245
  return leaf.leafer ? leaf.leafer.selector : Platform.selector || (Platform.selector = Creator.selector());
10220
10246
  };
10221
- const {toInnerRadiusPointOf: toInnerRadiusPointOf, copy: copy$2, setRadius: setRadius} = PointHelper;
10247
+ const {toInnerRadiusPointOf: toInnerRadiusPointOf, copyRadiusPoint: copyRadiusPoint} = PointHelper;
10222
10248
  const {hitRadiusPoint: hitRadiusPoint, hitPoint: hitPoint} = BoundsHelper;
10223
10249
  const inner = {}, worldRadiusPoint = {};
10224
10250
  const leaf = exports.Leaf.prototype;
10225
10251
  leaf.hit = function(worldPoint, hitRadius = 0) {
10226
10252
  this.updateLayout();
10227
- copy$2(worldRadiusPoint, worldPoint);
10228
- setRadius(worldRadiusPoint, hitRadius);
10253
+ copyRadiusPoint(worldRadiusPoint, worldPoint, hitRadius);
10229
10254
  const world = this.__world;
10230
10255
  if (hitRadius ? !hitRadiusPoint(world, worldRadiusPoint) : !hitPoint(world, worldRadiusPoint)) return false;
10231
10256
  return this.isBranch ? Platform.getSelector(this).hitPoint(Object.assign({}, worldRadiusPoint), hitRadius, {
@@ -10238,8 +10263,8 @@ var LeaferUI = function(exports) {
10238
10263
  const world = this.__world, layout = this.__layout;
10239
10264
  const isSmall = world.width < 10 && world.height < 10;
10240
10265
  if (data.hitRadius) {
10241
- copy$2(inner, point), point = inner;
10242
- setRadius(point, data.hitRadius);
10266
+ copyRadiusPoint(inner, point, data.hitRadius);
10267
+ point = inner;
10243
10268
  }
10244
10269
  toInnerRadiusPointOf(point, world, inner);
10245
10270
  if (data.hitBox || isSmall) {
@@ -10981,10 +11006,12 @@ var LeaferUI = function(exports) {
10981
11006
  function createPatternTask(paint, ui, canvas, renderOptions) {
10982
11007
  if (!paint.patternTask) {
10983
11008
  paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
10984
- paint.patternTask = null;
10985
- if (canvas.bounds.hit(ui.__nowWorld)) PaintImage.createPattern(paint, ui, canvas, renderOptions);
11009
+ PaintImage.createPattern(paint, ui, canvas, renderOptions);
10986
11010
  ui.forceUpdate("surface");
10987
- }), 300);
11011
+ }), 0, () => {
11012
+ paint.patternTask = null;
11013
+ return canvas.bounds.hit(ui.__nowWorld);
11014
+ });
10988
11015
  }
10989
11016
  }
10990
11017
  function createPattern(paint, ui, canvas, renderOptions) {
@@ -12088,7 +12115,7 @@ var LeaferUI = function(exports) {
12088
12115
  exports.surfaceType = surfaceType;
12089
12116
  exports.tempBounds = tempBounds$2;
12090
12117
  exports.tempMatrix = tempMatrix$2;
12091
- exports.tempPoint = tempPoint$2;
12118
+ exports.tempPoint = tempPoint$3;
12092
12119
  exports.tryToNumber = tryToNumber;
12093
12120
  exports.useCanvas = useCanvas;
12094
12121
  exports.useModule = useModule;