@leafer-draw/worker 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$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
374
374
 
375
- const {float: float$1} = MathHelper;
375
+ const {float: float$2} = MathHelper;
376
376
 
377
377
  const tempPoint$3 = {};
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$6.toInnerPoint(t, origin, tempPoint$3);
428
437
  M$6.scaleOfInner(t, tempPoint$3, 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$1(cos$5(rotation));
626
+ const cosR = float$2(cos$5(rotation));
618
627
  const sinR = sin$5(rotation);
619
- scaleX = float$1(scaleX), scaleY = float$1(scaleY);
620
- skewX = cosR ? float$1((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
621
- skewY = cosR ? float$1((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
622
- rotation = float$1(rotation / OneRadian);
628
+ scaleX = float$2(scaleX), scaleY = float$2(scaleY);
629
+ skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
630
+ skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
631
+ rotation = float$2(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$2, addPoint: addPo
1141
1154
 
1142
1155
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1143
1156
 
1144
- const {float: float, fourNumber: fourNumber} = MathHelper;
1157
+ const {float: float$1, fourNumber: fourNumber} = MathHelper;
1145
1158
 
1146
1159
  const {floor: floor$2, ceil: ceil$2} = Math;
1147
1160
 
@@ -1324,10 +1337,10 @@ const BoundsHelper = {
1324
1337
  }
1325
1338
  },
1326
1339
  float(t, maxLength) {
1327
- t.x = float(t.x, maxLength);
1328
- t.y = float(t.y, maxLength);
1329
- t.width = float(t.width, maxLength);
1330
- t.height = float(t.height, maxLength);
1340
+ t.x = float$1(t.x, maxLength);
1341
+ t.y = float$1(t.y, maxLength);
1342
+ t.width = float$1(t.width, maxLength);
1343
+ t.height = float$1(t.height, maxLength);
1331
1344
  },
1332
1345
  add(t, bounds, isPoint) {
1333
1346
  right$1 = 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$7, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2162
+ const {copy: copy$7, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = 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$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
2258
2266
  w.f = round$1(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() {
@@ -7303,7 +7328,7 @@ class Renderer {
7303
7328
  };
7304
7329
  if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
7305
7330
  if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
7306
- this.target.__render(canvas, options);
7331
+ Platform.render(this.target, canvas, options);
7307
7332
  this.renderBounds = realBounds = realBounds || bounds;
7308
7333
  this.renderOptions = options;
7309
7334
  this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
@@ -7396,6 +7421,15 @@ Object.assign(Creator, {
7396
7421
 
7397
7422
  Platform.layout = Layouter.fullLayout;
7398
7423
 
7424
+ Platform.render = function(target, canvas, options) {
7425
+ const topOptions = Object.assign(Object.assign({}, options), {
7426
+ topRendering: true
7427
+ });
7428
+ options.topList = new LeafList;
7429
+ target.__render(canvas, options);
7430
+ if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
7431
+ };
7432
+
7399
7433
  function effectType(defaultValue) {
7400
7434
  return decorateLeafAttr(defaultValue, key => attr({
7401
7435
  set(value) {
@@ -7749,8 +7783,6 @@ class TextData extends UIData {
7749
7783
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
7750
7784
  box.set(value);
7751
7785
  if (boxLayout.strokeChanged) layout.strokeChange();
7752
- if (boxLayout.renderChanged) layout.renderChange();
7753
- box.__updateChange();
7754
7786
  } else if (box) {
7755
7787
  t.__box = box.parent = null;
7756
7788
  box.destroy();
@@ -7820,7 +7852,7 @@ const UIBounds = {
7820
7852
  __updateRenderSpread() {
7821
7853
  let width = 0;
7822
7854
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
7823
- 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));
7855
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
7824
7856
  if (blur) width = Math.max(width, blur);
7825
7857
  if (filter) width += Filter.getSpread(filter);
7826
7858
  if (renderSpread) width += renderSpread;
@@ -7833,36 +7865,69 @@ const UIBounds = {
7833
7865
  }
7834
7866
  };
7835
7867
 
7868
+ const {float: float} = MathHelper;
7869
+
7870
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
7871
+
7836
7872
  const DragBoundsHelper = {
7873
+ limitMove(leaf, move) {
7874
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7875
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
7876
+ D.axisMove(leaf, move);
7877
+ },
7878
+ limitScaleOf(leaf, origin, scale) {
7879
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7880
+ if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
7881
+ },
7882
+ axisMove(leaf, move) {
7883
+ const {draggable: draggable} = leaf;
7884
+ if (draggable === "x") move.y = 0;
7885
+ if (draggable === "y") move.x = 0;
7886
+ },
7887
+ getDragBounds(leaf) {
7888
+ const {dragBounds: dragBounds} = leaf;
7889
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
7890
+ },
7891
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
7892
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
7893
+ },
7837
7894
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
7838
7895
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7839
7896
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7840
7897
  if (!change) move = Object.assign({}, move);
7841
- const isBiggerWidth = content.width > dragBounds.width;
7842
- const isBiggerHeight = content.height > dragBounds.height;
7843
- if (isBiggerWidth && dragBoundsType !== "outer") {
7898
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7844
7899
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7845
7900
  } else {
7846
7901
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
7847
7902
  }
7848
- if (isBiggerHeight && dragBoundsType !== "outer") {
7903
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7849
7904
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
7850
7905
  } else {
7851
7906
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
7852
7907
  }
7853
- move.x = MathHelper.float(move.x);
7854
- move.y = MathHelper.float(move.y);
7908
+ move.x = float(move.x);
7909
+ move.y = float(move.y);
7855
7910
  return move;
7856
7911
  },
7857
- axisMove(leaf, move) {
7858
- const {draggable: draggable} = leaf;
7859
- if (draggable === "x") move.y = 0;
7860
- if (draggable === "y") move.x = 0;
7861
- },
7862
- limitMove(leaf, move) {
7863
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7864
- if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
7865
- D.axisMove(leaf, move);
7912
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
7913
+ if (!change) scale = Object.assign({}, scale);
7914
+ let fitScaleX, fitScaleY;
7915
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
7916
+ tempMerge.set(tempContent).add(dragBounds);
7917
+ tempIntersect.set(tempContent).intersect(dragBounds);
7918
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7919
+ fitScaleX = tempMerge.width / tempContent.width;
7920
+ } else {
7921
+ fitScaleX = tempIntersect.width / tempContent.width;
7922
+ }
7923
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7924
+ fitScaleY = tempMerge.height / tempContent.height;
7925
+ } else {
7926
+ fitScaleY = tempIntersect.height / tempContent.height;
7927
+ }
7928
+ scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
7929
+ scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
7930
+ return scale;
7866
7931
  }
7867
7932
  };
7868
7933
 
@@ -7880,7 +7945,7 @@ const UIRender = {
7880
7945
  }
7881
7946
  if (data.__useEffect) {
7882
7947
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7883
- 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"));
7948
+ 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"));
7884
7949
  data.__useEffect = !!(shadow || otherEffect);
7885
7950
  }
7886
7951
  data.__checkSingle();
@@ -8140,9 +8205,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
8140
8205
 
8141
8206
  __decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
8142
8207
 
8143
- __decorate([ surfaceType(false) ], UI.prototype, "dim", void 0);
8208
+ __decorate([ dimType(false) ], UI.prototype, "dim", void 0);
8144
8209
 
8145
- __decorate([ surfaceType(false) ], UI.prototype, "dimskip", void 0);
8210
+ __decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
8146
8211
 
8147
8212
  __decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
8148
8213
 
@@ -8518,7 +8583,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8518
8583
  } else if (attrName === "zIndex") {
8519
8584
  this.canvas.zIndex = newValue;
8520
8585
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8521
- }
8586
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8587
+ mode: newValue
8588
+ });
8522
8589
  }
8523
8590
  return super.__setAttr(attrName, newValue);
8524
8591
  }
@@ -8701,6 +8768,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
8701
8768
 
8702
8769
  __decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
8703
8770
 
8771
+ __decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
8772
+
8704
8773
  Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
8705
8774
 
8706
8775
  let Rect = class Rect extends UI {
@@ -8893,57 +8962,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
8893
8962
 
8894
8963
  Ellipse = __decorate([ registerUI() ], Ellipse);
8895
8964
 
8896
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
8897
-
8898
- const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
8899
-
8900
- let Line = class Line extends UI {
8901
- get __tag() {
8902
- return "Line";
8903
- }
8904
- get toPoint() {
8905
- const {width: width, rotation: rotation} = this.__;
8906
- const to = getPointData();
8907
- if (width) to.x = width;
8908
- if (rotation) rotate$1(to, rotation);
8909
- return to;
8910
- }
8911
- set toPoint(value) {
8912
- this.width = getDistance$2(defaultPoint, value);
8913
- this.rotation = getAngle$1(defaultPoint, value);
8914
- if (this.height) this.height = 0;
8915
- }
8916
- __updatePath() {
8917
- const data = this.__;
8918
- const path = data.path = [];
8919
- if (data.points) {
8920
- drawPoints$1(path, data.points, data.curve, data.closed);
8921
- } else {
8922
- moveTo$2(path, 0, 0);
8923
- lineTo$2(path, this.width, 0);
8924
- }
8925
- }
8926
- };
8927
-
8928
- __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
8929
-
8930
- __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
8931
-
8932
- __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
8933
-
8934
- __decorate([ pathType() ], Line.prototype, "points", void 0);
8935
-
8936
- __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
8937
-
8938
- __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
8939
-
8940
- Line = __decorate([ registerUI() ], Line);
8941
-
8942
8965
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
8943
8966
 
8944
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
8945
-
8946
- const line = Line.prototype;
8967
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
8947
8968
 
8948
8969
  let Polygon = class Polygon extends UI {
8949
8970
  get __tag() {
@@ -8953,19 +8974,17 @@ let Polygon = class Polygon extends UI {
8953
8974
  const data = this.__;
8954
8975
  const path = data.path = [];
8955
8976
  if (data.points) {
8956
- drawPoints(path, data.points, data.curve, true);
8977
+ drawPoints$1(path, data.points, data.curve, true);
8957
8978
  } else {
8958
8979
  const {width: width, height: height, sides: sides} = data;
8959
8980
  const rx = width / 2, ry = height / 2;
8960
- moveTo$1(path, rx, 0);
8981
+ moveTo$2(path, rx, 0);
8961
8982
  for (let i = 1; i < sides; i++) {
8962
- lineTo$1(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
8983
+ lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
8963
8984
  }
8964
8985
  closePath$1(path);
8965
8986
  }
8966
8987
  }
8967
- __updateRenderPath() {}
8968
- __updateBoxBounds() {}
8969
8988
  };
8970
8989
 
8971
8990
  __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
@@ -8976,15 +8995,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
8976
8995
 
8977
8996
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
8978
8997
 
8979
- __decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
8980
-
8981
- __decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
8982
-
8983
8998
  Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
8984
8999
 
8985
9000
  const {sin: sin, cos: cos, PI: PI} = Math;
8986
9001
 
8987
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
9002
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
8988
9003
 
8989
9004
  let Star = class Star extends UI {
8990
9005
  get __tag() {
@@ -8994,9 +9009,9 @@ let Star = class Star extends UI {
8994
9009
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
8995
9010
  const rx = width / 2, ry = height / 2;
8996
9011
  const path = this.__.path = [];
8997
- moveTo(path, rx, 0);
9012
+ moveTo$1(path, rx, 0);
8998
9013
  for (let i = 1; i < corners * 2; i++) {
8999
- lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
9014
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
9000
9015
  }
9001
9016
  closePath(path);
9002
9017
  }
@@ -9010,6 +9025,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9010
9025
 
9011
9026
  Star = __decorate([ registerUI() ], Star);
9012
9027
 
9028
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9029
+
9030
+ const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
9031
+
9032
+ let Line = class Line extends UI {
9033
+ get __tag() {
9034
+ return "Line";
9035
+ }
9036
+ get toPoint() {
9037
+ const {width: width, rotation: rotation} = this.__;
9038
+ const to = getPointData();
9039
+ if (width) to.x = width;
9040
+ if (rotation) rotate$1(to, rotation);
9041
+ return to;
9042
+ }
9043
+ set toPoint(value) {
9044
+ this.width = getDistance$2(defaultPoint, value);
9045
+ this.rotation = getAngle$1(defaultPoint, value);
9046
+ if (this.height) this.height = 0;
9047
+ }
9048
+ __updatePath() {
9049
+ const data = this.__;
9050
+ const path = data.path = [];
9051
+ if (data.points) {
9052
+ drawPoints(path, data.points, data.curve, data.closed);
9053
+ } else {
9054
+ moveTo(path, 0, 0);
9055
+ lineTo(path, this.width, 0);
9056
+ }
9057
+ }
9058
+ };
9059
+
9060
+ __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9061
+
9062
+ __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9063
+
9064
+ __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9065
+
9066
+ __decorate([ pathType() ], Line.prototype, "points", void 0);
9067
+
9068
+ __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9069
+
9070
+ __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9071
+
9072
+ Line = __decorate([ registerUI() ], Line);
9073
+
9013
9074
  let Image = class Image extends Rect {
9014
9075
  get __tag() {
9015
9076
  return "Image";
@@ -9157,10 +9218,6 @@ let Text = class Text extends UI {
9157
9218
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9158
9219
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9159
9220
  }
9160
- __onUpdateSize() {
9161
- if (this.__box) this.__box.__onUpdateSize();
9162
- super.__onUpdateSize();
9163
- }
9164
9221
  __updateRenderSpread() {
9165
9222
  let width = super.__updateRenderSpread();
9166
9223
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -9171,6 +9228,11 @@ let Text = class Text extends UI {
9171
9228
  copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
9172
9229
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9173
9230
  }
9231
+ __updateChange() {
9232
+ super.__updateChange();
9233
+ const box = this.__box;
9234
+ if (box) box.__onUpdateSize(), box.__updateChange();
9235
+ }
9174
9236
  __drawRenderPath(canvas) {
9175
9237
  canvas.font = this.__.__font;
9176
9238
  }
@@ -10259,12 +10321,18 @@ function shadow(ui, current, shape) {
10259
10321
  }
10260
10322
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
10261
10323
  }
10262
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10324
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10263
10325
  if (end && index < end) other.clearWorld(copyBounds);
10264
10326
  });
10265
10327
  other.recycle(copyBounds);
10266
10328
  }
10267
10329
 
10330
+ function getShadowSpread(_ui, shadow) {
10331
+ let width = 0;
10332
+ 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));
10333
+ return width;
10334
+ }
10335
+
10268
10336
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
10269
10337
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
10270
10338
  if (Platform.fullImageShadow) {
@@ -10342,7 +10410,11 @@ const EffectModule = {
10342
10410
  shadow: shadow,
10343
10411
  innerShadow: innerShadow,
10344
10412
  blur: blur,
10345
- backgroundBlur: backgroundBlur
10413
+ backgroundBlur: backgroundBlur,
10414
+ getShadowSpread: getShadowSpread,
10415
+ isTransformShadow(_shadow) {
10416
+ return undefined;
10417
+ }
10346
10418
  };
10347
10419
 
10348
10420
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -10850,16 +10922,17 @@ function toTextChar(row) {
10850
10922
  }
10851
10923
 
10852
10924
  function decorationText(drawData, style) {
10853
- let type;
10925
+ let type, offset = 0;
10854
10926
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
10855
10927
  drawData.decorationHeight = fontSize / 11;
10856
10928
  if (isObject(textDecoration)) {
10857
10929
  type = textDecoration.type;
10858
10930
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
10931
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
10859
10932
  } else type = textDecoration;
10860
10933
  switch (type) {
10861
10934
  case "under":
10862
- drawData.decorationY = [ fontSize * .15 ];
10935
+ drawData.decorationY = [ fontSize * .15 + offset ];
10863
10936
  break;
10864
10937
 
10865
10938
  case "delete":
@@ -10867,7 +10940,7 @@ function decorationText(drawData, style) {
10867
10940
  break;
10868
10941
 
10869
10942
  case "under-delete":
10870
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
10943
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
10871
10944
  }
10872
10945
  }
10873
10946
 
@@ -10965,4 +11038,4 @@ Object.assign(Effect, EffectModule);
10965
11038
 
10966
11039
  useCanvas();
10967
11040
 
10968
- export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, 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, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
11041
+ export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, 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, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };