@leafer-ui/miniapp 1.0.0-rc.23 → 1.0.0-rc.25

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.
@@ -750,7 +750,7 @@ const { float, fourNumber } = MathHelper;
750
750
  const { floor, ceil: ceil$2 } = Math;
751
751
  let right$1, bottom$1, boundsRight, boundsBottom;
752
752
  const point = {};
753
- const toPoint$2 = {};
753
+ const toPoint$5 = {};
754
754
  const BoundsHelper = {
755
755
  tempBounds: {},
756
756
  set(t, x = 0, y = 0, width = 0, height = 0) {
@@ -852,17 +852,17 @@ const BoundsHelper = {
852
852
  else {
853
853
  point.x = t.x;
854
854
  point.y = t.y;
855
- toOuterPoint$1(matrix, point, toPoint$2);
856
- setPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
855
+ toOuterPoint$1(matrix, point, toPoint$5);
856
+ setPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
857
857
  point.x = t.x + t.width;
858
- toOuterPoint$1(matrix, point, toPoint$2);
859
- addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
858
+ toOuterPoint$1(matrix, point, toPoint$5);
859
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
860
860
  point.y = t.y + t.height;
861
- toOuterPoint$1(matrix, point, toPoint$2);
862
- addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
861
+ toOuterPoint$1(matrix, point, toPoint$5);
862
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
863
863
  point.x = t.x;
864
- toOuterPoint$1(matrix, point, toPoint$2);
865
- addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
864
+ toOuterPoint$1(matrix, point, toPoint$5);
865
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
866
866
  toBounds$4(tempPointBounds$1, to);
867
867
  }
868
868
  },
@@ -1235,10 +1235,10 @@ function get$5(around) {
1235
1235
  return typeof around === 'string' ? directionData[Direction9[around]] : around;
1236
1236
  }
1237
1237
 
1238
- const { toPoint: toPoint$1 } = AroundHelper;
1238
+ const { toPoint: toPoint$4 } = AroundHelper;
1239
1239
  const AlignHelper = {
1240
1240
  toPoint(align, contentBounds, bounds, to, onlySize) {
1241
- toPoint$1(align, bounds, to, onlySize, contentBounds);
1241
+ toPoint$4(align, bounds, to, onlySize, contentBounds);
1242
1242
  }
1243
1243
  };
1244
1244
 
@@ -1485,6 +1485,8 @@ const DataHelper = {
1485
1485
  const { assign } = DataHelper;
1486
1486
 
1487
1487
  class LeafData {
1488
+ get __useNaturalRatio() { return true; }
1489
+ get __isLinePath() { return this.path && this.path.length === 6; }
1488
1490
  get __blendMode() {
1489
1491
  if (this.eraser && this.eraser !== 'path')
1490
1492
  return 'destination-out';
@@ -1982,6 +1984,11 @@ class LeaferCanvasBase extends Canvas$1 {
1982
1984
  }
1983
1985
  updateViewSize() { }
1984
1986
  updateClientBounds() { }
1987
+ getClientBounds(update) {
1988
+ if (update)
1989
+ this.updateClientBounds();
1990
+ return this.clientBounds || this.bounds;
1991
+ }
1985
1992
  startAutoLayout(_autoBounds, _listener) { }
1986
1993
  stopAutoLayout() { }
1987
1994
  setCursor(_cursor) { }
@@ -2233,7 +2240,7 @@ const RectHelper = {
2233
2240
 
2234
2241
  const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2235
2242
  const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
2236
- const { set: set$2 } = PointHelper;
2243
+ const { set } = PointHelper;
2237
2244
  const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
2238
2245
  const tempPoint$2 = {};
2239
2246
  const BezierHelper = {
@@ -2311,9 +2318,9 @@ const BezierHelper = {
2311
2318
  addPoint$2(setPointBounds, x1, y1);
2312
2319
  }
2313
2320
  if (setStartPoint)
2314
- set$2(setStartPoint, fromX, fromY);
2321
+ set(setStartPoint, fromX, fromY);
2315
2322
  if (setEndPoint)
2316
- set$2(setEndPoint, x1, y1);
2323
+ set(setEndPoint, x1, y1);
2317
2324
  return;
2318
2325
  }
2319
2326
  const anticlockwise = BAx * CBy - CBx * BAy < 0;
@@ -2362,7 +2369,7 @@ const BezierHelper = {
2362
2369
  if (setPointBounds)
2363
2370
  setPoint$2(setPointBounds, fromX, fromY);
2364
2371
  if (setStartPoint)
2365
- set$2(setStartPoint, fromX, fromY);
2372
+ set(setStartPoint, fromX, fromY);
2366
2373
  for (let i = 0; i < parts; i++) {
2367
2374
  endCos = cos$3(endRadian);
2368
2375
  endSin = sin$3(endRadian);
@@ -2384,7 +2391,7 @@ const BezierHelper = {
2384
2391
  endRadian += partRadian;
2385
2392
  }
2386
2393
  if (setEndPoint)
2387
- set$2(setEndPoint, cx + x, cy + y);
2394
+ set(setEndPoint, cx + x, cy + y);
2388
2395
  },
2389
2396
  quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
2390
2397
  data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
@@ -2530,11 +2537,15 @@ const PathConvert = {
2530
2537
  char = pathString[i];
2531
2538
  if (StringNumberMap[char]) {
2532
2539
  if (char === '.') {
2533
- current.dot++;
2534
- if (current.dot > 1) {
2540
+ if (current.dot) {
2535
2541
  pushData(data, num);
2536
2542
  num = '';
2537
2543
  }
2544
+ current.dot++;
2545
+ }
2546
+ if (num === '0' && char !== '.') {
2547
+ pushData(data, num);
2548
+ num = '';
2538
2549
  }
2539
2550
  num += char;
2540
2551
  }
@@ -3624,7 +3635,9 @@ class LeaferImage {
3624
3635
  }
3625
3636
  }
3626
3637
 
3627
- function defineKey(target, key, descriptor) {
3638
+ function defineKey(target, key, descriptor, noConfigurable) {
3639
+ if (!noConfigurable)
3640
+ descriptor.configurable = descriptor.enumerable = true;
3628
3641
  Object.defineProperty(target, key, descriptor);
3629
3642
  }
3630
3643
  function getDescriptor(object, name) {
@@ -3643,9 +3656,7 @@ function attr(partDescriptor) {
3643
3656
  function defineLeafAttr(target, key, defaultValue, partDescriptor) {
3644
3657
  const defaultDescriptor = {
3645
3658
  get() { return this.__getAttr(key); },
3646
- set(value) { this.__setAttr(key, value); },
3647
- configurable: true,
3648
- enumerable: true
3659
+ set(value) { this.__setAttr(key, value); }
3649
3660
  };
3650
3661
  defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
3651
3662
  defineDataProcessor(target, key, defaultValue);
@@ -3656,35 +3667,33 @@ function dataType(defaultValue) {
3656
3667
  function positionType(defaultValue, checkFiniteNumber) {
3657
3668
  return decorateLeafAttr(defaultValue, (key) => attr({
3658
3669
  set(value) {
3659
- this.__setAttr(key, value, checkFiniteNumber);
3660
- this.__layout.matrixChanged || this.__layout.matrixChange();
3670
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.matrixChanged || this.__layout.matrixChange());
3661
3671
  }
3662
3672
  }));
3663
3673
  }
3664
3674
  function autoLayoutType(defaultValue) {
3665
3675
  return decorateLeafAttr(defaultValue, (key) => attr({
3666
3676
  set(value) {
3667
- this.__setAttr(key, value);
3668
- this.__layout.matrixChanged || this.__layout.matrixChange();
3669
- this.__hasAutoLayout = !!value;
3670
- if (!this.__local)
3671
- this.__layout.createLocal();
3677
+ if (this.__setAttr(key, value)) {
3678
+ this.__layout.matrixChanged || this.__layout.matrixChange();
3679
+ this.__hasAutoLayout = !!value;
3680
+ if (!this.__local)
3681
+ this.__layout.createLocal();
3682
+ }
3672
3683
  }
3673
3684
  }));
3674
3685
  }
3675
3686
  function scaleType(defaultValue, checkFiniteNumber) {
3676
3687
  return decorateLeafAttr(defaultValue, (key) => attr({
3677
3688
  set(value) {
3678
- this.__setAttr(key, value, checkFiniteNumber);
3679
- this.__layout.scaleChanged || this.__layout.scaleChange();
3689
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.scaleChanged || this.__layout.scaleChange());
3680
3690
  }
3681
3691
  }));
3682
3692
  }
3683
3693
  function rotationType(defaultValue, checkFiniteNumber) {
3684
3694
  return decorateLeafAttr(defaultValue, (key) => attr({
3685
3695
  set(value) {
3686
- this.__setAttr(key, value, checkFiniteNumber);
3687
- this.__layout.rotationChanged || this.__layout.rotationChange();
3696
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.rotationChanged || this.__layout.rotationChange());
3688
3697
  }
3689
3698
  }));
3690
3699
  }
@@ -3698,9 +3707,7 @@ function boundsType(defaultValue, checkFiniteNumber) {
3698
3707
  function naturalBoundsType(defaultValue) {
3699
3708
  return decorateLeafAttr(defaultValue, (key) => attr({
3700
3709
  set(value) {
3701
- this.__setAttr(key, value);
3702
- doBoundsType(this);
3703
- this.__.__removeNaturalSize();
3710
+ this.__setAttr(key, value) && (doBoundsType(this), this.__.__removeNaturalSize());
3704
3711
  }
3705
3712
  }));
3706
3713
  }
@@ -3712,8 +3719,11 @@ function doBoundsType(leaf) {
3712
3719
  function pathInputType(defaultValue) {
3713
3720
  return decorateLeafAttr(defaultValue, (key) => attr({
3714
3721
  set(value) {
3715
- if (this.__.__pathInputed !== 2)
3716
- this.__.__pathInputed = value ? 1 : 0;
3722
+ const data = this.__;
3723
+ if (data.__pathInputed !== 2)
3724
+ data.__pathInputed = value ? 1 : 0;
3725
+ if (!value)
3726
+ data.__pathForRender = undefined;
3717
3727
  this.__setAttr(key, value);
3718
3728
  doBoundsType(this);
3719
3729
  }
@@ -3744,56 +3754,66 @@ function affectRenderBoundsType(defaultValue) {
3744
3754
  function surfaceType(defaultValue) {
3745
3755
  return decorateLeafAttr(defaultValue, (key) => attr({
3746
3756
  set(value) {
3747
- this.__setAttr(key, value);
3748
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3757
+ this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
3749
3758
  }
3750
3759
  }));
3751
3760
  }
3752
3761
  function opacityType(defaultValue) {
3753
3762
  return decorateLeafAttr(defaultValue, (key) => attr({
3754
3763
  set(value) {
3755
- this.__setAttr(key, value);
3756
- this.__layout.opacityChanged || this.__layout.opacityChange();
3764
+ this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
3765
+ }
3766
+ }));
3767
+ }
3768
+ function visibleType(defaultValue) {
3769
+ return decorateLeafAttr(defaultValue, (key) => attr({
3770
+ set(value) {
3771
+ const oldValue = this.visible;
3772
+ if (this.__setAttr(key, value)) {
3773
+ this.__layout.opacityChanged || this.__layout.opacityChange();
3774
+ if (oldValue === 0 || value === 0)
3775
+ doBoundsType(this);
3776
+ }
3757
3777
  }
3758
3778
  }));
3759
3779
  }
3760
3780
  function sortType(defaultValue) {
3761
3781
  return decorateLeafAttr(defaultValue, (key) => attr({
3762
3782
  set(value) {
3763
- this.__setAttr(key, value);
3764
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3765
- this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
3783
+ if (this.__setAttr(key, value)) {
3784
+ this.__layout.surfaceChanged || this.__layout.surfaceChange();
3785
+ this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
3786
+ }
3766
3787
  }
3767
3788
  }));
3768
3789
  }
3769
3790
  function maskType(defaultValue) {
3770
3791
  return decorateLeafAttr(defaultValue, (key) => attr({
3771
3792
  set(value) {
3772
- this.__setAttr(key, value);
3773
- this.__layout.boxChanged || this.__layout.boxChange();
3774
- this.waitParent(() => { this.parent.__updateMask(value); });
3775
- if (typeof value === 'string')
3776
- this.maskType = value;
3793
+ if (this.__setAttr(key, value)) {
3794
+ this.__layout.boxChanged || this.__layout.boxChange();
3795
+ this.waitParent(() => { this.parent.__updateMask(value); });
3796
+ }
3777
3797
  }
3778
3798
  }));
3779
3799
  }
3780
3800
  function eraserType(defaultValue) {
3781
3801
  return decorateLeafAttr(defaultValue, (key) => attr({
3782
3802
  set(value) {
3783
- this.__setAttr(key, value);
3784
- this.waitParent(() => { this.parent.__updateEraser(value); });
3803
+ this.__setAttr(key, value) && this.waitParent(() => { this.parent.__updateEraser(value); });
3785
3804
  }
3786
3805
  }));
3787
3806
  }
3788
3807
  function hitType(defaultValue) {
3789
3808
  return decorateLeafAttr(defaultValue, (key) => attr({
3790
3809
  set(value) {
3791
- this.__setAttr(key, value);
3792
- if (Debug.showHitView) {
3793
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3810
+ if (this.__setAttr(key, value)) {
3811
+ if (Debug.showHitView) {
3812
+ this.__layout.surfaceChanged || this.__layout.surfaceChange();
3813
+ }
3814
+ if (this.leafer)
3815
+ this.leafer.updateCursor();
3794
3816
  }
3795
- if (this.leafer)
3796
- this.leafer.updateCursor();
3797
3817
  }
3798
3818
  }));
3799
3819
  }
@@ -3834,9 +3854,7 @@ function defineDataProcessor(target, key, defaultValue) {
3834
3854
  },
3835
3855
  set(value) {
3836
3856
  this[computedKey] = value;
3837
- },
3838
- configurable: true,
3839
- enumerable: true
3857
+ }
3840
3858
  };
3841
3859
  if (defaultValue === undefined) {
3842
3860
  property.get = function () { return this[computedKey]; };
@@ -3844,13 +3862,25 @@ function defineDataProcessor(target, key, defaultValue) {
3844
3862
  else if (key === 'width') {
3845
3863
  property.get = function () {
3846
3864
  const v = this[computedKey];
3847
- return v === undefined ? (this.__naturalWidth || defaultValue) : v;
3865
+ if (v === undefined) {
3866
+ const t = this;
3867
+ return t._height && t.__naturalWidth && t.__useNaturalRatio ? t._height * t.__naturalWidth / t.__naturalHeight : t.__naturalWidth || defaultValue;
3868
+ }
3869
+ else {
3870
+ return v;
3871
+ }
3848
3872
  };
3849
3873
  }
3850
3874
  else if (key === 'height') {
3851
3875
  property.get = function () {
3852
3876
  const v = this[computedKey];
3853
- return v === undefined ? (this.__naturalHeight || defaultValue) : v;
3877
+ if (v === undefined) {
3878
+ const t = this;
3879
+ return t._width && t.__naturalHeight && t.__useNaturalRatio ? t._width * t.__naturalHeight / t.__naturalWidth : t.__naturalHeight || defaultValue;
3880
+ }
3881
+ else {
3882
+ return v;
3883
+ }
3854
3884
  };
3855
3885
  }
3856
3886
  let descriptor, find = data;
@@ -3864,7 +3894,7 @@ function defineDataProcessor(target, key, defaultValue) {
3864
3894
  property.set = data[setMethodName];
3865
3895
  delete data[setMethodName];
3866
3896
  }
3867
- Object.defineProperty(data, key, property);
3897
+ defineKey(data, key, property);
3868
3898
  }
3869
3899
 
3870
3900
  const debug$8 = new Debug('rewrite');
@@ -4065,13 +4095,6 @@ const LeafHelper = {
4065
4095
  return true;
4066
4096
  p = p.parent;
4067
4097
  }
4068
- },
4069
- hasParentAutoLayout(p) {
4070
- while (p.parent) {
4071
- p = p.parent;
4072
- if (p.__hasAutoLayout)
4073
- return true;
4074
- }
4075
4098
  }
4076
4099
  };
4077
4100
  const L = LeafHelper;
@@ -4091,13 +4114,13 @@ const LeafBoundsHelper = {
4091
4114
  return target.__world;
4092
4115
  },
4093
4116
  localBoxBounds(target) {
4094
- return target.__.eraser ? null : (target.__local || target.__layout);
4117
+ return target.__.eraser || target.__.visible === 0 ? null : (target.__local || target.__layout);
4095
4118
  },
4096
4119
  localStrokeBounds(target) {
4097
- return target.__.eraser ? null : target.__layout.localStrokeBounds;
4120
+ return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
4098
4121
  },
4099
4122
  localRenderBounds(target) {
4100
- return target.__.eraser ? null : target.__layout.localRenderBounds;
4123
+ return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
4101
4124
  },
4102
4125
  maskLocalBoxBounds(target) {
4103
4126
  return target.__.mask ? target.__localBoxBounds : null;
@@ -4803,7 +4826,7 @@ const LeafDataProxy = {
4803
4826
  };
4804
4827
 
4805
4828
  const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
4806
- const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
4829
+ const { toPoint: toPoint$3, tempPoint: tempPoint$1 } = AroundHelper;
4807
4830
  const LeafMatrix = {
4808
4831
  __updateWorldMatrix() {
4809
4832
  multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
@@ -4820,7 +4843,7 @@ const LeafMatrix = {
4820
4843
  local.e = data.x + data.offsetX;
4821
4844
  local.f = data.y + data.offsetY;
4822
4845
  if (data.around || data.origin) {
4823
- toPoint(data.around || data.origin, layout.boxBounds, tempPoint$1);
4846
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
4824
4847
  translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
4825
4848
  }
4826
4849
  }
@@ -4828,7 +4851,7 @@ const LeafMatrix = {
4828
4851
  }
4829
4852
  };
4830
4853
 
4831
- const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2, hasParentAutoLayout } = LeafHelper;
4854
+ const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
4832
4855
  const { updateBounds: updateBounds$1 } = BranchHelper;
4833
4856
  const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
4834
4857
  const { toBounds: toBounds$2 } = PathBounds;
@@ -4847,7 +4870,6 @@ const LeafBounds = {
4847
4870
  this.__updatePath();
4848
4871
  this.__updateRenderPath();
4849
4872
  this.__updateBoxBounds();
4850
- layout.boxChanged = false;
4851
4873
  layout.resized = true;
4852
4874
  }
4853
4875
  if (layout.localBoxChanged) {
@@ -4861,12 +4883,12 @@ const LeafBounds = {
4861
4883
  if (this.parent)
4862
4884
  this.parent.__layout.boxChange();
4863
4885
  }
4886
+ layout.boxChanged = false;
4864
4887
  if (layout.strokeChanged) {
4865
4888
  layout.strokeSpread = this.__updateStrokeSpread();
4866
4889
  if (layout.strokeSpread) {
4867
- if (layout.strokeBounds === layout.boxBounds) {
4890
+ if (layout.strokeBounds === layout.boxBounds)
4868
4891
  layout.spreadStroke();
4869
- }
4870
4892
  this.__updateStrokeBounds();
4871
4893
  this.__updateLocalStrokeBounds();
4872
4894
  }
@@ -4874,7 +4896,7 @@ const LeafBounds = {
4874
4896
  layout.spreadStrokeCancel();
4875
4897
  }
4876
4898
  layout.strokeChanged = false;
4877
- if (layout.renderSpread)
4899
+ if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
4878
4900
  layout.renderChanged = true;
4879
4901
  if (this.parent)
4880
4902
  this.parent.__layout.strokeChange();
@@ -4883,9 +4905,8 @@ const LeafBounds = {
4883
4905
  if (layout.renderChanged) {
4884
4906
  layout.renderSpread = this.__updateRenderSpread();
4885
4907
  if (layout.renderSpread) {
4886
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) {
4908
+ if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
4887
4909
  layout.spreadRender();
4888
- }
4889
4910
  this.__updateRenderBounds();
4890
4911
  this.__updateLocalRenderBounds();
4891
4912
  }
@@ -4925,12 +4946,15 @@ const LeafBounds = {
4925
4946
  __updateAutoLayout() {
4926
4947
  this.__layout.matrixChanged = true;
4927
4948
  if (this.isBranch) {
4928
- if (this.leafer)
4949
+ if (this.leafer && this.leafer.ready)
4929
4950
  this.leafer.layouter.addExtra(this);
4930
- if (this.__.flow)
4931
- this.__updateFlowLayout();
4932
- if (hasParentAutoLayout(this)) {
4933
- updateMatrix$1(this);
4951
+ if (this.__.flow) {
4952
+ if (this.__layout.boxChanged)
4953
+ this.__updateFlowLayout();
4954
+ updateAllMatrix$2(this);
4955
+ updateBounds$1(this, this);
4956
+ if (this.__.__autoSide)
4957
+ this.__updateBoxBounds();
4934
4958
  }
4935
4959
  else {
4936
4960
  updateAllMatrix$2(this);
@@ -4947,12 +4971,13 @@ const LeafBounds = {
4947
4971
  data.__naturalHeight = layout.boxBounds.height;
4948
4972
  },
4949
4973
  __updateStrokeBounds() {
4950
- copyAndSpread$1(this.__layout.strokeBounds, this.__layout.boxBounds, this.__layout.strokeSpread);
4974
+ const layout = this.__layout;
4975
+ copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
4951
4976
  },
4952
4977
  __updateRenderBounds() {
4953
- const { renderSpread, strokeBounds, renderBounds } = this.__layout;
4954
- renderSpread > 0 ? copyAndSpread$1(renderBounds, strokeBounds, renderSpread) : copy$5(renderBounds, strokeBounds);
4955
- },
4978
+ const layout = this.__layout;
4979
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
4980
+ }
4956
4981
  };
4957
4982
 
4958
4983
  const LeafRender = {
@@ -5072,7 +5097,7 @@ let Leaf = class Leaf {
5072
5097
  get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
5073
5098
  get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
5074
5099
  get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
5075
- get pathInputed() { return !!this.__.__pathInputed; }
5100
+ get pathInputed() { return this.__.__pathInputed; }
5076
5101
  constructor(data) {
5077
5102
  this.innerId = create(LEAF);
5078
5103
  this.reset(data);
@@ -5684,6 +5709,9 @@ class LeafLevelList {
5684
5709
  }
5685
5710
  }
5686
5711
 
5712
+ const version = "1.0.0-rc.25";
5713
+ const inviteCode = {};
5714
+
5687
5715
  class LeaferCanvas extends LeaferCanvasBase {
5688
5716
  get allowBackgroundColor() { return false; }
5689
5717
  init() {
@@ -6344,7 +6372,7 @@ class Renderer {
6344
6372
  canvas.clear();
6345
6373
  }
6346
6374
  else {
6347
- bounds.spread(1 + 1 / this.canvas.pixelRatio).ceil();
6375
+ bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
6348
6376
  canvas.clearWorld(bounds, true);
6349
6377
  canvas.clipWorld(bounds, true);
6350
6378
  }
@@ -6761,10 +6789,11 @@ function stateType(defaultValue) {
6761
6789
  function arrowType(defaultValue) {
6762
6790
  return decorateLeafAttr(defaultValue, (key) => attr({
6763
6791
  set(value) {
6764
- this.__setAttr(key, value);
6765
- const data = this.__;
6766
- data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6767
- doStrokeType(this);
6792
+ if (this.__setAttr(key, value)) {
6793
+ const data = this.__;
6794
+ data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6795
+ doStrokeType(this);
6796
+ }
6768
6797
  }
6769
6798
  }));
6770
6799
  }
@@ -6937,7 +6966,7 @@ class UIData extends LeafData {
6937
6966
  const UnitConvert = {
6938
6967
  number(value, percentRefer) {
6939
6968
  if (typeof value === 'object')
6940
- return value.type === 'percent' ? (value.value > 49 ? value.value / 100 : value.value) * percentRefer : value.value;
6969
+ return value.type === 'percent' ? value.value * percentRefer : value.value;
6941
6970
  return value;
6942
6971
  }
6943
6972
  };
@@ -6946,7 +6975,7 @@ class GroupData extends UIData {
6946
6975
  }
6947
6976
 
6948
6977
  class BoxData extends GroupData {
6949
- get __boxStroke() { return true; }
6978
+ get __boxStroke() { return !this.__pathInputed; }
6950
6979
  }
6951
6980
 
6952
6981
  class LeaferData extends GroupData {
@@ -6959,11 +6988,11 @@ class LineData extends UIData {
6959
6988
  }
6960
6989
 
6961
6990
  class RectData extends UIData {
6962
- get __boxStroke() { return true; }
6991
+ get __boxStroke() { return !this.__pathInputed; }
6963
6992
  }
6964
6993
 
6965
6994
  class EllipseData extends UIData {
6966
- get __boxStroke() { return true; }
6995
+ get __boxStroke() { return !this.__pathInputed; }
6967
6996
  }
6968
6997
 
6969
6998
  class PolygonData extends UIData {
@@ -6990,6 +7019,7 @@ const fontWeightMap = {
6990
7019
  'black': 900
6991
7020
  };
6992
7021
  class TextData extends UIData {
7022
+ get __useNaturalRatio() { return false; }
6993
7023
  setFontWeight(value) {
6994
7024
  if (typeof value === 'string') {
6995
7025
  this.__setInput('fontWeight', value);
@@ -7031,19 +7061,18 @@ class CanvasData extends RectData {
7031
7061
  const UIBounds = {
7032
7062
  __updateStrokeSpread() {
7033
7063
  let width = 0, boxWidth = 0;
7034
- const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__;
7035
- if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
7064
+ const data = this.__, { strokeAlign, strokeWidth } = data;
7065
+ if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
7036
7066
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
7037
- if (!this.__.__boxStroke) {
7038
- const { miterLimit, strokeCap } = this.__;
7039
- const miterLimitAddWidth = this.__tag !== 'Line' ? 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) - width : 0;
7040
- const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
7067
+ if (!data.__boxStroke) {
7068
+ const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
7069
+ const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
7041
7070
  width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
7042
7071
  }
7043
7072
  }
7044
- this.__layout.strokeBoxSpread = boxWidth;
7045
- if (this.__.__useArrow)
7073
+ if (data.__useArrow)
7046
7074
  width += strokeWidth * 5;
7075
+ this.__layout.strokeBoxSpread = boxWidth;
7047
7076
  return width;
7048
7077
  },
7049
7078
  __updateRenderSpread() {
@@ -7063,7 +7092,7 @@ const UIBounds = {
7063
7092
  if (backgroundBlur)
7064
7093
  shapeWidth = Math.max(shapeWidth, backgroundBlur);
7065
7094
  this.__layout.renderShapeSpread = shapeWidth;
7066
- return width;
7095
+ return width + (this.__layout.strokeSpread || 0);
7067
7096
  }
7068
7097
  };
7069
7098
 
@@ -7154,7 +7183,7 @@ function drawFast(ui, canvas, options) {
7154
7183
 
7155
7184
  const RectRender = {
7156
7185
  __drawFast(canvas, options) {
7157
- const { width, height, fill, stroke, __drawAfterFill } = this.__;
7186
+ let { width, height, fill, stroke, __drawAfterFill } = this.__;
7158
7187
  if (fill) {
7159
7188
  canvas.fillStyle = fill;
7160
7189
  canvas.fillRect(0, 0, width, height);
@@ -7172,7 +7201,16 @@ const RectRender = {
7172
7201
  canvas.strokeRect(0, 0, width, height);
7173
7202
  break;
7174
7203
  case 'inside':
7175
- canvas.strokeRect(half, half, width - __strokeWidth, height - __strokeWidth);
7204
+ width -= __strokeWidth, height -= __strokeWidth;
7205
+ if (width < 0 || height < 0) {
7206
+ canvas.save();
7207
+ this.__clip(canvas, options);
7208
+ canvas.strokeRect(half, half, width, height);
7209
+ canvas.restore();
7210
+ }
7211
+ else {
7212
+ canvas.strokeRect(half, half, width, height);
7213
+ }
7176
7214
  break;
7177
7215
  case 'outside':
7178
7216
  canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
@@ -7200,11 +7238,14 @@ let UI = UI_1 = class UI extends Leaf {
7200
7238
  return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
7201
7239
  }
7202
7240
  get pen() {
7203
- pen.set(this.path = this.__.path || []);
7241
+ const { path } = this.__;
7242
+ pen.set(this.path = path || []);
7243
+ if (!path)
7244
+ this.__drawPathByBox(pen);
7204
7245
  return pen;
7205
7246
  }
7206
7247
  get editConfig() { return undefined; }
7207
- get editOuter() { return 'EditTool'; }
7248
+ get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
7208
7249
  get editInner() { return 'PathEditor'; }
7209
7250
  constructor(data) {
7210
7251
  super(data);
@@ -7224,18 +7265,16 @@ let UI = UI_1 = class UI extends Leaf {
7224
7265
  getPath(curve, pathForRender) {
7225
7266
  this.__layout.update();
7226
7267
  let path = pathForRender ? this.__.__pathForRender : this.__.path;
7227
- if (!path) {
7228
- const { width, height } = this.boxBounds;
7229
- if (width || height) {
7230
- pen.set(path = []);
7231
- this.__drawPathByBox(pen);
7232
- }
7233
- }
7268
+ if (!path)
7269
+ pen.set(path = []), this.__drawPathByBox(pen);
7234
7270
  return curve ? PathConvert.toCanvasData(path, true) : path;
7235
7271
  }
7236
7272
  getPathString(curve, pathForRender) {
7237
7273
  return PathConvert.stringify(this.getPath(curve, pathForRender));
7238
7274
  }
7275
+ load() {
7276
+ this.__.__computePaint();
7277
+ }
7239
7278
  __onUpdateSize() {
7240
7279
  if (this.__.__input) {
7241
7280
  const data = this.__;
@@ -7321,7 +7360,7 @@ __decorate([
7321
7360
  opacityType(1)
7322
7361
  ], UI.prototype, "opacity", void 0);
7323
7362
  __decorate([
7324
- opacityType(true)
7363
+ visibleType(true)
7325
7364
  ], UI.prototype, "visible", void 0);
7326
7365
  __decorate([
7327
7366
  stateType(false)
@@ -7338,9 +7377,6 @@ __decorate([
7338
7377
  __decorate([
7339
7378
  maskType(false)
7340
7379
  ], UI.prototype, "mask", void 0);
7341
- __decorate([
7342
- surfaceType('pixel')
7343
- ], UI.prototype, "maskType", void 0);
7344
7380
  __decorate([
7345
7381
  eraserType(false)
7346
7382
  ], UI.prototype, "eraser", void 0);
@@ -7415,10 +7451,10 @@ __decorate([
7415
7451
  ], UI.prototype, "gap", void 0);
7416
7452
  __decorate([
7417
7453
  boundsType('top-left')
7418
- ], UI.prototype, "align", void 0);
7454
+ ], UI.prototype, "flowAlign", void 0);
7419
7455
  __decorate([
7420
7456
  boundsType(false)
7421
- ], UI.prototype, "wrap", void 0);
7457
+ ], UI.prototype, "flowWrap", void 0);
7422
7458
  __decorate([
7423
7459
  boundsType('box')
7424
7460
  ], UI.prototype, "itemBox", void 0);
@@ -7633,6 +7669,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7633
7669
  get layoutLocked() { return !this.layouter.running; }
7634
7670
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7635
7671
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
7672
+ get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
7636
7673
  constructor(userConfig, data) {
7637
7674
  super(data);
7638
7675
  this.config = {
@@ -7790,7 +7827,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7790
7827
  this.__changeFill(newValue);
7791
7828
  }
7792
7829
  else if (attrName === 'hittable') {
7793
- this.canvas.hittable = newValue;
7830
+ if (!this.parent)
7831
+ this.canvas.hittable = newValue;
7794
7832
  }
7795
7833
  }
7796
7834
  return super.__setAttr(attrName, newValue);
@@ -7908,6 +7946,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7908
7946
  zoom(_zoomType, _padding, _fixedScale) { return undefined; }
7909
7947
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
7910
7948
  getValidScale(changeScale) { return changeScale; }
7949
+ getWorldPointByClient(clientPoint, updateClient) {
7950
+ return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
7951
+ }
7911
7952
  __checkUpdateLayout() {
7912
7953
  this.__layout.update();
7913
7954
  }
@@ -7990,8 +8031,8 @@ Rect = __decorate([
7990
8031
 
7991
8032
  const rect$1 = Rect.prototype;
7992
8033
  const group$1 = Group.prototype;
7993
- const bounds$1 = {};
7994
- const { copy: copy$3, add } = BoundsHelper;
8034
+ const childrenRenderBounds = {};
8035
+ const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
7995
8036
  let Box = class Box extends Group {
7996
8037
  get __tag() { return 'Box'; }
7997
8038
  get isBranchLeaf() { return true; }
@@ -8002,40 +8043,50 @@ let Box = class Box extends Group {
8002
8043
  __updateStrokeSpread() { return 0; }
8003
8044
  __updateRectRenderSpread() { return 0; }
8004
8045
  __updateRenderSpread() {
8005
- const width = this.__updateRectRenderSpread();
8006
- const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
8007
- return (width || hide) ? width : -1;
8046
+ return this.__updateRectRenderSpread() || -1;
8008
8047
  }
8009
8048
  __updateRectBoxBounds() { }
8010
8049
  __updateBoxBounds() {
8011
8050
  const data = this.__;
8012
- if (data.__autoSide && this.children.length) {
8013
- if (this.leafer)
8014
- this.leafer.layouter.addExtra(this);
8015
- super.__updateBoxBounds();
8016
- if (!data.__autoSize) {
8017
- const b = this.__layout.boxBounds;
8018
- if (!data.__autoWidth)
8019
- b.x = 0, b.width = data.width;
8020
- if (!data.__autoHeight)
8021
- b.y = 0, b.height = data.height;
8051
+ if (this.children.length) {
8052
+ if (data.__autoSide) {
8053
+ if (this.leafer && this.leafer.ready)
8054
+ this.leafer.layouter.addExtra(this);
8055
+ super.__updateBoxBounds();
8056
+ if (!data.__autoSize) {
8057
+ const b = this.__layout.boxBounds;
8058
+ if (!data.__autoWidth)
8059
+ b.x = 0, b.width = data.width;
8060
+ if (!data.__autoHeight)
8061
+ b.y = 0, b.height = data.height;
8062
+ }
8063
+ }
8064
+ else {
8065
+ this.__updateRectBoxBounds();
8022
8066
  }
8067
+ if (data.flow)
8068
+ this.__updateContentBounds();
8023
8069
  }
8024
8070
  else {
8025
8071
  this.__updateRectBoxBounds();
8026
8072
  }
8027
- if (data.flow)
8028
- this.__updateContentBounds();
8029
8073
  }
8030
8074
  __updateStrokeBounds() { }
8031
8075
  __updateRenderBounds() {
8032
- this.__updateRectRenderBounds();
8033
- if (!this.__.__drawAfterFill) {
8034
- const { renderBounds } = this.__layout;
8035
- copy$3(bounds$1, renderBounds);
8076
+ let isOverflow;
8077
+ const { renderBounds } = this.__layout;
8078
+ if (this.children.length) {
8036
8079
  super.__updateRenderBounds();
8037
- add(renderBounds, bounds$1);
8080
+ copy$3(childrenRenderBounds, renderBounds);
8081
+ this.__updateRectRenderBounds();
8082
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
8038
8083
  }
8084
+ else {
8085
+ this.__updateRectRenderBounds();
8086
+ }
8087
+ this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8088
+ if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
8089
+ add(renderBounds, childrenRenderBounds);
8039
8090
  }
8040
8091
  __updateRectRenderBounds() { }
8041
8092
  __updateRectChange() { }
@@ -8051,16 +8102,27 @@ let Box = class Box extends Group {
8051
8102
  }
8052
8103
  else {
8053
8104
  this.__renderRect(canvas, options);
8054
- this.__renderGroup(canvas, options);
8105
+ if (this.children.length)
8106
+ this.__renderGroup(canvas, options);
8055
8107
  }
8056
8108
  }
8057
8109
  __drawAfterFill(canvas, options) {
8058
- canvas.save();
8059
- canvas.clip();
8060
- this.__renderGroup(canvas, options);
8061
- canvas.restore();
8062
- if (this.__.stroke)
8110
+ const { length } = this.children;
8111
+ if (this.isOverflow) {
8112
+ canvas.save();
8113
+ canvas.clip();
8114
+ if (length)
8115
+ this.__renderGroup(canvas, options);
8116
+ canvas.restore();
8117
+ }
8118
+ else {
8119
+ if (length)
8120
+ this.__renderGroup(canvas, options);
8121
+ }
8122
+ if (this.__.stroke && length) {
8123
+ canvas.setWorld(this.__nowWorld);
8063
8124
  this.__drawRenderPath(canvas);
8125
+ }
8064
8126
  }
8065
8127
  };
8066
8128
  __decorate([
@@ -8198,9 +8260,10 @@ let Line = class Line extends UI {
8198
8260
  super(data);
8199
8261
  }
8200
8262
  __updatePath() {
8201
- const path = this.__.path = [];
8202
- if (this.__.points) {
8203
- drawPoints$1(path, this.__.points, this.__.closed);
8263
+ const data = this.__;
8264
+ const path = data.path = [];
8265
+ if (data.points) {
8266
+ drawPoints$1(path, data.points, false, data.closed);
8204
8267
  }
8205
8268
  else {
8206
8269
  moveTo$2(path, 0, 0);
@@ -8570,7 +8633,7 @@ __decorate([
8570
8633
  boundsType(0)
8571
8634
  ], Text.prototype, "letterSpacing", void 0);
8572
8635
  __decorate([
8573
- boundsType({ type: 'percent', value: 150 })
8636
+ boundsType({ type: 'percent', value: 1.5 })
8574
8637
  ], Text.prototype, "lineHeight", void 0);
8575
8638
  __decorate([
8576
8639
  boundsType(0)
@@ -8664,8 +8727,6 @@ function penPathType() {
8664
8727
  };
8665
8728
  }
8666
8729
 
8667
- const version = "1.0.0-rc.23";
8668
-
8669
8730
  let App = class App extends Leafer {
8670
8731
  get __tag() { return 'App'; }
8671
8732
  get isApp() { return true; }
@@ -9765,8 +9826,8 @@ class InteractionBase {
9765
9826
  }
9766
9827
  tap(data) {
9767
9828
  const { pointer } = this.config;
9768
- const longTap = this.longTap(data);
9769
- if (!pointer.tapMore && longTap)
9829
+ const hasLong = this.longTap(data);
9830
+ if (!pointer.tapMore && hasLong)
9770
9831
  return;
9771
9832
  if (!this.waitTap)
9772
9833
  return;
@@ -9888,6 +9949,10 @@ class InteractionBase {
9888
9949
  setCursor(cursor) {
9889
9950
  this.cursor = cursor;
9890
9951
  }
9952
+ getLocal(clientPoint, updateClient) {
9953
+ const clientBounds = this.canvas.getClientBounds(updateClient);
9954
+ return { x: clientPoint.clientX - clientBounds.x, y: clientPoint.clientY - clientBounds.y };
9955
+ }
9891
9956
  emitTap(data) {
9892
9957
  this.emit(PointerEvent.TAP, data);
9893
9958
  this.emit(PointerEvent.CLICK, data);
@@ -9917,14 +9982,14 @@ class InteractionBase {
9917
9982
  }, this.config.pointer.longPressTime);
9918
9983
  }
9919
9984
  longTap(data) {
9920
- let longTap;
9985
+ let hasLong;
9921
9986
  if (this.longPressed) {
9922
9987
  this.emit(PointerEvent.LONG_TAP, data);
9923
- if (pathHasEventType(data.path, PointerEvent.LONG_TAP))
9924
- longTap = true;
9988
+ if (pathHasEventType(data.path, PointerEvent.LONG_TAP) || pathHasEventType(data.path, PointerEvent.LONG_PRESS))
9989
+ hasLong = true;
9925
9990
  }
9926
9991
  this.longPressWaitCancel();
9927
- return longTap;
9992
+ return hasLong;
9928
9993
  }
9929
9994
  longPressWaitCancel() {
9930
9995
  clearTimeout(this.longPressTimer);
@@ -10190,15 +10255,12 @@ class Interaction extends InteractionBase {
10190
10255
  this.onTouchCancel();
10191
10256
  }
10192
10257
  }
10193
- getLocal(p, updateClient) {
10194
- if (updateClient)
10195
- this.canvas.updateClientBounds();
10196
- if (p.x !== undefined) {
10197
- return { x: p.x, y: p.y };
10258
+ getLocal(clientPoint, updateClient) {
10259
+ if (clientPoint.x !== undefined) {
10260
+ return { x: clientPoint.x, y: clientPoint.y };
10198
10261
  }
10199
10262
  else {
10200
- const { clientBounds } = this.canvas;
10201
- return { x: p.clientX - clientBounds.x, y: p.clientY - clientBounds.y };
10263
+ return super.getLocal(clientPoint, updateClient);
10202
10264
  }
10203
10265
  }
10204
10266
  getTouches(touches) {
@@ -10936,13 +10998,14 @@ const PaintImageModule = {
10936
10998
  recycleImage
10937
10999
  };
10938
11000
 
10939
- const defaultFrom$2 = { x: 0.5, y: 0 };
10940
- const defaultTo$2 = { x: 0.5, y: 1 };
11001
+ const { toPoint: toPoint$2 } = AroundHelper;
11002
+ const realFrom$2 = {};
11003
+ const realTo$2 = {};
10941
11004
  function linearGradient(paint, box) {
10942
11005
  let { from, to, type, blendMode, opacity } = paint;
10943
- from || (from = defaultFrom$2);
10944
- to || (to = defaultTo$2);
10945
- const style = Platform.canvas.createLinearGradient(box.x + from.x * box.width, box.y + from.y * box.height, box.x + to.x * box.width, box.y + to.y * box.height);
11006
+ toPoint$2(from || 'top', box, realFrom$2);
11007
+ toPoint$2(to || 'bottom', box, realTo$2);
11008
+ const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
10946
11009
  applyStops(style, paint.stops, opacity);
10947
11010
  const data = { type, style };
10948
11011
  if (blendMode)
@@ -10953,23 +11016,25 @@ function applyStops(gradient, stops, opacity) {
10953
11016
  let stop;
10954
11017
  for (let i = 0, len = stops.length; i < len; i++) {
10955
11018
  stop = stops[i];
10956
- gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
11019
+ if (typeof stop === 'string') {
11020
+ gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
11021
+ }
11022
+ else {
11023
+ gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
11024
+ }
10957
11025
  }
10958
11026
  }
10959
11027
 
10960
- const { set: set$1, getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
11028
+ const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
10961
11029
  const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
10962
- const defaultFrom$1 = { x: 0.5, y: 0.5 };
10963
- const defaultTo$1 = { x: 0.5, y: 1 };
11030
+ const { toPoint: toPoint$1 } = AroundHelper;
10964
11031
  const realFrom$1 = {};
10965
11032
  const realTo$1 = {};
10966
11033
  function radialGradient(paint, box) {
10967
11034
  let { from, to, type, opacity, blendMode, stretch } = paint;
10968
- from || (from = defaultFrom$1);
10969
- to || (to = defaultTo$1);
10970
- const { x, y, width, height } = box;
10971
- set$1(realFrom$1, x + from.x * width, y + from.y * height);
10972
- set$1(realTo$1, x + to.x * width, y + to.y * height);
11035
+ toPoint$1(from || 'center', box, realFrom$1);
11036
+ toPoint$1(to || 'bottom', box, realTo$1);
11037
+ const { width, height } = box;
10973
11038
  let transform;
10974
11039
  if (width !== height || stretch) {
10975
11040
  transform = get$1();
@@ -10984,19 +11049,16 @@ function radialGradient(paint, box) {
10984
11049
  return data;
10985
11050
  }
10986
11051
 
10987
- const { set, getAngle, getDistance } = PointHelper;
11052
+ const { getAngle, getDistance } = PointHelper;
10988
11053
  const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
10989
- const defaultFrom = { x: 0.5, y: 0.5 };
10990
- const defaultTo = { x: 0.5, y: 1 };
11054
+ const { toPoint } = AroundHelper;
10991
11055
  const realFrom = {};
10992
11056
  const realTo = {};
10993
11057
  function conicGradient(paint, box) {
10994
11058
  let { from, to, type, opacity, blendMode, stretch } = paint;
10995
- from || (from = defaultFrom);
10996
- to || (to = defaultTo);
10997
- const { x, y, width, height } = box;
10998
- set(realFrom, x + from.x * width, y + from.y * height);
10999
- set(realTo, x + to.x * width, y + to.y * height);
11059
+ toPoint(from || 'center', box, realFrom);
11060
+ toPoint(to || 'bottom', box, realTo);
11061
+ const { width, height } = box;
11000
11062
  const transform = get();
11001
11063
  const angle = getAngle(realFrom, realTo);
11002
11064
  if (Platform.conicGradientRotate90) {
@@ -11150,7 +11212,7 @@ Group.prototype.__renderMask = function (canvas, options) {
11150
11212
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
11151
11213
  maskCanvas = contentCanvas = null;
11152
11214
  }
11153
- if (child.__.maskType === 'path') {
11215
+ if (child.__.mask === 'path') {
11154
11216
  if (child.opacity < 1) {
11155
11217
  currentMask = 'opacity-path';
11156
11218
  maskOpacity = child.opacity;
@@ -11171,7 +11233,7 @@ Group.prototype.__renderMask = function (canvas, options) {
11171
11233
  contentCanvas = getCanvas(canvas);
11172
11234
  child.__render(maskCanvas, options);
11173
11235
  }
11174
- if (child.__.maskType !== 'clipping')
11236
+ if (child.__.mask !== 'clipping')
11175
11237
  continue;
11176
11238
  }
11177
11239
  if (excludeRenderBounds(child, options))
@@ -11472,11 +11534,11 @@ function layoutChar(drawData, style, width, _height) {
11472
11534
  if (mode === WordMode) {
11473
11535
  wordChar = { char: '', x: charX };
11474
11536
  charX = toWordChar(word.data, charX, wordChar);
11475
- if (wordChar.char !== ' ')
11537
+ if (row.isOverflow || wordChar.char !== ' ')
11476
11538
  row.data.push(wordChar);
11477
11539
  }
11478
11540
  else {
11479
- charX = toChar(word.data, charX, row.data);
11541
+ charX = toChar(word.data, charX, row.data, row.isOverflow);
11480
11542
  }
11481
11543
  if (!row.paraEnd && addWordWidth) {
11482
11544
  charX += addWordWidth;
@@ -11503,9 +11565,9 @@ function toWordChar(data, charX, wordChar) {
11503
11565
  });
11504
11566
  return charX;
11505
11567
  }
11506
- function toChar(data, charX, rowData) {
11568
+ function toChar(data, charX, rowData, isOverflow) {
11507
11569
  data.forEach(char => {
11508
- if (char.char !== ' ') {
11570
+ if (isOverflow || char.char !== ' ') {
11509
11571
  char.x = charX;
11510
11572
  rowData.push(char);
11511
11573
  }
@@ -11537,12 +11599,14 @@ function layoutText(drawData, style) {
11537
11599
  for (let i = 0, len = rows.length; i < len; i++) {
11538
11600
  row = rows[i];
11539
11601
  row.x = x;
11540
- switch (textAlign) {
11541
- case 'center':
11542
- row.x += (width - row.width) / 2;
11543
- break;
11544
- case 'right':
11545
- row.x += width - row.width;
11602
+ if (row.width < width || (row.width > width && !__clipText)) {
11603
+ switch (textAlign) {
11604
+ case 'center':
11605
+ row.x += (width - row.width) / 2;
11606
+ break;
11607
+ case 'right':
11608
+ row.x += width - row.width;
11609
+ }
11546
11610
  }
11547
11611
  if (row.paraStart && paraSpacing && i > 0)
11548
11612
  starY += paraSpacing;
@@ -11929,4 +11993,4 @@ LeaferCanvas.prototype.updateViewSize = function () {
11929
11993
  }
11930
11994
  };
11931
11995
 
11932
- export { AlignHelper, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, 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, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, zoomLayerType };
11996
+ export { AlignHelper, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, 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, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, inviteCode, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };