leafer-ui 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$f = Debug.get('RunTime');
1296
+ const debug$g = 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$f.log(name, duration, 'ms');
1314
+ debug$g.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$e = Debug.get('UICreator');
1324
+ const debug$f = 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$e.repeat(tag);
1330
+ debug$f.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$d = Debug.get('EventCreator');
1352
+ const debug$e = 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$d.repeat(name) : nameList[name] = Event;
1360
+ nameList[name] ? debug$e.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$c = 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$c.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$c.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$b = Debug.get('PathConvert');
2472
+ const debug$d = 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$b.error(`command: ${command} [index:${i}]`, old);
2709
+ debug$d.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$a = 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$c = 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$a.error(`command: ${command} [index:${i}]`, data);
2959
+ debug$c.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$9 = Debug.get('PathBounds');
2968
+ const { addPointBounds, copy: copy$8, addPoint: addPoint$1, setPoint: setPoint$1, addBounds, toBounds: toBounds$3 } = TwoPointBoundsHelper;
2969
+ const debug$b = 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$9.error(`command: ${command} [index:${i}]`, data);
3078
+ debug$b.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$8 = 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$a = 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$8.error(error);
3209
+ debug$a.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$7 = new Debug('rewrite');
3839
+ const debug$9 = 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$7.error(item.name, '需在Class上装饰@rewriteAble()');
3856
+ debug$9.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$8 = 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$8.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) { }
@@ -5638,7 +5613,7 @@ class LeafLevelList {
5638
5613
  }
5639
5614
  }
5640
5615
 
5641
- const debug$6 = Debug.get('LeaferCanvas');
5616
+ const debug$7 = Debug.get('LeaferCanvas');
5642
5617
  class LeaferCanvas extends LeaferCanvasBase {
5643
5618
  init() {
5644
5619
  const { view } = this.config;
@@ -5691,7 +5666,7 @@ class LeaferCanvas extends LeaferCanvasBase {
5691
5666
  }
5692
5667
  }
5693
5668
  else {
5694
- debug$6.error(`no id: ${inputView}`);
5669
+ debug$7.error(`no id: ${inputView}`);
5695
5670
  this.__createView();
5696
5671
  }
5697
5672
  }
@@ -5797,9 +5772,13 @@ function useCanvas(_canvasType, _power) {
5797
5772
  canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
5798
5773
  canvasToBolb: (canvas, type, quality) => new Promise((resolve) => canvas.toBlob(resolve, mineType(type), quality)),
5799
5774
  canvasSaveAs: (canvas, filename, quality) => {
5775
+ const url = canvas.toDataURL(mineType(fileType(filename)), quality);
5776
+ return Platform.origin.download(url, filename);
5777
+ },
5778
+ download(url, filename) {
5800
5779
  return new Promise((resolve) => {
5801
5780
  let el = document.createElement('a');
5802
- el.href = canvas.toDataURL(mineType(fileType(filename)), quality);
5781
+ el.href = url;
5803
5782
  el.download = filename;
5804
5783
  document.body.appendChild(el);
5805
5784
  el.click();
@@ -6036,7 +6015,7 @@ class LayoutBlockData {
6036
6015
  }
6037
6016
 
6038
6017
  const { updateAllMatrix, updateAllChange } = LeafHelper;
6039
- const debug$5 = Debug.get('Layouter');
6018
+ const debug$6 = Debug.get('Layouter');
6040
6019
  class Layouter {
6041
6020
  constructor(target, userConfig) {
6042
6021
  this.totalTimes = 0;
@@ -6071,7 +6050,7 @@ class Layouter {
6071
6050
  target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
6072
6051
  }
6073
6052
  catch (e) {
6074
- debug$5.error(e);
6053
+ debug$6.error(e);
6075
6054
  }
6076
6055
  this.layoutedBlocks = null;
6077
6056
  }
@@ -6085,9 +6064,9 @@ class Layouter {
6085
6064
  }
6086
6065
  layoutOnce() {
6087
6066
  if (this.layouting)
6088
- return debug$5.warn('layouting');
6067
+ return debug$6.warn('layouting');
6089
6068
  if (this.times > 3)
6090
- return debug$5.warn('layout max times');
6069
+ return debug$6.warn('layout max times');
6091
6070
  this.times++;
6092
6071
  this.totalTimes++;
6093
6072
  this.layouting = true;
@@ -6191,7 +6170,7 @@ class Layouter {
6191
6170
  }
6192
6171
  }
6193
6172
 
6194
- const debug$4 = Debug.get('Renderer');
6173
+ const debug$5 = Debug.get('Renderer');
6195
6174
  class Renderer {
6196
6175
  get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
6197
6176
  constructor(target, canvas, userConfig) {
@@ -6229,7 +6208,7 @@ class Renderer {
6229
6208
  const { target } = this;
6230
6209
  this.times = 0;
6231
6210
  this.totalBounds = new Bounds();
6232
- debug$4.log(target.innerName, '--->');
6211
+ debug$5.log(target.innerName, '--->');
6233
6212
  try {
6234
6213
  this.emitRender(RenderEvent.START);
6235
6214
  this.renderOnce(callback);
@@ -6238,9 +6217,9 @@ class Renderer {
6238
6217
  }
6239
6218
  catch (e) {
6240
6219
  this.rendering = false;
6241
- debug$4.error(e);
6220
+ debug$5.error(e);
6242
6221
  }
6243
- debug$4.log('-------------|');
6222
+ debug$5.log('-------------|');
6244
6223
  }
6245
6224
  renderAgain() {
6246
6225
  if (this.rendering) {
@@ -6252,9 +6231,9 @@ class Renderer {
6252
6231
  }
6253
6232
  renderOnce(callback) {
6254
6233
  if (this.rendering)
6255
- return debug$4.warn('rendering');
6234
+ return debug$5.warn('rendering');
6256
6235
  if (this.times > 3)
6257
- return debug$4.warn('render max times');
6236
+ return debug$5.warn('render max times');
6258
6237
  this.times++;
6259
6238
  this.totalTimes++;
6260
6239
  this.rendering = true;
@@ -6291,7 +6270,7 @@ class Renderer {
6291
6270
  partRender() {
6292
6271
  const { canvas, updateBlocks: list } = this;
6293
6272
  if (!list)
6294
- return debug$4.warn('PartRender: need update attr');
6273
+ return debug$5.warn('PartRender: need update attr');
6295
6274
  this.mergeBlocks();
6296
6275
  list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
6297
6276
  this.clipRender(block); });
@@ -6391,7 +6370,7 @@ class Renderer {
6391
6370
  empty = (!leaf.__world.width || !leaf.__world.height);
6392
6371
  if (empty) {
6393
6372
  if (!leaf.isLeafer)
6394
- debug$4.tip(leaf.innerName, ': empty');
6373
+ debug$5.tip(leaf.innerName, ': empty');
6395
6374
  empty = (!leaf.isBranch || leaf.isBranchLeaf);
6396
6375
  }
6397
6376
  return empty;
@@ -6686,51 +6665,42 @@ const Export = {};
6686
6665
  const State = {};
6687
6666
 
6688
6667
  function stateType(defaultValue) {
6689
- return (target, key) => {
6690
- const stateType = key + 'Style';
6691
- defineLeafAttr(target, key, defaultValue, {
6692
- set(value) {
6693
- this.__setAttr(key, value);
6694
- this.waitLeafer(() => { if (State.setStyle)
6695
- State.setStyle(this, stateType, value); });
6696
- }
6697
- });
6698
- };
6668
+ return decorateLeafAttr(defaultValue, (key) => attr({
6669
+ set(value) {
6670
+ this.__setAttr(key, value);
6671
+ this.waitLeafer(() => { if (State.setStyle)
6672
+ State.setStyle(this, key + 'Style', value); });
6673
+ }
6674
+ }));
6699
6675
  }
6700
6676
  function arrowType(defaultValue) {
6701
- return (target, key) => {
6702
- defineLeafAttr(target, key, defaultValue, {
6703
- set(value) {
6704
- this.__setAttr(key, value);
6705
- const data = this.__;
6706
- data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6707
- doStrokeType(this);
6708
- }
6709
- });
6710
- };
6677
+ return decorateLeafAttr(defaultValue, (key) => attr({
6678
+ set(value) {
6679
+ this.__setAttr(key, value);
6680
+ const data = this.__;
6681
+ data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
6682
+ doStrokeType(this);
6683
+ }
6684
+ }));
6711
6685
  }
6712
6686
  function effectType(defaultValue) {
6713
- return (target, key) => {
6714
- defineLeafAttr(target, key, defaultValue, {
6715
- set(value) {
6716
- this.__setAttr(key, value);
6717
- if (value)
6718
- this.__.__useEffect = true;
6719
- this.__layout.renderChanged || this.__layout.renderChange();
6720
- }
6721
- });
6722
- };
6687
+ return decorateLeafAttr(defaultValue, (key) => attr({
6688
+ set(value) {
6689
+ this.__setAttr(key, value);
6690
+ if (value)
6691
+ this.__.__useEffect = true;
6692
+ this.__layout.renderChanged || this.__layout.renderChange();
6693
+ }
6694
+ }));
6723
6695
  }
6724
6696
  function resizeType(defaultValue) {
6725
- return (target, key) => {
6726
- defineLeafAttr(target, key, defaultValue, {
6727
- set(value) {
6728
- this.__setAttr(key, value);
6729
- this.__layout.boxChanged || this.__layout.boxChange();
6730
- this.__updateSize();
6731
- }
6732
- });
6733
- };
6697
+ return decorateLeafAttr(defaultValue, (key) => attr({
6698
+ set(value) {
6699
+ this.__setAttr(key, value);
6700
+ this.__layout.boxChanged || this.__layout.boxChange();
6701
+ this.__updateSize();
6702
+ }
6703
+ }));
6734
6704
  }
6735
6705
  function zoomLayerType() {
6736
6706
  return (target, key) => {
@@ -6745,12 +6715,13 @@ function zoomLayerType() {
6745
6715
 
6746
6716
  const { parse } = PathConvert;
6747
6717
  const emptyPaint = {};
6748
- const debug$3 = Debug.get('UIData');
6718
+ const debug$4 = Debug.get('UIData');
6749
6719
  class UIData extends LeafData {
6750
6720
  get __strokeWidth() {
6751
6721
  const { strokeWidth, strokeWidthFixed } = this;
6752
6722
  if (strokeWidthFixed) {
6753
- let { scaleX } = this.__leaf.__nowWorld;
6723
+ const ui = this.__leaf;
6724
+ let { scaleX } = ui.__nowWorld || ui.__world;
6754
6725
  if (scaleX < 0)
6755
6726
  scaleX = -scaleX;
6756
6727
  return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
@@ -6772,7 +6743,7 @@ class UIData extends LeafData {
6772
6743
  if (value < 0) {
6773
6744
  this._width = -value;
6774
6745
  this.__leaf.scaleX *= -1;
6775
- debug$3.warn('width < 0, instead -scaleX ', this);
6746
+ debug$4.warn('width < 0, instead -scaleX ', this);
6776
6747
  }
6777
6748
  else {
6778
6749
  this._width = value;
@@ -6782,7 +6753,7 @@ class UIData extends LeafData {
6782
6753
  if (value < 0) {
6783
6754
  this._height = -value;
6784
6755
  this.__leaf.scaleY *= -1;
6785
- debug$3.warn('height < 0, instead -scaleY', this);
6756
+ debug$4.warn('height < 0, instead -scaleY', this);
6786
6757
  }
6787
6758
  else {
6788
6759
  this._height = value;
@@ -7069,14 +7040,14 @@ const UIRender = {
7069
7040
  }
7070
7041
  }
7071
7042
  },
7072
- __renderShape(canvas, options) {
7043
+ __renderShape(canvas, options, ignoreFill, ignoreStroke) {
7073
7044
  if (this.__worldOpacity) {
7074
7045
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
7075
7046
  const { fill, stroke } = this.__;
7076
7047
  this.__drawRenderPath(canvas);
7077
- if (fill)
7048
+ if (fill && !ignoreFill)
7078
7049
  this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7079
- if (stroke)
7050
+ if (stroke && !ignoreStroke)
7080
7051
  this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7081
7052
  }
7082
7053
  }
@@ -7174,10 +7145,7 @@ let UI = UI_1 = class UI extends Leaf {
7174
7145
  __onUpdateSize() {
7175
7146
  if (this.__.__input) {
7176
7147
  const data = this.__;
7177
- data.__needComputePaint = true;
7178
- if (data.lazy && this.leafer && !this.leafer.canvas.bounds.hit(this.__world))
7179
- return;
7180
- data.__computePaint();
7148
+ (data.lazy && this.leafer && this.leafer.created && !this.leafer.lazyBounds.hit(this.__world)) ? data.__needComputePaint = true : data.__computePaint();
7181
7149
  }
7182
7150
  }
7183
7151
  __updateRenderPath() {
@@ -7279,31 +7247,31 @@ __decorate([
7279
7247
  eraserType(false)
7280
7248
  ], UI.prototype, "eraser", void 0);
7281
7249
  __decorate([
7282
- positionType(0)
7250
+ positionType(0, true)
7283
7251
  ], UI.prototype, "x", void 0);
7284
7252
  __decorate([
7285
- positionType(0)
7253
+ positionType(0, true)
7286
7254
  ], UI.prototype, "y", void 0);
7287
7255
  __decorate([
7288
- boundsType(100)
7256
+ boundsType(100, true)
7289
7257
  ], UI.prototype, "width", void 0);
7290
7258
  __decorate([
7291
- boundsType(100)
7259
+ boundsType(100, true)
7292
7260
  ], UI.prototype, "height", void 0);
7293
7261
  __decorate([
7294
- scaleType(1)
7262
+ scaleType(1, true)
7295
7263
  ], UI.prototype, "scaleX", void 0);
7296
7264
  __decorate([
7297
- scaleType(1)
7265
+ scaleType(1, true)
7298
7266
  ], UI.prototype, "scaleY", void 0);
7299
7267
  __decorate([
7300
- rotationType(0)
7268
+ rotationType(0, true)
7301
7269
  ], UI.prototype, "rotation", void 0);
7302
7270
  __decorate([
7303
- rotationType(0)
7271
+ rotationType(0, true)
7304
7272
  ], UI.prototype, "skewX", void 0);
7305
7273
  __decorate([
7306
- rotationType(0)
7274
+ rotationType(0, true)
7307
7275
  ], UI.prototype, "skewY", void 0);
7308
7276
  __decorate([
7309
7277
  autoLayoutType()
@@ -7317,6 +7285,9 @@ __decorate([
7317
7285
  __decorate([
7318
7286
  dataType('size')
7319
7287
  ], UI.prototype, "editSize", void 0);
7288
+ __decorate([
7289
+ dataType()
7290
+ ], UI.prototype, "editorStyle", void 0);
7320
7291
  __decorate([
7321
7292
  hitType(true)
7322
7293
  ], UI.prototype, "hittable", void 0);
@@ -7383,6 +7354,9 @@ __decorate([
7383
7354
  __decorate([
7384
7355
  pathType()
7385
7356
  ], UI.prototype, "windingRule", void 0);
7357
+ __decorate([
7358
+ pathType(true)
7359
+ ], UI.prototype, "closed", void 0);
7386
7360
  __decorate([
7387
7361
  arrowType('none')
7388
7362
  ], UI.prototype, "startArrow", void 0);
@@ -7502,14 +7476,17 @@ Group = __decorate([
7502
7476
  registerUI()
7503
7477
  ], Group);
7504
7478
 
7505
- const debug$2 = Debug.get('Leafer');
7506
- let Leafer = class Leafer extends Group {
7479
+ var Leafer_1;
7480
+ const debug$3 = Debug.get('Leafer');
7481
+ let Leafer = Leafer_1 = class Leafer extends Group {
7482
+ static get version() { return '1.0.0-rc.20'; }
7507
7483
  get __tag() { return 'Leafer'; }
7508
7484
  get isApp() { return false; }
7509
7485
  get app() { return this.parent || this; }
7510
7486
  get isLeafer() { return true; }
7511
7487
  get imageReady() { return this.viewReady && ImageManager.isComplete; }
7512
7488
  get layoutLocked() { return !this.layouter.running; }
7489
+ get FPS() { return this.renderer ? this.renderer.FPS : 60; }
7513
7490
  get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
7514
7491
  constructor(userConfig, data) {
7515
7492
  super(data);
@@ -7518,6 +7495,7 @@ let Leafer = class Leafer extends Group {
7518
7495
  start: true,
7519
7496
  hittable: true,
7520
7497
  smooth: true,
7498
+ lazySpeard: 100,
7521
7499
  zoom: {
7522
7500
  min: 0.01,
7523
7501
  max: 256
@@ -7538,6 +7516,7 @@ let Leafer = class Leafer extends Group {
7538
7516
  this.userConfig = userConfig;
7539
7517
  if (userConfig && (userConfig.view || userConfig.width))
7540
7518
  this.init(userConfig);
7519
+ Leafer_1.list.add(this);
7541
7520
  }
7542
7521
  init(userConfig, parentApp) {
7543
7522
  if (this.canvas)
@@ -7548,19 +7527,20 @@ let Leafer = class Leafer extends Group {
7548
7527
  let start;
7549
7528
  const { config } = this;
7550
7529
  this.initType(config.type);
7551
- this.canvas = Creator.canvas(config);
7552
- this.__controllers.push(this.renderer = Creator.renderer(this, this.canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
7530
+ const canvas = this.canvas = Creator.canvas(config);
7531
+ this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
7553
7532
  if (this.isApp)
7554
7533
  this.__setApp();
7555
7534
  this.__checkAutoLayout(config);
7556
- this.view = this.canvas.view;
7535
+ this.updateLazyBounds();
7536
+ this.view = canvas.view;
7557
7537
  if (parentApp) {
7558
7538
  this.__bindApp(parentApp);
7559
7539
  start = parentApp.running;
7560
7540
  }
7561
7541
  else {
7562
7542
  this.selector = Creator.selector(this);
7563
- this.interaction = Creator.interaction(this, this.canvas, this.selector, config);
7543
+ this.interaction = Creator.interaction(this, canvas, this.selector, config);
7564
7544
  if (this.interaction) {
7565
7545
  this.__controllers.unshift(this.interaction);
7566
7546
  this.hitCanvasManager = Creator.hitCanvasManager();
@@ -7570,23 +7550,17 @@ let Leafer = class Leafer extends Group {
7570
7550
  }
7571
7551
  this.hittable = config.hittable;
7572
7552
  this.fill = config.fill;
7573
- this.canvasManager.add(this.canvas);
7553
+ this.canvasManager.add(canvas);
7574
7554
  this.__listenEvents();
7575
7555
  if (start)
7576
7556
  this.__startTimer = setTimeout(this.start.bind(this));
7557
+ WaitHelper.run(this.__initWait);
7577
7558
  this.onInit();
7578
7559
  }
7579
7560
  onInit() { }
7580
7561
  initType(_type) { }
7581
7562
  set(data) {
7582
- if (!this.children) {
7583
- setTimeout(() => {
7584
- super.set(data);
7585
- });
7586
- }
7587
- else {
7588
- super.set(data);
7589
- }
7563
+ this.waitInit(() => { super.set(data); });
7590
7564
  }
7591
7565
  start() {
7592
7566
  clearTimeout(this.__startTimer);
@@ -7631,11 +7605,16 @@ let Leafer = class Leafer extends Group {
7631
7605
  if (i)
7632
7606
  cursor ? i.setCursor(cursor) : i.updateCursor();
7633
7607
  }
7608
+ updateLazyBounds() {
7609
+ this.lazyBounds = this.canvas.bounds.clone().spread(this.config.lazySpeard);
7610
+ }
7634
7611
  __doResize(size) {
7635
- if (!this.canvas || this.canvas.isSameSize(size))
7612
+ const { canvas } = this;
7613
+ if (!canvas || canvas.isSameSize(size))
7636
7614
  return;
7637
7615
  const old = DataHelper.copyAttrs({}, this.canvas, canvasSizeAttrs);
7638
- this.canvas.resize(size);
7616
+ canvas.resize(size);
7617
+ this.updateLazyBounds();
7639
7618
  this.__onResize(new ResizeEvent(size, old));
7640
7619
  }
7641
7620
  __onResize(event) {
@@ -7673,7 +7652,7 @@ let Leafer = class Leafer extends Group {
7673
7652
  this.canvas.hittable = newValue;
7674
7653
  }
7675
7654
  }
7676
- super.__setAttr(attrName, newValue);
7655
+ return super.__setAttr(attrName, newValue);
7677
7656
  }
7678
7657
  __getAttr(attrName) {
7679
7658
  if (this.canvas && canvasSizeAttrs.includes(attrName))
@@ -7740,6 +7719,13 @@ let Leafer = class Leafer extends Group {
7740
7719
  this.nextRender(() => this.interaction.updateCursor());
7741
7720
  }
7742
7721
  }
7722
+ waitInit(item, bind) {
7723
+ if (bind)
7724
+ item = item.bind(bind);
7725
+ if (!this.__initWait)
7726
+ this.__initWait = [];
7727
+ this.canvas ? item() : this.__initWait.push(item);
7728
+ }
7743
7729
  waitReady(item, bind) {
7744
7730
  if (bind)
7745
7731
  item = item.bind(bind);
@@ -7779,14 +7765,8 @@ let Leafer = class Leafer extends Group {
7779
7765
  }
7780
7766
  }
7781
7767
  zoom(_zoomType, _padding, _fixedScale) { return undefined; }
7782
- validScale(changeScale) {
7783
- const { scaleX } = this.zoomLayer.__, { min, max } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
7784
- if (absScale < min)
7785
- changeScale = min / scaleX;
7786
- else if (absScale > max)
7787
- changeScale = max / scaleX;
7788
- return changeScale;
7789
- }
7768
+ getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
7769
+ getValidScale(changeScale) { return changeScale; }
7790
7770
  __checkUpdateLayout() {
7791
7771
  this.__layout.update();
7792
7772
  }
@@ -7805,9 +7785,10 @@ let Leafer = class Leafer extends Group {
7805
7785
  this.off_(this.__eventIds);
7806
7786
  this.__eventIds.length = 0;
7807
7787
  }
7808
- destroy() {
7809
- setTimeout(() => {
7788
+ destroy(sync) {
7789
+ const doDestory = () => {
7810
7790
  if (!this.destroyed) {
7791
+ Leafer_1.list.remove(this);
7811
7792
  try {
7812
7793
  this.stop();
7813
7794
  this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
@@ -7832,19 +7813,21 @@ let Leafer = class Leafer extends Group {
7832
7813
  setTimeout(() => { ImageManager.clearRecycled(); }, 100);
7833
7814
  }
7834
7815
  catch (e) {
7835
- debug$2.error(e);
7816
+ debug$3.error(e);
7836
7817
  }
7837
7818
  }
7838
- });
7819
+ };
7820
+ sync ? doDestory() : setTimeout(doDestory);
7839
7821
  }
7840
7822
  };
7823
+ Leafer.list = new LeafList();
7841
7824
  __decorate([
7842
7825
  dataProcessor(LeaferData)
7843
7826
  ], Leafer.prototype, "__", void 0);
7844
7827
  __decorate([
7845
7828
  boundsType()
7846
7829
  ], Leafer.prototype, "pixelRatio", void 0);
7847
- Leafer = __decorate([
7830
+ Leafer = Leafer_1 = __decorate([
7848
7831
  registerUI()
7849
7832
  ], Leafer);
7850
7833
 
@@ -7877,11 +7860,9 @@ let Box = class Box extends Group {
7877
7860
  __updateStrokeSpread() { return 0; }
7878
7861
  __updateRectRenderSpread() { return 0; }
7879
7862
  __updateRenderSpread() {
7880
- let width = this.__updateRectRenderSpread() || super.__updateRenderSpread();
7881
- this.__.__drawAfterFill = this.__.overflow === 'hide';
7882
- if (!width)
7883
- width = this.__.__drawAfterFill ? 0 : 1;
7884
- return width;
7863
+ const width = this.__updateRectRenderSpread();
7864
+ const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
7865
+ return (width || hide) ? width : -1;
7885
7866
  }
7886
7867
  __updateRectBoxBounds() { }
7887
7868
  __updateBoxBounds() {
@@ -8075,7 +8056,7 @@ let Line = class Line extends UI {
8075
8056
  __updatePath() {
8076
8057
  const path = this.__.path = [];
8077
8058
  if (this.__.points) {
8078
- drawPoints$1(path, this.__.points, false);
8059
+ drawPoints$1(path, this.__.points, this.__.closed);
8079
8060
  }
8080
8061
  else {
8081
8062
  moveTo$2(path, 0, 0);
@@ -8085,7 +8066,7 @@ let Line = class Line extends UI {
8085
8066
  __updateRenderPath() {
8086
8067
  const data = this.__;
8087
8068
  if (!this.pathInputed && data.points && data.curve) {
8088
- drawPoints$1(data.__pathForRender = [], data.points, data.curve, this.pathClosed);
8069
+ drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
8089
8070
  if (data.__useArrow)
8090
8071
  PathArrow.addArrows(this, false);
8091
8072
  }
@@ -8117,6 +8098,9 @@ __decorate([
8117
8098
  __decorate([
8118
8099
  pathType(0)
8119
8100
  ], Line.prototype, "curve", void 0);
8101
+ __decorate([
8102
+ pathType(false)
8103
+ ], Line.prototype, "closed", void 0);
8120
8104
  Line = __decorate([
8121
8105
  registerUI()
8122
8106
  ], Line);
@@ -8128,7 +8112,6 @@ let Polygon = class Polygon extends UI {
8128
8112
  get __tag() { return 'Polygon'; }
8129
8113
  constructor(data) {
8130
8114
  super(data);
8131
- this.pathClosed = true;
8132
8115
  }
8133
8116
  __updatePath() {
8134
8117
  const path = this.__.path = [];
@@ -8298,6 +8281,9 @@ __decorate([
8298
8281
  __decorate([
8299
8282
  resizeType(true)
8300
8283
  ], Canvas.prototype, "smooth", void 0);
8284
+ __decorate([
8285
+ resizeType()
8286
+ ], Canvas.prototype, "contextSettings", void 0);
8301
8287
  __decorate([
8302
8288
  hitType('all')
8303
8289
  ], Canvas.prototype, "hitFill", void 0);
@@ -8374,6 +8360,8 @@ let Text = class Text extends UI {
8374
8360
  else {
8375
8361
  super.__updateBoxBounds();
8376
8362
  }
8363
+ if (italic)
8364
+ b.width += fontSize * 0.16;
8377
8365
  const contentBounds = includes(b, bounds) ? b : bounds;
8378
8366
  if (contentBounds !== layout.contentBounds) {
8379
8367
  layout.contentBounds = contentBounds;
@@ -8511,6 +8499,7 @@ let Pen = class Pen extends Group {
8511
8499
  drawEllipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise) { return this; }
8512
8500
  drawArc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise) { return this; }
8513
8501
  drawPoints(_points, _curve, _close) { return this; }
8502
+ clearPath() { return this; }
8514
8503
  paint() {
8515
8504
  this.pathElement.forceUpdate('path');
8516
8505
  }
@@ -8522,7 +8511,7 @@ __decorate([
8522
8511
  penPathType()
8523
8512
  ], Pen.prototype, "path", void 0);
8524
8513
  Pen = __decorate([
8525
- useModule(PathCreator, ['beginPath', 'path']),
8514
+ useModule(PathCreator, ['set', 'beginPath', 'path']),
8526
8515
  registerUI()
8527
8516
  ], Pen);
8528
8517
  function penPathType() {
@@ -8533,6 +8522,8 @@ function penPathType() {
8533
8522
  };
8534
8523
  }
8535
8524
 
8525
+ const version = "1.0.0-rc.20";
8526
+
8536
8527
  let App = class App extends Leafer {
8537
8528
  get __tag() { return 'App'; }
8538
8529
  get isApp() { return true; }
@@ -8624,7 +8615,8 @@ let App = class App extends Leafer {
8624
8615
  if (this.viewReady)
8625
8616
  this.renderer.update();
8626
8617
  }
8627
- __render(canvas, _options) {
8618
+ __render(canvas, options) {
8619
+ canvas.setWorld(options.matrix || this.__world);
8628
8620
  this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
8629
8621
  }
8630
8622
  __onResize(event) {
@@ -8657,11 +8649,6 @@ App = __decorate([
8657
8649
  registerUI()
8658
8650
  ], App);
8659
8651
 
8660
- function draw(leafer) {
8661
- const { config } = leafer;
8662
- config.move.dragOut = false;
8663
- }
8664
-
8665
8652
  const downKeyMap = {};
8666
8653
  const Keyboard = {
8667
8654
  isHoldSpaceKey() {
@@ -8856,21 +8843,16 @@ KeyEvent = __decorate([
8856
8843
  registerUIEvent()
8857
8844
  ], KeyEvent);
8858
8845
 
8859
- function design(leafer) {
8846
+ function addInteractionWindow(leafer) {
8860
8847
  if (leafer.isApp)
8861
8848
  return;
8862
8849
  leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, (e) => {
8863
- let { moveX, moveY } = e;
8864
- if (leafer.config.move.scroll) {
8865
- if (Math.abs(moveX) > Math.abs(moveY))
8866
- moveY = 0;
8867
- else
8868
- moveX = 0;
8869
- }
8870
- leafer.zoomLayer.move(moveX, moveY);
8850
+ const { x, y } = leafer.getValidMove(e.moveX, e.moveY);
8851
+ if (x || y)
8852
+ leafer.zoomLayer.move(x, y);
8871
8853
  }), leafer.on_(ZoomEvent.BEFORE_ZOOM, (e) => {
8872
8854
  const { zoomLayer } = leafer;
8873
- const changeScale = leafer.validScale(e.scale);
8855
+ const changeScale = leafer.getValidScale(e.scale);
8874
8856
  if (changeScale !== 1) {
8875
8857
  PointHelper.scaleOf(zoomLayer, e, changeScale);
8876
8858
  zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
@@ -8878,12 +8860,18 @@ function design(leafer) {
8878
8860
  }));
8879
8861
  }
8880
8862
 
8881
- const debug$1 = Debug.get('LeaferTypeCreator');
8863
+ function document$1(leafer) {
8864
+ addInteractionWindow(leafer);
8865
+ leafer.config.move.scroll = 'limit';
8866
+ leafer.config.zoom.min = 1;
8867
+ }
8868
+
8869
+ const debug$2 = Debug.get('LeaferTypeCreator');
8882
8870
  const LeaferTypeCreator = {
8883
8871
  list: {},
8884
8872
  register(name, fn) {
8885
8873
  if (list[name]) {
8886
- debug$1.repeat(name);
8874
+ debug$2.repeat(name);
8887
8875
  }
8888
8876
  else {
8889
8877
  list[name] = fn;
@@ -8895,17 +8883,56 @@ const LeaferTypeCreator = {
8895
8883
  fn(leafer);
8896
8884
  }
8897
8885
  else {
8898
- debug$1.error('no', name);
8886
+ debug$2.error('no', name);
8899
8887
  }
8900
8888
  }
8901
8889
  };
8902
8890
  const { list, register } = LeaferTypeCreator;
8903
- register('draw', draw);
8904
- register('design', design);
8891
+ register('draw', () => { });
8892
+ register('design', addInteractionWindow);
8893
+ register('document', document$1);
8905
8894
 
8906
8895
  Leafer.prototype.initType = function (type) {
8907
8896
  LeaferTypeCreator.run(type, this);
8908
8897
  };
8898
+ Leafer.prototype.getValidMove = function (moveX, moveY) {
8899
+ const { scroll, disabled } = this.app.config.move;
8900
+ if (scroll) {
8901
+ if (Math.abs(moveX) > Math.abs(moveY))
8902
+ moveY = 0;
8903
+ else
8904
+ moveX = 0;
8905
+ if (scroll === 'limit') {
8906
+ const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
8907
+ const right = x + width - this.width, bottom = y + height - this.height;
8908
+ if (x >= 0 && right <= 0)
8909
+ moveX = 0;
8910
+ else if (moveX > 0) {
8911
+ if (x + moveX > 0)
8912
+ moveX = -x;
8913
+ }
8914
+ else if (moveX < 0 && right + moveX < 0)
8915
+ moveX = -right;
8916
+ if (y >= 0 && bottom <= 0)
8917
+ moveY = 0;
8918
+ else if (moveY > 0) {
8919
+ if (y + moveY > 0)
8920
+ moveY = -y;
8921
+ }
8922
+ else if (moveY < 0 && bottom + moveY < 0)
8923
+ moveY = -bottom;
8924
+ }
8925
+ }
8926
+ return { x: disabled ? 0 : moveX, y: disabled ? 0 : moveY };
8927
+ };
8928
+ Leafer.prototype.getValidScale = function (changeScale) {
8929
+ const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale);
8930
+ if (absScale < min)
8931
+ changeScale = min / scaleX;
8932
+ else if (absScale > max)
8933
+ changeScale = max / scaleX;
8934
+ return disabled ? 1 : changeScale;
8935
+ };
8909
8936
 
8910
8937
  class Transformer {
8911
8938
  constructor(interaction) {
@@ -9077,7 +9104,7 @@ class Dragger {
9077
9104
  return;
9078
9105
  }
9079
9106
  if (!this.moving && canDrag) {
9080
- if (this.moving = interaction.canMove(this.downData) || interaction.isHoldRightKey)
9107
+ if (this.moving = interaction.canMove(this.downData) || interaction.isHoldRightKey || interaction.isMobileDragEmpty)
9081
9108
  interaction.emit(MoveEvent.START, this.dragData);
9082
9109
  }
9083
9110
  if (!this.moving) {
@@ -9126,7 +9153,7 @@ class Dragger {
9126
9153
  const list = this.getList();
9127
9154
  if (list.length && running) {
9128
9155
  const { moveX, moveY } = this.dragData;
9129
- list.forEach(leaf => leaf.moveWorld(moveX, moveY));
9156
+ list.forEach(leaf => leaf.draggable && leaf.moveWorld(moveX, moveY));
9130
9157
  }
9131
9158
  }
9132
9159
  dragOverOrOut(data) {
@@ -9153,7 +9180,7 @@ class Dragger {
9153
9180
  this.dragEnterPath = path;
9154
9181
  }
9155
9182
  dragEnd(data, speed) {
9156
- if (!this.dragData)
9183
+ if (!this.dragging && !this.moving)
9157
9184
  return;
9158
9185
  const { moveX, moveY } = this.dragData;
9159
9186
  if (this.interaction.config.move.dragAnimate && this.canAnimate && this.moving && (Math.abs(moveX) > 1 || Math.abs(moveY) > 1)) {
@@ -9176,12 +9203,16 @@ class Dragger {
9176
9203
  if (throughPath)
9177
9204
  endDragData.throughPath = throughPath;
9178
9205
  endDragData.path = path;
9179
- if (this.moving)
9206
+ if (this.moving) {
9207
+ this.moving = false;
9180
9208
  interaction.emit(MoveEvent.END, endDragData);
9209
+ }
9181
9210
  if (this.dragging) {
9211
+ const dropList = this.getList();
9212
+ this.dragging = false;
9182
9213
  interaction.emit(DragEvent.END, endDragData);
9183
- this.swipe(data, endDragData);
9184
- this.drop(data);
9214
+ this.swipe(data, downData, dragData, endDragData);
9215
+ this.drop(data, dropList, this.dragEnterPath);
9185
9216
  }
9186
9217
  this.autoMoveCancel();
9187
9218
  this.dragReset();
@@ -9193,22 +9224,21 @@ class Dragger {
9193
9224
  this.interaction.target.nextRender(animateWait, null, off);
9194
9225
  this.animateWait = func;
9195
9226
  }
9196
- swipe(data, endDragData) {
9197
- const { interaction, downData } = this;
9227
+ swipe(data, downData, dragData, endDragData) {
9228
+ const { interaction } = this;
9198
9229
  if (PointHelper.getDistance(downData, data) > interaction.config.pointer.swipeDistance) {
9199
- const swipeData = getSwipeEventData(downData, this.dragData, endDragData);
9230
+ const swipeData = getSwipeEventData(downData, dragData, endDragData);
9200
9231
  this.interaction.emit(swipeData.type, swipeData);
9201
9232
  }
9202
9233
  }
9203
- drop(data) {
9204
- const dropData = getDropEventData(data, this.getList(), DragEvent.data);
9205
- dropData.path = this.dragEnterPath;
9234
+ drop(data, dropList, dragEnterPath) {
9235
+ const dropData = getDropEventData(data, dropList, DragEvent.data);
9236
+ dropData.path = dragEnterPath;
9206
9237
  this.interaction.emit(DropEvent.DROP, dropData);
9207
- this.interaction.emit(DragEvent.LEAVE, data, this.dragEnterPath);
9238
+ this.interaction.emit(DragEvent.LEAVE, data, dragEnterPath);
9208
9239
  }
9209
9240
  dragReset() {
9210
9241
  DragEvent.list = DragEvent.data = this.dragableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
9211
- this.dragging = this.moving = false;
9212
9242
  }
9213
9243
  checkDragOut(data) {
9214
9244
  const { interaction } = this;
@@ -9248,7 +9278,7 @@ class Dragger {
9248
9278
  }
9249
9279
  }
9250
9280
 
9251
- const debug = Debug.get('emit');
9281
+ const debug$1 = Debug.get('emit');
9252
9282
  function emit$1(type, data, path, excludePath) {
9253
9283
  if (!path && !data.path)
9254
9284
  return;
@@ -9278,7 +9308,7 @@ function emit$1(type, data, path, excludePath) {
9278
9308
  }
9279
9309
  }
9280
9310
  catch (e) {
9281
- debug.error(e);
9311
+ debug$1.error(e);
9282
9312
  }
9283
9313
  }
9284
9314
  const allowTypes = ['move', 'zoom', 'rotate', 'key'];
@@ -9340,6 +9370,7 @@ const config = {
9340
9370
  tapTime: 120,
9341
9371
  longPressTime: 800,
9342
9372
  transformTime: 500,
9373
+ hover: true,
9343
9374
  dragHover: true,
9344
9375
  dragDistance: 2,
9345
9376
  swipeDistance: 20,
@@ -9351,9 +9382,12 @@ const config = {
9351
9382
  const { pathHasEventType, getMoveEventData: getMoveEventData$1, getZoomEventData: getZoomEventData$1, getRotateEventData: getRotateEventData$1 } = InteractionHelper;
9352
9383
  class InteractionBase {
9353
9384
  get dragging() { return this.dragger.dragging; }
9385
+ get moveMode() { return this.config.move.drag || this.isHoldSpaceKey || this.isHoldMiddleKey || (this.isHoldRightKey && this.dragger.moving) || this.isDragEmpty; }
9354
9386
  get isDragEmpty() { return this.config.move.dragEmpty && this.isRootPath(this.hoverData) && (!this.downData || this.isRootPath(this.downData)); }
9387
+ get isMobileDragEmpty() { return this.config.move.dragEmpty && !this.config.pointer.hover && this.downData && this.isTreePath(this.downData); }
9388
+ get isHoldMiddleKey() { return this.config.move.holdMiddleKey && this.downData && PointerButton.middle(this.downData); }
9355
9389
  get isHoldRightKey() { return this.config.move.holdRightKey && this.downData && PointerButton.right(this.downData); }
9356
- 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; }
9390
+ get isHoldSpaceKey() { return this.config.move.holdSpaceKey && Keyboard.isHoldSpaceKey(); }
9357
9391
  get hitRadius() { return this.config.pointer.hitRadius; }
9358
9392
  constructor(target, canvas, selector, userConfig) {
9359
9393
  this.config = config;
@@ -9395,7 +9429,8 @@ class InteractionBase {
9395
9429
  this.waitMenuTap = true;
9396
9430
  }
9397
9431
  this.dragger.setDragData(data);
9398
- this.updateCursor(data);
9432
+ if (!this.isHoldRightKey)
9433
+ this.updateCursor(data);
9399
9434
  }
9400
9435
  pointerMove(data) {
9401
9436
  if (!data)
@@ -9413,9 +9448,10 @@ class InteractionBase {
9413
9448
  }
9414
9449
  }
9415
9450
  pointerMoveReal(data) {
9451
+ const { dragHover, dragDistance } = this.config.pointer;
9416
9452
  this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
9417
9453
  if (this.downData) {
9418
- const canDrag = PointHelper.getDistance(this.downData, data) > this.config.pointer.dragDistance;
9454
+ const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
9419
9455
  if (canDrag) {
9420
9456
  if (this.waitTap)
9421
9457
  this.pointerWaitCancel();
@@ -9427,7 +9463,7 @@ class InteractionBase {
9427
9463
  this.updateHoverData(data);
9428
9464
  this.checkPath(data);
9429
9465
  this.emit(PointerEvent.MOVE, data);
9430
- if (!(this.dragging && !this.config.pointer.dragHover))
9466
+ if (!(this.dragging && !dragHover))
9431
9467
  this.pointerHover(data);
9432
9468
  if (this.dragger.dragging) {
9433
9469
  this.dragger.dragOverOrOut(data);
@@ -9443,20 +9479,25 @@ class InteractionBase {
9443
9479
  if (!downData)
9444
9480
  return;
9445
9481
  PointerButton.defaultLeft(data);
9446
- this.downData = null;
9447
9482
  this.findPath(data);
9483
+ const upData = Object.assign(Object.assign({}, data), { path: data.path.clone() });
9448
9484
  data.path.addList(downData.path.list);
9449
9485
  this.checkPath(data);
9486
+ this.downData = null;
9450
9487
  this.emit(PointerEvent.BEFORE_UP, data);
9451
9488
  this.emit(PointerEvent.UP, data);
9452
9489
  this.touchLeave(data);
9453
- this.tap(data);
9454
- this.menuTap(data);
9490
+ if (!data.isCancel) {
9491
+ this.tap(data);
9492
+ this.menuTap(data);
9493
+ }
9455
9494
  this.dragger.dragEnd(data);
9456
- this.updateCursor(data);
9495
+ this.updateCursor(upData);
9457
9496
  }
9458
9497
  pointerCancel() {
9459
- this.pointerUp(this.dragger.dragData);
9498
+ const data = Object.assign({}, this.dragger.dragData);
9499
+ data.isCancel = true;
9500
+ this.pointerUp(data);
9460
9501
  }
9461
9502
  multiTouch(data, list) {
9462
9503
  const { move, angle, scale, center } = MultiTouchHelper.getData(list);
@@ -9506,8 +9547,10 @@ class InteractionBase {
9506
9547
  this.updateCursor();
9507
9548
  }
9508
9549
  pointerHover(data) {
9509
- this.pointerOverOrOut(data);
9510
- this.pointerEnterOrLeave(data);
9550
+ if (this.config.pointer.hover) {
9551
+ this.pointerOverOrOut(data);
9552
+ this.pointerEnterOrLeave(data);
9553
+ }
9511
9554
  }
9512
9555
  pointerOverOrOut(data) {
9513
9556
  const { path } = data;
@@ -9588,6 +9631,12 @@ class InteractionBase {
9588
9631
  isRootPath(data) {
9589
9632
  return data && data.path.list[0].isLeafer;
9590
9633
  }
9634
+ isTreePath(data) {
9635
+ const app = this.target.app;
9636
+ if (!app || !app.isApp)
9637
+ return false;
9638
+ return app.editor && (!data.path.has(app.editor) && data.path.has(app.tree));
9639
+ }
9591
9640
  checkPath(data, useDefaultPath) {
9592
9641
  if (useDefaultPath || this.canMove(data))
9593
9642
  data.path = this.defaultPath;
@@ -9634,7 +9683,7 @@ class InteractionBase {
9634
9683
  this.hoverData = data;
9635
9684
  }
9636
9685
  updateCursor(data) {
9637
- if (this.config.cursor.stop)
9686
+ if (this.config.cursor.stop || !this.config.pointer.hover)
9638
9687
  return;
9639
9688
  if (!data) {
9640
9689
  this.updateHoverData();
@@ -9744,22 +9793,25 @@ Cursor.custom = {};
9744
9793
  class HitCanvasManager extends CanvasManager {
9745
9794
  constructor() {
9746
9795
  super(...arguments);
9747
- this.pathTypeList = new LeafList();
9748
- this.imageTypeList = new LeafList();
9796
+ this.maxTotal = 1000;
9797
+ this.pathList = new LeafList();
9798
+ this.pixelList = new LeafList();
9749
9799
  }
9750
- getImageType(leaf, size) {
9751
- this.imageTypeList.add(leaf);
9752
- return Creator.hitCanvas(size);
9800
+ getPixelType(leaf, config) {
9801
+ this.__autoClear();
9802
+ this.pixelList.add(leaf);
9803
+ return Creator.hitCanvas(config);
9753
9804
  }
9754
9805
  getPathType(leaf) {
9755
- this.pathTypeList.add(leaf);
9806
+ this.__autoClear();
9807
+ this.pathList.add(leaf);
9756
9808
  return Creator.hitCanvas();
9757
9809
  }
9758
9810
  clearImageType() {
9759
- this.__clearLeafList(this.imageTypeList);
9811
+ this.__clearLeafList(this.pixelList);
9760
9812
  }
9761
9813
  clearPathType() {
9762
- this.__clearLeafList(this.pathTypeList);
9814
+ this.__clearLeafList(this.pathList);
9763
9815
  }
9764
9816
  __clearLeafList(leafList) {
9765
9817
  if (leafList.length) {
@@ -9772,56 +9824,117 @@ class HitCanvasManager extends CanvasManager {
9772
9824
  leafList.reset();
9773
9825
  }
9774
9826
  }
9827
+ __autoClear() {
9828
+ if (this.pathList.length + this.pixelList.length > this.maxTotal)
9829
+ this.clear();
9830
+ }
9775
9831
  clear() {
9776
9832
  this.clearPathType();
9777
9833
  this.clearImageType();
9778
9834
  }
9779
9835
  }
9780
9836
 
9837
+ const canvas$1 = LeaferCanvasBase.prototype;
9838
+ canvas$1.hitFill = function (point, fillRule) {
9839
+ return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
9840
+ };
9841
+ canvas$1.hitStroke = function (point, strokeWidth) {
9842
+ this.strokeWidth = strokeWidth;
9843
+ return this.context.isPointInStroke(point.x, point.y);
9844
+ };
9845
+ canvas$1.hitPixel = function (radiusPoint, offset, scale = 1) {
9846
+ let { x, y, radiusX, radiusY } = radiusPoint;
9847
+ if (offset)
9848
+ x -= offset.x, y -= offset.y;
9849
+ tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
9850
+ const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
9851
+ for (let i = 0, len = data.length; i < len; i += 4) {
9852
+ if (data[i + 3] > 0)
9853
+ return true;
9854
+ }
9855
+ return data[3] > 0;
9856
+ };
9857
+
9781
9858
  const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
9782
9859
  const inner = {};
9783
- Leaf.prototype.__hitWorld = function (point) {
9784
- if (this.__layout.hitCanvasChanged || !this.__hitCanvas) {
9785
- this.__updateHitCanvas();
9786
- if (!this.__layout.boundsChanged)
9787
- this.__layout.hitCanvasChanged = false;
9788
- }
9860
+ const leaf = Leaf.prototype;
9861
+ leaf.__hitWorld = function (point) {
9789
9862
  if (this.__.hitRadius) {
9790
9863
  copy$2(inner, point), point = inner;
9791
9864
  setRadius(point, this.__.hitRadius);
9792
9865
  }
9793
9866
  toInnerRadiusPointOf(point, this.__world, inner);
9794
- if (this.__.hitBox) {
9867
+ const { width, height } = this.__world;
9868
+ const isSmall = width < 10 && height < 10;
9869
+ if (this.__.hitBox || isSmall) {
9795
9870
  if (BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner))
9796
9871
  return true;
9872
+ if (isSmall)
9873
+ return false;
9874
+ }
9875
+ if (this.__layout.hitCanvasChanged || !this.__hitCanvas) {
9876
+ this.__updateHitCanvas();
9877
+ if (!this.__layout.boundsChanged)
9878
+ this.__layout.hitCanvasChanged = false;
9797
9879
  }
9798
9880
  return this.__hit(inner);
9799
9881
  };
9800
-
9801
- UI.prototype.__updateHitCanvas = function () {
9882
+ leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
9883
+ leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
9884
+ 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); };
9885
+ leaf.__drawHitPath = function (canvas) { if (canvas)
9886
+ this.__drawRenderPath(canvas); };
9887
+
9888
+ const matrix = new Matrix();
9889
+ const ui$1 = UI.prototype;
9890
+ ui$1.__updateHitCanvas = function () {
9891
+ const data = this.__, { hitCanvasManager } = this.leafer;
9892
+ const isHitPixelFill = data.__pixelFill && data.hitFill === 'pixel';
9893
+ const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
9894
+ const isHitPixel = isHitPixelFill || isHitPixelStroke;
9802
9895
  if (!this.__hitCanvas)
9803
- this.__hitCanvas = this.leafer.hitCanvasManager.getPathType(this);
9896
+ this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
9804
9897
  const h = this.__hitCanvas;
9898
+ if (isHitPixel) {
9899
+ const { renderBounds } = this.__layout;
9900
+ const size = Platform.image.hitCanvasSize;
9901
+ const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds, 0.5).a;
9902
+ const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
9903
+ h.resize({ width, height, pixelRatio: 1 });
9904
+ h.clear();
9905
+ ImageManager.patternLocked = true;
9906
+ this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
9907
+ ImageManager.patternLocked = false;
9908
+ h.resetTransform();
9909
+ data.__isHitPixel = true;
9910
+ }
9911
+ else {
9912
+ data.__isHitPixel && (data.__isHitPixel = false);
9913
+ }
9805
9914
  this.__drawHitPath(h);
9806
- h.setStrokeOptions(this.__);
9915
+ h.setStrokeOptions(data);
9807
9916
  };
9808
- UI.prototype.__hit = function (inner) {
9917
+ ui$1.__hit = function (inner) {
9809
9918
  if (Platform.name === 'miniapp')
9810
9919
  this.__drawHitPath(this.__hitCanvas);
9811
- const { fill, hitFill, windingRule } = this.__;
9812
- const needHitFill = (fill && hitFill === 'path') || hitFill === 'all';
9813
- const isHitFill = this.__hitFill(inner, windingRule);
9814
- if (needHitFill && isHitFill)
9920
+ const data = this.__;
9921
+ if (data.__isHitPixel && this.__hitPixel(inner))
9922
+ return true;
9923
+ const { hitFill } = data;
9924
+ const needHitFillPath = ((data.fill && hitFill == 'path') || hitFill === 'all');
9925
+ if (needHitFillPath && this.__hitFill(inner))
9815
9926
  return true;
9816
- const { stroke, hitStroke, __strokeWidth, strokeAlign } = this.__;
9817
- const needHitStroke = (stroke && hitStroke === 'path') || hitStroke === 'all';
9927
+ const { hitStroke, __strokeWidth } = data;
9928
+ const needHitStrokePath = ((data.stroke && hitStroke == 'path') || hitStroke === 'all');
9929
+ if (!needHitFillPath && !needHitStrokePath)
9930
+ return false;
9818
9931
  const radiusWidth = inner.radiusX * 2;
9819
9932
  let hitWidth = radiusWidth;
9820
- if (needHitStroke) {
9821
- switch (strokeAlign) {
9933
+ if (needHitStrokePath) {
9934
+ switch (data.strokeAlign) {
9822
9935
  case 'inside':
9823
9936
  hitWidth += __strokeWidth * 2;
9824
- if (!needHitFill && (isHitFill && this.__hitStroke(inner, hitWidth)))
9937
+ if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9825
9938
  return true;
9826
9939
  hitWidth = radiusWidth;
9827
9940
  break;
@@ -9830,8 +9943,8 @@ UI.prototype.__hit = function (inner) {
9830
9943
  break;
9831
9944
  case 'outside':
9832
9945
  hitWidth += __strokeWidth * 2;
9833
- if (!needHitFill) {
9834
- if (!isHitFill && this.__hitStroke(inner, hitWidth))
9946
+ if (!needHitFillPath) {
9947
+ if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9835
9948
  return true;
9836
9949
  hitWidth = radiusWidth;
9837
9950
  }
@@ -9846,8 +9959,8 @@ Rect.prototype.__updateHitCanvas = function () {
9846
9959
  if (this.stroke || this.cornerRadius)
9847
9960
  ui.__updateHitCanvas.call(this);
9848
9961
  };
9849
- Rect.prototype.__hitFill = function (inner, windingRule) {
9850
- return this.__hitCanvas ? ui.__hitFill.call(this, inner, windingRule) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
9962
+ Rect.prototype.__hitFill = function (inner) {
9963
+ return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
9851
9964
  };
9852
9965
 
9853
9966
  UI.prototype.find = function (condition, options) {
@@ -10571,8 +10684,11 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
10571
10684
  }
10572
10685
 
10573
10686
  const { get: get$3, translate } = MatrixHelper;
10687
+ const tempBox = new Bounds();
10574
10688
  function createData(leafPaint, image, paint, box) {
10575
10689
  let { width, height } = image;
10690
+ if (paint.padding)
10691
+ box = tempBox.set(box).shrink(paint.padding);
10576
10692
  const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
10577
10693
  const sameBox = box.width === width && box.height === height;
10578
10694
  if (blendMode)
@@ -10656,8 +10772,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10656
10772
  leafPaint.loadId = image.load(() => {
10657
10773
  ignoreRender(ui, false);
10658
10774
  if (!ui.destroyed) {
10659
- if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds))
10775
+ if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
10776
+ if (image.hasOpacityPixel)
10777
+ ui.__layout.hitCanvasChanged = true;
10660
10778
  ui.forceUpdate('surface');
10779
+ }
10661
10780
  onLoadSuccess(ui, event);
10662
10781
  }
10663
10782
  leafPaint.loadId = null;
@@ -10711,7 +10830,7 @@ function ignoreRender(ui, value) {
10711
10830
  const { get: get$2, scale, copy: copy$1 } = MatrixHelper;
10712
10831
  const { ceil, abs: abs$1 } = Math;
10713
10832
  function createPattern(ui, paint, pixelRatio) {
10714
- let { scaleX, scaleY } = ui.__nowWorld;
10833
+ let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
10715
10834
  const id = scaleX + '-' + scaleY;
10716
10835
  if (paint.patternId !== id && !ui.destroyed) {
10717
10836
  scaleX = abs$1(scaleX);
@@ -10773,7 +10892,7 @@ function createPattern(ui, paint, pixelRatio) {
10773
10892
 
10774
10893
  const { abs } = Math;
10775
10894
  function checkImage(ui, canvas, paint, allowPaint) {
10776
- const { scaleX, scaleY } = ui.__nowWorld;
10895
+ const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
10777
10896
  if (!paint.data || paint.patternId === scaleX + '-' + scaleY) {
10778
10897
  return false;
10779
10898
  }
@@ -11678,7 +11797,7 @@ const ExportModule = {
11678
11797
  const scale = options.scale || 1;
11679
11798
  const pixelRatio = options.pixelRatio || 1;
11680
11799
  const screenshot = options.screenshot || leaf.isApp;
11681
- const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : undefined) : options.fill;
11800
+ const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
11682
11801
  const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
11683
11802
  if (screenshot) {
11684
11803
  renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
@@ -11689,10 +11808,10 @@ const ExportModule = {
11689
11808
  scaleY = worldTransform.scaleY;
11690
11809
  switch (relative) {
11691
11810
  case 'inner':
11692
- matrix.set(worldTransform).invert();
11811
+ matrix.set(worldTransform);
11693
11812
  break;
11694
11813
  case 'local':
11695
- matrix.set(worldTransform).divide(leaf.localTransform).invert();
11814
+ matrix.set(worldTransform).divide(leaf.localTransform);
11696
11815
  scaleX /= leaf.scaleX;
11697
11816
  scaleY /= leaf.scaleY;
11698
11817
  break;
@@ -11703,7 +11822,7 @@ const ExportModule = {
11703
11822
  case 'page':
11704
11823
  relative = leaf.leafer;
11705
11824
  default:
11706
- matrix.set(worldTransform).divide(leaf.getTransform(relative)).invert();
11825
+ matrix.set(worldTransform).divide(leaf.getTransform(relative));
11707
11826
  const l = relative.worldTransform;
11708
11827
  scaleX /= scaleX / l.scaleX;
11709
11828
  scaleY /= scaleY / l.scaleY;
@@ -11712,7 +11831,7 @@ const ExportModule = {
11712
11831
  }
11713
11832
  const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
11714
11833
  let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio });
11715
- const renderOptions = { matrix: matrix.scale(scale).translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
11834
+ const renderOptions = { matrix: matrix.scale(1 / scale).invert().translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
11716
11835
  if (slice) {
11717
11836
  leaf = leafer;
11718
11837
  renderOptions.bounds = canvas.bounds;
@@ -11758,6 +11877,44 @@ function addTask(task) {
11758
11877
  });
11759
11878
  }
11760
11879
 
11880
+ const canvas = LeaferCanvasBase.prototype;
11881
+ const debug = Debug.get('@leafer-ui/export');
11882
+ canvas.export = function (filename, options) {
11883
+ const { quality, blob } = FileHelper.getExportOptions(options);
11884
+ if (filename.includes('.')) {
11885
+ return this.saveAs(filename, quality);
11886
+ }
11887
+ else if (blob) {
11888
+ return this.toBlob(filename, quality);
11889
+ }
11890
+ else {
11891
+ return this.toDataURL(filename, quality);
11892
+ }
11893
+ };
11894
+ canvas.toBlob = function (type, quality) {
11895
+ return new Promise((resolve) => {
11896
+ Platform.origin.canvasToBolb(this.view, type, quality).then((blob) => {
11897
+ resolve(blob);
11898
+ }).catch((e) => {
11899
+ debug.error(e);
11900
+ resolve(null);
11901
+ });
11902
+ });
11903
+ };
11904
+ canvas.toDataURL = function (type, quality) {
11905
+ return Platform.origin.canvasToDataURL(this.view, type, quality);
11906
+ };
11907
+ canvas.saveAs = function (filename, quality) {
11908
+ return new Promise((resolve) => {
11909
+ Platform.origin.canvasSaveAs(this.view, filename, quality).then(() => {
11910
+ resolve(true);
11911
+ }).catch((e) => {
11912
+ debug.error(e);
11913
+ resolve(false);
11914
+ });
11915
+ });
11916
+ };
11917
+
11761
11918
  Object.assign(TextConvert, TextConvertModule);
11762
11919
  Object.assign(ColorConvert, ColorConvertModule);
11763
11920
  Object.assign(Paint, PaintModule);
@@ -11772,5 +11929,11 @@ Object.assign(Creator, {
11772
11929
  hitCanvasManager: () => new HitCanvasManager()
11773
11930
  });
11774
11931
  useCanvas();
11932
+ window.addEventListener('unload', () => {
11933
+ const { list } = Leafer;
11934
+ list.forEach(leafer => leafer.destroy(true));
11935
+ list.destroy();
11936
+ ImageManager.destroy();
11937
+ });
11775
11938
 
11776
- export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, 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 };
11939
+ export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$2 as tempPoint, useCanvas, useModule, version, zoomLayerType };