@leafer/worker 2.0.2 → 2.0.4

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/worker.js CHANGED
@@ -233,6 +233,7 @@ var LeaferUI = function(exports) {
233
233
  }
234
234
  destroy() {
235
235
  this.__input = this.__middle = null;
236
+ if (this.__complexData) this.__complexData.destroy();
236
237
  }
237
238
  }
238
239
  const IncrementId = {
@@ -323,6 +324,7 @@ var LeaferUI = function(exports) {
323
324
  };
324
325
  const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
325
326
  const {round: round$6, pow: pow$2, max: max$6, floor: floor$3, PI: PI$4} = Math;
327
+ const tempScaleData$1 = {};
326
328
  const MathHelper = {
327
329
  within(value, min, max) {
328
330
  if (isObject(min)) max = min.max, min = min.min;
@@ -366,6 +368,24 @@ var LeaferUI = function(exports) {
366
368
  } else if (scale) MathHelper.assignScale(scaleData, scale);
367
369
  return scaleData;
368
370
  },
371
+ getScaleFixedData(worldScaleData, scaleFixed, unscale, abs, _localScaleData) {
372
+ let {scaleX: scaleX, scaleY: scaleY} = worldScaleData;
373
+ if (abs || scaleFixed) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
374
+ if (scaleFixed) {
375
+ if (scaleFixed === true) {
376
+ scaleX = scaleY = unscale ? 1 : 1 / scaleX;
377
+ } else {
378
+ let minScale;
379
+ if (isNumber(scaleFixed)) minScale = scaleFixed; else if (scaleFixed === "zoom-in") minScale = 1;
380
+ if (minScale) {
381
+ if (scaleX > minScale || scaleY > minScale) scaleX = scaleY = unscale ? 1 : 1 / scaleX; else scaleX = scaleY = unscale ? 1 : 1 / minScale;
382
+ }
383
+ }
384
+ }
385
+ tempScaleData$1.scaleX = scaleX;
386
+ tempScaleData$1.scaleY = scaleY;
387
+ return tempScaleData$1;
388
+ },
369
389
  assignScale(scaleData, scale) {
370
390
  if (isNumber(scale)) {
371
391
  scaleData.scaleX = scaleData.scaleY = scale;
@@ -845,8 +865,8 @@ var LeaferUI = function(exports) {
845
865
  if (isObject(originPoints[0])) points = [], originPoints.forEach(p => points.push(p.x, p.y));
846
866
  return points;
847
867
  },
848
- isSame(t, point) {
849
- return float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
868
+ isSame(t, point, quick) {
869
+ return quick ? t.x === point.x && t.y === point.y : float$5(t.x) === float$5(point.x) && float$5(t.y) === float$5(point.y);
850
870
  },
851
871
  reset(t) {
852
872
  P$7.reset(t);
@@ -918,8 +938,8 @@ var LeaferUI = function(exports) {
918
938
  getAtan2(to) {
919
939
  return PointHelper.getAtan2(this, to);
920
940
  }
921
- isSame(point) {
922
- return PointHelper.isSame(this, point);
941
+ isSame(point, quick) {
942
+ return PointHelper.isSame(this, point, quick);
923
943
  }
924
944
  reset() {
925
945
  PointHelper.reset(this);
@@ -1163,9 +1183,9 @@ var LeaferUI = function(exports) {
1163
1183
  }
1164
1184
  if (!onlyBoxSize) to.x += box.x, to.y += box.y;
1165
1185
  },
1166
- getPoint(around, box, to) {
1186
+ getPoint(around, box, to, onlyBoxSize = true) {
1167
1187
  if (!to) to = {};
1168
- AroundHelper.toPoint(around, box, to, true);
1188
+ AroundHelper.toPoint(around, box, to, onlyBoxSize);
1169
1189
  return to;
1170
1190
  }
1171
1191
  };
@@ -1420,6 +1440,9 @@ var LeaferUI = function(exports) {
1420
1440
  y: y + height
1421
1441
  } ];
1422
1442
  },
1443
+ getPoint(t, around, onlyBoxSize = false, to) {
1444
+ return AroundHelper.getPoint(around, t, to, onlyBoxSize);
1445
+ },
1423
1446
  hitRadiusPoint(t, point, pointMatrix) {
1424
1447
  if (pointMatrix) point = PointHelper.tempToInnerRadiusPointOf(point, pointMatrix);
1425
1448
  return point.x >= t.x - point.radiusX && point.x <= t.x + t.width + point.radiusX && (point.y >= t.y - point.radiusY && point.y <= t.y + t.height + point.radiusY);
@@ -1588,6 +1611,9 @@ var LeaferUI = function(exports) {
1588
1611
  getPoints() {
1589
1612
  return BoundsHelper.getPoints(this);
1590
1613
  }
1614
+ getPoint(around, onlyBoxSize, to) {
1615
+ return BoundsHelper.getPoint(this, around, onlyBoxSize, to);
1616
+ }
1591
1617
  hitPoint(point, pointMatrix) {
1592
1618
  return BoundsHelper.hitPoint(this, point, pointMatrix);
1593
1619
  }
@@ -2581,10 +2607,10 @@ var LeaferUI = function(exports) {
2581
2607
  const centerY = y1 + c * sin$4(startRadian + totalRadian / 2 + PI_2 * sign);
2582
2608
  startRadian -= PI_2 * sign;
2583
2609
  endRadian -= PI_2 * sign;
2584
- return ellipse$6(data, centerX, centerY, radius, radius, 0, startRadian / OneRadian, endRadian / OneRadian, anticlockwise, setPointBounds, setEndPoint, setStartPoint);
2610
+ return ellipse$8(data, centerX, centerY, radius, radius, 0, startRadian / OneRadian, endRadian / OneRadian, anticlockwise, setPointBounds, setEndPoint, setStartPoint);
2585
2611
  },
2586
2612
  arc(data, x, y, radius, startAngle, endAngle, anticlockwise, setPointBounds, setEndPoint, setStartPoint) {
2587
- return ellipse$6(data, x, y, radius, radius, 0, startAngle, endAngle, anticlockwise, setPointBounds, setEndPoint, setStartPoint);
2613
+ return ellipse$8(data, x, y, radius, radius, 0, startAngle, endAngle, anticlockwise, setPointBounds, setEndPoint, setStartPoint);
2588
2614
  },
2589
2615
  ellipse(data, cx, cy, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise, setPointBounds, setEndPoint, setStartPoint) {
2590
2616
  const rotationRadian = rotation * OneRadian;
@@ -2685,9 +2711,9 @@ var LeaferUI = function(exports) {
2685
2711
  return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
2686
2712
  }
2687
2713
  };
2688
- const {getPointAndSet: getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6} = BezierHelper;
2714
+ const {getPointAndSet: getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$8} = BezierHelper;
2689
2715
  const {sin: sin$3, cos: cos$3, sqrt: sqrt$2, atan2: atan2} = Math;
2690
- const {ellipse: ellipse$5} = BezierHelper;
2716
+ const {ellipse: ellipse$7} = BezierHelper;
2691
2717
  const EllipseHelper = {
2692
2718
  ellipticalArc(data, fromX, fromY, radiusX, radiusY, rotation, largeFlag, sweepFlag, toX, toY, curveMode) {
2693
2719
  const halfX = (toX - fromX) / 2;
@@ -2724,7 +2750,7 @@ var LeaferUI = function(exports) {
2724
2750
  const centerY = fromY + halfY + rotationSin * cx + rotationCos * cy;
2725
2751
  const anticlockwise = totalRadian < 0 ? 1 : 0;
2726
2752
  if (curveMode || Platform.ellipseToCurve) {
2727
- ellipse$5(data, centerX, centerY, radiusX, radiusY, rotation, startRadian / OneRadian, endRadian / OneRadian, anticlockwise);
2753
+ ellipse$7(data, centerX, centerY, radiusX, radiusY, rotation, startRadian / OneRadian, endRadian / OneRadian, anticlockwise);
2728
2754
  } else {
2729
2755
  if (radiusX === radiusY && !rotation) {
2730
2756
  data.push(PathCommandMap.O, centerX, centerY, radiusX, startRadian / OneRadian, endRadian / OneRadian, anticlockwise);
@@ -2743,7 +2769,7 @@ var LeaferUI = function(exports) {
2743
2769
  }
2744
2770
  };
2745
2771
  const {M: M$9, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S$1, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
2746
- const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2772
+ const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$6, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2747
2773
  const {ellipticalArc: ellipticalArc} = EllipseHelper;
2748
2774
  const debug$f = Debug.get("PathConvert");
2749
2775
  const setEndPoint$1 = {};
@@ -2972,14 +2998,14 @@ var LeaferUI = function(exports) {
2972
2998
  break;
2973
2999
 
2974
3000
  case G$5:
2975
- ellipse$4(curveMode ? data : copyData(data, old, i, 9), old[i + 1], old[i + 2], old[i + 3], old[i + 4], old[i + 5], old[i + 6], old[i + 7], old[i + 8], null, setEndPoint$1);
3001
+ ellipse$6(curveMode ? data : copyData(data, old, i, 9), old[i + 1], old[i + 2], old[i + 3], old[i + 4], old[i + 5], old[i + 6], old[i + 7], old[i + 8], null, setEndPoint$1);
2976
3002
  x = setEndPoint$1.x;
2977
3003
  y = setEndPoint$1.y;
2978
3004
  i += 9;
2979
3005
  break;
2980
3006
 
2981
3007
  case F$6:
2982
- curveMode ? ellipse$4(data, old[i + 1], old[i + 2], old[i + 3], old[i + 4], 0, 0, 360, false) : copyData(data, old, i, 5);
3008
+ curveMode ? ellipse$6(data, old[i + 1], old[i + 2], old[i + 3], old[i + 4], 0, 0, 360, false) : copyData(data, old, i, 5);
2983
3009
  x = old[i + 1] + old[i + 3];
2984
3010
  y = old[i + 2];
2985
3011
  i += 5;
@@ -3127,7 +3153,7 @@ var LeaferUI = function(exports) {
3127
3153
  drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
3128
3154
  BezierHelper.ellipse(null, x, y, radiusX, radiusY, isNull(rotation) ? 0 : rotation, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
3129
3155
  data.push(M$8, startPoint.x, startPoint.y);
3130
- ellipse$3(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3156
+ ellipse$5(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3131
3157
  },
3132
3158
  drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
3133
3159
  BezierHelper.arc(null, x, y, radius, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
@@ -3138,8 +3164,8 @@ var LeaferUI = function(exports) {
3138
3164
  BezierHelper.points(data, points, curve, close);
3139
3165
  }
3140
3166
  };
3141
- const {ellipse: ellipse$3, arc: arc$2} = PathCommandDataHelper;
3142
- const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3167
+ const {ellipse: ellipse$5, arc: arc$2} = PathCommandDataHelper;
3168
+ const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$4, arc: arc$1, arcTo: arcTo$2, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
3143
3169
  class PathCreator {
3144
3170
  set path(value) {
3145
3171
  this.__path = value;
@@ -3195,7 +3221,7 @@ var LeaferUI = function(exports) {
3195
3221
  return this;
3196
3222
  }
3197
3223
  ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
3198
- ellipse$2(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3224
+ ellipse$4(this.__path, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3199
3225
  this.paint();
3200
3226
  return this;
3201
3227
  }
@@ -3312,7 +3338,7 @@ var LeaferUI = function(exports) {
3312
3338
  }
3313
3339
  };
3314
3340
  const {M: M$6, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = PathCommandMap;
3315
- const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3341
+ const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$3} = BezierHelper;
3316
3342
  const {addPointBounds: addPointBounds, copy: copy$9, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3317
3343
  const debug$d = Debug.get("PathBounds");
3318
3344
  let radius, radiusX, radiusY;
@@ -3388,7 +3414,7 @@ var LeaferUI = function(exports) {
3388
3414
  break;
3389
3415
 
3390
3416
  case G$2:
3391
- ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
3417
+ ellipse$3(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
3392
3418
  i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3393
3419
  x = setEndPoint.x;
3394
3420
  y = setEndPoint.y;
@@ -3861,6 +3887,7 @@ var LeaferUI = function(exports) {
3861
3887
  return image;
3862
3888
  },
3863
3889
  recycle(image) {
3890
+ if (image.parent) image = image.parent;
3864
3891
  image.use--;
3865
3892
  setTimeout(() => {
3866
3893
  if (!image.use) {
@@ -4026,8 +4053,10 @@ var LeaferUI = function(exports) {
4026
4053
  return undefined;
4027
4054
  }
4028
4055
  clearLevels(_checkUse) {}
4056
+ destroyFilter() {}
4029
4057
  destroy() {
4030
4058
  this.clearLevels();
4059
+ this.destroyFilter();
4031
4060
  const {view: view} = this;
4032
4061
  if (view && view.close) view.close();
4033
4062
  this.config = {
@@ -4198,7 +4227,6 @@ var LeaferUI = function(exports) {
4198
4227
  if (this.__setAttr(key, value)) {
4199
4228
  const data = this.__;
4200
4229
  DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
4201
- this.__layout.surfaceChange();
4202
4230
  }
4203
4231
  }
4204
4232
  }));
@@ -4243,7 +4271,6 @@ var LeaferUI = function(exports) {
4243
4271
  return decorateLeafAttr(defaultValue, key => attr({
4244
4272
  set(value) {
4245
4273
  if (this.__setAttr(key, value)) {
4246
- this.__layout.surfaceChange();
4247
4274
  this.waitParent(() => {
4248
4275
  this.parent.__layout.childrenSortChange();
4249
4276
  });
@@ -4277,7 +4304,6 @@ var LeaferUI = function(exports) {
4277
4304
  set(value) {
4278
4305
  if (this.__setAttr(key, value)) {
4279
4306
  this.__layout.hitCanvasChanged = true;
4280
- if (Debug.showBounds === "hit") this.__layout.surfaceChange();
4281
4307
  if (this.leafer) this.leafer.updateCursor();
4282
4308
  }
4283
4309
  }
@@ -4465,6 +4491,10 @@ var LeaferUI = function(exports) {
4465
4491
  if (layout.stateStyleChanged) leaf.updateState();
4466
4492
  if (layout.opacityChanged) updateAllWorldOpacity(leaf);
4467
4493
  leaf.__updateChange();
4494
+ if (layout.surfaceChanged) {
4495
+ if (leaf.__hasComplex) L$4.updateComplex(leaf);
4496
+ layout.surfaceChanged = false;
4497
+ }
4468
4498
  },
4469
4499
  updateAllChange(leaf) {
4470
4500
  updateChange$1(leaf);
@@ -4489,6 +4519,9 @@ var LeaferUI = function(exports) {
4489
4519
  if (!fromWorld) fromWorld = leaf.__nowWorld;
4490
4520
  if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform); else currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
4491
4521
  },
4522
+ renderComplex(_leaf, _canvas, _options) {},
4523
+ updateComplex(_leaf) {},
4524
+ checkComplex(_leaf) {},
4492
4525
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4493
4526
  const local = isObject(x) ? Object.assign({}, x) : {
4494
4527
  x: x,
@@ -4600,6 +4633,9 @@ var LeaferUI = function(exports) {
4600
4633
  divideParent(matrix$3, relative.scrollWorldTransform);
4601
4634
  return temp ? matrix$3 : Object.assign({}, matrix$3);
4602
4635
  },
4636
+ updateScaleFixedWorld(_t) {},
4637
+ updateOuterBounds(_t) {},
4638
+ cacheId(_t) {},
4603
4639
  drop(t, parent, index, resize) {
4604
4640
  t.setTransform(L$4.getRelativeWorld(t, parent, true), resize);
4605
4641
  parent.add(t, index);
@@ -4646,7 +4682,8 @@ var LeaferUI = function(exports) {
4646
4682
  return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
4647
4683
  },
4648
4684
  localRenderBounds(target) {
4649
- return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
4685
+ const {__: __, __layout: __layout} = target;
4686
+ return __.eraser || __.visible === 0 ? null : __layout.localOuterBounds || __layout.localRenderBounds;
4650
4687
  },
4651
4688
  maskLocalBoxBounds(target, index) {
4652
4689
  return checkMask(target, index) && target.__localBoxBounds;
@@ -4655,7 +4692,8 @@ var LeaferUI = function(exports) {
4655
4692
  return checkMask(target, index) && target.__layout.localStrokeBounds;
4656
4693
  },
4657
4694
  maskLocalRenderBounds(target, index) {
4658
- return checkMask(target, index) && target.__layout.localRenderBounds;
4695
+ const {__layout: __layout} = target;
4696
+ return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds);
4659
4697
  },
4660
4698
  excludeRenderBounds(child, options) {
4661
4699
  if (options.bounds && !options.bounds.hit(child.__world, options.matrix)) return true;
@@ -4775,11 +4813,11 @@ var LeaferUI = function(exports) {
4775
4813
  w.height *= scaleY;
4776
4814
  w.scaleX *= scaleX;
4777
4815
  w.scaleY *= scaleY;
4778
- if (branch.isBranch) scale$2(branch, x, y, scaleX, scaleY, a, b);
4816
+ if (branch.isBranch) scale$3(branch, x, y, scaleX, scaleY, a, b);
4779
4817
  }
4780
4818
  }
4781
4819
  };
4782
- const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$2} = BranchHelper;
4820
+ const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$3} = BranchHelper;
4783
4821
  const WaitHelper = {
4784
4822
  run(wait) {
4785
4823
  if (wait && wait.length) {
@@ -5164,7 +5202,6 @@ var LeaferUI = function(exports) {
5164
5202
  }
5165
5203
  opacityChange() {
5166
5204
  this.opacityChanged = true;
5167
- this.surfaceChanged || this.surfaceChange();
5168
5205
  }
5169
5206
  childrenSortChange() {
5170
5207
  if (!this.childrenSortChanged) {
@@ -5252,7 +5289,7 @@ var LeaferUI = function(exports) {
5252
5289
  }
5253
5290
  }
5254
5291
  static emitWorld(leaf) {
5255
- if (leaf.leaferIsReady) leaf.emit(WORLD, this);
5292
+ if (leaf.leaferIsReady) leaf.emit(WORLD, leaf);
5256
5293
  }
5257
5294
  }
5258
5295
  BoundsEvent.RESIZE = "bounds.resize";
@@ -5579,6 +5616,7 @@ var LeaferUI = function(exports) {
5579
5616
  const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
5580
5617
  multiplyParent$2(this.__local || __layout, parent ? parent.__scrollWorld || parent.__world : defaultWorld, __world, !!__layout.affectScaleOrRotation, __);
5581
5618
  if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY);
5619
+ if (__layout.scaleFixed) LeafHelper.updateScaleFixedWorld(this);
5582
5620
  },
5583
5621
  __updateLocalMatrix() {
5584
5622
  if (this.__local) {
@@ -5601,12 +5639,13 @@ var LeaferUI = function(exports) {
5601
5639
  };
5602
5640
  const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
5603
5641
  const {updateBounds: updateBounds$2} = BranchHelper;
5604
- const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$6} = BoundsHelper;
5642
+ const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$4, copy: copy$6} = BoundsHelper;
5605
5643
  const {toBounds: toBounds$1} = PathBounds;
5606
5644
  const LeafBounds = {
5607
5645
  __updateWorldBounds() {
5608
5646
  const {__layout: __layout, __world: __world} = this;
5609
5647
  toOuterOf$2(__layout.renderBounds, __world, __world);
5648
+ if (this.__hasComplex) LeafHelper.checkComplex(this);
5610
5649
  if (__layout.resized) {
5611
5650
  if (__layout.resized === "inner") this.__onUpdateSize();
5612
5651
  if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
@@ -5656,6 +5695,7 @@ var LeaferUI = function(exports) {
5656
5695
  layout.renderChanged = undefined;
5657
5696
  if (this.parent) this.parent.__layout.renderChange();
5658
5697
  }
5698
+ if (layout.outerScale) LeafHelper.updateOuterBounds(this);
5659
5699
  layout.resized || (layout.resized = "local");
5660
5700
  layout.boundsChanged = undefined;
5661
5701
  },
@@ -5706,11 +5746,11 @@ var LeaferUI = function(exports) {
5706
5746
  },
5707
5747
  __updateStrokeBounds(_bounds) {
5708
5748
  const layout = this.__layout;
5709
- copyAndSpread$3(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5749
+ copyAndSpread$4(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5710
5750
  },
5711
5751
  __updateRenderBounds(_bounds) {
5712
5752
  const layout = this.__layout, {renderSpread: renderSpread} = layout;
5713
- isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$3(layout.renderBounds, layout.boxBounds, renderSpread);
5753
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$4(layout.renderBounds, layout.boxBounds, renderSpread);
5714
5754
  }
5715
5755
  };
5716
5756
  const LeafRender = {
@@ -5721,7 +5761,7 @@ var LeaferUI = function(exports) {
5721
5761
  const data = this.__;
5722
5762
  if (data.bright && !options.topRendering) return options.topList.add(this);
5723
5763
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5724
- canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5764
+ canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5725
5765
  if (this.__.__single) {
5726
5766
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5727
5767
  const tempCanvas = canvas.getSameCanvas(true, true);
@@ -5773,7 +5813,7 @@ var LeaferUI = function(exports) {
5773
5813
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5774
5814
  const tempCanvas = canvas.getSameCanvas(false, true);
5775
5815
  this.__renderBranch(tempCanvas, options);
5776
- canvas.opacity = options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
5816
+ canvas.opacity = options.ignoreOpacity ? 1 : options.dimOpacity ? data.opacity * options.dimOpacity : data.opacity;
5777
5817
  canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, data.__blendMode, true);
5778
5818
  tempCanvas.recycle(nowWorld);
5779
5819
  } else {
@@ -5789,7 +5829,7 @@ var LeaferUI = function(exports) {
5789
5829
  const {children: children} = this;
5790
5830
  for (let i = 0, len = children.length; i < len; i++) {
5791
5831
  child = children[i];
5792
- excludeRenderBounds$1(child, options) || (child.__.complex ? child.__renderComplex(canvas, options) : child.__render(canvas, options));
5832
+ excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
5793
5833
  }
5794
5834
  }
5795
5835
  },
@@ -5802,12 +5842,12 @@ var LeaferUI = function(exports) {
5802
5842
  }
5803
5843
  }
5804
5844
  };
5805
- const tempScaleData$1 = {};
5806
5845
  const {LEAF: LEAF, create: create} = IncrementId;
5807
- const {stintSet: stintSet$4} = DataHelper;
5846
+ const {stintSet: stintSet$6} = DataHelper;
5808
5847
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
5809
5848
  const {toOuterOf: toOuterOf$1} = BoundsHelper;
5810
5849
  const {copy: copy$5, move: move$8} = PointHelper;
5850
+ const {getScaleFixedData: getScaleFixedData$1} = MathHelper;
5811
5851
  const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
5812
5852
  exports.Leaf = class Leaf {
5813
5853
  get tag() {
@@ -5965,6 +6005,7 @@ var LeaferUI = function(exports) {
5965
6005
  this.__level = this.parent ? this.parent.__level + 1 : 1;
5966
6006
  if (this.animation) this.__runAnimation("in");
5967
6007
  if (this.__bubbleMap) this.__emitLifeEvent(ChildEvent.MOUNTED);
6008
+ if (leafer.cacheId) LeafHelper.cacheId(this);
5968
6009
  } else {
5969
6010
  this.__emitLifeEvent(ChildEvent.UNMOUNTED);
5970
6011
  }
@@ -6082,8 +6123,8 @@ var LeaferUI = function(exports) {
6082
6123
  const cameraWorld = this.__cameraWorld, world = this.__world;
6083
6124
  multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
6084
6125
  toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
6085
- stintSet$4(cameraWorld, "half", world.half);
6086
- stintSet$4(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6126
+ stintSet$6(cameraWorld, "half", world.half);
6127
+ stintSet$6(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6087
6128
  return cameraWorld;
6088
6129
  } else {
6089
6130
  return this.__world;
@@ -6094,13 +6135,8 @@ var LeaferUI = function(exports) {
6094
6135
  if (scaleX < 0) scaleX = -scaleX;
6095
6136
  return scaleX > 1 ? scaleX : 1;
6096
6137
  }
6097
- getRenderScaleData(abs, scaleFixed) {
6098
- let {scaleX: scaleX, scaleY: scaleY} = ImageManager.patternLocked ? this.__world : this.__nowWorld;
6099
- if (abs) scaleX < 0 && (scaleX = -scaleX), scaleY < 0 && (scaleY = -scaleY);
6100
- if (scaleFixed === true || scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) scaleX = scaleY = 1;
6101
- tempScaleData$1.scaleX = scaleX;
6102
- tempScaleData$1.scaleY = scaleY;
6103
- return tempScaleData$1;
6138
+ getRenderScaleData(abs, scaleFixed, unscale = true) {
6139
+ return getScaleFixedData$1(ImageManager.patternLocked ? this.__world : this.__nowWorld || this.__world, scaleFixed, unscale, abs);
6104
6140
  }
6105
6141
  getTransform(relative) {
6106
6142
  return this.__layout.getTransform(relative || "local");
@@ -6139,14 +6175,16 @@ var LeaferUI = function(exports) {
6139
6175
  relative.innerToWorld(world, to, distance);
6140
6176
  world = to ? to : world;
6141
6177
  }
6142
- toInnerPoint(this.scrollWorldTransform, world, to, distance);
6178
+ toInnerPoint(this.worldTransform, world, to, distance);
6143
6179
  }
6144
6180
  innerToWorld(inner, to, distance, relative) {
6145
- toOuterPoint(this.scrollWorldTransform, inner, to, distance);
6181
+ toOuterPoint(this.worldTransform, inner, to, distance);
6146
6182
  if (relative) relative.worldToInner(to ? to : inner, null, distance);
6147
6183
  }
6148
6184
  getBoxPoint(world, relative, distance, change) {
6149
- return this.getBoxPointByInner(this.getInnerPoint(world, relative, distance, change), null, null, true);
6185
+ const inner = this.getInnerPoint(world, relative, distance, change);
6186
+ if (distance) return inner;
6187
+ return this.getBoxPointByInner(inner, null, null, true);
6150
6188
  }
6151
6189
  getBoxPointByInner(inner, _relative, _distance, change) {
6152
6190
  const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
@@ -6262,7 +6300,6 @@ var LeaferUI = function(exports) {
6262
6300
  __drawHitPath(_canvas) {}
6263
6301
  __updateHitCanvas() {}
6264
6302
  __render(_canvas, _options) {}
6265
- __renderComplex(_canvas, _options) {}
6266
6303
  __drawFast(_canvas, _options) {}
6267
6304
  __draw(_canvas, _options, _originCanvas) {}
6268
6305
  __clip(_canvas, _options) {}
@@ -6273,7 +6310,7 @@ var LeaferUI = function(exports) {
6273
6310
  __drawPath(_canvas) {}
6274
6311
  __drawRenderPath(_canvas) {}
6275
6312
  __updatePath() {}
6276
- __updateRenderPath() {}
6313
+ __updateRenderPath(_updateCache) {}
6277
6314
  getMotionPathData() {
6278
6315
  return Plugin.need("path");
6279
6316
  }
@@ -6341,9 +6378,11 @@ var LeaferUI = function(exports) {
6341
6378
  return 0;
6342
6379
  }
6343
6380
  __updateRenderSpread() {
6381
+ let layout;
6344
6382
  const {children: children} = this;
6345
6383
  for (let i = 0, len = children.length; i < len; i++) {
6346
- if (children[i].__layout.renderSpread) return 1;
6384
+ layout = children[i].__layout;
6385
+ if (layout.renderSpread || layout.localOuterBounds) return 1;
6347
6386
  }
6348
6387
  return 0;
6349
6388
  }
@@ -6598,7 +6637,7 @@ var LeaferUI = function(exports) {
6598
6637
  this.levelMap = null;
6599
6638
  }
6600
6639
  }
6601
- const version = "2.0.2";
6640
+ const version = "2.0.4";
6602
6641
  class LeaferCanvas extends LeaferCanvasBase {
6603
6642
  get allowBackgroundColor() {
6604
6643
  return true;
@@ -7405,7 +7444,7 @@ var LeaferUI = function(exports) {
7405
7444
  this.config = {};
7406
7445
  if (userConfig) this.config = DataHelper.default(userConfig, this.config);
7407
7446
  this.picker = new Picker(this.target = target, this);
7408
- this.finder = Creator.finder && Creator.finder();
7447
+ this.finder = Creator.finder && Creator.finder(target, this.config);
7409
7448
  }
7410
7449
  getByPoint(hitPoint, hitRadius, options) {
7411
7450
  const {target: target, picker: picker} = this;
@@ -7443,7 +7482,9 @@ var LeaferUI = function(exports) {
7443
7482
  set(value) {
7444
7483
  this.__setAttr(key, value);
7445
7484
  if (value) this.__.__useEffect = true;
7446
- this.__layout.renderChanged || this.__layout.renderChange();
7485
+ const layout = this.__layout;
7486
+ layout.renderChanged || layout.renderChange();
7487
+ layout.surfaceChange();
7447
7488
  }
7448
7489
  }));
7449
7490
  }
@@ -7528,7 +7569,7 @@ var LeaferUI = function(exports) {
7528
7569
  }
7529
7570
  };
7530
7571
  const {parse: parse, objectToCanvasData: objectToCanvasData} = PathConvert;
7531
- const {stintSet: stintSet$3} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
7572
+ const {stintSet: stintSet$5} = DataHelper, {hasTransparent: hasTransparent$2} = ColorConvert;
7532
7573
  const emptyPaint = {
7533
7574
  originPaint: {}
7534
7575
  };
@@ -7594,7 +7635,7 @@ var LeaferUI = function(exports) {
7594
7635
  setFill(value) {
7595
7636
  if (this.__naturalWidth) this.__removeNaturalSize();
7596
7637
  if (isString(value) || !value) {
7597
- stintSet$3(this, "__isTransparentFill", hasTransparent$2(value));
7638
+ stintSet$5(this, "__isTransparentFill", hasTransparent$2(value));
7598
7639
  this.__isFills && this.__removePaint("fill", true);
7599
7640
  this._fill = value;
7600
7641
  } else if (isObject(value)) {
@@ -7603,7 +7644,7 @@ var LeaferUI = function(exports) {
7603
7644
  }
7604
7645
  setStroke(value) {
7605
7646
  if (isString(value) || !value) {
7606
- stintSet$3(this, "__isTransparentStroke", hasTransparent$2(value));
7647
+ stintSet$5(this, "__isTransparentStroke", hasTransparent$2(value));
7607
7648
  this.__isStrokes && this.__removePaint("stroke", true);
7608
7649
  this._stroke = value;
7609
7650
  } else if (isObject(value)) {
@@ -7636,15 +7677,16 @@ var LeaferUI = function(exports) {
7636
7677
  this.__needComputePaint = undefined;
7637
7678
  }
7638
7679
  __getRealStrokeWidth(childStyle) {
7639
- let {strokeWidth: strokeWidth, strokeWidthFixed: strokeWidthFixed} = this;
7680
+ let {strokeWidth: strokeWidth, strokeScaleFixed: strokeScaleFixed} = this;
7640
7681
  if (childStyle) {
7641
7682
  if (childStyle.strokeWidth) strokeWidth = childStyle.strokeWidth;
7642
- if (!isUndefined(childStyle.strokeWidthFixed)) strokeWidthFixed = childStyle.strokeWidthFixed;
7683
+ if (!isUndefined(childStyle.strokeScaleFixed)) strokeScaleFixed = childStyle.strokeScaleFixed;
7643
7684
  }
7644
- if (strokeWidthFixed) {
7645
- const scale = this.__leaf.getClampRenderScale();
7646
- return scale > 1 ? strokeWidth / scale : strokeWidth;
7647
- } else return strokeWidth;
7685
+ if (strokeScaleFixed) {
7686
+ const {scaleX: scaleX} = this.__leaf.getRenderScaleData(true, strokeScaleFixed, false);
7687
+ if (scaleX !== 1) return strokeWidth * scaleX;
7688
+ }
7689
+ return strokeWidth;
7648
7690
  }
7649
7691
  __setPaint(attrName, value) {
7650
7692
  this.__setInput(attrName, value);
@@ -7661,11 +7703,11 @@ var LeaferUI = function(exports) {
7661
7703
  if (removeInput) this.__removeInput(attrName);
7662
7704
  PaintImage.recycleImage(attrName, this);
7663
7705
  if (attrName === "fill") {
7664
- stintSet$3(this, "__isAlphaPixelFill", undefined);
7706
+ stintSet$5(this, "__isAlphaPixelFill", undefined);
7665
7707
  this._fill = this.__isFills = undefined;
7666
7708
  } else {
7667
- stintSet$3(this, "__isAlphaPixelStroke", undefined);
7668
- stintSet$3(this, "__hasMultiStrokeStyle", undefined);
7709
+ stintSet$5(this, "__isAlphaPixelStroke", undefined);
7710
+ stintSet$5(this, "__hasMultiStrokeStyle", undefined);
7669
7711
  this._stroke = this.__isStrokes = undefined;
7670
7712
  }
7671
7713
  }
@@ -7716,7 +7758,11 @@ var LeaferUI = function(exports) {
7716
7758
  }
7717
7759
  }
7718
7760
  class PolygonData extends LineData {}
7719
- class StarData extends UIData {}
7761
+ class StarData extends UIData {
7762
+ get __boxStroke() {
7763
+ return !this.__pathInputed;
7764
+ }
7765
+ }
7720
7766
  class PathData extends UIData {
7721
7767
  get __pathInputed() {
7722
7768
  return 2;
@@ -7812,7 +7858,7 @@ var LeaferUI = function(exports) {
7812
7858
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
7813
7859
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
7814
7860
  boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
7815
- if (!data.__boxStroke) {
7861
+ if (!data.__boxStroke || data.__useArrow) {
7816
7862
  const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
7817
7863
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
7818
7864
  spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
@@ -7841,22 +7887,22 @@ var LeaferUI = function(exports) {
7841
7887
  return box ? max$4(box.__updateRenderSpread(), spread) : spread;
7842
7888
  }
7843
7889
  };
7844
- const {stintSet: stintSet$2} = DataHelper;
7890
+ const {stintSet: stintSet$4} = DataHelper;
7845
7891
  const UIRender = {
7846
7892
  __updateChange() {
7847
7893
  const data = this.__;
7848
7894
  if (data.__useStroke) {
7849
7895
  const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
7850
- stintSet$2(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
7851
- stintSet$2(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
7896
+ stintSet$4(this.__world, "half", useStroke && data.strokeAlign === "center" && data.strokeWidth % 2);
7897
+ stintSet$4(data, "__fillAfterStroke", useStroke && data.strokeAlign === "outside" && data.fill && !data.__isTransparentFill);
7852
7898
  }
7853
7899
  if (data.__useEffect) {
7854
7900
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7855
- stintSet$2(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"));
7901
+ stintSet$4(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"));
7856
7902
  data.__useEffect = !!(shadow || otherEffect);
7857
7903
  }
7858
7904
  data.__checkSingle();
7859
- stintSet$2(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7905
+ stintSet$4(data, "__complex", data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7860
7906
  },
7861
7907
  __drawFast(canvas, options) {
7862
7908
  drawFast(this, canvas, options);
@@ -7963,6 +8009,12 @@ var LeaferUI = function(exports) {
7963
8009
  get isFrame() {
7964
8010
  return false;
7965
8011
  }
8012
+ set strokeWidthFixed(value) {
8013
+ this.strokeScaleFixed = value;
8014
+ }
8015
+ get strokeWidthFixed() {
8016
+ return this.strokeScaleFixed;
8017
+ }
7966
8018
  set scale(value) {
7967
8019
  MathHelper.assignScale(this, value);
7968
8020
  }
@@ -8018,6 +8070,9 @@ var LeaferUI = function(exports) {
8018
8070
  getPathString(curve, pathForRender, floatLength) {
8019
8071
  return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength);
8020
8072
  }
8073
+ asPath(curve, pathForRender) {
8074
+ this.path = this.getPath(curve, pathForRender);
8075
+ }
8021
8076
  load() {
8022
8077
  this.__.__computePaint();
8023
8078
  }
@@ -8027,16 +8082,18 @@ var LeaferUI = function(exports) {
8027
8082
  data.lazy && !this.__inLazyBounds && !Export.running ? data.__needComputePaint = true : data.__computePaint();
8028
8083
  }
8029
8084
  }
8030
- __updateRenderPath() {
8085
+ __updateRenderPath(updateCache) {
8031
8086
  const data = this.__;
8032
8087
  if (data.path) {
8033
8088
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
8034
- if (data.__useArrow) PathArrow.addArrows(this);
8089
+ if (data.__useArrow) PathArrow.addArrows(this, updateCache);
8035
8090
  } else data.__pathForRender && (data.__pathForRender = undefined);
8036
8091
  }
8037
8092
  __drawRenderPath(canvas) {
8093
+ const data = this.__;
8038
8094
  canvas.beginPath();
8039
- this.__drawPathByData(canvas, this.__.__pathForRender);
8095
+ if (data.__useArrow) PathArrow.updateArrow(this);
8096
+ this.__drawPathByData(canvas, data.__pathForRender);
8040
8097
  }
8041
8098
  __drawPath(canvas) {
8042
8099
  canvas.beginPath();
@@ -8085,6 +8142,7 @@ var LeaferUI = function(exports) {
8085
8142
  static setEditOuter(_toolName) {}
8086
8143
  static setEditInner(_editorName) {}
8087
8144
  destroy() {
8145
+ this.__.__willDestroy = true;
8088
8146
  this.fill = this.stroke = null;
8089
8147
  if (this.__animate) this.killAnimate();
8090
8148
  super.destroy();
@@ -8145,7 +8203,7 @@ var LeaferUI = function(exports) {
8145
8203
  __decorate([ strokeType(undefined, true) ], exports.UI.prototype, "stroke", void 0);
8146
8204
  __decorate([ strokeType("inside") ], exports.UI.prototype, "strokeAlign", void 0);
8147
8205
  __decorate([ strokeType(1, true) ], exports.UI.prototype, "strokeWidth", void 0);
8148
- __decorate([ strokeType(false) ], exports.UI.prototype, "strokeWidthFixed", void 0);
8206
+ __decorate([ strokeType(false) ], exports.UI.prototype, "strokeScaleFixed", void 0);
8149
8207
  __decorate([ strokeType("none") ], exports.UI.prototype, "strokeCap", void 0);
8150
8208
  __decorate([ strokeType("miter") ], exports.UI.prototype, "strokeJoin", void 0);
8151
8209
  __decorate([ strokeType() ], exports.UI.prototype, "dashPattern", void 0);
@@ -8609,6 +8667,9 @@ var LeaferUI = function(exports) {
8609
8667
  get isBranchLeaf() {
8610
8668
  return true;
8611
8669
  }
8670
+ get __useSelfBox() {
8671
+ return this.pathInputed;
8672
+ }
8612
8673
  constructor(data) {
8613
8674
  super(data);
8614
8675
  this.__layout.renderChanged || this.__layout.renderChange();
@@ -8624,7 +8685,7 @@ var LeaferUI = function(exports) {
8624
8685
  }
8625
8686
  __updateRectBoxBounds() {}
8626
8687
  __updateBoxBounds(_secondLayout) {
8627
- if (this.children.length && !this.pathInputed) {
8688
+ if (this.children.length && !this.__useSelfBox) {
8628
8689
  const data = this.__;
8629
8690
  if (data.__autoSide) {
8630
8691
  if (data.__hasSurface) this.__extraUpdate();
@@ -8713,37 +8774,37 @@ var LeaferUI = function(exports) {
8713
8774
  __decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
8714
8775
  __decorate([ affectRenderBoundsType("hide") ], exports.Frame.prototype, "overflow", void 0);
8715
8776
  exports.Frame = __decorate([ registerUI() ], exports.Frame);
8716
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper;
8777
+ const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse$2} = PathCommandDataHelper;
8717
8778
  exports.Ellipse = class Ellipse extends exports.UI {
8718
8779
  get __tag() {
8719
8780
  return "Ellipse";
8720
8781
  }
8721
8782
  __updatePath() {
8722
- const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
8783
+ const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
8723
8784
  const rx = width / 2, ry = height / 2;
8724
- const path = this.__.path = [];
8785
+ const path = data.path = [];
8725
8786
  let open;
8726
8787
  if (innerRadius) {
8727
8788
  if (startAngle || endAngle) {
8728
- if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
8729
- ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
8789
+ if (innerRadius < 1) ellipse$2(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false); else open = true;
8790
+ ellipse$2(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
8730
8791
  } else {
8731
8792
  if (innerRadius < 1) {
8732
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
8793
+ ellipse$2(path, rx, ry, rx * innerRadius, ry * innerRadius);
8733
8794
  moveTo$3(path, width, ry);
8734
8795
  }
8735
- ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
8796
+ ellipse$2(path, rx, ry, rx, ry, 0, 360, 0, true);
8736
8797
  }
8737
8798
  } else {
8738
8799
  if (startAngle || endAngle) {
8739
8800
  moveTo$3(path, rx, ry);
8740
- ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
8801
+ ellipse$2(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
8741
8802
  } else {
8742
- ellipse(path, rx, ry, rx, ry);
8803
+ ellipse$2(path, rx, ry, rx, ry);
8743
8804
  }
8744
8805
  }
8745
8806
  if (!open) closePath$2(path);
8746
- if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
8807
+ if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
8747
8808
  }
8748
8809
  };
8749
8810
  __decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
@@ -8922,7 +8983,7 @@ var LeaferUI = function(exports) {
8922
8983
  __decorate([ dataType(false) ], exports.Canvas.prototype, "safeResize", void 0);
8923
8984
  __decorate([ resizeType() ], exports.Canvas.prototype, "contextSettings", void 0);
8924
8985
  exports.Canvas = __decorate([ registerUI() ], exports.Canvas);
8925
- const {copyAndSpread: copyAndSpread$2, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$1} = DataHelper;
8986
+ const {copyAndSpread: copyAndSpread$3, includes: includes, spread: spread, setList: setList} = BoundsHelper, {stintSet: stintSet$3} = DataHelper;
8926
8987
  exports.Text = class Text extends exports.UI {
8927
8988
  get __tag() {
8928
8989
  return "Text";
@@ -8938,9 +8999,9 @@ var LeaferUI = function(exports) {
8938
8999
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize);
8939
9000
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * .7) / 2;
8940
9001
  data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
8941
- stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
8942
- stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
8943
- stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
9002
+ stintSet$3(data, "__padding", padding && MathHelper.fourNumber(padding));
9003
+ stintSet$3(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
9004
+ stintSet$3(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
8944
9005
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
8945
9006
  }
8946
9007
  __updateBoxBounds() {
@@ -8975,7 +9036,7 @@ var LeaferUI = function(exports) {
8975
9036
  }
8976
9037
  __updateRenderBounds() {
8977
9038
  const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
8978
- copyAndSpread$2(renderBounds, this.__.__textBoxBounds, renderSpread);
9039
+ copyAndSpread$3(renderBounds, this.__.__textBoxBounds, renderSpread);
8979
9040
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
8980
9041
  }
8981
9042
  __updateChange() {
@@ -9199,7 +9260,7 @@ var LeaferUI = function(exports) {
9199
9260
  if (this.viewReady) this.renderer.update();
9200
9261
  }
9201
9262
  __render(canvas, options) {
9202
- if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds));
9263
+ if (canvas.context) this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options.bounds, undefined, undefined, true));
9203
9264
  }
9204
9265
  __onResize(event) {
9205
9266
  this.forEach(leafer => leafer.resize(event));
@@ -10153,6 +10214,14 @@ var LeaferUI = function(exports) {
10153
10214
  stopDragAnimate() {
10154
10215
  this.dragger.stopAnimate();
10155
10216
  }
10217
+ replaceDownTarget(target) {
10218
+ const {downData: downData} = this;
10219
+ if (downData && target) {
10220
+ const {path: path} = downData;
10221
+ path.remove(path.list[0]);
10222
+ path.addAt(target, 0);
10223
+ }
10224
+ }
10156
10225
  updateDownData(data, options, merge) {
10157
10226
  const {downData: downData} = this;
10158
10227
  if (!data && downData) data = downData;
@@ -10515,8 +10584,8 @@ var LeaferUI = function(exports) {
10515
10584
  canvas.save();
10516
10585
  if (item.transform) canvas.transform(item.transform);
10517
10586
  if (originPaint.scaleFixed) {
10518
- const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
10519
- if (originPaint.scaleFixed === true || originPaint.scaleFixed === "zoom-in" && scaleX > 1 && scaleY > 1) canvas.scale(1 / scaleX, 1 / scaleY);
10587
+ const {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, originPaint.scaleFixed, false);
10588
+ if (scaleX !== 1) canvas.scale(scaleX, scaleY);
10520
10589
  }
10521
10590
  if (originPaint.blendMode) canvas.blendMode = originPaint.blendMode;
10522
10591
  fillPathOrText(ui, canvas, renderOptions);
@@ -10674,13 +10743,13 @@ var LeaferUI = function(exports) {
10674
10743
  }
10675
10744
  }
10676
10745
  }
10677
- const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
10746
+ const {getSpread: getSpread, copyAndSpread: copyAndSpread$2, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
10678
10747
  const tempBounds$2 = {};
10679
10748
  function shape(ui, current, options) {
10680
10749
  const canvas = current.getSameCanvas();
10681
10750
  const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
10682
10751
  const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
10683
- toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$2, layout.boxBounds, layout.strokeSpread),
10752
+ toOuterOf(layout.strokeSpread ? (copyAndSpread$2(tempBounds$2, layout.boxBounds, layout.strokeSpread),
10684
10753
  tempBounds$2) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
10685
10754
  let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
10686
10755
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
@@ -10734,7 +10803,7 @@ var LeaferUI = function(exports) {
10734
10803
  };
10735
10804
  }
10736
10805
  let recycleMap;
10737
- const {stintSet: stintSet} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
10806
+ const {stintSet: stintSet$2} = DataHelper, {hasTransparent: hasTransparent$1} = ColorConvert;
10738
10807
  function compute(attrName, ui) {
10739
10808
  const data = ui.__, leafPaints = [];
10740
10809
  let paints = data.__input[attrName], isAlphaPixel, isTransparent;
@@ -10757,12 +10826,12 @@ var LeaferUI = function(exports) {
10757
10826
  isTransparent = true;
10758
10827
  }
10759
10828
  if (attrName === "fill") {
10760
- stintSet(data, "__isAlphaPixelFill", isAlphaPixel);
10761
- stintSet(data, "__isTransparentFill", isTransparent);
10829
+ stintSet$2(data, "__isAlphaPixelFill", isAlphaPixel);
10830
+ stintSet$2(data, "__isTransparentFill", isTransparent);
10762
10831
  } else {
10763
- stintSet(data, "__isAlphaPixelStroke", isAlphaPixel);
10764
- stintSet(data, "__isTransparentStroke", isTransparent);
10765
- stintSet(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
10832
+ stintSet$2(data, "__isAlphaPixelStroke", isAlphaPixel);
10833
+ stintSet$2(data, "__isTransparentStroke", isTransparent);
10834
+ stintSet$2(data, "__hasMultiStrokeStyle", maxChildStrokeWidth);
10766
10835
  }
10767
10836
  } else {
10768
10837
  data.__removePaint(attrName, false);
@@ -10831,11 +10900,11 @@ var LeaferUI = function(exports) {
10831
10900
  shape: shape
10832
10901
  };
10833
10902
  let cache$1, box$2 = new Bounds;
10834
- const {isSame: isSame} = BoundsHelper;
10903
+ const {isSame: isSame$1} = BoundsHelper;
10835
10904
  function image(ui, attrName, paint, boxBounds, firstUse) {
10836
10905
  let leafPaint, event;
10837
10906
  const image = ImageManager.get(paint, paint.type);
10838
- if (cache$1 && paint === cache$1.paint && isSame(boxBounds, cache$1.boxBounds)) {
10907
+ if (cache$1 && paint === cache$1.paint && isSame$1(boxBounds, cache$1.boxBounds)) {
10839
10908
  leafPaint = cache$1.leafPaint;
10840
10909
  } else {
10841
10910
  leafPaint = {
@@ -10913,6 +10982,7 @@ var LeaferUI = function(exports) {
10913
10982
  const clip = transform && !transform.onlyScale || data.path || data.cornerRadius;
10914
10983
  if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
10915
10984
  }
10985
+ if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
10916
10986
  return true;
10917
10987
  }
10918
10988
  function onLoad(ui, event) {
@@ -11099,7 +11169,7 @@ var LeaferUI = function(exports) {
11099
11169
  if (scaleX) scaleHelper(transform, scaleX, scaleY);
11100
11170
  translate(transform, box.x + x, box.y + y);
11101
11171
  }
11102
- const {get: get$1, scale: scale$1, copy: copy$4} = MatrixHelper;
11172
+ const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
11103
11173
  const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
11104
11174
  function createPatternTask(paint, ui, canvas, renderOptions) {
11105
11175
  if (!paint.patternTask) {
@@ -11116,7 +11186,7 @@ var LeaferUI = function(exports) {
11116
11186
  let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
11117
11187
  if (paint.patternId !== id && !ui.destroyed) {
11118
11188
  if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
11119
- const {image: image, data: data} = paint, {opacity: opacity, filters: filters} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11189
+ const {image: image, data: data} = paint, {opacity: opacity} = paint.originPaint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
11120
11190
  let imageMatrix, xGap, yGap, {width: width, height: height} = image;
11121
11191
  if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
11122
11192
  width *= scaleX;
@@ -11130,9 +11200,9 @@ var LeaferUI = function(exports) {
11130
11200
  scaleY *= getFloorScale(height + (yGap || 0));
11131
11201
  imageMatrix = get$1();
11132
11202
  if (transform) copy$4(imageMatrix, transform);
11133
- scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
11203
+ scale$2(imageMatrix, 1 / scaleX, 1 / scaleY);
11134
11204
  }
11135
- const imageCanvas = image.getCanvas(width, height, opacity, filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
11205
+ const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
11136
11206
  const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
11137
11207
  paint.style = pattern;
11138
11208
  paint.patternId = id;
@@ -11159,7 +11229,7 @@ var LeaferUI = function(exports) {
11159
11229
  if (drawImage) {
11160
11230
  if (data.repeat) {
11161
11231
  drawImage = false;
11162
- } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
11232
+ } else if (!(originPaint.changeful || paint.film || Platform.name === "miniapp" || exporting)) {
11163
11233
  drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
11164
11234
  }
11165
11235
  }
@@ -11218,6 +11288,7 @@ var LeaferUI = function(exports) {
11218
11288
  if (!recycleMap) recycleMap = {};
11219
11289
  recycleMap[url] = true;
11220
11290
  ImageManager.recyclePaint(paint);
11291
+ if (data.__willDestroy && image.parent) PaintImage.recycleFilter(image, data.__leaf);
11221
11292
  if (image.loading) {
11222
11293
  if (!input) {
11223
11294
  input = data.__input && data.__input[attrName] || [];
@@ -11638,7 +11709,7 @@ var LeaferUI = function(exports) {
11638
11709
  }, row = {
11639
11710
  words: []
11640
11711
  };
11641
- if (__letterSpacing) content = [ ...content ];
11712
+ content = [ ...content ];
11642
11713
  for (let i = 0, len = content.length; i < len; i++) {
11643
11714
  char = content[i];
11644
11715
  if (char === "\n") {
@@ -12073,8 +12144,11 @@ var LeaferUI = function(exports) {
12073
12144
  });
12074
12145
  if (isObject(check)) value = check; else if (check === false) return;
12075
12146
  }
12076
- t.setDimOthers(false);
12077
- t.setBright(false);
12147
+ if (t.hasDimOthers) {
12148
+ t.setDimOthers(false);
12149
+ t.setBright(false);
12150
+ t.hasDimOthers = undefined;
12151
+ }
12078
12152
  if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
12079
12153
  if (t.single) {
12080
12154
  delete t.element.syncEventer;
@@ -12098,7 +12172,8 @@ var LeaferUI = function(exports) {
12098
12172
  return (target, key) => {
12099
12173
  defineKey(target, key, {
12100
12174
  get() {
12101
- const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
12175
+ const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, editTool: editTool, innerEditor: innerEditor, app: app} = this, mergeConfig = Object.assign({}, config);
12176
+ if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
12102
12177
  if (element && element.editConfig) {
12103
12178
  let {editConfig: editConfig} = element;
12104
12179
  if (editConfig.hover || editConfig.hoverStyle) {
@@ -12976,8 +13051,11 @@ var LeaferUI = function(exports) {
12976
13051
  const {editMask: editMask} = editor;
12977
13052
  const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
12978
13053
  editMask.visible = mask ? true : 0;
12979
- editor.setDimOthers(dimOthers);
12980
- editor.setBright(!!dimOthers || bright);
13054
+ if (!isUndefined(dimOthers) || !isUndefined(bright)) {
13055
+ editor.setDimOthers(dimOthers);
13056
+ editor.setBright(!!dimOthers || bright);
13057
+ editor.hasDimOthers = true;
13058
+ }
12981
13059
  if (spread) BoundsHelper.spread(bounds, spread);
12982
13060
  if (this.view.worldOpacity) {
12983
13061
  const {width: width, height: height} = bounds;
@@ -12996,7 +13074,8 @@ var LeaferUI = function(exports) {
12996
13074
  resizeL = resizeLines[(i - 1) / 2];
12997
13075
  resizeL.set(point);
12998
13076
  resizeL.visible = resizeP.visible && !hideResizeLines;
12999
- resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
13077
+ if (resizeP.visible) resizeP.visible = !!middlePoint;
13078
+ if (rotateP.visible) rotateP.visible = !!middlePoint;
13000
13079
  if ((i + 1) / 2 % 2) {
13001
13080
  resizeL.width = width + resizeL.height;
13002
13081
  if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
@@ -13082,8 +13161,9 @@ var LeaferUI = function(exports) {
13082
13161
  onDragStart(e) {
13083
13162
  this.dragging = true;
13084
13163
  const point = this.dragPoint = e.current, {pointType: pointType} = point;
13085
- const {moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = this.mergeConfig;
13164
+ const {moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable, onCopy: onCopy} = this.mergeConfig;
13086
13165
  if (pointType === "move") {
13166
+ if (e.altKey && onCopy && onCopy() && this.editor.single) this.app.interaction.replaceDownTarget(this.target);
13087
13167
  moveable && (this.moving = true);
13088
13168
  } else {
13089
13169
  if (pointType.includes("rotate") || this.isHoldRotateKey(e) || !resizeable) {
@@ -13202,26 +13282,31 @@ var LeaferUI = function(exports) {
13202
13282
  updatePointCursor(this, e);
13203
13283
  }
13204
13284
  onArrow(e) {
13205
- if (this.canUse && this.mergeConfig.keyEvent) {
13285
+ if (this.canUse) {
13206
13286
  let x = 0, y = 0;
13207
- const distance = e.shiftKey ? 10 : 1;
13208
13287
  switch (e.code) {
13209
13288
  case "ArrowDown":
13210
- y = distance;
13289
+ y = 1;
13211
13290
  break;
13212
13291
 
13213
13292
  case "ArrowUp":
13214
- y = -distance;
13293
+ y = -1;
13215
13294
  break;
13216
13295
 
13217
13296
  case "ArrowLeft":
13218
- x = -distance;
13297
+ x = -1;
13219
13298
  break;
13220
13299
 
13221
13300
  case "ArrowRight":
13222
- x = distance;
13301
+ x = 1;
13302
+ }
13303
+ if (x || y) {
13304
+ const {keyEvent: keyEvent, arrowStep: arrowStep, arrowFastStep: arrowFastStep} = this.mergeConfig;
13305
+ if (keyEvent) {
13306
+ const step = e.shiftKey ? arrowFastStep : arrowStep;
13307
+ this.transformTool.move(x * step, y * step);
13308
+ }
13223
13309
  }
13224
- if (x || y) this.transformTool.move(x, y);
13225
13310
  }
13226
13311
  }
13227
13312
  onDoubleTap(e) {
@@ -13326,6 +13411,8 @@ var LeaferUI = function(exports) {
13326
13411
  pointSize: 10,
13327
13412
  pointRadius: 16,
13328
13413
  rotateGap: 45,
13414
+ arrowStep: 1,
13415
+ arrowFastStep: 10,
13329
13416
  buttonsDirection: "bottom",
13330
13417
  buttonsMargin: 12,
13331
13418
  hideOnSmall: true,
@@ -15781,7 +15868,7 @@ var LeaferUI = function(exports) {
15781
15868
  __decorate([ arrowType("angle") ], exports.Arrow.prototype, "endArrow", void 0);
15782
15869
  exports.Arrow = __decorate([ registerUI() ], exports.Arrow);
15783
15870
  const {M: M$2, L: L$2, C: C$2, Q: Q$1, O: O$1} = PathCommandMap;
15784
- const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale} = PointHelper;
15871
+ const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
15785
15872
  const point$1 = {};
15786
15873
  const PathMatrixHelper = {
15787
15874
  layout(data, x, y, scaleX, scaleY, rotation, origin) {
@@ -15825,17 +15912,19 @@ var LeaferUI = function(exports) {
15825
15912
  function setPoint$2(data, startIndex, x, y, scaleX, scaleY, rotation, origin) {
15826
15913
  copyFrom$1(point$1, data[startIndex], data[startIndex + 1]);
15827
15914
  if (rotation) rotate$1(point$1, rotation, origin);
15828
- if (scaleX) scale(point$1, scaleX, scaleY);
15915
+ if (scaleX) scale$1(point$1, scaleX, scaleY);
15829
15916
  data[startIndex] = x + point$1.x;
15830
15917
  data[startIndex + 1] = y + point$1.y;
15831
15918
  }
15832
15919
  const {layout: layout$2, rotate: rotate} = PathMatrixHelper;
15833
15920
  const {getAngle: getAngle} = PointHelper;
15834
- const half = {
15921
+ const zero = {
15922
+ x: 0
15923
+ }, half = {
15835
15924
  x: -.5
15836
15925
  };
15837
15926
  const angle = {
15838
- connect: half,
15927
+ connect: zero,
15839
15928
  offset: {
15840
15929
  x: -.71,
15841
15930
  bevelJoin: .36,
@@ -15853,61 +15942,83 @@ var LeaferUI = function(exports) {
15853
15942
  path: [ 1, -3, -3, 2, 0, 0, 2, -1, 0 ]
15854
15943
  };
15855
15944
  const triangleLinePath = [ 1, -3, 0, 2, -3, -2, 2, 0, 0, 2, -3, 2, 2, -3, 0 ];
15856
- const triangle = {
15857
- connect: half,
15945
+ const triangleFill = {
15946
+ connect: zero,
15858
15947
  offset: {
15859
15948
  x: -.9,
15860
15949
  bevelJoin: .624,
15861
15950
  roundJoin: .4
15862
15951
  },
15863
- path: [ ...triangleLinePath, 1, -2.05, 1.1, 2, -2.05, -1.1 ],
15864
- dashPath: [ 1, -2, 0, 2, -.5, 0 ]
15952
+ path: [ ...triangleLinePath ]
15865
15953
  };
15866
- const arrowLinePath = [ 1, -3, 0, 2, -3.5, -1.8, 2, 0, 0, 2, -3.5, 1.8, 2, -3, 0 ];
15867
- const arrow = {
15868
- connect: half,
15869
- offset: {
15870
- x: -1.1,
15871
- bevelJoin: .872,
15872
- roundJoin: .6
15873
- },
15874
- path: [ ...arrowLinePath, 1, -2.25, .95, 2, -2.25, -.95 ],
15875
- dashPath: [ 1, -3, 0, 2, -.5, 0 ]
15954
+ const triangle = DataHelper.clone(triangleFill);
15955
+ triangle.path = [ ...triangleLinePath, 1, -2.05, 1.1, 2, -2.05, -1.1 ];
15956
+ triangle.dashPath = [ 1, -2, 0, 2, -.5, 0 ];
15957
+ const triangleFlipFill = {
15958
+ connect: zero,
15959
+ offset: half,
15960
+ path: [ ...triangleFill.path ]
15876
15961
  };
15877
15962
  const triangleFlip = {
15963
+ connect: zero,
15878
15964
  offset: half,
15879
15965
  path: [ ...triangle.path ],
15880
15966
  dashPath: [ 1, -2.5, 0, 2, -1, 0 ]
15881
15967
  };
15968
+ rotate(triangleFlipFill.path, 180, {
15969
+ x: -1.5,
15970
+ y: 0
15971
+ });
15882
15972
  rotate(triangleFlip.path, 180, {
15883
15973
  x: -1.5,
15884
15974
  y: 0
15885
15975
  });
15976
+ const arrowLinePath = [ 1, -3, 0, 2, -3.5, -1.8, 2, 0, 0, 2, -3.5, 1.8, 2, -3, 0 ];
15977
+ const arrowFill = {
15978
+ connect: zero,
15979
+ offset: {
15980
+ x: -1.1,
15981
+ bevelJoin: .872,
15982
+ roundJoin: .6
15983
+ },
15984
+ path: [ ...arrowLinePath ]
15985
+ };
15986
+ const arrow = DataHelper.clone(arrowFill);
15987
+ arrow.path = [ ...arrowLinePath, 1, -2.25, .95, 2, -2.25, -.95 ];
15988
+ arrow.dashPath = [ 1, -3, 0, 2, -.5, 0 ];
15886
15989
  const circleLine = {
15887
15990
  connect: {
15888
- x: -1.3
15991
+ x: -1.8
15889
15992
  },
15890
15993
  path: [ 1, 1.8, -.1, 2, 1.8, 0, 26, 0, 0, 1.8, 0, 359, 0 ]
15891
15994
  };
15892
- const circle = {
15995
+ const circleFill = {
15893
15996
  connect: {
15894
15997
  x: .5
15895
15998
  },
15896
- path: [ ...circleLine.path, 1, 0, 0, 26, 0, 0, 1, 0, 360, 0 ],
15897
- dashPath: [ 1, -.5, 0, 2, .5, 0 ]
15999
+ path: [ ...circleLine.path ]
15898
16000
  };
16001
+ const circle = DataHelper.clone(circleFill);
16002
+ circle.path = [ ...circleLine.path, 1, 0, 0, 26, 0, 0, 1, 0, 360, 0 ];
16003
+ circle.dashPath = [ 1, -.5, 0, 2, .5, 0 ];
15899
16004
  const squareLine = {
15900
16005
  connect: {
15901
- x: -1.3
16006
+ x: -1.4
15902
16007
  },
15903
16008
  path: [ 1, -1.4, 0, 2, -1.4, -1.4, 2, 1.4, -1.4, 2, 1.4, 1.4, 2, -1.4, 1.4, 2, -1.4, 0 ]
15904
16009
  };
16010
+ const squareFill = {
16011
+ path: [ ...squareLine.path ]
16012
+ };
15905
16013
  const square = {
15906
16014
  path: [ ...squareLine.path, 2, -1.4, -.49, 2, 1, -.49, 1, -1.4, .49, 2, 1, .49 ]
15907
16015
  };
15908
16016
  const diamondLine = DataHelper.clone(squareLine);
16017
+ diamondLine.connect.x = -1.9;
16018
+ const diamondFill = DataHelper.clone(squareFill);
15909
16019
  const diamond = DataHelper.clone(square);
15910
16020
  rotate(diamondLine.path, 45);
16021
+ rotate(diamondFill.path, 45);
15911
16022
  rotate(diamond.path, 45);
15912
16023
  const mark = {
15913
16024
  offset: half,
@@ -15927,19 +16038,33 @@ var LeaferUI = function(exports) {
15927
16038
  "diamond-line": diamondLine,
15928
16039
  mark: mark
15929
16040
  };
16041
+ const fillArrows = {
16042
+ triangle: triangleFill,
16043
+ "triangle-flip": triangleFlipFill,
16044
+ arrow: arrowFill,
16045
+ circle: circleFill,
16046
+ square: squareFill,
16047
+ diamond: diamondFill
16048
+ };
15930
16049
  function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern) {
15931
- let pathData, scale;
16050
+ let pathData, scale = 1, rotation = 0, fill;
15932
16051
  const {strokeCap: strokeCap, strokeJoin: strokeJoin} = ui.__;
15933
16052
  if (isObject(arrow)) {
15934
16053
  if (arrow.type) {
15935
- scale = arrow.scale;
16054
+ scale = arrow.scale || 1;
16055
+ rotation = arrow.rotation || 0;
15936
16056
  pathData = arrows[arrow.type];
16057
+ if (scale > 1) {
16058
+ const fillData = fillArrows[arrow.type];
16059
+ if (fillData) pathData = fillData, fill = true;
16060
+ }
15937
16061
  } else pathData = arrow;
15938
16062
  } else {
15939
16063
  pathData = arrows[arrow];
15940
16064
  }
16065
+ if (!fill) fill = pathData.fill;
15941
16066
  const {offset: offset, connect: connect, path: path, dashPath: dashPath} = pathData;
15942
- let connectX = connect ? connect.x : 0;
16067
+ let connectX = connect ? connect.x * scale : 0;
15943
16068
  let offsetX = offset ? offset.x : 0;
15944
16069
  const data = [ ...path ];
15945
16070
  if (hasDashPattern && dashPath) data.push(...dashPath);
@@ -15947,22 +16072,31 @@ var LeaferUI = function(exports) {
15947
16072
  if (offset) {
15948
16073
  if (strokeJoin === "round" && offset.roundJoin) offsetX += offset.roundJoin; else if (strokeJoin === "bevel" && offset.bevelJoin) offsetX += offset.bevelJoin;
15949
16074
  }
15950
- if (scale) layout$2(data, 0, 0, scale, scale);
16075
+ if (scale !== 1) layout$2(data, 0, 0, scale, scale);
15951
16076
  if (offsetX) layout$2(data, offsetX, 0);
15952
- layout$2(data, to.x, to.y, size, size, getAngle(from, to));
16077
+ layout$2(data, to.x, to.y, size, size, getAngle(from, to) + rotation);
15953
16078
  connectOffset.x = (connectX + offsetX) * size;
15954
- return data;
16079
+ const arrowData = {
16080
+ data: data
16081
+ };
16082
+ if (fill) arrowData.fill = fill;
16083
+ return arrowData;
15955
16084
  }
15956
16085
  const {M: M$1, L: L$1, C: C$1, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
15957
- const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint} = PointHelper;
16086
+ const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
16087
+ const {stintSet: stintSet$1} = DataHelper;
15958
16088
  const connectPoint = {};
15959
16089
  const first = {}, second = {};
15960
- const last = {}, now = {};
16090
+ const old = {}, last = {}, now = {};
15961
16091
  const PathArrowModule = {
15962
16092
  list: arrows,
15963
- addArrows(ui) {
15964
- const {startArrow: startArrow, endArrow: endArrow, strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = ui.__;
16093
+ fillList: fillArrows,
16094
+ addArrows(ui, updateCache) {
16095
+ const uData = ui.__;
16096
+ const {startArrow: startArrow, endArrow: endArrow, __strokeWidth: strokeWidth, dashPattern: dashPattern, __pathForRender: data, cornerRadius: cornerRadius} = uData;
15965
16097
  const clonePathForArrow = !cornerRadius;
16098
+ if (!updateCache) uData.__strokeWidthCache = strokeWidth;
16099
+ let startArrowPath, singleStartArrow, endArrowPath, singleEndArrow;
15966
16100
  let command, i = 0, len = data.length, count = 0, useStartArrow = startArrow && startArrow !== "none";
15967
16101
  while (i < len) {
15968
16102
  command = data[i];
@@ -15970,6 +16104,7 @@ var LeaferUI = function(exports) {
15970
16104
  case M$1:
15971
16105
  case L$1:
15972
16106
  if (count < 2 || i + 6 >= len) {
16107
+ copy(old, now);
15973
16108
  copyFrom(now, data[i + 1], data[i + 2]);
15974
16109
  if (!count && useStartArrow) copy(first, now);
15975
16110
  }
@@ -15977,12 +16112,18 @@ var LeaferUI = function(exports) {
15977
16112
  break;
15978
16113
 
15979
16114
  case C$1:
15980
- if (count === 1 || i + 7 >= len - 3) copyPoints(data, last, now, i + 3);
16115
+ if (count === 1 || i + 7 >= len - 3) {
16116
+ copyPoints(data, last, now, i + 3);
16117
+ old.x = data[i + 1], old.y = data[i + 2];
16118
+ }
15981
16119
  i += 7;
15982
16120
  break;
15983
16121
 
15984
16122
  case Q:
15985
- if (count === 1 || i + 5 >= len - 3) copyPoints(data, last, now, i + 1);
16123
+ if (count === 1 || i + 5 >= len - 3) {
16124
+ copyPoints(data, last, now, i + 1);
16125
+ copy(old, last);
16126
+ }
15986
16127
  i += 5;
15987
16128
  break;
15988
16129
 
@@ -16020,6 +16161,7 @@ var LeaferUI = function(exports) {
16020
16161
  case U:
16021
16162
  if (count === 1 || i + 6 >= len - 3) {
16022
16163
  copyPoints(data, last, now, i + 1);
16164
+ copy(old, last);
16023
16165
  if (i + 6 !== len) {
16024
16166
  now.x -= (now.x - last.x) / 10;
16025
16167
  now.y -= (now.y - last.y) / 10;
@@ -16030,13 +16172,13 @@ var LeaferUI = function(exports) {
16030
16172
  }
16031
16173
  count++;
16032
16174
  if (count === 1 && command !== M$1) return;
16033
- if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : last);
16175
+ if (count === 2 && useStartArrow) copy(second, command === L$1 ? now : isSame(old, first) ? last : old);
16034
16176
  if (i === len) {
16035
- const path = ui.__.__pathForRender = clonePathForArrow ? [ ...data ] : data;
16036
- const pathForArrow = ui.__.__pathForArrow = [];
16177
+ const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
16037
16178
  if (useStartArrow) {
16038
- const startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
16039
- dashPattern ? pathForArrow.push(...startArrowPath) : path.push(...startArrowPath);
16179
+ startArrowPath = getArrowPath(ui, startArrow, second, first, strokeWidth, connectPoint, !!dashPattern);
16180
+ singleStartArrow = startArrowPath.fill || dashPattern;
16181
+ if (!singleStartArrow) path.push(...startArrowPath.data);
16040
16182
  if (connectPoint.x) {
16041
16183
  getDistancePoint(first, second, -connectPoint.x, true);
16042
16184
  path[1] = second.x;
@@ -16044,8 +16186,10 @@ var LeaferUI = function(exports) {
16044
16186
  }
16045
16187
  }
16046
16188
  if (endArrow && endArrow !== "none") {
16047
- const endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
16048
- dashPattern ? pathForArrow.push(...endArrowPath) : path.push(...endArrowPath);
16189
+ if (isSame(last, now)) copy(last, old);
16190
+ endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
16191
+ singleEndArrow = endArrowPath.fill || dashPattern;
16192
+ if (!singleEndArrow) path.push(...endArrowPath.data);
16049
16193
  if (connectPoint.x) {
16050
16194
  getDistancePoint(now, last, -connectPoint.x, true);
16051
16195
  let index;
@@ -16072,10 +16216,21 @@ var LeaferUI = function(exports) {
16072
16216
  } else {
16073
16217
  copy(last, now);
16074
16218
  }
16219
+ stintSet$1(uData, "__startArrowPath", singleStartArrow && startArrowPath);
16220
+ stintSet$1(uData, "__endArrowPath", singleEndArrow && endArrowPath);
16075
16221
  }
16076
16222
  },
16077
- register(name, data) {
16223
+ updateArrow(ui) {
16224
+ const data = ui.__;
16225
+ if (data.strokeScaleFixed) {
16226
+ if (data.__strokeWidthCache !== data.__strokeWidth) {
16227
+ ui.__updateRenderPath(true);
16228
+ }
16229
+ }
16230
+ },
16231
+ register(name, data, fillData) {
16078
16232
  this.list[name] = data;
16233
+ if (fillData) this.fillList[name] = data;
16079
16234
  },
16080
16235
  get(name) {
16081
16236
  return this.list[name];
@@ -16094,12 +16249,26 @@ var LeaferUI = function(exports) {
16094
16249
  exports.UI.addAttr("endArrow", "none", arrowType);
16095
16250
  Object.assign(PathArrow, PathArrowModule);
16096
16251
  Object.assign(Paint, {
16097
- strokeArrow(_stroke, ui, canvas, _renderOptions) {
16098
- if (ui.__.dashPattern) {
16252
+ strokeArrow(stroke, ui, canvas, _renderOptions) {
16253
+ const {__startArrowPath: __startArrowPath, __endArrowPath: __endArrowPath, dashPattern: dashPattern} = ui.__;
16254
+ if (dashPattern) canvas.dashPattern = null;
16255
+ if (__startArrowPath) {
16099
16256
  canvas.beginPath();
16100
- ui.__drawPathByData(canvas, ui.__.__pathForArrow);
16101
- canvas.dashPattern = null;
16257
+ ui.__drawPathByData(canvas, __startArrowPath.data);
16102
16258
  canvas.stroke();
16259
+ if (__startArrowPath.fill) {
16260
+ canvas.fillStyle = stroke;
16261
+ canvas.fill();
16262
+ }
16263
+ }
16264
+ if (__endArrowPath) {
16265
+ canvas.beginPath();
16266
+ ui.__drawPathByData(canvas, __endArrowPath.data);
16267
+ canvas.stroke();
16268
+ if (__endArrowPath.fill) {
16269
+ canvas.fillStyle = stroke;
16270
+ canvas.fill();
16271
+ }
16103
16272
  }
16104
16273
  }
16105
16274
  });
@@ -16512,7 +16681,7 @@ var LeaferUI = function(exports) {
16512
16681
  exports.UI.addAttr("autoWidth", undefined, autoBoundsType);
16513
16682
  exports.UI.addAttr("autoHeight", undefined, autoBoundsType);
16514
16683
  exports.UI.addAttr("autoBox", undefined, boundsType);
16515
- const {copyAndSpread: copyAndSpread} = BoundsHelper;
16684
+ const {copyAndSpread: copyAndSpread$1} = BoundsHelper;
16516
16685
  box$1.__updateFlowLayout = function() {
16517
16686
  const {leaferIsCreated: leaferIsCreated, flow: flow} = this;
16518
16687
  if (leaferIsCreated) this.leafer.created = false;
@@ -16542,7 +16711,7 @@ var LeaferUI = function(exports) {
16542
16711
  const same = layout.contentBounds === layout.boxBounds;
16543
16712
  if (padding) {
16544
16713
  if (same) layout.shrinkContent();
16545
- copyAndSpread(layout.contentBounds, layout.boxBounds, padding, true);
16714
+ copyAndSpread$1(layout.contentBounds, layout.boxBounds, padding, true);
16546
16715
  } else {
16547
16716
  if (!same) layout.shrinkContentCancel();
16548
16717
  }
@@ -16563,7 +16732,7 @@ var LeaferUI = function(exports) {
16563
16732
  boxBounds.width = data.width, boxBounds.x = 0;
16564
16733
  }
16565
16734
  }
16566
- flow && secondLayout && data.padding && copyAndSpread(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
16735
+ flow && secondLayout && data.padding && copyAndSpread$1(boxBounds, boxBounds, data.padding, false, data.__autoSize ? null : data.__autoWidth ? "width" : "height");
16567
16736
  this.__updateNaturalSize();
16568
16737
  } else {
16569
16738
  this.__updateRectBoxBounds();
@@ -18366,9 +18535,7 @@ var LeaferUI = function(exports) {
18366
18535
  const {Yes: Yes, NoAndSkip: NoAndSkip, YesAndSkip: YesAndSkip} = exports.Answer;
18367
18536
  const idCondition = {}, classNameCondition = {}, tagCondition = {};
18368
18537
  class Finder {
18369
- constructor(target) {
18370
- this.innerIdMap = {};
18371
- this.idMap = {};
18538
+ constructor(target, _config) {
18372
18539
  this.methods = {
18373
18540
  id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf),
18374
18541
  1) : 0,
@@ -18378,6 +18545,13 @@ var LeaferUI = function(exports) {
18378
18545
  tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
18379
18546
  tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
18380
18547
  };
18548
+ this.idMap = {};
18549
+ this.innerIdMap = {};
18550
+ const app = target && target.app;
18551
+ if (app) {
18552
+ app.idMap ? this.idMap = app.idMap : app.idMap = this.idMap;
18553
+ app.innerIdMap ? this.innerIdMap = app.innerIdMap : app.innerIdMap = this.innerIdMap;
18554
+ }
18381
18555
  if (this.target = target) this.__listenEvents();
18382
18556
  }
18383
18557
  getBy(condition, branch, one, options) {
@@ -18498,8 +18672,13 @@ var LeaferUI = function(exports) {
18498
18672
  return getSelector(this).getBy(condition, this, true, options);
18499
18673
  };
18500
18674
  Plugin.add("find");
18501
- Creator.finder = function(target) {
18502
- return new Finder(target);
18675
+ Creator.finder = function(target, config) {
18676
+ return new Finder(target, config);
18677
+ };
18678
+ LeafHelper.cacheId = function(t) {
18679
+ const {leafer: leafer, id: id} = t;
18680
+ if (id) leafer.app.idMap[id] = t;
18681
+ if (leafer.cacheInnerId) leafer.app.innerIdMap[t.innerId] = t;
18503
18682
  };
18504
18683
  const {setPoint: setPoint, addPoint: addPoint, toBounds: toBounds} = TwoPointBoundsHelper;
18505
18684
  function getTrimBounds(canvas) {
@@ -18771,7 +18950,7 @@ var LeaferUI = function(exports) {
18771
18950
  style: {
18772
18951
  dragBoundsType: "outer",
18773
18952
  strokeAlign: "center",
18774
- strokeWidthFixed: "zoom-in",
18953
+ strokeScaleFixed: "zoom-in",
18775
18954
  width: 6,
18776
18955
  height: 6,
18777
18956
  opacity: .5,
@@ -19008,6 +19187,141 @@ var LeaferUI = function(exports) {
19008
19187
  fill: "white"
19009
19188
  }
19010
19189
  });
19190
+ const {stintSet: stintSet} = DataHelper;
19191
+ function scaleFixedType(defaultValue) {
19192
+ return decorateLeafAttr(defaultValue, key => attr({
19193
+ set(value) {
19194
+ if (this.__setAttr(key, value)) {
19195
+ const layout = this.__layout;
19196
+ doBoundsType(this);
19197
+ if (!isNumber(value)) value = value ? 1 : 0;
19198
+ stintSet(layout, "scaleFixed", value);
19199
+ stintSet(layout, "outerScale", value ? 1 / value : 0);
19200
+ if (!layout.outerScale && layout.localOuterBounds) layout.localOuterBounds = undefined;
19201
+ }
19202
+ }
19203
+ }));
19204
+ }
19205
+ const {scale: scale} = MatrixHelper;
19206
+ const {copyAndSpread: copyAndSpread} = BoundsHelper;
19207
+ const {getScaleFixedData: getScaleFixedData} = MathHelper;
19208
+ LeafHelper.updateScaleFixedWorld = function(t) {
19209
+ const {__world: __world, __: __} = t, {scaleX: scaleX, scaleY: scaleY} = getScaleFixedData(__world, __.scaleFixed);
19210
+ if (scaleX !== 1) {
19211
+ scale(__world, scaleX, scaleY);
19212
+ __world.scaleX *= scaleX, __world.scaleY *= scaleY;
19213
+ }
19214
+ };
19215
+ LeafHelper.updateOuterBounds = function(t) {
19216
+ const layout = t.__layout, {localRenderBounds: localRenderBounds} = layout;
19217
+ const localOuterBounds = layout.localOuterBounds || (layout.localOuterBounds = {});
19218
+ const {width: width, height: height} = localRenderBounds;
19219
+ const scale = layout.outerScale - 1;
19220
+ copyAndSpread(localOuterBounds, localRenderBounds, [ height * scale, width * scale ]);
19221
+ if (t.parent) t.parent.__layout.renderChange();
19222
+ };
19223
+ Plugin.add("scale-fixed");
19224
+ exports.UI.addAttr("scaleFixed", undefined, scaleFixedType);
19225
+ class EllipseBoxData extends BoxData {}
19226
+ const ellipse$1 = exports.Ellipse.prototype;
19227
+ exports.EllipseBox = class EllipseBox extends exports.Box {
19228
+ get __tag() {
19229
+ return "EllipseBox";
19230
+ }
19231
+ __updatePath() {}
19232
+ };
19233
+ __decorate([ dataProcessor(EllipseBoxData) ], exports.EllipseBox.prototype, "__", void 0);
19234
+ __decorate([ pathType(0) ], exports.EllipseBox.prototype, "innerRadius", void 0);
19235
+ __decorate([ pathType(0) ], exports.EllipseBox.prototype, "startAngle", void 0);
19236
+ __decorate([ pathType(0) ], exports.EllipseBox.prototype, "endAngle", void 0);
19237
+ __decorate([ rewrite(ellipse$1.__updatePath) ], exports.EllipseBox.prototype, "__updatePath", null);
19238
+ exports.EllipseBox = __decorate([ rewriteAble(), registerUI() ], exports.EllipseBox);
19239
+ class PolygonBoxData extends BoxData {
19240
+ get __usePathBox() {
19241
+ return this.points || this.__pathInputed;
19242
+ }
19243
+ }
19244
+ const polygon = exports.Polygon.prototype;
19245
+ exports.PolygonBox = class PolygonBox extends exports.Box {
19246
+ get __tag() {
19247
+ return "PolygonBox";
19248
+ }
19249
+ __updatePath() {}
19250
+ };
19251
+ __decorate([ dataProcessor(PolygonBoxData) ], exports.PolygonBox.prototype, "__", void 0);
19252
+ __decorate([ pathType(3) ], exports.PolygonBox.prototype, "sides", void 0);
19253
+ __decorate([ pathType() ], exports.PolygonBox.prototype, "points", void 0);
19254
+ __decorate([ pathType(0) ], exports.PolygonBox.prototype, "curve", void 0);
19255
+ __decorate([ rewrite(polygon.__updatePath) ], exports.PolygonBox.prototype, "__updatePath", null);
19256
+ exports.PolygonBox = __decorate([ rewriteAble(), registerUI() ], exports.PolygonBox);
19257
+ class StarBoxData extends BoxData {}
19258
+ const ellipse = exports.Star.prototype;
19259
+ exports.StarBox = class StarBox extends exports.Box {
19260
+ get __tag() {
19261
+ return "StarBox";
19262
+ }
19263
+ __updatePath() {}
19264
+ };
19265
+ __decorate([ pathType(5) ], exports.StarBox.prototype, "corners", void 0);
19266
+ __decorate([ pathType(.382) ], exports.StarBox.prototype, "innerRadius", void 0);
19267
+ __decorate([ dataProcessor(StarBoxData) ], exports.StarBox.prototype, "__", void 0);
19268
+ __decorate([ rewrite(ellipse.__updatePath) ], exports.StarBox.prototype, "__updatePath", null);
19269
+ exports.StarBox = __decorate([ rewriteAble(), registerUI() ], exports.StarBox);
19270
+ class PathBoxData extends BoxData {}
19271
+ exports.PathBox = class PathBox extends exports.Box {
19272
+ get __tag() {
19273
+ return "PathBox";
19274
+ }
19275
+ };
19276
+ __decorate([ dataProcessor(PathBoxData) ], exports.PathBox.prototype, "__", void 0);
19277
+ __decorate([ affectStrokeBoundsType("center") ], exports.PathBox.prototype, "strokeAlign", void 0);
19278
+ exports.PathBox = __decorate([ registerUI() ], exports.PathBox);
19279
+ class ImageBoxData extends BoxData {
19280
+ get __urlType() {
19281
+ return "image";
19282
+ }
19283
+ setUrl(value) {
19284
+ this.__setImageFill(value);
19285
+ this._url = value;
19286
+ }
19287
+ __setImageFill(value) {
19288
+ this.fill = value ? {
19289
+ type: this.__urlType,
19290
+ mode: "stretch",
19291
+ url: value
19292
+ } : undefined;
19293
+ }
19294
+ __getData() {
19295
+ const data = super.__getData();
19296
+ if (data.url) delete data.fill;
19297
+ return data;
19298
+ }
19299
+ __getInputData(names, options) {
19300
+ const data = super.__getInputData(names, options);
19301
+ if (data.url) delete data.fill;
19302
+ return data;
19303
+ }
19304
+ }
19305
+ exports.ImageBox = class ImageBox extends exports.Box {
19306
+ get __tag() {
19307
+ return "ImageBox";
19308
+ }
19309
+ get ready() {
19310
+ const {image: image} = this;
19311
+ return image && image.ready;
19312
+ }
19313
+ get image() {
19314
+ const {fill: fill} = this.__;
19315
+ return isArray(fill) && fill[0].image;
19316
+ }
19317
+ get __useSelfBox() {
19318
+ return true;
19319
+ }
19320
+ };
19321
+ __decorate([ dataProcessor(ImageBoxData) ], exports.ImageBox.prototype, "__", void 0);
19322
+ __decorate([ boundsType("") ], exports.ImageBox.prototype, "url", void 0);
19323
+ exports.ImageBox = __decorate([ registerUI() ], exports.ImageBox);
19324
+ Plugin.add("box");
19011
19325
  exports.AlignHelper = AlignHelper;
19012
19326
  exports.AnimateEasing = AnimateEasing;
19013
19327
  exports.AnimateEvent = AnimateEvent;
@@ -19045,6 +19359,7 @@ var LeaferUI = function(exports) {
19045
19359
  exports.EditorScaleEvent = EditorScaleEvent;
19046
19360
  exports.EditorSkewEvent = EditorSkewEvent;
19047
19361
  exports.Effect = Effect;
19362
+ exports.EllipseBoxData = EllipseBoxData;
19048
19363
  exports.EllipseData = EllipseData;
19049
19364
  exports.EllipseHelper = EllipseHelper;
19050
19365
  exports.Event = Event;
@@ -19061,6 +19376,7 @@ var LeaferUI = function(exports) {
19061
19376
  exports.HighBezierHelper = HighBezierHelper;
19062
19377
  exports.HighCurveHelper = HighCurveHelper;
19063
19378
  exports.HitCanvasManager = HitCanvasManager;
19379
+ exports.ImageBoxData = ImageBoxData;
19064
19380
  exports.ImageData = ImageData;
19065
19381
  exports.ImageEvent = ImageEvent;
19066
19382
  exports.ImageManager = ImageManager;
@@ -19110,6 +19426,7 @@ var LeaferUI = function(exports) {
19110
19426
  exports.PathArrow = PathArrow;
19111
19427
  exports.PathArrowModule = PathArrowModule;
19112
19428
  exports.PathBounds = PathBounds;
19429
+ exports.PathBoxData = PathBoxData;
19113
19430
  exports.PathCommandDataHelper = PathCommandDataHelper;
19114
19431
  exports.PathCommandMap = PathCommandMap;
19115
19432
  exports.PathCommandNodeHelper = PathCommandNodeHelper;
@@ -19130,6 +19447,7 @@ var LeaferUI = function(exports) {
19130
19447
  exports.Point = Point;
19131
19448
  exports.PointHelper = PointHelper;
19132
19449
  exports.PointerButton = PointerButton;
19450
+ exports.PolygonBoxData = PolygonBoxData;
19133
19451
  exports.PolygonData = PolygonData;
19134
19452
  exports.PropertyEvent = PropertyEvent;
19135
19453
  exports.RectData = RectData;
@@ -19145,6 +19463,7 @@ var LeaferUI = function(exports) {
19145
19463
  exports.Scroller = Scroller;
19146
19464
  exports.SelectArea = SelectArea;
19147
19465
  exports.Selector = Selector;
19466
+ exports.StarBoxData = StarBoxData;
19148
19467
  exports.StarData = StarData;
19149
19468
  exports.State = State;
19150
19469
  exports.StringNumberMap = StringNumberMap;