@leafer-draw/worker 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.
package/dist/worker.js CHANGED
@@ -753,7 +753,7 @@ var LeaferUI = (function (exports) {
753
753
  const { floor, ceil: ceil$2 } = Math;
754
754
  let right$1, bottom$1, boundsRight, boundsBottom;
755
755
  const point = {};
756
- const toPoint$2 = {};
756
+ const toPoint$5 = {};
757
757
  const BoundsHelper = {
758
758
  tempBounds: {},
759
759
  set(t, x = 0, y = 0, width = 0, height = 0) {
@@ -855,17 +855,17 @@ var LeaferUI = (function (exports) {
855
855
  else {
856
856
  point.x = t.x;
857
857
  point.y = t.y;
858
- toOuterPoint$1(matrix, point, toPoint$2);
859
- setPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
858
+ toOuterPoint$1(matrix, point, toPoint$5);
859
+ setPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
860
860
  point.x = t.x + t.width;
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.y = t.y + t.height;
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
  point.x = t.x;
867
- toOuterPoint$1(matrix, point, toPoint$2);
868
- addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
867
+ toOuterPoint$1(matrix, point, toPoint$5);
868
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
869
869
  toBounds$4(tempPointBounds$1, to);
870
870
  }
871
871
  },
@@ -1238,10 +1238,10 @@ var LeaferUI = (function (exports) {
1238
1238
  return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
1239
1239
  }
1240
1240
 
1241
- const { toPoint: toPoint$1 } = AroundHelper;
1241
+ const { toPoint: toPoint$4 } = AroundHelper;
1242
1242
  const AlignHelper = {
1243
1243
  toPoint(align, contentBounds, bounds, to, onlySize) {
1244
- toPoint$1(align, bounds, to, onlySize, contentBounds);
1244
+ toPoint$4(align, bounds, to, onlySize, contentBounds);
1245
1245
  }
1246
1246
  };
1247
1247
 
@@ -1488,6 +1488,8 @@ var LeaferUI = (function (exports) {
1488
1488
  const { assign } = DataHelper;
1489
1489
 
1490
1490
  class LeafData {
1491
+ get __useNaturalRatio() { return true; }
1492
+ get __isLinePath() { return this.path && this.path.length === 6; }
1491
1493
  get __blendMode() {
1492
1494
  if (this.eraser && this.eraser !== 'path')
1493
1495
  return 'destination-out';
@@ -1985,6 +1987,11 @@ var LeaferUI = (function (exports) {
1985
1987
  }
1986
1988
  updateViewSize() { }
1987
1989
  updateClientBounds() { }
1990
+ getClientBounds(update) {
1991
+ if (update)
1992
+ this.updateClientBounds();
1993
+ return this.clientBounds || this.bounds;
1994
+ }
1988
1995
  startAutoLayout(_autoBounds, _listener) { }
1989
1996
  stopAutoLayout() { }
1990
1997
  setCursor(_cursor) { }
@@ -2236,7 +2243,7 @@ var LeaferUI = (function (exports) {
2236
2243
 
2237
2244
  const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2238
2245
  const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
2239
- const { set: set$2 } = PointHelper;
2246
+ const { set } = PointHelper;
2240
2247
  const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
2241
2248
  const tempPoint$2 = {};
2242
2249
  const BezierHelper = {
@@ -2314,9 +2321,9 @@ var LeaferUI = (function (exports) {
2314
2321
  addPoint$2(setPointBounds, x1, y1);
2315
2322
  }
2316
2323
  if (setStartPoint)
2317
- set$2(setStartPoint, fromX, fromY);
2324
+ set(setStartPoint, fromX, fromY);
2318
2325
  if (setEndPoint)
2319
- set$2(setEndPoint, x1, y1);
2326
+ set(setEndPoint, x1, y1);
2320
2327
  return;
2321
2328
  }
2322
2329
  const anticlockwise = BAx * CBy - CBx * BAy < 0;
@@ -2365,7 +2372,7 @@ var LeaferUI = (function (exports) {
2365
2372
  if (setPointBounds)
2366
2373
  setPoint$2(setPointBounds, fromX, fromY);
2367
2374
  if (setStartPoint)
2368
- set$2(setStartPoint, fromX, fromY);
2375
+ set(setStartPoint, fromX, fromY);
2369
2376
  for (let i = 0; i < parts; i++) {
2370
2377
  endCos = cos$3(endRadian);
2371
2378
  endSin = sin$3(endRadian);
@@ -2387,7 +2394,7 @@ var LeaferUI = (function (exports) {
2387
2394
  endRadian += partRadian;
2388
2395
  }
2389
2396
  if (setEndPoint)
2390
- set$2(setEndPoint, cx + x, cy + y);
2397
+ set(setEndPoint, cx + x, cy + y);
2391
2398
  },
2392
2399
  quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
2393
2400
  data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
@@ -2533,11 +2540,15 @@ var LeaferUI = (function (exports) {
2533
2540
  char = pathString[i];
2534
2541
  if (StringNumberMap[char]) {
2535
2542
  if (char === '.') {
2536
- current.dot++;
2537
- if (current.dot > 1) {
2543
+ if (current.dot) {
2538
2544
  pushData(data, num);
2539
2545
  num = '';
2540
2546
  }
2547
+ current.dot++;
2548
+ }
2549
+ if (num === '0' && char !== '.') {
2550
+ pushData(data, num);
2551
+ num = '';
2541
2552
  }
2542
2553
  num += char;
2543
2554
  }
@@ -3627,7 +3638,9 @@ var LeaferUI = (function (exports) {
3627
3638
  }
3628
3639
  }
3629
3640
 
3630
- function defineKey(target, key, descriptor) {
3641
+ function defineKey(target, key, descriptor, noConfigurable) {
3642
+ if (!noConfigurable)
3643
+ descriptor.configurable = descriptor.enumerable = true;
3631
3644
  Object.defineProperty(target, key, descriptor);
3632
3645
  }
3633
3646
  function getDescriptor(object, name) {
@@ -3646,9 +3659,7 @@ var LeaferUI = (function (exports) {
3646
3659
  function defineLeafAttr(target, key, defaultValue, partDescriptor) {
3647
3660
  const defaultDescriptor = {
3648
3661
  get() { return this.__getAttr(key); },
3649
- set(value) { this.__setAttr(key, value); },
3650
- configurable: true,
3651
- enumerable: true
3662
+ set(value) { this.__setAttr(key, value); }
3652
3663
  };
3653
3664
  defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
3654
3665
  defineDataProcessor(target, key, defaultValue);
@@ -3659,35 +3670,33 @@ var LeaferUI = (function (exports) {
3659
3670
  function positionType(defaultValue, checkFiniteNumber) {
3660
3671
  return decorateLeafAttr(defaultValue, (key) => attr({
3661
3672
  set(value) {
3662
- this.__setAttr(key, value, checkFiniteNumber);
3663
- this.__layout.matrixChanged || this.__layout.matrixChange();
3673
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.matrixChanged || this.__layout.matrixChange());
3664
3674
  }
3665
3675
  }));
3666
3676
  }
3667
3677
  function autoLayoutType(defaultValue) {
3668
3678
  return decorateLeafAttr(defaultValue, (key) => attr({
3669
3679
  set(value) {
3670
- this.__setAttr(key, value);
3671
- this.__layout.matrixChanged || this.__layout.matrixChange();
3672
- this.__hasAutoLayout = !!value;
3673
- if (!this.__local)
3674
- this.__layout.createLocal();
3680
+ if (this.__setAttr(key, value)) {
3681
+ this.__layout.matrixChanged || this.__layout.matrixChange();
3682
+ this.__hasAutoLayout = !!value;
3683
+ if (!this.__local)
3684
+ this.__layout.createLocal();
3685
+ }
3675
3686
  }
3676
3687
  }));
3677
3688
  }
3678
3689
  function scaleType(defaultValue, checkFiniteNumber) {
3679
3690
  return decorateLeafAttr(defaultValue, (key) => attr({
3680
3691
  set(value) {
3681
- this.__setAttr(key, value, checkFiniteNumber);
3682
- this.__layout.scaleChanged || this.__layout.scaleChange();
3692
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.scaleChanged || this.__layout.scaleChange());
3683
3693
  }
3684
3694
  }));
3685
3695
  }
3686
3696
  function rotationType(defaultValue, checkFiniteNumber) {
3687
3697
  return decorateLeafAttr(defaultValue, (key) => attr({
3688
3698
  set(value) {
3689
- this.__setAttr(key, value, checkFiniteNumber);
3690
- this.__layout.rotationChanged || this.__layout.rotationChange();
3699
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.rotationChanged || this.__layout.rotationChange());
3691
3700
  }
3692
3701
  }));
3693
3702
  }
@@ -3701,9 +3710,7 @@ var LeaferUI = (function (exports) {
3701
3710
  function naturalBoundsType(defaultValue) {
3702
3711
  return decorateLeafAttr(defaultValue, (key) => attr({
3703
3712
  set(value) {
3704
- this.__setAttr(key, value);
3705
- doBoundsType(this);
3706
- this.__.__removeNaturalSize();
3713
+ this.__setAttr(key, value) && (doBoundsType(this), this.__.__removeNaturalSize());
3707
3714
  }
3708
3715
  }));
3709
3716
  }
@@ -3715,8 +3722,11 @@ var LeaferUI = (function (exports) {
3715
3722
  function pathInputType(defaultValue) {
3716
3723
  return decorateLeafAttr(defaultValue, (key) => attr({
3717
3724
  set(value) {
3718
- if (this.__.__pathInputed !== 2)
3719
- this.__.__pathInputed = value ? 1 : 0;
3725
+ const data = this.__;
3726
+ if (data.__pathInputed !== 2)
3727
+ data.__pathInputed = value ? 1 : 0;
3728
+ if (!value)
3729
+ data.__pathForRender = undefined;
3720
3730
  this.__setAttr(key, value);
3721
3731
  doBoundsType(this);
3722
3732
  }
@@ -3747,56 +3757,66 @@ var LeaferUI = (function (exports) {
3747
3757
  function surfaceType(defaultValue) {
3748
3758
  return decorateLeafAttr(defaultValue, (key) => attr({
3749
3759
  set(value) {
3750
- this.__setAttr(key, value);
3751
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3760
+ this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
3752
3761
  }
3753
3762
  }));
3754
3763
  }
3755
3764
  function opacityType(defaultValue) {
3756
3765
  return decorateLeafAttr(defaultValue, (key) => attr({
3757
3766
  set(value) {
3758
- this.__setAttr(key, value);
3759
- this.__layout.opacityChanged || this.__layout.opacityChange();
3767
+ this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
3768
+ }
3769
+ }));
3770
+ }
3771
+ function visibleType(defaultValue) {
3772
+ return decorateLeafAttr(defaultValue, (key) => attr({
3773
+ set(value) {
3774
+ const oldValue = this.visible;
3775
+ if (this.__setAttr(key, value)) {
3776
+ this.__layout.opacityChanged || this.__layout.opacityChange();
3777
+ if (oldValue === 0 || value === 0)
3778
+ doBoundsType(this);
3779
+ }
3760
3780
  }
3761
3781
  }));
3762
3782
  }
3763
3783
  function sortType(defaultValue) {
3764
3784
  return decorateLeafAttr(defaultValue, (key) => attr({
3765
3785
  set(value) {
3766
- this.__setAttr(key, value);
3767
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3768
- this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
3786
+ if (this.__setAttr(key, value)) {
3787
+ this.__layout.surfaceChanged || this.__layout.surfaceChange();
3788
+ this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
3789
+ }
3769
3790
  }
3770
3791
  }));
3771
3792
  }
3772
3793
  function maskType(defaultValue) {
3773
3794
  return decorateLeafAttr(defaultValue, (key) => attr({
3774
3795
  set(value) {
3775
- this.__setAttr(key, value);
3776
- this.__layout.boxChanged || this.__layout.boxChange();
3777
- this.waitParent(() => { this.parent.__updateMask(value); });
3778
- if (typeof value === 'string')
3779
- this.maskType = value;
3796
+ if (this.__setAttr(key, value)) {
3797
+ this.__layout.boxChanged || this.__layout.boxChange();
3798
+ this.waitParent(() => { this.parent.__updateMask(value); });
3799
+ }
3780
3800
  }
3781
3801
  }));
3782
3802
  }
3783
3803
  function eraserType(defaultValue) {
3784
3804
  return decorateLeafAttr(defaultValue, (key) => attr({
3785
3805
  set(value) {
3786
- this.__setAttr(key, value);
3787
- this.waitParent(() => { this.parent.__updateEraser(value); });
3806
+ this.__setAttr(key, value) && this.waitParent(() => { this.parent.__updateEraser(value); });
3788
3807
  }
3789
3808
  }));
3790
3809
  }
3791
3810
  function hitType(defaultValue) {
3792
3811
  return decorateLeafAttr(defaultValue, (key) => attr({
3793
3812
  set(value) {
3794
- this.__setAttr(key, value);
3795
- if (Debug.showHitView) {
3796
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3813
+ if (this.__setAttr(key, value)) {
3814
+ if (Debug.showHitView) {
3815
+ this.__layout.surfaceChanged || this.__layout.surfaceChange();
3816
+ }
3817
+ if (this.leafer)
3818
+ this.leafer.updateCursor();
3797
3819
  }
3798
- if (this.leafer)
3799
- this.leafer.updateCursor();
3800
3820
  }
3801
3821
  }));
3802
3822
  }
@@ -3837,9 +3857,7 @@ var LeaferUI = (function (exports) {
3837
3857
  },
3838
3858
  set(value) {
3839
3859
  this[computedKey] = value;
3840
- },
3841
- configurable: true,
3842
- enumerable: true
3860
+ }
3843
3861
  };
3844
3862
  if (defaultValue === undefined) {
3845
3863
  property.get = function () { return this[computedKey]; };
@@ -3847,13 +3865,25 @@ var LeaferUI = (function (exports) {
3847
3865
  else if (key === 'width') {
3848
3866
  property.get = function () {
3849
3867
  const v = this[computedKey];
3850
- return v === undefined ? (this.__naturalWidth || defaultValue) : v;
3868
+ if (v === undefined) {
3869
+ const t = this;
3870
+ return t._height && t.__naturalWidth && t.__useNaturalRatio ? t._height * t.__naturalWidth / t.__naturalHeight : t.__naturalWidth || defaultValue;
3871
+ }
3872
+ else {
3873
+ return v;
3874
+ }
3851
3875
  };
3852
3876
  }
3853
3877
  else if (key === 'height') {
3854
3878
  property.get = function () {
3855
3879
  const v = this[computedKey];
3856
- return v === undefined ? (this.__naturalHeight || defaultValue) : v;
3880
+ if (v === undefined) {
3881
+ const t = this;
3882
+ return t._width && t.__naturalHeight && t.__useNaturalRatio ? t._width * t.__naturalHeight / t.__naturalWidth : t.__naturalHeight || defaultValue;
3883
+ }
3884
+ else {
3885
+ return v;
3886
+ }
3857
3887
  };
3858
3888
  }
3859
3889
  let descriptor, find = data;
@@ -3867,7 +3897,7 @@ var LeaferUI = (function (exports) {
3867
3897
  property.set = data[setMethodName];
3868
3898
  delete data[setMethodName];
3869
3899
  }
3870
- Object.defineProperty(data, key, property);
3900
+ defineKey(data, key, property);
3871
3901
  }
3872
3902
 
3873
3903
  const debug$6 = new Debug('rewrite');
@@ -4068,13 +4098,6 @@ var LeaferUI = (function (exports) {
4068
4098
  return true;
4069
4099
  p = p.parent;
4070
4100
  }
4071
- },
4072
- hasParentAutoLayout(p) {
4073
- while (p.parent) {
4074
- p = p.parent;
4075
- if (p.__hasAutoLayout)
4076
- return true;
4077
- }
4078
4101
  }
4079
4102
  };
4080
4103
  const L = LeafHelper;
@@ -4094,13 +4117,13 @@ var LeaferUI = (function (exports) {
4094
4117
  return target.__world;
4095
4118
  },
4096
4119
  localBoxBounds(target) {
4097
- return target.__.eraser ? null : (target.__local || target.__layout);
4120
+ return target.__.eraser || target.__.visible === 0 ? null : (target.__local || target.__layout);
4098
4121
  },
4099
4122
  localStrokeBounds(target) {
4100
- return target.__.eraser ? null : target.__layout.localStrokeBounds;
4123
+ return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
4101
4124
  },
4102
4125
  localRenderBounds(target) {
4103
- return target.__.eraser ? null : target.__layout.localRenderBounds;
4126
+ return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
4104
4127
  },
4105
4128
  maskLocalBoxBounds(target) {
4106
4129
  return target.__.mask ? target.__localBoxBounds : null;
@@ -4806,7 +4829,7 @@ var LeaferUI = (function (exports) {
4806
4829
  };
4807
4830
 
4808
4831
  const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
4809
- const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
4832
+ const { toPoint: toPoint$3, tempPoint: tempPoint$1 } = AroundHelper;
4810
4833
  const LeafMatrix = {
4811
4834
  __updateWorldMatrix() {
4812
4835
  multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
@@ -4823,7 +4846,7 @@ var LeaferUI = (function (exports) {
4823
4846
  local.e = data.x + data.offsetX;
4824
4847
  local.f = data.y + data.offsetY;
4825
4848
  if (data.around || data.origin) {
4826
- toPoint(data.around || data.origin, layout.boxBounds, tempPoint$1);
4849
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
4827
4850
  translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
4828
4851
  }
4829
4852
  }
@@ -4831,7 +4854,7 @@ var LeaferUI = (function (exports) {
4831
4854
  }
4832
4855
  };
4833
4856
 
4834
- const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2, hasParentAutoLayout } = LeafHelper;
4857
+ const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
4835
4858
  const { updateBounds: updateBounds$1 } = BranchHelper;
4836
4859
  const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
4837
4860
  const { toBounds: toBounds$2 } = PathBounds;
@@ -4850,7 +4873,6 @@ var LeaferUI = (function (exports) {
4850
4873
  this.__updatePath();
4851
4874
  this.__updateRenderPath();
4852
4875
  this.__updateBoxBounds();
4853
- layout.boxChanged = false;
4854
4876
  layout.resized = true;
4855
4877
  }
4856
4878
  if (layout.localBoxChanged) {
@@ -4864,12 +4886,12 @@ var LeaferUI = (function (exports) {
4864
4886
  if (this.parent)
4865
4887
  this.parent.__layout.boxChange();
4866
4888
  }
4889
+ layout.boxChanged = false;
4867
4890
  if (layout.strokeChanged) {
4868
4891
  layout.strokeSpread = this.__updateStrokeSpread();
4869
4892
  if (layout.strokeSpread) {
4870
- if (layout.strokeBounds === layout.boxBounds) {
4893
+ if (layout.strokeBounds === layout.boxBounds)
4871
4894
  layout.spreadStroke();
4872
- }
4873
4895
  this.__updateStrokeBounds();
4874
4896
  this.__updateLocalStrokeBounds();
4875
4897
  }
@@ -4877,7 +4899,7 @@ var LeaferUI = (function (exports) {
4877
4899
  layout.spreadStrokeCancel();
4878
4900
  }
4879
4901
  layout.strokeChanged = false;
4880
- if (layout.renderSpread)
4902
+ if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
4881
4903
  layout.renderChanged = true;
4882
4904
  if (this.parent)
4883
4905
  this.parent.__layout.strokeChange();
@@ -4886,9 +4908,8 @@ var LeaferUI = (function (exports) {
4886
4908
  if (layout.renderChanged) {
4887
4909
  layout.renderSpread = this.__updateRenderSpread();
4888
4910
  if (layout.renderSpread) {
4889
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) {
4911
+ if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
4890
4912
  layout.spreadRender();
4891
- }
4892
4913
  this.__updateRenderBounds();
4893
4914
  this.__updateLocalRenderBounds();
4894
4915
  }
@@ -4928,12 +4949,15 @@ var LeaferUI = (function (exports) {
4928
4949
  __updateAutoLayout() {
4929
4950
  this.__layout.matrixChanged = true;
4930
4951
  if (this.isBranch) {
4931
- if (this.leafer)
4952
+ if (this.leafer && this.leafer.ready)
4932
4953
  this.leafer.layouter.addExtra(this);
4933
- if (this.__.flow)
4934
- this.__updateFlowLayout();
4935
- if (hasParentAutoLayout(this)) {
4936
- updateMatrix$1(this);
4954
+ if (this.__.flow) {
4955
+ if (this.__layout.boxChanged)
4956
+ this.__updateFlowLayout();
4957
+ updateAllMatrix$2(this);
4958
+ updateBounds$1(this, this);
4959
+ if (this.__.__autoSide)
4960
+ this.__updateBoxBounds();
4937
4961
  }
4938
4962
  else {
4939
4963
  updateAllMatrix$2(this);
@@ -4950,12 +4974,13 @@ var LeaferUI = (function (exports) {
4950
4974
  data.__naturalHeight = layout.boxBounds.height;
4951
4975
  },
4952
4976
  __updateStrokeBounds() {
4953
- copyAndSpread$1(this.__layout.strokeBounds, this.__layout.boxBounds, this.__layout.strokeSpread);
4977
+ const layout = this.__layout;
4978
+ copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
4954
4979
  },
4955
4980
  __updateRenderBounds() {
4956
- const { renderSpread, strokeBounds, renderBounds } = this.__layout;
4957
- renderSpread > 0 ? copyAndSpread$1(renderBounds, strokeBounds, renderSpread) : copy$4(renderBounds, strokeBounds);
4958
- },
4981
+ const layout = this.__layout;
4982
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
4983
+ }
4959
4984
  };
4960
4985
 
4961
4986
  const LeafRender = {
@@ -5075,7 +5100,7 @@ var LeaferUI = (function (exports) {
5075
5100
  get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
5076
5101
  get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
5077
5102
  get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
5078
- get pathInputed() { return !!this.__.__pathInputed; }
5103
+ get pathInputed() { return this.__.__pathInputed; }
5079
5104
  constructor(data) {
5080
5105
  this.innerId = create(LEAF);
5081
5106
  this.reset(data);
@@ -5687,6 +5712,9 @@ var LeaferUI = (function (exports) {
5687
5712
  }
5688
5713
  }
5689
5714
 
5715
+ const version = "1.0.0-rc.24";
5716
+ const inviteCode = {};
5717
+
5690
5718
  class LeaferCanvas extends LeaferCanvasBase {
5691
5719
  get allowBackgroundColor() { return true; }
5692
5720
  init() {
@@ -6228,7 +6256,7 @@ var LeaferUI = (function (exports) {
6228
6256
  canvas.clear();
6229
6257
  }
6230
6258
  else {
6231
- bounds.spread(1 + 1 / this.canvas.pixelRatio).ceil();
6259
+ bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
6232
6260
  canvas.clearWorld(bounds, true);
6233
6261
  canvas.clipWorld(bounds, true);
6234
6262
  }
@@ -6378,10 +6406,11 @@ var LeaferUI = (function (exports) {
6378
6406
  function arrowType(defaultValue) {
6379
6407
  return decorateLeafAttr(defaultValue, (key) => attr({
6380
6408
  set(value) {
6381
- this.__setAttr(key, value);
6382
- const data = this.__;
6383
- data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6384
- doStrokeType(this);
6409
+ if (this.__setAttr(key, value)) {
6410
+ const data = this.__;
6411
+ data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6412
+ doStrokeType(this);
6413
+ }
6385
6414
  }
6386
6415
  }));
6387
6416
  }
@@ -6554,7 +6583,7 @@ var LeaferUI = (function (exports) {
6554
6583
  const UnitConvert = {
6555
6584
  number(value, percentRefer) {
6556
6585
  if (typeof value === 'object')
6557
- return value.type === 'percent' ? (value.value > 49 ? value.value / 100 : value.value) * percentRefer : value.value;
6586
+ return value.type === 'percent' ? value.value * percentRefer : value.value;
6558
6587
  return value;
6559
6588
  }
6560
6589
  };
@@ -6563,7 +6592,7 @@ var LeaferUI = (function (exports) {
6563
6592
  }
6564
6593
 
6565
6594
  class BoxData extends GroupData {
6566
- get __boxStroke() { return true; }
6595
+ get __boxStroke() { return !this.__pathInputed; }
6567
6596
  }
6568
6597
 
6569
6598
  class LeaferData extends GroupData {
@@ -6576,11 +6605,11 @@ var LeaferUI = (function (exports) {
6576
6605
  }
6577
6606
 
6578
6607
  class RectData extends UIData {
6579
- get __boxStroke() { return true; }
6608
+ get __boxStroke() { return !this.__pathInputed; }
6580
6609
  }
6581
6610
 
6582
6611
  class EllipseData extends UIData {
6583
- get __boxStroke() { return true; }
6612
+ get __boxStroke() { return !this.__pathInputed; }
6584
6613
  }
6585
6614
 
6586
6615
  class PolygonData extends UIData {
@@ -6607,6 +6636,7 @@ var LeaferUI = (function (exports) {
6607
6636
  'black': 900
6608
6637
  };
6609
6638
  class TextData extends UIData {
6639
+ get __useNaturalRatio() { return false; }
6610
6640
  setFontWeight(value) {
6611
6641
  if (typeof value === 'string') {
6612
6642
  this.__setInput('fontWeight', value);
@@ -6648,19 +6678,18 @@ var LeaferUI = (function (exports) {
6648
6678
  const UIBounds = {
6649
6679
  __updateStrokeSpread() {
6650
6680
  let width = 0, boxWidth = 0;
6651
- const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__;
6652
- if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
6681
+ const data = this.__, { strokeAlign, strokeWidth } = data;
6682
+ if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
6653
6683
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
6654
- if (!this.__.__boxStroke) {
6655
- const { miterLimit, strokeCap } = this.__;
6656
- const miterLimitAddWidth = this.__tag !== 'Line' ? 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) - width : 0;
6657
- const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
6684
+ if (!data.__boxStroke) {
6685
+ const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
6686
+ const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
6658
6687
  width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
6659
6688
  }
6660
6689
  }
6661
- this.__layout.strokeBoxSpread = boxWidth;
6662
- if (this.__.__useArrow)
6690
+ if (data.__useArrow)
6663
6691
  width += strokeWidth * 5;
6692
+ this.__layout.strokeBoxSpread = boxWidth;
6664
6693
  return width;
6665
6694
  },
6666
6695
  __updateRenderSpread() {
@@ -6680,7 +6709,7 @@ var LeaferUI = (function (exports) {
6680
6709
  if (backgroundBlur)
6681
6710
  shapeWidth = Math.max(shapeWidth, backgroundBlur);
6682
6711
  this.__layout.renderShapeSpread = shapeWidth;
6683
- return width;
6712
+ return width + (this.__layout.strokeSpread || 0);
6684
6713
  }
6685
6714
  };
6686
6715
 
@@ -6771,7 +6800,7 @@ var LeaferUI = (function (exports) {
6771
6800
 
6772
6801
  const RectRender = {
6773
6802
  __drawFast(canvas, options) {
6774
- const { width, height, fill, stroke, __drawAfterFill } = this.__;
6803
+ let { width, height, fill, stroke, __drawAfterFill } = this.__;
6775
6804
  if (fill) {
6776
6805
  canvas.fillStyle = fill;
6777
6806
  canvas.fillRect(0, 0, width, height);
@@ -6789,7 +6818,16 @@ var LeaferUI = (function (exports) {
6789
6818
  canvas.strokeRect(0, 0, width, height);
6790
6819
  break;
6791
6820
  case 'inside':
6792
- canvas.strokeRect(half, half, width - __strokeWidth, height - __strokeWidth);
6821
+ width -= __strokeWidth, height -= __strokeWidth;
6822
+ if (width < 0 || height < 0) {
6823
+ canvas.save();
6824
+ this.__clip(canvas, options);
6825
+ canvas.strokeRect(half, half, width, height);
6826
+ canvas.restore();
6827
+ }
6828
+ else {
6829
+ canvas.strokeRect(half, half, width, height);
6830
+ }
6793
6831
  break;
6794
6832
  case 'outside':
6795
6833
  canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
@@ -6817,11 +6855,14 @@ var LeaferUI = (function (exports) {
6817
6855
  return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
6818
6856
  }
6819
6857
  get pen() {
6820
- pen.set(this.path = this.__.path || []);
6858
+ const { path } = this.__;
6859
+ pen.set(this.path = path || []);
6860
+ if (!path)
6861
+ this.__drawPathByBox(pen);
6821
6862
  return pen;
6822
6863
  }
6823
6864
  get editConfig() { return undefined; }
6824
- get editOuter() { return 'EditTool'; }
6865
+ get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
6825
6866
  get editInner() { return 'PathEditor'; }
6826
6867
  constructor(data) {
6827
6868
  super(data);
@@ -6841,18 +6882,16 @@ var LeaferUI = (function (exports) {
6841
6882
  getPath(curve, pathForRender) {
6842
6883
  this.__layout.update();
6843
6884
  let path = pathForRender ? this.__.__pathForRender : this.__.path;
6844
- if (!path) {
6845
- const { width, height } = this.boxBounds;
6846
- if (width || height) {
6847
- pen.set(path = []);
6848
- this.__drawPathByBox(pen);
6849
- }
6850
- }
6885
+ if (!path)
6886
+ pen.set(path = []), this.__drawPathByBox(pen);
6851
6887
  return curve ? PathConvert.toCanvasData(path, true) : path;
6852
6888
  }
6853
6889
  getPathString(curve, pathForRender) {
6854
6890
  return PathConvert.stringify(this.getPath(curve, pathForRender));
6855
6891
  }
6892
+ load() {
6893
+ this.__.__computePaint();
6894
+ }
6856
6895
  __onUpdateSize() {
6857
6896
  if (this.__.__input) {
6858
6897
  const data = this.__;
@@ -6938,7 +6977,7 @@ var LeaferUI = (function (exports) {
6938
6977
  opacityType(1)
6939
6978
  ], exports.UI.prototype, "opacity", void 0);
6940
6979
  __decorate([
6941
- opacityType(true)
6980
+ visibleType(true)
6942
6981
  ], exports.UI.prototype, "visible", void 0);
6943
6982
  __decorate([
6944
6983
  stateType(false)
@@ -6955,9 +6994,6 @@ var LeaferUI = (function (exports) {
6955
6994
  __decorate([
6956
6995
  maskType(false)
6957
6996
  ], exports.UI.prototype, "mask", void 0);
6958
- __decorate([
6959
- surfaceType('pixel')
6960
- ], exports.UI.prototype, "maskType", void 0);
6961
6997
  __decorate([
6962
6998
  eraserType(false)
6963
6999
  ], exports.UI.prototype, "eraser", void 0);
@@ -7250,6 +7286,7 @@ var LeaferUI = (function (exports) {
7250
7286
  get layoutLocked() { return !this.layouter.running; }
7251
7287
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7252
7288
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
7289
+ get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
7253
7290
  constructor(userConfig, data) {
7254
7291
  super(data);
7255
7292
  this.config = {
@@ -7407,7 +7444,8 @@ var LeaferUI = (function (exports) {
7407
7444
  this.__changeFill(newValue);
7408
7445
  }
7409
7446
  else if (attrName === 'hittable') {
7410
- this.canvas.hittable = newValue;
7447
+ if (!this.parent)
7448
+ this.canvas.hittable = newValue;
7411
7449
  }
7412
7450
  }
7413
7451
  return super.__setAttr(attrName, newValue);
@@ -7525,6 +7563,9 @@ var LeaferUI = (function (exports) {
7525
7563
  zoom(_zoomType, _padding, _fixedScale) { return undefined; }
7526
7564
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
7527
7565
  getValidScale(changeScale) { return changeScale; }
7566
+ getWorldPointByClient(clientPoint, updateClient) {
7567
+ return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
7568
+ }
7528
7569
  __checkUpdateLayout() {
7529
7570
  this.__layout.update();
7530
7571
  }
@@ -7607,8 +7648,8 @@ var LeaferUI = (function (exports) {
7607
7648
 
7608
7649
  const rect = exports.Rect.prototype;
7609
7650
  const group = exports.Group.prototype;
7610
- const bounds$1 = {};
7611
- const { copy: copy$2, add } = BoundsHelper;
7651
+ const childrenRenderBounds = {};
7652
+ const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
7612
7653
  exports.Box = class Box extends exports.Group {
7613
7654
  get __tag() { return 'Box'; }
7614
7655
  get isBranchLeaf() { return true; }
@@ -7619,40 +7660,50 @@ var LeaferUI = (function (exports) {
7619
7660
  __updateStrokeSpread() { return 0; }
7620
7661
  __updateRectRenderSpread() { return 0; }
7621
7662
  __updateRenderSpread() {
7622
- const width = this.__updateRectRenderSpread();
7623
- const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
7624
- return (width || hide) ? width : -1;
7663
+ return this.__updateRectRenderSpread() || -1;
7625
7664
  }
7626
7665
  __updateRectBoxBounds() { }
7627
7666
  __updateBoxBounds() {
7628
7667
  const data = this.__;
7629
- if (data.__autoSide && this.children.length) {
7630
- if (this.leafer)
7631
- this.leafer.layouter.addExtra(this);
7632
- super.__updateBoxBounds();
7633
- if (!data.__autoSize) {
7634
- const b = this.__layout.boxBounds;
7635
- if (!data.__autoWidth)
7636
- b.x = 0, b.width = data.width;
7637
- if (!data.__autoHeight)
7638
- b.y = 0, b.height = data.height;
7668
+ if (this.children.length) {
7669
+ if (data.__autoSide) {
7670
+ if (this.leafer && this.leafer.ready)
7671
+ this.leafer.layouter.addExtra(this);
7672
+ super.__updateBoxBounds();
7673
+ if (!data.__autoSize) {
7674
+ const b = this.__layout.boxBounds;
7675
+ if (!data.__autoWidth)
7676
+ b.x = 0, b.width = data.width;
7677
+ if (!data.__autoHeight)
7678
+ b.y = 0, b.height = data.height;
7679
+ }
7680
+ }
7681
+ else {
7682
+ this.__updateRectBoxBounds();
7639
7683
  }
7684
+ if (data.flow)
7685
+ this.__updateContentBounds();
7640
7686
  }
7641
7687
  else {
7642
7688
  this.__updateRectBoxBounds();
7643
7689
  }
7644
- if (data.flow)
7645
- this.__updateContentBounds();
7646
7690
  }
7647
7691
  __updateStrokeBounds() { }
7648
7692
  __updateRenderBounds() {
7649
- this.__updateRectRenderBounds();
7650
- if (!this.__.__drawAfterFill) {
7651
- const { renderBounds } = this.__layout;
7652
- copy$2(bounds$1, renderBounds);
7693
+ let isOverflow;
7694
+ const { renderBounds } = this.__layout;
7695
+ if (this.children.length) {
7653
7696
  super.__updateRenderBounds();
7654
- add(renderBounds, bounds$1);
7697
+ copy$2(childrenRenderBounds, renderBounds);
7698
+ this.__updateRectRenderBounds();
7699
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
7655
7700
  }
7701
+ else {
7702
+ this.__updateRectRenderBounds();
7703
+ }
7704
+ this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
7705
+ if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
7706
+ add(renderBounds, childrenRenderBounds);
7656
7707
  }
7657
7708
  __updateRectRenderBounds() { }
7658
7709
  __updateRectChange() { }
@@ -7668,16 +7719,27 @@ var LeaferUI = (function (exports) {
7668
7719
  }
7669
7720
  else {
7670
7721
  this.__renderRect(canvas, options);
7671
- this.__renderGroup(canvas, options);
7722
+ if (this.children.length)
7723
+ this.__renderGroup(canvas, options);
7672
7724
  }
7673
7725
  }
7674
7726
  __drawAfterFill(canvas, options) {
7675
- canvas.save();
7676
- canvas.clip();
7677
- this.__renderGroup(canvas, options);
7678
- canvas.restore();
7679
- if (this.__.stroke)
7727
+ const { length } = this.children;
7728
+ if (this.isOverflow) {
7729
+ canvas.save();
7730
+ canvas.clip();
7731
+ if (length)
7732
+ this.__renderGroup(canvas, options);
7733
+ canvas.restore();
7734
+ }
7735
+ else {
7736
+ if (length)
7737
+ this.__renderGroup(canvas, options);
7738
+ }
7739
+ if (this.__.stroke && length) {
7740
+ canvas.setWorld(this.__nowWorld);
7680
7741
  this.__drawRenderPath(canvas);
7742
+ }
7681
7743
  }
7682
7744
  };
7683
7745
  __decorate([
@@ -7815,9 +7877,10 @@ var LeaferUI = (function (exports) {
7815
7877
  super(data);
7816
7878
  }
7817
7879
  __updatePath() {
7818
- const path = this.__.path = [];
7819
- if (this.__.points) {
7820
- drawPoints$1(path, this.__.points, this.__.closed);
7880
+ const data = this.__;
7881
+ const path = data.path = [];
7882
+ if (data.points) {
7883
+ drawPoints$1(path, data.points, false, data.closed);
7821
7884
  }
7822
7885
  else {
7823
7886
  moveTo$2(path, 0, 0);
@@ -8187,7 +8250,7 @@ var LeaferUI = (function (exports) {
8187
8250
  boundsType(0)
8188
8251
  ], exports.Text.prototype, "letterSpacing", void 0);
8189
8252
  __decorate([
8190
- boundsType({ type: 'percent', value: 150 })
8253
+ boundsType({ type: 'percent', value: 1.5 })
8191
8254
  ], exports.Text.prototype, "lineHeight", void 0);
8192
8255
  __decorate([
8193
8256
  boundsType(0)
@@ -8281,8 +8344,6 @@ var LeaferUI = (function (exports) {
8281
8344
  };
8282
8345
  }
8283
8346
 
8284
- const version = "1.0.0-rc.23";
8285
-
8286
8347
  function fillText(ui, canvas) {
8287
8348
  let row;
8288
8349
  const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
@@ -8953,13 +9014,14 @@ var LeaferUI = (function (exports) {
8953
9014
  recycleImage
8954
9015
  };
8955
9016
 
8956
- const defaultFrom$2 = { x: 0.5, y: 0 };
8957
- const defaultTo$2 = { x: 0.5, y: 1 };
9017
+ const { toPoint: toPoint$2 } = AroundHelper;
9018
+ const realFrom$2 = {};
9019
+ const realTo$2 = {};
8958
9020
  function linearGradient(paint, box) {
8959
9021
  let { from, to, type, blendMode, opacity } = paint;
8960
- from || (from = defaultFrom$2);
8961
- to || (to = defaultTo$2);
8962
- 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);
9022
+ toPoint$2(from || 'top', box, realFrom$2);
9023
+ toPoint$2(to || 'bottom', box, realTo$2);
9024
+ const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
8963
9025
  applyStops(style, paint.stops, opacity);
8964
9026
  const data = { type, style };
8965
9027
  if (blendMode)
@@ -8970,23 +9032,25 @@ var LeaferUI = (function (exports) {
8970
9032
  let stop;
8971
9033
  for (let i = 0, len = stops.length; i < len; i++) {
8972
9034
  stop = stops[i];
8973
- gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
9035
+ if (typeof stop === 'string') {
9036
+ gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
9037
+ }
9038
+ else {
9039
+ gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
9040
+ }
8974
9041
  }
8975
9042
  }
8976
9043
 
8977
- const { set: set$1, getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
9044
+ const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
8978
9045
  const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
8979
- const defaultFrom$1 = { x: 0.5, y: 0.5 };
8980
- const defaultTo$1 = { x: 0.5, y: 1 };
9046
+ const { toPoint: toPoint$1 } = AroundHelper;
8981
9047
  const realFrom$1 = {};
8982
9048
  const realTo$1 = {};
8983
9049
  function radialGradient(paint, box) {
8984
9050
  let { from, to, type, opacity, blendMode, stretch } = paint;
8985
- from || (from = defaultFrom$1);
8986
- to || (to = defaultTo$1);
8987
- const { x, y, width, height } = box;
8988
- set$1(realFrom$1, x + from.x * width, y + from.y * height);
8989
- set$1(realTo$1, x + to.x * width, y + to.y * height);
9051
+ toPoint$1(from || 'center', box, realFrom$1);
9052
+ toPoint$1(to || 'bottom', box, realTo$1);
9053
+ const { width, height } = box;
8990
9054
  let transform;
8991
9055
  if (width !== height || stretch) {
8992
9056
  transform = get$1();
@@ -9001,19 +9065,16 @@ var LeaferUI = (function (exports) {
9001
9065
  return data;
9002
9066
  }
9003
9067
 
9004
- const { set, getAngle, getDistance } = PointHelper;
9068
+ const { getAngle, getDistance } = PointHelper;
9005
9069
  const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
9006
- const defaultFrom = { x: 0.5, y: 0.5 };
9007
- const defaultTo = { x: 0.5, y: 1 };
9070
+ const { toPoint } = AroundHelper;
9008
9071
  const realFrom = {};
9009
9072
  const realTo = {};
9010
9073
  function conicGradient(paint, box) {
9011
9074
  let { from, to, type, opacity, blendMode, stretch } = paint;
9012
- from || (from = defaultFrom);
9013
- to || (to = defaultTo);
9014
- const { x, y, width, height } = box;
9015
- set(realFrom, x + from.x * width, y + from.y * height);
9016
- set(realTo, x + to.x * width, y + to.y * height);
9075
+ toPoint(from || 'center', box, realFrom);
9076
+ toPoint(to || 'bottom', box, realTo);
9077
+ const { width, height } = box;
9017
9078
  const transform = get();
9018
9079
  const angle = getAngle(realFrom, realTo);
9019
9080
  if (Platform.conicGradientRotate90) {
@@ -9167,7 +9228,7 @@ var LeaferUI = (function (exports) {
9167
9228
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
9168
9229
  maskCanvas = contentCanvas = null;
9169
9230
  }
9170
- if (child.__.maskType === 'path') {
9231
+ if (child.__.mask === 'path') {
9171
9232
  if (child.opacity < 1) {
9172
9233
  currentMask = 'opacity-path';
9173
9234
  maskOpacity = child.opacity;
@@ -9188,7 +9249,7 @@ var LeaferUI = (function (exports) {
9188
9249
  contentCanvas = getCanvas(canvas);
9189
9250
  child.__render(maskCanvas, options);
9190
9251
  }
9191
- if (child.__.maskType !== 'clipping')
9252
+ if (child.__.mask !== 'clipping')
9192
9253
  continue;
9193
9254
  }
9194
9255
  if (excludeRenderBounds(child, options))
@@ -9489,11 +9550,11 @@ var LeaferUI = (function (exports) {
9489
9550
  if (mode === WordMode) {
9490
9551
  wordChar = { char: '', x: charX };
9491
9552
  charX = toWordChar(word.data, charX, wordChar);
9492
- if (wordChar.char !== ' ')
9553
+ if (row.isOverflow || wordChar.char !== ' ')
9493
9554
  row.data.push(wordChar);
9494
9555
  }
9495
9556
  else {
9496
- charX = toChar(word.data, charX, row.data);
9557
+ charX = toChar(word.data, charX, row.data, row.isOverflow);
9497
9558
  }
9498
9559
  if (!row.paraEnd && addWordWidth) {
9499
9560
  charX += addWordWidth;
@@ -9520,9 +9581,9 @@ var LeaferUI = (function (exports) {
9520
9581
  });
9521
9582
  return charX;
9522
9583
  }
9523
- function toChar(data, charX, rowData) {
9584
+ function toChar(data, charX, rowData, isOverflow) {
9524
9585
  data.forEach(char => {
9525
- if (char.char !== ' ') {
9586
+ if (isOverflow || char.char !== ' ') {
9526
9587
  char.x = charX;
9527
9588
  rowData.push(char);
9528
9589
  }
@@ -9554,12 +9615,14 @@ var LeaferUI = (function (exports) {
9554
9615
  for (let i = 0, len = rows.length; i < len; i++) {
9555
9616
  row = rows[i];
9556
9617
  row.x = x;
9557
- switch (textAlign) {
9558
- case 'center':
9559
- row.x += (width - row.width) / 2;
9560
- break;
9561
- case 'right':
9562
- row.x += width - row.width;
9618
+ if (row.width < width || (row.width > width && !__clipText)) {
9619
+ switch (textAlign) {
9620
+ case 'center':
9621
+ row.x += (width - row.width) / 2;
9622
+ break;
9623
+ case 'right':
9624
+ row.x += width - row.width;
9625
+ }
9563
9626
  }
9564
9627
  if (row.paraStart && paraSpacing && i > 0)
9565
9628
  starY += paraSpacing;
@@ -10033,6 +10096,7 @@ var LeaferUI = (function (exports) {
10033
10096
  exports.getMatrixData = getMatrixData;
10034
10097
  exports.getPointData = getPointData;
10035
10098
  exports.hitType = hitType;
10099
+ exports.inviteCode = inviteCode;
10036
10100
  exports.layoutProcessor = layoutProcessor;
10037
10101
  exports.maskType = maskType;
10038
10102
  exports.naturalBoundsType = naturalBoundsType;
@@ -10058,6 +10122,7 @@ var LeaferUI = (function (exports) {
10058
10122
  exports.useCanvas = useCanvas;
10059
10123
  exports.useModule = useModule;
10060
10124
  exports.version = version;
10125
+ exports.visibleType = visibleType;
10061
10126
  exports.zoomLayerType = zoomLayerType;
10062
10127
 
10063
10128
  return exports;