@leafer/miniapp 1.9.5 → 1.9.7

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
 
@@ -423,6 +423,15 @@ const MatrixHelper = {
423
423
  t.c *= scaleY;
424
424
  t.d *= scaleY;
425
425
  },
426
+ pixelScale(t, pixelRatio, to) {
427
+ to || (to = t);
428
+ to.a = t.a * pixelRatio;
429
+ to.b = t.b * pixelRatio;
430
+ to.c = t.c * pixelRatio;
431
+ to.d = t.d * pixelRatio;
432
+ to.e = t.e * pixelRatio;
433
+ to.f = t.f * pixelRatio;
434
+ },
426
435
  scaleOfOuter(t, origin, scaleX, scaleY) {
427
436
  M$a.toInnerPoint(t, origin, tempPoint$4);
428
437
  M$a.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
@@ -614,12 +623,12 @@ const MatrixHelper = {
614
623
  const cosR = c / scaleY;
615
624
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
616
625
  }
617
- const cosR = float$2(cos$6(rotation));
626
+ const cosR = float$3(cos$6(rotation));
618
627
  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);
628
+ scaleX = float$3(scaleX), scaleY = float$3(scaleY);
629
+ skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
630
+ skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
631
+ rotation = float$3(rotation / OneRadian);
623
632
  } else {
624
633
  scaleX = a;
625
634
  scaleY = d;
@@ -922,6 +931,10 @@ class Matrix {
922
931
  this.scaleY *= y || x;
923
932
  return this;
924
933
  }
934
+ pixelScale(pixelRatio) {
935
+ MatrixHelper.pixelScale(this, pixelRatio);
936
+ return this;
937
+ }
925
938
  scaleOfOuter(origin, x, y) {
926
939
  MatrixHelper.scaleOfOuter(this, origin, x, y);
927
940
  return this;
@@ -1141,7 +1154,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPo
1141
1154
 
1142
1155
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1143
1156
 
1144
- const {float: float$1, fourNumber: fourNumber$1} = MathHelper;
1157
+ const {float: float$2, fourNumber: fourNumber$1} = MathHelper;
1145
1158
 
1146
1159
  const {floor: floor$3, ceil: ceil$3} = Math;
1147
1160
 
@@ -1324,10 +1337,10 @@ const BoundsHelper = {
1324
1337
  }
1325
1338
  },
1326
1339
  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);
1340
+ t.x = float$2(t.x, maxLength);
1341
+ t.y = float$2(t.y, maxLength);
1342
+ t.width = float$2(t.width, maxLength);
1343
+ t.height = float$2(t.height, maxLength);
1331
1344
  },
1332
1345
  add(t, bounds, isPoint) {
1333
1346
  right$4 = t.x + t.width;
@@ -2146,7 +2159,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
2146
2159
 
2147
2160
  __decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
2148
2161
 
2149
- const {copy: copy$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2162
+ const {copy: copy$b, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2150
2163
 
2151
2164
  const minSize = {
2152
2165
  width: 1,
@@ -2247,12 +2260,7 @@ class LeaferCanvasBase extends Canvas$1 {
2247
2260
  setWorld(matrix, parentMatrix) {
2248
2261
  const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
2249
2262
  if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
2250
- w.a = matrix.a * pixelRatio;
2251
- w.b = matrix.b * pixelRatio;
2252
- w.c = matrix.c * pixelRatio;
2253
- w.d = matrix.d * pixelRatio;
2254
- w.e = matrix.e * pixelRatio;
2255
- w.f = matrix.f * pixelRatio;
2263
+ pixelScale(matrix, pixelRatio, w);
2256
2264
  if (pixelSnap) {
2257
2265
  if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$4(w.e - .5) + .5, w.f = round$4(w.f - .5) + .5; else w.e = round$4(w.e),
2258
2266
  w.f = round$4(w.f);
@@ -4265,6 +4273,18 @@ function surfaceType(defaultValue) {
4265
4273
  }));
4266
4274
  }
4267
4275
 
4276
+ function dimType(defaultValue) {
4277
+ return decorateLeafAttr(defaultValue, key => attr({
4278
+ set(value) {
4279
+ if (this.__setAttr(key, value)) {
4280
+ const data = this.__;
4281
+ DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
4282
+ this.__layout.surfaceChange();
4283
+ }
4284
+ }
4285
+ }));
4286
+ }
4287
+
4268
4288
  function opacityType(defaultValue) {
4269
4289
  return decorateLeafAttr(defaultValue, key => attr({
4270
4290
  set(value) {
@@ -4309,7 +4329,7 @@ function sortType(defaultValue) {
4309
4329
  return decorateLeafAttr(defaultValue, key => attr({
4310
4330
  set(value) {
4311
4331
  if (this.__setAttr(key, value)) {
4312
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
4332
+ this.__layout.surfaceChange();
4313
4333
  this.waitParent(() => {
4314
4334
  this.parent.__layout.childrenSortChange();
4315
4335
  });
@@ -4346,7 +4366,7 @@ function hitType(defaultValue) {
4346
4366
  set(value) {
4347
4367
  if (this.__setAttr(key, value)) {
4348
4368
  this.__layout.hitCanvasChanged = true;
4349
- if (Debug.showBounds === "hit") this.__layout.surfaceChanged || this.__layout.surfaceChange();
4369
+ if (Debug.showBounds === "hit") this.__layout.surfaceChange();
4350
4370
  if (this.leafer) this.leafer.updateCursor();
4351
4371
  }
4352
4372
  }
@@ -5463,6 +5483,8 @@ LeaferEvent.RESTART = "leafer.restart";
5463
5483
 
5464
5484
  LeaferEvent.END = "leafer.end";
5465
5485
 
5486
+ LeaferEvent.UPDATE_MODE = "leafer.update_mode";
5487
+
5466
5488
  LeaferEvent.TRANSFORM = "leafer.transform";
5467
5489
 
5468
5490
  LeaferEvent.MOVE = "leafer.move";
@@ -5859,6 +5881,7 @@ const LeafRender = {
5859
5881
  if (options.shape) return this.__renderShape(canvas, options);
5860
5882
  if (this.__worldOpacity) {
5861
5883
  const data = this.__;
5884
+ if (data.bright && !options.topRendering) return options.topList.add(this);
5862
5885
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5863
5886
  canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5864
5887
  if (this.__.__single) {
@@ -5907,7 +5930,9 @@ const BranchRender = {
5907
5930
  this.__nowWorld = this.__getNowWorld(options);
5908
5931
  if (this.__worldOpacity) {
5909
5932
  const data = this.__;
5910
- if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5933
+ if (data.__useDim) {
5934
+ if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5935
+ }
5911
5936
  if (data.__single && !this.isBranchLeaf) {
5912
5937
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5913
5938
  const tempCanvas = canvas.getSameCanvas(false, true);
@@ -6749,7 +6774,7 @@ class LeafLevelList {
6749
6774
  }
6750
6775
  }
6751
6776
 
6752
- const version = "1.9.5";
6777
+ const version = "1.9.7";
6753
6778
 
6754
6779
  class LeaferCanvas extends LeaferCanvasBase {
6755
6780
  get allowBackgroundColor() {
@@ -7456,7 +7481,7 @@ class Renderer {
7456
7481
  };
7457
7482
  if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
7458
7483
  if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
7459
- this.target.__render(canvas, options);
7484
+ Platform.render(this.target, canvas, options);
7460
7485
  this.renderBounds = realBounds = realBounds || bounds;
7461
7486
  this.renderOptions = options;
7462
7487
  this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
@@ -7628,7 +7653,7 @@ class Picker {
7628
7653
  item = path.list[i];
7629
7654
  if (!item.__.hittable) break;
7630
7655
  hittablePath.addAt(item, 0);
7631
- if (!item.__.hitChildren) break;
7656
+ if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
7632
7657
  }
7633
7658
  return hittablePath;
7634
7659
  }
@@ -7732,6 +7757,15 @@ Object.assign(Creator, {
7732
7757
 
7733
7758
  Platform.layout = Layouter.fullLayout;
7734
7759
 
7760
+ Platform.render = function(target, canvas, options) {
7761
+ const topOptions = Object.assign(Object.assign({}, options), {
7762
+ topRendering: true
7763
+ });
7764
+ options.topList = new LeafList;
7765
+ target.__render(canvas, options);
7766
+ if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
7767
+ };
7768
+
7735
7769
  function effectType(defaultValue) {
7736
7770
  return decorateLeafAttr(defaultValue, key => attr({
7737
7771
  set(value) {
@@ -8085,8 +8119,6 @@ class TextData extends UIData {
8085
8119
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
8086
8120
  box.set(value);
8087
8121
  if (boxLayout.strokeChanged) layout.strokeChange();
8088
- if (boxLayout.renderChanged) layout.renderChange();
8089
- box.__updateChange();
8090
8122
  } else if (box) {
8091
8123
  t.__box = box.parent = null;
8092
8124
  box.destroy();
@@ -8156,7 +8188,7 @@ const UIBounds = {
8156
8188
  __updateRenderSpread() {
8157
8189
  let width = 0;
8158
8190
  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));
8191
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
8160
8192
  if (blur) width = Math.max(width, blur);
8161
8193
  if (filter) width += Filter.getSpread(filter);
8162
8194
  if (renderSpread) width += renderSpread;
@@ -8169,36 +8201,69 @@ const UIBounds = {
8169
8201
  }
8170
8202
  };
8171
8203
 
8204
+ const {float: float$1} = MathHelper;
8205
+
8206
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
8207
+
8172
8208
  const DragBoundsHelper = {
8209
+ limitMove(leaf, move) {
8210
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8211
+ if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
8212
+ D$2.axisMove(leaf, move);
8213
+ },
8214
+ limitScaleOf(leaf, origin, scale) {
8215
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8216
+ if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
8217
+ },
8218
+ axisMove(leaf, move) {
8219
+ const {draggable: draggable} = leaf;
8220
+ if (draggable === "x") move.y = 0;
8221
+ if (draggable === "y") move.x = 0;
8222
+ },
8223
+ getDragBounds(leaf) {
8224
+ const {dragBounds: dragBounds} = leaf;
8225
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
8226
+ },
8227
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
8228
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
8229
+ },
8173
8230
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
8174
8231
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
8175
8232
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
8176
8233
  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") {
8234
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8180
8235
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
8181
8236
  } else {
8182
8237
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8183
8238
  }
8184
- if (isBiggerHeight && dragBoundsType !== "outer") {
8239
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8185
8240
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8186
8241
  } else {
8187
8242
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8188
8243
  }
8189
- move.x = MathHelper.float(move.x);
8190
- move.y = MathHelper.float(move.y);
8244
+ move.x = float$1(move.x);
8245
+ move.y = float$1(move.y);
8191
8246
  return move;
8192
8247
  },
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);
8248
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
8249
+ if (!change) scale = Object.assign({}, scale);
8250
+ let fitScaleX, fitScaleY;
8251
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
8252
+ tempMerge.set(tempContent).add(dragBounds);
8253
+ tempIntersect.set(tempContent).intersect(dragBounds);
8254
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8255
+ fitScaleX = tempMerge.width / tempContent.width;
8256
+ } else {
8257
+ fitScaleX = tempIntersect.width / tempContent.width;
8258
+ }
8259
+ if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8260
+ fitScaleY = tempMerge.height / tempContent.height;
8261
+ } else {
8262
+ fitScaleY = tempIntersect.height / tempContent.height;
8263
+ }
8264
+ scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
8265
+ scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
8266
+ return scale;
8202
8267
  }
8203
8268
  };
8204
8269
 
@@ -8216,7 +8281,7 @@ const UIRender = {
8216
8281
  }
8217
8282
  if (data.__useEffect) {
8218
8283
  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"));
8284
+ 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
8285
  data.__useEffect = !!(shadow || otherEffect);
8221
8286
  }
8222
8287
  data.__checkSingle();
@@ -8476,9 +8541,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
8476
8541
 
8477
8542
  __decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
8478
8543
 
8479
- __decorate([ surfaceType(false) ], UI.prototype, "dim", void 0);
8544
+ __decorate([ dimType(false) ], UI.prototype, "dim", void 0);
8480
8545
 
8481
- __decorate([ surfaceType(false) ], UI.prototype, "dimskip", void 0);
8546
+ __decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
8482
8547
 
8483
8548
  __decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
8484
8549
 
@@ -8854,7 +8919,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8854
8919
  } else if (attrName === "zIndex") {
8855
8920
  this.canvas.zIndex = newValue;
8856
8921
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8857
- }
8922
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8923
+ mode: newValue
8924
+ });
8858
8925
  }
8859
8926
  return super.__setAttr(attrName, newValue);
8860
8927
  }
@@ -9037,6 +9104,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
9037
9104
 
9038
9105
  __decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
9039
9106
 
9107
+ __decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
9108
+
9040
9109
  Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
9041
9110
 
9042
9111
  let Rect = class Rect extends UI {
@@ -9229,57 +9298,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
9229
9298
 
9230
9299
  Ellipse = __decorate([ registerUI() ], Ellipse);
9231
9300
 
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
9301
  const {sin: sin$2, cos: cos$2, PI: PI$2} = Math;
9279
9302
 
9280
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
9281
-
9282
- const line = Line.prototype;
9303
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
9283
9304
 
9284
9305
  let Polygon = class Polygon extends UI {
9285
9306
  get __tag() {
@@ -9289,19 +9310,17 @@ let Polygon = class Polygon extends UI {
9289
9310
  const data = this.__;
9290
9311
  const path = data.path = [];
9291
9312
  if (data.points) {
9292
- drawPoints(path, data.points, data.curve, true);
9313
+ drawPoints$1(path, data.points, data.curve, true);
9293
9314
  } else {
9294
9315
  const {width: width, height: height, sides: sides} = data;
9295
9316
  const rx = width / 2, ry = height / 2;
9296
- moveTo$1(path, rx, 0);
9317
+ moveTo$2(path, rx, 0);
9297
9318
  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));
9319
+ lineTo$2(path, rx + rx * sin$2(i * 2 * PI$2 / sides), ry - ry * cos$2(i * 2 * PI$2 / sides));
9299
9320
  }
9300
9321
  closePath$1(path);
9301
9322
  }
9302
9323
  }
9303
- __updateRenderPath() {}
9304
- __updateBoxBounds() {}
9305
9324
  };
9306
9325
 
9307
9326
  __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
@@ -9312,15 +9331,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9312
9331
 
9313
9332
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
9314
9333
 
9315
- __decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
9316
-
9317
- __decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
9318
-
9319
9334
  Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
9320
9335
 
9321
9336
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
9322
9337
 
9323
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
9338
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
9324
9339
 
9325
9340
  let Star = class Star extends UI {
9326
9341
  get __tag() {
@@ -9330,9 +9345,9 @@ let Star = class Star extends UI {
9330
9345
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9331
9346
  const rx = width / 2, ry = height / 2;
9332
9347
  const path = this.__.path = [];
9333
- moveTo(path, rx, 0);
9348
+ moveTo$1(path, rx, 0);
9334
9349
  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));
9350
+ 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
9351
  }
9337
9352
  closePath(path);
9338
9353
  }
@@ -9346,6 +9361,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9346
9361
 
9347
9362
  Star = __decorate([ registerUI() ], Star);
9348
9363
 
9364
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9365
+
9366
+ const {rotate: rotate$3, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9367
+
9368
+ let Line = class Line extends UI {
9369
+ get __tag() {
9370
+ return "Line";
9371
+ }
9372
+ get toPoint() {
9373
+ const {width: width, rotation: rotation} = this.__;
9374
+ const to = getPointData();
9375
+ if (width) to.x = width;
9376
+ if (rotation) rotate$3(to, rotation);
9377
+ return to;
9378
+ }
9379
+ set toPoint(value) {
9380
+ this.width = getDistance$3(defaultPoint, value);
9381
+ this.rotation = getAngle$2(defaultPoint, value);
9382
+ if (this.height) this.height = 0;
9383
+ }
9384
+ __updatePath() {
9385
+ const data = this.__;
9386
+ const path = data.path = [];
9387
+ if (data.points) {
9388
+ drawPoints(path, data.points, data.curve, data.closed);
9389
+ } else {
9390
+ moveTo(path, 0, 0);
9391
+ lineTo(path, this.width, 0);
9392
+ }
9393
+ }
9394
+ };
9395
+
9396
+ __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9397
+
9398
+ __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9399
+
9400
+ __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9401
+
9402
+ __decorate([ pathType() ], Line.prototype, "points", void 0);
9403
+
9404
+ __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9405
+
9406
+ __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9407
+
9408
+ Line = __decorate([ registerUI() ], Line);
9409
+
9349
9410
  let Image = class Image extends Rect {
9350
9411
  get __tag() {
9351
9412
  return "Image";
@@ -9493,10 +9554,6 @@ let Text = class Text extends UI {
9493
9554
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9494
9555
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9495
9556
  }
9496
- __onUpdateSize() {
9497
- if (this.__box) this.__box.__onUpdateSize();
9498
- super.__onUpdateSize();
9499
- }
9500
9557
  __updateRenderSpread() {
9501
9558
  let width = super.__updateRenderSpread();
9502
9559
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -9507,6 +9564,11 @@ let Text = class Text extends UI {
9507
9564
  copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
9508
9565
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9509
9566
  }
9567
+ __updateChange() {
9568
+ super.__updateChange();
9569
+ const box = this.__box;
9570
+ if (box) box.__onUpdateSize(), box.__updateChange();
9571
+ }
9510
9572
  __drawRenderPath(canvas) {
9511
9573
  canvas.font = this.__.__font;
9512
9574
  }
@@ -12096,12 +12158,18 @@ function shadow$1(ui, current, shape) {
12096
12158
  }
12097
12159
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
12098
12160
  }
12099
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12161
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12100
12162
  if (end && index < end) other.clearWorld(copyBounds);
12101
12163
  });
12102
12164
  other.recycle(copyBounds);
12103
12165
  }
12104
12166
 
12167
+ function getShadowSpread(_ui, shadow) {
12168
+ let width = 0;
12169
+ 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));
12170
+ return width;
12171
+ }
12172
+
12105
12173
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
12106
12174
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
12107
12175
  if (Platform.fullImageShadow) {
@@ -12179,7 +12247,11 @@ const EffectModule = {
12179
12247
  shadow: shadow$1,
12180
12248
  innerShadow: innerShadow,
12181
12249
  blur: blur,
12182
- backgroundBlur: backgroundBlur
12250
+ backgroundBlur: backgroundBlur,
12251
+ getShadowSpread: getShadowSpread,
12252
+ isTransformShadow(_shadow) {
12253
+ return undefined;
12254
+ }
12183
12255
  };
12184
12256
 
12185
12257
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -12687,16 +12759,17 @@ function toTextChar(row) {
12687
12759
  }
12688
12760
 
12689
12761
  function decorationText(drawData, style) {
12690
- let type;
12762
+ let type, offset = 0;
12691
12763
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
12692
12764
  drawData.decorationHeight = fontSize / 11;
12693
12765
  if (isObject(textDecoration)) {
12694
12766
  type = textDecoration.type;
12695
12767
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
12768
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
12696
12769
  } else type = textDecoration;
12697
12770
  switch (type) {
12698
12771
  case "under":
12699
- drawData.decorationY = [ fontSize * .15 ];
12772
+ drawData.decorationY = [ fontSize * .15 + offset ];
12700
12773
  break;
12701
12774
 
12702
12775
  case "delete":
@@ -12704,7 +12777,7 @@ function decorationText(drawData, style) {
12704
12777
  break;
12705
12778
 
12706
12779
  case "under-delete":
12707
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
12780
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
12708
12781
  }
12709
12782
  }
12710
12783
 
@@ -12851,12 +12924,15 @@ function targetAttr(fn) {
12851
12924
  set(value) {
12852
12925
  const old = this[privateKey];
12853
12926
  if (old !== value) {
12854
- if (this.config) {
12927
+ const t = this;
12928
+ if (t.config) {
12855
12929
  const isSelect = key === "target";
12856
12930
  if (isSelect) {
12931
+ t.setDimOthers(false);
12932
+ t.setBright(false);
12857
12933
  if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
12858
- if (this.single) this.element.syncEventer = null;
12859
- const {beforeSelect: beforeSelect} = this.config;
12934
+ if (t.single) t.element.syncEventer = null;
12935
+ const {beforeSelect: beforeSelect} = t.config;
12860
12936
  if (beforeSelect) {
12861
12937
  const check = beforeSelect({
12862
12938
  target: value
@@ -12866,7 +12942,7 @@ function targetAttr(fn) {
12866
12942
  }
12867
12943
  const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
12868
12944
  if (this.hasEvent(type)) this.emitEvent(new EditorEvent(type, {
12869
- editor: this,
12945
+ editor: t,
12870
12946
  value: value,
12871
12947
  oldValue: old
12872
12948
  }));
@@ -13049,7 +13125,7 @@ class EditSelect extends Group {
13049
13125
  }
13050
13126
  get running() {
13051
13127
  const {editor: editor} = this;
13052
- return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector;
13128
+ return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && this.app.mode === "normal";
13053
13129
  }
13054
13130
  get isMoveMode() {
13055
13131
  return this.app && this.app.interaction.moveMode;
@@ -13351,17 +13427,13 @@ const EditDataHelper = {
13351
13427
  }
13352
13428
  toPoint(around || align, boxBounds, origin, true);
13353
13429
  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
- }
13430
+ const scaleData = {
13431
+ x: scaleX,
13432
+ y: scaleY
13433
+ };
13434
+ DragBoundsHelper.limitScaleOf(target, origin, scaleData);
13435
+ scaleX = scaleData.x;
13436
+ scaleY = scaleData.y;
13365
13437
  }
13366
13438
  if (useScaleX && widthRange) {
13367
13439
  const nowWidth = boxBounds.width * target.scaleX;
@@ -13541,13 +13613,18 @@ const cacheCursors = {};
13541
13613
  function updatePointCursor(editBox, e) {
13542
13614
  const {enterPoint: point, dragging: dragging, skewing: skewing, resizing: resizing, flippedX: flippedX, flippedY: flippedY} = editBox;
13543
13615
  if (!point || !editBox.editor.editing || !editBox.canUse) return;
13616
+ if (point.name === "rect") return updateMoveCursor(editBox);
13544
13617
  if (point.name === "circle") return;
13545
- if (point.pointType === "button") {
13618
+ let {rotation: rotation} = editBox;
13619
+ const {pointType: pointType} = point, {moveCursor: moveCursor, resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
13620
+ if (pointType === "move") {
13621
+ point.cursor = moveCursor;
13622
+ if (!moveable) point.visible = false;
13623
+ return;
13624
+ } else if (pointType === "button") {
13546
13625
  if (!point.cursor) point.cursor = "pointer";
13547
13626
  return;
13548
13627
  }
13549
- let {rotation: rotation} = editBox;
13550
- const {pointType: pointType} = point, {resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
13551
13628
  let showResize = pointType.includes("resize");
13552
13629
  if (showResize && rotateable && (editBox.isHoldRotateKey(e) || !resizeable)) showResize = false;
13553
13630
  const showSkew = skewable && !showResize && (point.name === "resize-line" || pointType === "skew");
@@ -13628,7 +13705,7 @@ class EditBox extends Group {
13628
13705
  constructor(editor) {
13629
13706
  super();
13630
13707
  this.view = new Group;
13631
- this.rect = new Box({
13708
+ this.rect = new EditPoint({
13632
13709
  name: "rect",
13633
13710
  hitFill: "all",
13634
13711
  hitStroke: "none",
@@ -13690,12 +13767,13 @@ class EditBox extends Group {
13690
13767
  this.listenPointEvents(resizePoint, "resize", i);
13691
13768
  }
13692
13769
  this.listenPointEvents(circle, "rotate", 2);
13770
+ this.listenPointEvents(rect, "move", 8);
13693
13771
  view.addMany(...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints);
13694
13772
  this.add(view);
13695
13773
  }
13696
13774
  load() {
13697
- const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints} = this;
13698
- const {stroke: stroke, strokeWidth: strokeWidth} = mergeConfig;
13775
+ const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
13776
+ const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine} = mergeConfig;
13699
13777
  const pointsStyle = this.getPointsStyle();
13700
13778
  const middlePointsStyle = this.getMiddlePointsStyle();
13701
13779
  this.visible = !target.locked;
@@ -13704,6 +13782,10 @@ class EditBox extends Group {
13704
13782
  resizeP = resizePoints[i];
13705
13783
  resizeP.set(this.getPointStyle(i % 2 ? middlePointsStyle[(i - 1) / 2 % middlePointsStyle.length] : pointsStyle[i / 2 % pointsStyle.length]));
13706
13784
  resizeP.rotation = (i - (i % 2 ? 1 : 0)) / 2 * 90;
13785
+ if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
13786
+ pointType: "resize",
13787
+ rotation: (i - 1) / 2 * 90
13788
+ }, resizeLine || {}));
13707
13789
  }
13708
13790
  circle.set(this.getPointStyle(mergeConfig.circle || mergeConfig.rotatePoint || pointsStyle[0]));
13709
13791
  rect.set(Object.assign({
@@ -13748,10 +13830,12 @@ class EditBox extends Group {
13748
13830
  if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
13749
13831
  }
13750
13832
  updateBounds(bounds) {
13751
- const {editMask: editMask} = this.editor;
13752
- const {mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
13753
- const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
13833
+ const {editor: editor, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
13834
+ const {editMask: editMask} = editor;
13835
+ const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
13754
13836
  editMask.visible = mask ? true : 0;
13837
+ editor.setDimOthers(dimOthers);
13838
+ editor.setBright(!!dimOthers || bright);
13755
13839
  if (spread) BoundsHelper.spread(bounds, spread);
13756
13840
  if (this.view.worldOpacity) {
13757
13841
  const {width: width, height: height} = bounds;
@@ -13772,10 +13856,10 @@ class EditBox extends Group {
13772
13856
  resizeL.visible = resizeP.visible && !hideResizeLines;
13773
13857
  resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
13774
13858
  if ((i + 1) / 2 % 2) {
13775
- resizeL.width = width;
13859
+ resizeL.width = width + resizeL.height;
13776
13860
  if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
13777
13861
  } else {
13778
- resizeL.height = height;
13862
+ resizeL.width = height + resizeL.height;
13779
13863
  if (hideOnSmall && resizeP.width * 2 > height) resizeP.visible = false;
13780
13864
  }
13781
13865
  }
@@ -13852,7 +13936,7 @@ class EditBox extends Group {
13852
13936
  this.dragging = true;
13853
13937
  const point = this.dragPoint = e.current, {pointType: pointType} = point;
13854
13938
  const {editor: editor, dragStartData: dragStartData} = this, {target: target} = this, {moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable, hideOnMove: hideOnMove} = this.mergeConfig;
13855
- if (point.name === "rect") {
13939
+ if (pointType === "move") {
13856
13940
  moveable && (this.moving = true);
13857
13941
  editor.opacity = hideOnMove ? 0 : 1;
13858
13942
  } else {
@@ -13877,23 +13961,22 @@ class EditBox extends Group {
13877
13961
  if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
13878
13962
  this.dragPoint = null;
13879
13963
  this.resetDoing();
13880
- const {name: name, pointType: pointType} = e.current;
13881
- if (name === "rect") this.editor.opacity = 1;
13964
+ const {pointType: pointType} = e.current;
13965
+ if (pointType === "move") this.editor.opacity = 1;
13882
13966
  if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = null;
13883
13967
  }
13884
13968
  onDrag(e) {
13885
13969
  const {transformTool: transformTool, moving: moving, resizing: resizing, rotating: rotating, skewing: skewing} = this;
13886
13970
  if (moving) {
13887
13971
  transformTool.onMove(e);
13888
- updateMoveCursor(this);
13889
13972
  } else if (resizing || rotating || skewing) {
13890
13973
  const point = e.current;
13891
13974
  if (point.pointType) this.enterPoint = point;
13892
13975
  if (rotating) transformTool.onRotate(e);
13893
13976
  if (resizing) transformTool.onScale(e);
13894
13977
  if (skewing) transformTool.onSkew(e);
13895
- updatePointCursor(this, e);
13896
13978
  }
13979
+ updatePointCursor(this, e);
13897
13980
  }
13898
13981
  resetDoing() {
13899
13982
  if (this.canUse) this.dragging = this.gesturing = this.moving = this.resizing = this.rotating = this.skewing = false;
@@ -13989,17 +14072,15 @@ class EditBox extends Group {
13989
14072
  listenPointEvents(point, type, direction) {
13990
14073
  point.direction = direction;
13991
14074
  point.pointType = type;
13992
- const events = [ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.LEAVE, () => {
13993
- this.enterPoint = null;
13994
- } ] ];
13995
- if (point.name !== "circle") events.push([ PointerEvent.ENTER, e => {
14075
+ this.__eventIds.push(point.on_([ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.ENTER, e => {
13996
14076
  this.enterPoint = point, updatePointCursor(this, e);
13997
- } ]);
13998
- this.__eventIds.push(point.on_(events));
14077
+ } ], [ PointerEvent.LEAVE, () => {
14078
+ this.enterPoint = null;
14079
+ } ] ]));
13999
14080
  }
14000
14081
  __listenEvents() {
14001
14082
  const {rect: rect, editor: editor, __eventIds: events} = this;
14002
- events.push(rect.on_([ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.ENTER, () => updateMoveCursor(this) ], [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
14083
+ events.push(rect.on_([ [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
14003
14084
  this.waitLeafer(() => {
14004
14085
  events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ MoveEvent.END, this.onMoveEnd, this ], [ ZoomEvent.END, this.resetDoing, this ], [ RotateEvent.END, this.resetDoing, this ] ]));
14005
14086
  });
@@ -14727,6 +14808,16 @@ let Editor = class Editor extends Group {
14727
14808
  shiftItem(item) {
14728
14809
  this.hasItem(item) ? this.removeItem(item) : this.addItem(item);
14729
14810
  }
14811
+ setDimOthers(value, attrName = "dim", list) {
14812
+ if (!list) {
14813
+ const {dimTarget: dimTarget, targetLeafer: targetLeafer} = this;
14814
+ list = dimTarget ? isArray(dimTarget) ? dimTarget : [ dimTarget ] : [ targetLeafer ];
14815
+ }
14816
+ if (list[0] && list[0][attrName] !== (value || false)) list.forEach(item => DataHelper.stintSet(item, attrName, value));
14817
+ }
14818
+ setBright(value) {
14819
+ this.setDimOthers(value, "bright", this.list);
14820
+ }
14730
14821
  update() {
14731
14822
  if (this.editing) {
14732
14823
  if (!this.element.parent) return this.cancel();
@@ -14922,7 +15013,9 @@ let Editor = class Editor extends Group {
14922
15013
  listenTargetEvents() {
14923
15014
  if (!this.targetEventIds.length) {
14924
15015
  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) ];
15016
+ 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 => {
15017
+ if (data.mode && data.mode !== "normal") this.cancel();
15018
+ }) ];
14926
15019
  if (editMask.visible) editMask.forceRender();
14927
15020
  }
14928
15021
  }
@@ -14947,10 +15040,10 @@ let Editor = class Editor extends Group {
14947
15040
 
14948
15041
  __decorate([ mergeConfigAttr() ], Editor.prototype, "mergeConfig", void 0);
14949
15042
 
14950
- __decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
14951
-
14952
15043
  __decorate([ targetAttr(onTarget) ], Editor.prototype, "target", void 0);
14953
15044
 
15045
+ __decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
15046
+
14954
15047
  Editor = __decorate([ useModule(TransformTool, [ "editBox", "editTool", "emitEvent" ]) ], Editor);
14955
15048
 
14956
15049
  class InnerEditor {
@@ -19152,14 +19245,10 @@ const ExportModule = {
19152
19245
  renderOptions.bounds = canvas.bounds;
19153
19246
  }
19154
19247
  canvas.save();
19155
- if (isFrame && !isUndefined(fill)) {
19156
- const oldFill = leaf.get("fill");
19157
- leaf.fill = "";
19158
- leaf.__render(canvas, renderOptions);
19159
- leaf.fill = oldFill;
19160
- } else {
19161
- leaf.__render(canvas, renderOptions);
19162
- }
19248
+ const igroneFill = isFrame && !isUndefined(fill), oldFill = leaf.get("fill");
19249
+ if (igroneFill) leaf.fill = "";
19250
+ Platform.render(leaf, canvas, renderOptions);
19251
+ if (igroneFill) leaf.fill = oldFill;
19163
19252
  canvas.restore();
19164
19253
  if (sliceLeaf) sliceLeaf.__updateWorldOpacity();
19165
19254
  if (trim) {
@@ -19202,6 +19291,8 @@ const ExportModule = {
19202
19291
  renderBounds: renderBounds,
19203
19292
  trimBounds: trimBounds
19204
19293
  };
19294
+ const app = leafer && leafer.app;
19295
+ if (app && app.canvasManager) app.canvasManager.clearRecycled();
19205
19296
  }
19206
19297
  } catch (error) {
19207
19298
  result = {
@@ -19319,4 +19410,8 @@ Object.assign(Filter, {
19319
19410
  }
19320
19411
  });
19321
19412
 
19322
- 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, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, 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, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, 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$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
19413
+ Plugin.add("bright");
19414
+
19415
+ UI.addAttr("bright", false, dimType);
19416
+
19417
+ 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, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, 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, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, 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, 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$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };