@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.
@@ -372,7 +372,7 @@ function getMatrixData() {
372
372
 
373
373
  const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
374
374
 
375
- const {float: float$2} = MathHelper;
375
+ const {float: float$3} = MathHelper;
376
376
 
377
377
  const tempPoint$4 = {};
378
378
 
@@ -614,12 +614,12 @@ const MatrixHelper = {
614
614
  const cosR = c / scaleY;
615
615
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
616
616
  }
617
- const cosR = float$2(cos$6(rotation));
617
+ const cosR = float$3(cos$6(rotation));
618
618
  const sinR = sin$6(rotation);
619
- scaleX = float$2(scaleX), scaleY = float$2(scaleY);
620
- skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
621
- skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
622
- rotation = float$2(rotation / OneRadian);
619
+ scaleX = float$3(scaleX), scaleY = float$3(scaleY);
620
+ skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
621
+ skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
622
+ rotation = float$3(rotation / OneRadian);
623
623
  } else {
624
624
  scaleX = a;
625
625
  scaleY = d;
@@ -1141,7 +1141,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPo
1141
1141
 
1142
1142
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1143
1143
 
1144
- const {float: float$1, fourNumber: fourNumber$1} = MathHelper;
1144
+ const {float: float$2, fourNumber: fourNumber$1} = MathHelper;
1145
1145
 
1146
1146
  const {floor: floor$3, ceil: ceil$3} = Math;
1147
1147
 
@@ -1324,10 +1324,10 @@ const BoundsHelper = {
1324
1324
  }
1325
1325
  },
1326
1326
  float(t, maxLength) {
1327
- t.x = float$1(t.x, maxLength);
1328
- t.y = float$1(t.y, maxLength);
1329
- t.width = float$1(t.width, maxLength);
1330
- t.height = float$1(t.height, maxLength);
1327
+ t.x = float$2(t.x, maxLength);
1328
+ t.y = float$2(t.y, maxLength);
1329
+ t.width = float$2(t.width, maxLength);
1330
+ t.height = float$2(t.height, maxLength);
1331
1331
  },
1332
1332
  add(t, bounds, isPoint) {
1333
1333
  right$4 = t.x + t.width;
@@ -5463,6 +5463,8 @@ LeaferEvent.RESTART = "leafer.restart";
5463
5463
 
5464
5464
  LeaferEvent.END = "leafer.end";
5465
5465
 
5466
+ LeaferEvent.UPDATE_MODE = "leafer.update_mode";
5467
+
5466
5468
  LeaferEvent.TRANSFORM = "leafer.transform";
5467
5469
 
5468
5470
  LeaferEvent.MOVE = "leafer.move";
@@ -6749,7 +6751,7 @@ class LeafLevelList {
6749
6751
  }
6750
6752
  }
6751
6753
 
6752
- const version = "1.9.5";
6754
+ const version = "1.9.6";
6753
6755
 
6754
6756
  class LeaferCanvas extends LeaferCanvasBase {
6755
6757
  get allowBackgroundColor() {
@@ -7475,7 +7477,7 @@ class Picker {
7475
7477
  item = path.list[i];
7476
7478
  if (!item.__.hittable) break;
7477
7479
  hittablePath.addAt(item, 0);
7478
- if (!item.__.hitChildren) break;
7480
+ if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
7479
7481
  }
7480
7482
  return hittablePath;
7481
7483
  }
@@ -7932,8 +7934,6 @@ class TextData extends UIData {
7932
7934
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
7933
7935
  box.set(value);
7934
7936
  if (boxLayout.strokeChanged) layout.strokeChange();
7935
- if (boxLayout.renderChanged) layout.renderChange();
7936
- box.__updateChange();
7937
7937
  } else if (box) {
7938
7938
  t.__box = box.parent = null;
7939
7939
  box.destroy();
@@ -8003,7 +8003,7 @@ const UIBounds = {
8003
8003
  __updateRenderSpread() {
8004
8004
  let width = 0;
8005
8005
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
8006
- 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));
8006
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
8007
8007
  if (blur) width = Math.max(width, blur);
8008
8008
  if (filter) width += Filter.getSpread(filter);
8009
8009
  if (renderSpread) width += renderSpread;
@@ -8016,36 +8016,69 @@ const UIBounds = {
8016
8016
  }
8017
8017
  };
8018
8018
 
8019
+ const {float: float$1} = MathHelper;
8020
+
8021
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
8022
+
8019
8023
  const DragBoundsHelper = {
8024
+ limitMove(leaf, move) {
8025
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8026
+ if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
8027
+ D$2.axisMove(leaf, move);
8028
+ },
8029
+ limitScaleOf(leaf, origin, scale) {
8030
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8031
+ if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
8032
+ },
8033
+ axisMove(leaf, move) {
8034
+ const {draggable: draggable} = leaf;
8035
+ if (draggable === "x") move.y = 0;
8036
+ if (draggable === "y") move.x = 0;
8037
+ },
8038
+ getDragBounds(leaf) {
8039
+ const {dragBounds: dragBounds} = leaf;
8040
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
8041
+ },
8042
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
8043
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
8044
+ },
8020
8045
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
8021
8046
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
8022
8047
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
8023
8048
  if (!change) move = Object.assign({}, move);
8024
- const isBiggerWidth = content.width > dragBounds.width;
8025
- const isBiggerHeight = content.height > dragBounds.height;
8026
- if (isBiggerWidth && dragBoundsType !== "outer") {
8049
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8027
8050
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
8028
8051
  } else {
8029
8052
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8030
8053
  }
8031
- if (isBiggerHeight && dragBoundsType !== "outer") {
8054
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8032
8055
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8033
8056
  } else {
8034
8057
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8035
8058
  }
8036
- move.x = MathHelper.float(move.x);
8037
- move.y = MathHelper.float(move.y);
8059
+ move.x = float$1(move.x);
8060
+ move.y = float$1(move.y);
8038
8061
  return move;
8039
8062
  },
8040
- axisMove(leaf, move) {
8041
- const {draggable: draggable} = leaf;
8042
- if (draggable === "x") move.y = 0;
8043
- if (draggable === "y") move.x = 0;
8044
- },
8045
- limitMove(leaf, move) {
8046
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8047
- if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
8048
- D$2.axisMove(leaf, move);
8063
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
8064
+ if (!change) scale = Object.assign({}, scale);
8065
+ let fitScaleX, fitScaleY;
8066
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
8067
+ tempMerge.set(tempContent).add(dragBounds);
8068
+ tempIntersect.set(tempContent).intersect(dragBounds);
8069
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8070
+ fitScaleX = tempMerge.width / tempContent.width;
8071
+ } else {
8072
+ fitScaleX = tempIntersect.width / tempContent.width;
8073
+ }
8074
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8075
+ fitScaleY = tempMerge.height / tempContent.height;
8076
+ } else {
8077
+ fitScaleY = tempIntersect.height / tempContent.height;
8078
+ }
8079
+ scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
8080
+ scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
8081
+ return scale;
8049
8082
  }
8050
8083
  };
8051
8084
 
@@ -8063,7 +8096,7 @@ const UIRender = {
8063
8096
  }
8064
8097
  if (data.__useEffect) {
8065
8098
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8066
- 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"));
8099
+ 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"));
8067
8100
  data.__useEffect = !!(shadow || otherEffect);
8068
8101
  }
8069
8102
  data.__checkSingle();
@@ -8701,7 +8734,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8701
8734
  } else if (attrName === "zIndex") {
8702
8735
  this.canvas.zIndex = newValue;
8703
8736
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8704
- }
8737
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8738
+ mode: newValue
8739
+ });
8705
8740
  }
8706
8741
  return super.__setAttr(attrName, newValue);
8707
8742
  }
@@ -8884,6 +8919,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
8884
8919
 
8885
8920
  __decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
8886
8921
 
8922
+ __decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
8923
+
8887
8924
  Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
8888
8925
 
8889
8926
  let Rect = class Rect extends UI {
@@ -9076,57 +9113,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
9076
9113
 
9077
9114
  Ellipse = __decorate([ registerUI() ], Ellipse);
9078
9115
 
9079
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
9080
-
9081
- const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9082
-
9083
- let Line = class Line extends UI {
9084
- get __tag() {
9085
- return "Line";
9086
- }
9087
- get toPoint() {
9088
- const {width: width, rotation: rotation} = this.__;
9089
- const to = getPointData();
9090
- if (width) to.x = width;
9091
- if (rotation) rotate$3(to, rotation);
9092
- return to;
9093
- }
9094
- set toPoint(value) {
9095
- this.width = getDistance$3(defaultPoint, value);
9096
- this.rotation = getAngle$2(defaultPoint, value);
9097
- if (this.height) this.height = 0;
9098
- }
9099
- __updatePath() {
9100
- const data = this.__;
9101
- const path = data.path = [];
9102
- if (data.points) {
9103
- drawPoints$1(path, data.points, data.curve, data.closed);
9104
- } else {
9105
- moveTo$2(path, 0, 0);
9106
- lineTo$2(path, this.width, 0);
9107
- }
9108
- }
9109
- };
9110
-
9111
- __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9112
-
9113
- __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9114
-
9115
- __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9116
-
9117
- __decorate([ pathType() ], Line.prototype, "points", void 0);
9118
-
9119
- __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9120
-
9121
- __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9122
-
9123
- Line = __decorate([ registerUI() ], Line);
9124
-
9125
9116
  const {sin: sin$2, cos: cos$2, PI: PI$2} = Math;
9126
9117
 
9127
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
9128
-
9129
- const line = Line.prototype;
9118
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
9130
9119
 
9131
9120
  let Polygon = class Polygon extends UI {
9132
9121
  get __tag() {
@@ -9136,19 +9125,17 @@ let Polygon = class Polygon extends UI {
9136
9125
  const data = this.__;
9137
9126
  const path = data.path = [];
9138
9127
  if (data.points) {
9139
- drawPoints(path, data.points, data.curve, true);
9128
+ drawPoints$1(path, data.points, data.curve, true);
9140
9129
  } else {
9141
9130
  const {width: width, height: height, sides: sides} = data;
9142
9131
  const rx = width / 2, ry = height / 2;
9143
- moveTo$1(path, rx, 0);
9132
+ moveTo$2(path, rx, 0);
9144
9133
  for (let i = 1; i < sides; i++) {
9145
- lineTo$1(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
9134
+ lineTo$2(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
9146
9135
  }
9147
9136
  closePath$1(path);
9148
9137
  }
9149
9138
  }
9150
- __updateRenderPath() {}
9151
- __updateBoxBounds() {}
9152
9139
  };
9153
9140
 
9154
9141
  __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
@@ -9159,15 +9146,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9159
9146
 
9160
9147
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
9161
9148
 
9162
- __decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
9163
-
9164
- __decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
9165
-
9166
9149
  Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
9167
9150
 
9168
9151
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
9169
9152
 
9170
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
9153
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
9171
9154
 
9172
9155
  let Star = class Star extends UI {
9173
9156
  get __tag() {
@@ -9177,9 +9160,9 @@ let Star = class Star extends UI {
9177
9160
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9178
9161
  const rx = width / 2, ry = height / 2;
9179
9162
  const path = this.__.path = [];
9180
- moveTo(path, rx, 0);
9163
+ moveTo$1(path, rx, 0);
9181
9164
  for (let i = 1; i < corners * 2; i++) {
9182
- 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));
9165
+ 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));
9183
9166
  }
9184
9167
  closePath(path);
9185
9168
  }
@@ -9193,6 +9176,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9193
9176
 
9194
9177
  Star = __decorate([ registerUI() ], Star);
9195
9178
 
9179
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9180
+
9181
+ const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9182
+
9183
+ let Line = class Line extends UI {
9184
+ get __tag() {
9185
+ return "Line";
9186
+ }
9187
+ get toPoint() {
9188
+ const {width: width, rotation: rotation} = this.__;
9189
+ const to = getPointData();
9190
+ if (width) to.x = width;
9191
+ if (rotation) rotate$3(to, rotation);
9192
+ return to;
9193
+ }
9194
+ set toPoint(value) {
9195
+ this.width = getDistance$3(defaultPoint, value);
9196
+ this.rotation = getAngle$2(defaultPoint, value);
9197
+ if (this.height) this.height = 0;
9198
+ }
9199
+ __updatePath() {
9200
+ const data = this.__;
9201
+ const path = data.path = [];
9202
+ if (data.points) {
9203
+ drawPoints(path, data.points, data.curve, data.closed);
9204
+ } else {
9205
+ moveTo(path, 0, 0);
9206
+ lineTo(path, this.width, 0);
9207
+ }
9208
+ }
9209
+ };
9210
+
9211
+ __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9212
+
9213
+ __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9214
+
9215
+ __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9216
+
9217
+ __decorate([ pathType() ], Line.prototype, "points", void 0);
9218
+
9219
+ __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9220
+
9221
+ __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9222
+
9223
+ Line = __decorate([ registerUI() ], Line);
9224
+
9196
9225
  let Image = class Image extends Rect {
9197
9226
  get __tag() {
9198
9227
  return "Image";
@@ -9340,10 +9369,6 @@ let Text = class Text extends UI {
9340
9369
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9341
9370
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9342
9371
  }
9343
- __onUpdateSize() {
9344
- if (this.__box) this.__box.__onUpdateSize();
9345
- super.__onUpdateSize();
9346
- }
9347
9372
  __updateRenderSpread() {
9348
9373
  let width = super.__updateRenderSpread();
9349
9374
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -9354,6 +9379,11 @@ let Text = class Text extends UI {
9354
9379
  copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
9355
9380
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9356
9381
  }
9382
+ __updateChange() {
9383
+ super.__updateChange();
9384
+ const box = this.__box;
9385
+ if (box) box.__onUpdateSize(), box.__updateChange();
9386
+ }
9357
9387
  __drawRenderPath(canvas) {
9358
9388
  canvas.font = this.__.__font;
9359
9389
  }
@@ -11831,12 +11861,18 @@ function shadow$1(ui, current, shape) {
11831
11861
  }
11832
11862
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
11833
11863
  }
11834
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11864
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11835
11865
  if (end && index < end) other.clearWorld(copyBounds);
11836
11866
  });
11837
11867
  other.recycle(copyBounds);
11838
11868
  }
11839
11869
 
11870
+ function getShadowSpread(_ui, shadow) {
11871
+ let width = 0;
11872
+ 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));
11873
+ return width;
11874
+ }
11875
+
11840
11876
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
11841
11877
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
11842
11878
  if (Platform.fullImageShadow) {
@@ -11914,7 +11950,11 @@ const EffectModule = {
11914
11950
  shadow: shadow$1,
11915
11951
  innerShadow: innerShadow,
11916
11952
  blur: blur,
11917
- backgroundBlur: backgroundBlur
11953
+ backgroundBlur: backgroundBlur,
11954
+ getShadowSpread: getShadowSpread,
11955
+ isTransformShadow(_shadow) {
11956
+ return undefined;
11957
+ }
11918
11958
  };
11919
11959
 
11920
11960
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -12422,16 +12462,17 @@ function toTextChar(row) {
12422
12462
  }
12423
12463
 
12424
12464
  function decorationText(drawData, style) {
12425
- let type;
12465
+ let type, offset = 0;
12426
12466
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
12427
12467
  drawData.decorationHeight = fontSize / 11;
12428
12468
  if (isObject(textDecoration)) {
12429
12469
  type = textDecoration.type;
12430
12470
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
12471
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
12431
12472
  } else type = textDecoration;
12432
12473
  switch (type) {
12433
12474
  case "under":
12434
- drawData.decorationY = [ fontSize * .15 ];
12475
+ drawData.decorationY = [ fontSize * .15 + offset ];
12435
12476
  break;
12436
12477
 
12437
12478
  case "delete":
@@ -12439,7 +12480,7 @@ function decorationText(drawData, style) {
12439
12480
  break;
12440
12481
 
12441
12482
  case "under-delete":
12442
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
12483
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
12443
12484
  }
12444
12485
  }
12445
12486
 
@@ -12778,7 +12819,7 @@ class EditSelect extends Group {
12778
12819
  }
12779
12820
  get running() {
12780
12821
  const {editor: editor} = this;
12781
- return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector;
12822
+ return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && this.app.mode === "normal";
12782
12823
  }
12783
12824
  get isMoveMode() {
12784
12825
  return this.app && this.app.interaction.moveMode;
@@ -13080,17 +13121,13 @@ const EditDataHelper = {
13080
13121
  }
13081
13122
  toPoint(around || align, boxBounds, origin, true);
13082
13123
  if (dragBounds) {
13083
- const allowBounds = dragBounds === "parent" ? target.parent.boxBounds : dragBounds;
13084
- const childBounds = new Bounds(target.__localBoxBounds);
13085
- if (BoundsHelper.includes(new Bounds(allowBounds).spread(.1), childBounds)) {
13086
- childBounds.scaleOf(target.getLocalPointByInner(origin), scaleX, scaleY);
13087
- if (!BoundsHelper.includes(allowBounds, childBounds)) {
13088
- const realBounds = childBounds.getIntersect(allowBounds);
13089
- const fitScaleX = realBounds.width / childBounds.width, fitScaleY = realBounds.height / childBounds.height;
13090
- if (useScaleX) scaleX *= fitScaleX;
13091
- if (useScaleY) scaleY *= fitScaleY;
13092
- }
13093
- }
13124
+ const scaleData = {
13125
+ x: scaleX,
13126
+ y: scaleY
13127
+ };
13128
+ DragBoundsHelper.limitScaleOf(target, origin, scaleData);
13129
+ scaleX = scaleData.x;
13130
+ scaleY = scaleData.y;
13094
13131
  }
13095
13132
  if (useScaleX && widthRange) {
13096
13133
  const nowWidth = boxBounds.width * target.scaleX;
@@ -14651,7 +14688,9 @@ let Editor = class Editor extends Group {
14651
14688
  listenTargetEvents() {
14652
14689
  if (!this.targetEventIds.length) {
14653
14690
  const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
14654
- 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) ];
14691
+ 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 => {
14692
+ if (data.mode && data.mode !== "normal") this.cancel();
14693
+ }) ];
14655
14694
  if (editMask.visible) editMask.forceRender();
14656
14695
  }
14657
14696
  }
@@ -19239,6 +19278,8 @@ const ExportModule = {
19239
19278
  renderBounds: renderBounds,
19240
19279
  trimBounds: trimBounds
19241
19280
  };
19281
+ const app = leafer && leafer.app;
19282
+ if (app && app.canvasManager) app.canvasManager.clearRecycled();
19242
19283
  }
19243
19284
  } catch (error) {
19244
19285
  result = {