@leafer-draw/worker 1.9.9 → 1.9.11

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.
@@ -263,7 +263,7 @@ const FourNumberHelper = {
263
263
  return to;
264
264
  },
265
265
  setTemp(top, right, bottom, left) {
266
- return set$1(tempFour, top, right, bottom, left);
266
+ return set$2(tempFour, top, right, bottom, left);
267
267
  },
268
268
  toTempAB(a, b, change) {
269
269
  tempTo = change ? isNumber(a) ? b : a : [];
@@ -303,22 +303,22 @@ const FourNumberHelper = {
303
303
  max(t, other, change) {
304
304
  if (isNumber(t) && isNumber(other)) return max$4(t, other);
305
305
  toTempAB(t, other, change);
306
- return set$1(tempTo, max$4(tempA[0], tempB[0]), max$4(tempA[1], tempB[1]), max$4(tempA[2], tempB[2]), max$4(tempA[3], tempB[3]));
306
+ return set$2(tempTo, max$4(tempA[0], tempB[0]), max$4(tempA[1], tempB[1]), max$4(tempA[2], tempB[2]), max$4(tempA[3], tempB[3]));
307
307
  },
308
308
  add(t, other, change) {
309
309
  if (isNumber(t) && isNumber(other)) return t + other;
310
310
  toTempAB(t, other, change);
311
- return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
311
+ return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
312
312
  },
313
313
  swapAndScale(t, scaleX, scaleY, change) {
314
314
  if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
315
315
  const to = change ? t : [];
316
316
  const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
317
- return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
317
+ return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
318
318
  }
319
319
  };
320
320
 
321
- const {set: set$1, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
321
+ const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
322
322
 
323
323
  const {round: round$3, pow: pow$1, PI: PI$3} = Math;
324
324
 
@@ -418,7 +418,7 @@ function getMatrixData() {
418
418
 
419
419
  const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
420
420
 
421
- const {float: float$2} = MathHelper;
421
+ const {float: float$1} = MathHelper;
422
422
 
423
423
  const tempPoint$3 = {};
424
424
 
@@ -669,12 +669,12 @@ const MatrixHelper = {
669
669
  const cosR = c / scaleY;
670
670
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
671
671
  }
672
- const cosR = float$2(cos$5(rotation));
672
+ const cosR = float$1(cos$5(rotation));
673
673
  const sinR = sin$5(rotation);
674
- scaleX = float$2(scaleX), scaleY = float$2(scaleY);
675
- skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
676
- skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
677
- rotation = float$2(rotation / OneRadian);
674
+ scaleX = float$1(scaleX), scaleY = float$1(scaleY);
675
+ skewX = cosR ? float$1((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
676
+ skewY = cosR ? float$1((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
677
+ rotation = float$1(rotation / OneRadian);
678
678
  } else {
679
679
  scaleX = a;
680
680
  scaleY = d;
@@ -720,7 +720,7 @@ const M$6 = MatrixHelper;
720
720
 
721
721
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
722
722
 
723
- const {sin: sin$4, cos: cos$4, abs: abs$3, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
723
+ const {sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
724
724
 
725
725
  const PointHelper = {
726
726
  defaultPoint: getPointData(),
@@ -813,8 +813,8 @@ const PointHelper = {
813
813
  return getDistanceFrom(t.x, t.y, point.x, point.y);
814
814
  },
815
815
  getDistanceFrom(x1, y1, x2, y2) {
816
- const x = abs$3(x2 - x1);
817
- const y = abs$3(y2 - y1);
816
+ const x = abs$4(x2 - x1);
817
+ const y = abs$4(y2 - y1);
818
818
  return sqrt$2(x * x + y * y);
819
819
  },
820
820
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
@@ -1200,7 +1200,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPo
1200
1200
 
1201
1201
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1202
1202
 
1203
- const {float: float$1, fourNumber: fourNumber} = MathHelper;
1203
+ const {float: float, fourNumber: fourNumber} = MathHelper;
1204
1204
 
1205
1205
  const {floor: floor$2, ceil: ceil$2} = Math;
1206
1206
 
@@ -1375,10 +1375,10 @@ const BoundsHelper = {
1375
1375
  }
1376
1376
  },
1377
1377
  float(t, maxLength) {
1378
- t.x = float$1(t.x, maxLength);
1379
- t.y = float$1(t.y, maxLength);
1380
- t.width = float$1(t.width, maxLength);
1381
- t.height = float$1(t.height, maxLength);
1378
+ t.x = float(t.x, maxLength);
1379
+ t.y = float(t.y, maxLength);
1380
+ t.width = float(t.width, maxLength);
1381
+ t.height = float(t.height, maxLength);
1382
1382
  },
1383
1383
  add(t, bounds, isPoint) {
1384
1384
  right$1 = t.x + t.width;
@@ -1714,17 +1714,17 @@ class Debug {
1714
1714
  showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
1715
1715
  }
1716
1716
  log(...messages) {
1717
- if (D$5.enable) {
1718
- if (D$5.filterList.length && D$5.filterList.every(name => name !== this.name)) return;
1719
- if (D$5.excludeList.length && D$5.excludeList.some(name => name === this.name)) return;
1717
+ if (D$4.enable) {
1718
+ if (D$4.filterList.length && D$4.filterList.every(name => name !== this.name)) return;
1719
+ if (D$4.excludeList.length && D$4.excludeList.some(name => name === this.name)) return;
1720
1720
  console.log("%c" + this.name, "color:#21ae62", ...messages);
1721
1721
  }
1722
1722
  }
1723
1723
  tip(...messages) {
1724
- if (D$5.enable) this.warn(...messages);
1724
+ if (D$4.enable) this.warn(...messages);
1725
1725
  }
1726
1726
  warn(...messages) {
1727
- if (D$5.showWarn) console.warn(this.name, ...messages);
1727
+ if (D$4.showWarn) console.warn(this.name, ...messages);
1728
1728
  }
1729
1729
  repeat(name, ...messages) {
1730
1730
  if (!this.repeatMap[name]) {
@@ -1752,7 +1752,7 @@ function getNameList(name) {
1752
1752
  return name;
1753
1753
  }
1754
1754
 
1755
- const D$5 = Debug;
1755
+ const D$4 = Debug;
1756
1756
 
1757
1757
  const debug$e = Debug.get("RunTime");
1758
1758
 
@@ -2592,11 +2592,11 @@ const RectHelper = {
2592
2592
  }
2593
2593
  };
2594
2594
 
2595
- const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
2595
+ const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
2596
2596
 
2597
2597
  const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
2598
2598
 
2599
- const {set: set, toNumberPoints: toNumberPoints} = PointHelper;
2599
+ const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
2600
2600
 
2601
2601
  const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
2602
2602
 
@@ -2667,14 +2667,14 @@ const BezierHelper = {
2667
2667
  const lenCB = hypot(CBx, CBy);
2668
2668
  let totalRadian = endRadian - startRadian;
2669
2669
  if (totalRadian < 0) totalRadian += PI2;
2670
- if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$2(totalRadian - PI$2) < 1e-12) {
2670
+ if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$3(totalRadian - PI$2) < 1e-12) {
2671
2671
  if (data) data.push(L$6, x1, y1);
2672
2672
  if (setPointBounds) {
2673
2673
  setPoint$1(setPointBounds, fromX, fromY);
2674
2674
  addPoint$1(setPointBounds, x1, y1);
2675
2675
  }
2676
- if (setStartPoint) set(setStartPoint, fromX, fromY);
2677
- if (setEndPoint) set(setEndPoint, x1, y1);
2676
+ if (setStartPoint) set$1(setStartPoint, fromX, fromY);
2677
+ if (setEndPoint) set$1(setEndPoint, x1, y1);
2678
2678
  return;
2679
2679
  }
2680
2680
  const anticlockwise = BAx * CBy - CBx * BAy < 0;
@@ -2700,7 +2700,7 @@ const BezierHelper = {
2700
2700
  let totalRadian = endRadian - startRadian;
2701
2701
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2702
2702
  if (anticlockwise) totalRadian -= PI2;
2703
- const parts = ceil$1(abs$2(totalRadian / PI_2));
2703
+ const parts = ceil$1(abs$3(totalRadian / PI_2));
2704
2704
  const partRadian = totalRadian / parts;
2705
2705
  const partRadian4Sin = sin$3(partRadian / 4);
2706
2706
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
@@ -2714,7 +2714,7 @@ const BezierHelper = {
2714
2714
  let fromX = cx + x, fromY = cy + y;
2715
2715
  if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
2716
2716
  if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
2717
- if (setStartPoint) set(setStartPoint, fromX, fromY);
2717
+ if (setStartPoint) set$1(setStartPoint, fromX, fromY);
2718
2718
  for (let i = 0; i < parts; i++) {
2719
2719
  endCos = cos$3(endRadian);
2720
2720
  endSin = sin$3(endRadian);
@@ -2733,7 +2733,7 @@ const BezierHelper = {
2733
2733
  startRadian = endRadian;
2734
2734
  endRadian += partRadian;
2735
2735
  }
2736
- if (setEndPoint) set(setEndPoint, cx + x, cy + y);
2736
+ if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
2737
2737
  },
2738
2738
  quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
2739
2739
  data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
@@ -2842,7 +2842,7 @@ const EllipseHelper = {
2842
2842
  }
2843
2843
  };
2844
2844
 
2845
- const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
2845
+ const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
2846
2846
 
2847
2847
  const {rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2848
2848
 
@@ -3062,7 +3062,7 @@ const PathConvert = {
3062
3062
  i += 5;
3063
3063
  break;
3064
3064
 
3065
- case D$4:
3065
+ case D$3:
3066
3066
  x = old[i + 1];
3067
3067
  y = old[i + 2];
3068
3068
  curveMode ? roundRect$2(data, x, y, old[i + 3], old[i + 4], [ old[i + 5], old[i + 6], old[i + 7], old[i + 8] ]) : copyData(data, old, i, 9);
@@ -3163,11 +3163,11 @@ const PathConvert = {
3163
3163
 
3164
3164
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
3165
3165
 
3166
- const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
3166
+ const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
3167
3167
 
3168
3168
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3169
3169
 
3170
- const {tan: tan, min: min, abs: abs$1} = Math;
3170
+ const {tan: tan, min: min, abs: abs$2} = Math;
3171
3171
 
3172
3172
  const startPoint = {};
3173
3173
 
@@ -3199,7 +3199,7 @@ const PathCommandDataHelper = {
3199
3199
  } else {
3200
3200
  const fourCorners = MathHelper.fourNumber(cornerRadius);
3201
3201
  if (fourCorners) {
3202
- data.push(D$3, x, y, width, height, ...fourCorners);
3202
+ data.push(D$2, x, y, width, height, ...fourCorners);
3203
3203
  } else {
3204
3204
  data.push(N$2, x, y, width, height);
3205
3205
  }
@@ -3225,7 +3225,7 @@ const PathCommandDataHelper = {
3225
3225
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3226
3226
  if (!isUndefined(lastX)) {
3227
3227
  const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3228
- radius = min(radius, min(d / 2, d / 2 * abs$1(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3228
+ radius = min(radius, min(d / 2, d / 2 * abs$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3229
3229
  }
3230
3230
  data.push(U$2, x1, y1, x2, y2, radius);
3231
3231
  },
@@ -3338,7 +3338,7 @@ class PathCreator {
3338
3338
  paint() {}
3339
3339
  }
3340
3340
 
3341
- const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$2, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
3341
+ const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
3342
3342
 
3343
3343
  const debug$a = Debug.get("PathDrawer");
3344
3344
 
@@ -3380,7 +3380,7 @@ const PathDrawer = {
3380
3380
  i += 5;
3381
3381
  break;
3382
3382
 
3383
- case D$2:
3383
+ case D$1:
3384
3384
  drawer.roundRect(data[i + 1], data[i + 2], data[i + 3], data[i + 4], [ data[i + 5], data[i + 6], data[i + 7], data[i + 8] ]);
3385
3385
  i += 9;
3386
3386
  break;
@@ -3423,7 +3423,7 @@ const PathDrawer = {
3423
3423
  }
3424
3424
  };
3425
3425
 
3426
- 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;
3426
+ const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
3427
3427
 
3428
3428
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3429
3429
 
@@ -3499,12 +3499,12 @@ const PathBounds = {
3499
3499
  i += 5;
3500
3500
  break;
3501
3501
 
3502
- case D$1:
3502
+ case D:
3503
3503
  case X:
3504
3504
  x = data[i + 1];
3505
3505
  y = data[i + 2];
3506
3506
  addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
3507
- i += command === D$1 ? 9 : 6;
3507
+ i += command === D ? 9 : 6;
3508
3508
  break;
3509
3509
 
3510
3510
  case G:
@@ -3840,7 +3840,12 @@ class TaskProcessor {
3840
3840
  runTask() {
3841
3841
  const task = this.list[this.index];
3842
3842
  if (!task) {
3843
- this.nextTask();
3843
+ this.timer = setTimeout(() => this.nextTask());
3844
+ return;
3845
+ }
3846
+ if (task.isCancel) {
3847
+ this.index++;
3848
+ this.runTask();
3844
3849
  return;
3845
3850
  }
3846
3851
  task.run().then(() => {
@@ -3871,16 +3876,15 @@ class TaskProcessor {
3871
3876
  }
3872
3877
  setParallelList() {
3873
3878
  let task;
3879
+ const {config: config, list: list, index: index} = this;
3874
3880
  this.parallelList = [];
3875
3881
  this.parallelSuccessNumber = 0;
3876
- let end = this.index + this.config.parallel;
3877
- if (end > this.list.length) end = this.list.length;
3878
- for (let i = this.index; i < end; i++) {
3879
- task = this.list[i];
3880
- if (task.parallel) {
3881
- this.parallelList.push(task);
3882
- } else {
3883
- break;
3882
+ let end = index + config.parallel;
3883
+ if (end > list.length) end = list.length;
3884
+ if (config.parallel > 1) {
3885
+ for (let i = index; i < end; i++) {
3886
+ task = list[i];
3887
+ if (task.parallel) this.parallelList.push(task); else break;
3884
3888
  }
3885
3889
  }
3886
3890
  }
@@ -6815,7 +6819,7 @@ class LeafLevelList {
6815
6819
  }
6816
6820
  }
6817
6821
 
6818
- const version = "1.9.9";
6822
+ const version = "1.9.11";
6819
6823
 
6820
6824
  class LeaferCanvas extends LeaferCanvasBase {
6821
6825
  get allowBackgroundColor() {
@@ -7850,12 +7854,12 @@ class ImageData extends RectData {
7850
7854
  }
7851
7855
  __getData() {
7852
7856
  const data = super.__getData();
7853
- delete data.fill;
7857
+ if (data.url) delete data.fill;
7854
7858
  return data;
7855
7859
  }
7856
7860
  __getInputData(names, options) {
7857
7861
  const data = super.__getInputData(names, options);
7858
- delete data.fill;
7862
+ if (data.url) delete data.fill;
7859
7863
  return data;
7860
7864
  }
7861
7865
  }
@@ -7912,74 +7916,6 @@ const UIBounds = {
7912
7916
  }
7913
7917
  };
7914
7918
 
7915
- const {float: float} = MathHelper;
7916
-
7917
- const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
7918
-
7919
- const DragBoundsHelper = {
7920
- limitMove(leaf, move) {
7921
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7922
- if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
7923
- D.axisMove(leaf, move);
7924
- },
7925
- limitScaleOf(leaf, origin, scale) {
7926
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7927
- if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
7928
- },
7929
- axisMove(leaf, move) {
7930
- const {draggable: draggable} = leaf;
7931
- if (draggable === "x") move.y = 0;
7932
- if (draggable === "y") move.x = 0;
7933
- },
7934
- getDragBounds(leaf) {
7935
- const {dragBounds: dragBounds} = leaf;
7936
- return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
7937
- },
7938
- isInnerMode(content, dragBounds, dragBoundsType, sideType) {
7939
- return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
7940
- },
7941
- getValidMove(content, dragBounds, dragBoundsType, move, change) {
7942
- const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7943
- const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7944
- if (!change) move = Object.assign({}, move);
7945
- if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7946
- if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7947
- } else {
7948
- if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
7949
- }
7950
- if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7951
- if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
7952
- } else {
7953
- if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
7954
- }
7955
- move.x = float(move.x);
7956
- move.y = float(move.y);
7957
- return move;
7958
- },
7959
- getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
7960
- if (!change) scale = Object.assign({}, scale);
7961
- let fitScaleX, fitScaleY;
7962
- tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
7963
- tempMerge.set(tempContent).add(dragBounds);
7964
- tempIntersect.set(tempContent).intersect(dragBounds);
7965
- if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7966
- fitScaleX = tempMerge.width / tempContent.width;
7967
- } else {
7968
- fitScaleX = tempIntersect.width / tempContent.width;
7969
- }
7970
- if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7971
- fitScaleY = tempMerge.height / tempContent.height;
7972
- } else {
7973
- fitScaleY = tempIntersect.height / tempContent.height;
7974
- }
7975
- scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
7976
- scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
7977
- return scale;
7978
- }
7979
- };
7980
-
7981
- const D = DragBoundsHelper;
7982
-
7983
7919
  const {stintSet: stintSet$1} = DataHelper;
7984
7920
 
7985
7921
  const UIRender = {
@@ -9800,7 +9736,14 @@ const PaintModule = {
9800
9736
 
9801
9737
  let origin = {}, tempMatrix$1 = getMatrixData();
9802
9738
 
9803
- const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
9739
+ const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
9740
+
9741
+ function stretchMode(data, box, scaleX, scaleY) {
9742
+ const transform = get$3();
9743
+ translate$1(transform, box.x, box.y);
9744
+ if (scaleX) scaleHelper(transform, scaleX, scaleY);
9745
+ data.transform = transform;
9746
+ }
9804
9747
 
9805
9748
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
9806
9749
  const transform = get$3();
@@ -9817,8 +9760,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
9817
9760
  const transform = get$3();
9818
9761
  layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
9819
9762
  if (clipScaleX) {
9820
- tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
9821
- multiplyParent(transform, tempMatrix$1);
9763
+ if (rotation || skew) {
9764
+ set(tempMatrix$1);
9765
+ scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
9766
+ multiplyParent(transform, tempMatrix$1);
9767
+ } else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
9822
9768
  }
9823
9769
  data.transform = transform;
9824
9770
  }
@@ -9914,7 +9860,10 @@ function getPatternData(paint, box, image) {
9914
9860
  if (offset) PointHelper.move(tempImage, offset);
9915
9861
  switch (mode) {
9916
9862
  case "stretch":
9917
- if (!sameBox) width = box.width, height = box.height;
9863
+ if (!sameBox) {
9864
+ scaleX = box.width / width, scaleY = box.height / height;
9865
+ stretchMode(data, box, scaleX, scaleY);
9866
+ }
9918
9867
  break;
9919
9868
 
9920
9869
  case "normal":
@@ -9923,7 +9872,7 @@ function getPatternData(paint, box, image) {
9923
9872
  let clipScaleX, clipScaleY;
9924
9873
  if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
9925
9874
  clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
9926
- if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
9875
+ if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
9927
9876
  }
9928
9877
  break;
9929
9878
 
@@ -9940,17 +9889,14 @@ function getPatternData(paint, box, image) {
9940
9889
  if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
9941
9890
  }
9942
9891
  if (!data.transform) {
9943
- if (box.x || box.y) {
9944
- data.transform = get$2();
9945
- translate(data.transform, box.x, box.y);
9946
- }
9892
+ if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
9947
9893
  }
9948
- if (scaleX && mode !== "stretch") {
9894
+ data.width = width;
9895
+ data.height = height;
9896
+ if (scaleX) {
9949
9897
  data.scaleX = scaleX;
9950
9898
  data.scaleY = scaleY;
9951
9899
  }
9952
- data.width = width;
9953
- data.height = height;
9954
9900
  if (opacity) data.opacity = opacity;
9955
9901
  if (filters) data.filters = filters;
9956
9902
  if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
@@ -10082,7 +10028,7 @@ function ignoreRender(ui, value) {
10082
10028
 
10083
10029
  const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
10084
10030
 
10085
- const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
10031
+ const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
10086
10032
 
10087
10033
  function createPattern(ui, paint, pixelRatio) {
10088
10034
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
@@ -10093,8 +10039,8 @@ function createPattern(ui, paint, pixelRatio) {
10093
10039
  scaleX *= pixelRatio;
10094
10040
  scaleY *= pixelRatio;
10095
10041
  if (sx) {
10096
- sx = abs(sx);
10097
- sy = abs(sy);
10042
+ sx = abs$1(sx);
10043
+ sy = abs$1(sy);
10098
10044
  imageMatrix = get$1();
10099
10045
  copy$1(imageMatrix, transform);
10100
10046
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -10236,6 +10182,7 @@ const PaintImageModule = {
10236
10182
  recycleImage: recycleImage,
10237
10183
  createData: createData,
10238
10184
  getPatternData: getPatternData,
10185
+ stretchMode: stretchMode,
10239
10186
  fillOrFitMode: fillOrFitMode,
10240
10187
  clipMode: clipMode,
10241
10188
  repeatMode: repeatMode
@@ -10346,7 +10293,7 @@ const PaintGradientModule = {
10346
10293
  getTransform: getTransform
10347
10294
  };
10348
10295
 
10349
- const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
10296
+ const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
10350
10297
 
10351
10298
  const tempBounds = {}, tempMatrix = new Matrix;
10352
10299
 
@@ -10390,7 +10337,7 @@ function shadow(ui, current, shape) {
10390
10337
  function getShadowRenderSpread(_ui, shadow) {
10391
10338
  let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
10392
10339
  shadow.forEach(item => {
10393
- x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
10340
+ x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
10394
10341
  top = max(top, spread + blur - y);
10395
10342
  right = max(right, spread + blur + x);
10396
10343
  bottom = max(bottom, spread + blur + y);
@@ -10401,11 +10348,11 @@ function getShadowRenderSpread(_ui, shadow) {
10401
10348
 
10402
10349
  function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
10403
10350
  if (shadow.spread) {
10404
- const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
10351
+ const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
10405
10352
  tempMatrix.set().scaleOfOuter({
10406
10353
  x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
10407
10354
  y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
10408
- }, spreadScale);
10355
+ }, 1 + spread / width, 1 + spread / height);
10409
10356
  return tempMatrix;
10410
10357
  }
10411
10358
  return undefined;
@@ -11109,4 +11056,4 @@ Object.assign(Effect, EffectModule);
11109
11056
 
11110
11057
  useCanvas();
11111
11058
 
11112
- export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
11059
+ export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };