@leafer-ui/miniapp 1.0.0-rc.19 → 1.0.0-rc.20

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.
@@ -1,5 +1,6 @@
1
1
  const Platform = {
2
2
  image: {
3
+ hitCanvasSize: 100,
3
4
  maxCacheSize: 2560 * 1600,
4
5
  maxPatternSize: 4096 * 2160,
5
6
  suffix: 'leaf',
@@ -41,7 +42,7 @@ const MathHelper = {
41
42
  minus(value, isFourNumber) {
42
43
  if (value instanceof Array) {
43
44
  if (isFourNumber)
44
- value = MathHelper.fourNumber(value);
45
+ value = MathHelper.fourNumber(value, 0);
45
46
  for (let i = 0; i < value.length; i++)
46
47
  value[i] = -value[i];
47
48
  }
@@ -55,7 +56,7 @@ const MathHelper = {
55
56
  if (num instanceof Array) {
56
57
  switch (num.length) {
57
58
  case 4:
58
- data = num;
59
+ data = maxValue === undefined ? num : [...num];
59
60
  break;
60
61
  case 2:
61
62
  data = [num[0], num[1], num[0], num[1]];
@@ -116,7 +117,7 @@ function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
116
117
 
117
118
  const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
118
119
  const { float: float$1 } = MathHelper;
119
- const tempPoint$2 = {};
120
+ const tempPoint$3 = {};
120
121
  function getWorld() {
121
122
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
122
123
  }
@@ -157,8 +158,8 @@ const MatrixHelper = {
157
158
  t.d *= scaleY;
158
159
  },
159
160
  scaleOfOuter(t, origin, scaleX, scaleY) {
160
- M$6.toInnerPoint(t, origin, tempPoint$2);
161
- M$6.scaleOfInner(t, tempPoint$2, scaleX, scaleY);
161
+ M$6.toInnerPoint(t, origin, tempPoint$3);
162
+ M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
162
163
  },
163
164
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
164
165
  M$6.translateInner(t, origin.x, origin.y);
@@ -176,8 +177,8 @@ const MatrixHelper = {
176
177
  t.d = c * sinR + d * cosR;
177
178
  },
178
179
  rotateOfOuter(t, origin, rotation) {
179
- M$6.toInnerPoint(t, origin, tempPoint$2);
180
- M$6.rotateOfInner(t, tempPoint$2, rotation);
180
+ M$6.toInnerPoint(t, origin, tempPoint$3);
181
+ M$6.rotateOfInner(t, tempPoint$3, rotation);
181
182
  },
182
183
  rotateOfInner(t, origin, rotation) {
183
184
  M$6.translateInner(t, origin.x, origin.y);
@@ -198,8 +199,8 @@ const MatrixHelper = {
198
199
  }
199
200
  },
200
201
  skewOfOuter(t, origin, skewX, skewY) {
201
- M$6.toInnerPoint(t, origin, tempPoint$2);
202
- M$6.skewOfInner(t, tempPoint$2, skewX, skewY);
202
+ M$6.toInnerPoint(t, origin, tempPoint$3);
203
+ M$6.skewOfInner(t, tempPoint$3, skewX, skewY);
203
204
  },
204
205
  skewOfInner(t, origin, skewX, skewY = 0) {
205
206
  M$6.translateInner(t, origin.x, origin.y);
@@ -446,19 +447,19 @@ const PointHelper = {
446
447
  },
447
448
  tempToInnerOf(t, matrix) {
448
449
  const { tempPoint: temp } = P$5;
449
- copy$a(temp, t);
450
+ copy$b(temp, t);
450
451
  toInnerPoint$2(matrix, temp, temp);
451
452
  return temp;
452
453
  },
453
454
  tempToOuterOf(t, matrix) {
454
455
  const { tempPoint: temp } = P$5;
455
- copy$a(temp, t);
456
+ copy$b(temp, t);
456
457
  toOuterPoint$2(matrix, temp, temp);
457
458
  return temp;
458
459
  },
459
460
  tempToInnerRadiusPointOf(t, matrix) {
460
461
  const { tempRadiusPoint: temp } = P$5;
461
- copy$a(temp, t);
462
+ copy$b(temp, t);
462
463
  P$5.toInnerRadiusPointOf(t, matrix, temp);
463
464
  return temp;
464
465
  },
@@ -525,7 +526,7 @@ const PointHelper = {
525
526
  }
526
527
  };
527
528
  const P$5 = PointHelper;
528
- const { getDistanceFrom, copy: copy$a, getAtan2 } = P$5;
529
+ const { getDistanceFrom, copy: copy$b, getAtan2 } = P$5;
529
530
 
530
531
  class Point {
531
532
  constructor(x, y) {
@@ -593,6 +594,7 @@ class Point {
593
594
  return this;
594
595
  }
595
596
  }
597
+ const tempPoint$2 = new Point();
596
598
 
597
599
  class Matrix {
598
600
  constructor(a, b, c, d, e, f) {
@@ -602,6 +604,12 @@ class Matrix {
602
604
  typeof a === 'object' ? MatrixHelper.copy(this, a) : MatrixHelper.set(this, a, b, c, d, e, f);
603
605
  return this;
604
606
  }
607
+ setWith(dataWithScale) {
608
+ MatrixHelper.copy(this, dataWithScale);
609
+ this.scaleX = dataWithScale.scaleX;
610
+ this.scaleY = dataWithScale.scaleY;
611
+ return this;
612
+ }
605
613
  get() {
606
614
  const { a, b, c, d, e, f } = this;
607
615
  return { a, b, c, d, e, f };
@@ -621,6 +629,12 @@ class Matrix {
621
629
  MatrixHelper.scale(this, x, y);
622
630
  return this;
623
631
  }
632
+ scaleWith(x, y) {
633
+ MatrixHelper.scale(this, x, y);
634
+ this.scaleX *= x;
635
+ this.scaleY *= y || x;
636
+ return this;
637
+ }
624
638
  scaleOfOuter(origin, x, y) {
625
639
  MatrixHelper.scaleOfOuter(this, origin, x, y);
626
640
  return this;
@@ -673,6 +687,12 @@ class Matrix {
673
687
  MatrixHelper.invert(this);
674
688
  return this;
675
689
  }
690
+ invertWith() {
691
+ MatrixHelper.invert(this);
692
+ this.scaleX = 1 / this.scaleX;
693
+ this.scaleY = 1 / this.scaleY;
694
+ return this;
695
+ }
676
696
  toOuterPoint(inner, to, distance) {
677
697
  MatrixHelper.toOuterPoint(this, inner, to, distance);
678
698
  }
@@ -693,6 +713,7 @@ class Matrix {
693
713
  MatrixHelper.reset(this);
694
714
  }
695
715
  }
716
+ const tempMatrix = new Matrix();
696
717
 
697
718
  const TwoPointBoundsHelper = {
698
719
  tempPointBounds: {},
@@ -781,7 +802,7 @@ const BoundsHelper = {
781
802
  to = t;
782
803
  }
783
804
  else {
784
- copy$9(to, t);
805
+ copy$a(to, t);
785
806
  }
786
807
  if (parent) {
787
808
  to.offsetX = -(B.maxX(parent) - t.x);
@@ -856,8 +877,8 @@ const BoundsHelper = {
856
877
  B.move(to, -matrix.e, -matrix.f);
857
878
  B.scale(to, 1 / matrix.a, 1 / matrix.d);
858
879
  },
859
- getFitMatrix(t, put) {
860
- const scale = Math.min(1, Math.min(t.width / put.width, t.height / put.height));
880
+ getFitMatrix(t, put, baseScale = 1) {
881
+ const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
861
882
  return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
862
883
  },
863
884
  getSpread(t, spreadX, spreadY) {
@@ -891,11 +912,15 @@ const BoundsHelper = {
891
912
  t.width = float(t.width, maxLength);
892
913
  t.height = float(t.height, maxLength);
893
914
  },
894
- add(t, bounds) {
915
+ add(t, bounds, isPoint) {
895
916
  right$1 = t.x + t.width;
896
917
  bottom$1 = t.y + t.height;
897
- boundsRight = bounds.x + bounds.width;
898
- boundsBottom = bounds.y + bounds.height;
918
+ boundsRight = bounds.x;
919
+ boundsBottom = bounds.y;
920
+ if (!isPoint) {
921
+ boundsRight += bounds.width;
922
+ boundsBottom += bounds.height;
923
+ }
899
924
  right$1 = right$1 > boundsRight ? right$1 : boundsRight;
900
925
  bottom$1 = bottom$1 > boundsBottom ? bottom$1 : boundsBottom;
901
926
  t.x = t.x < bounds.x ? t.x : bounds.x;
@@ -920,7 +945,7 @@ const BoundsHelper = {
920
945
  if (first) {
921
946
  first = false;
922
947
  if (!addMode)
923
- copy$9(t, bounds);
948
+ copy$a(t, bounds);
924
949
  }
925
950
  else {
926
951
  add$1(t, bounds);
@@ -934,6 +959,9 @@ const BoundsHelper = {
934
959
  points.forEach((point, index) => index === 0 ? setPoint$3(tempPointBounds$1, point.x, point.y) : addPoint$3(tempPointBounds$1, point.x, point.y));
935
960
  toBounds$4(tempPointBounds$1, t);
936
961
  },
962
+ addPoint(t, point) {
963
+ add$1(t, point, true);
964
+ },
937
965
  getPoints(t) {
938
966
  const { x, y, width, height } = t;
939
967
  return [
@@ -995,7 +1023,7 @@ const BoundsHelper = {
995
1023
  }
996
1024
  };
997
1025
  const B = BoundsHelper;
998
- const { add: add$1, copy: copy$9 } = B;
1026
+ const { add: add$1, copy: copy$a } = B;
999
1027
 
1000
1028
  class Bounds {
1001
1029
  get minX() { return BoundsHelper.minX(this); }
@@ -1036,8 +1064,8 @@ class Bounds {
1036
1064
  BoundsHelper.toInnerOf(this, matrix, to);
1037
1065
  return this;
1038
1066
  }
1039
- getFitMatrix(put) {
1040
- return BoundsHelper.getFitMatrix(this, put);
1067
+ getFitMatrix(put, baseScale) {
1068
+ return BoundsHelper.getFitMatrix(this, put, baseScale);
1041
1069
  }
1042
1070
  spread(fourNumber, spreadY) {
1043
1071
  BoundsHelper.spread(this, fourNumber, spreadY);
@@ -1083,6 +1111,10 @@ class Bounds {
1083
1111
  BoundsHelper.setPoints(this, points);
1084
1112
  return this;
1085
1113
  }
1114
+ addPoint(point) {
1115
+ BoundsHelper.addPoint(this, point);
1116
+ return this;
1117
+ }
1086
1118
  getPoints() {
1087
1119
  return BoundsHelper.getPoints(this);
1088
1120
  }
@@ -1115,6 +1147,7 @@ class Bounds {
1115
1147
  BoundsHelper.reset(this);
1116
1148
  }
1117
1149
  }
1150
+ const tempBounds$1 = new Bounds();
1118
1151
 
1119
1152
  class AutoBounds {
1120
1153
  constructor(top, right, bottom, left, width, height) {
@@ -1260,7 +1293,7 @@ function getNameList(name) {
1260
1293
  }
1261
1294
  const D$4 = Debug;
1262
1295
 
1263
- const debug$e = Debug.get('RunTime');
1296
+ const debug$f = Debug.get('RunTime');
1264
1297
  const Run = {
1265
1298
  currentId: 0,
1266
1299
  currentName: '',
@@ -1278,7 +1311,7 @@ const Run = {
1278
1311
  const time = R.idMap[id], name = R.nameMap[id];
1279
1312
  const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
1280
1313
  R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
1281
- debug$e.log(name, duration, 'ms');
1314
+ debug$f.log(name, duration, 'ms');
1282
1315
  },
1283
1316
  endOfName(name, microsecond) {
1284
1317
  const id = R.nameToIdMap[name];
@@ -1288,13 +1321,13 @@ const Run = {
1288
1321
  };
1289
1322
  const R = Run;
1290
1323
 
1291
- const debug$d = Debug.get('UICreator');
1324
+ const debug$e = Debug.get('UICreator');
1292
1325
  const UICreator = {
1293
1326
  list: {},
1294
1327
  register(UI) {
1295
1328
  const { __tag: tag } = UI.prototype;
1296
1329
  if (list$2[tag]) {
1297
- debug$d.repeat(tag);
1330
+ debug$e.repeat(tag);
1298
1331
  }
1299
1332
  else {
1300
1333
  list$2[tag] = UI;
@@ -1316,7 +1349,7 @@ const UICreator = {
1316
1349
  };
1317
1350
  const { list: list$2 } = UICreator;
1318
1351
 
1319
- const debug$c = Debug.get('EventCreator');
1352
+ const debug$d = Debug.get('EventCreator');
1320
1353
  const EventCreator = {
1321
1354
  nameList: {},
1322
1355
  register(Event) {
@@ -1324,7 +1357,7 @@ const EventCreator = {
1324
1357
  Object.keys(Event).forEach(key => {
1325
1358
  name = Event[key];
1326
1359
  if (typeof name === 'string')
1327
- nameList[name] ? debug$c.repeat(name) : nameList[name] = Event;
1360
+ nameList[name] ? debug$d.repeat(name) : nameList[name] = Event;
1328
1361
  });
1329
1362
  },
1330
1363
  changeName(oldName, newName) {
@@ -1535,36 +1568,7 @@ var Answer;
1535
1568
  Answer[Answer["NoAndSkip"] = 2] = "NoAndSkip";
1536
1569
  Answer[Answer["YesAndSkip"] = 3] = "YesAndSkip";
1537
1570
  })(Answer || (Answer = {}));
1538
-
1539
- const FileHelper = {
1540
- opacityTypes: ['png', 'webp', 'svg'],
1541
- upperCaseTypeMap: {},
1542
- mineType(type) {
1543
- if (!type || type.startsWith('image'))
1544
- return type;
1545
- if (type === 'jpg')
1546
- type = 'jpeg';
1547
- return 'image/' + type;
1548
- },
1549
- fileType(filename) {
1550
- const l = filename.split('.');
1551
- return l[l.length - 1];
1552
- },
1553
- isOpaqueImage(filename) {
1554
- const type = F$4.fileType(filename);
1555
- return ['jpg', 'jpeg'].some(item => item === type);
1556
- },
1557
- getExportOptions(options) {
1558
- switch (typeof options) {
1559
- case 'object': return options;
1560
- case 'number': return { quality: options };
1561
- case 'boolean': return { blob: options };
1562
- default: return {};
1563
- }
1564
- }
1565
- };
1566
- const F$4 = FileHelper;
1567
- F$4.opacityTypes.forEach(type => F$4.upperCaseTypeMap[type] = type.toUpperCase());
1571
+ const emptyData = {};
1568
1572
 
1569
1573
  /******************************************************************************
1570
1574
  Copyright (c) Microsoft Corporation.
@@ -1888,10 +1892,8 @@ __decorate([
1888
1892
  contextMethod()
1889
1893
  ], Canvas$1.prototype, "strokeText", null);
1890
1894
 
1891
- const { copy: copy$8 } = MatrixHelper;
1892
- const temp = new Bounds();
1895
+ const { copy: copy$9 } = MatrixHelper;
1893
1896
  const minSize = { width: 1, height: 1, pixelRatio: 1 };
1894
- const debug$b = Debug.get('LeaferCanvasBase');
1895
1897
  const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
1896
1898
  class LeaferCanvasBase extends Canvas$1 {
1897
1899
  get width() { return this.size.width; }
@@ -1918,44 +1920,15 @@ class LeaferCanvasBase extends Canvas$1 {
1918
1920
  }
1919
1921
  init() { }
1920
1922
  __createContext() {
1921
- this.context = this.view.getContext('2d');
1923
+ const { view } = this;
1924
+ const { contextSettings } = this.config;
1925
+ this.context = contextSettings ? view.getContext('2d', contextSettings) : view.getContext('2d');
1922
1926
  this.__bindContext();
1923
1927
  }
1924
- export(filename, options) {
1925
- const { quality, blob } = FileHelper.getExportOptions(options);
1926
- if (filename.includes('.')) {
1927
- return this.saveAs(filename, quality);
1928
- }
1929
- else if (blob) {
1930
- return this.toBlob(filename, quality);
1931
- }
1932
- else {
1933
- return this.toDataURL(filename, quality);
1934
- }
1935
- }
1936
- toBlob(type, quality) {
1937
- return new Promise((resolve) => {
1938
- Platform.origin.canvasToBolb(this.view, type, quality).then((blob) => {
1939
- resolve(blob);
1940
- }).catch((e) => {
1941
- debug$b.error(e);
1942
- resolve(null);
1943
- });
1944
- });
1945
- }
1946
- toDataURL(type, quality) {
1947
- return Platform.origin.canvasToDataURL(this.view, type, quality);
1948
- }
1949
- saveAs(filename, quality) {
1950
- return new Promise((resolve) => {
1951
- Platform.origin.canvasSaveAs(this.view, filename, quality).then(() => {
1952
- resolve(true);
1953
- }).catch((e) => {
1954
- debug$b.error(e);
1955
- resolve(false);
1956
- });
1957
- });
1958
- }
1928
+ export(_filename, _options) { return undefined; }
1929
+ toBlob(_type, _quality) { return undefined; }
1930
+ toDataURL(_type, _quality) { return undefined; }
1931
+ saveAs(_filename, _quality) { return undefined; }
1959
1932
  resize(size) {
1960
1933
  if (this.isSameSize(size))
1961
1934
  return;
@@ -2023,13 +1996,9 @@ class LeaferCanvasBase extends Canvas$1 {
2023
1996
  restoreBlendMode() {
2024
1997
  this.blendMode = this.savedBlendMode;
2025
1998
  }
2026
- hitFill(point, fillRule) {
2027
- return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
2028
- }
2029
- hitStroke(point, strokeWidth) {
2030
- this.strokeWidth = strokeWidth;
2031
- return this.context.isPointInStroke(point.x, point.y);
2032
- }
1999
+ hitFill(_point, _fillRule) { return true; }
2000
+ hitStroke(_point, _strokeWidth) { return true; }
2001
+ hitPixel(_radiusPoint, _offset, _scale = 1) { return true; }
2033
2002
  setWorldShadow(x, y, blur, color) {
2034
2003
  const { pixelRatio } = this;
2035
2004
  this.shadowOffsetX = x * pixelRatio;
@@ -2088,8 +2057,8 @@ class LeaferCanvasBase extends Canvas$1 {
2088
2057
  if (blendMode)
2089
2058
  this.blendMode = blendMode;
2090
2059
  this.fillStyle = color;
2091
- temp.set(bounds).scale(this.pixelRatio);
2092
- this.fillRect(temp.x, temp.y, temp.width, temp.height);
2060
+ tempBounds$1.set(bounds).scale(this.pixelRatio);
2061
+ this.fillRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2093
2062
  if (blendMode)
2094
2063
  this.blendMode = 'source-over';
2095
2064
  }
@@ -2097,23 +2066,23 @@ class LeaferCanvasBase extends Canvas$1 {
2097
2066
  if (blendMode)
2098
2067
  this.blendMode = blendMode;
2099
2068
  this.strokeStyle = color;
2100
- temp.set(bounds).scale(this.pixelRatio);
2101
- this.strokeRect(temp.x, temp.y, temp.width, temp.height);
2069
+ tempBounds$1.set(bounds).scale(this.pixelRatio);
2070
+ this.strokeRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2102
2071
  if (blendMode)
2103
2072
  this.blendMode = 'source-over';
2104
2073
  }
2105
2074
  clearWorld(bounds, ceilPixel) {
2106
- temp.set(bounds).scale(this.pixelRatio);
2075
+ tempBounds$1.set(bounds).scale(this.pixelRatio);
2107
2076
  if (ceilPixel)
2108
- temp.ceil();
2109
- this.clearRect(temp.x, temp.y, temp.width, temp.height);
2077
+ tempBounds$1.ceil();
2078
+ this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2110
2079
  }
2111
2080
  clipWorld(bounds, ceilPixel) {
2112
2081
  this.beginPath();
2113
- temp.set(bounds).scale(this.pixelRatio);
2082
+ tempBounds$1.set(bounds).scale(this.pixelRatio);
2114
2083
  if (ceilPixel)
2115
- temp.ceil();
2116
- this.rect(temp.x, temp.y, temp.width, temp.height);
2084
+ tempBounds$1.ceil();
2085
+ this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2117
2086
  this.clip();
2118
2087
  }
2119
2088
  clear() {
@@ -2127,7 +2096,7 @@ class LeaferCanvasBase extends Canvas$1 {
2127
2096
  const canvas = this.manager ? this.manager.get(this.size) : Creator.canvas(Object.assign({}, this.size));
2128
2097
  canvas.save();
2129
2098
  if (useSameWorldTransform)
2130
- copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2099
+ copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2131
2100
  if (useSameSmooth)
2132
2101
  canvas.smooth = this.smooth;
2133
2102
  return canvas;
@@ -2497,10 +2466,10 @@ const EllipseHelper = {
2497
2466
  }
2498
2467
  };
2499
2468
 
2500
- const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$4, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$3, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
2469
+ const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$4, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
2501
2470
  const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2502
2471
  const { ellipticalArc } = EllipseHelper;
2503
- const debug$a = Debug.get('PathConvert');
2472
+ const debug$c = Debug.get('PathConvert');
2504
2473
  const setEndPoint$1 = {};
2505
2474
  const PathConvert = {
2506
2475
  current: { dot: 0 },
@@ -2712,7 +2681,7 @@ const PathConvert = {
2712
2681
  y = setEndPoint$1.y;
2713
2682
  i += 9;
2714
2683
  break;
2715
- case F$3:
2684
+ case F$4:
2716
2685
  curveMode ? ellipse$4(data, old[i + 1], old[i + 2], old[i + 3], old[i + 4], 0, 0, 360, false) : copyData(data, old, i, 5);
2717
2686
  x = old[i + 1] + old[i + 3];
2718
2687
  y = old[i + 2];
@@ -2737,7 +2706,7 @@ const PathConvert = {
2737
2706
  i += 6;
2738
2707
  break;
2739
2708
  default:
2740
- debug$a.error(`command: ${command} [index:${i}]`, old);
2709
+ debug$c.error(`command: ${command} [index:${i}]`, old);
2741
2710
  return data;
2742
2711
  }
2743
2712
  lastCommand = command;
@@ -2761,7 +2730,7 @@ const PathConvert = {
2761
2730
  };
2762
2731
  const { current, pushData, copyData } = PathConvert;
2763
2732
 
2764
- const { M: M$3, L: L$4, C: C$3, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$2, O: O$2, P: P$2, U: U$2 } = PathCommandMap;
2733
+ const { M: M$3, L: L$4, C: C$3, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2 } = PathCommandMap;
2765
2734
  const { getMinDistanceFrom, getRadianFrom } = PointHelper;
2766
2735
  const { tan, min, abs: abs$2 } = Math;
2767
2736
  const startPoint = {};
@@ -2803,7 +2772,7 @@ const PathCommandDataHelper = {
2803
2772
  },
2804
2773
  ellipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
2805
2774
  if (rotation === undefined) {
2806
- data.push(F$2, x, y, radiusX, radiusY);
2775
+ data.push(F$3, x, y, radiusX, radiusY);
2807
2776
  }
2808
2777
  else {
2809
2778
  if (startAngle === undefined)
@@ -2853,6 +2822,7 @@ class PathCreator {
2853
2822
  set path(value) { this.__path = value; }
2854
2823
  get path() { return this.__path; }
2855
2824
  constructor(path) {
2825
+ this.clearPath = this.beginPath;
2856
2826
  this.set(path);
2857
2827
  }
2858
2828
  set(path) {
@@ -2922,8 +2892,8 @@ class PathCreator {
2922
2892
  }
2923
2893
  }
2924
2894
 
2925
- const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$1, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
2926
- const debug$9 = Debug.get('PathDrawer');
2895
+ const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
2896
+ const debug$b = Debug.get('PathDrawer');
2927
2897
  const PathDrawer = {
2928
2898
  drawPathByData(drawer, data) {
2929
2899
  if (!data)
@@ -2969,7 +2939,7 @@ const PathDrawer = {
2969
2939
  drawer.ellipse(data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5] * OneRadian, data[i + 6] * OneRadian, data[i + 7] * OneRadian, data[i + 8]);
2970
2940
  i += 9;
2971
2941
  break;
2972
- case F$1:
2942
+ case F$2:
2973
2943
  drawer.ellipse(data[i + 1], data[i + 2], data[i + 3], data[i + 4], 0, 0, PI2, false);
2974
2944
  i += 5;
2975
2945
  break;
@@ -2986,17 +2956,17 @@ const PathDrawer = {
2986
2956
  i += 6;
2987
2957
  break;
2988
2958
  default:
2989
- debug$9.error(`command: ${command} [index:${i}]`, data);
2959
+ debug$b.error(`command: ${command} [index:${i}]`, data);
2990
2960
  return;
2991
2961
  }
2992
2962
  }
2993
2963
  }
2994
2964
  };
2995
2965
 
2996
- const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F, O, P, U } = PathCommandMap;
2966
+ const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
2997
2967
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
2998
- const { addPointBounds, copy: copy$7, addPoint: addPoint$1, setPoint: setPoint$1, addBounds, toBounds: toBounds$3 } = TwoPointBoundsHelper;
2999
- const debug$8 = Debug.get('PathBounds');
2968
+ const { addPointBounds, copy: copy$8, addPoint: addPoint$1, setPoint: setPoint$1, addBounds, toBounds: toBounds$3 } = TwoPointBoundsHelper;
2969
+ const debug$a = Debug.get('PathBounds');
3000
2970
  let radius, radiusX, radiusY;
3001
2971
  const tempPointBounds = {};
3002
2972
  const setPointBounds = {};
@@ -3068,12 +3038,12 @@ const PathBounds = {
3068
3038
  break;
3069
3039
  case G:
3070
3040
  ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
3071
- i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3041
+ i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3072
3042
  x = setEndPoint.x;
3073
3043
  y = setEndPoint.y;
3074
3044
  i += 9;
3075
3045
  break;
3076
- case F:
3046
+ case F$1:
3077
3047
  x = data[i + 1];
3078
3048
  y = data[i + 2];
3079
3049
  radiusX = data[i + 3];
@@ -3084,7 +3054,7 @@ const PathBounds = {
3084
3054
  break;
3085
3055
  case O:
3086
3056
  arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
3087
- i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3057
+ i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3088
3058
  x = setEndPoint.x;
3089
3059
  y = setEndPoint.y;
3090
3060
  i += 7;
@@ -3099,13 +3069,13 @@ const PathBounds = {
3099
3069
  break;
3100
3070
  case U:
3101
3071
  arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
3102
- i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3072
+ i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3103
3073
  x = setEndPoint.x;
3104
3074
  y = setEndPoint.y;
3105
3075
  i += 6;
3106
3076
  break;
3107
3077
  default:
3108
- debug$8.error(`command: ${command} [index:${i}]`, data);
3078
+ debug$a.error(`command: ${command} [index:${i}]`, data);
3109
3079
  return;
3110
3080
  }
3111
3081
  }
@@ -3191,7 +3161,37 @@ function canvasPatch(drawer) {
3191
3161
  roundRect(drawer);
3192
3162
  }
3193
3163
 
3194
- const debug$7 = Debug.get('TaskProcessor');
3164
+ const FileHelper = {
3165
+ opacityTypes: ['png', 'webp', 'svg'],
3166
+ upperCaseTypeMap: {},
3167
+ mineType(type) {
3168
+ if (!type || type.startsWith('image'))
3169
+ return type;
3170
+ if (type === 'jpg')
3171
+ type = 'jpeg';
3172
+ return 'image/' + type;
3173
+ },
3174
+ fileType(filename) {
3175
+ const l = filename.split('.');
3176
+ return l[l.length - 1];
3177
+ },
3178
+ isOpaqueImage(filename) {
3179
+ const type = F.fileType(filename);
3180
+ return ['jpg', 'jpeg'].some(item => item === type);
3181
+ },
3182
+ getExportOptions(options) {
3183
+ switch (typeof options) {
3184
+ case 'object': return options;
3185
+ case 'number': return { quality: options };
3186
+ case 'boolean': return { blob: options };
3187
+ default: return {};
3188
+ }
3189
+ }
3190
+ };
3191
+ const F = FileHelper;
3192
+ F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3193
+
3194
+ const debug$9 = Debug.get('TaskProcessor');
3195
3195
  class TaskItem {
3196
3196
  constructor(task) {
3197
3197
  this.parallel = true;
@@ -3206,7 +3206,7 @@ class TaskItem {
3206
3206
  yield this.task();
3207
3207
  }
3208
3208
  catch (error) {
3209
- debug$7.error(error);
3209
+ debug$9.error(error);
3210
3210
  }
3211
3211
  });
3212
3212
  }
@@ -3490,6 +3490,7 @@ const ImageManager = {
3490
3490
  },
3491
3491
  destroy() {
3492
3492
  I$1.map = {};
3493
+ I$1.recycledList = [];
3493
3494
  }
3494
3495
  };
3495
3496
  const I$1 = ImageManager;
@@ -3604,84 +3605,75 @@ function getNames(object) {
3604
3605
  return Object.getOwnPropertyNames(object);
3605
3606
  }
3606
3607
 
3607
- function defineLeafAttr(target, key, defaultValue, mergeDescriptor) {
3608
+ function decorateLeafAttr(defaultValue, descriptorFn) {
3609
+ return (target, key) => defineLeafAttr(target, key, defaultValue, descriptorFn && descriptorFn(key));
3610
+ }
3611
+ function attr(partDescriptor) {
3612
+ return partDescriptor;
3613
+ }
3614
+ function defineLeafAttr(target, key, defaultValue, partDescriptor) {
3608
3615
  const defaultDescriptor = {
3609
3616
  get() { return this.__getAttr(key); },
3610
3617
  set(value) { this.__setAttr(key, value); },
3611
3618
  configurable: true,
3612
3619
  enumerable: true
3613
3620
  };
3614
- defineKey(target, key, Object.assign(defaultDescriptor, mergeDescriptor || {}));
3621
+ defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
3615
3622
  defineDataProcessor(target, key, defaultValue);
3616
3623
  }
3617
3624
  function dataType(defaultValue) {
3618
- return (target, key) => {
3619
- defineLeafAttr(target, key, defaultValue);
3620
- };
3625
+ return decorateLeafAttr(defaultValue);
3621
3626
  }
3622
- function positionType(defaultValue) {
3623
- return (target, key) => {
3624
- defineLeafAttr(target, key, defaultValue, {
3625
- set(value) {
3626
- this.__setAttr(key, value);
3627
- this.__layout.matrixChanged || this.__layout.matrixChange();
3628
- }
3629
- });
3630
- };
3627
+ function positionType(defaultValue, checkFiniteNumber) {
3628
+ return decorateLeafAttr(defaultValue, (key) => attr({
3629
+ set(value) {
3630
+ this.__setAttr(key, value, checkFiniteNumber);
3631
+ this.__layout.matrixChanged || this.__layout.matrixChange();
3632
+ }
3633
+ }));
3631
3634
  }
3632
3635
  function autoLayoutType(defaultValue) {
3633
- return (target, key) => {
3634
- defineLeafAttr(target, key, defaultValue, {
3635
- set(value) {
3636
- this.__setAttr(key, value);
3637
- this.__layout.matrixChanged || this.__layout.matrixChange();
3638
- this.__hasAutoLayout = !!value;
3639
- if (!this.__local)
3640
- this.__layout.createLocal();
3641
- }
3642
- });
3643
- };
3636
+ return decorateLeafAttr(defaultValue, (key) => attr({
3637
+ set(value) {
3638
+ this.__setAttr(key, value);
3639
+ this.__layout.matrixChanged || this.__layout.matrixChange();
3640
+ this.__hasAutoLayout = !!value;
3641
+ if (!this.__local)
3642
+ this.__layout.createLocal();
3643
+ }
3644
+ }));
3644
3645
  }
3645
- function scaleType(defaultValue) {
3646
- return (target, key) => {
3647
- defineLeafAttr(target, key, defaultValue, {
3648
- set(value) {
3649
- this.__setAttr(key, value);
3650
- this.__layout.scaleChanged || this.__layout.scaleChange();
3651
- }
3652
- });
3653
- };
3646
+ function scaleType(defaultValue, checkFiniteNumber) {
3647
+ return decorateLeafAttr(defaultValue, (key) => attr({
3648
+ set(value) {
3649
+ this.__setAttr(key, value, checkFiniteNumber);
3650
+ this.__layout.scaleChanged || this.__layout.scaleChange();
3651
+ }
3652
+ }));
3654
3653
  }
3655
- function rotationType(defaultValue) {
3656
- return (target, key) => {
3657
- defineLeafAttr(target, key, defaultValue, {
3658
- set(value) {
3659
- this.__setAttr(key, value);
3660
- this.__layout.rotationChanged || this.__layout.rotationChange();
3661
- }
3662
- });
3663
- };
3654
+ function rotationType(defaultValue, checkFiniteNumber) {
3655
+ return decorateLeafAttr(defaultValue, (key) => attr({
3656
+ set(value) {
3657
+ this.__setAttr(key, value, checkFiniteNumber);
3658
+ this.__layout.rotationChanged || this.__layout.rotationChange();
3659
+ }
3660
+ }));
3664
3661
  }
3665
- function boundsType(defaultValue) {
3666
- return (target, key) => {
3667
- defineLeafAttr(target, key, defaultValue, {
3668
- set(value) {
3669
- this.__setAttr(key, value);
3670
- doBoundsType(this);
3671
- }
3672
- });
3673
- };
3662
+ function boundsType(defaultValue, checkFiniteNumber) {
3663
+ return decorateLeafAttr(defaultValue, (key) => attr({
3664
+ set(value) {
3665
+ this.__setAttr(key, value, checkFiniteNumber) && doBoundsType(this);
3666
+ }
3667
+ }));
3674
3668
  }
3675
3669
  function naturalBoundsType(defaultValue) {
3676
- return (target, key) => {
3677
- defineLeafAttr(target, key, defaultValue, {
3678
- set(value) {
3679
- this.__setAttr(key, value);
3680
- doBoundsType(this);
3681
- this.__.__removeNaturalSize();
3682
- }
3683
- });
3684
- };
3670
+ return decorateLeafAttr(defaultValue, (key) => attr({
3671
+ set(value) {
3672
+ this.__setAttr(key, value);
3673
+ doBoundsType(this);
3674
+ this.__.__removeNaturalSize();
3675
+ }
3676
+ }));
3685
3677
  }
3686
3678
  function doBoundsType(leaf) {
3687
3679
  leaf.__layout.boxChanged || leaf.__layout.boxChange();
@@ -3689,27 +3681,22 @@ function doBoundsType(leaf) {
3689
3681
  leaf.__layout.matrixChanged || leaf.__layout.matrixChange();
3690
3682
  }
3691
3683
  function pathInputType(defaultValue) {
3692
- return (target, key) => {
3693
- defineLeafAttr(target, key, defaultValue, {
3694
- set(value) {
3695
- if (this.__.__pathInputed !== 2)
3696
- this.__.__pathInputed = value ? 1 : 0;
3697
- this.__setAttr(key, value);
3698
- doBoundsType(this);
3699
- }
3700
- });
3701
- };
3684
+ return decorateLeafAttr(defaultValue, (key) => attr({
3685
+ set(value) {
3686
+ if (this.__.__pathInputed !== 2)
3687
+ this.__.__pathInputed = value ? 1 : 0;
3688
+ this.__setAttr(key, value);
3689
+ doBoundsType(this);
3690
+ }
3691
+ }));
3702
3692
  }
3703
3693
  const pathType = boundsType;
3704
3694
  function affectStrokeBoundsType(defaultValue) {
3705
- return (target, key) => {
3706
- defineLeafAttr(target, key, defaultValue, {
3707
- set(value) {
3708
- this.__setAttr(key, value);
3709
- doStrokeType(this);
3710
- }
3711
- });
3712
- };
3695
+ return decorateLeafAttr(defaultValue, (key) => attr({
3696
+ set(value) {
3697
+ this.__setAttr(key, value) && doStrokeType(this);
3698
+ }
3699
+ }));
3713
3700
  }
3714
3701
  function doStrokeType(leaf) {
3715
3702
  leaf.__layout.strokeChanged || leaf.__layout.strokeChange();
@@ -3718,91 +3705,75 @@ function doStrokeType(leaf) {
3718
3705
  }
3719
3706
  const strokeType = affectStrokeBoundsType;
3720
3707
  function affectRenderBoundsType(defaultValue) {
3721
- return (target, key) => {
3722
- defineLeafAttr(target, key, defaultValue, {
3723
- set(value) {
3724
- this.__setAttr(key, value);
3725
- this.__layout.renderChanged || this.__layout.renderChange();
3726
- }
3727
- });
3728
- };
3708
+ return decorateLeafAttr(defaultValue, (key) => attr({
3709
+ set(value) {
3710
+ this.__setAttr(key, value);
3711
+ this.__layout.renderChanged || this.__layout.renderChange();
3712
+ }
3713
+ }));
3729
3714
  }
3730
3715
  function surfaceType(defaultValue) {
3731
- return (target, key) => {
3732
- defineLeafAttr(target, key, defaultValue, {
3733
- set(value) {
3734
- this.__setAttr(key, value);
3735
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3736
- }
3737
- });
3738
- };
3716
+ return decorateLeafAttr(defaultValue, (key) => attr({
3717
+ set(value) {
3718
+ this.__setAttr(key, value);
3719
+ this.__layout.surfaceChanged || this.__layout.surfaceChange();
3720
+ }
3721
+ }));
3739
3722
  }
3740
3723
  function opacityType(defaultValue) {
3741
- return (target, key) => {
3742
- defineLeafAttr(target, key, defaultValue, {
3743
- set(value) {
3744
- this.__setAttr(key, value);
3745
- this.__layout.opacityChanged || this.__layout.opacityChange();
3746
- }
3747
- });
3748
- };
3724
+ return decorateLeafAttr(defaultValue, (key) => attr({
3725
+ set(value) {
3726
+ this.__setAttr(key, value);
3727
+ this.__layout.opacityChanged || this.__layout.opacityChange();
3728
+ }
3729
+ }));
3749
3730
  }
3750
3731
  function sortType(defaultValue) {
3751
- return (target, key) => {
3752
- defineLeafAttr(target, key, defaultValue, {
3753
- set(value) {
3754
- this.__setAttr(key, value);
3755
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3756
- this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
3757
- }
3758
- });
3759
- };
3732
+ return decorateLeafAttr(defaultValue, (key) => attr({
3733
+ set(value) {
3734
+ this.__setAttr(key, value);
3735
+ this.__layout.surfaceChanged || this.__layout.surfaceChange();
3736
+ this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
3737
+ }
3738
+ }));
3760
3739
  }
3761
3740
  function maskType(defaultValue) {
3762
- return (target, key) => {
3763
- defineLeafAttr(target, key, defaultValue, {
3764
- set(value) {
3765
- this.__setAttr(key, value);
3766
- this.__layout.boxChanged || this.__layout.boxChange();
3767
- this.waitParent(() => { this.parent.__updateMask(value); });
3768
- }
3769
- });
3770
- };
3741
+ return decorateLeafAttr(defaultValue, (key) => attr({
3742
+ set(value) {
3743
+ this.__setAttr(key, value);
3744
+ this.__layout.boxChanged || this.__layout.boxChange();
3745
+ this.waitParent(() => { this.parent.__updateMask(value); });
3746
+ }
3747
+ }));
3771
3748
  }
3772
3749
  function eraserType(defaultValue) {
3773
- return (target, key) => {
3774
- defineLeafAttr(target, key, defaultValue, {
3775
- set(value) {
3776
- this.__setAttr(key, value);
3777
- this.waitParent(() => { this.parent.__updateEraser(value); });
3778
- }
3779
- });
3780
- };
3750
+ return decorateLeafAttr(defaultValue, (key) => attr({
3751
+ set(value) {
3752
+ this.__setAttr(key, value);
3753
+ this.waitParent(() => { this.parent.__updateEraser(value); });
3754
+ }
3755
+ }));
3781
3756
  }
3782
3757
  function hitType(defaultValue) {
3783
- return (target, key) => {
3784
- defineLeafAttr(target, key, defaultValue, {
3785
- set(value) {
3786
- this.__setAttr(key, value);
3787
- if (Debug.showHitView) {
3788
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
3789
- }
3790
- if (this.leafer)
3791
- this.leafer.updateCursor();
3758
+ return decorateLeafAttr(defaultValue, (key) => attr({
3759
+ set(value) {
3760
+ this.__setAttr(key, value);
3761
+ if (Debug.showHitView) {
3762
+ this.__layout.surfaceChanged || this.__layout.surfaceChange();
3792
3763
  }
3793
- });
3794
- };
3764
+ if (this.leafer)
3765
+ this.leafer.updateCursor();
3766
+ }
3767
+ }));
3795
3768
  }
3796
3769
  function cursorType(defaultValue) {
3797
- return (target, key) => {
3798
- defineLeafAttr(target, key, defaultValue, {
3799
- set(value) {
3800
- this.__setAttr(key, value);
3801
- if (this.leafer)
3802
- this.leafer.updateCursor();
3803
- }
3804
- });
3805
- };
3770
+ return decorateLeafAttr(defaultValue, (key) => attr({
3771
+ set(value) {
3772
+ this.__setAttr(key, value);
3773
+ if (this.leafer)
3774
+ this.leafer.updateCursor();
3775
+ }
3776
+ }));
3806
3777
  }
3807
3778
  function dataProcessor(processor) {
3808
3779
  return (target, _key) => {
@@ -3865,7 +3836,7 @@ function defineDataProcessor(target, key, defaultValue) {
3865
3836
  Object.defineProperty(data, key, property);
3866
3837
  }
3867
3838
 
3868
- const debug$6 = new Debug('rewrite');
3839
+ const debug$8 = new Debug('rewrite');
3869
3840
  const list$1 = [];
3870
3841
  const excludeNames = ['destroy', 'constructor'];
3871
3842
  function rewrite(method) {
@@ -3882,7 +3853,7 @@ function doRewrite(error) {
3882
3853
  if (list$1.length) {
3883
3854
  list$1.forEach(item => {
3884
3855
  if (error)
3885
- debug$6.error(item.name, '需在Class上装饰@rewriteAble()');
3856
+ debug$8.error(item.name, '需在Class上装饰@rewriteAble()');
3886
3857
  item.run();
3887
3858
  });
3888
3859
  list$1.length = 0;
@@ -3918,8 +3889,8 @@ function registerUIEvent() {
3918
3889
  };
3919
3890
  }
3920
3891
 
3921
- const { copy: copy$6, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
3922
- const matrix = {};
3892
+ const { copy: copy$7, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$3, rotateOfOuter: rotateOfOuter$3, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
3893
+ const matrix$1 = {};
3923
3894
  const LeafHelper = {
3924
3895
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
3925
3896
  if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
@@ -3997,39 +3968,39 @@ const LeafHelper = {
3997
3968
  L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
3998
3969
  },
3999
3970
  zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
4000
- copy$6(matrix, t.__localMatrix);
4001
- scaleOfOuter$3(matrix, origin, scaleX, scaleY);
4002
- moveByMatrix(t, matrix);
3971
+ copy$7(matrix$1, t.__localMatrix);
3972
+ scaleOfOuter$3(matrix$1, origin, scaleX, scaleY);
3973
+ moveByMatrix(t, matrix$1);
4003
3974
  t.scaleResize(scaleX, scaleY, resize !== true);
4004
3975
  },
4005
3976
  rotateOfWorld(t, origin, angle) {
4006
3977
  L.rotateOfLocal(t, getTempLocal(t, origin), angle);
4007
3978
  },
4008
3979
  rotateOfLocal(t, origin, angle) {
4009
- copy$6(matrix, t.__localMatrix);
4010
- rotateOfOuter$3(matrix, origin, angle);
4011
- moveByMatrix(t, matrix);
3980
+ copy$7(matrix$1, t.__localMatrix);
3981
+ rotateOfOuter$3(matrix$1, origin, angle);
3982
+ moveByMatrix(t, matrix$1);
4012
3983
  t.rotation = MathHelper.formatRotation(t.rotation + angle);
4013
3984
  },
4014
3985
  skewOfWorld(t, origin, skewX, skewY, resize) {
4015
3986
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize);
4016
3987
  },
4017
3988
  skewOfLocal(t, origin, skewX, skewY = 0, resize) {
4018
- copy$6(matrix, t.__localMatrix);
4019
- skewOfOuter(matrix, origin, skewX, skewY);
4020
- L.setTransform(t, matrix, resize);
3989
+ copy$7(matrix$1, t.__localMatrix);
3990
+ skewOfOuter(matrix$1, origin, skewX, skewY);
3991
+ L.setTransform(t, matrix$1, resize);
4021
3992
  },
4022
3993
  transformWorld(t, transform, resize) {
4023
- copy$6(matrix, t.worldTransform);
4024
- multiplyParent$2(matrix, transform);
3994
+ copy$7(matrix$1, t.worldTransform);
3995
+ multiplyParent$2(matrix$1, transform);
4025
3996
  if (t.parent)
4026
- divideParent(matrix, t.parent.worldTransform);
4027
- L.setTransform(t, matrix, resize);
3997
+ divideParent(matrix$1, t.parent.worldTransform);
3998
+ L.setTransform(t, matrix$1, resize);
4028
3999
  },
4029
4000
  transform(t, transform, resize) {
4030
- copy$6(matrix, t.localTransform);
4031
- multiplyParent$2(matrix, transform);
4032
- L.setTransform(t, matrix, resize);
4001
+ copy$7(matrix$1, t.localTransform);
4002
+ multiplyParent$2(matrix$1, transform);
4003
+ L.setTransform(t, matrix$1, resize);
4033
4004
  },
4034
4005
  setTransform(t, transform, resize) {
4035
4006
  const layout = getLayout(transform);
@@ -4041,9 +4012,9 @@ const LeafHelper = {
4041
4012
  t.set(layout);
4042
4013
  },
4043
4014
  getRelativeWorld(t, relative, temp) {
4044
- copy$6(matrix, t.worldTransform);
4045
- divideParent(matrix, relative.worldTransform);
4046
- return temp ? matrix : Object.assign({}, matrix);
4015
+ copy$7(matrix$1, t.worldTransform);
4016
+ divideParent(matrix$1, relative.worldTransform);
4017
+ return temp ? matrix$1 : Object.assign({}, matrix$1);
4047
4018
  },
4048
4019
  drop(t, parent, index, resize) {
4049
4020
  t.setTransform(L.getRelativeWorld(t, parent, true), resize);
@@ -4183,7 +4154,7 @@ const { pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack, updateBoun
4183
4154
 
4184
4155
  const WaitHelper = {
4185
4156
  run(wait) {
4186
- if (wait.length) {
4157
+ if (wait && wait.length) {
4187
4158
  const len = wait.length;
4188
4159
  for (let i = 0; i < len; i++) {
4189
4160
  wait[i]();
@@ -4194,7 +4165,7 @@ const WaitHelper = {
4194
4165
  };
4195
4166
 
4196
4167
  const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
4197
- const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
4168
+ const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
4198
4169
  class LeafLayout {
4199
4170
  get strokeBounds() { return this._strokeBounds || this.boxBounds; }
4200
4171
  get renderBounds() { return this._renderBounds || this.boxBounds; }
@@ -4339,7 +4310,7 @@ class LeafLayout {
4339
4310
  matrix = getRelativeWorld$1(leaf, relative, true);
4340
4311
  }
4341
4312
  const layoutBounds = MatrixHelper.getLayout(matrix);
4342
- copy$5(layoutBounds, bounds);
4313
+ copy$6(layoutBounds, bounds);
4343
4314
  PointHelper.copy(layoutBounds, point);
4344
4315
  if (unscale) {
4345
4316
  const { scaleX, scaleY } = layoutBounds;
@@ -4733,10 +4704,16 @@ LeaferEvent.STOP = 'leafer.stop';
4733
4704
  LeaferEvent.RESTART = 'leafer.restart';
4734
4705
  LeaferEvent.END = 'leafer.end';
4735
4706
 
4707
+ const { isFinite } = Number;
4708
+ const debug$7 = Debug.get('setAttr');
4736
4709
  const LeafDataProxy = {
4737
- __setAttr(name, newValue) {
4710
+ __setAttr(name, newValue, checkFiniteNumber) {
4738
4711
  if (this.leafer && this.leafer.created) {
4739
4712
  const oldValue = this.__.__getInput(name);
4713
+ if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
4714
+ debug$7.warn(this.innerName, name, newValue);
4715
+ newValue = undefined;
4716
+ }
4740
4717
  if (typeof newValue === 'object' || oldValue !== newValue) {
4741
4718
  this.__[name] = newValue;
4742
4719
  if (this.__proxyData)
@@ -4751,12 +4728,17 @@ const LeafDataProxy = {
4751
4728
  this.emitEvent(event);
4752
4729
  }
4753
4730
  this.leafer.emitEvent(event);
4731
+ return true;
4732
+ }
4733
+ else {
4734
+ return false;
4754
4735
  }
4755
4736
  }
4756
4737
  else {
4757
4738
  this.__[name] = newValue;
4758
4739
  if (this.__proxyData)
4759
4740
  this.setProxyAttr(name, newValue);
4741
+ return true;
4760
4742
  }
4761
4743
  },
4762
4744
  __getAttr(name) {
@@ -4794,7 +4776,7 @@ const LeafMatrix = {
4794
4776
 
4795
4777
  const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2, hasParentAutoLayout } = LeafHelper;
4796
4778
  const { updateBounds: updateBounds$1 } = BranchHelper;
4797
- const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1 } = BoundsHelper;
4779
+ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
4798
4780
  const { toBounds: toBounds$2 } = PathBounds;
4799
4781
  const LeafBounds = {
4800
4782
  __updateWorldBounds() {
@@ -4912,7 +4894,8 @@ const LeafBounds = {
4912
4894
  copyAndSpread$1(this.__layout.strokeBounds, this.__layout.boxBounds, this.__layout.strokeSpread);
4913
4895
  },
4914
4896
  __updateRenderBounds() {
4915
- copyAndSpread$1(this.__layout.renderBounds, this.__layout.strokeBounds, this.__layout.renderSpread);
4897
+ const { renderSpread, strokeBounds, renderBounds } = this.__layout;
4898
+ renderSpread > 0 ? copyAndSpread$1(renderBounds, strokeBounds, renderSpread) : copy$5(renderBounds, strokeBounds);
4916
4899
  },
4917
4900
  };
4918
4901
 
@@ -5098,7 +5081,7 @@ let Leaf = class Leaf {
5098
5081
  toString() {
5099
5082
  return JSON.stringify(this.toJSON());
5100
5083
  }
5101
- __setAttr(_attrName, _newValue) { }
5084
+ __setAttr(_attrName, _newValue) { return true; }
5102
5085
  __getAttr(_attrName) { return undefined; }
5103
5086
  setProxyAttr(_attrName, _newValue) { }
5104
5087
  getProxyAttr(_attrName) { return undefined; }
@@ -5282,24 +5265,16 @@ let Leaf = class Leaf {
5282
5265
  __scaleResize(_scaleX, _scaleY) { }
5283
5266
  __hitWorld(_point) { return true; }
5284
5267
  __hit(_local) { return true; }
5285
- __hitFill(inner, windingRule) {
5286
- var _a;
5287
- return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, windingRule);
5288
- }
5289
- __hitStroke(inner, strokeWidth) {
5290
- var _a;
5291
- return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth);
5292
- }
5293
- __drawHitPath(canvas) {
5294
- if (canvas)
5295
- this.__drawRenderPath(canvas);
5296
- }
5268
+ __hitFill(_inner) { return true; }
5269
+ __hitStroke(_inner, _strokeWidth) { return true; }
5270
+ __hitPixel(_inner) { return true; }
5271
+ __drawHitPath(_canvas) { }
5297
5272
  __updateHitCanvas() { }
5298
5273
  __render(_canvas, _options) { }
5299
5274
  __drawFast(_canvas, _options) { }
5300
5275
  __draw(_canvas, _options) { }
5301
5276
  __clip(_canvas, _options) { }
5302
- __renderShape(_canvas, _options) { }
5277
+ __renderShape(_canvas, _options, _ignoreFill, _ignoreStroke) { }
5303
5278
  __updateWorldOpacity() { }
5304
5279
  __updateChange() { }
5305
5280
  __drawPath(_canvas) { }
@@ -5740,9 +5715,12 @@ function useCanvas(_canvasType, app) {
5740
5715
  canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
5741
5716
  canvasToBolb: (canvas, type, quality) => canvas.toBuffer(type, { quality }),
5742
5717
  canvasSaveAs: (canvas, filePath, quality) => {
5718
+ let data = canvas.toDataURL(mineType(fileType(filePath)), quality);
5719
+ data = data.substring(data.indexOf('64,') + 3);
5720
+ return Platform.origin.download(data, filePath);
5721
+ },
5722
+ download(data, filePath) {
5743
5723
  return new Promise((resolve, reject) => {
5744
- let data = canvas.toDataURL(mineType(fileType(filePath)), quality);
5745
- data = data.substring(data.indexOf('64,') + 3);
5746
5724
  let toAlbum;
5747
5725
  if (!filePath.includes('/')) {
5748
5726
  filePath = `${app.env.USER_DATA_PATH}/` + filePath;
@@ -6024,7 +6002,7 @@ class LayoutBlockData {
6024
6002
  }
6025
6003
 
6026
6004
  const { updateAllMatrix, updateAllChange } = LeafHelper;
6027
- const debug$5 = Debug.get('Layouter');
6005
+ const debug$6 = Debug.get('Layouter');
6028
6006
  class Layouter {
6029
6007
  constructor(target, userConfig) {
6030
6008
  this.totalTimes = 0;
@@ -6059,7 +6037,7 @@ class Layouter {
6059
6037
  target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
6060
6038
  }
6061
6039
  catch (e) {
6062
- debug$5.error(e);
6040
+ debug$6.error(e);
6063
6041
  }
6064
6042
  this.layoutedBlocks = null;
6065
6043
  }
@@ -6073,9 +6051,9 @@ class Layouter {
6073
6051
  }
6074
6052
  layoutOnce() {
6075
6053
  if (this.layouting)
6076
- return debug$5.warn('layouting');
6054
+ return debug$6.warn('layouting');
6077
6055
  if (this.times > 3)
6078
- return debug$5.warn('layout max times');
6056
+ return debug$6.warn('layout max times');
6079
6057
  this.times++;
6080
6058
  this.totalTimes++;
6081
6059
  this.layouting = true;
@@ -6179,7 +6157,7 @@ class Layouter {
6179
6157
  }
6180
6158
  }
6181
6159
 
6182
- const debug$4 = Debug.get('Renderer');
6160
+ const debug$5 = Debug.get('Renderer');
6183
6161
  class Renderer {
6184
6162
  get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
6185
6163
  constructor(target, canvas, userConfig) {
@@ -6217,7 +6195,7 @@ class Renderer {
6217
6195
  const { target } = this;
6218
6196
  this.times = 0;
6219
6197
  this.totalBounds = new Bounds();
6220
- debug$4.log(target.innerName, '--->');
6198
+ debug$5.log(target.innerName, '--->');
6221
6199
  try {
6222
6200
  this.emitRender(RenderEvent.START);
6223
6201
  this.renderOnce(callback);
@@ -6226,9 +6204,9 @@ class Renderer {
6226
6204
  }
6227
6205
  catch (e) {
6228
6206
  this.rendering = false;
6229
- debug$4.error(e);
6207
+ debug$5.error(e);
6230
6208
  }
6231
- debug$4.log('-------------|');
6209
+ debug$5.log('-------------|');
6232
6210
  }
6233
6211
  renderAgain() {
6234
6212
  if (this.rendering) {
@@ -6240,9 +6218,9 @@ class Renderer {
6240
6218
  }
6241
6219
  renderOnce(callback) {
6242
6220
  if (this.rendering)
6243
- return debug$4.warn('rendering');
6221
+ return debug$5.warn('rendering');
6244
6222
  if (this.times > 3)
6245
- return debug$4.warn('render max times');
6223
+ return debug$5.warn('render max times');
6246
6224
  this.times++;
6247
6225
  this.totalTimes++;
6248
6226
  this.rendering = true;
@@ -6279,7 +6257,7 @@ class Renderer {
6279
6257
  partRender() {
6280
6258
  const { canvas, updateBlocks: list } = this;
6281
6259
  if (!list)
6282
- return debug$4.warn('PartRender: need update attr');
6260
+ return debug$5.warn('PartRender: need update attr');
6283
6261
  this.mergeBlocks();
6284
6262
  list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
6285
6263
  this.clipRender(block); });
@@ -6379,7 +6357,7 @@ class Renderer {
6379
6357
  empty = (!leaf.__world.width || !leaf.__world.height);
6380
6358
  if (empty) {
6381
6359
  if (!leaf.isLeafer)
6382
- debug$4.tip(leaf.innerName, ': empty');
6360
+ debug$5.tip(leaf.innerName, ': empty');
6383
6361
  empty = (!leaf.isBranch || leaf.isBranchLeaf);
6384
6362
  }
6385
6363
  return empty;
@@ -6674,51 +6652,42 @@ const Export = {};
6674
6652
  const State = {};
6675
6653
 
6676
6654
  function stateType(defaultValue) {
6677
- return (target, key) => {
6678
- const stateType = key + 'Style';
6679
- defineLeafAttr(target, key, defaultValue, {
6680
- set(value) {
6681
- this.__setAttr(key, value);
6682
- this.waitLeafer(() => { if (State.setStyle)
6683
- State.setStyle(this, stateType, value); });
6684
- }
6685
- });
6686
- };
6655
+ return decorateLeafAttr(defaultValue, (key) => attr({
6656
+ set(value) {
6657
+ this.__setAttr(key, value);
6658
+ this.waitLeafer(() => { if (State.setStyle)
6659
+ State.setStyle(this, key + 'Style', value); });
6660
+ }
6661
+ }));
6687
6662
  }
6688
6663
  function arrowType(defaultValue) {
6689
- return (target, key) => {
6690
- defineLeafAttr(target, key, defaultValue, {
6691
- set(value) {
6692
- this.__setAttr(key, value);
6693
- const data = this.__;
6694
- data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6695
- doStrokeType(this);
6696
- }
6697
- });
6698
- };
6664
+ return decorateLeafAttr(defaultValue, (key) => attr({
6665
+ set(value) {
6666
+ this.__setAttr(key, value);
6667
+ const data = this.__;
6668
+ data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6669
+ doStrokeType(this);
6670
+ }
6671
+ }));
6699
6672
  }
6700
6673
  function effectType(defaultValue) {
6701
- return (target, key) => {
6702
- defineLeafAttr(target, key, defaultValue, {
6703
- set(value) {
6704
- this.__setAttr(key, value);
6705
- if (value)
6706
- this.__.__useEffect = true;
6707
- this.__layout.renderChanged || this.__layout.renderChange();
6708
- }
6709
- });
6710
- };
6674
+ return decorateLeafAttr(defaultValue, (key) => attr({
6675
+ set(value) {
6676
+ this.__setAttr(key, value);
6677
+ if (value)
6678
+ this.__.__useEffect = true;
6679
+ this.__layout.renderChanged || this.__layout.renderChange();
6680
+ }
6681
+ }));
6711
6682
  }
6712
6683
  function resizeType(defaultValue) {
6713
- return (target, key) => {
6714
- defineLeafAttr(target, key, defaultValue, {
6715
- set(value) {
6716
- this.__setAttr(key, value);
6717
- this.__layout.boxChanged || this.__layout.boxChange();
6718
- this.__updateSize();
6719
- }
6720
- });
6721
- };
6684
+ return decorateLeafAttr(defaultValue, (key) => attr({
6685
+ set(value) {
6686
+ this.__setAttr(key, value);
6687
+ this.__layout.boxChanged || this.__layout.boxChange();
6688
+ this.__updateSize();
6689
+ }
6690
+ }));
6722
6691
  }
6723
6692
  function zoomLayerType() {
6724
6693
  return (target, key) => {
@@ -6733,12 +6702,13 @@ function zoomLayerType() {
6733
6702
 
6734
6703
  const { parse } = PathConvert;
6735
6704
  const emptyPaint = {};
6736
- const debug$3 = Debug.get('UIData');
6705
+ const debug$4 = Debug.get('UIData');
6737
6706
  class UIData extends LeafData {
6738
6707
  get __strokeWidth() {
6739
6708
  const { strokeWidth, strokeWidthFixed } = this;
6740
6709
  if (strokeWidthFixed) {
6741
- let { scaleX } = this.__leaf.__nowWorld;
6710
+ const ui = this.__leaf;
6711
+ let { scaleX } = ui.__nowWorld || ui.__world;
6742
6712
  if (scaleX < 0)
6743
6713
  scaleX = -scaleX;
6744
6714
  return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
@@ -6760,7 +6730,7 @@ class UIData extends LeafData {
6760
6730
  if (value < 0) {
6761
6731
  this._width = -value;
6762
6732
  this.__leaf.scaleX *= -1;
6763
- debug$3.warn('width < 0, instead -scaleX ', this);
6733
+ debug$4.warn('width < 0, instead -scaleX ', this);
6764
6734
  }
6765
6735
  else {
6766
6736
  this._width = value;
@@ -6770,7 +6740,7 @@ class UIData extends LeafData {
6770
6740
  if (value < 0) {
6771
6741
  this._height = -value;
6772
6742
  this.__leaf.scaleY *= -1;
6773
- debug$3.warn('height < 0, instead -scaleY', this);
6743
+ debug$4.warn('height < 0, instead -scaleY', this);
6774
6744
  }
6775
6745
  else {
6776
6746
  this._height = value;
@@ -7057,14 +7027,14 @@ const UIRender = {
7057
7027
  }
7058
7028
  }
7059
7029
  },
7060
- __renderShape(canvas, options) {
7030
+ __renderShape(canvas, options, ignoreFill, ignoreStroke) {
7061
7031
  if (this.__worldOpacity) {
7062
7032
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
7063
7033
  const { fill, stroke } = this.__;
7064
7034
  this.__drawRenderPath(canvas);
7065
- if (fill)
7035
+ if (fill && !ignoreFill)
7066
7036
  this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7067
- if (stroke)
7037
+ if (stroke && !ignoreStroke)
7068
7038
  this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7069
7039
  }
7070
7040
  }
@@ -7162,10 +7132,7 @@ let UI = UI_1 = class UI extends Leaf {
7162
7132
  __onUpdateSize() {
7163
7133
  if (this.__.__input) {
7164
7134
  const data = this.__;
7165
- data.__needComputePaint = true;
7166
- if (data.lazy && this.leafer && !this.leafer.canvas.bounds.hit(this.__world))
7167
- return;
7168
- data.__computePaint();
7135
+ (data.lazy && this.leafer && this.leafer.created && !this.leafer.lazyBounds.hit(this.__world)) ? data.__needComputePaint = true : data.__computePaint();
7169
7136
  }
7170
7137
  }
7171
7138
  __updateRenderPath() {
@@ -7267,31 +7234,31 @@ __decorate([
7267
7234
  eraserType(false)
7268
7235
  ], UI.prototype, "eraser", void 0);
7269
7236
  __decorate([
7270
- positionType(0)
7237
+ positionType(0, true)
7271
7238
  ], UI.prototype, "x", void 0);
7272
7239
  __decorate([
7273
- positionType(0)
7240
+ positionType(0, true)
7274
7241
  ], UI.prototype, "y", void 0);
7275
7242
  __decorate([
7276
- boundsType(100)
7243
+ boundsType(100, true)
7277
7244
  ], UI.prototype, "width", void 0);
7278
7245
  __decorate([
7279
- boundsType(100)
7246
+ boundsType(100, true)
7280
7247
  ], UI.prototype, "height", void 0);
7281
7248
  __decorate([
7282
- scaleType(1)
7249
+ scaleType(1, true)
7283
7250
  ], UI.prototype, "scaleX", void 0);
7284
7251
  __decorate([
7285
- scaleType(1)
7252
+ scaleType(1, true)
7286
7253
  ], UI.prototype, "scaleY", void 0);
7287
7254
  __decorate([
7288
- rotationType(0)
7255
+ rotationType(0, true)
7289
7256
  ], UI.prototype, "rotation", void 0);
7290
7257
  __decorate([
7291
- rotationType(0)
7258
+ rotationType(0, true)
7292
7259
  ], UI.prototype, "skewX", void 0);
7293
7260
  __decorate([
7294
- rotationType(0)
7261
+ rotationType(0, true)
7295
7262
  ], UI.prototype, "skewY", void 0);
7296
7263
  __decorate([
7297
7264
  autoLayoutType()
@@ -7305,6 +7272,9 @@ __decorate([
7305
7272
  __decorate([
7306
7273
  dataType('size')
7307
7274
  ], UI.prototype, "editSize", void 0);
7275
+ __decorate([
7276
+ dataType()
7277
+ ], UI.prototype, "editorStyle", void 0);
7308
7278
  __decorate([
7309
7279
  hitType(true)
7310
7280
  ], UI.prototype, "hittable", void 0);
@@ -7371,6 +7341,9 @@ __decorate([
7371
7341
  __decorate([
7372
7342
  pathType()
7373
7343
  ], UI.prototype, "windingRule", void 0);
7344
+ __decorate([
7345
+ pathType(true)
7346
+ ], UI.prototype, "closed", void 0);
7374
7347
  __decorate([
7375
7348
  arrowType('none')
7376
7349
  ], UI.prototype, "startArrow", void 0);
@@ -7490,14 +7463,17 @@ Group = __decorate([
7490
7463
  registerUI()
7491
7464
  ], Group);
7492
7465
 
7493
- const debug$2 = Debug.get('Leafer');
7494
- let Leafer = class Leafer extends Group {
7466
+ var Leafer_1;
7467
+ const debug$3 = Debug.get('Leafer');
7468
+ let Leafer = Leafer_1 = class Leafer extends Group {
7469
+ static get version() { return '1.0.0-rc.20'; }
7495
7470
  get __tag() { return 'Leafer'; }
7496
7471
  get isApp() { return false; }
7497
7472
  get app() { return this.parent || this; }
7498
7473
  get isLeafer() { return true; }
7499
7474
  get imageReady() { return this.viewReady && ImageManager.isComplete; }
7500
7475
  get layoutLocked() { return !this.layouter.running; }
7476
+ get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7501
7477
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
7502
7478
  constructor(userConfig, data) {
7503
7479
  super(data);
@@ -7506,6 +7482,7 @@ let Leafer = class Leafer extends Group {
7506
7482
  start: true,
7507
7483
  hittable: true,
7508
7484
  smooth: true,
7485
+ lazySpeard: 100,
7509
7486
  zoom: {
7510
7487
  min: 0.01,
7511
7488
  max: 256
@@ -7526,6 +7503,7 @@ let Leafer = class Leafer extends Group {
7526
7503
  this.userConfig = userConfig;
7527
7504
  if (userConfig && (userConfig.view || userConfig.width))
7528
7505
  this.init(userConfig);
7506
+ Leafer_1.list.add(this);
7529
7507
  }
7530
7508
  init(userConfig, parentApp) {
7531
7509
  if (this.canvas)
@@ -7536,19 +7514,20 @@ let Leafer = class Leafer extends Group {
7536
7514
  let start;
7537
7515
  const { config } = this;
7538
7516
  this.initType(config.type);
7539
- this.canvas = Creator.canvas(config);
7540
- this.__controllers.push(this.renderer = Creator.renderer(this, this.canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
7517
+ const canvas = this.canvas = Creator.canvas(config);
7518
+ this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
7541
7519
  if (this.isApp)
7542
7520
  this.__setApp();
7543
7521
  this.__checkAutoLayout(config);
7544
- this.view = this.canvas.view;
7522
+ this.updateLazyBounds();
7523
+ this.view = canvas.view;
7545
7524
  if (parentApp) {
7546
7525
  this.__bindApp(parentApp);
7547
7526
  start = parentApp.running;
7548
7527
  }
7549
7528
  else {
7550
7529
  this.selector = Creator.selector(this);
7551
- this.interaction = Creator.interaction(this, this.canvas, this.selector, config);
7530
+ this.interaction = Creator.interaction(this, canvas, this.selector, config);
7552
7531
  if (this.interaction) {
7553
7532
  this.__controllers.unshift(this.interaction);
7554
7533
  this.hitCanvasManager = Creator.hitCanvasManager();
@@ -7558,23 +7537,17 @@ let Leafer = class Leafer extends Group {
7558
7537
  }
7559
7538
  this.hittable = config.hittable;
7560
7539
  this.fill = config.fill;
7561
- this.canvasManager.add(this.canvas);
7540
+ this.canvasManager.add(canvas);
7562
7541
  this.__listenEvents();
7563
7542
  if (start)
7564
7543
  this.__startTimer = setTimeout(this.start.bind(this));
7544
+ WaitHelper.run(this.__initWait);
7565
7545
  this.onInit();
7566
7546
  }
7567
7547
  onInit() { }
7568
7548
  initType(_type) { }
7569
7549
  set(data) {
7570
- if (!this.children) {
7571
- setTimeout(() => {
7572
- super.set(data);
7573
- });
7574
- }
7575
- else {
7576
- super.set(data);
7577
- }
7550
+ this.waitInit(() => { super.set(data); });
7578
7551
  }
7579
7552
  start() {
7580
7553
  clearTimeout(this.__startTimer);
@@ -7619,11 +7592,16 @@ let Leafer = class Leafer extends Group {
7619
7592
  if (i)
7620
7593
  cursor ? i.setCursor(cursor) : i.updateCursor();
7621
7594
  }
7595
+ updateLazyBounds() {
7596
+ this.lazyBounds = this.canvas.bounds.clone().spread(this.config.lazySpeard);
7597
+ }
7622
7598
  __doResize(size) {
7623
- if (!this.canvas || this.canvas.isSameSize(size))
7599
+ const { canvas } = this;
7600
+ if (!canvas || canvas.isSameSize(size))
7624
7601
  return;
7625
7602
  const old = DataHelper.copyAttrs({}, this.canvas, canvasSizeAttrs);
7626
- this.canvas.resize(size);
7603
+ canvas.resize(size);
7604
+ this.updateLazyBounds();
7627
7605
  this.__onResize(new ResizeEvent(size, old));
7628
7606
  }
7629
7607
  __onResize(event) {
@@ -7661,7 +7639,7 @@ let Leafer = class Leafer extends Group {
7661
7639
  this.canvas.hittable = newValue;
7662
7640
  }
7663
7641
  }
7664
- super.__setAttr(attrName, newValue);
7642
+ return super.__setAttr(attrName, newValue);
7665
7643
  }
7666
7644
  __getAttr(attrName) {
7667
7645
  if (this.canvas && canvasSizeAttrs.includes(attrName))
@@ -7728,6 +7706,13 @@ let Leafer = class Leafer extends Group {
7728
7706
  this.nextRender(() => this.interaction.updateCursor());
7729
7707
  }
7730
7708
  }
7709
+ waitInit(item, bind) {
7710
+ if (bind)
7711
+ item = item.bind(bind);
7712
+ if (!this.__initWait)
7713
+ this.__initWait = [];
7714
+ this.canvas ? item() : this.__initWait.push(item);
7715
+ }
7731
7716
  waitReady(item, bind) {
7732
7717
  if (bind)
7733
7718
  item = item.bind(bind);
@@ -7767,14 +7752,8 @@ let Leafer = class Leafer extends Group {
7767
7752
  }
7768
7753
  }
7769
7754
  zoom(_zoomType, _padding, _fixedScale) { return undefined; }
7770
- validScale(changeScale) {
7771
- const { scaleX } = this.zoomLayer.__, { min, max } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
7772
- if (absScale < min)
7773
- changeScale = min / scaleX;
7774
- else if (absScale > max)
7775
- changeScale = max / scaleX;
7776
- return changeScale;
7777
- }
7755
+ getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
7756
+ getValidScale(changeScale) { return changeScale; }
7778
7757
  __checkUpdateLayout() {
7779
7758
  this.__layout.update();
7780
7759
  }
@@ -7793,9 +7772,10 @@ let Leafer = class Leafer extends Group {
7793
7772
  this.off_(this.__eventIds);
7794
7773
  this.__eventIds.length = 0;
7795
7774
  }
7796
- destroy() {
7797
- setTimeout(() => {
7775
+ destroy(sync) {
7776
+ const doDestory = () => {
7798
7777
  if (!this.destroyed) {
7778
+ Leafer_1.list.remove(this);
7799
7779
  try {
7800
7780
  this.stop();
7801
7781
  this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
@@ -7820,19 +7800,21 @@ let Leafer = class Leafer extends Group {
7820
7800
  setTimeout(() => { ImageManager.clearRecycled(); }, 100);
7821
7801
  }
7822
7802
  catch (e) {
7823
- debug$2.error(e);
7803
+ debug$3.error(e);
7824
7804
  }
7825
7805
  }
7826
- });
7806
+ };
7807
+ sync ? doDestory() : setTimeout(doDestory);
7827
7808
  }
7828
7809
  };
7810
+ Leafer.list = new LeafList();
7829
7811
  __decorate([
7830
7812
  dataProcessor(LeaferData)
7831
7813
  ], Leafer.prototype, "__", void 0);
7832
7814
  __decorate([
7833
7815
  boundsType()
7834
7816
  ], Leafer.prototype, "pixelRatio", void 0);
7835
- Leafer = __decorate([
7817
+ Leafer = Leafer_1 = __decorate([
7836
7818
  registerUI()
7837
7819
  ], Leafer);
7838
7820
 
@@ -7865,11 +7847,9 @@ let Box = class Box extends Group {
7865
7847
  __updateStrokeSpread() { return 0; }
7866
7848
  __updateRectRenderSpread() { return 0; }
7867
7849
  __updateRenderSpread() {
7868
- let width = this.__updateRectRenderSpread() || super.__updateRenderSpread();
7869
- this.__.__drawAfterFill = this.__.overflow === 'hide';
7870
- if (!width)
7871
- width = this.__.__drawAfterFill ? 0 : 1;
7872
- return width;
7850
+ const width = this.__updateRectRenderSpread();
7851
+ const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
7852
+ return (width || hide) ? width : -1;
7873
7853
  }
7874
7854
  __updateRectBoxBounds() { }
7875
7855
  __updateBoxBounds() {
@@ -8063,7 +8043,7 @@ let Line = class Line extends UI {
8063
8043
  __updatePath() {
8064
8044
  const path = this.__.path = [];
8065
8045
  if (this.__.points) {
8066
- drawPoints$1(path, this.__.points, false);
8046
+ drawPoints$1(path, this.__.points, this.__.closed);
8067
8047
  }
8068
8048
  else {
8069
8049
  moveTo$2(path, 0, 0);
@@ -8073,7 +8053,7 @@ let Line = class Line extends UI {
8073
8053
  __updateRenderPath() {
8074
8054
  const data = this.__;
8075
8055
  if (!this.pathInputed && data.points && data.curve) {
8076
- drawPoints$1(data.__pathForRender = [], data.points, data.curve, this.pathClosed);
8056
+ drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
8077
8057
  if (data.__useArrow)
8078
8058
  PathArrow.addArrows(this, false);
8079
8059
  }
@@ -8105,6 +8085,9 @@ __decorate([
8105
8085
  __decorate([
8106
8086
  pathType(0)
8107
8087
  ], Line.prototype, "curve", void 0);
8088
+ __decorate([
8089
+ pathType(false)
8090
+ ], Line.prototype, "closed", void 0);
8108
8091
  Line = __decorate([
8109
8092
  registerUI()
8110
8093
  ], Line);
@@ -8116,7 +8099,6 @@ let Polygon = class Polygon extends UI {
8116
8099
  get __tag() { return 'Polygon'; }
8117
8100
  constructor(data) {
8118
8101
  super(data);
8119
- this.pathClosed = true;
8120
8102
  }
8121
8103
  __updatePath() {
8122
8104
  const path = this.__.path = [];
@@ -8286,6 +8268,9 @@ __decorate([
8286
8268
  __decorate([
8287
8269
  resizeType(true)
8288
8270
  ], Canvas.prototype, "smooth", void 0);
8271
+ __decorate([
8272
+ resizeType()
8273
+ ], Canvas.prototype, "contextSettings", void 0);
8289
8274
  __decorate([
8290
8275
  hitType('all')
8291
8276
  ], Canvas.prototype, "hitFill", void 0);
@@ -8362,6 +8347,8 @@ let Text = class Text extends UI {
8362
8347
  else {
8363
8348
  super.__updateBoxBounds();
8364
8349
  }
8350
+ if (italic)
8351
+ b.width += fontSize * 0.16;
8365
8352
  const contentBounds = includes(b, bounds) ? b : bounds;
8366
8353
  if (contentBounds !== layout.contentBounds) {
8367
8354
  layout.contentBounds = contentBounds;
@@ -8499,6 +8486,7 @@ let Pen = class Pen extends Group {
8499
8486
  drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { return this; }
8500
8487
  drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) { return this; }
8501
8488
  drawPoints(_points, _curve, _close) { return this; }
8489
+ clearPath() { return this; }
8502
8490
  paint() {
8503
8491
  this.pathElement.forceUpdate('path');
8504
8492
  }
@@ -8510,7 +8498,7 @@ __decorate([
8510
8498
  penPathType()
8511
8499
  ], Pen.prototype, "path", void 0);
8512
8500
  Pen = __decorate([
8513
- useModule(PathCreator, ['beginPath', 'path']),
8501
+ useModule(PathCreator, ['set', 'beginPath', 'path']),
8514
8502
  registerUI()
8515
8503
  ], Pen);
8516
8504
  function penPathType() {
@@ -8521,6 +8509,8 @@ function penPathType() {
8521
8509
  };
8522
8510
  }
8523
8511
 
8512
+ const version = "1.0.0-rc.20";
8513
+
8524
8514
  let App = class App extends Leafer {
8525
8515
  get __tag() { return 'App'; }
8526
8516
  get isApp() { return true; }
@@ -8612,7 +8602,8 @@ let App = class App extends Leafer {
8612
8602
  if (this.viewReady)
8613
8603
  this.renderer.update();
8614
8604
  }
8615
- __render(canvas, _options) {
8605
+ __render(canvas, options) {
8606
+ canvas.setWorld(options.matrix || this.__world);
8616
8607
  this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
8617
8608
  }
8618
8609
  __onResize(event) {
@@ -8645,11 +8636,6 @@ App = __decorate([
8645
8636
  registerUI()
8646
8637
  ], App);
8647
8638
 
8648
- function draw(leafer) {
8649
- const { config } = leafer;
8650
- config.move.dragOut = false;
8651
- }
8652
-
8653
8639
  const downKeyMap = {};
8654
8640
  const Keyboard = {
8655
8641
  isHoldSpaceKey() {
@@ -8844,21 +8830,16 @@ KeyEvent = __decorate([
8844
8830
  registerUIEvent()
8845
8831
  ], KeyEvent);
8846
8832
 
8847
- function design(leafer) {
8833
+ function addInteractionWindow(leafer) {
8848
8834
  if (leafer.isApp)
8849
8835
  return;
8850
8836
  leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => {
8851
- let { moveX, moveY } = e;
8852
- if (leafer.config.move.scroll) {
8853
- if (Math.abs(moveX) > Math.abs(moveY))
8854
- moveY = 0;
8855
- else
8856
- moveX = 0;
8857
- }
8858
- leafer.zoomLayer.move(moveX, moveY);
8837
+ const { x, y } = leafer.getValidMove(e.moveX, e.moveY);
8838
+ if (x || y)
8839
+ leafer.zoomLayer.move(x, y);
8859
8840
  }), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
8860
8841
  const { zoomLayer } = leafer;
8861
- const changeScale = leafer.validScale(e.scale);
8842
+ const changeScale = leafer.getValidScale(e.scale);
8862
8843
  if (changeScale !== 1) {
8863
8844
  PointHelper.scaleOf(zoomLayer, e, changeScale);
8864
8845
  zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
@@ -8866,12 +8847,18 @@ function design(leafer) {
8866
8847
  }));
8867
8848
  }
8868
8849
 
8869
- const debug$1 = Debug.get('LeaferTypeCreator');
8850
+ function document(leafer) {
8851
+ addInteractionWindow(leafer);
8852
+ leafer.config.move.scroll = 'limit';
8853
+ leafer.config.zoom.min = 1;
8854
+ }
8855
+
8856
+ const debug$2 = Debug.get('LeaferTypeCreator');
8870
8857
  const LeaferTypeCreator = {
8871
8858
  list: {},
8872
8859
  register(name, fn) {
8873
8860
  if (list[name]) {
8874
- debug$1.repeat(name);
8861
+ debug$2.repeat(name);
8875
8862
  }
8876
8863
  else {
8877
8864
  list[name] = fn;
@@ -8883,17 +8870,56 @@ const LeaferTypeCreator = {
8883
8870
  fn(leafer);
8884
8871
  }
8885
8872
  else {
8886
- debug$1.error('no', name);
8873
+ debug$2.error('no', name);
8887
8874
  }
8888
8875
  }
8889
8876
  };
8890
8877
  const { list, register } = LeaferTypeCreator;
8891
- register('draw', draw);
8892
- register('design', design);
8878
+ register('draw', () => { });
8879
+ register('design', addInteractionWindow);
8880
+ register('document', document);
8893
8881
 
8894
8882
  Leafer.prototype.initType = function (type) {
8895
8883
  LeaferTypeCreator.run(type, this);
8896
8884
  };
8885
+ Leafer.prototype.getValidMove = function (moveX, moveY) {
8886
+ const { scroll, disabled } = this.app.config.move;
8887
+ if (scroll) {
8888
+ if (Math.abs(moveX) > Math.abs(moveY))
8889
+ moveY = 0;
8890
+ else
8891
+ moveX = 0;
8892
+ if (scroll === 'limit') {
8893
+ const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
8894
+ const right = x + width - this.width, bottom = y + height - this.height;
8895
+ if (x >= 0 && right <= 0)
8896
+ moveX = 0;
8897
+ else if (moveX > 0) {
8898
+ if (x + moveX > 0)
8899
+ moveX = -x;
8900
+ }
8901
+ else if (moveX < 0 && right + moveX < 0)
8902
+ moveX = -right;
8903
+ if (y >= 0 && bottom <= 0)
8904
+ moveY = 0;
8905
+ else if (moveY > 0) {
8906
+ if (y + moveY > 0)
8907
+ moveY = -y;
8908
+ }
8909
+ else if (moveY < 0 && bottom + moveY < 0)
8910
+ moveY = -bottom;
8911
+ }
8912
+ }
8913
+ return { x: disabled ? 0 : moveX, y: disabled ? 0 : moveY };
8914
+ };
8915
+ Leafer.prototype.getValidScale = function (changeScale) {
8916
+ const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
8917
+ if (absScale < min)
8918
+ changeScale = min / scaleX;
8919
+ else if (absScale > max)
8920
+ changeScale = max / scaleX;
8921
+ return disabled ? 1 : changeScale;
8922
+ };
8897
8923
 
8898
8924
  class Transformer {
8899
8925
  constructor(interaction) {
@@ -9065,7 +9091,7 @@ class Dragger {
9065
9091
  return;
9066
9092
  }
9067
9093
  if (!this.moving && canDrag) {
9068
- if (this.moving = interaction.canMove(this.downData) || interaction.isHoldRightKey)
9094
+ if (this.moving = interaction.canMove(this.downData) || interaction.isHoldRightKey || interaction.isMobileDragEmpty)
9069
9095
  interaction.emit(MoveEvent.START, this.dragData);
9070
9096
  }
9071
9097
  if (!this.moving) {
@@ -9114,7 +9140,7 @@ class Dragger {
9114
9140
  const list = this.getList();
9115
9141
  if (list.length && running) {
9116
9142
  const { moveX, moveY } = this.dragData;
9117
- list.forEach(leaf => leaf.moveWorld(moveX, moveY));
9143
+ list.forEach(leaf => leaf.draggable && leaf.moveWorld(moveX, moveY));
9118
9144
  }
9119
9145
  }
9120
9146
  dragOverOrOut(data) {
@@ -9141,7 +9167,7 @@ class Dragger {
9141
9167
  this.dragEnterPath = path;
9142
9168
  }
9143
9169
  dragEnd(data, speed) {
9144
- if (!this.dragData)
9170
+ if (!this.dragging && !this.moving)
9145
9171
  return;
9146
9172
  const { moveX, moveY } = this.dragData;
9147
9173
  if (this.interaction.config.move.dragAnimate && this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
@@ -9164,12 +9190,16 @@ class Dragger {
9164
9190
  if (throughPath)
9165
9191
  endDragData.throughPath = throughPath;
9166
9192
  endDragData.path = path;
9167
- if (this.moving)
9193
+ if (this.moving) {
9194
+ this.moving = false;
9168
9195
  interaction.emit(MoveEvent.END, endDragData);
9196
+ }
9169
9197
  if (this.dragging) {
9198
+ const dropList = this.getList();
9199
+ this.dragging = false;
9170
9200
  interaction.emit(DragEvent.END, endDragData);
9171
- this.swipe(data, endDragData);
9172
- this.drop(data);
9201
+ this.swipe(data, downData, dragData, endDragData);
9202
+ this.drop(data, dropList, this.dragEnterPath);
9173
9203
  }
9174
9204
  this.autoMoveCancel();
9175
9205
  this.dragReset();
@@ -9181,22 +9211,21 @@ class Dragger {
9181
9211
  this.interaction.target.nextRender(animateWait, null, off);
9182
9212
  this.animateWait = func;
9183
9213
  }
9184
- swipe(data, endDragData) {
9185
- const { interaction, downData } = this;
9214
+ swipe(data, downData, dragData, endDragData) {
9215
+ const { interaction } = this;
9186
9216
  if (PointHelper.getDistance(downData, data) > interaction.config.pointer.swipeDistance) {
9187
- const swipeData = getSwipeEventData(downData, this.dragData, endDragData);
9217
+ const swipeData = getSwipeEventData(downData, dragData, endDragData);
9188
9218
  this.interaction.emit(swipeData.type, swipeData);
9189
9219
  }
9190
9220
  }
9191
- drop(data) {
9192
- const dropData = getDropEventData(data, this.getList(), DragEvent.data);
9193
- dropData.path = this.dragEnterPath;
9221
+ drop(data, dropList, dragEnterPath) {
9222
+ const dropData = getDropEventData(data, dropList, DragEvent.data);
9223
+ dropData.path = dragEnterPath;
9194
9224
  this.interaction.emit(DropEvent.DROP, dropData);
9195
- this.interaction.emit(DragEvent.LEAVE, data, this.dragEnterPath);
9225
+ this.interaction.emit(DragEvent.LEAVE, data, dragEnterPath);
9196
9226
  }
9197
9227
  dragReset() {
9198
9228
  DragEvent.list = DragEvent.data = this.dragableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9199
- this.dragging = this.moving = false;
9200
9229
  }
9201
9230
  checkDragOut(data) {
9202
9231
  const { interaction } = this;
@@ -9236,7 +9265,7 @@ class Dragger {
9236
9265
  }
9237
9266
  }
9238
9267
 
9239
- const debug = Debug.get('emit');
9268
+ const debug$1 = Debug.get('emit');
9240
9269
  function emit$1(type, data, path, excludePath) {
9241
9270
  if (!path && !data.path)
9242
9271
  return;
@@ -9266,7 +9295,7 @@ function emit$1(type, data, path, excludePath) {
9266
9295
  }
9267
9296
  }
9268
9297
  catch (e) {
9269
- debug.error(e);
9298
+ debug$1.error(e);
9270
9299
  }
9271
9300
  }
9272
9301
  const allowTypes = ['move', 'zoom', 'rotate', 'key'];
@@ -9328,6 +9357,7 @@ const config = {
9328
9357
  tapTime: 120,
9329
9358
  longPressTime: 800,
9330
9359
  transformTime: 500,
9360
+ hover: true,
9331
9361
  dragHover: true,
9332
9362
  dragDistance: 2,
9333
9363
  swipeDistance: 20,
@@ -9339,9 +9369,12 @@ const config = {
9339
9369
  const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData } = InteractionHelper;
9340
9370
  class InteractionBase {
9341
9371
  get dragging() { return this.dragger.dragging; }
9372
+ get moveMode() { return this.config.move.drag || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9342
9373
  get isDragEmpty() { return this.config.move.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9374
+ get isMobileDragEmpty() { return this.config.move.dragEmpty && !this.config.pointer.hover && this.downData && this.isTreePath(this.downData); }
9375
+ get isHoldMiddleKey() { return this.config.move.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
9343
9376
  get isHoldRightKey() { return this.config.move.holdRightKey && this.downData && PointerButton.right(this.downData); }
9344
- get moveMode() { return this.config.move.drag || (this.config.move.holdSpaceKey && Keyboard.isHoldSpaceKey()) || (this.downData && ((this.config.move.holdMiddleKey && PointerButton.middle(this.downData)) || (this.isHoldRightKey && this.dragger.moving))) || this.isDragEmpty; }
9377
+ get isHoldSpaceKey() { return this.config.move.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9345
9378
  get hitRadius() { return this.config.pointer.hitRadius; }
9346
9379
  constructor(target, canvas, selector, userConfig) {
9347
9380
  this.config = config;
@@ -9383,7 +9416,8 @@ class InteractionBase {
9383
9416
  this.waitMenuTap = true;
9384
9417
  }
9385
9418
  this.dragger.setDragData(data);
9386
- this.updateCursor(data);
9419
+ if (!this.isHoldRightKey)
9420
+ this.updateCursor(data);
9387
9421
  }
9388
9422
  pointerMove(data) {
9389
9423
  if (!data)
@@ -9401,9 +9435,10 @@ class InteractionBase {
9401
9435
  }
9402
9436
  }
9403
9437
  pointerMoveReal(data) {
9438
+ const { dragHover, dragDistance } = this.config.pointer;
9404
9439
  this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
9405
9440
  if (this.downData) {
9406
- const canDrag = PointHelper.getDistance(this.downData, data) > this.config.pointer.dragDistance;
9441
+ const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
9407
9442
  if (canDrag) {
9408
9443
  if (this.waitTap)
9409
9444
  this.pointerWaitCancel();
@@ -9415,7 +9450,7 @@ class InteractionBase {
9415
9450
  this.updateHoverData(data);
9416
9451
  this.checkPath(data);
9417
9452
  this.emit(PointerEvent.MOVE, data);
9418
- if (!(this.dragging && !this.config.pointer.dragHover))
9453
+ if (!(this.dragging && !dragHover))
9419
9454
  this.pointerHover(data);
9420
9455
  if (this.dragger.dragging) {
9421
9456
  this.dragger.dragOverOrOut(data);
@@ -9431,20 +9466,25 @@ class InteractionBase {
9431
9466
  if (!downData)
9432
9467
  return;
9433
9468
  PointerButton.defaultLeft(data);
9434
- this.downData = null;
9435
9469
  this.findPath(data);
9470
+ const upData = Object.assign(Object.assign({}, data), { path: data.path.clone() });
9436
9471
  data.path.addList(downData.path.list);
9437
9472
  this.checkPath(data);
9473
+ this.downData = null;
9438
9474
  this.emit(PointerEvent.BEFORE_UP, data);
9439
9475
  this.emit(PointerEvent.UP, data);
9440
9476
  this.touchLeave(data);
9441
- this.tap(data);
9442
- this.menuTap(data);
9477
+ if (!data.isCancel) {
9478
+ this.tap(data);
9479
+ this.menuTap(data);
9480
+ }
9443
9481
  this.dragger.dragEnd(data);
9444
- this.updateCursor(data);
9482
+ this.updateCursor(upData);
9445
9483
  }
9446
9484
  pointerCancel() {
9447
- this.pointerUp(this.dragger.dragData);
9485
+ const data = Object.assign({}, this.dragger.dragData);
9486
+ data.isCancel = true;
9487
+ this.pointerUp(data);
9448
9488
  }
9449
9489
  multiTouch(data, list) {
9450
9490
  const { move, angle, scale, center } = MultiTouchHelper.getData(list);
@@ -9494,8 +9534,10 @@ class InteractionBase {
9494
9534
  this.updateCursor();
9495
9535
  }
9496
9536
  pointerHover(data) {
9497
- this.pointerOverOrOut(data);
9498
- this.pointerEnterOrLeave(data);
9537
+ if (this.config.pointer.hover) {
9538
+ this.pointerOverOrOut(data);
9539
+ this.pointerEnterOrLeave(data);
9540
+ }
9499
9541
  }
9500
9542
  pointerOverOrOut(data) {
9501
9543
  const { path } = data;
@@ -9576,6 +9618,12 @@ class InteractionBase {
9576
9618
  isRootPath(data) {
9577
9619
  return data && data.path.list[0].isLeafer;
9578
9620
  }
9621
+ isTreePath(data) {
9622
+ const app = this.target.app;
9623
+ if (!app || !app.isApp)
9624
+ return false;
9625
+ return app.editor && (!data.path.has(app.editor) && data.path.has(app.tree));
9626
+ }
9579
9627
  checkPath(data, useDefaultPath) {
9580
9628
  if (useDefaultPath || this.canMove(data))
9581
9629
  data.path = this.defaultPath;
@@ -9622,7 +9670,7 @@ class InteractionBase {
9622
9670
  this.hoverData = data;
9623
9671
  }
9624
9672
  updateCursor(data) {
9625
- if (this.config.cursor.stop)
9673
+ if (this.config.cursor.stop || !this.config.pointer.hover)
9626
9674
  return;
9627
9675
  if (!data) {
9628
9676
  this.updateHoverData();
@@ -9732,22 +9780,25 @@ Cursor.custom = {};
9732
9780
  class HitCanvasManager extends CanvasManager {
9733
9781
  constructor() {
9734
9782
  super(...arguments);
9735
- this.pathTypeList = new LeafList();
9736
- this.imageTypeList = new LeafList();
9783
+ this.maxTotal = 1000;
9784
+ this.pathList = new LeafList();
9785
+ this.pixelList = new LeafList();
9737
9786
  }
9738
- getImageType(leaf, size) {
9739
- this.imageTypeList.add(leaf);
9740
- return Creator.hitCanvas(size);
9787
+ getPixelType(leaf, config) {
9788
+ this.__autoClear();
9789
+ this.pixelList.add(leaf);
9790
+ return Creator.hitCanvas(config);
9741
9791
  }
9742
9792
  getPathType(leaf) {
9743
- this.pathTypeList.add(leaf);
9793
+ this.__autoClear();
9794
+ this.pathList.add(leaf);
9744
9795
  return Creator.hitCanvas();
9745
9796
  }
9746
9797
  clearImageType() {
9747
- this.__clearLeafList(this.imageTypeList);
9798
+ this.__clearLeafList(this.pixelList);
9748
9799
  }
9749
9800
  clearPathType() {
9750
- this.__clearLeafList(this.pathTypeList);
9801
+ this.__clearLeafList(this.pathList);
9751
9802
  }
9752
9803
  __clearLeafList(leafList) {
9753
9804
  if (leafList.length) {
@@ -9760,56 +9811,117 @@ class HitCanvasManager extends CanvasManager {
9760
9811
  leafList.reset();
9761
9812
  }
9762
9813
  }
9814
+ __autoClear() {
9815
+ if (this.pathList.length + this.pixelList.length > this.maxTotal)
9816
+ this.clear();
9817
+ }
9763
9818
  clear() {
9764
9819
  this.clearPathType();
9765
9820
  this.clearImageType();
9766
9821
  }
9767
9822
  }
9768
9823
 
9824
+ const canvas$1 = LeaferCanvasBase.prototype;
9825
+ canvas$1.hitFill = function (point, fillRule) {
9826
+ return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
9827
+ };
9828
+ canvas$1.hitStroke = function (point, strokeWidth) {
9829
+ this.strokeWidth = strokeWidth;
9830
+ return this.context.isPointInStroke(point.x, point.y);
9831
+ };
9832
+ canvas$1.hitPixel = function (radiusPoint, offset, scale = 1) {
9833
+ let { x, y, radiusX, radiusY } = radiusPoint;
9834
+ if (offset)
9835
+ x -= offset.x, y -= offset.y;
9836
+ tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
9837
+ const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
9838
+ for (let i = 0, len = data.length; i < len; i += 4) {
9839
+ if (data[i + 3] > 0)
9840
+ return true;
9841
+ }
9842
+ return data[3] > 0;
9843
+ };
9844
+
9769
9845
  const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
9770
9846
  const inner = {};
9771
- Leaf.prototype.__hitWorld = function (point) {
9772
- if (this.__layout.hitCanvasChanged || !this.__hitCanvas) {
9773
- this.__updateHitCanvas();
9774
- if (!this.__layout.boundsChanged)
9775
- this.__layout.hitCanvasChanged = false;
9776
- }
9847
+ const leaf = Leaf.prototype;
9848
+ leaf.__hitWorld = function (point) {
9777
9849
  if (this.__.hitRadius) {
9778
9850
  copy$2(inner, point), point = inner;
9779
9851
  setRadius(point, this.__.hitRadius);
9780
9852
  }
9781
9853
  toInnerRadiusPointOf(point, this.__world, inner);
9782
- if (this.__.hitBox) {
9854
+ const { width, height } = this.__world;
9855
+ const isSmall = width < 10 && height < 10;
9856
+ if (this.__.hitBox || isSmall) {
9783
9857
  if (BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner))
9784
9858
  return true;
9859
+ if (isSmall)
9860
+ return false;
9861
+ }
9862
+ if (this.__layout.hitCanvasChanged || !this.__hitCanvas) {
9863
+ this.__updateHitCanvas();
9864
+ if (!this.__layout.boundsChanged)
9865
+ this.__layout.hitCanvasChanged = false;
9785
9866
  }
9786
9867
  return this.__hit(inner);
9787
9868
  };
9788
-
9789
- UI.prototype.__updateHitCanvas = function () {
9869
+ leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
9870
+ leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
9871
+ leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
9872
+ leaf.__drawHitPath = function (canvas) { if (canvas)
9873
+ this.__drawRenderPath(canvas); };
9874
+
9875
+ const matrix = new Matrix();
9876
+ const ui$1 = UI.prototype;
9877
+ ui$1.__updateHitCanvas = function () {
9878
+ const data = this.__, { hitCanvasManager } = this.leafer;
9879
+ const isHitPixelFill = data.__pixelFill && data.hitFill === 'pixel';
9880
+ const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
9881
+ const isHitPixel = isHitPixelFill || isHitPixelStroke;
9790
9882
  if (!this.__hitCanvas)
9791
- this.__hitCanvas = this.leafer.hitCanvasManager.getPathType(this);
9883
+ this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
9792
9884
  const h = this.__hitCanvas;
9885
+ if (isHitPixel) {
9886
+ const { renderBounds } = this.__layout;
9887
+ const size = Platform.image.hitCanvasSize;
9888
+ const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds, 0.5).a;
9889
+ const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
9890
+ h.resize({ width, height, pixelRatio: 1 });
9891
+ h.clear();
9892
+ ImageManager.patternLocked = true;
9893
+ this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
9894
+ ImageManager.patternLocked = false;
9895
+ h.resetTransform();
9896
+ data.__isHitPixel = true;
9897
+ }
9898
+ else {
9899
+ data.__isHitPixel && (data.__isHitPixel = false);
9900
+ }
9793
9901
  this.__drawHitPath(h);
9794
- h.setStrokeOptions(this.__);
9902
+ h.setStrokeOptions(data);
9795
9903
  };
9796
- UI.prototype.__hit = function (inner) {
9904
+ ui$1.__hit = function (inner) {
9797
9905
  if (Platform.name === 'miniapp')
9798
9906
  this.__drawHitPath(this.__hitCanvas);
9799
- const { fill, hitFill, windingRule } = this.__;
9800
- const needHitFill = (fill && hitFill === 'path') || hitFill === 'all';
9801
- const isHitFill = this.__hitFill(inner, windingRule);
9802
- if (needHitFill && isHitFill)
9907
+ const data = this.__;
9908
+ if (data.__isHitPixel && this.__hitPixel(inner))
9909
+ return true;
9910
+ const { hitFill } = data;
9911
+ const needHitFillPath = ((data.fill && hitFill == 'path') || hitFill === 'all');
9912
+ if (needHitFillPath && this.__hitFill(inner))
9803
9913
  return true;
9804
- const { stroke, hitStroke, __strokeWidth, strokeAlign } = this.__;
9805
- const needHitStroke = (stroke && hitStroke === 'path') || hitStroke === 'all';
9914
+ const { hitStroke, __strokeWidth } = data;
9915
+ const needHitStrokePath = ((data.stroke && hitStroke == 'path') || hitStroke === 'all');
9916
+ if (!needHitFillPath && !needHitStrokePath)
9917
+ return false;
9806
9918
  const radiusWidth = inner.radiusX * 2;
9807
9919
  let hitWidth = radiusWidth;
9808
- if (needHitStroke) {
9809
- switch (strokeAlign) {
9920
+ if (needHitStrokePath) {
9921
+ switch (data.strokeAlign) {
9810
9922
  case 'inside':
9811
9923
  hitWidth += __strokeWidth * 2;
9812
- if (!needHitFill && (isHitFill && this.__hitStroke(inner, hitWidth)))
9924
+ if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9813
9925
  return true;
9814
9926
  hitWidth = radiusWidth;
9815
9927
  break;
@@ -9818,8 +9930,8 @@ UI.prototype.__hit = function (inner) {
9818
9930
  break;
9819
9931
  case 'outside':
9820
9932
  hitWidth += __strokeWidth * 2;
9821
- if (!needHitFill) {
9822
- if (!isHitFill && this.__hitStroke(inner, hitWidth))
9933
+ if (!needHitFillPath) {
9934
+ if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9823
9935
  return true;
9824
9936
  hitWidth = radiusWidth;
9825
9937
  }
@@ -9834,8 +9946,8 @@ Rect.prototype.__updateHitCanvas = function () {
9834
9946
  if (this.stroke || this.cornerRadius)
9835
9947
  ui.__updateHitCanvas.call(this);
9836
9948
  };
9837
- Rect.prototype.__hitFill = function (inner, windingRule) {
9838
- return this.__hitCanvas ? ui.__hitFill.call(this, inner, windingRule) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
9949
+ Rect.prototype.__hitFill = function (inner) {
9950
+ return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
9839
9951
  };
9840
9952
 
9841
9953
  UI.prototype.find = function (condition, options) {
@@ -10320,8 +10432,11 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
10320
10432
  }
10321
10433
 
10322
10434
  const { get: get$3, translate } = MatrixHelper;
10435
+ const tempBox = new Bounds();
10323
10436
  function createData(leafPaint, image, paint, box) {
10324
10437
  let { width, height } = image;
10438
+ if (paint.padding)
10439
+ box = tempBox.set(box).shrink(paint.padding);
10325
10440
  const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
10326
10441
  const sameBox = box.width === width && box.height === height;
10327
10442
  if (blendMode)
@@ -10405,8 +10520,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10405
10520
  leafPaint.loadId = image.load(() => {
10406
10521
  ignoreRender(ui, false);
10407
10522
  if (!ui.destroyed) {
10408
- if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds))
10523
+ if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
10524
+ if (image.hasOpacityPixel)
10525
+ ui.__layout.hitCanvasChanged = true;
10409
10526
  ui.forceUpdate('surface');
10527
+ }
10410
10528
  onLoadSuccess(ui, event);
10411
10529
  }
10412
10530
  leafPaint.loadId = null;
@@ -10460,7 +10578,7 @@ function ignoreRender(ui, value) {
10460
10578
  const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
10461
10579
  const { ceil, abs: abs$1 } = Math;
10462
10580
  function createPattern(ui, paint, pixelRatio) {
10463
- let { scaleX, scaleY } = ui.__nowWorld;
10581
+ let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
10464
10582
  const id = scaleX + '-' + scaleY;
10465
10583
  if (paint.patternId !== id && !ui.destroyed) {
10466
10584
  scaleX = abs$1(scaleX);
@@ -10522,7 +10640,7 @@ function createPattern(ui, paint, pixelRatio) {
10522
10640
 
10523
10641
  const { abs } = Math;
10524
10642
  function checkImage(ui, canvas, paint, allowPaint) {
10525
- const { scaleX, scaleY } = ui.__nowWorld;
10643
+ const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
10526
10644
  if (!paint.data || paint.patternId === scaleX + '-' + scaleY) {
10527
10645
  return false;
10528
10646
  }
@@ -11427,7 +11545,7 @@ const ExportModule = {
11427
11545
  const scale = options.scale || 1;
11428
11546
  const pixelRatio = options.pixelRatio || 1;
11429
11547
  const screenshot = options.screenshot || leaf.isApp;
11430
- const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : undefined) : options.fill;
11548
+ const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
11431
11549
  const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
11432
11550
  if (screenshot) {
11433
11551
  renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
@@ -11438,10 +11556,10 @@ const ExportModule = {
11438
11556
  scaleY = worldTransform.scaleY;
11439
11557
  switch (relative) {
11440
11558
  case 'inner':
11441
- matrix.set(worldTransform).invert();
11559
+ matrix.set(worldTransform);
11442
11560
  break;
11443
11561
  case 'local':
11444
- matrix.set(worldTransform).divide(leaf.localTransform).invert();
11562
+ matrix.set(worldTransform).divide(leaf.localTransform);
11445
11563
  scaleX /= leaf.scaleX;
11446
11564
  scaleY /= leaf.scaleY;
11447
11565
  break;
@@ -11452,7 +11570,7 @@ const ExportModule = {
11452
11570
  case 'page':
11453
11571
  relative = leaf.leafer;
11454
11572
  default:
11455
- matrix.set(worldTransform).divide(leaf.getTransform(relative)).invert();
11573
+ matrix.set(worldTransform).divide(leaf.getTransform(relative));
11456
11574
  const l = relative.worldTransform;
11457
11575
  scaleX /= scaleX / l.scaleX;
11458
11576
  scaleY /= scaleY / l.scaleY;
@@ -11461,7 +11579,7 @@ const ExportModule = {
11461
11579
  }
11462
11580
  const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
11463
11581
  let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
11464
- const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
11582
+ const renderOptions = { matrix: matrix.scale(1 / scale).invert().translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
11465
11583
  if (slice) {
11466
11584
  leaf = leafer;
11467
11585
  renderOptions.bounds = canvas.bounds;
@@ -11507,6 +11625,44 @@ function addTask(task) {
11507
11625
  });
11508
11626
  }
11509
11627
 
11628
+ const canvas = LeaferCanvasBase.prototype;
11629
+ const debug = Debug.get('@leafer-ui/export');
11630
+ canvas.export = function (filename, options) {
11631
+ const { quality, blob } = FileHelper.getExportOptions(options);
11632
+ if (filename.includes('.')) {
11633
+ return this.saveAs(filename, quality);
11634
+ }
11635
+ else if (blob) {
11636
+ return this.toBlob(filename, quality);
11637
+ }
11638
+ else {
11639
+ return this.toDataURL(filename, quality);
11640
+ }
11641
+ };
11642
+ canvas.toBlob = function (type, quality) {
11643
+ return new Promise((resolve) => {
11644
+ Platform.origin.canvasToBolb(this.view, type, quality).then((blob) => {
11645
+ resolve(blob);
11646
+ }).catch((e) => {
11647
+ debug.error(e);
11648
+ resolve(null);
11649
+ });
11650
+ });
11651
+ };
11652
+ canvas.toDataURL = function (type, quality) {
11653
+ return Platform.origin.canvasToDataURL(this.view, type, quality);
11654
+ };
11655
+ canvas.saveAs = function (filename, quality) {
11656
+ return new Promise((resolve) => {
11657
+ Platform.origin.canvasSaveAs(this.view, filename, quality).then(() => {
11658
+ resolve(true);
11659
+ }).catch((e) => {
11660
+ debug.error(e);
11661
+ resolve(false);
11662
+ });
11663
+ });
11664
+ };
11665
+
11510
11666
  Object.assign(TextConvert, TextConvertModule);
11511
11667
  Object.assign(ColorConvert, ColorConvertModule);
11512
11668
  Object.assign(Paint, PaintModule);
@@ -11555,4 +11711,4 @@ LeaferCanvas.prototype.updateViewSize = function () {
11555
11711
  }
11556
11712
  };
11557
11713
 
11558
- 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, 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, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, 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, useCanvas, useModule, zoomLayerType };
11714
+ 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, 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$2 as tempPoint, useCanvas, useModule, version, zoomLayerType };