@leafer/miniapp 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() {
@@ -7628,7 +7630,7 @@ class Picker {
7628
7630
  item = path.list[i];
7629
7631
  if (!item.__.hittable) break;
7630
7632
  hittablePath.addAt(item, 0);
7631
- if (!item.__.hitChildren) break;
7633
+ if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
7632
7634
  }
7633
7635
  return hittablePath;
7634
7636
  }
@@ -8085,8 +8087,6 @@ class TextData extends UIData {
8085
8087
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
8086
8088
  box.set(value);
8087
8089
  if (boxLayout.strokeChanged) layout.strokeChange();
8088
- if (boxLayout.renderChanged) layout.renderChange();
8089
- box.__updateChange();
8090
8090
  } else if (box) {
8091
8091
  t.__box = box.parent = null;
8092
8092
  box.destroy();
@@ -8156,7 +8156,7 @@ const UIBounds = {
8156
8156
  __updateRenderSpread() {
8157
8157
  let width = 0;
8158
8158
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
8159
- 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));
8159
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
8160
8160
  if (blur) width = Math.max(width, blur);
8161
8161
  if (filter) width += Filter.getSpread(filter);
8162
8162
  if (renderSpread) width += renderSpread;
@@ -8169,36 +8169,69 @@ const UIBounds = {
8169
8169
  }
8170
8170
  };
8171
8171
 
8172
+ const {float: float$1} = MathHelper;
8173
+
8174
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
8175
+
8172
8176
  const DragBoundsHelper = {
8177
+ limitMove(leaf, move) {
8178
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8179
+ if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
8180
+ D$2.axisMove(leaf, move);
8181
+ },
8182
+ limitScaleOf(leaf, origin, scale) {
8183
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8184
+ if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
8185
+ },
8186
+ axisMove(leaf, move) {
8187
+ const {draggable: draggable} = leaf;
8188
+ if (draggable === "x") move.y = 0;
8189
+ if (draggable === "y") move.x = 0;
8190
+ },
8191
+ getDragBounds(leaf) {
8192
+ const {dragBounds: dragBounds} = leaf;
8193
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
8194
+ },
8195
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
8196
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
8197
+ },
8173
8198
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
8174
8199
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
8175
8200
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
8176
8201
  if (!change) move = Object.assign({}, move);
8177
- const isBiggerWidth = content.width > dragBounds.width;
8178
- const isBiggerHeight = content.height > dragBounds.height;
8179
- if (isBiggerWidth && dragBoundsType !== "outer") {
8202
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8180
8203
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
8181
8204
  } else {
8182
8205
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8183
8206
  }
8184
- if (isBiggerHeight && dragBoundsType !== "outer") {
8207
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8185
8208
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8186
8209
  } else {
8187
8210
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8188
8211
  }
8189
- move.x = MathHelper.float(move.x);
8190
- move.y = MathHelper.float(move.y);
8212
+ move.x = float$1(move.x);
8213
+ move.y = float$1(move.y);
8191
8214
  return move;
8192
8215
  },
8193
- axisMove(leaf, move) {
8194
- const {draggable: draggable} = leaf;
8195
- if (draggable === "x") move.y = 0;
8196
- if (draggable === "y") move.x = 0;
8197
- },
8198
- limitMove(leaf, move) {
8199
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8200
- if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
8201
- D$2.axisMove(leaf, move);
8216
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
8217
+ if (!change) scale = Object.assign({}, scale);
8218
+ let fitScaleX, fitScaleY;
8219
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
8220
+ tempMerge.set(tempContent).add(dragBounds);
8221
+ tempIntersect.set(tempContent).intersect(dragBounds);
8222
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8223
+ fitScaleX = tempMerge.width / tempContent.width;
8224
+ } else {
8225
+ fitScaleX = tempIntersect.width / tempContent.width;
8226
+ }
8227
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8228
+ fitScaleY = tempMerge.height / tempContent.height;
8229
+ } else {
8230
+ fitScaleY = tempIntersect.height / tempContent.height;
8231
+ }
8232
+ scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
8233
+ scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
8234
+ return scale;
8202
8235
  }
8203
8236
  };
8204
8237
 
@@ -8216,7 +8249,7 @@ const UIRender = {
8216
8249
  }
8217
8250
  if (data.__useEffect) {
8218
8251
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8219
- 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"));
8252
+ 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"));
8220
8253
  data.__useEffect = !!(shadow || otherEffect);
8221
8254
  }
8222
8255
  data.__checkSingle();
@@ -8854,7 +8887,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8854
8887
  } else if (attrName === "zIndex") {
8855
8888
  this.canvas.zIndex = newValue;
8856
8889
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8857
- }
8890
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8891
+ mode: newValue
8892
+ });
8858
8893
  }
8859
8894
  return super.__setAttr(attrName, newValue);
8860
8895
  }
@@ -9037,6 +9072,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
9037
9072
 
9038
9073
  __decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
9039
9074
 
9075
+ __decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
9076
+
9040
9077
  Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
9041
9078
 
9042
9079
  let Rect = class Rect extends UI {
@@ -9229,57 +9266,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
9229
9266
 
9230
9267
  Ellipse = __decorate([ registerUI() ], Ellipse);
9231
9268
 
9232
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
9233
-
9234
- const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9235
-
9236
- let Line = class Line extends UI {
9237
- get __tag() {
9238
- return "Line";
9239
- }
9240
- get toPoint() {
9241
- const {width: width, rotation: rotation} = this.__;
9242
- const to = getPointData();
9243
- if (width) to.x = width;
9244
- if (rotation) rotate$3(to, rotation);
9245
- return to;
9246
- }
9247
- set toPoint(value) {
9248
- this.width = getDistance$3(defaultPoint, value);
9249
- this.rotation = getAngle$2(defaultPoint, value);
9250
- if (this.height) this.height = 0;
9251
- }
9252
- __updatePath() {
9253
- const data = this.__;
9254
- const path = data.path = [];
9255
- if (data.points) {
9256
- drawPoints$1(path, data.points, data.curve, data.closed);
9257
- } else {
9258
- moveTo$2(path, 0, 0);
9259
- lineTo$2(path, this.width, 0);
9260
- }
9261
- }
9262
- };
9263
-
9264
- __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9265
-
9266
- __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9267
-
9268
- __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9269
-
9270
- __decorate([ pathType() ], Line.prototype, "points", void 0);
9271
-
9272
- __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9273
-
9274
- __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9275
-
9276
- Line = __decorate([ registerUI() ], Line);
9277
-
9278
9269
  const {sin: sin$2, cos: cos$2, PI: PI$2} = Math;
9279
9270
 
9280
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
9281
-
9282
- const line = Line.prototype;
9271
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
9283
9272
 
9284
9273
  let Polygon = class Polygon extends UI {
9285
9274
  get __tag() {
@@ -9289,19 +9278,17 @@ let Polygon = class Polygon extends UI {
9289
9278
  const data = this.__;
9290
9279
  const path = data.path = [];
9291
9280
  if (data.points) {
9292
- drawPoints(path, data.points, data.curve, true);
9281
+ drawPoints$1(path, data.points, data.curve, true);
9293
9282
  } else {
9294
9283
  const {width: width, height: height, sides: sides} = data;
9295
9284
  const rx = width / 2, ry = height / 2;
9296
- moveTo$1(path, rx, 0);
9285
+ moveTo$2(path, rx, 0);
9297
9286
  for (let i = 1; i < sides; i++) {
9298
- lineTo$1(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
9287
+ lineTo$2(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
9299
9288
  }
9300
9289
  closePath$1(path);
9301
9290
  }
9302
9291
  }
9303
- __updateRenderPath() {}
9304
- __updateBoxBounds() {}
9305
9292
  };
9306
9293
 
9307
9294
  __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
@@ -9312,15 +9299,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9312
9299
 
9313
9300
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
9314
9301
 
9315
- __decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
9316
-
9317
- __decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
9318
-
9319
9302
  Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
9320
9303
 
9321
9304
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
9322
9305
 
9323
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
9306
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
9324
9307
 
9325
9308
  let Star = class Star extends UI {
9326
9309
  get __tag() {
@@ -9330,9 +9313,9 @@ let Star = class Star extends UI {
9330
9313
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9331
9314
  const rx = width / 2, ry = height / 2;
9332
9315
  const path = this.__.path = [];
9333
- moveTo(path, rx, 0);
9316
+ moveTo$1(path, rx, 0);
9334
9317
  for (let i = 1; i < corners * 2; i++) {
9335
- 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));
9318
+ 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));
9336
9319
  }
9337
9320
  closePath(path);
9338
9321
  }
@@ -9346,6 +9329,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9346
9329
 
9347
9330
  Star = __decorate([ registerUI() ], Star);
9348
9331
 
9332
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9333
+
9334
+ const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9335
+
9336
+ let Line = class Line extends UI {
9337
+ get __tag() {
9338
+ return "Line";
9339
+ }
9340
+ get toPoint() {
9341
+ const {width: width, rotation: rotation} = this.__;
9342
+ const to = getPointData();
9343
+ if (width) to.x = width;
9344
+ if (rotation) rotate$3(to, rotation);
9345
+ return to;
9346
+ }
9347
+ set toPoint(value) {
9348
+ this.width = getDistance$3(defaultPoint, value);
9349
+ this.rotation = getAngle$2(defaultPoint, value);
9350
+ if (this.height) this.height = 0;
9351
+ }
9352
+ __updatePath() {
9353
+ const data = this.__;
9354
+ const path = data.path = [];
9355
+ if (data.points) {
9356
+ drawPoints(path, data.points, data.curve, data.closed);
9357
+ } else {
9358
+ moveTo(path, 0, 0);
9359
+ lineTo(path, this.width, 0);
9360
+ }
9361
+ }
9362
+ };
9363
+
9364
+ __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9365
+
9366
+ __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9367
+
9368
+ __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9369
+
9370
+ __decorate([ pathType() ], Line.prototype, "points", void 0);
9371
+
9372
+ __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9373
+
9374
+ __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9375
+
9376
+ Line = __decorate([ registerUI() ], Line);
9377
+
9349
9378
  let Image = class Image extends Rect {
9350
9379
  get __tag() {
9351
9380
  return "Image";
@@ -9493,10 +9522,6 @@ let Text = class Text extends UI {
9493
9522
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9494
9523
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9495
9524
  }
9496
- __onUpdateSize() {
9497
- if (this.__box) this.__box.__onUpdateSize();
9498
- super.__onUpdateSize();
9499
- }
9500
9525
  __updateRenderSpread() {
9501
9526
  let width = super.__updateRenderSpread();
9502
9527
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -9507,6 +9532,11 @@ let Text = class Text extends UI {
9507
9532
  copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
9508
9533
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9509
9534
  }
9535
+ __updateChange() {
9536
+ super.__updateChange();
9537
+ const box = this.__box;
9538
+ if (box) box.__onUpdateSize(), box.__updateChange();
9539
+ }
9510
9540
  __drawRenderPath(canvas) {
9511
9541
  canvas.font = this.__.__font;
9512
9542
  }
@@ -12096,12 +12126,18 @@ function shadow$1(ui, current, shape) {
12096
12126
  }
12097
12127
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
12098
12128
  }
12099
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12129
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12100
12130
  if (end && index < end) other.clearWorld(copyBounds);
12101
12131
  });
12102
12132
  other.recycle(copyBounds);
12103
12133
  }
12104
12134
 
12135
+ function getShadowSpread(_ui, shadow) {
12136
+ let width = 0;
12137
+ 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));
12138
+ return width;
12139
+ }
12140
+
12105
12141
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
12106
12142
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
12107
12143
  if (Platform.fullImageShadow) {
@@ -12179,7 +12215,11 @@ const EffectModule = {
12179
12215
  shadow: shadow$1,
12180
12216
  innerShadow: innerShadow,
12181
12217
  blur: blur,
12182
- backgroundBlur: backgroundBlur
12218
+ backgroundBlur: backgroundBlur,
12219
+ getShadowSpread: getShadowSpread,
12220
+ isTransformShadow(_shadow) {
12221
+ return undefined;
12222
+ }
12183
12223
  };
12184
12224
 
12185
12225
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -12687,16 +12727,17 @@ function toTextChar(row) {
12687
12727
  }
12688
12728
 
12689
12729
  function decorationText(drawData, style) {
12690
- let type;
12730
+ let type, offset = 0;
12691
12731
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
12692
12732
  drawData.decorationHeight = fontSize / 11;
12693
12733
  if (isObject(textDecoration)) {
12694
12734
  type = textDecoration.type;
12695
12735
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
12736
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
12696
12737
  } else type = textDecoration;
12697
12738
  switch (type) {
12698
12739
  case "under":
12699
- drawData.decorationY = [ fontSize * .15 ];
12740
+ drawData.decorationY = [ fontSize * .15 + offset ];
12700
12741
  break;
12701
12742
 
12702
12743
  case "delete":
@@ -12704,7 +12745,7 @@ function decorationText(drawData, style) {
12704
12745
  break;
12705
12746
 
12706
12747
  case "under-delete":
12707
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
12748
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
12708
12749
  }
12709
12750
  }
12710
12751
 
@@ -13049,7 +13090,7 @@ class EditSelect extends Group {
13049
13090
  }
13050
13091
  get running() {
13051
13092
  const {editor: editor} = this;
13052
- return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector;
13093
+ return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && this.app.mode === "normal";
13053
13094
  }
13054
13095
  get isMoveMode() {
13055
13096
  return this.app && this.app.interaction.moveMode;
@@ -13351,17 +13392,13 @@ const EditDataHelper = {
13351
13392
  }
13352
13393
  toPoint(around || align, boxBounds, origin, true);
13353
13394
  if (dragBounds) {
13354
- const allowBounds = dragBounds === "parent" ? target.parent.boxBounds : dragBounds;
13355
- const childBounds = new Bounds(target.__localBoxBounds);
13356
- if (BoundsHelper.includes(new Bounds(allowBounds).spread(.1), childBounds)) {
13357
- childBounds.scaleOf(target.getLocalPointByInner(origin), scaleX, scaleY);
13358
- if (!BoundsHelper.includes(allowBounds, childBounds)) {
13359
- const realBounds = childBounds.getIntersect(allowBounds);
13360
- const fitScaleX = realBounds.width / childBounds.width, fitScaleY = realBounds.height / childBounds.height;
13361
- if (useScaleX) scaleX *= fitScaleX;
13362
- if (useScaleY) scaleY *= fitScaleY;
13363
- }
13364
- }
13395
+ const scaleData = {
13396
+ x: scaleX,
13397
+ y: scaleY
13398
+ };
13399
+ DragBoundsHelper.limitScaleOf(target, origin, scaleData);
13400
+ scaleX = scaleData.x;
13401
+ scaleY = scaleData.y;
13365
13402
  }
13366
13403
  if (useScaleX && widthRange) {
13367
13404
  const nowWidth = boxBounds.width * target.scaleX;
@@ -14922,7 +14959,9 @@ let Editor = class Editor extends Group {
14922
14959
  listenTargetEvents() {
14923
14960
  if (!this.targetEventIds.length) {
14924
14961
  const {app: app, leafer: leafer, targetLeafer: targetLeafer, editMask: editMask} = this;
14925
- 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) ];
14962
+ 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 => {
14963
+ if (data.mode && data.mode !== "normal") this.cancel();
14964
+ }) ];
14926
14965
  if (editMask.visible) editMask.forceRender();
14927
14966
  }
14928
14967
  }
@@ -19202,6 +19241,8 @@ const ExportModule = {
19202
19241
  renderBounds: renderBounds,
19203
19242
  trimBounds: trimBounds
19204
19243
  };
19244
+ const app = leafer && leafer.app;
19245
+ if (app && app.canvasManager) app.canvasManager.clearRecycled();
19205
19246
  }
19206
19247
  } catch (error) {
19207
19248
  result = {