leafer-ui 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.
package/dist/web.js CHANGED
@@ -344,7 +344,7 @@ var LeaferUI = function(exports) {
344
344
  };
345
345
  }
346
346
  const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
347
- const {float: float$1} = MathHelper;
347
+ const {float: float$2} = MathHelper;
348
348
  const tempPoint$3 = {};
349
349
  function getWorld() {
350
350
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
@@ -392,6 +392,15 @@ var LeaferUI = function(exports) {
392
392
  t.c *= scaleY;
393
393
  t.d *= scaleY;
394
394
  },
395
+ pixelScale(t, pixelRatio, to) {
396
+ to || (to = t);
397
+ to.a = t.a * pixelRatio;
398
+ to.b = t.b * pixelRatio;
399
+ to.c = t.c * pixelRatio;
400
+ to.d = t.d * pixelRatio;
401
+ to.e = t.e * pixelRatio;
402
+ to.f = t.f * pixelRatio;
403
+ },
395
404
  scaleOfOuter(t, origin, scaleX, scaleY) {
396
405
  M$6.toInnerPoint(t, origin, tempPoint$3);
397
406
  M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
@@ -583,12 +592,12 @@ var LeaferUI = function(exports) {
583
592
  const cosR = c / scaleY;
584
593
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
585
594
  }
586
- const cosR = float$1(cos$5(rotation));
595
+ const cosR = float$2(cos$5(rotation));
587
596
  const sinR = sin$5(rotation);
588
- scaleX = float$1(scaleX), scaleY = float$1(scaleY);
589
- skewX = cosR ? float$1((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
590
- skewY = cosR ? float$1((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
591
- rotation = float$1(rotation / OneRadian);
597
+ scaleX = float$2(scaleX), scaleY = float$2(scaleY);
598
+ skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
599
+ skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
600
+ rotation = float$2(rotation / OneRadian);
592
601
  } else {
593
602
  scaleX = a;
594
603
  scaleY = d;
@@ -882,6 +891,10 @@ var LeaferUI = function(exports) {
882
891
  this.scaleY *= y || x;
883
892
  return this;
884
893
  }
894
+ pixelScale(pixelRatio) {
895
+ MatrixHelper.pixelScale(this, pixelRatio);
896
+ return this;
897
+ }
885
898
  scaleOfOuter(origin, x, y) {
886
899
  MatrixHelper.scaleOfOuter(this, origin, x, y);
887
900
  return this;
@@ -1085,7 +1098,7 @@ var LeaferUI = function(exports) {
1085
1098
  };
1086
1099
  const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
1087
1100
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1088
- const {float: float, fourNumber: fourNumber} = MathHelper;
1101
+ const {float: float$1, fourNumber: fourNumber} = MathHelper;
1089
1102
  const {floor: floor$2, ceil: ceil$2} = Math;
1090
1103
  let right$1, bottom$1, boundsRight, boundsBottom;
1091
1104
  const point = {};
@@ -1262,10 +1275,10 @@ var LeaferUI = function(exports) {
1262
1275
  }
1263
1276
  },
1264
1277
  float(t, maxLength) {
1265
- t.x = float(t.x, maxLength);
1266
- t.y = float(t.y, maxLength);
1267
- t.width = float(t.width, maxLength);
1268
- t.height = float(t.height, maxLength);
1278
+ t.x = float$1(t.x, maxLength);
1279
+ t.y = float$1(t.y, maxLength);
1280
+ t.width = float$1(t.width, maxLength);
1281
+ t.height = float$1(t.height, maxLength);
1269
1282
  },
1270
1283
  add(t, bounds, isPoint) {
1271
1284
  right$1 = t.x + t.width;
@@ -1991,7 +2004,7 @@ var LeaferUI = function(exports) {
1991
2004
  __decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
1992
2005
  __decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
1993
2006
  __decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
1994
- const {copy: copy$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2007
+ const {copy: copy$8, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
1995
2008
  const minSize = {
1996
2009
  width: 1,
1997
2010
  height: 1,
@@ -2089,12 +2102,7 @@ var LeaferUI = function(exports) {
2089
2102
  setWorld(matrix, parentMatrix) {
2090
2103
  const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
2091
2104
  if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
2092
- w.a = matrix.a * pixelRatio;
2093
- w.b = matrix.b * pixelRatio;
2094
- w.c = matrix.c * pixelRatio;
2095
- w.d = matrix.d * pixelRatio;
2096
- w.e = matrix.e * pixelRatio;
2097
- w.f = matrix.f * pixelRatio;
2105
+ pixelScale(matrix, pixelRatio, w);
2098
2106
  if (pixelSnap) {
2099
2107
  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),
2100
2108
  w.f = round$1(w.f);
@@ -4008,6 +4016,17 @@ var LeaferUI = function(exports) {
4008
4016
  }
4009
4017
  }));
4010
4018
  }
4019
+ function dimType(defaultValue) {
4020
+ return decorateLeafAttr(defaultValue, key => attr({
4021
+ set(value) {
4022
+ if (this.__setAttr(key, value)) {
4023
+ const data = this.__;
4024
+ DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
4025
+ this.__layout.surfaceChange();
4026
+ }
4027
+ }
4028
+ }));
4029
+ }
4011
4030
  function opacityType(defaultValue) {
4012
4031
  return decorateLeafAttr(defaultValue, key => attr({
4013
4032
  set(value) {
@@ -4048,7 +4067,7 @@ var LeaferUI = function(exports) {
4048
4067
  return decorateLeafAttr(defaultValue, key => attr({
4049
4068
  set(value) {
4050
4069
  if (this.__setAttr(key, value)) {
4051
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
4070
+ this.__layout.surfaceChange();
4052
4071
  this.waitParent(() => {
4053
4072
  this.parent.__layout.childrenSortChange();
4054
4073
  });
@@ -4082,7 +4101,7 @@ var LeaferUI = function(exports) {
4082
4101
  set(value) {
4083
4102
  if (this.__setAttr(key, value)) {
4084
4103
  this.__layout.hitCanvasChanged = true;
4085
- if (Debug.showBounds === "hit") this.__layout.surfaceChanged || this.__layout.surfaceChange();
4104
+ if (Debug.showBounds === "hit") this.__layout.surfaceChange();
4086
4105
  if (this.leafer) this.leafer.updateCursor();
4087
4106
  }
4088
4107
  }
@@ -5105,6 +5124,7 @@ var LeaferUI = function(exports) {
5105
5124
  LeaferEvent.STOP = "leafer.stop";
5106
5125
  LeaferEvent.RESTART = "leafer.restart";
5107
5126
  LeaferEvent.END = "leafer.end";
5127
+ LeaferEvent.UPDATE_MODE = "leafer.update_mode";
5108
5128
  LeaferEvent.TRANSFORM = "leafer.transform";
5109
5129
  LeaferEvent.MOVE = "leafer.move";
5110
5130
  LeaferEvent.SCALE = "leafer.scale";
@@ -5479,6 +5499,7 @@ var LeaferUI = function(exports) {
5479
5499
  if (options.shape) return this.__renderShape(canvas, options);
5480
5500
  if (this.__worldOpacity) {
5481
5501
  const data = this.__;
5502
+ if (data.bright && !options.topRendering) return options.topList.add(this);
5482
5503
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5483
5504
  canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5484
5505
  if (this.__.__single) {
@@ -5525,7 +5546,9 @@ var LeaferUI = function(exports) {
5525
5546
  this.__nowWorld = this.__getNowWorld(options);
5526
5547
  if (this.__worldOpacity) {
5527
5548
  const data = this.__;
5528
- if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5549
+ if (data.__useDim) {
5550
+ 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);
5551
+ }
5529
5552
  if (data.__single && !this.isBranchLeaf) {
5530
5553
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5531
5554
  const tempCanvas = canvas.getSameCanvas(false, true);
@@ -6350,7 +6373,7 @@ var LeaferUI = function(exports) {
6350
6373
  this.levelMap = null;
6351
6374
  }
6352
6375
  }
6353
- const version = "1.9.5";
6376
+ const version = "1.9.7";
6354
6377
  const debug$5 = Debug.get("LeaferCanvas");
6355
6378
  class LeaferCanvas extends LeaferCanvasBase {
6356
6379
  set zIndex(zIndex) {
@@ -7083,7 +7106,7 @@ var LeaferUI = function(exports) {
7083
7106
  };
7084
7107
  if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
7085
7108
  if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
7086
- this.target.__render(canvas, options);
7109
+ Platform.render(this.target, canvas, options);
7087
7110
  this.renderBounds = realBounds = realBounds || bounds;
7088
7111
  this.renderOptions = options;
7089
7112
  this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
@@ -7252,7 +7275,7 @@ var LeaferUI = function(exports) {
7252
7275
  item = path.list[i];
7253
7276
  if (!item.__.hittable) break;
7254
7277
  hittablePath.addAt(item, 0);
7255
- if (!item.__.hitChildren) break;
7278
+ if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
7256
7279
  }
7257
7280
  return hittablePath;
7258
7281
  }
@@ -7352,6 +7375,14 @@ var LeaferUI = function(exports) {
7352
7375
  selector: (target, options) => new Selector(target, options)
7353
7376
  });
7354
7377
  Platform.layout = Layouter.fullLayout;
7378
+ Platform.render = function(target, canvas, options) {
7379
+ const topOptions = Object.assign(Object.assign({}, options), {
7380
+ topRendering: true
7381
+ });
7382
+ options.topList = new LeafList;
7383
+ target.__render(canvas, options);
7384
+ if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
7385
+ };
7355
7386
  function effectType(defaultValue) {
7356
7387
  return decorateLeafAttr(defaultValue, key => attr({
7357
7388
  set(value) {
@@ -7670,8 +7701,6 @@ var LeaferUI = function(exports) {
7670
7701
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
7671
7702
  box.set(value);
7672
7703
  if (boxLayout.strokeChanged) layout.strokeChange();
7673
- if (boxLayout.renderChanged) layout.renderChange();
7674
- box.__updateChange();
7675
7704
  } else if (box) {
7676
7705
  t.__box = box.parent = null;
7677
7706
  box.destroy();
@@ -7738,7 +7767,7 @@ var LeaferUI = function(exports) {
7738
7767
  __updateRenderSpread() {
7739
7768
  let width = 0;
7740
7769
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
7741
- 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));
7770
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
7742
7771
  if (blur) width = Math.max(width, blur);
7743
7772
  if (filter) width += Filter.getSpread(filter);
7744
7773
  if (renderSpread) width += renderSpread;
@@ -7750,36 +7779,67 @@ var LeaferUI = function(exports) {
7750
7779
  return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
7751
7780
  }
7752
7781
  };
7782
+ const {float: float} = MathHelper;
7783
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
7753
7784
  const DragBoundsHelper = {
7785
+ limitMove(leaf, move) {
7786
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7787
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
7788
+ D.axisMove(leaf, move);
7789
+ },
7790
+ limitScaleOf(leaf, origin, scale) {
7791
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7792
+ if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
7793
+ },
7794
+ axisMove(leaf, move) {
7795
+ const {draggable: draggable} = leaf;
7796
+ if (draggable === "x") move.y = 0;
7797
+ if (draggable === "y") move.x = 0;
7798
+ },
7799
+ getDragBounds(leaf) {
7800
+ const {dragBounds: dragBounds} = leaf;
7801
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
7802
+ },
7803
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
7804
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
7805
+ },
7754
7806
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
7755
7807
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7756
7808
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7757
7809
  if (!change) move = Object.assign({}, move);
7758
- const isBiggerWidth = content.width > dragBounds.width;
7759
- const isBiggerHeight = content.height > dragBounds.height;
7760
- if (isBiggerWidth && dragBoundsType !== "outer") {
7810
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7761
7811
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7762
7812
  } else {
7763
7813
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
7764
7814
  }
7765
- if (isBiggerHeight && dragBoundsType !== "outer") {
7815
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7766
7816
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
7767
7817
  } else {
7768
7818
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
7769
7819
  }
7770
- move.x = MathHelper.float(move.x);
7771
- move.y = MathHelper.float(move.y);
7820
+ move.x = float(move.x);
7821
+ move.y = float(move.y);
7772
7822
  return move;
7773
7823
  },
7774
- axisMove(leaf, move) {
7775
- const {draggable: draggable} = leaf;
7776
- if (draggable === "x") move.y = 0;
7777
- if (draggable === "y") move.x = 0;
7778
- },
7779
- limitMove(leaf, move) {
7780
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7781
- if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
7782
- D.axisMove(leaf, move);
7824
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
7825
+ if (!change) scale = Object.assign({}, scale);
7826
+ let fitScaleX, fitScaleY;
7827
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
7828
+ tempMerge.set(tempContent).add(dragBounds);
7829
+ tempIntersect.set(tempContent).intersect(dragBounds);
7830
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7831
+ fitScaleX = tempMerge.width / tempContent.width;
7832
+ } else {
7833
+ fitScaleX = tempIntersect.width / tempContent.width;
7834
+ }
7835
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7836
+ fitScaleY = tempMerge.height / tempContent.height;
7837
+ } else {
7838
+ fitScaleY = tempIntersect.height / tempContent.height;
7839
+ }
7840
+ scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
7841
+ scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
7842
+ return scale;
7783
7843
  }
7784
7844
  };
7785
7845
  const D = DragBoundsHelper;
@@ -7794,7 +7854,7 @@ var LeaferUI = function(exports) {
7794
7854
  }
7795
7855
  if (data.__useEffect) {
7796
7856
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7797
- 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"));
7857
+ 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"));
7798
7858
  data.__useEffect = !!(shadow || otherEffect);
7799
7859
  }
7800
7860
  data.__checkSingle();
@@ -8040,8 +8100,8 @@ var LeaferUI = function(exports) {
8040
8100
  __decorate([ opacityType(1) ], exports.UI.prototype, "opacity", void 0);
8041
8101
  __decorate([ visibleType(true) ], exports.UI.prototype, "visible", void 0);
8042
8102
  __decorate([ surfaceType(false) ], exports.UI.prototype, "locked", void 0);
8043
- __decorate([ surfaceType(false) ], exports.UI.prototype, "dim", void 0);
8044
- __decorate([ surfaceType(false) ], exports.UI.prototype, "dimskip", void 0);
8103
+ __decorate([ dimType(false) ], exports.UI.prototype, "dim", void 0);
8104
+ __decorate([ dimType(false) ], exports.UI.prototype, "dimskip", void 0);
8045
8105
  __decorate([ sortType(0) ], exports.UI.prototype, "zIndex", void 0);
8046
8106
  __decorate([ maskType(false) ], exports.UI.prototype, "mask", void 0);
8047
8107
  __decorate([ eraserType(false) ], exports.UI.prototype, "eraser", void 0);
@@ -8346,7 +8406,9 @@ var LeaferUI = function(exports) {
8346
8406
  } else if (attrName === "zIndex") {
8347
8407
  this.canvas.zIndex = newValue;
8348
8408
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8349
- }
8409
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8410
+ mode: newValue
8411
+ });
8350
8412
  }
8351
8413
  return super.__setAttr(attrName, newValue);
8352
8414
  }
@@ -8525,6 +8587,7 @@ var LeaferUI = function(exports) {
8525
8587
  exports.Leafer.list = new LeafList;
8526
8588
  __decorate([ dataProcessor(LeaferData) ], exports.Leafer.prototype, "__", void 0);
8527
8589
  __decorate([ boundsType() ], exports.Leafer.prototype, "pixelRatio", void 0);
8590
+ __decorate([ dataType("normal") ], exports.Leafer.prototype, "mode", void 0);
8528
8591
  exports.Leafer = Leafer_1 = __decorate([ registerUI() ], exports.Leafer);
8529
8592
  exports.Rect = class Rect extends exports.UI {
8530
8593
  get __tag() {
@@ -8684,45 +8747,8 @@ var LeaferUI = function(exports) {
8684
8747
  __decorate([ pathType(0) ], exports.Ellipse.prototype, "startAngle", void 0);
8685
8748
  __decorate([ pathType(0) ], exports.Ellipse.prototype, "endAngle", void 0);
8686
8749
  exports.Ellipse = __decorate([ registerUI() ], exports.Ellipse);
8687
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
8688
- const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
8689
- exports.Line = class Line extends exports.UI {
8690
- get __tag() {
8691
- return "Line";
8692
- }
8693
- get toPoint() {
8694
- const {width: width, rotation: rotation} = this.__;
8695
- const to = getPointData();
8696
- if (width) to.x = width;
8697
- if (rotation) rotate$1(to, rotation);
8698
- return to;
8699
- }
8700
- set toPoint(value) {
8701
- this.width = getDistance$2(defaultPoint, value);
8702
- this.rotation = getAngle$1(defaultPoint, value);
8703
- if (this.height) this.height = 0;
8704
- }
8705
- __updatePath() {
8706
- const data = this.__;
8707
- const path = data.path = [];
8708
- if (data.points) {
8709
- drawPoints$1(path, data.points, data.curve, data.closed);
8710
- } else {
8711
- moveTo$2(path, 0, 0);
8712
- lineTo$2(path, this.width, 0);
8713
- }
8714
- }
8715
- };
8716
- __decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
8717
- __decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
8718
- __decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
8719
- __decorate([ pathType() ], exports.Line.prototype, "points", void 0);
8720
- __decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
8721
- __decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
8722
- exports.Line = __decorate([ registerUI() ], exports.Line);
8723
8750
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
8724
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
8725
- const line = exports.Line.prototype;
8751
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
8726
8752
  exports.Polygon = class Polygon extends exports.UI {
8727
8753
  get __tag() {
8728
8754
  return "Polygon";
@@ -8731,29 +8757,25 @@ var LeaferUI = function(exports) {
8731
8757
  const data = this.__;
8732
8758
  const path = data.path = [];
8733
8759
  if (data.points) {
8734
- drawPoints(path, data.points, data.curve, true);
8760
+ drawPoints$1(path, data.points, data.curve, true);
8735
8761
  } else {
8736
8762
  const {width: width, height: height, sides: sides} = data;
8737
8763
  const rx = width / 2, ry = height / 2;
8738
- moveTo$1(path, rx, 0);
8764
+ moveTo$2(path, rx, 0);
8739
8765
  for (let i = 1; i < sides; i++) {
8740
- lineTo$1(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
8766
+ lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
8741
8767
  }
8742
8768
  closePath$1(path);
8743
8769
  }
8744
8770
  }
8745
- __updateRenderPath() {}
8746
- __updateBoxBounds() {}
8747
8771
  };
8748
8772
  __decorate([ dataProcessor(PolygonData) ], exports.Polygon.prototype, "__", void 0);
8749
8773
  __decorate([ pathType(3) ], exports.Polygon.prototype, "sides", void 0);
8750
8774
  __decorate([ pathType() ], exports.Polygon.prototype, "points", void 0);
8751
8775
  __decorate([ pathType(0) ], exports.Polygon.prototype, "curve", void 0);
8752
- __decorate([ rewrite(line.__updateRenderPath) ], exports.Polygon.prototype, "__updateRenderPath", null);
8753
- __decorate([ rewrite(line.__updateBoxBounds) ], exports.Polygon.prototype, "__updateBoxBounds", null);
8754
8776
  exports.Polygon = __decorate([ rewriteAble(), registerUI() ], exports.Polygon);
8755
8777
  const {sin: sin, cos: cos, PI: PI} = Math;
8756
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
8778
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
8757
8779
  exports.Star = class Star extends exports.UI {
8758
8780
  get __tag() {
8759
8781
  return "Star";
@@ -8762,9 +8784,9 @@ var LeaferUI = function(exports) {
8762
8784
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
8763
8785
  const rx = width / 2, ry = height / 2;
8764
8786
  const path = this.__.path = [];
8765
- moveTo(path, rx, 0);
8787
+ moveTo$1(path, rx, 0);
8766
8788
  for (let i = 1; i < corners * 2; i++) {
8767
- lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
8789
+ 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));
8768
8790
  }
8769
8791
  closePath(path);
8770
8792
  }
@@ -8773,6 +8795,42 @@ var LeaferUI = function(exports) {
8773
8795
  __decorate([ pathType(5) ], exports.Star.prototype, "corners", void 0);
8774
8796
  __decorate([ pathType(.382) ], exports.Star.prototype, "innerRadius", void 0);
8775
8797
  exports.Star = __decorate([ registerUI() ], exports.Star);
8798
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
8799
+ const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
8800
+ exports.Line = class Line extends exports.UI {
8801
+ get __tag() {
8802
+ return "Line";
8803
+ }
8804
+ get toPoint() {
8805
+ const {width: width, rotation: rotation} = this.__;
8806
+ const to = getPointData();
8807
+ if (width) to.x = width;
8808
+ if (rotation) rotate$1(to, rotation);
8809
+ return to;
8810
+ }
8811
+ set toPoint(value) {
8812
+ this.width = getDistance$2(defaultPoint, value);
8813
+ this.rotation = getAngle$1(defaultPoint, value);
8814
+ if (this.height) this.height = 0;
8815
+ }
8816
+ __updatePath() {
8817
+ const data = this.__;
8818
+ const path = data.path = [];
8819
+ if (data.points) {
8820
+ drawPoints(path, data.points, data.curve, data.closed);
8821
+ } else {
8822
+ moveTo(path, 0, 0);
8823
+ lineTo(path, this.width, 0);
8824
+ }
8825
+ }
8826
+ };
8827
+ __decorate([ dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
8828
+ __decorate([ affectStrokeBoundsType("center") ], exports.Line.prototype, "strokeAlign", void 0);
8829
+ __decorate([ boundsType(0) ], exports.Line.prototype, "height", void 0);
8830
+ __decorate([ pathType() ], exports.Line.prototype, "points", void 0);
8831
+ __decorate([ pathType(0) ], exports.Line.prototype, "curve", void 0);
8832
+ __decorate([ pathType(false) ], exports.Line.prototype, "closed", void 0);
8833
+ exports.Line = __decorate([ registerUI() ], exports.Line);
8776
8834
  exports.Image = class Image extends exports.Rect {
8777
8835
  get __tag() {
8778
8836
  return "Image";
@@ -8905,10 +8963,6 @@ var LeaferUI = function(exports) {
8905
8963
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
8906
8964
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
8907
8965
  }
8908
- __onUpdateSize() {
8909
- if (this.__box) this.__box.__onUpdateSize();
8910
- super.__onUpdateSize();
8911
- }
8912
8966
  __updateRenderSpread() {
8913
8967
  let width = super.__updateRenderSpread();
8914
8968
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -8919,6 +8973,11 @@ var LeaferUI = function(exports) {
8919
8973
  copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
8920
8974
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
8921
8975
  }
8976
+ __updateChange() {
8977
+ super.__updateChange();
8978
+ const box = this.__box;
8979
+ if (box) box.__onUpdateSize(), box.__updateChange();
8980
+ }
8922
8981
  __drawRenderPath(canvas) {
8923
8982
  canvas.font = this.__.__font;
8924
8983
  }
@@ -10323,10 +10382,10 @@ var LeaferUI = function(exports) {
10323
10382
  };
10324
10383
  const PointerEventHelper = {
10325
10384
  convert(e, local) {
10326
- const base = InteractionHelper.getBase(e);
10385
+ const base = InteractionHelper.getBase(e), {x: x, y: y} = local;
10327
10386
  const data = Object.assign(Object.assign({}, base), {
10328
- x: local.x,
10329
- y: local.y,
10387
+ x: x,
10388
+ y: y,
10330
10389
  width: e.width,
10331
10390
  height: e.height,
10332
10391
  pointerType: e.pointerType,
@@ -10341,10 +10400,10 @@ var LeaferUI = function(exports) {
10341
10400
  return data;
10342
10401
  },
10343
10402
  convertMouse(e, local) {
10344
- const base = InteractionHelper.getBase(e);
10403
+ const base = InteractionHelper.getBase(e), {x: x, y: y} = local;
10345
10404
  return Object.assign(Object.assign({}, base), {
10346
- x: local.x,
10347
- y: local.y,
10405
+ x: x,
10406
+ y: y,
10348
10407
  width: 1,
10349
10408
  height: 1,
10350
10409
  pointerType: "mouse",
@@ -10353,10 +10412,10 @@ var LeaferUI = function(exports) {
10353
10412
  },
10354
10413
  convertTouch(e, local) {
10355
10414
  const touch = PointerEventHelper.getTouch(e);
10356
- const base = InteractionHelper.getBase(e);
10415
+ const base = InteractionHelper.getBase(e), {x: x, y: y} = local;
10357
10416
  return Object.assign(Object.assign({}, base), {
10358
- x: local.x,
10359
- y: local.y,
10417
+ x: x,
10418
+ y: y,
10360
10419
  width: 1,
10361
10420
  height: 1,
10362
10421
  pointerType: "touch",
@@ -11494,11 +11553,16 @@ var LeaferUI = function(exports) {
11494
11553
  }
11495
11554
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
11496
11555
  }
11497
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11556
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11498
11557
  if (end && index < end) other.clearWorld(copyBounds);
11499
11558
  });
11500
11559
  other.recycle(copyBounds);
11501
11560
  }
11561
+ function getShadowSpread(_ui, shadow) {
11562
+ let width = 0;
11563
+ 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));
11564
+ return width;
11565
+ }
11502
11566
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
11503
11567
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
11504
11568
  if (Platform.fullImageShadow) {
@@ -11570,7 +11634,11 @@ var LeaferUI = function(exports) {
11570
11634
  shadow: shadow,
11571
11635
  innerShadow: innerShadow,
11572
11636
  blur: blur,
11573
- backgroundBlur: backgroundBlur
11637
+ backgroundBlur: backgroundBlur,
11638
+ getShadowSpread: getShadowSpread,
11639
+ isTransformShadow(_shadow) {
11640
+ return undefined;
11641
+ }
11574
11642
  };
11575
11643
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
11576
11644
  let usedGrayscaleAlpha;
@@ -12026,16 +12094,17 @@ var LeaferUI = function(exports) {
12026
12094
  row.data = null;
12027
12095
  }
12028
12096
  function decorationText(drawData, style) {
12029
- let type;
12097
+ let type, offset = 0;
12030
12098
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
12031
12099
  drawData.decorationHeight = fontSize / 11;
12032
12100
  if (isObject(textDecoration)) {
12033
12101
  type = textDecoration.type;
12034
12102
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
12103
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
12035
12104
  } else type = textDecoration;
12036
12105
  switch (type) {
12037
12106
  case "under":
12038
- drawData.decorationY = [ fontSize * .15 ];
12107
+ drawData.decorationY = [ fontSize * .15 + offset ];
12039
12108
  break;
12040
12109
 
12041
12110
  case "delete":
@@ -12043,7 +12112,7 @@ var LeaferUI = function(exports) {
12043
12112
  break;
12044
12113
 
12045
12114
  case "under-delete":
12046
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
12115
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
12047
12116
  }
12048
12117
  }
12049
12118
  const {top: top, right: right, bottom: bottom, left: left} = exports.Direction4;
@@ -12267,6 +12336,7 @@ var LeaferUI = function(exports) {
12267
12336
  exports.defineDataProcessor = defineDataProcessor;
12268
12337
  exports.defineKey = defineKey;
12269
12338
  exports.defineLeafAttr = defineLeafAttr;
12339
+ exports.dimType = dimType;
12270
12340
  exports.doBoundsType = doBoundsType;
12271
12341
  exports.doStrokeType = doStrokeType;
12272
12342
  exports.effectType = effectType;