@leafer/miniapp 2.1.8 → 2.1.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.
@@ -784,24 +784,24 @@ const PointHelper = {
784
784
  },
785
785
  tempToInnerOf(t, matrix) {
786
786
  const {tempPoint: temp} = P$7;
787
- copy$c(temp, t);
787
+ copy$d(temp, t);
788
788
  toInnerPoint$2(matrix, temp, temp);
789
789
  return temp;
790
790
  },
791
791
  tempToOuterOf(t, matrix) {
792
792
  const {tempPoint: temp} = P$7;
793
- copy$c(temp, t);
793
+ copy$d(temp, t);
794
794
  toOuterPoint$4(matrix, temp, temp);
795
795
  return temp;
796
796
  },
797
797
  tempToInnerRadiusPointOf(t, matrix) {
798
798
  const {tempRadiusPoint: temp} = P$7;
799
- copy$c(temp, t);
799
+ copy$d(temp, t);
800
800
  P$7.toInnerRadiusPointOf(t, matrix, temp);
801
801
  return temp;
802
802
  },
803
803
  copyRadiusPoint(t, point, x, y) {
804
- copy$c(t, point);
804
+ copy$d(t, point);
805
805
  setRadius(t, x, y);
806
806
  return t;
807
807
  },
@@ -881,7 +881,7 @@ const PointHelper = {
881
881
 
882
882
  const P$7 = PointHelper;
883
883
 
884
- const {getDistanceFrom: getDistanceFrom, copy: copy$c, setRadius: setRadius, getAtan2: getAtan2} = P$7;
884
+ const {getDistanceFrom: getDistanceFrom, copy: copy$d, setRadius: setRadius, getAtan2: getAtan2} = P$7;
885
885
 
886
886
  class Point {
887
887
  constructor(x, y) {
@@ -1088,7 +1088,7 @@ class Matrix {
1088
1088
  }
1089
1089
  }
1090
1090
 
1091
- const tempMatrix$2 = new Matrix;
1091
+ const tempMatrix$3 = new Matrix;
1092
1092
 
1093
1093
  const TwoPointBoundsHelper = {
1094
1094
  tempPointBounds: {},
@@ -1256,6 +1256,7 @@ const BoundsHelper = {
1256
1256
  },
1257
1257
  copyAndSpread(t, bounds, spread, isShrink, side) {
1258
1258
  const {x: x, y: y, width: width, height: height} = bounds;
1259
+ if (!spread) spread = 0;
1259
1260
  if (isArray(spread)) {
1260
1261
  const four = fourNumber$1(spread);
1261
1262
  isShrink ? B.set(t, x + four[3], y + four[0], width - four[1] - four[3], height - four[2] - four[0]) : B.set(t, x - four[3], y - four[0], width + four[1] + four[3], height + four[2] + four[0]);
@@ -1293,7 +1294,7 @@ const BoundsHelper = {
1293
1294
  return t;
1294
1295
  },
1295
1296
  toOffsetOutBounds(t, to, offsetBounds) {
1296
- if (!to) to = t; else copy$b(to, t);
1297
+ if (!to) to = t; else copy$c(to, t);
1297
1298
  if (!offsetBounds) offsetBounds = t;
1298
1299
  to.offsetX = B.maxX(offsetBounds);
1299
1300
  to.offsetY = B.maxY(offsetBounds);
@@ -1440,7 +1441,7 @@ const BoundsHelper = {
1440
1441
  if (bounds && (bounds.width || bounds.height)) {
1441
1442
  if (first) {
1442
1443
  first = false;
1443
- if (!addMode) copy$b(t, bounds);
1444
+ if (!addMode) copy$c(t, bounds);
1444
1445
  } else {
1445
1446
  add$2(t, bounds);
1446
1447
  }
@@ -1533,7 +1534,7 @@ const BoundsHelper = {
1533
1534
 
1534
1535
  const B = BoundsHelper;
1535
1536
 
1536
- const {add: add$2, copy: copy$b} = B;
1537
+ const {add: add$2, copy: copy$c} = B;
1537
1538
 
1538
1539
  class Bounds {
1539
1540
  get minX() {
@@ -2306,7 +2307,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
2306
2307
 
2307
2308
  __decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
2308
2309
 
2309
- const {copy: copy$a, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2310
+ const {copy: copy$b, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2310
2311
 
2311
2312
  const minSize = {
2312
2313
  width: 1,
@@ -2561,7 +2562,7 @@ class LeaferCanvasBase extends Canvas$1 {
2561
2562
  getSameCanvas(useSameWorldTransform, useSameSmooth) {
2562
2563
  const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2563
2564
  canvas.save();
2564
- if (useSameWorldTransform) copy$a(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2565
+ if (useSameWorldTransform) copy$b(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2565
2566
  if (useSameSmooth) canvas.smooth = this.smooth;
2566
2567
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
2567
2568
  return canvas;
@@ -3583,7 +3584,7 @@ const {M: M$7, L: L$7, C: C$5, Q: Q$3, Z: Z$5, N: N$2, D: D$3, X: X$2, G: G$2, F
3583
3584
 
3584
3585
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$2, arc: arc, ellipse: ellipse$2} = BezierHelper;
3585
3586
 
3586
- const {addPointBounds: addPointBounds, copy: copy$9, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3587
+ const {addPointBounds: addPointBounds, copy: copy$a, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3587
3588
 
3588
3589
  const debug$d = Debug.get("PathBounds");
3589
3590
 
@@ -3665,7 +3666,7 @@ const PathBounds = {
3665
3666
 
3666
3667
  case G$2:
3667
3668
  ellipse$2(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);
3668
- i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3669
+ i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3669
3670
  x = setEndPoint.x;
3670
3671
  y = setEndPoint.y;
3671
3672
  i += 9;
@@ -3683,7 +3684,7 @@ const PathBounds = {
3683
3684
 
3684
3685
  case O$3:
3685
3686
  arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
3686
- i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3687
+ i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3687
3688
  x = setEndPoint.x;
3688
3689
  y = setEndPoint.y;
3689
3690
  i += 7;
@@ -3700,7 +3701,7 @@ const PathBounds = {
3700
3701
 
3701
3702
  case U$2:
3702
3703
  arcTo$2(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
3703
- i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3704
+ i === 0 ? copy$a(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3704
3705
  x = setEndPoint.x;
3705
3706
  y = setEndPoint.y;
3706
3707
  i += 6;
@@ -4781,7 +4782,7 @@ function registerUIEvent() {
4781
4782
  };
4782
4783
  }
4783
4784
 
4784
- const {copy: copy$8, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$2, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
4785
+ const {copy: copy$9, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$2, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
4785
4786
 
4786
4787
  const matrix$3 = {}, {round: round$3} = Math;
4787
4788
 
@@ -4886,7 +4887,7 @@ const LeafHelper = {
4886
4887
  if (scaleY) transition = scaleY;
4887
4888
  scaleY = scaleX;
4888
4889
  }
4889
- copy$8(matrix$3, o);
4890
+ copy$9(matrix$3, o);
4890
4891
  scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
4891
4892
  if (L$5.hasHighPosition(t)) {
4892
4893
  L$5.setTransform(t, matrix$3, resize, transition, boundsType);
@@ -4905,7 +4906,7 @@ const LeafHelper = {
4905
4906
  },
4906
4907
  rotateOfLocal(t, origin, angle, transition) {
4907
4908
  const o = t.__localMatrix;
4908
- copy$8(matrix$3, o);
4909
+ copy$9(matrix$3, o);
4909
4910
  rotateOfOuter$2(matrix$3, origin, angle);
4910
4911
  if (L$5.hasHighPosition(t)) L$5.setTransform(t, matrix$3, false, transition); else t.set({
4911
4912
  x: t.x + matrix$3.e - o.e,
@@ -4917,18 +4918,18 @@ const LeafHelper = {
4917
4918
  L$5.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4918
4919
  },
4919
4920
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4920
- copy$8(matrix$3, t.__localMatrix);
4921
+ copy$9(matrix$3, t.__localMatrix);
4921
4922
  skewOfOuter(matrix$3, origin, skewX, skewY);
4922
4923
  L$5.setTransform(t, matrix$3, resize, transition);
4923
4924
  },
4924
4925
  transformWorld(t, transform, resize, transition, boundsType) {
4925
- copy$8(matrix$3, t.worldTransform);
4926
+ copy$9(matrix$3, t.worldTransform);
4926
4927
  multiplyParent$3(matrix$3, transform);
4927
4928
  if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
4928
4929
  L$5.setTransform(t, matrix$3, resize, transition, boundsType);
4929
4930
  },
4930
4931
  transform(t, transform, resize, transition, boundsType) {
4931
- copy$8(matrix$3, t.localTransform);
4932
+ copy$9(matrix$3, t.localTransform);
4932
4933
  multiplyParent$3(matrix$3, transform);
4933
4934
  L$5.setTransform(t, matrix$3, resize, transition, boundsType);
4934
4935
  },
@@ -4966,7 +4967,7 @@ const LeafHelper = {
4966
4967
  return innerOrigin;
4967
4968
  },
4968
4969
  getRelativeWorld(t, relative, temp) {
4969
- copy$8(matrix$3, t.worldTransform);
4970
+ copy$9(matrix$3, t.worldTransform);
4970
4971
  divideParent(matrix$3, relative.scrollWorldTransform);
4971
4972
  return temp ? matrix$3 : Object.assign({}, matrix$3);
4972
4973
  },
@@ -5180,7 +5181,7 @@ const WaitHelper = {
5180
5181
 
5181
5182
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
5182
5183
 
5183
- const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$7} = BoundsHelper;
5184
+ const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$8} = BoundsHelper;
5184
5185
 
5185
5186
  const localContent = "_localContentBounds";
5186
5187
 
@@ -5419,7 +5420,7 @@ class LeafLayout {
5419
5420
  matrix = getRelativeWorld$1(leaf, relative, true);
5420
5421
  }
5421
5422
  if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
5422
- copy$7(layoutBounds, bounds);
5423
+ copy$8(layoutBounds, bounds);
5423
5424
  PointHelper.copy(layoutBounds, point);
5424
5425
  if (unscale) {
5425
5426
  const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
@@ -6074,7 +6075,7 @@ const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafH
6074
6075
 
6075
6076
  const {updateBounds: updateBounds$2} = BranchHelper;
6076
6077
 
6077
- const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$4, copy: copy$6} = BoundsHelper;
6078
+ const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$4, copy: copy$7} = BoundsHelper;
6078
6079
 
6079
6080
  const {toBounds: toBounds$1} = PathBounds;
6080
6081
 
@@ -6196,7 +6197,7 @@ const LeafBounds = {
6196
6197
  },
6197
6198
  __updateRenderBounds(_bounds) {
6198
6199
  const layout = this.__layout, {renderSpread: renderSpread} = layout;
6199
- isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$4(layout.renderBounds, layout.boxBounds, renderSpread);
6200
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$7(layout.renderBounds, layout.strokeBounds) : copyAndSpread$4(layout.renderBounds, layout.boxBounds, renderSpread);
6200
6201
  }
6201
6202
  };
6202
6203
 
@@ -6296,7 +6297,7 @@ const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint$1, multiplyParent:
6296
6297
 
6297
6298
  const {toOuterOf: toOuterOf$1} = BoundsHelper;
6298
6299
 
6299
- const {copy: copy$5, move: move$8} = PointHelper;
6300
+ const {copy: copy$6, move: move$8} = PointHelper;
6300
6301
 
6301
6302
  const {getScaleFixedData: getScaleFixedData$1} = MathHelper;
6302
6303
 
@@ -6560,14 +6561,14 @@ let Leaf = class Leaf {
6560
6561
  if (this.parent) {
6561
6562
  this.parent.worldToInner(world, to, distance, relative);
6562
6563
  } else {
6563
- if (to) copy$5(to, world);
6564
+ if (to) copy$6(to, world);
6564
6565
  }
6565
6566
  }
6566
6567
  localToWorld(local, to, distance, relative) {
6567
6568
  if (this.parent) {
6568
6569
  this.parent.innerToWorld(local, to, distance, relative);
6569
6570
  } else {
6570
- if (to) copy$5(to, local);
6571
+ if (to) copy$6(to, local);
6571
6572
  }
6572
6573
  }
6573
6574
  worldToInner(world, to, distance, relative) {
@@ -6984,7 +6985,7 @@ class LeafLevelList {
6984
6985
  }
6985
6986
  }
6986
6987
 
6987
- const version = "2.1.8";
6988
+ const version = "2.1.10";
6988
6989
 
6989
6990
  class LeaferCanvas extends LeaferCanvasBase {
6990
6991
  get allowBackgroundColor() {
@@ -7300,7 +7301,10 @@ class Watcher {
7300
7301
  if (this.running) this.target.emit(RenderEvent.REQUEST);
7301
7302
  }
7302
7303
  __onAttrChange(event) {
7303
- if (this.config.usePartLayout) this.__updatedList.add(event.target);
7304
+ this.add(event.target);
7305
+ }
7306
+ add(leaf) {
7307
+ if (this.config.usePartLayout) this.__updatedList.add(leaf);
7304
7308
  this.update();
7305
7309
  }
7306
7310
  __onChildEvent(event) {
@@ -8339,11 +8343,7 @@ class PolygonData extends UIData {
8339
8343
  }
8340
8344
  }
8341
8345
 
8342
- class StarData extends UIData {
8343
- get __boxStroke() {
8344
- return !this.__pathInputed;
8345
- }
8346
- }
8346
+ class StarData extends UIData {}
8347
8347
 
8348
8348
  class PathData extends UIData {
8349
8349
  get __pathInputed() {
@@ -12174,7 +12174,7 @@ function getGapValue(gap, size, totalSize, rows) {
12174
12174
  return gap === "auto" ? value < 0 ? 0 : value : value;
12175
12175
  }
12176
12176
 
12177
- let origin$1 = {}, tempMatrix$1 = getMatrixData();
12177
+ let origin$1 = {}, tempMatrix$2 = getMatrixData();
12178
12178
 
12179
12179
  const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
12180
12180
 
@@ -12201,9 +12201,9 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
12201
12201
  layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
12202
12202
  if (clipScaleX) {
12203
12203
  if (rotation || skew) {
12204
- set(tempMatrix$1);
12205
- scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
12206
- multiplyParent(transform, tempMatrix$1);
12204
+ set(tempMatrix$2);
12205
+ scaleOfOuter$1(tempMatrix$2, box, clipScaleX, clipScaleY);
12206
+ multiplyParent(transform, tempMatrix$2);
12207
12207
  } else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
12208
12208
  }
12209
12209
  data.transform = transform;
@@ -12252,7 +12252,7 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
12252
12252
  translate(transform, box.x + x, box.y + y);
12253
12253
  }
12254
12254
 
12255
- const {get: get$1, scale: scale$3, copy: copy$4} = MatrixHelper;
12255
+ const {get: get$1, scale: scale$3, copy: copy$5} = MatrixHelper;
12256
12256
 
12257
12257
  const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
12258
12258
 
@@ -12278,19 +12278,15 @@ function createPattern(paint, ui, canvas, renderOptions) {
12278
12278
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
12279
12279
  width *= scaleX;
12280
12280
  height *= scaleY;
12281
- if (gap) {
12281
+ if (gap && !brush) {
12282
12282
  xGap = gap.x * scaleX / abs$7(data.scaleX || 1);
12283
12283
  yGap = gap.y * scaleY / abs$7(data.scaleY || 1);
12284
- if (brush) {
12285
- const brushScale = PaintImage.getBrushScale(paint, ui);
12286
- xGap /= brushScale, yGap /= brushScale;
12287
- }
12288
12284
  }
12289
12285
  if (transform || scaleX !== 1 || scaleY !== 1) {
12290
12286
  scaleX *= getFloorScale(width + (xGap || 0));
12291
12287
  scaleY *= getFloorScale(height + (yGap || 0));
12292
12288
  imageMatrix = get$1();
12293
- if (transform) copy$4(imageMatrix, transform);
12289
+ if (transform) copy$5(imageMatrix, transform);
12294
12290
  scale$3(imageMatrix, 1 / scaleX, 1 / scaleY);
12295
12291
  }
12296
12292
  const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
@@ -12528,9 +12524,9 @@ const PaintGradientModule = {
12528
12524
  getTransform: getTransform
12529
12525
  };
12530
12526
 
12531
- const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$6} = Math;
12527
+ const {copy: copy$4, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$6} = Math;
12532
12528
 
12533
- const tempBounds$1 = {}, tempMatrix = new Matrix;
12529
+ const tempBounds$1 = {}, tempMatrix$1 = new Matrix;
12534
12530
 
12535
12531
  const offsetOutBounds$1 = {};
12536
12532
 
@@ -12584,11 +12580,11 @@ function getShadowRenderSpread(_ui, shadow) {
12584
12580
  function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
12585
12581
  if (shadow.spread) {
12586
12582
  const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
12587
- tempMatrix.set().scaleOfOuter({
12583
+ tempMatrix$1.set().scaleOfOuter({
12588
12584
  x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
12589
12585
  y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
12590
12586
  }, 1 + spread / width, 1 + spread / height);
12591
- return tempMatrix;
12587
+ return tempMatrix$1;
12592
12588
  }
12593
12589
  return undefined;
12594
12590
  }
@@ -12597,7 +12593,7 @@ function drawWorldShadow(canvas, outBounds, shape) {
12597
12593
  const {shapeBounds: shapeBounds} = shape;
12598
12594
  let from, to;
12599
12595
  if (Platform.fullImageShadow) {
12600
- copy$3(tempBounds$1, canvas.bounds);
12596
+ copy$4(tempBounds$1, canvas.bounds);
12601
12597
  move$6(tempBounds$1, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
12602
12598
  from = canvas.bounds, to = tempBounds$1;
12603
12599
  } else {
@@ -13416,7 +13412,7 @@ function mergeConfigAttr() {
13416
13412
 
13417
13413
  const {abs: abs$5} = Math;
13418
13414
 
13419
- const {copy: copy$2} = MatrixHelper;
13415
+ const {copy: copy$3} = MatrixHelper;
13420
13416
 
13421
13417
  const {setListWithFn: setListWithFn} = BoundsHelper;
13422
13418
 
@@ -13458,7 +13454,7 @@ class Stroker extends UI {
13458
13454
  const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
13459
13455
  if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
13460
13456
  const aScaleX = abs$5(worldTransform.scaleX), aScaleY = abs$5(worldTransform.scaleY);
13461
- copy$2(matrix$1, worldTransform);
13457
+ copy$3(matrix$1, worldTransform);
13462
13458
  matrix$1.half = strokeWidth % 2;
13463
13459
  canvas.setWorld(matrix$1, options.matrix);
13464
13460
  canvas.beginPath();
@@ -13790,7 +13786,7 @@ const EditDataHelper = {
13790
13786
  getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode, boundsType) {
13791
13787
  let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
13792
13788
  const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
13793
- const {width: width, height: height} = startBounds;
13789
+ const {width: width, height: height} = startBounds, worldScaleX = abs$4(worldTransform.scaleX), worldScaleY = abs$4(worldTransform.scaleY);
13794
13790
  const innerBounds = target.getBounds(boundsType, "inner");
13795
13791
  const originChangedScaleX = target.scaleX / startBounds.scaleX;
13796
13792
  const originChangedScaleY = target.scaleY / startBounds.scaleY;
@@ -13882,9 +13878,8 @@ const EditDataHelper = {
13882
13878
  if (useScaleX) scaleX /= changedScaleX;
13883
13879
  if (useScaleY) scaleY /= changedScaleY;
13884
13880
  if (!flipable) {
13885
- const {worldTransform: worldTransform} = target;
13886
- if (scaleX < 0) scaleX = 1 / innerBounds.width / worldTransform.scaleX;
13887
- if (scaleY < 0) scaleY = 1 / innerBounds.height / worldTransform.scaleY;
13881
+ if (scaleX < 0) scaleX = 1 / innerBounds.width / worldScaleX;
13882
+ if (scaleY < 0) scaleY = 1 / innerBounds.height / worldScaleY;
13888
13883
  }
13889
13884
  toPoint(around || align, innerBounds, origin, true);
13890
13885
  this.checkOrigin(target, origin, boundsType);
@@ -13905,13 +13900,14 @@ const EditDataHelper = {
13905
13900
  const nowHeight = innerBounds.height * target.scaleY;
13906
13901
  scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
13907
13902
  }
13908
- let minWidth = 1 * abs$4(worldTransform.scaleX), minHeight = 1 * abs$4(worldTransform.scaleY);
13903
+ let minWidth = 1, minHeight = 1;
13909
13904
  if (boundsType !== "box") {
13910
- minWidth += innerBounds.width - boxBounds.width;
13911
- minHeight += innerBounds.height - boxBounds.height;
13905
+ minWidth += (innerBounds.width - boxBounds.width) * worldScaleX;
13906
+ minHeight += (innerBounds.height - boxBounds.height) * worldScaleY;
13912
13907
  }
13913
- if (useScaleX && abs$4(scaleX * innerBounds.width) < minWidth) scaleX = sign$1(scaleX) * minWidth / innerBounds.width;
13914
- if (useScaleY && abs$4(scaleY * innerBounds.height) < minHeight) scaleY = sign$1(scaleY) * minHeight / innerBounds.height;
13908
+ const worldWidth = worldScaleX * innerBounds.width, worldHeight = worldScaleY * innerBounds.height;
13909
+ if (useScaleX && abs$4(scaleX * worldWidth) < minWidth) scaleX = sign$1(scaleX) * minWidth / worldWidth;
13910
+ if (useScaleY && abs$4(scaleY * worldHeight) < minHeight) scaleY = sign$1(scaleY) * minHeight / worldHeight;
13915
13911
  if (lockRatio && scaleX !== scaleY) {
13916
13912
  lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
13917
13913
  scaleX = sign$1(scaleX) * lockScale;
@@ -14294,8 +14290,8 @@ class EditBox extends Group {
14294
14290
  updateMoveCursor(this);
14295
14291
  }
14296
14292
  update() {
14297
- const {editor: editor, mergeConfig: mergeConfig} = this;
14298
- const {x: x, y: y, scaleX: scaleX, scaleY: scaleY, rotation: rotation, skewX: skewX, skewY: skewY, width: width, height: height} = this.target.getLayoutBounds(mergeConfig.editBoxType, editor, true);
14293
+ const {editor: editor} = this;
14294
+ const {x: x, y: y, scaleX: scaleX, scaleY: scaleY, rotation: rotation, skewX: skewX, skewY: skewY, width: width, height: height} = this.target.getLayoutBounds("box", editor, true);
14299
14295
  this.visible = !this.target.locked;
14300
14296
  this.set({
14301
14297
  x: x,
@@ -14318,9 +14314,9 @@ class EditBox extends Group {
14318
14314
  if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
14319
14315
  }
14320
14316
  updateBounds(bounds) {
14321
- const {editor: editor, mergedConfig: mergedConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
14317
+ const {editor: editor, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
14322
14318
  const {editMask: editMask} = editor;
14323
- const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergedConfig;
14319
+ const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, editBoxType: editBoxType, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
14324
14320
  editMask.visible = mask ? true : 0;
14325
14321
  if (!isUndefined(dimOthers) || !isUndefined(bright)) {
14326
14322
  editor.setDimOthers(dimOthers);
@@ -14329,6 +14325,7 @@ class EditBox extends Group {
14329
14325
  } else if (editor.hasDimOthers) {
14330
14326
  editor.cancelDimOthers();
14331
14327
  }
14328
+ if (editBoxType === "stroke") BoundsHelper.spread(bounds, this.target.__layout.strokeBoxSpread);
14332
14329
  if (spread) BoundsHelper.spread(bounds, spread);
14333
14330
  if (this.view.worldOpacity) {
14334
14331
  const {width: width, height: height} = bounds;
@@ -14358,7 +14355,7 @@ class EditBox extends Group {
14358
14355
  }
14359
14356
  }
14360
14357
  }
14361
- circle.visible = showPoints && rotateable && !!(mergedConfig.circle || mergedConfig.rotatePoint);
14358
+ circle.visible = showPoints && rotateable && !!(mergeConfig.circle || mergeConfig.rotatePoint);
14362
14359
  if (circle.visible) this.layoutCircle();
14363
14360
  if (rect.path) rect.path = null;
14364
14361
  rect.set(Object.assign(Object.assign({}, bounds), {
@@ -15409,17 +15406,19 @@ let Editor = class Editor extends Group {
15409
15406
  if (EditToolCreator.list[name]) {
15410
15407
  const tool = this.editTool = this.getEditTool(name);
15411
15408
  this.editBox.load();
15409
+ tool.editTarget = target;
15412
15410
  tool.load();
15413
15411
  this.update();
15414
15412
  }
15415
15413
  }
15416
15414
  }
15417
- unloadEditTool() {
15415
+ unloadEditTool(onlyTool) {
15418
15416
  let tool = this.editTool;
15419
15417
  if (tool) {
15420
- this.editBox.unload();
15418
+ if (!onlyTool) this.editBox.unload();
15421
15419
  tool.unload();
15422
- this.editTool = null;
15420
+ if (!onlyTool) this.editTool = null;
15421
+ tool.editTarget = null;
15423
15422
  }
15424
15423
  }
15425
15424
  getEditSize(_ui) {
@@ -15518,7 +15517,7 @@ let Editor = class Editor extends Group {
15518
15517
  if (isString(check)) name = check; else if (check === false) return;
15519
15518
  }
15520
15519
  if (EditToolCreator.list[name]) {
15521
- this.editTool.unload();
15520
+ this.unloadEditTool(true);
15522
15521
  this.innerEditing = true;
15523
15522
  this.innerEditor = this.getInnerEditor(name);
15524
15523
  this.innerEditor.editTarget = target;
@@ -15535,7 +15534,7 @@ let Editor = class Editor extends Group {
15535
15534
  this.innerEditor.unload();
15536
15535
  this.emitInnerEvent(InnerEditorEvent.CLOSE);
15537
15536
  if (!onlyInnerEditor) this.updateEditTool();
15538
- this.innerEditor = null;
15537
+ this.innerEditor = this.innerEditor.editTarget = null;
15539
15538
  }
15540
15539
  }
15541
15540
  emitInnerEvent(type) {
@@ -15670,8 +15669,13 @@ class InnerEditor {
15670
15669
  }
15671
15670
 
15672
15671
  let EditTool = class EditTool extends InnerEditor {
15673
- static registerEditTool(name) {
15672
+ static registerEditTool(name, changeTag) {
15674
15673
  EditToolCreator.register(this, name);
15674
+ if (changeTag) defineKey(this.prototype, "tag", {
15675
+ get() {
15676
+ return name;
15677
+ }
15678
+ });
15675
15679
  }
15676
15680
  get tag() {
15677
15681
  return "EditTool";
@@ -15733,7 +15737,7 @@ EditTool = __decorate([ registerEditTool() ], EditTool);
15733
15737
 
15734
15738
  const {left: left$1, right: right$1} = Direction9;
15735
15739
 
15736
- const {move: move$5, copy: copy$1, toNumberPoints: toNumberPoints} = PointHelper;
15740
+ const {move: move$5, copy: copy$2, toNumberPoints: toNumberPoints} = PointHelper;
15737
15741
 
15738
15742
  let LineEditTool = class LineEditTool extends EditTool {
15739
15743
  constructor() {
@@ -15825,10 +15829,10 @@ let LineEditTool = class LineEditTool extends EditTool {
15825
15829
  line.innerToWorld(from, from, false, editBox);
15826
15830
  line.innerToWorld(to, to, false, editBox);
15827
15831
  rect.pen.clearPath().moveTo(from.x, from.y).lineTo(to.x, to.y);
15828
- copy$1(resizePoints[7], from);
15829
- copy$1(rotatePoints[7], from);
15830
- copy$1(resizePoints[3], to);
15831
- copy$1(rotatePoints[3], to);
15832
+ copy$2(resizePoints[7], from);
15833
+ copy$2(rotatePoints[7], from);
15834
+ copy$2(resizePoints[3], to);
15835
+ copy$2(rotatePoints[3], to);
15832
15836
  }
15833
15837
  for (let i = 0; i < 8; i++) {
15834
15838
  if (i < 4) resizeLines[i].visible = false;
@@ -16008,7 +16012,7 @@ function scaleResizeGroup(group, scaleX, scaleY) {
16008
16012
  }
16009
16013
  }
16010
16014
 
16011
- const leaf = Leaf.prototype, tempPoint$1 = {}, {scale: scale$2, toOuterPoint: toOuterPoint} = MatrixHelper;
16015
+ const leaf = Leaf.prototype, tempPoint$1 = {}, tempMatrix = {}, {copy: copy$1, scale: scale$2, toOuterPoint: toOuterPoint} = MatrixHelper;
16012
16016
 
16013
16017
  leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize, boundsType) {
16014
16018
  const data = this;
@@ -16016,14 +16020,16 @@ leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize, boundsType) {
16016
16020
  data.scaleX *= scaleX;
16017
16021
  data.scaleY *= scaleY;
16018
16022
  } else {
16019
- const local = this.__localMatrix;
16020
- if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX, scale$2(local, -1, 1);
16021
- if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY, scale$2(local, 1, -1);
16023
+ if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX;
16024
+ if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY;
16022
16025
  if (boundsType === "stroke") {
16026
+ copy$1(tempMatrix, this.__localMatrix);
16027
+ if (scaleX < 0) scale$2(tempMatrix, -1, 1);
16028
+ if (scaleY < 0) scale$2(tempMatrix, 1, -1);
16023
16029
  const {boxBounds: boxBounds, strokeBounds: strokeBounds} = this.__layout, {x: x, y: y, width: width, height: height} = strokeBounds;
16024
16030
  tempPoint$1.x = (x - boxBounds.x) * (scaleX - 1);
16025
16031
  tempPoint$1.y = (y - boxBounds.y) * (scaleY - 1);
16026
- toOuterPoint(local, tempPoint$1, tempPoint$1, true);
16032
+ toOuterPoint(tempMatrix, tempPoint$1, tempPoint$1, true);
16027
16033
  this.x += tempPoint$1.x;
16028
16034
  this.y += tempPoint$1.y;
16029
16035
  scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width;
@@ -21065,4 +21071,4 @@ function isSame(a, b) {
21065
21071
 
21066
21072
  Plugin.add("corner");
21067
21073
 
21068
- export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$6 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
21074
+ export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$3 as tempMatrix, tempPoint$6 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };