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.
@@ -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$8, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2162
+ const {copy: copy$8, 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
  const debug$5 = Debug.get("LeaferCanvas");
6755
6780
 
@@ -7509,7 +7534,7 @@ class Renderer {
7509
7534
  };
7510
7535
  if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
7511
7536
  if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
7512
- this.target.__render(canvas, options);
7537
+ Platform.render(this.target, canvas, options);
7513
7538
  this.renderBounds = realBounds = realBounds || bounds;
7514
7539
  this.renderOptions = options;
7515
7540
  this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
@@ -7681,7 +7706,7 @@ class Picker {
7681
7706
  item = path.list[i];
7682
7707
  if (!item.__.hittable) break;
7683
7708
  hittablePath.addAt(item, 0);
7684
- if (!item.__.hitChildren) break;
7709
+ if (!item.__.hitChildren || item.isLeafer && item.mode === "draw") break;
7685
7710
  }
7686
7711
  return hittablePath;
7687
7712
  }
@@ -7785,6 +7810,15 @@ Object.assign(Creator, {
7785
7810
 
7786
7811
  Platform.layout = Layouter.fullLayout;
7787
7812
 
7813
+ Platform.render = function(target, canvas, options) {
7814
+ const topOptions = Object.assign(Object.assign({}, options), {
7815
+ topRendering: true
7816
+ });
7817
+ options.topList = new LeafList;
7818
+ target.__render(canvas, options);
7819
+ if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
7820
+ };
7821
+
7788
7822
  function effectType(defaultValue) {
7789
7823
  return decorateLeafAttr(defaultValue, key => attr({
7790
7824
  set(value) {
@@ -8138,8 +8172,6 @@ class TextData extends UIData {
8138
8172
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
8139
8173
  box.set(value);
8140
8174
  if (boxLayout.strokeChanged) layout.strokeChange();
8141
- if (boxLayout.renderChanged) layout.renderChange();
8142
- box.__updateChange();
8143
8175
  } else if (box) {
8144
8176
  t.__box = box.parent = null;
8145
8177
  box.destroy();
@@ -8209,7 +8241,7 @@ const UIBounds = {
8209
8241
  __updateRenderSpread() {
8210
8242
  let width = 0;
8211
8243
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
8212
- 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));
8244
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
8213
8245
  if (blur) width = Math.max(width, blur);
8214
8246
  if (filter) width += Filter.getSpread(filter);
8215
8247
  if (renderSpread) width += renderSpread;
@@ -8222,36 +8254,69 @@ const UIBounds = {
8222
8254
  }
8223
8255
  };
8224
8256
 
8257
+ const {float: float} = MathHelper;
8258
+
8259
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
8260
+
8225
8261
  const DragBoundsHelper = {
8262
+ limitMove(leaf, move) {
8263
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8264
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
8265
+ D.axisMove(leaf, move);
8266
+ },
8267
+ limitScaleOf(leaf, origin, scale) {
8268
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8269
+ if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
8270
+ },
8271
+ axisMove(leaf, move) {
8272
+ const {draggable: draggable} = leaf;
8273
+ if (draggable === "x") move.y = 0;
8274
+ if (draggable === "y") move.x = 0;
8275
+ },
8276
+ getDragBounds(leaf) {
8277
+ const {dragBounds: dragBounds} = leaf;
8278
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
8279
+ },
8280
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
8281
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
8282
+ },
8226
8283
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
8227
8284
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
8228
8285
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
8229
8286
  if (!change) move = Object.assign({}, move);
8230
- const isBiggerWidth = content.width > dragBounds.width;
8231
- const isBiggerHeight = content.height > dragBounds.height;
8232
- if (isBiggerWidth && dragBoundsType !== "outer") {
8287
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8233
8288
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
8234
8289
  } else {
8235
8290
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8236
8291
  }
8237
- if (isBiggerHeight && dragBoundsType !== "outer") {
8292
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8238
8293
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8239
8294
  } else {
8240
8295
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8241
8296
  }
8242
- move.x = MathHelper.float(move.x);
8243
- move.y = MathHelper.float(move.y);
8297
+ move.x = float(move.x);
8298
+ move.y = float(move.y);
8244
8299
  return move;
8245
8300
  },
8246
- axisMove(leaf, move) {
8247
- const {draggable: draggable} = leaf;
8248
- if (draggable === "x") move.y = 0;
8249
- if (draggable === "y") move.x = 0;
8250
- },
8251
- limitMove(leaf, move) {
8252
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8253
- if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
8254
- D.axisMove(leaf, move);
8301
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
8302
+ if (!change) scale = Object.assign({}, scale);
8303
+ let fitScaleX, fitScaleY;
8304
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
8305
+ tempMerge.set(tempContent).add(dragBounds);
8306
+ tempIntersect.set(tempContent).intersect(dragBounds);
8307
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8308
+ fitScaleX = tempMerge.width / tempContent.width;
8309
+ } else {
8310
+ fitScaleX = tempIntersect.width / tempContent.width;
8311
+ }
8312
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8313
+ fitScaleY = tempMerge.height / tempContent.height;
8314
+ } else {
8315
+ fitScaleY = tempIntersect.height / tempContent.height;
8316
+ }
8317
+ scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
8318
+ scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
8319
+ return scale;
8255
8320
  }
8256
8321
  };
8257
8322
 
@@ -8269,7 +8334,7 @@ const UIRender = {
8269
8334
  }
8270
8335
  if (data.__useEffect) {
8271
8336
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8272
- 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"));
8337
+ 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"));
8273
8338
  data.__useEffect = !!(shadow || otherEffect);
8274
8339
  }
8275
8340
  data.__checkSingle();
@@ -8529,9 +8594,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
8529
8594
 
8530
8595
  __decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
8531
8596
 
8532
- __decorate([ surfaceType(false) ], UI.prototype, "dim", void 0);
8597
+ __decorate([ dimType(false) ], UI.prototype, "dim", void 0);
8533
8598
 
8534
- __decorate([ surfaceType(false) ], UI.prototype, "dimskip", void 0);
8599
+ __decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
8535
8600
 
8536
8601
  __decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
8537
8602
 
@@ -8907,7 +8972,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8907
8972
  } else if (attrName === "zIndex") {
8908
8973
  this.canvas.zIndex = newValue;
8909
8974
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8910
- }
8975
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8976
+ mode: newValue
8977
+ });
8911
8978
  }
8912
8979
  return super.__setAttr(attrName, newValue);
8913
8980
  }
@@ -9090,6 +9157,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
9090
9157
 
9091
9158
  __decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
9092
9159
 
9160
+ __decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
9161
+
9093
9162
  Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
9094
9163
 
9095
9164
  let Rect = class Rect extends UI {
@@ -9282,57 +9351,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
9282
9351
 
9283
9352
  Ellipse = __decorate([ registerUI() ], Ellipse);
9284
9353
 
9285
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
9286
-
9287
- const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
9288
-
9289
- let Line = class Line extends UI {
9290
- get __tag() {
9291
- return "Line";
9292
- }
9293
- get toPoint() {
9294
- const {width: width, rotation: rotation} = this.__;
9295
- const to = getPointData();
9296
- if (width) to.x = width;
9297
- if (rotation) rotate$1(to, rotation);
9298
- return to;
9299
- }
9300
- set toPoint(value) {
9301
- this.width = getDistance$2(defaultPoint, value);
9302
- this.rotation = getAngle$1(defaultPoint, value);
9303
- if (this.height) this.height = 0;
9304
- }
9305
- __updatePath() {
9306
- const data = this.__;
9307
- const path = data.path = [];
9308
- if (data.points) {
9309
- drawPoints$1(path, data.points, data.curve, data.closed);
9310
- } else {
9311
- moveTo$2(path, 0, 0);
9312
- lineTo$2(path, this.width, 0);
9313
- }
9314
- }
9315
- };
9316
-
9317
- __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9318
-
9319
- __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9320
-
9321
- __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9322
-
9323
- __decorate([ pathType() ], Line.prototype, "points", void 0);
9324
-
9325
- __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9326
-
9327
- __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9328
-
9329
- Line = __decorate([ registerUI() ], Line);
9330
-
9331
9354
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
9332
9355
 
9333
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
9334
-
9335
- const line = Line.prototype;
9356
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
9336
9357
 
9337
9358
  let Polygon = class Polygon extends UI {
9338
9359
  get __tag() {
@@ -9342,19 +9363,17 @@ let Polygon = class Polygon extends UI {
9342
9363
  const data = this.__;
9343
9364
  const path = data.path = [];
9344
9365
  if (data.points) {
9345
- drawPoints(path, data.points, data.curve, true);
9366
+ drawPoints$1(path, data.points, data.curve, true);
9346
9367
  } else {
9347
9368
  const {width: width, height: height, sides: sides} = data;
9348
9369
  const rx = width / 2, ry = height / 2;
9349
- moveTo$1(path, rx, 0);
9370
+ moveTo$2(path, rx, 0);
9350
9371
  for (let i = 1; i < sides; i++) {
9351
- lineTo$1(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9372
+ lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9352
9373
  }
9353
9374
  closePath$1(path);
9354
9375
  }
9355
9376
  }
9356
- __updateRenderPath() {}
9357
- __updateBoxBounds() {}
9358
9377
  };
9359
9378
 
9360
9379
  __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
@@ -9365,15 +9384,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9365
9384
 
9366
9385
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
9367
9386
 
9368
- __decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
9369
-
9370
- __decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
9371
-
9372
9387
  Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
9373
9388
 
9374
9389
  const {sin: sin, cos: cos, PI: PI} = Math;
9375
9390
 
9376
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
9391
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
9377
9392
 
9378
9393
  let Star = class Star extends UI {
9379
9394
  get __tag() {
@@ -9383,9 +9398,9 @@ let Star = class Star extends UI {
9383
9398
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9384
9399
  const rx = width / 2, ry = height / 2;
9385
9400
  const path = this.__.path = [];
9386
- moveTo(path, rx, 0);
9401
+ moveTo$1(path, rx, 0);
9387
9402
  for (let i = 1; i < corners * 2; i++) {
9388
- lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
9403
+ 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));
9389
9404
  }
9390
9405
  closePath(path);
9391
9406
  }
@@ -9399,6 +9414,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9399
9414
 
9400
9415
  Star = __decorate([ registerUI() ], Star);
9401
9416
 
9417
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9418
+
9419
+ const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
9420
+
9421
+ let Line = class Line extends UI {
9422
+ get __tag() {
9423
+ return "Line";
9424
+ }
9425
+ get toPoint() {
9426
+ const {width: width, rotation: rotation} = this.__;
9427
+ const to = getPointData();
9428
+ if (width) to.x = width;
9429
+ if (rotation) rotate$1(to, rotation);
9430
+ return to;
9431
+ }
9432
+ set toPoint(value) {
9433
+ this.width = getDistance$2(defaultPoint, value);
9434
+ this.rotation = getAngle$1(defaultPoint, value);
9435
+ if (this.height) this.height = 0;
9436
+ }
9437
+ __updatePath() {
9438
+ const data = this.__;
9439
+ const path = data.path = [];
9440
+ if (data.points) {
9441
+ drawPoints(path, data.points, data.curve, data.closed);
9442
+ } else {
9443
+ moveTo(path, 0, 0);
9444
+ lineTo(path, this.width, 0);
9445
+ }
9446
+ }
9447
+ };
9448
+
9449
+ __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9450
+
9451
+ __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9452
+
9453
+ __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9454
+
9455
+ __decorate([ pathType() ], Line.prototype, "points", void 0);
9456
+
9457
+ __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9458
+
9459
+ __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9460
+
9461
+ Line = __decorate([ registerUI() ], Line);
9462
+
9402
9463
  let Image$1 = class Image extends Rect {
9403
9464
  get __tag() {
9404
9465
  return "Image";
@@ -9546,10 +9607,6 @@ let Text = class Text extends UI {
9546
9607
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9547
9608
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9548
9609
  }
9549
- __onUpdateSize() {
9550
- if (this.__box) this.__box.__onUpdateSize();
9551
- super.__onUpdateSize();
9552
- }
9553
9610
  __updateRenderSpread() {
9554
9611
  let width = super.__updateRenderSpread();
9555
9612
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -9560,6 +9617,11 @@ let Text = class Text extends UI {
9560
9617
  copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
9561
9618
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9562
9619
  }
9620
+ __updateChange() {
9621
+ super.__updateChange();
9622
+ const box = this.__box;
9623
+ if (box) box.__onUpdateSize(), box.__updateChange();
9624
+ }
9563
9625
  __drawRenderPath(canvas) {
9564
9626
  canvas.font = this.__.__font;
9565
9627
  }
@@ -11118,10 +11180,10 @@ canvas.hitPixel = function(radiusPoint, offset, scale = 1) {
11118
11180
 
11119
11181
  const PointerEventHelper = {
11120
11182
  convert(e, local) {
11121
- const base = InteractionHelper.getBase(e);
11183
+ const base = InteractionHelper.getBase(e), {x: x, y: y} = local;
11122
11184
  const data = Object.assign(Object.assign({}, base), {
11123
- x: local.x,
11124
- y: local.y,
11185
+ x: x,
11186
+ y: y,
11125
11187
  width: e.width,
11126
11188
  height: e.height,
11127
11189
  pointerType: e.pointerType,
@@ -11136,10 +11198,10 @@ const PointerEventHelper = {
11136
11198
  return data;
11137
11199
  },
11138
11200
  convertMouse(e, local) {
11139
- const base = InteractionHelper.getBase(e);
11201
+ const base = InteractionHelper.getBase(e), {x: x, y: y} = local;
11140
11202
  return Object.assign(Object.assign({}, base), {
11141
- x: local.x,
11142
- y: local.y,
11203
+ x: x,
11204
+ y: y,
11143
11205
  width: 1,
11144
11206
  height: 1,
11145
11207
  pointerType: "mouse",
@@ -11148,10 +11210,10 @@ const PointerEventHelper = {
11148
11210
  },
11149
11211
  convertTouch(e, local) {
11150
11212
  const touch = PointerEventHelper.getTouch(e);
11151
- const base = InteractionHelper.getBase(e);
11213
+ const base = InteractionHelper.getBase(e), {x: x, y: y} = local;
11152
11214
  return Object.assign(Object.assign({}, base), {
11153
- x: local.x,
11154
- y: local.y,
11215
+ x: x,
11216
+ y: y,
11155
11217
  width: 1,
11156
11218
  height: 1,
11157
11219
  pointerType: "touch",
@@ -12365,12 +12427,18 @@ function shadow(ui, current, shape) {
12365
12427
  }
12366
12428
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
12367
12429
  }
12368
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12430
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
12369
12431
  if (end && index < end) other.clearWorld(copyBounds);
12370
12432
  });
12371
12433
  other.recycle(copyBounds);
12372
12434
  }
12373
12435
 
12436
+ function getShadowSpread(_ui, shadow) {
12437
+ let width = 0;
12438
+ 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));
12439
+ return width;
12440
+ }
12441
+
12374
12442
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
12375
12443
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
12376
12444
  if (Platform.fullImageShadow) {
@@ -12448,7 +12516,11 @@ const EffectModule = {
12448
12516
  shadow: shadow,
12449
12517
  innerShadow: innerShadow,
12450
12518
  blur: blur,
12451
- backgroundBlur: backgroundBlur
12519
+ backgroundBlur: backgroundBlur,
12520
+ getShadowSpread: getShadowSpread,
12521
+ isTransformShadow(_shadow) {
12522
+ return undefined;
12523
+ }
12452
12524
  };
12453
12525
 
12454
12526
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -12956,16 +13028,17 @@ function toTextChar(row) {
12956
13028
  }
12957
13029
 
12958
13030
  function decorationText(drawData, style) {
12959
- let type;
13031
+ let type, offset = 0;
12960
13032
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
12961
13033
  drawData.decorationHeight = fontSize / 11;
12962
13034
  if (isObject(textDecoration)) {
12963
13035
  type = textDecoration.type;
12964
13036
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
13037
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
12965
13038
  } else type = textDecoration;
12966
13039
  switch (type) {
12967
13040
  case "under":
12968
- drawData.decorationY = [ fontSize * .15 ];
13041
+ drawData.decorationY = [ fontSize * .15 + offset ];
12969
13042
  break;
12970
13043
 
12971
13044
  case "delete":
@@ -12973,7 +13046,7 @@ function decorationText(drawData, style) {
12973
13046
  break;
12974
13047
 
12975
13048
  case "under-delete":
12976
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
13049
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
12977
13050
  }
12978
13051
  }
12979
13052
 
@@ -13077,4 +13150,4 @@ Object.assign(Creator, {
13077
13150
 
13078
13151
  useCanvas();
13079
13152
 
13080
- export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, 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, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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 };
13153
+ export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, 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, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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 };