@leafer/worker 1.9.5 → 1.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/worker.js CHANGED
@@ -344,7 +344,7 @@ var LeaferUI = function(exports) {
344
344
  };
345
345
  }
346
346
  const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
347
- const {float: float$2} = MathHelper;
347
+ const {float: float$3} = MathHelper;
348
348
  const tempPoint$4 = {};
349
349
  function getWorld() {
350
350
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
@@ -583,12 +583,12 @@ var LeaferUI = function(exports) {
583
583
  const cosR = c / scaleY;
584
584
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
585
585
  }
586
- const cosR = float$2(cos$6(rotation));
586
+ const cosR = float$3(cos$6(rotation));
587
587
  const sinR = sin$6(rotation);
588
- scaleX = float$2(scaleX), scaleY = float$2(scaleY);
589
- skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
590
- skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
591
- rotation = float$2(rotation / OneRadian);
588
+ scaleX = float$3(scaleX), scaleY = float$3(scaleY);
589
+ skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
590
+ skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
591
+ rotation = float$3(rotation / OneRadian);
592
592
  } else {
593
593
  scaleX = a;
594
594
  scaleY = d;
@@ -1085,7 +1085,7 @@ var LeaferUI = function(exports) {
1085
1085
  };
1086
1086
  const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
1087
1087
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1088
- const {float: float$1, fourNumber: fourNumber$1} = MathHelper;
1088
+ const {float: float$2, fourNumber: fourNumber$1} = MathHelper;
1089
1089
  const {floor: floor$3, ceil: ceil$3} = Math;
1090
1090
  let right$4, bottom$3, boundsRight, boundsBottom;
1091
1091
  const point$2 = {};
@@ -1262,10 +1262,10 @@ var LeaferUI = function(exports) {
1262
1262
  }
1263
1263
  },
1264
1264
  float(t, maxLength) {
1265
- t.x = float$1(t.x, maxLength);
1266
- t.y = float$1(t.y, maxLength);
1267
- t.width = float$1(t.width, maxLength);
1268
- t.height = float$1(t.height, maxLength);
1265
+ t.x = float$2(t.x, maxLength);
1266
+ t.y = float$2(t.y, maxLength);
1267
+ t.width = float$2(t.width, maxLength);
1268
+ t.height = float$2(t.height, maxLength);
1269
1269
  },
1270
1270
  add(t, bounds, isPoint) {
1271
1271
  right$4 = t.x + t.width;
@@ -5105,6 +5105,7 @@ var LeaferUI = function(exports) {
5105
5105
  LeaferEvent.STOP = "leafer.stop";
5106
5106
  LeaferEvent.RESTART = "leafer.restart";
5107
5107
  LeaferEvent.END = "leafer.end";
5108
+ LeaferEvent.UPDATE_MODE = "leafer.update_mode";
5108
5109
  LeaferEvent.TRANSFORM = "leafer.transform";
5109
5110
  LeaferEvent.MOVE = "leafer.move";
5110
5111
  LeaferEvent.SCALE = "leafer.scale";
@@ -6350,7 +6351,7 @@ var LeaferUI = function(exports) {
6350
6351
  this.levelMap = null;
6351
6352
  }
6352
6353
  }
6353
- const version = "1.9.5";
6354
+ const version = "1.9.6";
6354
6355
  class LeaferCanvas extends LeaferCanvasBase {
6355
6356
  get allowBackgroundColor() {
6356
6357
  return true;
@@ -7046,7 +7047,7 @@ var LeaferUI = function(exports) {
7046
7047
  item = path.list[i];
7047
7048
  if (!item.__.hittable) break;
7048
7049
  hittablePath.addAt(item, 0);
7049
- if (!item.__.hitChildren) break;
7050
+ if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
7050
7051
  }
7051
7052
  return hittablePath;
7052
7053
  }
@@ -7464,8 +7465,6 @@ var LeaferUI = function(exports) {
7464
7465
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
7465
7466
  box.set(value);
7466
7467
  if (boxLayout.strokeChanged) layout.strokeChange();
7467
- if (boxLayout.renderChanged) layout.renderChange();
7468
- box.__updateChange();
7469
7468
  } else if (box) {
7470
7469
  t.__box = box.parent = null;
7471
7470
  box.destroy();
@@ -7532,7 +7531,7 @@ var LeaferUI = function(exports) {
7532
7531
  __updateRenderSpread() {
7533
7532
  let width = 0;
7534
7533
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
7535
- if (shadow) shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
7534
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
7536
7535
  if (blur) width = Math.max(width, blur);
7537
7536
  if (filter) width += Filter.getSpread(filter);
7538
7537
  if (renderSpread) width += renderSpread;
@@ -7544,36 +7543,67 @@ var LeaferUI = function(exports) {
7544
7543
  return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
7545
7544
  }
7546
7545
  };
7546
+ const {float: float$1} = MathHelper;
7547
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
7547
7548
  const DragBoundsHelper = {
7549
+ limitMove(leaf, move) {
7550
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7551
+ if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
7552
+ D$2.axisMove(leaf, move);
7553
+ },
7554
+ limitScaleOf(leaf, origin, scale) {
7555
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7556
+ if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
7557
+ },
7558
+ axisMove(leaf, move) {
7559
+ const {draggable: draggable} = leaf;
7560
+ if (draggable === "x") move.y = 0;
7561
+ if (draggable === "y") move.x = 0;
7562
+ },
7563
+ getDragBounds(leaf) {
7564
+ const {dragBounds: dragBounds} = leaf;
7565
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
7566
+ },
7567
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
7568
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
7569
+ },
7548
7570
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
7549
7571
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7550
7572
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7551
7573
  if (!change) move = Object.assign({}, move);
7552
- const isBiggerWidth = content.width > dragBounds.width;
7553
- const isBiggerHeight = content.height > dragBounds.height;
7554
- if (isBiggerWidth && dragBoundsType !== "outer") {
7574
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7555
7575
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7556
7576
  } else {
7557
7577
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
7558
7578
  }
7559
- if (isBiggerHeight && dragBoundsType !== "outer") {
7579
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7560
7580
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
7561
7581
  } else {
7562
7582
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
7563
7583
  }
7564
- move.x = MathHelper.float(move.x);
7565
- move.y = MathHelper.float(move.y);
7584
+ move.x = float$1(move.x);
7585
+ move.y = float$1(move.y);
7566
7586
  return move;
7567
7587
  },
7568
- axisMove(leaf, move) {
7569
- const {draggable: draggable} = leaf;
7570
- if (draggable === "x") move.y = 0;
7571
- if (draggable === "y") move.x = 0;
7572
- },
7573
- limitMove(leaf, move) {
7574
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7575
- if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
7576
- D$2.axisMove(leaf, move);
7588
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
7589
+ if (!change) scale = Object.assign({}, scale);
7590
+ let fitScaleX, fitScaleY;
7591
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
7592
+ tempMerge.set(tempContent).add(dragBounds);
7593
+ tempIntersect.set(tempContent).intersect(dragBounds);
7594
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7595
+ fitScaleX = tempMerge.width / tempContent.width;
7596
+ } else {
7597
+ fitScaleX = tempIntersect.width / tempContent.width;
7598
+ }
7599
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7600
+ fitScaleY = tempMerge.height / tempContent.height;
7601
+ } else {
7602
+ fitScaleY = tempIntersect.height / tempContent.height;
7603
+ }
7604
+ scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
7605
+ scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
7606
+ return scale;
7577
7607
  }
7578
7608
  };
7579
7609
  const D$2 = DragBoundsHelper;
@@ -7588,7 +7618,7 @@ var LeaferUI = function(exports) {
7588
7618
  }
7589
7619
  if (data.__useEffect) {
7590
7620
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7591
- stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
7621
+ stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
7592
7622
  data.__useEffect = !!(shadow || otherEffect);
7593
7623
  }
7594
7624
  data.__checkSingle();
@@ -8140,7 +8170,9 @@ var LeaferUI = function(exports) {
8140
8170
  } else if (attrName === "zIndex") {
8141
8171
  this.canvas.zIndex = newValue;
8142
8172
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8143
- }
8173
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8174
+ mode: newValue
8175
+ });
8144
8176
  }
8145
8177
  return super.__setAttr(attrName, newValue);
8146
8178
  }
@@ -8319,6 +8351,7 @@ var LeaferUI = function(exports) {
8319
8351
  exports.Leafer.list = new LeafList;
8320
8352
  __decorate([ dataProcessor(LeaferData) ], exports.Leafer.prototype, "__", void 0);
8321
8353
  __decorate([ boundsType() ], exports.Leafer.prototype, "pixelRatio", void 0);
8354
+ __decorate([ dataType("normal") ], exports.Leafer.prototype, "mode", void 0);
8322
8355
  exports.Leafer = Leafer_1 = __decorate([ registerUI() ], exports.Leafer);
8323
8356
  exports.Rect = class Rect extends exports.UI {
8324
8357
  get __tag() {
@@ -8478,45 +8511,8 @@ var LeaferUI = function(exports) {
8478
8511
  __decorate([ pathType(0) ], exports.Ellipse.prototype, "startAngle", void 0);
8479
8512
  __decorate([ pathType(0) ], exports.Ellipse.prototype, "endAngle", void 0);
8480
8513
  exports.Ellipse = __decorate([ registerUI() ], exports.Ellipse);
8481
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
8482
- const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
8483
- exports.Line = class Line extends exports.UI {
8484
- get __tag() {
8485
- return "Line";
8486
- }
8487
- get toPoint() {
8488
- const {width: width, rotation: rotation} = this.__;
8489
- const to = getPointData();
8490
- if (width) to.x = width;
8491
- if (rotation) rotate$3(to, rotation);
8492
- return to;
8493
- }
8494
- set toPoint(value) {
8495
- this.width = getDistance$3(defaultPoint, value);
8496
- this.rotation = getAngle$2(defaultPoint, value);
8497
- if (this.height) this.height = 0;
8498
- }
8499
- __updatePath() {
8500
- const data = this.__;
8501
- const path = data.path = [];
8502
- if (data.points) {
8503
- drawPoints$1(path, data.points, data.curve, data.closed);
8504
- } else {
8505
- moveTo$2(path, 0, 0);
8506
- lineTo$2(path, this.width, 0);
8507
- }
8508
- }
8509
- };
8510
- __decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
8511
- __decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
8512
- __decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
8513
- __decorate([ pathType() ], exports.Line.prototype, "points", void 0);
8514
- __decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
8515
- __decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
8516
- exports.Line = __decorate([ registerUI() ], exports.Line);
8517
8514
  const {sin: sin$2, cos: cos$2, PI: PI$2} = Math;
8518
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
8519
- const line = exports.Line.prototype;
8515
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
8520
8516
  exports.Polygon = class Polygon extends exports.UI {
8521
8517
  get __tag() {
8522
8518
  return "Polygon";
@@ -8525,29 +8521,25 @@ var LeaferUI = function(exports) {
8525
8521
  const data = this.__;
8526
8522
  const path = data.path = [];
8527
8523
  if (data.points) {
8528
- drawPoints(path, data.points, data.curve, true);
8524
+ drawPoints$1(path, data.points, data.curve, true);
8529
8525
  } else {
8530
8526
  const {width: width, height: height, sides: sides} = data;
8531
8527
  const rx = width / 2, ry = height / 2;
8532
- moveTo$1(path, rx, 0);
8528
+ moveTo$2(path, rx, 0);
8533
8529
  for (let i = 1; i < sides; i++) {
8534
- lineTo$1(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
8530
+ lineTo$2(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
8535
8531
  }
8536
8532
  closePath$1(path);
8537
8533
  }
8538
8534
  }
8539
- __updateRenderPath() {}
8540
- __updateBoxBounds() {}
8541
8535
  };
8542
8536
  __decorate([ dataProcessor(PolygonData) ], exports.Polygon.prototype, "__", void 0);
8543
8537
  __decorate([ pathType(3) ], exports.Polygon.prototype, "sides", void 0);
8544
8538
  __decorate([ pathType() ], exports.Polygon.prototype, "points", void 0);
8545
8539
  __decorate([ pathType(0) ], exports.Polygon.prototype, "curve", void 0);
8546
- __decorate([ rewrite(line.__updateRenderPath) ], exports.Polygon.prototype, "__updateRenderPath", null);
8547
- __decorate([ rewrite(line.__updateBoxBounds) ], exports.Polygon.prototype, "__updateBoxBounds", null);
8548
8540
  exports.Polygon = __decorate([ rewriteAble(), registerUI() ], exports.Polygon);
8549
8541
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
8550
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
8542
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
8551
8543
  exports.Star = class Star extends exports.UI {
8552
8544
  get __tag() {
8553
8545
  return "Star";
@@ -8556,9 +8548,9 @@ var LeaferUI = function(exports) {
8556
8548
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
8557
8549
  const rx = width / 2, ry = height / 2;
8558
8550
  const path = this.__.path = [];
8559
- moveTo(path, rx, 0);
8551
+ moveTo$1(path, rx, 0);
8560
8552
  for (let i = 1; i < corners * 2; i++) {
8561
- lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(i * PI$1 / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(i * PI$1 / corners));
8553
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(i * PI$1 / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(i * PI$1 / corners));
8562
8554
  }
8563
8555
  closePath(path);
8564
8556
  }
@@ -8567,6 +8559,42 @@ var LeaferUI = function(exports) {
8567
8559
  __decorate([ pathType(5) ], exports.Star.prototype, "corners", void 0);
8568
8560
  __decorate([ pathType(.382) ], exports.Star.prototype, "innerRadius", void 0);
8569
8561
  exports.Star = __decorate([ registerUI() ], exports.Star);
8562
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
8563
+ const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
8564
+ exports.Line = class Line extends exports.UI {
8565
+ get __tag() {
8566
+ return "Line";
8567
+ }
8568
+ get toPoint() {
8569
+ const {width: width, rotation: rotation} = this.__;
8570
+ const to = getPointData();
8571
+ if (width) to.x = width;
8572
+ if (rotation) rotate$3(to, rotation);
8573
+ return to;
8574
+ }
8575
+ set toPoint(value) {
8576
+ this.width = getDistance$3(defaultPoint, value);
8577
+ this.rotation = getAngle$2(defaultPoint, value);
8578
+ if (this.height) this.height = 0;
8579
+ }
8580
+ __updatePath() {
8581
+ const data = this.__;
8582
+ const path = data.path = [];
8583
+ if (data.points) {
8584
+ drawPoints(path, data.points, data.curve, data.closed);
8585
+ } else {
8586
+ moveTo(path, 0, 0);
8587
+ lineTo(path, this.width, 0);
8588
+ }
8589
+ }
8590
+ };
8591
+ __decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
8592
+ __decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
8593
+ __decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
8594
+ __decorate([ pathType() ], exports.Line.prototype, "points", void 0);
8595
+ __decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
8596
+ __decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
8597
+ exports.Line = __decorate([ registerUI() ], exports.Line);
8570
8598
  exports.Image = class Image extends exports.Rect {
8571
8599
  get __tag() {
8572
8600
  return "Image";
@@ -8699,10 +8727,6 @@ var LeaferUI = function(exports) {
8699
8727
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
8700
8728
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
8701
8729
  }
8702
- __onUpdateSize() {
8703
- if (this.__box) this.__box.__onUpdateSize();
8704
- super.__onUpdateSize();
8705
- }
8706
8730
  __updateRenderSpread() {
8707
8731
  let width = super.__updateRenderSpread();
8708
8732
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -8713,6 +8737,11 @@ var LeaferUI = function(exports) {
8713
8737
  copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
8714
8738
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
8715
8739
  }
8740
+ __updateChange() {
8741
+ super.__updateChange();
8742
+ const box = this.__box;
8743
+ if (box) box.__onUpdateSize(), box.__updateChange();
8744
+ }
8716
8745
  __drawRenderPath(canvas) {
8717
8746
  canvas.font = this.__.__font;
8718
8747
  }
@@ -10964,11 +10993,16 @@ var LeaferUI = function(exports) {
10964
10993
  }
10965
10994
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
10966
10995
  }
10967
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10996
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10968
10997
  if (end && index < end) other.clearWorld(copyBounds);
10969
10998
  });
10970
10999
  other.recycle(copyBounds);
10971
11000
  }
11001
+ function getShadowSpread(_ui, shadow) {
11002
+ let width = 0;
11003
+ shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
11004
+ return width;
11005
+ }
10972
11006
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
10973
11007
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
10974
11008
  if (Platform.fullImageShadow) {
@@ -11040,7 +11074,11 @@ var LeaferUI = function(exports) {
11040
11074
  shadow: shadow$1,
11041
11075
  innerShadow: innerShadow,
11042
11076
  blur: blur,
11043
- backgroundBlur: backgroundBlur
11077
+ backgroundBlur: backgroundBlur,
11078
+ getShadowSpread: getShadowSpread,
11079
+ isTransformShadow(_shadow) {
11080
+ return undefined;
11081
+ }
11044
11082
  };
11045
11083
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
11046
11084
  let usedGrayscaleAlpha;
@@ -11496,16 +11534,17 @@ var LeaferUI = function(exports) {
11496
11534
  row.data = null;
11497
11535
  }
11498
11536
  function decorationText(drawData, style) {
11499
- let type;
11537
+ let type, offset = 0;
11500
11538
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
11501
11539
  drawData.decorationHeight = fontSize / 11;
11502
11540
  if (isObject(textDecoration)) {
11503
11541
  type = textDecoration.type;
11504
11542
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
11543
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
11505
11544
  } else type = textDecoration;
11506
11545
  switch (type) {
11507
11546
  case "under":
11508
- drawData.decorationY = [ fontSize * .15 ];
11547
+ drawData.decorationY = [ fontSize * .15 + offset ];
11509
11548
  break;
11510
11549
 
11511
11550
  case "delete":
@@ -11513,7 +11552,7 @@ var LeaferUI = function(exports) {
11513
11552
  break;
11514
11553
 
11515
11554
  case "under-delete":
11516
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
11555
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
11517
11556
  }
11518
11557
  }
11519
11558
  const {top: top$2, right: right$3, bottom: bottom$2, left: left$3} = exports.Direction4;
@@ -11814,7 +11853,7 @@ var LeaferUI = function(exports) {
11814
11853
  }
11815
11854
  get running() {
11816
11855
  const {editor: editor} = this;
11817
- return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector;
11856
+ return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && this.app.mode === "normal";
11818
11857
  }
11819
11858
  get isMoveMode() {
11820
11859
  return this.app && this.app.interaction.moveMode;
@@ -12112,17 +12151,13 @@ var LeaferUI = function(exports) {
12112
12151
  }
12113
12152
  toPoint(around || align, boxBounds, origin, true);
12114
12153
  if (dragBounds) {
12115
- const allowBounds = dragBounds === "parent" ? target.parent.boxBounds : dragBounds;
12116
- const childBounds = new Bounds(target.__localBoxBounds);
12117
- if (BoundsHelper.includes(new Bounds(allowBounds).spread(.1), childBounds)) {
12118
- childBounds.scaleOf(target.getLocalPointByInner(origin), scaleX, scaleY);
12119
- if (!BoundsHelper.includes(allowBounds, childBounds)) {
12120
- const realBounds = childBounds.getIntersect(allowBounds);
12121
- const fitScaleX = realBounds.width / childBounds.width, fitScaleY = realBounds.height / childBounds.height;
12122
- if (useScaleX) scaleX *= fitScaleX;
12123
- if (useScaleY) scaleY *= fitScaleY;
12124
- }
12125
- }
12154
+ const scaleData = {
12155
+ x: scaleX,
12156
+ y: scaleY
12157
+ };
12158
+ DragBoundsHelper.limitScaleOf(target, origin, scaleData);
12159
+ scaleX = scaleData.x;
12160
+ scaleY = scaleData.y;
12126
12161
  }
12127
12162
  if (useScaleX && widthRange) {
12128
12163
  const nowWidth = boxBounds.width * target.scaleX;
@@ -13626,7 +13661,9 @@ var LeaferUI = function(exports) {
13626
13661
  listenTargetEvents() {
13627
13662
  if (!this.targetEventIds.length) {
13628
13663
  const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
13629
- this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), targetLeafer && targetLeafer.on_(PropertyEvent.SCROLL, this.onChildScroll, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this) ];
13664
+ this.targetEventIds = [ leafer.on_(RenderEvent.START, this.onRenderStart, this), targetLeafer && targetLeafer.on_(PropertyEvent.SCROLL, this.onChildScroll, this), app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this), app.on_(LeaferEvent.UPDATE_MODE, data => {
13665
+ if (data.mode && data.mode !== "normal") this.cancel();
13666
+ }) ];
13630
13667
  if (editMask.visible) editMask.forceRender();
13631
13668
  }
13632
13669
  }
@@ -17822,6 +17859,8 @@ var LeaferUI = function(exports) {
17822
17859
  renderBounds: renderBounds,
17823
17860
  trimBounds: trimBounds
17824
17861
  };
17862
+ const app = leafer && leafer.app;
17863
+ if (app && app.canvasManager) app.canvasManager.clearRecycled();
17825
17864
  }
17826
17865
  } catch (error) {
17827
17866
  result = {