leafer-ui 1.0.0-rc.22 → 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.
@@ -3,7 +3,7 @@ const Platform = {
3
3
  hitCanvasSize: 100,
4
4
  maxCacheSize: 2560 * 1600,
5
5
  maxPatternSize: 4096 * 2160,
6
- suffix: 'leaf',
6
+ suffix: '',
7
7
  crossOrigin: 'anonymous'
8
8
  }
9
9
  };
@@ -33,24 +33,12 @@ const I$2 = IncrementId;
33
33
  const { round, pow: pow$1, PI: PI$4 } = Math;
34
34
  const MathHelper = {
35
35
  within(value, min, max) {
36
- if (value < min)
36
+ if (min !== undefined && value < min)
37
37
  value = min;
38
- if (value > max)
38
+ if (max !== undefined && value > max)
39
39
  value = max;
40
40
  return value;
41
41
  },
42
- minus(value, isFourNumber) {
43
- if (value instanceof Array) {
44
- if (isFourNumber)
45
- value = MathHelper.fourNumber(value, 0);
46
- for (let i = 0; i < value.length; i++)
47
- value[i] = -value[i];
48
- }
49
- else {
50
- value = -value;
51
- }
52
- return value;
53
- },
54
42
  fourNumber(num, maxValue) {
55
43
  let data;
56
44
  if (num instanceof Array) {
@@ -147,9 +135,11 @@ const MatrixHelper = {
147
135
  t.e += x;
148
136
  t.f += y;
149
137
  },
150
- translateInner(t, x, y) {
138
+ translateInner(t, x, y, isMoveOrigin) {
151
139
  t.e += t.a * x + t.c * y;
152
140
  t.f += t.b * x + t.d * y;
141
+ if (isMoveOrigin)
142
+ t.e -= x, t.f -= y;
153
143
  },
154
144
  scale(t, scaleX, scaleY = scaleX) {
155
145
  t.a *= scaleX;
@@ -216,8 +206,10 @@ const MatrixHelper = {
216
206
  t.e = child.e * a + child.f * c + e;
217
207
  t.f = child.e * b + child.f * d + f;
218
208
  },
219
- multiplyParent(t, parent, to, abcdChanged, childScaleData) {
220
- const { e, f } = t;
209
+ multiplyParent(t, parent, to, abcdChanged, childScaleData, scrollData) {
210
+ let { e, f } = t;
211
+ if (scrollData)
212
+ e += scrollData.scrollX, f += scrollData.scrollY;
221
213
  to || (to = t);
222
214
  if (abcdChanged === undefined)
223
215
  abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
@@ -338,7 +330,7 @@ const MatrixHelper = {
338
330
  t.e = x;
339
331
  t.f = y;
340
332
  if (origin)
341
- M$6.translateInner(t, -origin.x, -origin.y);
333
+ M$6.translateInner(t, -origin.x, -origin.y, true);
342
334
  },
343
335
  getLayout(t, origin, firstSkewY) {
344
336
  const { a, b, c, d, e, f } = t;
@@ -758,7 +750,7 @@ const { float, fourNumber } = MathHelper;
758
750
  const { floor, ceil: ceil$2 } = Math;
759
751
  let right$1, bottom$1, boundsRight, boundsBottom;
760
752
  const point = {};
761
- const toPoint$1 = {};
753
+ const toPoint$5 = {};
762
754
  const BoundsHelper = {
763
755
  tempBounds: {},
764
756
  set(t, x = 0, y = 0, width = 0, height = 0) {
@@ -773,15 +765,17 @@ const BoundsHelper = {
773
765
  t.width = bounds.width;
774
766
  t.height = bounds.height;
775
767
  },
776
- copyAndSpread(t, bounds, spreadX, spreadY) {
777
- if (spreadX instanceof Array) {
778
- const four = fourNumber(spreadX);
779
- B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
768
+ copyAndSpread(t, bounds, spread, isShrink) {
769
+ if (spread instanceof Array) {
770
+ const four = fourNumber(spread);
771
+ isShrink
772
+ ? B.set(t, bounds.x + four[3], bounds.y + four[0], bounds.width - four[1] - four[3], bounds.height - four[2] - four[0])
773
+ : B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
780
774
  }
781
775
  else {
782
- if (!spreadY)
783
- spreadY = spreadX;
784
- B.set(t, bounds.x - spreadX, bounds.y - spreadY, bounds.width + spreadX * 2, bounds.height + spreadY * 2);
776
+ if (isShrink)
777
+ spread = -spread;
778
+ B.set(t, bounds.x - spread, bounds.y - spread, bounds.width + spread * 2, bounds.height + spread * 2);
785
779
  }
786
780
  },
787
781
  minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
@@ -858,17 +852,17 @@ const BoundsHelper = {
858
852
  else {
859
853
  point.x = t.x;
860
854
  point.y = t.y;
861
- toOuterPoint$1(matrix, point, toPoint$1);
862
- setPoint$3(tempPointBounds$1, toPoint$1.x, toPoint$1.y);
855
+ toOuterPoint$1(matrix, point, toPoint$5);
856
+ setPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
863
857
  point.x = t.x + t.width;
864
- toOuterPoint$1(matrix, point, toPoint$1);
865
- addPoint$3(tempPointBounds$1, toPoint$1.x, toPoint$1.y);
858
+ toOuterPoint$1(matrix, point, toPoint$5);
859
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
866
860
  point.y = t.y + t.height;
867
- toOuterPoint$1(matrix, point, toPoint$1);
868
- addPoint$3(tempPointBounds$1, toPoint$1.x, toPoint$1.y);
861
+ toOuterPoint$1(matrix, point, toPoint$5);
862
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
869
863
  point.x = t.x;
870
- toOuterPoint$1(matrix, point, toPoint$1);
871
- addPoint$3(tempPointBounds$1, toPoint$1.x, toPoint$1.y);
864
+ toOuterPoint$1(matrix, point, toPoint$5);
865
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
872
866
  toBounds$4(tempPointBounds$1, to);
873
867
  }
874
868
  },
@@ -881,13 +875,16 @@ const BoundsHelper = {
881
875
  const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
882
876
  return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
883
877
  },
884
- getSpread(t, spreadX, spreadY) {
878
+ getSpread(t, spread) {
885
879
  const n = {};
886
- B.copyAndSpread(n, t, spreadX, spreadY);
880
+ B.copyAndSpread(n, t, spread);
887
881
  return n;
888
882
  },
889
- spread(t, spreadX, spreadY = spreadX) {
890
- B.copyAndSpread(t, t, spreadX, spreadY);
883
+ spread(t, spread) {
884
+ B.copyAndSpread(t, t, spread);
885
+ },
886
+ shrink(t, shrink) {
887
+ B.copyAndSpread(t, t, shrink, true);
891
888
  },
892
889
  ceil(t) {
893
890
  const { x, y } = t;
@@ -1067,12 +1064,12 @@ class Bounds {
1067
1064
  getFitMatrix(put, baseScale) {
1068
1065
  return BoundsHelper.getFitMatrix(this, put, baseScale);
1069
1066
  }
1070
- spread(fourNumber, spreadY) {
1071
- BoundsHelper.spread(this, fourNumber, spreadY);
1067
+ spread(fourNumber) {
1068
+ BoundsHelper.spread(this, fourNumber);
1072
1069
  return this;
1073
1070
  }
1074
1071
  shrink(fourNumber) {
1075
- BoundsHelper.spread(this, MathHelper.minus(fourNumber, true));
1072
+ BoundsHelper.shrink(this, fourNumber);
1076
1073
  return this;
1077
1074
  }
1078
1075
  ceil() {
@@ -1189,6 +1186,10 @@ var Direction9;
1189
1186
  Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
1190
1187
  Direction9[Direction9["left"] = 7] = "left";
1191
1188
  Direction9[Direction9["center"] = 8] = "center";
1189
+ Direction9[Direction9["top-left"] = 0] = "top-left";
1190
+ Direction9[Direction9["top-right"] = 2] = "top-right";
1191
+ Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
1192
+ Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
1192
1193
  })(Direction9 || (Direction9 = {}));
1193
1194
 
1194
1195
  const directionData = [
@@ -1202,6 +1203,7 @@ const directionData = [
1202
1203
  { x: 0, y: 0.5 },
1203
1204
  { x: 0.5, y: 0.5 }
1204
1205
  ];
1206
+ directionData.forEach(item => item.type = 'percent');
1205
1207
  const AroundHelper = {
1206
1208
  directionData,
1207
1209
  tempPoint: {},
@@ -1209,15 +1211,19 @@ const AroundHelper = {
1209
1211
  toPoint(around, bounds, to, onlySize, pointBounds) {
1210
1212
  to || (to = {});
1211
1213
  const point = get$5(around);
1212
- to.x = point.x * bounds.width;
1213
- to.y = point.y * bounds.height;
1214
- if (pointBounds) {
1215
- to.x -= pointBounds.x;
1216
- to.y -= pointBounds.y;
1217
- if (point.x)
1218
- to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
1219
- if (point.y)
1220
- to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
1214
+ to.x = point.x;
1215
+ to.y = point.y;
1216
+ if (point.type === 'percent') {
1217
+ to.x *= bounds.width;
1218
+ to.y *= bounds.height;
1219
+ if (pointBounds) {
1220
+ to.x -= pointBounds.x;
1221
+ to.y -= pointBounds.y;
1222
+ if (point.x)
1223
+ to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
1224
+ if (point.y)
1225
+ to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
1226
+ }
1221
1227
  }
1222
1228
  if (!onlySize) {
1223
1229
  to.x += bounds.x;
@@ -1229,6 +1235,13 @@ function get$5(around) {
1229
1235
  return typeof around === 'string' ? directionData[Direction9[around]] : around;
1230
1236
  }
1231
1237
 
1238
+ const { toPoint: toPoint$4 } = AroundHelper;
1239
+ const AlignHelper = {
1240
+ toPoint(align, contentBounds, bounds, to, onlySize) {
1241
+ toPoint$4(align, bounds, to, onlySize, contentBounds);
1242
+ }
1243
+ };
1244
+
1232
1245
  const StringNumberMap = {
1233
1246
  '0': 1,
1234
1247
  '1': 1,
@@ -1461,13 +1474,21 @@ const DataHelper = {
1461
1474
  },
1462
1475
  clone(data) {
1463
1476
  return JSON.parse(JSON.stringify(data));
1477
+ },
1478
+ toMap(list) {
1479
+ const map = {};
1480
+ for (let i = 0, len = list.length; i < len; i++)
1481
+ map[list[i]] = true;
1482
+ return map;
1464
1483
  }
1465
1484
  };
1466
1485
  const { assign } = DataHelper;
1467
1486
 
1468
1487
  class LeafData {
1488
+ get __useNaturalRatio() { return true; }
1489
+ get __isLinePath() { return this.path && this.path.length === 6; }
1469
1490
  get __blendMode() {
1470
- if (this.eraser)
1491
+ if (this.eraser && this.eraser !== 'path')
1471
1492
  return 'destination-out';
1472
1493
  const { blendMode } = this;
1473
1494
  return blendMode === 'pass-through' ? null : blendMode;
@@ -1963,6 +1984,11 @@ class LeaferCanvasBase extends Canvas$1 {
1963
1984
  }
1964
1985
  updateViewSize() { }
1965
1986
  updateClientBounds() { }
1987
+ getClientBounds(update) {
1988
+ if (update)
1989
+ this.updateClientBounds();
1990
+ return this.clientBounds || this.bounds;
1991
+ }
1966
1992
  startAutoLayout(_autoBounds, _listener) { }
1967
1993
  stopAutoLayout() { }
1968
1994
  setCursor(_cursor) { }
@@ -2097,7 +2123,7 @@ class LeaferCanvasBase extends Canvas$1 {
2097
2123
  }
2098
2124
  clear() {
2099
2125
  const { pixelRatio } = this;
2100
- this.clearRect(0, 0, this.width * pixelRatio, this.height * pixelRatio);
2126
+ this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
2101
2127
  }
2102
2128
  isSameSize(size) {
2103
2129
  return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
@@ -2214,7 +2240,7 @@ const RectHelper = {
2214
2240
 
2215
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;
2216
2242
  const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
2217
- const { set: set$2 } = PointHelper;
2243
+ const { set } = PointHelper;
2218
2244
  const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
2219
2245
  const tempPoint$2 = {};
2220
2246
  const BezierHelper = {
@@ -2292,9 +2318,9 @@ const BezierHelper = {
2292
2318
  addPoint$2(setPointBounds, x1, y1);
2293
2319
  }
2294
2320
  if (setStartPoint)
2295
- set$2(setStartPoint, fromX, fromY);
2321
+ set(setStartPoint, fromX, fromY);
2296
2322
  if (setEndPoint)
2297
- set$2(setEndPoint, x1, y1);
2323
+ set(setEndPoint, x1, y1);
2298
2324
  return;
2299
2325
  }
2300
2326
  const anticlockwise = BAx * CBy - CBx * BAy < 0;
@@ -2343,7 +2369,7 @@ const BezierHelper = {
2343
2369
  if (setPointBounds)
2344
2370
  setPoint$2(setPointBounds, fromX, fromY);
2345
2371
  if (setStartPoint)
2346
- set$2(setStartPoint, fromX, fromY);
2372
+ set(setStartPoint, fromX, fromY);
2347
2373
  for (let i = 0; i < parts; i++) {
2348
2374
  endCos = cos$3(endRadian);
2349
2375
  endSin = sin$3(endRadian);
@@ -2365,7 +2391,7 @@ const BezierHelper = {
2365
2391
  endRadian += partRadian;
2366
2392
  }
2367
2393
  if (setEndPoint)
2368
- set$2(setEndPoint, cx + x, cy + y);
2394
+ set(setEndPoint, cx + x, cy + y);
2369
2395
  },
2370
2396
  quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
2371
2397
  data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
@@ -2511,11 +2537,15 @@ const PathConvert = {
2511
2537
  char = pathString[i];
2512
2538
  if (StringNumberMap[char]) {
2513
2539
  if (char === '.') {
2514
- current.dot++;
2515
- if (current.dot > 1) {
2540
+ if (current.dot) {
2516
2541
  pushData(data, num);
2517
2542
  num = '';
2518
2543
  }
2544
+ current.dot++;
2545
+ }
2546
+ if (num === '0' && char !== '.') {
2547
+ pushData(data, num);
2548
+ num = '';
2519
2549
  }
2520
2550
  num += char;
2521
2551
  }
@@ -3605,7 +3635,9 @@ class LeaferImage {
3605
3635
  }
3606
3636
  }
3607
3637
 
3608
- function defineKey(target, key, descriptor) {
3638
+ function defineKey(target, key, descriptor, noConfigurable) {
3639
+ if (!noConfigurable)
3640
+ descriptor.configurable = descriptor.enumerable = true;
3609
3641
  Object.defineProperty(target, key, descriptor);
3610
3642
  }
3611
3643
  function getDescriptor(object, name) {
@@ -3624,9 +3656,7 @@ function attr(partDescriptor) {
3624
3656
  function defineLeafAttr(target, key, defaultValue, partDescriptor) {
3625
3657
  const defaultDescriptor = {
3626
3658
  get() { return this.__getAttr(key); },
3627
- set(value) { this.__setAttr(key, value); },
3628
- configurable: true,
3629
- enumerable: true
3659
+ set(value) { this.__setAttr(key, value); }
3630
3660
  };
3631
3661
  defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
3632
3662
  defineDataProcessor(target, key, defaultValue);
@@ -3637,35 +3667,33 @@ function dataType(defaultValue) {
3637
3667
  function positionType(defaultValue, checkFiniteNumber) {
3638
3668
  return decorateLeafAttr(defaultValue, (key) => attr({
3639
3669
  set(value) {
3640
- this.__setAttr(key, value, checkFiniteNumber);
3641
- this.__layout.matrixChanged || this.__layout.matrixChange();
3670
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.matrixChanged || this.__layout.matrixChange());
3642
3671
  }
3643
3672
  }));
3644
3673
  }
3645
3674
  function autoLayoutType(defaultValue) {
3646
3675
  return decorateLeafAttr(defaultValue, (key) => attr({
3647
3676
  set(value) {
3648
- this.__setAttr(key, value);
3649
- this.__layout.matrixChanged || this.__layout.matrixChange();
3650
- this.__hasAutoLayout = !!value;
3651
- if (!this.__local)
3652
- 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
+ }
3653
3683
  }
3654
3684
  }));
3655
3685
  }
3656
3686
  function scaleType(defaultValue, checkFiniteNumber) {
3657
3687
  return decorateLeafAttr(defaultValue, (key) => attr({
3658
3688
  set(value) {
3659
- this.__setAttr(key, value, checkFiniteNumber);
3660
- this.__layout.scaleChanged || this.__layout.scaleChange();
3689
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.scaleChanged || this.__layout.scaleChange());
3661
3690
  }
3662
3691
  }));
3663
3692
  }
3664
3693
  function rotationType(defaultValue, checkFiniteNumber) {
3665
3694
  return decorateLeafAttr(defaultValue, (key) => attr({
3666
3695
  set(value) {
3667
- this.__setAttr(key, value, checkFiniteNumber);
3668
- this.__layout.rotationChanged || this.__layout.rotationChange();
3696
+ this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.rotationChanged || this.__layout.rotationChange());
3669
3697
  }
3670
3698
  }));
3671
3699
  }
@@ -3679,9 +3707,7 @@ function boundsType(defaultValue, checkFiniteNumber) {
3679
3707
  function naturalBoundsType(defaultValue) {
3680
3708
  return decorateLeafAttr(defaultValue, (key) => attr({
3681
3709
  set(value) {
3682
- this.__setAttr(key, value);
3683
- doBoundsType(this);
3684
- this.__.__removeNaturalSize();
3710
+ this.__setAttr(key, value) && (doBoundsType(this), this.__.__removeNaturalSize());
3685
3711
  }
3686
3712
  }));
3687
3713
  }
@@ -3693,8 +3719,11 @@ function doBoundsType(leaf) {
3693
3719
  function pathInputType(defaultValue) {
3694
3720
  return decorateLeafAttr(defaultValue, (key) => attr({
3695
3721
  set(value) {
3696
- if (this.__.__pathInputed !== 2)
3697
- 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;
3698
3727
  this.__setAttr(key, value);
3699
3728
  doBoundsType(this);
3700
3729
  }
@@ -3725,54 +3754,66 @@ function affectRenderBoundsType(defaultValue) {
3725
3754
  function surfaceType(defaultValue) {
3726
3755
  return decorateLeafAttr(defaultValue, (key) => attr({
3727
3756
  set(value) {
3728
- this.__setAttr(key, value);
3729
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3757
+ this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
3730
3758
  }
3731
3759
  }));
3732
3760
  }
3733
3761
  function opacityType(defaultValue) {
3734
3762
  return decorateLeafAttr(defaultValue, (key) => attr({
3735
3763
  set(value) {
3736
- this.__setAttr(key, value);
3737
- 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
+ }
3738
3777
  }
3739
3778
  }));
3740
3779
  }
3741
3780
  function sortType(defaultValue) {
3742
3781
  return decorateLeafAttr(defaultValue, (key) => attr({
3743
3782
  set(value) {
3744
- this.__setAttr(key, value);
3745
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3746
- 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
+ }
3747
3787
  }
3748
3788
  }));
3749
3789
  }
3750
3790
  function maskType(defaultValue) {
3751
3791
  return decorateLeafAttr(defaultValue, (key) => attr({
3752
3792
  set(value) {
3753
- this.__setAttr(key, value);
3754
- this.__layout.boxChanged || this.__layout.boxChange();
3755
- this.waitParent(() => { this.parent.__updateMask(value); });
3793
+ if (this.__setAttr(key, value)) {
3794
+ this.__layout.boxChanged || this.__layout.boxChange();
3795
+ this.waitParent(() => { this.parent.__updateMask(value); });
3796
+ }
3756
3797
  }
3757
3798
  }));
3758
3799
  }
3759
3800
  function eraserType(defaultValue) {
3760
3801
  return decorateLeafAttr(defaultValue, (key) => attr({
3761
3802
  set(value) {
3762
- this.__setAttr(key, value);
3763
- this.waitParent(() => { this.parent.__updateEraser(value); });
3803
+ this.__setAttr(key, value) && this.waitParent(() => { this.parent.__updateEraser(value); });
3764
3804
  }
3765
3805
  }));
3766
3806
  }
3767
3807
  function hitType(defaultValue) {
3768
3808
  return decorateLeafAttr(defaultValue, (key) => attr({
3769
3809
  set(value) {
3770
- this.__setAttr(key, value);
3771
- if (Debug.showHitView) {
3772
- 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();
3773
3816
  }
3774
- if (this.leafer)
3775
- this.leafer.updateCursor();
3776
3817
  }
3777
3818
  }));
3778
3819
  }
@@ -3813,9 +3854,7 @@ function defineDataProcessor(target, key, defaultValue) {
3813
3854
  },
3814
3855
  set(value) {
3815
3856
  this[computedKey] = value;
3816
- },
3817
- configurable: true,
3818
- enumerable: true
3857
+ }
3819
3858
  };
3820
3859
  if (defaultValue === undefined) {
3821
3860
  property.get = function () { return this[computedKey]; };
@@ -3823,13 +3862,25 @@ function defineDataProcessor(target, key, defaultValue) {
3823
3862
  else if (key === 'width') {
3824
3863
  property.get = function () {
3825
3864
  const v = this[computedKey];
3826
- 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
+ }
3827
3872
  };
3828
3873
  }
3829
3874
  else if (key === 'height') {
3830
3875
  property.get = function () {
3831
3876
  const v = this[computedKey];
3832
- 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
+ }
3833
3884
  };
3834
3885
  }
3835
3886
  let descriptor, find = data;
@@ -3843,7 +3894,7 @@ function defineDataProcessor(target, key, defaultValue) {
3843
3894
  property.set = data[setMethodName];
3844
3895
  delete data[setMethodName];
3845
3896
  }
3846
- Object.defineProperty(data, key, property);
3897
+ defineKey(data, key, property);
3847
3898
  }
3848
3899
 
3849
3900
  const debug$9 = new Debug('rewrite');
@@ -4044,13 +4095,6 @@ const LeafHelper = {
4044
4095
  return true;
4045
4096
  p = p.parent;
4046
4097
  }
4047
- },
4048
- hasParentAutoLayout(p) {
4049
- while (p.parent) {
4050
- p = p.parent;
4051
- if (p.__hasAutoLayout)
4052
- return true;
4053
- }
4054
4098
  }
4055
4099
  };
4056
4100
  const L = LeafHelper;
@@ -4070,13 +4114,13 @@ const LeafBoundsHelper = {
4070
4114
  return target.__world;
4071
4115
  },
4072
4116
  localBoxBounds(target) {
4073
- return target.__.eraser ? null : (target.__local || target.__layout);
4117
+ return target.__.eraser || target.__.visible === 0 ? null : (target.__local || target.__layout);
4074
4118
  },
4075
4119
  localStrokeBounds(target) {
4076
- return target.__.eraser ? null : target.__layout.localStrokeBounds;
4120
+ return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
4077
4121
  },
4078
4122
  localRenderBounds(target) {
4079
- return target.__.eraser ? null : target.__layout.localRenderBounds;
4123
+ return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
4080
4124
  },
4081
4125
  maskLocalBoxBounds(target) {
4082
4126
  return target.__.mask ? target.__localBoxBounds : null;
@@ -4182,11 +4226,19 @@ const WaitHelper = {
4182
4226
 
4183
4227
  const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
4184
4228
  const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
4229
+ const localContent = '_localContentBounds';
4230
+ const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
4185
4231
  class LeafLayout {
4232
+ get contentBounds() { return this._contentBounds || this.boxBounds; }
4233
+ set contentBounds(bounds) { this._contentBounds = bounds; }
4186
4234
  get strokeBounds() { return this._strokeBounds || this.boxBounds; }
4187
4235
  get renderBounds() { return this._renderBounds || this.boxBounds; }
4236
+ get localContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {})); return this[localContent]; }
4188
4237
  get localStrokeBounds() { return this._localStrokeBounds || this; }
4189
4238
  get localRenderBounds() { return this._localRenderBounds || this; }
4239
+ get worldContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {})); return this[worldContent]; }
4240
+ get worldBoxBounds() { toOuterOf$2(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {})); return this[worldBox]; }
4241
+ get worldStrokeBounds() { toOuterOf$2(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {})); return this[worldStroke]; }
4190
4242
  get a() { return 1; }
4191
4243
  get b() { return 0; }
4192
4244
  get c() { return 0; }
@@ -4269,7 +4321,6 @@ class LeafLayout {
4269
4321
  case 'content':
4270
4322
  if (this.contentBounds)
4271
4323
  return this.contentBounds;
4272
- case 'margin':
4273
4324
  case 'box':
4274
4325
  return this.boxBounds;
4275
4326
  case 'stroke':
@@ -4282,8 +4333,9 @@ class LeafLayout {
4282
4333
  return this.localRenderBounds;
4283
4334
  case 'stroke':
4284
4335
  return this.localStrokeBounds;
4285
- case 'margin':
4286
4336
  case 'content':
4337
+ if (this.contentBounds)
4338
+ return this.localContentBounds;
4287
4339
  case 'box':
4288
4340
  return this.leaf.__localBoxBounds;
4289
4341
  }
@@ -4292,15 +4344,13 @@ class LeafLayout {
4292
4344
  switch (type) {
4293
4345
  case 'render':
4294
4346
  return this.leaf.__world;
4347
+ case 'stroke':
4348
+ return this.worldStrokeBounds;
4295
4349
  case 'content':
4296
4350
  if (this.contentBounds)
4297
- return this.getWorldContentBounds();
4298
- case 'margin':
4351
+ return this.worldContentBounds;
4299
4352
  case 'box':
4300
- return this.getWorldBoxBounds();
4301
- case 'margin':
4302
- case 'stroke':
4303
- return this.getWorldStrokeBounds();
4353
+ return this.worldBoxBounds;
4304
4354
  }
4305
4355
  }
4306
4356
  getLayoutBounds(type, relative = 'world', unscale) {
@@ -4363,20 +4413,24 @@ class LeafLayout {
4363
4413
  points.forEach(point => leaf.innerToWorld(point, null, false, relativeLeaf));
4364
4414
  return points;
4365
4415
  }
4366
- getWorldContentBounds() {
4367
- this._worldContentBounds || (this._worldContentBounds = {});
4368
- toOuterOf$2(this.contentBounds, this.leaf.__world, this._worldContentBounds);
4369
- return this._worldContentBounds;
4416
+ shrinkContent() {
4417
+ const { x, y, width, height } = this.boxBounds;
4418
+ this._contentBounds = { x, y, width, height };
4370
4419
  }
4371
- getWorldBoxBounds() {
4372
- this._worldBoxBounds || (this._worldBoxBounds = {});
4373
- toOuterOf$2(this.boxBounds, this.leaf.__world, this._worldBoxBounds);
4374
- return this._worldBoxBounds;
4420
+ spreadStroke() {
4421
+ const { x, y, width, height } = this.strokeBounds;
4422
+ this._strokeBounds = { x, y, width, height };
4423
+ this._localStrokeBounds = { x, y, width, height };
4424
+ if (!this.renderSpread)
4425
+ this.spreadRenderCancel();
4375
4426
  }
4376
- getWorldStrokeBounds() {
4377
- this._worldStrokeBounds || (this._worldStrokeBounds = {});
4378
- toOuterOf$2(this.strokeBounds, this.leaf.__world, this._worldStrokeBounds);
4379
- return this._worldStrokeBounds;
4427
+ spreadRender() {
4428
+ const { x, y, width, height } = this.renderBounds;
4429
+ this._renderBounds = { x, y, width, height };
4430
+ this._localRenderBounds = { x, y, width, height };
4431
+ }
4432
+ shrinkContentCancel() {
4433
+ this._contentBounds = undefined;
4380
4434
  }
4381
4435
  spreadStrokeCancel() {
4382
4436
  const same = this.renderBounds === this.strokeBounds;
@@ -4389,18 +4443,6 @@ class LeafLayout {
4389
4443
  this._renderBounds = this._strokeBounds;
4390
4444
  this._localRenderBounds = this._localStrokeBounds;
4391
4445
  }
4392
- spreadStroke() {
4393
- const { x, y, width, height } = this.strokeBounds;
4394
- this._strokeBounds = { x, y, width, height };
4395
- this._localStrokeBounds = { x, y, width, height };
4396
- if (!this.renderSpread)
4397
- this.spreadRenderCancel();
4398
- }
4399
- spreadRender() {
4400
- const { x, y, width, height } = this.renderBounds;
4401
- this._renderBounds = { x, y, width, height };
4402
- this._localRenderBounds = { x, y, width, height };
4403
- }
4404
4446
  boxChange() {
4405
4447
  this.boxChanged = true;
4406
4448
  this.localBoxChanged || this.localBoxChange();
@@ -4487,24 +4529,40 @@ const LeafEventer = {
4487
4529
  });
4488
4530
  },
4489
4531
  off(type, listener, options) {
4490
- let capture;
4491
- if (options)
4492
- capture = typeof options === 'boolean' ? options : options.capture;
4493
- let events, index;
4494
- const map = __getListenerMap(this, capture);
4495
- const typeList = typeof type === 'string' ? type.split(' ') : type;
4496
- typeList.forEach(type => {
4497
- if (type) {
4498
- events = map[type];
4499
- if (events) {
4500
- index = events.findIndex(item => item.listener === listener);
4501
- if (index > -1)
4502
- events.splice(index, 1);
4503
- if (!events.length)
4504
- delete map[type];
4505
- }
4532
+ if (type) {
4533
+ const typeList = typeof type === 'string' ? type.split(' ') : type;
4534
+ if (listener) {
4535
+ let capture;
4536
+ if (options)
4537
+ capture = typeof options === 'boolean' ? options : options.capture;
4538
+ let events, index;
4539
+ const map = __getListenerMap(this, capture);
4540
+ typeList.forEach(type => {
4541
+ if (type) {
4542
+ events = map[type];
4543
+ if (events) {
4544
+ index = events.findIndex(item => item.listener === listener);
4545
+ if (index > -1)
4546
+ events.splice(index, 1);
4547
+ if (!events.length)
4548
+ delete map[type];
4549
+ }
4550
+ }
4551
+ });
4506
4552
  }
4507
- });
4553
+ else {
4554
+ const { __bubbleMap: b, __captureMap: c } = this;
4555
+ typeList.forEach(type => {
4556
+ if (b)
4557
+ delete b[type];
4558
+ if (c)
4559
+ delete c[type];
4560
+ });
4561
+ }
4562
+ }
4563
+ else {
4564
+ this.__bubbleMap = this.__captureMap = undefined;
4565
+ }
4508
4566
  },
4509
4567
  on_(type, listener, bind, options) {
4510
4568
  if (bind)
@@ -4768,10 +4826,10 @@ const LeafDataProxy = {
4768
4826
  };
4769
4827
 
4770
4828
  const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
4771
- const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
4829
+ const { toPoint: toPoint$3, tempPoint: tempPoint$1 } = AroundHelper;
4772
4830
  const LeafMatrix = {
4773
4831
  __updateWorldMatrix() {
4774
- multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
4832
+ multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
4775
4833
  },
4776
4834
  __updateLocalMatrix() {
4777
4835
  if (this.__local) {
@@ -4782,18 +4840,18 @@ const LeafMatrix = {
4782
4840
  layout.scaleChanged = layout.rotationChanged = false;
4783
4841
  }
4784
4842
  }
4785
- local.e = data.x;
4786
- local.f = data.y;
4787
- if (data.around) {
4788
- toPoint(data.around, layout.boxBounds, tempPoint$1);
4789
- translateInner(local, -tempPoint$1.x, -tempPoint$1.y);
4843
+ local.e = data.x + data.offsetX;
4844
+ local.f = data.y + data.offsetY;
4845
+ if (data.around || data.origin) {
4846
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
4847
+ translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
4790
4848
  }
4791
4849
  }
4792
4850
  this.__layout.matrixChanged = false;
4793
4851
  }
4794
4852
  };
4795
4853
 
4796
- const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2, hasParentAutoLayout } = LeafHelper;
4854
+ const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
4797
4855
  const { updateBounds: updateBounds$1 } = BranchHelper;
4798
4856
  const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
4799
4857
  const { toBounds: toBounds$2 } = PathBounds;
@@ -4812,7 +4870,6 @@ const LeafBounds = {
4812
4870
  this.__updatePath();
4813
4871
  this.__updateRenderPath();
4814
4872
  this.__updateBoxBounds();
4815
- layout.boxChanged = false;
4816
4873
  layout.resized = true;
4817
4874
  }
4818
4875
  if (layout.localBoxChanged) {
@@ -4826,12 +4883,12 @@ const LeafBounds = {
4826
4883
  if (this.parent)
4827
4884
  this.parent.__layout.boxChange();
4828
4885
  }
4886
+ layout.boxChanged = false;
4829
4887
  if (layout.strokeChanged) {
4830
4888
  layout.strokeSpread = this.__updateStrokeSpread();
4831
4889
  if (layout.strokeSpread) {
4832
- if (layout.strokeBounds === layout.boxBounds) {
4890
+ if (layout.strokeBounds === layout.boxBounds)
4833
4891
  layout.spreadStroke();
4834
- }
4835
4892
  this.__updateStrokeBounds();
4836
4893
  this.__updateLocalStrokeBounds();
4837
4894
  }
@@ -4839,7 +4896,7 @@ const LeafBounds = {
4839
4896
  layout.spreadStrokeCancel();
4840
4897
  }
4841
4898
  layout.strokeChanged = false;
4842
- if (layout.renderSpread)
4899
+ if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
4843
4900
  layout.renderChanged = true;
4844
4901
  if (this.parent)
4845
4902
  this.parent.__layout.strokeChange();
@@ -4848,9 +4905,8 @@ const LeafBounds = {
4848
4905
  if (layout.renderChanged) {
4849
4906
  layout.renderSpread = this.__updateRenderSpread();
4850
4907
  if (layout.renderSpread) {
4851
- if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) {
4908
+ if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
4852
4909
  layout.spreadRender();
4853
- }
4854
4910
  this.__updateRenderBounds();
4855
4911
  this.__updateLocalRenderBounds();
4856
4912
  }
@@ -4890,10 +4946,15 @@ const LeafBounds = {
4890
4946
  __updateAutoLayout() {
4891
4947
  this.__layout.matrixChanged = true;
4892
4948
  if (this.isBranch) {
4893
- if (this.leafer)
4949
+ if (this.leafer && this.leafer.ready)
4894
4950
  this.leafer.layouter.addExtra(this);
4895
- if (hasParentAutoLayout(this)) {
4896
- 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();
4897
4958
  }
4898
4959
  else {
4899
4960
  updateAllMatrix$2(this);
@@ -4910,12 +4971,13 @@ const LeafBounds = {
4910
4971
  data.__naturalHeight = layout.boxBounds.height;
4911
4972
  },
4912
4973
  __updateStrokeBounds() {
4913
- 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);
4914
4976
  },
4915
4977
  __updateRenderBounds() {
4916
- const { renderSpread, strokeBounds, renderBounds } = this.__layout;
4917
- renderSpread > 0 ? copyAndSpread$1(renderBounds, strokeBounds, renderSpread) : copy$5(renderBounds, strokeBounds);
4918
- },
4978
+ const layout = this.__layout;
4979
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
4980
+ }
4919
4981
  };
4920
4982
 
4921
4983
  const LeafRender = {
@@ -4924,6 +4986,8 @@ const LeafRender = {
4924
4986
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
4925
4987
  canvas.opacity = this.__.opacity;
4926
4988
  if (this.__.__single) {
4989
+ if (this.__.eraser === 'path')
4990
+ return this.__renderEraser(canvas, options);
4927
4991
  const tempCanvas = canvas.getSameCanvas(true, true);
4928
4992
  this.__draw(tempCanvas, options);
4929
4993
  if (this.__worldFlipped) {
@@ -4966,6 +5030,8 @@ const BranchRender = {
4966
5030
  __render(canvas, options) {
4967
5031
  if (this.__worldOpacity) {
4968
5032
  if (this.__.__single) {
5033
+ if (this.__.eraser === 'path')
5034
+ return this.__renderEraser(canvas, options);
4969
5035
  const tempCanvas = canvas.getSameCanvas(false, true);
4970
5036
  this.__renderBranch(tempCanvas, options);
4971
5037
  const nowWorld = this.__getNowWorld(options);
@@ -5031,7 +5097,7 @@ let Leaf = class Leaf {
5031
5097
  get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
5032
5098
  get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
5033
5099
  get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
5034
- get pathInputed() { return !!this.__.__pathInputed; }
5100
+ get pathInputed() { return this.__.__pathInputed; }
5035
5101
  constructor(data) {
5036
5102
  this.innerId = create(LEAF);
5037
5103
  this.reset(data);
@@ -5105,7 +5171,9 @@ let Leaf = class Leaf {
5105
5171
  setProxyAttr(_attrName, _newValue) { }
5106
5172
  getProxyAttr(_attrName) { return undefined; }
5107
5173
  find(_condition, _options) { return undefined; }
5174
+ findTag(_tag) { return undefined; }
5108
5175
  findOne(_condition, _options) { return undefined; }
5176
+ findId(_id) { return undefined; }
5109
5177
  focus(_value) { }
5110
5178
  forceUpdate(attrName) {
5111
5179
  if (attrName === undefined)
@@ -5127,9 +5195,11 @@ let Leaf = class Leaf {
5127
5195
  __updateLocalStrokeBounds() { }
5128
5196
  __updateLocalRenderBounds() { }
5129
5197
  __updateBoxBounds() { }
5198
+ __updateContentBounds() { }
5130
5199
  __updateStrokeBounds() { }
5131
5200
  __updateRenderBounds() { }
5132
5201
  __updateAutoLayout() { }
5202
+ __updateFlowLayout() { }
5133
5203
  __updateNaturalSize() { }
5134
5204
  __updateStrokeSpread() { return 0; }
5135
5205
  __updateRenderSpread() { return 0; }
@@ -5137,6 +5207,13 @@ let Leaf = class Leaf {
5137
5207
  __updateEraser(value) {
5138
5208
  this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
5139
5209
  }
5210
+ __renderEraser(canvas, options) {
5211
+ canvas.save();
5212
+ this.__clip(canvas, options);
5213
+ const { renderBounds: r } = this.__layout;
5214
+ canvas.clearRect(r.x, r.y, r.width, r.height);
5215
+ canvas.restore();
5216
+ }
5140
5217
  __updateMask(value) {
5141
5218
  this.__hasMask = value ? true : this.children.some(item => item.__.mask);
5142
5219
  }
@@ -5317,8 +5394,8 @@ let Leaf = class Leaf {
5317
5394
  emit(_type, _event, _capture) { }
5318
5395
  emitEvent(_event, _capture) { }
5319
5396
  hasEvent(_type, _capture) { return false; }
5320
- static changeAttr(attrName, defaultValue) {
5321
- defineDataProcessor(this.prototype, attrName, defaultValue);
5397
+ static changeAttr(attrName, defaultValue, fn) {
5398
+ fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
5322
5399
  }
5323
5400
  static addAttr(attrName, defaultValue, fn) {
5324
5401
  if (!fn)
@@ -5632,6 +5709,9 @@ class LeafLevelList {
5632
5709
  }
5633
5710
  }
5634
5711
 
5712
+ const version = "1.0.0-rc.24";
5713
+ const inviteCode = {};
5714
+
5635
5715
  const debug$7 = Debug.get('LeaferCanvas');
5636
5716
  class LeaferCanvas extends LeaferCanvasBase {
5637
5717
  init() {
@@ -5815,7 +5895,7 @@ function useCanvas(_canvasType, _power) {
5815
5895
  }
5816
5896
  img.onload = () => { resolve(img); };
5817
5897
  img.onerror = (e) => { reject(e); };
5818
- if (!src.startsWith('data:') && !src.startsWith('blob:') && suffix)
5898
+ if (suffix && !src.startsWith('data:') && !src.startsWith('blob:'))
5819
5899
  src += (src.includes("?") ? "&" : "?") + suffix;
5820
5900
  img.src = src;
5821
5901
  });
@@ -6305,7 +6385,7 @@ class Renderer {
6305
6385
  canvas.clear();
6306
6386
  }
6307
6387
  else {
6308
- bounds.spread(1 + 1 / this.canvas.pixelRatio).ceil();
6388
+ bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
6309
6389
  canvas.clearWorld(bounds, true);
6310
6390
  canvas.clipWorld(bounds, true);
6311
6391
  }
@@ -6377,8 +6457,11 @@ class Renderer {
6377
6457
  if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
6378
6458
  this.addBlock(this.canvas.bounds);
6379
6459
  this.target.forceUpdate('surface');
6460
+ return;
6380
6461
  }
6381
6462
  }
6463
+ this.addBlock(new Bounds(0, 0, 1, 1));
6464
+ this.changed = true;
6382
6465
  }
6383
6466
  __onLayoutEnd(event) {
6384
6467
  if (event.data)
@@ -6551,6 +6634,7 @@ class Picker {
6551
6634
  }
6552
6635
 
6553
6636
  const { Yes, NoAndSkip, YesAndSkip } = Answer;
6637
+ const idCondition = {}, classNameCondition = {}, tagCondition = {};
6554
6638
  class Selector {
6555
6639
  constructor(target, userConfig) {
6556
6640
  this.config = {};
@@ -6560,7 +6644,8 @@ class Selector {
6560
6644
  id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
6561
6645
  innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
6562
6646
  className: (leaf, name) => leaf.className === name ? 1 : 0,
6563
- tag: (leaf, name) => leaf.__tag === name ? 1 : 0
6647
+ tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
6648
+ tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
6564
6649
  };
6565
6650
  this.target = target;
6566
6651
  if (userConfig)
@@ -6576,12 +6661,25 @@ class Selector {
6576
6661
  case 'string':
6577
6662
  switch (condition[0]) {
6578
6663
  case '#':
6579
- const leaf = this.getById(condition.substring(1), branch);
6580
- return one ? leaf : (leaf ? [leaf] : []);
6664
+ idCondition.id = condition.substring(1), condition = idCondition;
6665
+ break;
6581
6666
  case '.':
6582
- return this.getByMethod(this.methods.className, branch, one, condition.substring(1));
6667
+ classNameCondition.className = condition.substring(1), condition = classNameCondition;
6668
+ break;
6583
6669
  default:
6584
- return this.getByMethod(this.methods.tag, branch, one, condition);
6670
+ tagCondition.tag = condition, condition = tagCondition;
6671
+ }
6672
+ case 'object':
6673
+ if (condition.id !== undefined) {
6674
+ const leaf = this.getById(condition.id, branch);
6675
+ return one ? leaf : (leaf ? [leaf] : []);
6676
+ }
6677
+ else if (condition.tag) {
6678
+ const { tag } = condition, isArray = tag instanceof Array;
6679
+ return this.getByMethod(isArray ? this.methods.tags : this.methods.tag, branch, one, isArray ? DataHelper.toMap(tag) : tag);
6680
+ }
6681
+ else {
6682
+ return this.getByMethod(this.methods.className, branch, one, condition.className);
6585
6683
  }
6586
6684
  case 'function':
6587
6685
  return this.getByMethod(condition, branch, one, options);
@@ -6704,10 +6802,11 @@ function stateType(defaultValue) {
6704
6802
  function arrowType(defaultValue) {
6705
6803
  return decorateLeafAttr(defaultValue, (key) => attr({
6706
6804
  set(value) {
6707
- this.__setAttr(key, value);
6708
- const data = this.__;
6709
- data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6710
- 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
+ }
6711
6810
  }
6712
6811
  }));
6713
6812
  }
@@ -6880,7 +6979,7 @@ class UIData extends LeafData {
6880
6979
  const UnitConvert = {
6881
6980
  number(value, percentRefer) {
6882
6981
  if (typeof value === 'object')
6883
- return value.type === 'percent' ? value.value / 100 * percentRefer : value.value;
6982
+ return value.type === 'percent' ? value.value * percentRefer : value.value;
6884
6983
  return value;
6885
6984
  }
6886
6985
  };
@@ -6889,7 +6988,7 @@ class GroupData extends UIData {
6889
6988
  }
6890
6989
 
6891
6990
  class BoxData extends GroupData {
6892
- get __boxStroke() { return true; }
6991
+ get __boxStroke() { return !this.__pathInputed; }
6893
6992
  }
6894
6993
 
6895
6994
  class LeaferData extends GroupData {
@@ -6902,11 +7001,11 @@ class LineData extends UIData {
6902
7001
  }
6903
7002
 
6904
7003
  class RectData extends UIData {
6905
- get __boxStroke() { return true; }
7004
+ get __boxStroke() { return !this.__pathInputed; }
6906
7005
  }
6907
7006
 
6908
7007
  class EllipseData extends UIData {
6909
- get __boxStroke() { return true; }
7008
+ get __boxStroke() { return !this.__pathInputed; }
6910
7009
  }
6911
7010
 
6912
7011
  class PolygonData extends UIData {
@@ -6933,6 +7032,7 @@ const fontWeightMap = {
6933
7032
  'black': 900
6934
7033
  };
6935
7034
  class TextData extends UIData {
7035
+ get __useNaturalRatio() { return false; }
6936
7036
  setFontWeight(value) {
6937
7037
  if (typeof value === 'string') {
6938
7038
  this.__setInput('fontWeight', value);
@@ -6974,19 +7074,18 @@ class CanvasData extends RectData {
6974
7074
  const UIBounds = {
6975
7075
  __updateStrokeSpread() {
6976
7076
  let width = 0, boxWidth = 0;
6977
- const { stroke, hitStroke, strokeAlign, strokeWidth } = this.__;
6978
- if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
7077
+ const data = this.__, { strokeAlign, strokeWidth } = data;
7078
+ if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
6979
7079
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
6980
- if (!this.__.__boxStroke) {
6981
- const { miterLimit, strokeCap } = this.__;
6982
- const miterLimitAddWidth = this.__tag !== 'Line' ? 1 / Math.sin(miterLimit * OneRadian / 2) * Math.sqrt(strokeWidth) - width : 0;
6983
- 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;
6984
7083
  width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
6985
7084
  }
6986
7085
  }
6987
- this.__layout.strokeBoxSpread = boxWidth;
6988
- if (this.__.__useArrow)
7086
+ if (data.__useArrow)
6989
7087
  width += strokeWidth * 5;
7088
+ this.__layout.strokeBoxSpread = boxWidth;
6990
7089
  return width;
6991
7090
  },
6992
7091
  __updateRenderSpread() {
@@ -7006,7 +7105,7 @@ const UIBounds = {
7006
7105
  if (backgroundBlur)
7007
7106
  shapeWidth = Math.max(shapeWidth, backgroundBlur);
7008
7107
  this.__layout.renderShapeSpread = shapeWidth;
7009
- return width;
7108
+ return width + (this.__layout.strokeSpread || 0);
7010
7109
  }
7011
7110
  };
7012
7111
 
@@ -7097,7 +7196,7 @@ function drawFast(ui, canvas, options) {
7097
7196
 
7098
7197
  const RectRender = {
7099
7198
  __drawFast(canvas, options) {
7100
- const { width, height, fill, stroke, __drawAfterFill } = this.__;
7199
+ let { width, height, fill, stroke, __drawAfterFill } = this.__;
7101
7200
  if (fill) {
7102
7201
  canvas.fillStyle = fill;
7103
7202
  canvas.fillRect(0, 0, width, height);
@@ -7115,7 +7214,16 @@ const RectRender = {
7115
7214
  canvas.strokeRect(0, 0, width, height);
7116
7215
  break;
7117
7216
  case 'inside':
7118
- 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
+ }
7119
7227
  break;
7120
7228
  case 'outside':
7121
7229
  canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
@@ -7143,11 +7251,14 @@ let UI = UI_1 = class UI extends Leaf {
7143
7251
  return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
7144
7252
  }
7145
7253
  get pen() {
7146
- pen.set(this.path = this.__.path || []);
7254
+ const { path } = this.__;
7255
+ pen.set(this.path = path || []);
7256
+ if (!path)
7257
+ this.__drawPathByBox(pen);
7147
7258
  return pen;
7148
7259
  }
7149
7260
  get editConfig() { return undefined; }
7150
- get editOuter() { return 'EditTool'; }
7261
+ get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
7151
7262
  get editInner() { return 'PathEditor'; }
7152
7263
  constructor(data) {
7153
7264
  super(data);
@@ -7161,22 +7272,22 @@ let UI = UI_1 = class UI extends Leaf {
7161
7272
  }
7162
7273
  createProxyData() { return undefined; }
7163
7274
  find(_condition, _options) { return undefined; }
7275
+ findTag(tag) { return this.find({ tag }); }
7164
7276
  findOne(_condition, _options) { return undefined; }
7277
+ findId(id) { return this.findOne({ id }); }
7165
7278
  getPath(curve, pathForRender) {
7166
7279
  this.__layout.update();
7167
7280
  let path = pathForRender ? this.__.__pathForRender : this.__.path;
7168
- if (!path) {
7169
- const { width, height } = this.boxBounds;
7170
- if (width || height) {
7171
- pen.set(path = []);
7172
- this.__drawPathByBox(pen);
7173
- }
7174
- }
7281
+ if (!path)
7282
+ pen.set(path = []), this.__drawPathByBox(pen);
7175
7283
  return curve ? PathConvert.toCanvasData(path, true) : path;
7176
7284
  }
7177
7285
  getPathString(curve, pathForRender) {
7178
7286
  return PathConvert.stringify(this.getPath(curve, pathForRender));
7179
7287
  }
7288
+ load() {
7289
+ this.__.__computePaint();
7290
+ }
7180
7291
  __onUpdateSize() {
7181
7292
  if (this.__.__input) {
7182
7293
  const data = this.__;
@@ -7262,7 +7373,7 @@ __decorate([
7262
7373
  opacityType(1)
7263
7374
  ], UI.prototype, "opacity", void 0);
7264
7375
  __decorate([
7265
- opacityType(true)
7376
+ visibleType(true)
7266
7377
  ], UI.prototype, "visible", void 0);
7267
7378
  __decorate([
7268
7379
  stateType(false)
@@ -7279,9 +7390,6 @@ __decorate([
7279
7390
  __decorate([
7280
7391
  maskType(false)
7281
7392
  ], UI.prototype, "mask", void 0);
7282
- __decorate([
7283
- surfaceType('pixel')
7284
- ], UI.prototype, "maskType", void 0);
7285
7393
  __decorate([
7286
7394
  eraserType(false)
7287
7395
  ], UI.prototype, "eraser", void 0);
@@ -7312,9 +7420,75 @@ __decorate([
7312
7420
  __decorate([
7313
7421
  rotationType(0, true)
7314
7422
  ], UI.prototype, "skewY", void 0);
7423
+ __decorate([
7424
+ positionType(0, true)
7425
+ ], UI.prototype, "offsetX", void 0);
7426
+ __decorate([
7427
+ positionType(0, true)
7428
+ ], UI.prototype, "offsetY", void 0);
7429
+ __decorate([
7430
+ positionType(0, true)
7431
+ ], UI.prototype, "scrollX", void 0);
7432
+ __decorate([
7433
+ positionType(0, true)
7434
+ ], UI.prototype, "scrollY", void 0);
7435
+ __decorate([
7436
+ autoLayoutType()
7437
+ ], UI.prototype, "origin", void 0);
7315
7438
  __decorate([
7316
7439
  autoLayoutType()
7317
7440
  ], UI.prototype, "around", void 0);
7441
+ __decorate([
7442
+ dataType(false)
7443
+ ], UI.prototype, "lazy", void 0);
7444
+ __decorate([
7445
+ naturalBoundsType(1)
7446
+ ], UI.prototype, "pixelRatio", void 0);
7447
+ __decorate([
7448
+ pathInputType()
7449
+ ], UI.prototype, "path", void 0);
7450
+ __decorate([
7451
+ pathType()
7452
+ ], UI.prototype, "windingRule", void 0);
7453
+ __decorate([
7454
+ pathType(true)
7455
+ ], UI.prototype, "closed", void 0);
7456
+ __decorate([
7457
+ autoLayoutType(false)
7458
+ ], UI.prototype, "flow", void 0);
7459
+ __decorate([
7460
+ boundsType(0)
7461
+ ], UI.prototype, "padding", void 0);
7462
+ __decorate([
7463
+ boundsType(0)
7464
+ ], UI.prototype, "gap", void 0);
7465
+ __decorate([
7466
+ boundsType('top-left')
7467
+ ], UI.prototype, "align", void 0);
7468
+ __decorate([
7469
+ boundsType(false)
7470
+ ], UI.prototype, "wrap", void 0);
7471
+ __decorate([
7472
+ boundsType('box')
7473
+ ], UI.prototype, "itemBox", void 0);
7474
+ __decorate([
7475
+ boundsType(true)
7476
+ ], UI.prototype, "inFlow", void 0);
7477
+ __decorate([
7478
+ boundsType()
7479
+ ], UI.prototype, "autoWidth", void 0);
7480
+ __decorate([
7481
+ boundsType()
7482
+ ], UI.prototype, "autoHeight", void 0);
7483
+ __decorate([
7484
+ boundsType()
7485
+ ], UI.prototype, "autoBox", void 0);
7486
+ __decorate([
7487
+ boundsType()
7488
+ ], UI.prototype, "widthRange", void 0);
7489
+ __decorate([
7490
+ boundsType()
7491
+ ], UI.prototype, "heightRange", void 0);
7318
7492
  __decorate([
7319
7493
  dataType(false)
7320
7494
  ], UI.prototype, "draggable", void 0);
@@ -7324,9 +7498,6 @@ __decorate([
7324
7498
  __decorate([
7325
7499
  dataType(false)
7326
7500
  ], UI.prototype, "editable", void 0);
7327
- __decorate([
7328
- dataType('size')
7329
- ], UI.prototype, "editSize", void 0);
7330
7501
  __decorate([
7331
7502
  hitType(true)
7332
7503
  ], UI.prototype, "hittable", void 0);
@@ -7381,21 +7552,6 @@ __decorate([
7381
7552
  __decorate([
7382
7553
  strokeType(10)
7383
7554
  ], UI.prototype, "miterLimit", void 0);
7384
- __decorate([
7385
- dataType(false)
7386
- ], UI.prototype, "lazy", void 0);
7387
- __decorate([
7388
- naturalBoundsType(1)
7389
- ], UI.prototype, "pixelRatio", void 0);
7390
- __decorate([
7391
- pathInputType()
7392
- ], UI.prototype, "path", void 0);
7393
- __decorate([
7394
- pathType()
7395
- ], UI.prototype, "windingRule", void 0);
7396
- __decorate([
7397
- pathType(true)
7398
- ], UI.prototype, "closed", void 0);
7399
7555
  __decorate([
7400
7556
  arrowType('none')
7401
7557
  ], UI.prototype, "startArrow", void 0);
@@ -7526,6 +7682,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7526
7682
  get layoutLocked() { return !this.layouter.running; }
7527
7683
  get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7528
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(); }
7529
7686
  constructor(userConfig, data) {
7530
7687
  super(data);
7531
7688
  this.config = {
@@ -7629,9 +7786,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7629
7786
  const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
7630
7787
  Object.keys(data).forEach(key => this[key] = data[key]);
7631
7788
  }
7632
- forceFullRender() {
7633
- this.forceRender();
7634
- }
7635
7789
  forceRender(bounds) {
7636
7790
  this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
7637
7791
  if (this.viewReady)
@@ -7686,7 +7840,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7686
7840
  this.__changeFill(newValue);
7687
7841
  }
7688
7842
  else if (attrName === 'hittable') {
7689
- this.canvas.hittable = newValue;
7843
+ if (!this.parent)
7844
+ this.canvas.hittable = newValue;
7690
7845
  }
7691
7846
  }
7692
7847
  return super.__setAttr(attrName, newValue);
@@ -7709,7 +7864,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7709
7864
  this.canvas.backgroundColor = newValue;
7710
7865
  }
7711
7866
  else {
7712
- this.forceFullRender();
7867
+ this.forceRender();
7713
7868
  }
7714
7869
  }
7715
7870
  __onCreated() {
@@ -7804,6 +7959,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7804
7959
  zoom(_zoomType, _padding, _fixedScale) { return undefined; }
7805
7960
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
7806
7961
  getValidScale(changeScale) { return changeScale; }
7962
+ getWorldPointByClient(clientPoint, updateClient) {
7963
+ return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
7964
+ }
7807
7965
  __checkUpdateLayout() {
7808
7966
  this.__layout.update();
7809
7967
  }
@@ -7886,8 +8044,8 @@ Rect = __decorate([
7886
8044
 
7887
8045
  const rect$1 = Rect.prototype;
7888
8046
  const group$1 = Group.prototype;
7889
- const bounds$1 = {};
7890
- const { copy: copy$3, add } = BoundsHelper;
8047
+ const childrenRenderBounds = {};
8048
+ const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
7891
8049
  let Box = class Box extends Group {
7892
8050
  get __tag() { return 'Box'; }
7893
8051
  get isBranchLeaf() { return true; }
@@ -7898,24 +8056,29 @@ let Box = class Box extends Group {
7898
8056
  __updateStrokeSpread() { return 0; }
7899
8057
  __updateRectRenderSpread() { return 0; }
7900
8058
  __updateRenderSpread() {
7901
- const width = this.__updateRectRenderSpread();
7902
- const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
7903
- return (width || hide) ? width : -1;
8059
+ return this.__updateRectRenderSpread() || -1;
7904
8060
  }
7905
8061
  __updateRectBoxBounds() { }
7906
8062
  __updateBoxBounds() {
7907
8063
  const data = this.__;
7908
- if (data.__autoSide && this.children.length) {
7909
- if (this.leafer)
7910
- this.leafer.layouter.addExtra(this);
7911
- super.__updateBoxBounds();
7912
- if (!data.__autoSize) {
7913
- const b = this.__layout.boxBounds;
7914
- if (!data.__autoWidth)
7915
- b.x = 0, b.width = data.width;
7916
- if (!data.__autoHeight)
7917
- 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();
7918
8079
  }
8080
+ if (data.flow)
8081
+ this.__updateContentBounds();
7919
8082
  }
7920
8083
  else {
7921
8084
  this.__updateRectBoxBounds();
@@ -7923,13 +8086,20 @@ let Box = class Box extends Group {
7923
8086
  }
7924
8087
  __updateStrokeBounds() { }
7925
8088
  __updateRenderBounds() {
7926
- this.__updateRectRenderBounds();
7927
- if (!this.__.__drawAfterFill) {
7928
- const { renderBounds } = this.__layout;
7929
- copy$3(bounds$1, renderBounds);
8089
+ let isOverflow;
8090
+ const { renderBounds } = this.__layout;
8091
+ if (this.children.length) {
7930
8092
  super.__updateRenderBounds();
7931
- 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();
7932
8099
  }
8100
+ this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8101
+ if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
8102
+ add(renderBounds, childrenRenderBounds);
7933
8103
  }
7934
8104
  __updateRectRenderBounds() { }
7935
8105
  __updateRectChange() { }
@@ -7945,16 +8115,27 @@ let Box = class Box extends Group {
7945
8115
  }
7946
8116
  else {
7947
8117
  this.__renderRect(canvas, options);
7948
- this.__renderGroup(canvas, options);
8118
+ if (this.children.length)
8119
+ this.__renderGroup(canvas, options);
7949
8120
  }
7950
8121
  }
7951
8122
  __drawAfterFill(canvas, options) {
7952
- canvas.save();
7953
- canvas.clip();
7954
- this.__renderGroup(canvas, options);
7955
- canvas.restore();
7956
- 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);
7957
8137
  this.__drawRenderPath(canvas);
8138
+ }
7958
8139
  }
7959
8140
  };
7960
8141
  __decorate([
@@ -8092,9 +8273,10 @@ let Line = class Line extends UI {
8092
8273
  super(data);
8093
8274
  }
8094
8275
  __updatePath() {
8095
- const path = this.__.path = [];
8096
- if (this.__.points) {
8097
- 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);
8098
8280
  }
8099
8281
  else {
8100
8282
  moveTo$2(path, 0, 0);
@@ -8329,7 +8511,7 @@ Canvas = __decorate([
8329
8511
  registerUI()
8330
8512
  ], Canvas);
8331
8513
 
8332
- const { copyAndSpread, includes, spread, setList } = BoundsHelper;
8514
+ const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
8333
8515
  let Text = class Text extends UI {
8334
8516
  get __tag() { return 'Text'; }
8335
8517
  get editInner() { return 'TextEditor'; }
@@ -8402,7 +8584,7 @@ let Text = class Text extends UI {
8402
8584
  if (italic)
8403
8585
  b.width += fontSize * 0.16;
8404
8586
  const contentBounds = includes(b, bounds) ? b : bounds;
8405
- if (contentBounds !== layout.contentBounds) {
8587
+ if (!isSame$1(contentBounds, layout.contentBounds)) {
8406
8588
  layout.contentBounds = contentBounds;
8407
8589
  layout.renderChanged = true;
8408
8590
  setList(data.__textBoxBounds = {}, [b, bounds]);
@@ -8430,9 +8612,6 @@ __decorate([
8430
8612
  __decorate([
8431
8613
  boundsType(0)
8432
8614
  ], Text.prototype, "height", void 0);
8433
- __decorate([
8434
- boundsType(0)
8435
- ], Text.prototype, "padding", void 0);
8436
8615
  __decorate([
8437
8616
  surfaceType('#000000')
8438
8617
  ], Text.prototype, "fill", void 0);
@@ -8467,7 +8646,7 @@ __decorate([
8467
8646
  boundsType(0)
8468
8647
  ], Text.prototype, "letterSpacing", void 0);
8469
8648
  __decorate([
8470
- boundsType({ type: 'percent', value: 150 })
8649
+ boundsType({ type: 'percent', value: 1.5 })
8471
8650
  ], Text.prototype, "lineHeight", void 0);
8472
8651
  __decorate([
8473
8652
  boundsType(0)
@@ -8561,8 +8740,6 @@ function penPathType() {
8561
8740
  };
8562
8741
  }
8563
8742
 
8564
- const version = "1.0.0-rc.21";
8565
-
8566
8743
  let App = class App extends Leafer {
8567
8744
  get __tag() { return 'App'; }
8568
8745
  get isApp() { return true; }
@@ -8655,8 +8832,10 @@ let App = class App extends Leafer {
8655
8832
  this.renderer.update();
8656
8833
  }
8657
8834
  __render(canvas, options) {
8658
- if (options.matrix)
8659
- canvas.setWorld(options.matrix);
8835
+ if (options.matrix) {
8836
+ const { a, b, c, d, e, f } = options.matrix;
8837
+ canvas.setTransform(a, b, c, d, e, f);
8838
+ }
8660
8839
  this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
8661
8840
  }
8662
8841
  __onResize(event) {
@@ -9660,8 +9839,8 @@ class InteractionBase {
9660
9839
  }
9661
9840
  tap(data) {
9662
9841
  const { pointer } = this.config;
9663
- const longTap = this.longTap(data);
9664
- if (!pointer.tapMore && longTap)
9842
+ const hasLong = this.longTap(data);
9843
+ if (!pointer.tapMore && hasLong)
9665
9844
  return;
9666
9845
  if (!this.waitTap)
9667
9846
  return;
@@ -9783,6 +9962,10 @@ class InteractionBase {
9783
9962
  setCursor(cursor) {
9784
9963
  this.cursor = cursor;
9785
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
+ }
9786
9969
  emitTap(data) {
9787
9970
  this.emit(PointerEvent.TAP, data);
9788
9971
  this.emit(PointerEvent.CLICK, data);
@@ -9812,14 +9995,14 @@ class InteractionBase {
9812
9995
  }, this.config.pointer.longPressTime);
9813
9996
  }
9814
9997
  longTap(data) {
9815
- let longTap;
9998
+ let hasLong;
9816
9999
  if (this.longPressed) {
9817
10000
  this.emit(PointerEvent.LONG_TAP, data);
9818
- if (pathHasEventType(data.path, PointerEvent.LONG_TAP))
9819
- longTap = true;
10001
+ if (pathHasEventType(data.path, PointerEvent.LONG_TAP) || pathHasEventType(data.path, PointerEvent.LONG_PRESS))
10002
+ hasLong = true;
9820
10003
  }
9821
10004
  this.longPressWaitCancel();
9822
- return longTap;
10005
+ return hasLong;
9823
10006
  }
9824
10007
  longPressWaitCancel() {
9825
10008
  clearTimeout(this.longPressTimer);
@@ -10177,12 +10360,6 @@ class Interaction extends InteractionBase {
10177
10360
  this.windowEvents = {};
10178
10361
  }
10179
10362
  }
10180
- getLocal(p, updateClient) {
10181
- if (updateClient)
10182
- this.canvas.updateClientBounds();
10183
- const { clientBounds } = this.canvas;
10184
- return { x: p.clientX - clientBounds.x, y: p.clientY - clientBounds.y };
10185
- }
10186
10363
  getTouches(touches) {
10187
10364
  const list = [];
10188
10365
  for (let i = 0, len = touches.length; i < len; i++) {
@@ -10619,7 +10796,7 @@ function shape(ui, current, options) {
10619
10796
  }
10620
10797
  else {
10621
10798
  const { renderShapeSpread: spread } = ui.__layout;
10622
- const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread * scaleY) : current.bounds, nowWorld);
10799
+ const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
10623
10800
  fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
10624
10801
  let { a: fitScaleX, d: fitScaleY } = fitMatrix;
10625
10802
  if (fitMatrix.a < 1) {
@@ -10719,10 +10896,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
10719
10896
  rotate(transform, rotation);
10720
10897
  data.transform = transform;
10721
10898
  }
10722
- function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around) {
10899
+ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
10723
10900
  const transform = get$4();
10724
10901
  if (rotation) {
10725
- if (around === 'center') {
10902
+ if (align === 'center') {
10726
10903
  rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
10727
10904
  }
10728
10905
  else {
@@ -10755,12 +10932,12 @@ function createData(leafPaint, image, paint, box) {
10755
10932
  let { width, height } = image;
10756
10933
  if (paint.padding)
10757
10934
  box = tempBox.set(box).shrink(paint.padding);
10758
- const { opacity, mode, around, offset, scale, size, rotation, blendMode, repeat } = paint;
10935
+ const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
10759
10936
  const sameBox = box.width === width && box.height === height;
10760
10937
  if (blendMode)
10761
10938
  leafPaint.blendMode = blendMode;
10762
10939
  const data = leafPaint.data = { mode };
10763
- const swapSize = around !== 'center' && (rotation || 0) % 180 === 90;
10940
+ const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
10764
10941
  const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
10765
10942
  let x = 0, y = 0, scaleX, scaleY;
10766
10943
  if (!mode || mode === 'cover' || mode === 'fit') {
@@ -10778,11 +10955,11 @@ function createData(leafPaint, image, paint, box) {
10778
10955
  scaleX = typeof scale === 'number' ? scale : scale.x;
10779
10956
  scaleY = typeof scale === 'number' ? scale : scale.y;
10780
10957
  }
10781
- if (around) {
10958
+ if (align) {
10782
10959
  const imageBounds = { x, y, width: swapWidth, height: swapHeight };
10783
10960
  if (scaleX)
10784
10961
  imageBounds.width *= scaleX, imageBounds.height *= scaleY;
10785
- AroundHelper.toPoint(around, box, tempPoint, true, imageBounds);
10962
+ AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
10786
10963
  x += tempPoint.x, y += tempPoint.y;
10787
10964
  }
10788
10965
  if (offset)
@@ -10799,7 +10976,7 @@ function createData(leafPaint, image, paint, box) {
10799
10976
  break;
10800
10977
  case 'repeat':
10801
10978
  if (!sameBox || scaleX || rotation)
10802
- repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around);
10979
+ repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
10803
10980
  if (!repeat)
10804
10981
  data.repeat = 'repeat';
10805
10982
  break;
@@ -11070,13 +11247,14 @@ const PaintImageModule = {
11070
11247
  recycleImage
11071
11248
  };
11072
11249
 
11073
- const defaultFrom$2 = { x: 0.5, y: 0 };
11074
- const defaultTo$2 = { x: 0.5, y: 1 };
11250
+ const { toPoint: toPoint$2 } = AroundHelper;
11251
+ const realFrom$2 = {};
11252
+ const realTo$2 = {};
11075
11253
  function linearGradient(paint, box) {
11076
11254
  let { from, to, type, blendMode, opacity } = paint;
11077
- from || (from = defaultFrom$2);
11078
- to || (to = defaultTo$2);
11079
- 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);
11080
11258
  applyStops(style, paint.stops, opacity);
11081
11259
  const data = { type, style };
11082
11260
  if (blendMode)
@@ -11087,23 +11265,25 @@ function applyStops(gradient, stops, opacity) {
11087
11265
  let stop;
11088
11266
  for (let i = 0, len = stops.length; i < len; i++) {
11089
11267
  stop = stops[i];
11090
- 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
+ }
11091
11274
  }
11092
11275
  }
11093
11276
 
11094
- const { set: set$1, getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
11277
+ const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
11095
11278
  const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
11096
- const defaultFrom$1 = { x: 0.5, y: 0.5 };
11097
- const defaultTo$1 = { x: 0.5, y: 1 };
11279
+ const { toPoint: toPoint$1 } = AroundHelper;
11098
11280
  const realFrom$1 = {};
11099
11281
  const realTo$1 = {};
11100
11282
  function radialGradient(paint, box) {
11101
11283
  let { from, to, type, opacity, blendMode, stretch } = paint;
11102
- from || (from = defaultFrom$1);
11103
- to || (to = defaultTo$1);
11104
- const { x, y, width, height } = box;
11105
- set$1(realFrom$1, x + from.x * width, y + from.y * height);
11106
- 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;
11107
11287
  let transform;
11108
11288
  if (width !== height || stretch) {
11109
11289
  transform = get$1();
@@ -11118,19 +11298,16 @@ function radialGradient(paint, box) {
11118
11298
  return data;
11119
11299
  }
11120
11300
 
11121
- const { set, getAngle, getDistance } = PointHelper;
11301
+ const { getAngle, getDistance } = PointHelper;
11122
11302
  const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
11123
- const defaultFrom = { x: 0.5, y: 0.5 };
11124
- const defaultTo = { x: 0.5, y: 1 };
11303
+ const { toPoint } = AroundHelper;
11125
11304
  const realFrom = {};
11126
11305
  const realTo = {};
11127
11306
  function conicGradient(paint, box) {
11128
11307
  let { from, to, type, opacity, blendMode, stretch } = paint;
11129
- from || (from = defaultFrom);
11130
- to || (to = defaultTo);
11131
- const { x, y, width, height } = box;
11132
- set(realFrom, x + from.x * width, y + from.y * height);
11133
- 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;
11134
11311
  const transform = get();
11135
11312
  const angle = getAngle(realFrom, realTo);
11136
11313
  if (Platform.conicGradientRotate90) {
@@ -11284,7 +11461,7 @@ Group.prototype.__renderMask = function (canvas, options) {
11284
11461
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
11285
11462
  maskCanvas = contentCanvas = null;
11286
11463
  }
11287
- if (child.__.maskType === 'path') {
11464
+ if (child.__.mask === 'path') {
11288
11465
  if (child.opacity < 1) {
11289
11466
  currentMask = 'opacity-path';
11290
11467
  maskOpacity = child.opacity;
@@ -11305,7 +11482,7 @@ Group.prototype.__renderMask = function (canvas, options) {
11305
11482
  contentCanvas = getCanvas(canvas);
11306
11483
  child.__render(maskCanvas, options);
11307
11484
  }
11308
- if (child.__.maskType !== 'clipping')
11485
+ if (child.__.mask !== 'clipping')
11309
11486
  continue;
11310
11487
  }
11311
11488
  if (excludeRenderBounds(child, options))
@@ -11606,11 +11783,11 @@ function layoutChar(drawData, style, width, _height) {
11606
11783
  if (mode === WordMode) {
11607
11784
  wordChar = { char: '', x: charX };
11608
11785
  charX = toWordChar(word.data, charX, wordChar);
11609
- if (wordChar.char !== ' ')
11786
+ if (row.isOverflow || wordChar.char !== ' ')
11610
11787
  row.data.push(wordChar);
11611
11788
  }
11612
11789
  else {
11613
- charX = toChar(word.data, charX, row.data);
11790
+ charX = toChar(word.data, charX, row.data, row.isOverflow);
11614
11791
  }
11615
11792
  if (!row.paraEnd && addWordWidth) {
11616
11793
  charX += addWordWidth;
@@ -11637,9 +11814,9 @@ function toWordChar(data, charX, wordChar) {
11637
11814
  });
11638
11815
  return charX;
11639
11816
  }
11640
- function toChar(data, charX, rowData) {
11817
+ function toChar(data, charX, rowData, isOverflow) {
11641
11818
  data.forEach(char => {
11642
- if (char.char !== ' ') {
11819
+ if (isOverflow || char.char !== ' ') {
11643
11820
  char.x = charX;
11644
11821
  rowData.push(char);
11645
11822
  }
@@ -11671,12 +11848,14 @@ function layoutText(drawData, style) {
11671
11848
  for (let i = 0, len = rows.length; i < len; i++) {
11672
11849
  row = rows[i];
11673
11850
  row.x = x;
11674
- switch (textAlign) {
11675
- case 'center':
11676
- row.x += (width - row.width) / 2;
11677
- break;
11678
- case 'right':
11679
- 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
+ }
11680
11859
  }
11681
11860
  if (row.paraStart && paraSpacing && i > 0)
11682
11861
  starY += paraSpacing;
@@ -11716,11 +11895,13 @@ function clipText(drawData, style) {
11716
11895
  const { rows, overflow } = drawData;
11717
11896
  let { textOverflow } = style;
11718
11897
  rows.splice(overflow);
11719
- if (textOverflow !== 'hide') {
11720
- if (textOverflow === 'ellipsis')
11898
+ if (textOverflow && textOverflow !== 'show') {
11899
+ if (textOverflow === 'hide')
11900
+ textOverflow = '';
11901
+ else if (textOverflow === 'ellipsis')
11721
11902
  textOverflow = '...';
11722
11903
  let char, charRight;
11723
- const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
11904
+ const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0;
11724
11905
  const right = style.x + style.width - ellipsisWidth;
11725
11906
  const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
11726
11907
  list.forEach(row => {
@@ -11888,8 +12069,12 @@ const ExportModule = {
11888
12069
  let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
11889
12070
  const { worldTransform, isLeafer, isFrame } = leaf;
11890
12071
  const { slice, trim, onCanvas } = options;
11891
- const scale = options.scale || 1;
11892
- const pixelRatio = options.pixelRatio || 1;
12072
+ let scale = options.scale || 1;
12073
+ let pixelRatio = options.pixelRatio || 1;
12074
+ if (leaf.isApp) {
12075
+ scale *= pixelRatio;
12076
+ pixelRatio = leaf.app.pixelRatio;
12077
+ }
11893
12078
  const screenshot = options.screenshot || leaf.isApp;
11894
12079
  const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
11895
12080
  const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
@@ -12030,4 +12215,4 @@ window.addEventListener('unload', () => {
12030
12215
  ImageManager.destroy();
12031
12216
  });
12032
12217
 
12033
- export { 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 };