leafer-draw 1.9.8 → 1.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -243,7 +243,7 @@ var LeaferUI = function(exports) {
243
243
  return to;
244
244
  },
245
245
  setTemp(top, right, bottom, left) {
246
- return set$1(tempFour, top, right, bottom, left);
246
+ return set$2(tempFour, top, right, bottom, left);
247
247
  },
248
248
  toTempAB(a, b, change) {
249
249
  tempTo = change ? isNumber(a) ? b : a : [];
@@ -283,21 +283,21 @@ var LeaferUI = function(exports) {
283
283
  max(t, other, change) {
284
284
  if (isNumber(t) && isNumber(other)) return max$4(t, other);
285
285
  toTempAB(t, other, change);
286
- 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]));
286
+ 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]));
287
287
  },
288
288
  add(t, other, change) {
289
289
  if (isNumber(t) && isNumber(other)) return t + other;
290
290
  toTempAB(t, other, change);
291
- return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
291
+ return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
292
292
  },
293
293
  swapAndScale(t, scaleX, scaleY, change) {
294
294
  if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
295
295
  const to = change ? t : [];
296
296
  const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
297
- return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
297
+ return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
298
298
  }
299
299
  };
300
- const {set: set$1, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
300
+ const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
301
301
  const {round: round$3, pow: pow$1, PI: PI$3} = Math;
302
302
  const MathHelper = {
303
303
  within(value, min, max) {
@@ -386,7 +386,7 @@ var LeaferUI = function(exports) {
386
386
  };
387
387
  }
388
388
  const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
389
- const {float: float$2} = MathHelper;
389
+ const {float: float$1} = MathHelper;
390
390
  const tempPoint$3 = {};
391
391
  function getWorld() {
392
392
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
@@ -634,12 +634,12 @@ var LeaferUI = function(exports) {
634
634
  const cosR = c / scaleY;
635
635
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
636
636
  }
637
- const cosR = float$2(cos$5(rotation));
637
+ const cosR = float$1(cos$5(rotation));
638
638
  const sinR = sin$5(rotation);
639
- scaleX = float$2(scaleX), scaleY = float$2(scaleY);
640
- skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
641
- skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
642
- rotation = float$2(rotation / OneRadian);
639
+ scaleX = float$1(scaleX), scaleY = float$1(scaleY);
640
+ skewX = cosR ? float$1((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
641
+ skewY = cosR ? float$1((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
642
+ rotation = float$1(rotation / OneRadian);
643
643
  } else {
644
644
  scaleX = a;
645
645
  scaleY = d;
@@ -682,7 +682,7 @@ var LeaferUI = function(exports) {
682
682
  };
683
683
  const M$6 = MatrixHelper;
684
684
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
685
- const {sin: sin$4, cos: cos$4, abs: abs$3, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
685
+ const {sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
686
686
  const PointHelper = {
687
687
  defaultPoint: getPointData(),
688
688
  tempPoint: {},
@@ -774,8 +774,8 @@ var LeaferUI = function(exports) {
774
774
  return getDistanceFrom(t.x, t.y, point.x, point.y);
775
775
  },
776
776
  getDistanceFrom(x1, y1, x2, y2) {
777
- const x = abs$3(x2 - x1);
778
- const y = abs$3(y2 - y1);
777
+ const x = abs$4(x2 - x1);
778
+ const y = abs$4(y2 - y1);
779
779
  return sqrt$2(x * x + y * y);
780
780
  },
781
781
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
@@ -1140,7 +1140,7 @@ var LeaferUI = function(exports) {
1140
1140
  };
1141
1141
  const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
1142
1142
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1143
- const {float: float$1, fourNumber: fourNumber} = MathHelper;
1143
+ const {float: float, fourNumber: fourNumber} = MathHelper;
1144
1144
  const {floor: floor$2, ceil: ceil$2} = Math;
1145
1145
  let right$1, bottom$1, boundsRight, boundsBottom;
1146
1146
  const point = {};
@@ -1309,10 +1309,10 @@ var LeaferUI = function(exports) {
1309
1309
  }
1310
1310
  },
1311
1311
  float(t, maxLength) {
1312
- t.x = float$1(t.x, maxLength);
1313
- t.y = float$1(t.y, maxLength);
1314
- t.width = float$1(t.width, maxLength);
1315
- t.height = float$1(t.height, maxLength);
1312
+ t.x = float(t.x, maxLength);
1313
+ t.y = float(t.y, maxLength);
1314
+ t.width = float(t.width, maxLength);
1315
+ t.height = float(t.height, maxLength);
1316
1316
  },
1317
1317
  add(t, bounds, isPoint) {
1318
1318
  right$1 = t.x + t.width;
@@ -1640,17 +1640,17 @@ var LeaferUI = function(exports) {
1640
1640
  showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
1641
1641
  }
1642
1642
  log(...messages) {
1643
- if (D$5.enable) {
1644
- if (D$5.filterList.length && D$5.filterList.every(name => name !== this.name)) return;
1645
- if (D$5.excludeList.length && D$5.excludeList.some(name => name === this.name)) return;
1643
+ if (D$4.enable) {
1644
+ if (D$4.filterList.length && D$4.filterList.every(name => name !== this.name)) return;
1645
+ if (D$4.excludeList.length && D$4.excludeList.some(name => name === this.name)) return;
1646
1646
  console.log("%c" + this.name, "color:#21ae62", ...messages);
1647
1647
  }
1648
1648
  }
1649
1649
  tip(...messages) {
1650
- if (D$5.enable) this.warn(...messages);
1650
+ if (D$4.enable) this.warn(...messages);
1651
1651
  }
1652
1652
  warn(...messages) {
1653
- if (D$5.showWarn) console.warn(this.name, ...messages);
1653
+ if (D$4.showWarn) console.warn(this.name, ...messages);
1654
1654
  }
1655
1655
  repeat(name, ...messages) {
1656
1656
  if (!this.repeatMap[name]) {
@@ -1673,7 +1673,7 @@ var LeaferUI = function(exports) {
1673
1673
  if (!name) name = []; else if (isString(name)) name = [ name ];
1674
1674
  return name;
1675
1675
  }
1676
- const D$5 = Debug;
1676
+ const D$4 = Debug;
1677
1677
  const debug$f = Debug.get("RunTime");
1678
1678
  const Run = {
1679
1679
  currentId: 0,
@@ -2417,9 +2417,9 @@ var LeaferUI = function(exports) {
2417
2417
  data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
2418
2418
  }
2419
2419
  };
2420
- 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;
2420
+ 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;
2421
2421
  const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
2422
- const {set: set, toNumberPoints: toNumberPoints} = PointHelper;
2422
+ const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
2423
2423
  const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
2424
2424
  const tempPoint$1 = {};
2425
2425
  const BezierHelper = {
@@ -2487,14 +2487,14 @@ var LeaferUI = function(exports) {
2487
2487
  const lenCB = hypot(CBx, CBy);
2488
2488
  let totalRadian = endRadian - startRadian;
2489
2489
  if (totalRadian < 0) totalRadian += PI2;
2490
- if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$2(totalRadian - PI$2) < 1e-12) {
2490
+ if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$3(totalRadian - PI$2) < 1e-12) {
2491
2491
  if (data) data.push(L$6, x1, y1);
2492
2492
  if (setPointBounds) {
2493
2493
  setPoint$1(setPointBounds, fromX, fromY);
2494
2494
  addPoint$1(setPointBounds, x1, y1);
2495
2495
  }
2496
- if (setStartPoint) set(setStartPoint, fromX, fromY);
2497
- if (setEndPoint) set(setEndPoint, x1, y1);
2496
+ if (setStartPoint) set$1(setStartPoint, fromX, fromY);
2497
+ if (setEndPoint) set$1(setEndPoint, x1, y1);
2498
2498
  return;
2499
2499
  }
2500
2500
  const anticlockwise = BAx * CBy - CBx * BAy < 0;
@@ -2520,7 +2520,7 @@ var LeaferUI = function(exports) {
2520
2520
  let totalRadian = endRadian - startRadian;
2521
2521
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2522
2522
  if (anticlockwise) totalRadian -= PI2;
2523
- const parts = ceil$1(abs$2(totalRadian / PI_2));
2523
+ const parts = ceil$1(abs$3(totalRadian / PI_2));
2524
2524
  const partRadian = totalRadian / parts;
2525
2525
  const partRadian4Sin = sin$3(partRadian / 4);
2526
2526
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
@@ -2534,7 +2534,7 @@ var LeaferUI = function(exports) {
2534
2534
  let fromX = cx + x, fromY = cy + y;
2535
2535
  if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
2536
2536
  if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
2537
- if (setStartPoint) set(setStartPoint, fromX, fromY);
2537
+ if (setStartPoint) set$1(setStartPoint, fromX, fromY);
2538
2538
  for (let i = 0; i < parts; i++) {
2539
2539
  endCos = cos$3(endRadian);
2540
2540
  endSin = sin$3(endRadian);
@@ -2553,7 +2553,7 @@ var LeaferUI = function(exports) {
2553
2553
  startRadian = endRadian;
2554
2554
  endRadian += partRadian;
2555
2555
  }
2556
- if (setEndPoint) set(setEndPoint, cx + x, cy + y);
2556
+ if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
2557
2557
  },
2558
2558
  quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
2559
2559
  data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
@@ -2657,7 +2657,7 @@ var LeaferUI = function(exports) {
2657
2657
  }
2658
2658
  }
2659
2659
  };
2660
- 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;
2660
+ 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;
2661
2661
  const {rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2662
2662
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2663
2663
  const debug$c = Debug.get("PathConvert");
@@ -2872,7 +2872,7 @@ var LeaferUI = function(exports) {
2872
2872
  i += 5;
2873
2873
  break;
2874
2874
 
2875
- case D$4:
2875
+ case D$3:
2876
2876
  x = old[i + 1];
2877
2877
  y = old[i + 2];
2878
2878
  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);
@@ -2971,9 +2971,9 @@ var LeaferUI = function(exports) {
2971
2971
  }
2972
2972
  };
2973
2973
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
2974
- 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;
2974
+ 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;
2975
2975
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
2976
- const {tan: tan, min: min, abs: abs$1} = Math;
2976
+ const {tan: tan, min: min, abs: abs$2} = Math;
2977
2977
  const startPoint = {};
2978
2978
  const PathCommandDataHelper = {
2979
2979
  beginPath(data) {
@@ -3003,7 +3003,7 @@ var LeaferUI = function(exports) {
3003
3003
  } else {
3004
3004
  const fourCorners = MathHelper.fourNumber(cornerRadius);
3005
3005
  if (fourCorners) {
3006
- data.push(D$3, x, y, width, height, ...fourCorners);
3006
+ data.push(D$2, x, y, width, height, ...fourCorners);
3007
3007
  } else {
3008
3008
  data.push(N$2, x, y, width, height);
3009
3009
  }
@@ -3029,7 +3029,7 @@ var LeaferUI = function(exports) {
3029
3029
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3030
3030
  if (!isUndefined(lastX)) {
3031
3031
  const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3032
- radius = min(radius, min(d / 2, d / 2 * abs$1(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3032
+ radius = min(radius, min(d / 2, d / 2 * abs$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3033
3033
  }
3034
3034
  data.push(U$2, x1, y1, x2, y2, radius);
3035
3035
  },
@@ -3138,7 +3138,7 @@ var LeaferUI = function(exports) {
3138
3138
  }
3139
3139
  paint() {}
3140
3140
  }
3141
- 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;
3141
+ 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;
3142
3142
  const debug$b = Debug.get("PathDrawer");
3143
3143
  const PathDrawer = {
3144
3144
  drawPathByData(drawer, data) {
@@ -3178,7 +3178,7 @@ var LeaferUI = function(exports) {
3178
3178
  i += 5;
3179
3179
  break;
3180
3180
 
3181
- case D$2:
3181
+ case D$1:
3182
3182
  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] ]);
3183
3183
  i += 9;
3184
3184
  break;
@@ -3220,7 +3220,7 @@ var LeaferUI = function(exports) {
3220
3220
  }
3221
3221
  }
3222
3222
  };
3223
- 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;
3223
+ 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;
3224
3224
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3225
3225
  const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
3226
3226
  const debug$a = Debug.get("PathBounds");
@@ -3288,12 +3288,12 @@ var LeaferUI = function(exports) {
3288
3288
  i += 5;
3289
3289
  break;
3290
3290
 
3291
- case D$1:
3291
+ case D:
3292
3292
  case X:
3293
3293
  x = data[i + 1];
3294
3294
  y = data[i + 2];
3295
3295
  addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
3296
- i += command === D$1 ? 9 : 6;
3296
+ i += command === D ? 9 : 6;
3297
3297
  break;
3298
3298
 
3299
3299
  case G:
@@ -6409,7 +6409,7 @@ var LeaferUI = function(exports) {
6409
6409
  this.levelMap = null;
6410
6410
  }
6411
6411
  }
6412
- const version = "1.9.8";
6412
+ const version = "1.9.10";
6413
6413
  const debug$4 = Debug.get("LeaferCanvas");
6414
6414
  class LeaferCanvas extends LeaferCanvasBase {
6415
6415
  set zIndex(zIndex) {
@@ -7582,12 +7582,12 @@ var LeaferUI = function(exports) {
7582
7582
  }
7583
7583
  __getData() {
7584
7584
  const data = super.__getData();
7585
- delete data.fill;
7585
+ if (data.url) delete data.fill;
7586
7586
  return data;
7587
7587
  }
7588
7588
  __getInputData(names, options) {
7589
7589
  const data = super.__getInputData(names, options);
7590
- delete data.fill;
7590
+ if (data.url) delete data.fill;
7591
7591
  return data;
7592
7592
  }
7593
7593
  }
@@ -7640,70 +7640,6 @@ var LeaferUI = function(exports) {
7640
7640
  return box ? max$2(box.__updateRenderSpread(), spread) : spread;
7641
7641
  }
7642
7642
  };
7643
- const {float: float} = MathHelper;
7644
- const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
7645
- const DragBoundsHelper = {
7646
- limitMove(leaf, move) {
7647
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7648
- if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
7649
- D.axisMove(leaf, move);
7650
- },
7651
- limitScaleOf(leaf, origin, scale) {
7652
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7653
- if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
7654
- },
7655
- axisMove(leaf, move) {
7656
- const {draggable: draggable} = leaf;
7657
- if (draggable === "x") move.y = 0;
7658
- if (draggable === "y") move.x = 0;
7659
- },
7660
- getDragBounds(leaf) {
7661
- const {dragBounds: dragBounds} = leaf;
7662
- return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
7663
- },
7664
- isInnerMode(content, dragBounds, dragBoundsType, sideType) {
7665
- return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
7666
- },
7667
- getValidMove(content, dragBounds, dragBoundsType, move, change) {
7668
- const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7669
- const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7670
- if (!change) move = Object.assign({}, move);
7671
- if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7672
- if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7673
- } else {
7674
- if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
7675
- }
7676
- if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7677
- if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
7678
- } else {
7679
- if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
7680
- }
7681
- move.x = float(move.x);
7682
- move.y = float(move.y);
7683
- return move;
7684
- },
7685
- getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
7686
- if (!change) scale = Object.assign({}, scale);
7687
- let fitScaleX, fitScaleY;
7688
- tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
7689
- tempMerge.set(tempContent).add(dragBounds);
7690
- tempIntersect.set(tempContent).intersect(dragBounds);
7691
- if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7692
- fitScaleX = tempMerge.width / tempContent.width;
7693
- } else {
7694
- fitScaleX = tempIntersect.width / tempContent.width;
7695
- }
7696
- if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7697
- fitScaleY = tempMerge.height / tempContent.height;
7698
- } else {
7699
- fitScaleY = tempIntersect.height / tempContent.height;
7700
- }
7701
- scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
7702
- scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
7703
- return scale;
7704
- }
7705
- };
7706
- const D = DragBoundsHelper;
7707
7643
  const {stintSet: stintSet$1} = DataHelper;
7708
7644
  const UIRender = {
7709
7645
  __updateChange() {
@@ -9298,7 +9234,13 @@ var LeaferUI = function(exports) {
9298
9234
  shape: shape
9299
9235
  };
9300
9236
  let origin = {}, tempMatrix$1 = getMatrixData();
9301
- const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
9237
+ const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
9238
+ function stretchMode(data, box, scaleX, scaleY) {
9239
+ const transform = get$3();
9240
+ translate$1(transform, box.x, box.y);
9241
+ if (scaleX) scaleHelper(transform, scaleX, scaleY);
9242
+ data.transform = transform;
9243
+ }
9302
9244
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
9303
9245
  const transform = get$3();
9304
9246
  translate$1(transform, box.x + x, box.y + y);
@@ -9313,8 +9255,11 @@ var LeaferUI = function(exports) {
9313
9255
  const transform = get$3();
9314
9256
  layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
9315
9257
  if (clipScaleX) {
9316
- tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
9317
- multiplyParent(transform, tempMatrix$1);
9258
+ if (rotation || skew) {
9259
+ set(tempMatrix$1);
9260
+ scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
9261
+ multiplyParent(transform, tempMatrix$1);
9262
+ } else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
9318
9263
  }
9319
9264
  data.transform = transform;
9320
9265
  }
@@ -9402,7 +9347,10 @@ var LeaferUI = function(exports) {
9402
9347
  if (offset) PointHelper.move(tempImage, offset);
9403
9348
  switch (mode) {
9404
9349
  case "stretch":
9405
- if (!sameBox) width = box.width, height = box.height;
9350
+ if (!sameBox) {
9351
+ scaleX = box.width / width, scaleY = box.height / height;
9352
+ stretchMode(data, box, scaleX, scaleY);
9353
+ }
9406
9354
  break;
9407
9355
 
9408
9356
  case "normal":
@@ -9411,7 +9359,7 @@ var LeaferUI = function(exports) {
9411
9359
  let clipScaleX, clipScaleY;
9412
9360
  if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
9413
9361
  clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
9414
- if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
9362
+ if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
9415
9363
  }
9416
9364
  break;
9417
9365
 
@@ -9428,17 +9376,14 @@ var LeaferUI = function(exports) {
9428
9376
  if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
9429
9377
  }
9430
9378
  if (!data.transform) {
9431
- if (box.x || box.y) {
9432
- data.transform = get$2();
9433
- translate(data.transform, box.x, box.y);
9434
- }
9379
+ if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
9435
9380
  }
9436
- if (scaleX && mode !== "stretch") {
9381
+ data.width = width;
9382
+ data.height = height;
9383
+ if (scaleX) {
9437
9384
  data.scaleX = scaleX;
9438
9385
  data.scaleY = scaleY;
9439
9386
  }
9440
- data.width = width;
9441
- data.height = height;
9442
9387
  if (opacity) data.opacity = opacity;
9443
9388
  if (filters) data.filters = filters;
9444
9389
  if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
@@ -9557,7 +9502,7 @@ var LeaferUI = function(exports) {
9557
9502
  if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
9558
9503
  }
9559
9504
  const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
9560
- const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
9505
+ const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
9561
9506
  function createPattern(ui, paint, pixelRatio) {
9562
9507
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
9563
9508
  const id = scaleX + "-" + scaleY + "-" + pixelRatio;
@@ -9567,8 +9512,8 @@ var LeaferUI = function(exports) {
9567
9512
  scaleX *= pixelRatio;
9568
9513
  scaleY *= pixelRatio;
9569
9514
  if (sx) {
9570
- sx = abs(sx);
9571
- sy = abs(sy);
9515
+ sx = abs$1(sx);
9516
+ sy = abs$1(sy);
9572
9517
  imageMatrix = get$1();
9573
9518
  copy$1(imageMatrix, transform);
9574
9519
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -9706,6 +9651,7 @@ var LeaferUI = function(exports) {
9706
9651
  recycleImage: recycleImage,
9707
9652
  createData: createData,
9708
9653
  getPatternData: getPatternData,
9654
+ stretchMode: stretchMode,
9709
9655
  fillOrFitMode: fillOrFitMode,
9710
9656
  clipMode: clipMode,
9711
9657
  repeatMode: repeatMode
@@ -9797,7 +9743,7 @@ var LeaferUI = function(exports) {
9797
9743
  conicGradient: conicGradient,
9798
9744
  getTransform: getTransform
9799
9745
  };
9800
- const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
9746
+ const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
9801
9747
  const tempBounds = {}, tempMatrix = new Matrix;
9802
9748
  const offsetOutBounds$1 = {};
9803
9749
  function shadow(ui, current, shape) {
@@ -9814,8 +9760,8 @@ var LeaferUI = function(exports) {
9814
9760
  const sx = Math.abs(nowWorld.scaleX);
9815
9761
  if (sx > 1) otherScale = 1 / sx;
9816
9762
  }
9817
- other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
9818
- transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
9763
+ other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, ColorConvert.string(item.color));
9764
+ transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
9819
9765
  if (transform) other.setTransform(transform);
9820
9766
  drawWorldShadow(other, offsetOutBounds$1, shape);
9821
9767
  if (transform) other.resetTransform();
@@ -9837,7 +9783,7 @@ var LeaferUI = function(exports) {
9837
9783
  function getShadowRenderSpread(_ui, shadow) {
9838
9784
  let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
9839
9785
  shadow.forEach(item => {
9840
- x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
9786
+ x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
9841
9787
  top = max(top, spread + blur - y);
9842
9788
  right = max(right, spread + blur + x);
9843
9789
  bottom = max(bottom, spread + blur + y);
@@ -9885,8 +9831,8 @@ var LeaferUI = function(exports) {
9885
9831
  if (sx > 1) otherScale = 1 / sx;
9886
9832
  }
9887
9833
  other.save();
9888
- other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
9889
- transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
9834
+ other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
9835
+ transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
9890
9836
  if (transform) other.setTransform(transform);
9891
9837
  drawWorldShadow(other, offsetOutBounds, shape);
9892
9838
  other.restore();
@@ -10460,6 +10406,7 @@ var LeaferUI = function(exports) {
10460
10406
  getDrawData: getDrawData
10461
10407
  };
10462
10408
  function string(color, opacity) {
10409
+ if (!color) return "#000";
10463
10410
  const doOpacity = isNumber(opacity) && opacity < 1;
10464
10411
  if (isString(color)) {
10465
10412
  if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
@@ -10496,7 +10443,6 @@ var LeaferUI = function(exports) {
10496
10443
  exports.Creator = Creator;
10497
10444
  exports.DataHelper = DataHelper;
10498
10445
  exports.Debug = Debug;
10499
- exports.DragBoundsHelper = DragBoundsHelper;
10500
10446
  exports.Effect = Effect;
10501
10447
  exports.EllipseData = EllipseData;
10502
10448
  exports.EllipseHelper = EllipseHelper;