leafer-ui 1.0.0-rc.23 → 1.0.0-rc.24

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$9 = 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.24";
5713
+ const inviteCode = {};
5714
+
5687
5715
  const debug$7 = Debug.get('LeaferCanvas');
5688
5716
  class LeaferCanvas extends LeaferCanvasBase {
5689
5717
  init() {
@@ -6357,7 +6385,7 @@ class Renderer {
6357
6385
  canvas.clear();
6358
6386
  }
6359
6387
  else {
6360
- bounds.spread(1 + 1 / this.canvas.pixelRatio).ceil();
6388
+ bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
6361
6389
  canvas.clearWorld(bounds, true);
6362
6390
  canvas.clipWorld(bounds, true);
6363
6391
  }
@@ -6774,10 +6802,11 @@ function stateType(defaultValue) {
6774
6802
  function arrowType(defaultValue) {
6775
6803
  return decorateLeafAttr(defaultValue, (key) => attr({
6776
6804
  set(value) {
6777
- this.__setAttr(key, value);
6778
- const data = this.__;
6779
- data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6780
- doStrokeType(this);
6805
+ if (this.__setAttr(key, value)) {
6806
+ const data = this.__;
6807
+ data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6808
+ doStrokeType(this);
6809
+ }
6781
6810
  }
6782
6811
  }));
6783
6812
  }
@@ -6950,7 +6979,7 @@ class UIData extends LeafData {
6950
6979
  const UnitConvert = {
6951
6980
  number(value, percentRefer) {
6952
6981
  if (typeof value === 'object')
6953
- return value.type === 'percent' ? (value.value > 49 ? value.value / 100 : value.value) * percentRefer : value.value;
6982
+ return value.type === 'percent' ? value.value * percentRefer : value.value;
6954
6983
  return value;
6955
6984
  }
6956
6985
  };
@@ -6959,7 +6988,7 @@ class GroupData extends UIData {
6959
6988
  }
6960
6989
 
6961
6990
  class BoxData extends GroupData {
6962
- get __boxStroke() { return true; }
6991
+ get __boxStroke() { return !this.__pathInputed; }
6963
6992
  }
6964
6993
 
6965
6994
  class LeaferData extends GroupData {
@@ -6972,11 +7001,11 @@ class LineData extends UIData {
6972
7001
  }
6973
7002
 
6974
7003
  class RectData extends UIData {
6975
- get __boxStroke() { return true; }
7004
+ get __boxStroke() { return !this.__pathInputed; }
6976
7005
  }
6977
7006
 
6978
7007
  class EllipseData extends UIData {
6979
- get __boxStroke() { return true; }
7008
+ get __boxStroke() { return !this.__pathInputed; }
6980
7009
  }
6981
7010
 
6982
7011
  class PolygonData extends UIData {
@@ -7003,6 +7032,7 @@ const fontWeightMap = {
7003
7032
  'black': 900
7004
7033
  };
7005
7034
  class TextData extends UIData {
7035
+ get __useNaturalRatio() { return false; }
7006
7036
  setFontWeight(value) {
7007
7037
  if (typeof value === 'string') {
7008
7038
  this.__setInput('fontWeight', value);
@@ -7044,19 +7074,18 @@ class CanvasData extends RectData {
7044
7074
  const UIBounds = {
7045
7075
  __updateStrokeSpread() {
7046
7076
  let width = 0, boxWidth = 0;
7047
- const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__;
7048
- if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
7077
+ const data = this.__, { strokeAlign, strokeWidth } = data;
7078
+ if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
7049
7079
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
7050
- if (!this.__.__boxStroke) {
7051
- const { miterLimit, strokeCap } = this.__;
7052
- const miterLimitAddWidth = this.__tag !== 'Line' ? 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) - width : 0;
7053
- const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
7080
+ if (!data.__boxStroke) {
7081
+ const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
7082
+ const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
7054
7083
  width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
7055
7084
  }
7056
7085
  }
7057
- this.__layout.strokeBoxSpread = boxWidth;
7058
- if (this.__.__useArrow)
7086
+ if (data.__useArrow)
7059
7087
  width += strokeWidth * 5;
7088
+ this.__layout.strokeBoxSpread = boxWidth;
7060
7089
  return width;
7061
7090
  },
7062
7091
  __updateRenderSpread() {
@@ -7076,7 +7105,7 @@ const UIBounds = {
7076
7105
  if (backgroundBlur)
7077
7106
  shapeWidth = Math.max(shapeWidth, backgroundBlur);
7078
7107
  this.__layout.renderShapeSpread = shapeWidth;
7079
- return width;
7108
+ return width + (this.__layout.strokeSpread || 0);
7080
7109
  }
7081
7110
  };
7082
7111
 
@@ -7167,7 +7196,7 @@ function drawFast(ui, canvas, options) {
7167
7196
 
7168
7197
  const RectRender = {
7169
7198
  __drawFast(canvas, options) {
7170
- const { width, height, fill, stroke, __drawAfterFill } = this.__;
7199
+ let { width, height, fill, stroke, __drawAfterFill } = this.__;
7171
7200
  if (fill) {
7172
7201
  canvas.fillStyle = fill;
7173
7202
  canvas.fillRect(0, 0, width, height);
@@ -7185,7 +7214,16 @@ const RectRender = {
7185
7214
  canvas.strokeRect(0, 0, width, height);
7186
7215
  break;
7187
7216
  case 'inside':
7188
- canvas.strokeRect(half, half, width - __strokeWidth, height - __strokeWidth);
7217
+ width -= __strokeWidth, height -= __strokeWidth;
7218
+ if (width < 0 || height < 0) {
7219
+ canvas.save();
7220
+ this.__clip(canvas, options);
7221
+ canvas.strokeRect(half, half, width, height);
7222
+ canvas.restore();
7223
+ }
7224
+ else {
7225
+ canvas.strokeRect(half, half, width, height);
7226
+ }
7189
7227
  break;
7190
7228
  case 'outside':
7191
7229
  canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
@@ -7213,11 +7251,14 @@ let UI = UI_1 = class UI extends Leaf {
7213
7251
  return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
7214
7252
  }
7215
7253
  get pen() {
7216
- pen.set(this.path = this.__.path || []);
7254
+ const { path } = this.__;
7255
+ pen.set(this.path = path || []);
7256
+ if (!path)
7257
+ this.__drawPathByBox(pen);
7217
7258
  return pen;
7218
7259
  }
7219
7260
  get editConfig() { return undefined; }
7220
- get editOuter() { return 'EditTool'; }
7261
+ get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
7221
7262
  get editInner() { return 'PathEditor'; }
7222
7263
  constructor(data) {
7223
7264
  super(data);
@@ -7237,18 +7278,16 @@ let UI = UI_1 = class UI extends Leaf {
7237
7278
  getPath(curve, pathForRender) {
7238
7279
  this.__layout.update();
7239
7280
  let path = pathForRender ? this.__.__pathForRender : this.__.path;
7240
- if (!path) {
7241
- const { width, height } = this.boxBounds;
7242
- if (width || height) {
7243
- pen.set(path = []);
7244
- this.__drawPathByBox(pen);
7245
- }
7246
- }
7281
+ if (!path)
7282
+ pen.set(path = []), this.__drawPathByBox(pen);
7247
7283
  return curve ? PathConvert.toCanvasData(path, true) : path;
7248
7284
  }
7249
7285
  getPathString(curve, pathForRender) {
7250
7286
  return PathConvert.stringify(this.getPath(curve, pathForRender));
7251
7287
  }
7288
+ load() {
7289
+ this.__.__computePaint();
7290
+ }
7252
7291
  __onUpdateSize() {
7253
7292
  if (this.__.__input) {
7254
7293
  const data = this.__;
@@ -7334,7 +7373,7 @@ __decorate([
7334
7373
  opacityType(1)
7335
7374
  ], UI.prototype, "opacity", void 0);
7336
7375
  __decorate([
7337
- opacityType(true)
7376
+ visibleType(true)
7338
7377
  ], UI.prototype, "visible", void 0);
7339
7378
  __decorate([
7340
7379
  stateType(false)
@@ -7351,9 +7390,6 @@ __decorate([
7351
7390
  __decorate([
7352
7391
  maskType(false)
7353
7392
  ], UI.prototype, "mask", void 0);
7354
- __decorate([
7355
- surfaceType('pixel')
7356
- ], UI.prototype, "maskType", void 0);
7357
7393
  __decorate([
7358
7394
  eraserType(false)
7359
7395
  ], UI.prototype, "eraser", void 0);
@@ -7646,6 +7682,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7646
7682
  get layoutLocked() { return !this.layouter.running; }
7647
7683
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7648
7684
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
7685
+ get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
7649
7686
  constructor(userConfig, data) {
7650
7687
  super(data);
7651
7688
  this.config = {
@@ -7803,7 +7840,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7803
7840
  this.__changeFill(newValue);
7804
7841
  }
7805
7842
  else if (attrName === 'hittable') {
7806
- this.canvas.hittable = newValue;
7843
+ if (!this.parent)
7844
+ this.canvas.hittable = newValue;
7807
7845
  }
7808
7846
  }
7809
7847
  return super.__setAttr(attrName, newValue);
@@ -7921,6 +7959,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7921
7959
  zoom(_zoomType, _padding, _fixedScale) { return undefined; }
7922
7960
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
7923
7961
  getValidScale(changeScale) { return changeScale; }
7962
+ getWorldPointByClient(clientPoint, updateClient) {
7963
+ return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
7964
+ }
7924
7965
  __checkUpdateLayout() {
7925
7966
  this.__layout.update();
7926
7967
  }
@@ -8003,8 +8044,8 @@ Rect = __decorate([
8003
8044
 
8004
8045
  const rect$1 = Rect.prototype;
8005
8046
  const group$1 = Group.prototype;
8006
- const bounds$1 = {};
8007
- const { copy: copy$3, add } = BoundsHelper;
8047
+ const childrenRenderBounds = {};
8048
+ const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
8008
8049
  let Box = class Box extends Group {
8009
8050
  get __tag() { return 'Box'; }
8010
8051
  get isBranchLeaf() { return true; }
@@ -8015,40 +8056,50 @@ let Box = class Box extends Group {
8015
8056
  __updateStrokeSpread() { return 0; }
8016
8057
  __updateRectRenderSpread() { return 0; }
8017
8058
  __updateRenderSpread() {
8018
- const width = this.__updateRectRenderSpread();
8019
- const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
8020
- return (width || hide) ? width : -1;
8059
+ return this.__updateRectRenderSpread() || -1;
8021
8060
  }
8022
8061
  __updateRectBoxBounds() { }
8023
8062
  __updateBoxBounds() {
8024
8063
  const data = this.__;
8025
- if (data.__autoSide && this.children.length) {
8026
- if (this.leafer)
8027
- this.leafer.layouter.addExtra(this);
8028
- super.__updateBoxBounds();
8029
- if (!data.__autoSize) {
8030
- const b = this.__layout.boxBounds;
8031
- if (!data.__autoWidth)
8032
- b.x = 0, b.width = data.width;
8033
- if (!data.__autoHeight)
8034
- b.y = 0, b.height = data.height;
8064
+ if (this.children.length) {
8065
+ if (data.__autoSide) {
8066
+ if (this.leafer && this.leafer.ready)
8067
+ this.leafer.layouter.addExtra(this);
8068
+ super.__updateBoxBounds();
8069
+ if (!data.__autoSize) {
8070
+ const b = this.__layout.boxBounds;
8071
+ if (!data.__autoWidth)
8072
+ b.x = 0, b.width = data.width;
8073
+ if (!data.__autoHeight)
8074
+ b.y = 0, b.height = data.height;
8075
+ }
8076
+ }
8077
+ else {
8078
+ this.__updateRectBoxBounds();
8035
8079
  }
8080
+ if (data.flow)
8081
+ this.__updateContentBounds();
8036
8082
  }
8037
8083
  else {
8038
8084
  this.__updateRectBoxBounds();
8039
8085
  }
8040
- if (data.flow)
8041
- this.__updateContentBounds();
8042
8086
  }
8043
8087
  __updateStrokeBounds() { }
8044
8088
  __updateRenderBounds() {
8045
- this.__updateRectRenderBounds();
8046
- if (!this.__.__drawAfterFill) {
8047
- const { renderBounds } = this.__layout;
8048
- copy$3(bounds$1, renderBounds);
8089
+ let isOverflow;
8090
+ const { renderBounds } = this.__layout;
8091
+ if (this.children.length) {
8049
8092
  super.__updateRenderBounds();
8050
- add(renderBounds, bounds$1);
8093
+ copy$3(childrenRenderBounds, renderBounds);
8094
+ this.__updateRectRenderBounds();
8095
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
8096
+ }
8097
+ else {
8098
+ this.__updateRectRenderBounds();
8051
8099
  }
8100
+ this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8101
+ if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
8102
+ add(renderBounds, childrenRenderBounds);
8052
8103
  }
8053
8104
  __updateRectRenderBounds() { }
8054
8105
  __updateRectChange() { }
@@ -8064,16 +8115,27 @@ let Box = class Box extends Group {
8064
8115
  }
8065
8116
  else {
8066
8117
  this.__renderRect(canvas, options);
8067
- this.__renderGroup(canvas, options);
8118
+ if (this.children.length)
8119
+ this.__renderGroup(canvas, options);
8068
8120
  }
8069
8121
  }
8070
8122
  __drawAfterFill(canvas, options) {
8071
- canvas.save();
8072
- canvas.clip();
8073
- this.__renderGroup(canvas, options);
8074
- canvas.restore();
8075
- if (this.__.stroke)
8123
+ const { length } = this.children;
8124
+ if (this.isOverflow) {
8125
+ canvas.save();
8126
+ canvas.clip();
8127
+ if (length)
8128
+ this.__renderGroup(canvas, options);
8129
+ canvas.restore();
8130
+ }
8131
+ else {
8132
+ if (length)
8133
+ this.__renderGroup(canvas, options);
8134
+ }
8135
+ if (this.__.stroke && length) {
8136
+ canvas.setWorld(this.__nowWorld);
8076
8137
  this.__drawRenderPath(canvas);
8138
+ }
8077
8139
  }
8078
8140
  };
8079
8141
  __decorate([
@@ -8211,9 +8273,10 @@ let Line = class Line extends UI {
8211
8273
  super(data);
8212
8274
  }
8213
8275
  __updatePath() {
8214
- const path = this.__.path = [];
8215
- if (this.__.points) {
8216
- drawPoints$1(path, this.__.points, this.__.closed);
8276
+ const data = this.__;
8277
+ const path = data.path = [];
8278
+ if (data.points) {
8279
+ drawPoints$1(path, data.points, false, data.closed);
8217
8280
  }
8218
8281
  else {
8219
8282
  moveTo$2(path, 0, 0);
@@ -8583,7 +8646,7 @@ __decorate([
8583
8646
  boundsType(0)
8584
8647
  ], Text.prototype, "letterSpacing", void 0);
8585
8648
  __decorate([
8586
- boundsType({ type: 'percent', value: 150 })
8649
+ boundsType({ type: 'percent', value: 1.5 })
8587
8650
  ], Text.prototype, "lineHeight", void 0);
8588
8651
  __decorate([
8589
8652
  boundsType(0)
@@ -8677,8 +8740,6 @@ function penPathType() {
8677
8740
  };
8678
8741
  }
8679
8742
 
8680
- const version = "1.0.0-rc.23";
8681
-
8682
8743
  let App = class App extends Leafer {
8683
8744
  get __tag() { return 'App'; }
8684
8745
  get isApp() { return true; }
@@ -9778,8 +9839,8 @@ class InteractionBase {
9778
9839
  }
9779
9840
  tap(data) {
9780
9841
  const { pointer } = this.config;
9781
- const longTap = this.longTap(data);
9782
- if (!pointer.tapMore && longTap)
9842
+ const hasLong = this.longTap(data);
9843
+ if (!pointer.tapMore && hasLong)
9783
9844
  return;
9784
9845
  if (!this.waitTap)
9785
9846
  return;
@@ -9901,6 +9962,10 @@ class InteractionBase {
9901
9962
  setCursor(cursor) {
9902
9963
  this.cursor = cursor;
9903
9964
  }
9965
+ getLocal(clientPoint, updateClient) {
9966
+ const clientBounds = this.canvas.getClientBounds(updateClient);
9967
+ return { x: clientPoint.clientX - clientBounds.x, y: clientPoint.clientY - clientBounds.y };
9968
+ }
9904
9969
  emitTap(data) {
9905
9970
  this.emit(PointerEvent.TAP, data);
9906
9971
  this.emit(PointerEvent.CLICK, data);
@@ -9930,14 +9995,14 @@ class InteractionBase {
9930
9995
  }, this.config.pointer.longPressTime);
9931
9996
  }
9932
9997
  longTap(data) {
9933
- let longTap;
9998
+ let hasLong;
9934
9999
  if (this.longPressed) {
9935
10000
  this.emit(PointerEvent.LONG_TAP, data);
9936
- if (pathHasEventType(data.path, PointerEvent.LONG_TAP))
9937
- longTap = true;
10001
+ if (pathHasEventType(data.path, PointerEvent.LONG_TAP) || pathHasEventType(data.path, PointerEvent.LONG_PRESS))
10002
+ hasLong = true;
9938
10003
  }
9939
10004
  this.longPressWaitCancel();
9940
- return longTap;
10005
+ return hasLong;
9941
10006
  }
9942
10007
  longPressWaitCancel() {
9943
10008
  clearTimeout(this.longPressTimer);
@@ -10295,12 +10360,6 @@ class Interaction extends InteractionBase {
10295
10360
  this.windowEvents = {};
10296
10361
  }
10297
10362
  }
10298
- getLocal(p, updateClient) {
10299
- if (updateClient)
10300
- this.canvas.updateClientBounds();
10301
- const { clientBounds } = this.canvas;
10302
- return { x: p.clientX - clientBounds.x, y: p.clientY - clientBounds.y };
10303
- }
10304
10363
  getTouches(touches) {
10305
10364
  const list = [];
10306
10365
  for (let i = 0, len = touches.length; i < len; i++) {
@@ -11188,13 +11247,14 @@ const PaintImageModule = {
11188
11247
  recycleImage
11189
11248
  };
11190
11249
 
11191
- const defaultFrom$2 = { x: 0.5, y: 0 };
11192
- const defaultTo$2 = { x: 0.5, y: 1 };
11250
+ const { toPoint: toPoint$2 } = AroundHelper;
11251
+ const realFrom$2 = {};
11252
+ const realTo$2 = {};
11193
11253
  function linearGradient(paint, box) {
11194
11254
  let { from, to, type, blendMode, opacity } = paint;
11195
- from || (from = defaultFrom$2);
11196
- to || (to = defaultTo$2);
11197
- 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);
11255
+ toPoint$2(from || 'top', box, realFrom$2);
11256
+ toPoint$2(to || 'bottom', box, realTo$2);
11257
+ const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
11198
11258
  applyStops(style, paint.stops, opacity);
11199
11259
  const data = { type, style };
11200
11260
  if (blendMode)
@@ -11205,23 +11265,25 @@ function applyStops(gradient, stops, opacity) {
11205
11265
  let stop;
11206
11266
  for (let i = 0, len = stops.length; i < len; i++) {
11207
11267
  stop = stops[i];
11208
- gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
11268
+ if (typeof stop === 'string') {
11269
+ gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
11270
+ }
11271
+ else {
11272
+ gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
11273
+ }
11209
11274
  }
11210
11275
  }
11211
11276
 
11212
- const { set: set$1, getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
11277
+ const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
11213
11278
  const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
11214
- const defaultFrom$1 = { x: 0.5, y: 0.5 };
11215
- const defaultTo$1 = { x: 0.5, y: 1 };
11279
+ const { toPoint: toPoint$1 } = AroundHelper;
11216
11280
  const realFrom$1 = {};
11217
11281
  const realTo$1 = {};
11218
11282
  function radialGradient(paint, box) {
11219
11283
  let { from, to, type, opacity, blendMode, stretch } = paint;
11220
- from || (from = defaultFrom$1);
11221
- to || (to = defaultTo$1);
11222
- const { x, y, width, height } = box;
11223
- set$1(realFrom$1, x + from.x * width, y + from.y * height);
11224
- set$1(realTo$1, x + to.x * width, y + to.y * height);
11284
+ toPoint$1(from || 'center', box, realFrom$1);
11285
+ toPoint$1(to || 'bottom', box, realTo$1);
11286
+ const { width, height } = box;
11225
11287
  let transform;
11226
11288
  if (width !== height || stretch) {
11227
11289
  transform = get$1();
@@ -11236,19 +11298,16 @@ function radialGradient(paint, box) {
11236
11298
  return data;
11237
11299
  }
11238
11300
 
11239
- const { set, getAngle, getDistance } = PointHelper;
11301
+ const { getAngle, getDistance } = PointHelper;
11240
11302
  const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
11241
- const defaultFrom = { x: 0.5, y: 0.5 };
11242
- const defaultTo = { x: 0.5, y: 1 };
11303
+ const { toPoint } = AroundHelper;
11243
11304
  const realFrom = {};
11244
11305
  const realTo = {};
11245
11306
  function conicGradient(paint, box) {
11246
11307
  let { from, to, type, opacity, blendMode, stretch } = paint;
11247
- from || (from = defaultFrom);
11248
- to || (to = defaultTo);
11249
- const { x, y, width, height } = box;
11250
- set(realFrom, x + from.x * width, y + from.y * height);
11251
- set(realTo, x + to.x * width, y + to.y * height);
11308
+ toPoint(from || 'center', box, realFrom);
11309
+ toPoint(to || 'bottom', box, realTo);
11310
+ const { width, height } = box;
11252
11311
  const transform = get();
11253
11312
  const angle = getAngle(realFrom, realTo);
11254
11313
  if (Platform.conicGradientRotate90) {
@@ -11402,7 +11461,7 @@ Group.prototype.__renderMask = function (canvas, options) {
11402
11461
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
11403
11462
  maskCanvas = contentCanvas = null;
11404
11463
  }
11405
- if (child.__.maskType === 'path') {
11464
+ if (child.__.mask === 'path') {
11406
11465
  if (child.opacity < 1) {
11407
11466
  currentMask = 'opacity-path';
11408
11467
  maskOpacity = child.opacity;
@@ -11423,7 +11482,7 @@ Group.prototype.__renderMask = function (canvas, options) {
11423
11482
  contentCanvas = getCanvas(canvas);
11424
11483
  child.__render(maskCanvas, options);
11425
11484
  }
11426
- if (child.__.maskType !== 'clipping')
11485
+ if (child.__.mask !== 'clipping')
11427
11486
  continue;
11428
11487
  }
11429
11488
  if (excludeRenderBounds(child, options))
@@ -11724,11 +11783,11 @@ function layoutChar(drawData, style, width, _height) {
11724
11783
  if (mode === WordMode) {
11725
11784
  wordChar = { char: '', x: charX };
11726
11785
  charX = toWordChar(word.data, charX, wordChar);
11727
- if (wordChar.char !== ' ')
11786
+ if (row.isOverflow || wordChar.char !== ' ')
11728
11787
  row.data.push(wordChar);
11729
11788
  }
11730
11789
  else {
11731
- charX = toChar(word.data, charX, row.data);
11790
+ charX = toChar(word.data, charX, row.data, row.isOverflow);
11732
11791
  }
11733
11792
  if (!row.paraEnd && addWordWidth) {
11734
11793
  charX += addWordWidth;
@@ -11755,9 +11814,9 @@ function toWordChar(data, charX, wordChar) {
11755
11814
  });
11756
11815
  return charX;
11757
11816
  }
11758
- function toChar(data, charX, rowData) {
11817
+ function toChar(data, charX, rowData, isOverflow) {
11759
11818
  data.forEach(char => {
11760
- if (char.char !== ' ') {
11819
+ if (isOverflow || char.char !== ' ') {
11761
11820
  char.x = charX;
11762
11821
  rowData.push(char);
11763
11822
  }
@@ -11789,12 +11848,14 @@ function layoutText(drawData, style) {
11789
11848
  for (let i = 0, len = rows.length; i < len; i++) {
11790
11849
  row = rows[i];
11791
11850
  row.x = x;
11792
- switch (textAlign) {
11793
- case 'center':
11794
- row.x += (width - row.width) / 2;
11795
- break;
11796
- case 'right':
11797
- row.x += width - row.width;
11851
+ if (row.width < width || (row.width > width && !__clipText)) {
11852
+ switch (textAlign) {
11853
+ case 'center':
11854
+ row.x += (width - row.width) / 2;
11855
+ break;
11856
+ case 'right':
11857
+ row.x += width - row.width;
11858
+ }
11798
11859
  }
11799
11860
  if (row.paraStart && paraSpacing && i > 0)
11800
11861
  starY += paraSpacing;
@@ -12154,4 +12215,4 @@ window.addEventListener('unload', () => {
12154
12215
  ImageManager.destroy();
12155
12216
  });
12156
12217
 
12157
- 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$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, 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 };
12218
+ 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$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, 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 };