@leafer-draw/worker 1.6.1 → 1.6.3

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.
@@ -23,8 +23,6 @@ const Platform = {
23
23
  }
24
24
  };
25
25
 
26
- const Creator = {};
27
-
28
26
  const IncrementId = {
29
27
  RUNTIME: 'runtime',
30
28
  LEAF: 'leaf',
@@ -150,7 +148,7 @@ function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
150
148
 
151
149
  const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
152
150
  const { float: float$1 } = MathHelper;
153
- const tempPoint$4 = {};
151
+ const tempPoint$3 = {};
154
152
  function getWorld() {
155
153
  return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
156
154
  }
@@ -193,8 +191,8 @@ const MatrixHelper = {
193
191
  t.d *= scaleY;
194
192
  },
195
193
  scaleOfOuter(t, origin, scaleX, scaleY) {
196
- M$6.toInnerPoint(t, origin, tempPoint$4);
197
- M$6.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
194
+ M$6.toInnerPoint(t, origin, tempPoint$3);
195
+ M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
198
196
  },
199
197
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
200
198
  M$6.translateInner(t, origin.x, origin.y);
@@ -212,8 +210,8 @@ const MatrixHelper = {
212
210
  t.d = c * sinR + d * cosR;
213
211
  },
214
212
  rotateOfOuter(t, origin, rotation) {
215
- M$6.toInnerPoint(t, origin, tempPoint$4);
216
- M$6.rotateOfInner(t, tempPoint$4, rotation);
213
+ M$6.toInnerPoint(t, origin, tempPoint$3);
214
+ M$6.rotateOfInner(t, tempPoint$3, rotation);
217
215
  },
218
216
  rotateOfInner(t, origin, rotation) {
219
217
  M$6.translateInner(t, origin.x, origin.y);
@@ -234,8 +232,8 @@ const MatrixHelper = {
234
232
  }
235
233
  },
236
234
  skewOfOuter(t, origin, skewX, skewY) {
237
- M$6.toInnerPoint(t, origin, tempPoint$4);
238
- M$6.skewOfInner(t, tempPoint$4, skewX, skewY);
235
+ M$6.toInnerPoint(t, origin, tempPoint$3);
236
+ M$6.skewOfInner(t, tempPoint$3, skewX, skewY);
239
237
  },
240
238
  skewOfInner(t, origin, skewX, skewY = 0) {
241
239
  M$6.translateInner(t, origin.x, origin.y);
@@ -464,8 +462,10 @@ const PointHelper = {
464
462
  t.y = halfPixel ? round$2(t.y - 0.5) + 0.5 : round$2(t.y);
465
463
  },
466
464
  move(t, x, y) {
467
- t.x += x;
468
- t.y += y;
465
+ if (typeof x === 'object')
466
+ t.x += x.x, t.y += x.y;
467
+ else
468
+ t.x += x, t.y += y;
469
469
  },
470
470
  scale(t, scaleX, scaleY = scaleX) {
471
471
  if (t.x)
@@ -490,19 +490,19 @@ const PointHelper = {
490
490
  },
491
491
  tempToInnerOf(t, matrix) {
492
492
  const { tempPoint: temp } = P$5;
493
- copy$a(temp, t);
493
+ copy$b(temp, t);
494
494
  toInnerPoint$2(matrix, temp, temp);
495
495
  return temp;
496
496
  },
497
497
  tempToOuterOf(t, matrix) {
498
498
  const { tempPoint: temp } = P$5;
499
- copy$a(temp, t);
499
+ copy$b(temp, t);
500
500
  toOuterPoint$3(matrix, temp, temp);
501
501
  return temp;
502
502
  },
503
503
  tempToInnerRadiusPointOf(t, matrix) {
504
504
  const { tempRadiusPoint: temp } = P$5;
505
- copy$a(temp, t);
505
+ copy$b(temp, t);
506
506
  P$5.toInnerRadiusPointOf(t, matrix, temp);
507
507
  return temp;
508
508
  },
@@ -575,7 +575,7 @@ const PointHelper = {
575
575
  }
576
576
  };
577
577
  const P$5 = PointHelper;
578
- const { getDistanceFrom, copy: copy$a, getAtan2 } = P$5;
578
+ const { getDistanceFrom, copy: copy$b, getAtan2 } = P$5;
579
579
 
580
580
  class Point {
581
581
  constructor(x, y) {
@@ -643,7 +643,7 @@ class Point {
643
643
  return this;
644
644
  }
645
645
  }
646
- const tempPoint$3 = new Point();
646
+ const tempPoint$2 = new Point();
647
647
 
648
648
  class Matrix {
649
649
  constructor(a, b, c, d, e, f) {
@@ -801,15 +801,87 @@ const TwoPointBoundsHelper = {
801
801
  };
802
802
  const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
803
803
 
804
+ var Direction4;
805
+ (function (Direction4) {
806
+ Direction4[Direction4["top"] = 0] = "top";
807
+ Direction4[Direction4["right"] = 1] = "right";
808
+ Direction4[Direction4["bottom"] = 2] = "bottom";
809
+ Direction4[Direction4["left"] = 3] = "left";
810
+ })(Direction4 || (Direction4 = {}));
811
+ var Direction9;
812
+ (function (Direction9) {
813
+ Direction9[Direction9["topLeft"] = 0] = "topLeft";
814
+ Direction9[Direction9["top"] = 1] = "top";
815
+ Direction9[Direction9["topRight"] = 2] = "topRight";
816
+ Direction9[Direction9["right"] = 3] = "right";
817
+ Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
818
+ Direction9[Direction9["bottom"] = 5] = "bottom";
819
+ Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
820
+ Direction9[Direction9["left"] = 7] = "left";
821
+ Direction9[Direction9["center"] = 8] = "center";
822
+ Direction9[Direction9["top-left"] = 0] = "top-left";
823
+ Direction9[Direction9["top-right"] = 2] = "top-right";
824
+ Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
825
+ Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
826
+ })(Direction9 || (Direction9 = {}));
827
+
828
+ const directionData = [
829
+ { x: 0, y: 0 },
830
+ { x: 0.5, y: 0 },
831
+ { x: 1, y: 0 },
832
+ { x: 1, y: 0.5 },
833
+ { x: 1, y: 1 },
834
+ { x: 0.5, y: 1 },
835
+ { x: 0, y: 1 },
836
+ { x: 0, y: 0.5 },
837
+ { x: 0.5, y: 0.5 }
838
+ ];
839
+ directionData.forEach(item => item.type = 'percent');
840
+ const AroundHelper = {
841
+ directionData,
842
+ tempPoint: {},
843
+ get: get$4,
844
+ toPoint(around, box, to, onlyBoxSize, content, onlyContentSize) {
845
+ const point = get$4(around);
846
+ to.x = point.x;
847
+ to.y = point.y;
848
+ if (point.type === 'percent') {
849
+ to.x *= box.width;
850
+ to.y *= box.height;
851
+ if (content) {
852
+ if (!onlyContentSize)
853
+ to.x -= content.x, to.y -= content.y;
854
+ if (point.x)
855
+ to.x -= (point.x === 1) ? content.width : (point.x === 0.5 ? point.x * content.width : 0);
856
+ if (point.y)
857
+ to.y -= (point.y === 1) ? content.height : (point.y === 0.5 ? point.y * content.height : 0);
858
+ }
859
+ }
860
+ if (!onlyBoxSize)
861
+ to.x += box.x, to.y += box.y;
862
+ }
863
+ };
864
+ function get$4(around) {
865
+ return typeof around === 'string' ? directionData[Direction9[around]] : around;
866
+ }
867
+
868
+ const { toPoint: toPoint$5 } = AroundHelper;
869
+ const AlignHelper = {
870
+ toPoint(align, content, box, to, onlyBoxSize, onlyContentSize) {
871
+ toPoint$5(align, box, to, onlyBoxSize, content, onlyContentSize);
872
+ }
873
+ };
874
+
804
875
  const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3 } = TwoPointBoundsHelper;
805
876
  const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
806
877
  const { float, fourNumber } = MathHelper;
807
878
  const { floor, ceil: ceil$2 } = Math;
808
879
  let right$1, bottom$1, boundsRight, boundsBottom;
809
880
  const point = {};
810
- const toPoint$5 = {};
881
+ const toPoint$4 = {};
882
+ const tempBounds$2 = {};
811
883
  const BoundsHelper = {
812
- tempBounds: {},
884
+ tempBounds: tempBounds$2,
813
885
  set(t, x = 0, y = 0, width = 0, height = 0) {
814
886
  t.x = x;
815
887
  t.y = y;
@@ -860,7 +932,7 @@ const BoundsHelper = {
860
932
  to = t;
861
933
  }
862
934
  else {
863
- copy$9(to, t);
935
+ copy$a(to, t);
864
936
  }
865
937
  if (parent) {
866
938
  to.offsetX = -(B.maxX(parent) - t.x);
@@ -872,8 +944,8 @@ const BoundsHelper = {
872
944
  }
873
945
  B.move(to, -to.offsetX, -to.offsetY);
874
946
  },
875
- scale(t, scaleX, scaleY = scaleX) {
876
- PointHelper.scale(t, scaleX, scaleY);
947
+ scale(t, scaleX, scaleY = scaleX, onlySize) {
948
+ onlySize || PointHelper.scale(t, scaleX, scaleY);
877
949
  t.width *= scaleX;
878
950
  t.height *= scaleY;
879
951
  },
@@ -883,9 +955,9 @@ const BoundsHelper = {
883
955
  t.height *= scaleY;
884
956
  },
885
957
  tempToOuterOf(t, matrix) {
886
- B.copy(B.tempBounds, t);
887
- B.toOuterOf(B.tempBounds, matrix);
888
- return B.tempBounds;
958
+ B.copy(tempBounds$2, t);
959
+ B.toOuterOf(tempBounds$2, matrix);
960
+ return tempBounds$2;
889
961
  },
890
962
  getOuterOf(t, matrix) {
891
963
  t = Object.assign({}, t);
@@ -916,17 +988,17 @@ const BoundsHelper = {
916
988
  else {
917
989
  point.x = t.x;
918
990
  point.y = t.y;
919
- toOuterPoint$2(matrix, point, toPoint$5);
920
- setPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
991
+ toOuterPoint$2(matrix, point, toPoint$4);
992
+ setPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
921
993
  point.x = t.x + t.width;
922
- toOuterPoint$2(matrix, point, toPoint$5);
923
- addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
994
+ toOuterPoint$2(matrix, point, toPoint$4);
995
+ addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
924
996
  point.y = t.y + t.height;
925
- toOuterPoint$2(matrix, point, toPoint$5);
926
- addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
997
+ toOuterPoint$2(matrix, point, toPoint$4);
998
+ addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
927
999
  point.x = t.x;
928
- toOuterPoint$2(matrix, point, toPoint$5);
929
- addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
1000
+ toOuterPoint$2(matrix, point, toPoint$4);
1001
+ addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
930
1002
  toBounds$3(tempPointBounds$1, to);
931
1003
  }
932
1004
  },
@@ -936,9 +1008,21 @@ const BoundsHelper = {
936
1008
  B.scale(to, 1 / matrix.a, 1 / matrix.d);
937
1009
  },
938
1010
  getFitMatrix(t, put, baseScale = 1) {
939
- const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
1011
+ const scale = Math.min(baseScale, B.getFitScale(t, put));
940
1012
  return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
941
1013
  },
1014
+ getFitScale(t, put, isCoverMode) {
1015
+ const sw = t.width / put.width, sh = t.height / put.height;
1016
+ return isCoverMode ? Math.max(sw, sh) : Math.min(sw, sh);
1017
+ },
1018
+ put(t, put, align = 'center', putScale = 1, changeSize = true, to) {
1019
+ to || (to = put);
1020
+ if (typeof putScale === 'string')
1021
+ putScale = B.getFitScale(t, put, putScale === 'cover');
1022
+ tempBounds$2.width = changeSize ? put.width *= putScale : put.width * putScale;
1023
+ tempBounds$2.height = changeSize ? put.height *= putScale : put.height * putScale;
1024
+ AlignHelper.toPoint(align, tempBounds$2, t, to, true, true);
1025
+ },
942
1026
  getSpread(t, spread, side) {
943
1027
  const n = {};
944
1028
  B.copyAndSpread(n, t, spread, false, side);
@@ -1006,7 +1090,7 @@ const BoundsHelper = {
1006
1090
  if (first) {
1007
1091
  first = false;
1008
1092
  if (!addMode)
1009
- copy$9(t, bounds);
1093
+ copy$a(t, bounds);
1010
1094
  }
1011
1095
  else {
1012
1096
  add$1(t, bounds);
@@ -1087,7 +1171,7 @@ const BoundsHelper = {
1087
1171
  }
1088
1172
  };
1089
1173
  const B = BoundsHelper;
1090
- const { add: add$1, copy: copy$9 } = B;
1174
+ const { add: add$1, copy: copy$a } = B;
1091
1175
 
1092
1176
  class Bounds {
1093
1177
  get minX() { return BoundsHelper.minX(this); }
@@ -1112,8 +1196,8 @@ class Bounds {
1112
1196
  BoundsHelper.move(this, x, y);
1113
1197
  return this;
1114
1198
  }
1115
- scale(scaleX, scaleY) {
1116
- BoundsHelper.scale(this, scaleX, scaleY);
1199
+ scale(scaleX, scaleY, onlySize) {
1200
+ BoundsHelper.scale(this, scaleX, scaleY, onlySize);
1117
1201
  return this;
1118
1202
  }
1119
1203
  scaleOf(origin, scaleX, scaleY) {
@@ -1131,6 +1215,9 @@ class Bounds {
1131
1215
  getFitMatrix(put, baseScale) {
1132
1216
  return BoundsHelper.getFitMatrix(this, put, baseScale);
1133
1217
  }
1218
+ put(put, align, putScale) {
1219
+ BoundsHelper.put(this, put, align, putScale);
1220
+ }
1134
1221
  spread(fourNumber, side) {
1135
1222
  BoundsHelper.spread(this, fourNumber, side);
1136
1223
  return this;
@@ -1239,79 +1326,6 @@ class AutoBounds {
1239
1326
  }
1240
1327
  }
1241
1328
 
1242
- var Direction4;
1243
- (function (Direction4) {
1244
- Direction4[Direction4["top"] = 0] = "top";
1245
- Direction4[Direction4["right"] = 1] = "right";
1246
- Direction4[Direction4["bottom"] = 2] = "bottom";
1247
- Direction4[Direction4["left"] = 3] = "left";
1248
- })(Direction4 || (Direction4 = {}));
1249
- var Direction9;
1250
- (function (Direction9) {
1251
- Direction9[Direction9["topLeft"] = 0] = "topLeft";
1252
- Direction9[Direction9["top"] = 1] = "top";
1253
- Direction9[Direction9["topRight"] = 2] = "topRight";
1254
- Direction9[Direction9["right"] = 3] = "right";
1255
- Direction9[Direction9["bottomRight"] = 4] = "bottomRight";
1256
- Direction9[Direction9["bottom"] = 5] = "bottom";
1257
- Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
1258
- Direction9[Direction9["left"] = 7] = "left";
1259
- Direction9[Direction9["center"] = 8] = "center";
1260
- Direction9[Direction9["top-left"] = 0] = "top-left";
1261
- Direction9[Direction9["top-right"] = 2] = "top-right";
1262
- Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
1263
- Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
1264
- })(Direction9 || (Direction9 = {}));
1265
-
1266
- const directionData = [
1267
- { x: 0, y: 0 },
1268
- { x: 0.5, y: 0 },
1269
- { x: 1, y: 0 },
1270
- { x: 1, y: 0.5 },
1271
- { x: 1, y: 1 },
1272
- { x: 0.5, y: 1 },
1273
- { x: 0, y: 1 },
1274
- { x: 0, y: 0.5 },
1275
- { x: 0.5, y: 0.5 }
1276
- ];
1277
- directionData.forEach(item => item.type = 'percent');
1278
- const AroundHelper = {
1279
- directionData,
1280
- tempPoint: {},
1281
- get: get$4,
1282
- toPoint(around, bounds, to, onlySize, pointBounds) {
1283
- const point = get$4(around);
1284
- to.x = point.x;
1285
- to.y = point.y;
1286
- if (point.type === 'percent') {
1287
- to.x *= bounds.width;
1288
- to.y *= bounds.height;
1289
- if (pointBounds) {
1290
- to.x -= pointBounds.x;
1291
- to.y -= pointBounds.y;
1292
- if (point.x)
1293
- to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
1294
- if (point.y)
1295
- to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
1296
- }
1297
- }
1298
- if (!onlySize) {
1299
- to.x += bounds.x;
1300
- to.y += bounds.y;
1301
- }
1302
- }
1303
- };
1304
- function get$4(around) {
1305
- return typeof around === 'string' ? directionData[Direction9[around]] : around;
1306
- }
1307
-
1308
- const { toPoint: toPoint$4 } = AroundHelper;
1309
- const AlignHelper = {
1310
- toPoint(align, contentBounds, bounds, to, onlySize) {
1311
- toPoint$4(align, bounds, to, onlySize, contentBounds);
1312
- }
1313
- };
1314
-
1315
1329
  const StringNumberMap = {
1316
1330
  '0': 1,
1317
1331
  '1': 1,
@@ -1442,11 +1456,17 @@ const Plugin = {
1442
1456
  return rs;
1443
1457
  },
1444
1458
  need(name) {
1445
- console.error('please install plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
1459
+ console.error('please install and import plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
1446
1460
  }
1447
1461
  };
1448
1462
  setTimeout(() => check.forEach(name => Plugin.has(name, true)));
1449
1463
 
1464
+ const Creator = {
1465
+ editor(_options) {
1466
+ return Plugin.need('editor');
1467
+ }
1468
+ };
1469
+
1450
1470
  const debug$d = Debug.get('UICreator');
1451
1471
  const UICreator = {
1452
1472
  list: {},
@@ -1584,6 +1604,10 @@ const DataHelper = {
1584
1604
  for (let i = 0, len = list.length; i < len; i++)
1585
1605
  map[list[i]] = true;
1586
1606
  return map;
1607
+ },
1608
+ stintSet(data, attrName, value) {
1609
+ value || (value = undefined);
1610
+ data[attrName] !== value && (data[attrName] = value);
1587
1611
  }
1588
1612
  };
1589
1613
  const { assign } = DataHelper;
@@ -2042,7 +2066,7 @@ __decorate([
2042
2066
  contextMethod()
2043
2067
  ], Canvas$1.prototype, "strokeText", null);
2044
2068
 
2045
- const { copy: copy$8, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2069
+ const { copy: copy$9, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2046
2070
  const minSize = { width: 1, height: 1, pixelRatio: 1 };
2047
2071
  const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
2048
2072
  class LeaferCanvasBase extends Canvas$1 {
@@ -2274,7 +2298,7 @@ class LeaferCanvasBase extends Canvas$1 {
2274
2298
  const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
2275
2299
  canvas.save();
2276
2300
  if (useSameWorldTransform)
2277
- copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2301
+ copy$9(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
2278
2302
  if (useSameSmooth)
2279
2303
  canvas.smooth = this.smooth;
2280
2304
  canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
@@ -2385,7 +2409,7 @@ const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI
2385
2409
  const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
2386
2410
  const { set, toNumberPoints } = PointHelper;
2387
2411
  const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
2388
- const tempPoint$2 = {};
2412
+ const tempPoint$1 = {};
2389
2413
  const BezierHelper = {
2390
2414
  points(data, originPoints, curve, close) {
2391
2415
  let points = toNumberPoints(originPoints);
@@ -2407,6 +2431,8 @@ const BezierHelper = {
2407
2431
  cY = points[i + 3];
2408
2432
  ba = sqrt$1(pow(bX - aX, 2) + pow(bY - aY, 2));
2409
2433
  cb = sqrt$1(pow(cX - bX, 2) + pow(cY - bY, 2));
2434
+ if (!ba && !cb)
2435
+ continue;
2410
2436
  d = ba + cb;
2411
2437
  ba = (t * ba) / d;
2412
2438
  cb = (t * cb) / d;
@@ -2576,8 +2602,8 @@ const BezierHelper = {
2576
2602
  addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
2577
2603
  addPoint$1(pointBounds, toX, toY);
2578
2604
  for (let i = 0, len = tList.length; i < len; i++) {
2579
- getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
2580
- addPoint$1(pointBounds, tempPoint$2.x, tempPoint$2.y);
2605
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$1);
2606
+ addPoint$1(pointBounds, tempPoint$1.x, tempPoint$1.y);
2581
2607
  }
2582
2608
  },
2583
2609
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
@@ -2589,7 +2615,11 @@ const BezierHelper = {
2589
2615
  const point = {};
2590
2616
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
2591
2617
  return point;
2592
- }
2618
+ },
2619
+ getDerivative(t, fromV, v1, v2, toV) {
2620
+ const o = 1 - t;
2621
+ return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
2622
+ },
2593
2623
  };
2594
2624
  const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
2595
2625
 
@@ -2647,7 +2677,7 @@ const EllipseHelper = {
2647
2677
  };
2648
2678
 
2649
2679
  const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$3, 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;
2650
- const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2680
+ const { rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
2651
2681
  const { ellipticalArc } = EllipseHelper;
2652
2682
  const debug$b = Debug.get('PathConvert');
2653
2683
  const setEndPoint$1 = {};
@@ -2844,7 +2874,7 @@ const PathConvert = {
2844
2874
  case N$3:
2845
2875
  x = old[i + 1];
2846
2876
  y = old[i + 2];
2847
- curveMode ? rect$2(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
2877
+ curveMode ? rect$3(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
2848
2878
  i += 5;
2849
2879
  break;
2850
2880
  case D$3:
@@ -3020,7 +3050,7 @@ const PathCommandDataHelper = {
3020
3050
  };
3021
3051
  const { ellipse: ellipse$3, arc: arc$2 } = PathCommandDataHelper;
3022
3052
 
3023
- const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$1, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints: drawPoints$2 } = PathCommandDataHelper;
3053
+ const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints: drawPoints$2 } = PathCommandDataHelper;
3024
3054
  class PathCreator {
3025
3055
  set path(value) { this.__path = value; }
3026
3056
  get path() { return this.__path; }
@@ -3067,7 +3097,7 @@ class PathCreator {
3067
3097
  return this;
3068
3098
  }
3069
3099
  rect(x, y, width, height) {
3070
- rect$1(this.__path, x, y, width, height);
3100
+ rect$2(this.__path, x, y, width, height);
3071
3101
  this.paint();
3072
3102
  return this;
3073
3103
  }
@@ -3185,7 +3215,7 @@ const PathDrawer = {
3185
3215
 
3186
3216
  const { M: M$1, L: L$2, C, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
3187
3217
  const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
3188
- const { addPointBounds, copy: copy$7, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3218
+ const { addPointBounds, copy: copy$8, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
3189
3219
  const debug$9 = Debug.get('PathBounds');
3190
3220
  let radius, radiusX, radiusY;
3191
3221
  const tempPointBounds = {};
@@ -3257,7 +3287,7 @@ const PathBounds = {
3257
3287
  break;
3258
3288
  case G:
3259
3289
  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);
3260
- i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3290
+ i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3261
3291
  x = setEndPoint.x;
3262
3292
  y = setEndPoint.y;
3263
3293
  i += 9;
@@ -3273,7 +3303,7 @@ const PathBounds = {
3273
3303
  break;
3274
3304
  case O:
3275
3305
  arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
3276
- i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3306
+ i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3277
3307
  x = setEndPoint.x;
3278
3308
  y = setEndPoint.y;
3279
3309
  i += 7;
@@ -3288,7 +3318,7 @@ const PathBounds = {
3288
3318
  break;
3289
3319
  case U:
3290
3320
  arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
3291
- i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3321
+ i === 0 ? copy$8(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
3292
3322
  x = setEndPoint.x;
3293
3323
  y = setEndPoint.y;
3294
3324
  i += 6;
@@ -3382,7 +3412,7 @@ function canvasPatch(drawer) {
3382
3412
  }
3383
3413
 
3384
3414
  const FileHelper = {
3385
- opacityTypes: ['png', 'webp', 'svg'],
3415
+ alphaPixelTypes: ['png', 'webp', 'svg'],
3386
3416
  upperCaseTypeMap: {},
3387
3417
  mineType(type) {
3388
3418
  if (!type || type.startsWith('image'))
@@ -3409,7 +3439,7 @@ const FileHelper = {
3409
3439
  }
3410
3440
  };
3411
3441
  const F = FileHelper;
3412
- F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3442
+ F.alphaPixelTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
3413
3443
 
3414
3444
  const debug$8 = Debug.get('TaskProcessor');
3415
3445
  class TaskItem {
@@ -3726,8 +3756,8 @@ const ImageManager = {
3726
3756
  list.length = 0;
3727
3757
  }
3728
3758
  },
3729
- hasOpacityPixel(config) {
3730
- return FileHelper.opacityTypes.some(item => I.isFormat(item, config));
3759
+ hasAlphaPixel(config) {
3760
+ return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
3731
3761
  },
3732
3762
  isFormat(format, config) {
3733
3763
  if (config.format === format)
@@ -3765,13 +3795,16 @@ class LeaferImage {
3765
3795
  this.setView(view.config ? view.view : view);
3766
3796
  }
3767
3797
  ImageManager.isFormat('svg', config) && (this.isSVG = true);
3768
- ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
3798
+ ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
3769
3799
  }
3770
3800
  load(onSuccess, onError) {
3771
3801
  if (!this.loading) {
3772
3802
  this.loading = true;
3803
+ let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
3804
+ if (onProgress)
3805
+ loadImage = loadImageWithProgress;
3773
3806
  Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
3774
- return yield Platform.origin.loadImage(this.url).then(img => this.setView(img)).catch((e) => {
3807
+ return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
3775
3808
  this.error = e;
3776
3809
  this.onComplete(false);
3777
3810
  });
@@ -3796,6 +3829,9 @@ class LeaferImage {
3796
3829
  this.view = img;
3797
3830
  this.onComplete(true);
3798
3831
  }
3832
+ onProgress(progress) {
3833
+ this.progress = progress;
3834
+ }
3799
3835
  onComplete(isSuccess) {
3800
3836
  let odd;
3801
3837
  this.waitComplete.forEach((item, index) => {
@@ -4218,8 +4254,8 @@ function registerUIEvent() {
4218
4254
  };
4219
4255
  }
4220
4256
 
4221
- const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4222
- const matrix = {}, { round } = Math;
4257
+ const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4258
+ const matrix$1 = {}, { round } = Math;
4223
4259
  const LeafHelper = {
4224
4260
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
4225
4261
  if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
@@ -4261,13 +4297,20 @@ const LeafHelper = {
4261
4297
  if (leaf.isBranch) {
4262
4298
  const { children } = leaf;
4263
4299
  for (let i = 0, len = children.length; i < len; i++) {
4264
- updateAllWorldOpacity$1(children[i]);
4300
+ updateAllWorldOpacity(children[i]);
4265
4301
  }
4266
4302
  }
4267
4303
  },
4268
- updateAllChange(leaf) {
4269
- updateAllWorldOpacity$1(leaf);
4304
+ updateChange(leaf) {
4305
+ const layout = leaf.__layout;
4306
+ if (layout.stateStyleChanged)
4307
+ leaf.updateState();
4308
+ if (layout.opacityChanged)
4309
+ updateAllWorldOpacity(leaf);
4270
4310
  leaf.__updateChange();
4311
+ },
4312
+ updateAllChange(leaf) {
4313
+ updateChange$1(leaf);
4271
4314
  if (leaf.isBranch) {
4272
4315
  const { children } = leaf;
4273
4316
  for (let i = 0, len = children.length; i < len; i++) {
@@ -4307,13 +4350,13 @@ const LeafHelper = {
4307
4350
  transition = scaleY;
4308
4351
  scaleY = scaleX;
4309
4352
  }
4310
- copy$6(matrix, o);
4311
- scaleOfOuter$2(matrix, origin, scaleX, scaleY);
4353
+ copy$7(matrix$1, o);
4354
+ scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
4312
4355
  if (t.origin || t.around) {
4313
- L.setTransform(t, matrix, resize, transition);
4356
+ L.setTransform(t, matrix$1, resize, transition);
4314
4357
  }
4315
4358
  else {
4316
- const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
4359
+ const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
4317
4360
  if (transition && !resize)
4318
4361
  t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
4319
4362
  else
@@ -4325,32 +4368,32 @@ const LeafHelper = {
4325
4368
  },
4326
4369
  rotateOfLocal(t, origin, angle, transition) {
4327
4370
  const o = t.__localMatrix;
4328
- copy$6(matrix, o);
4329
- rotateOfOuter$2(matrix, origin, angle);
4371
+ copy$7(matrix$1, o);
4372
+ rotateOfOuter$2(matrix$1, origin, angle);
4330
4373
  if (t.origin || t.around)
4331
- L.setTransform(t, matrix, false, transition);
4374
+ L.setTransform(t, matrix$1, false, transition);
4332
4375
  else
4333
- t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4376
+ t.set({ x: t.x + matrix$1.e - o.e, y: t.y + matrix$1.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
4334
4377
  },
4335
4378
  skewOfWorld(t, origin, skewX, skewY, resize, transition) {
4336
4379
  L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
4337
4380
  },
4338
4381
  skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
4339
- copy$6(matrix, t.__localMatrix);
4340
- skewOfOuter(matrix, origin, skewX, skewY);
4341
- L.setTransform(t, matrix, resize, transition);
4382
+ copy$7(matrix$1, t.__localMatrix);
4383
+ skewOfOuter(matrix$1, origin, skewX, skewY);
4384
+ L.setTransform(t, matrix$1, resize, transition);
4342
4385
  },
4343
4386
  transformWorld(t, transform, resize, transition) {
4344
- copy$6(matrix, t.worldTransform);
4345
- multiplyParent$2(matrix, transform);
4387
+ copy$7(matrix$1, t.worldTransform);
4388
+ multiplyParent$2(matrix$1, transform);
4346
4389
  if (t.parent)
4347
- divideParent(matrix, t.parent.worldTransform);
4348
- L.setTransform(t, matrix, resize, transition);
4390
+ divideParent(matrix$1, t.parent.worldTransform);
4391
+ L.setTransform(t, matrix$1, resize, transition);
4349
4392
  },
4350
4393
  transform(t, transform, resize, transition) {
4351
- copy$6(matrix, t.localTransform);
4352
- multiplyParent$2(matrix, transform);
4353
- L.setTransform(t, matrix, resize, transition);
4394
+ copy$7(matrix$1, t.localTransform);
4395
+ multiplyParent$2(matrix$1, transform);
4396
+ L.setTransform(t, matrix$1, resize, transition);
4354
4397
  },
4355
4398
  setTransform(t, transform, resize, transition) {
4356
4399
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
@@ -4384,9 +4427,9 @@ const LeafHelper = {
4384
4427
  return innerOrigin;
4385
4428
  },
4386
4429
  getRelativeWorld(t, relative, temp) {
4387
- copy$6(matrix, t.worldTransform);
4388
- divideParent(matrix, relative.worldTransform);
4389
- return temp ? matrix : Object.assign({}, matrix);
4430
+ copy$7(matrix$1, t.worldTransform);
4431
+ divideParent(matrix$1, relative.worldTransform);
4432
+ return temp ? matrix$1 : Object.assign({}, matrix$1);
4390
4433
  },
4391
4434
  drop(t, parent, index, resize) {
4392
4435
  t.setTransform(L.getRelativeWorld(t, parent, true), resize);
@@ -4403,7 +4446,7 @@ const LeafHelper = {
4403
4446
  }
4404
4447
  };
4405
4448
  const L = LeafHelper;
4406
- const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity$1, updateAllChange: updateAllChange$1 } = L;
4449
+ const { updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L;
4407
4450
  function getTempLocal(t, world) {
4408
4451
  t.__layout.update();
4409
4452
  return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
@@ -4440,7 +4483,7 @@ const LeafBoundsHelper = {
4440
4483
  }
4441
4484
  };
4442
4485
 
4443
- const { updateBounds: updateBounds$2 } = LeafHelper;
4486
+ const { updateBounds: updateBounds$3 } = LeafHelper;
4444
4487
  const BranchHelper = {
4445
4488
  sort(a, b) {
4446
4489
  return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
@@ -4502,11 +4545,11 @@ const BranchHelper = {
4502
4545
  branch = branchStack[i];
4503
4546
  children = branch.children;
4504
4547
  for (let j = 0, len = children.length; j < len; j++) {
4505
- updateBounds$2(children[j]);
4548
+ updateBounds$3(children[j]);
4506
4549
  }
4507
4550
  if (exclude && exclude === branch)
4508
4551
  continue;
4509
- updateBounds$2(branch);
4552
+ updateBounds$3(branch);
4510
4553
  }
4511
4554
  }
4512
4555
  };
@@ -4524,8 +4567,8 @@ const WaitHelper = {
4524
4567
  }
4525
4568
  };
4526
4569
 
4527
- const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
4528
- const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
4570
+ const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
4571
+ const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
4529
4572
  const localContent = '_localContentBounds';
4530
4573
  const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
4531
4574
  class LeafLayout {
@@ -4568,7 +4611,9 @@ class LeafLayout {
4568
4611
  this._localRenderBounds = local;
4569
4612
  }
4570
4613
  update() {
4571
- const { leafer } = this.leaf;
4614
+ const { leaf } = this, { leafer } = leaf;
4615
+ if (leaf.isApp)
4616
+ return updateBounds$2(leaf);
4572
4617
  if (leafer) {
4573
4618
  if (leafer.ready)
4574
4619
  leafer.watcher.changed && leafer.layouter.layout();
@@ -4576,7 +4621,7 @@ class LeafLayout {
4576
4621
  leafer.start();
4577
4622
  }
4578
4623
  else {
4579
- let root = this.leaf;
4624
+ let root = leaf;
4580
4625
  while (root.parent && !root.parent.leafer) {
4581
4626
  root = root.parent;
4582
4627
  }
@@ -4683,7 +4728,7 @@ class LeafLayout {
4683
4728
  }
4684
4729
  if (!layoutBounds)
4685
4730
  layoutBounds = MatrixHelper.getLayout(matrix);
4686
- copy$5(layoutBounds, bounds);
4731
+ copy$6(layoutBounds, bounds);
4687
4732
  PointHelper.copy(layoutBounds, point);
4688
4733
  if (unscale) {
4689
4734
  const { scaleX, scaleY } = layoutBounds;
@@ -4798,7 +4843,7 @@ class LeafLayout {
4798
4843
  }
4799
4844
  childrenSortChange() {
4800
4845
  if (!this.childrenSortChanged) {
4801
- this.childrenSortChanged = true;
4846
+ this.childrenSortChanged = this.affectChildrenSort = true;
4802
4847
  this.leaf.forceUpdate('surface');
4803
4848
  }
4804
4849
  }
@@ -4865,6 +4910,40 @@ ImageEvent.LOAD = 'image.load';
4865
4910
  ImageEvent.LOADED = 'image.loaded';
4866
4911
  ImageEvent.ERROR = 'image.error';
4867
4912
 
4913
+ class BoundsEvent extends Event {
4914
+ static checkHas(leaf, type, mode) {
4915
+ if (mode === 'on') {
4916
+ type === WORLD ? leaf.__hasWorldEvent = true : leaf.__hasLocalEvent = true;
4917
+ }
4918
+ else {
4919
+ leaf.__hasLocalEvent = leaf.hasEvent(RESIZE) || leaf.hasEvent(INNER) || leaf.hasEvent(LOCAL);
4920
+ leaf.__hasWorldEvent = leaf.hasEvent(WORLD);
4921
+ }
4922
+ }
4923
+ static emitLocal(leaf) {
4924
+ if (leaf.leaferIsReady) {
4925
+ const { resized } = leaf.__layout;
4926
+ if (resized !== 'local') {
4927
+ leaf.emit(RESIZE, leaf);
4928
+ if (resized === 'inner')
4929
+ leaf.emit(INNER, leaf);
4930
+ }
4931
+ leaf.emit(LOCAL, leaf);
4932
+ }
4933
+ }
4934
+ static emitWorld(leaf) {
4935
+ if (leaf.leaferIsReady)
4936
+ leaf.emit(WORLD, this);
4937
+ }
4938
+ }
4939
+ BoundsEvent.RESIZE = 'bounds.resize';
4940
+ BoundsEvent.INNER = 'bounds.inner';
4941
+ BoundsEvent.LOCAL = 'bounds.local';
4942
+ BoundsEvent.WORLD = 'bounds.world';
4943
+ const { RESIZE, INNER, LOCAL, WORLD } = BoundsEvent;
4944
+ const boundsEventMap = {};
4945
+ [RESIZE, INNER, LOCAL, WORLD].forEach(key => boundsEventMap[key] = 1);
4946
+
4868
4947
  class ResizeEvent extends Event {
4869
4948
  get bigger() {
4870
4949
  if (!this.old)
@@ -4961,9 +5040,12 @@ class Eventer {
4961
5040
  set event(map) { this.on(map); }
4962
5041
  on(type, listener, options) {
4963
5042
  if (!listener) {
4964
- let event, map = type;
4965
- for (let key in map)
4966
- event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
5043
+ let event;
5044
+ if (type instanceof Array)
5045
+ type.forEach(item => this.on(item[0], item[1], item[2]));
5046
+ else
5047
+ for (let key in type)
5048
+ (event = type[key]) instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event);
4967
5049
  return;
4968
5050
  }
4969
5051
  let capture, once;
@@ -4993,6 +5075,8 @@ class Eventer {
4993
5075
  else {
4994
5076
  map[type] = [item];
4995
5077
  }
5078
+ if (boundsEventMap[type])
5079
+ BoundsEvent.checkHas(this, type, 'on');
4996
5080
  }
4997
5081
  });
4998
5082
  }
@@ -5014,6 +5098,8 @@ class Eventer {
5014
5098
  events.splice(index, 1);
5015
5099
  if (!events.length)
5016
5100
  delete map[type];
5101
+ if (boundsEventMap[type])
5102
+ BoundsEvent.checkHas(this, type, 'off');
5017
5103
  }
5018
5104
  }
5019
5105
  });
@@ -5033,19 +5119,31 @@ class Eventer {
5033
5119
  }
5034
5120
  }
5035
5121
  on_(type, listener, bind, options) {
5036
- if (bind)
5037
- listener = listener.bind(bind);
5038
- this.on(type, listener, options);
5122
+ if (!listener)
5123
+ (type instanceof Array) && type.forEach(item => this.on(item[0], item[2] ? item[1] = item[1].bind(item[2]) : item[1], item[3]));
5124
+ else
5125
+ this.on(type, bind ? listener = listener.bind(bind) : listener, options);
5039
5126
  return { type, current: this, listener, options };
5040
5127
  }
5041
5128
  off_(id) {
5042
5129
  if (!id)
5043
5130
  return;
5044
5131
  const list = id instanceof Array ? id : [id];
5045
- list.forEach(item => item.current.off(item.type, item.listener, item.options));
5132
+ list.forEach(item => {
5133
+ if (!item.listener)
5134
+ (item.type instanceof Array) && item.type.forEach(v => item.current.off(v[0], v[1], v[3]));
5135
+ else
5136
+ item.current.off(item.type, item.listener, item.options);
5137
+ });
5046
5138
  list.length = 0;
5047
5139
  }
5048
- once(type, listener, capture) {
5140
+ once(type, listener, captureOrBind, capture) {
5141
+ if (!listener)
5142
+ return (type instanceof Array) && type.forEach(item => this.once(item[0], item[1], item[2], item[3]));
5143
+ if (typeof captureOrBind === 'object')
5144
+ listener = listener.bind(captureOrBind);
5145
+ else
5146
+ capture = captureOrBind;
5049
5147
  this.on(type, listener, { once: true, capture });
5050
5148
  }
5051
5149
  emit(type, event, capture) {
@@ -5157,7 +5255,7 @@ const LeafDataProxy = {
5157
5255
  };
5158
5256
 
5159
5257
  const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
5160
- const { toPoint: toPoint$3, tempPoint: tempPoint$1 } = AroundHelper;
5258
+ const { toPoint: toPoint$3, tempPoint } = AroundHelper;
5161
5259
  const LeafMatrix = {
5162
5260
  __updateWorldMatrix() {
5163
5261
  multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
@@ -5166,33 +5264,39 @@ const LeafMatrix = {
5166
5264
  if (this.__local) {
5167
5265
  const layout = this.__layout, local = this.__local, data = this.__;
5168
5266
  if (layout.affectScaleOrRotation) {
5169
- if (layout.scaleChanged || layout.rotationChanged) {
5267
+ if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
5170
5268
  setLayout(local, data, null, null, layout.affectRotation);
5171
- layout.scaleChanged = layout.rotationChanged = false;
5269
+ layout.scaleChanged = layout.rotationChanged = undefined;
5172
5270
  }
5173
5271
  }
5174
5272
  local.e = data.x + data.offsetX;
5175
5273
  local.f = data.y + data.offsetY;
5176
5274
  if (data.around || data.origin) {
5177
- toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
5178
- translateInner(local, -tempPoint$1.x, -tempPoint$1.y, !data.around);
5275
+ toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
5276
+ translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
5179
5277
  }
5180
5278
  }
5181
- this.__layout.matrixChanged = false;
5279
+ this.__layout.matrixChanged = undefined;
5182
5280
  }
5183
5281
  };
5184
5282
 
5185
5283
  const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
5186
5284
  const { updateBounds: updateBounds$1 } = BranchHelper;
5187
- const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
5285
+ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
5188
5286
  const { toBounds: toBounds$1 } = PathBounds;
5189
5287
  const LeafBounds = {
5190
5288
  __updateWorldBounds() {
5191
- toOuterOf$1(this.__layout.renderBounds, this.__world, this.__world);
5192
- if (this.__layout.resized) {
5193
- this.__onUpdateSize();
5194
- this.__layout.resized = false;
5289
+ const layout = this.__layout;
5290
+ toOuterOf$1(layout.renderBounds, this.__world, this.__world);
5291
+ if (layout.resized) {
5292
+ if (layout.resized === 'inner')
5293
+ this.__onUpdateSize();
5294
+ if (this.__hasLocalEvent)
5295
+ BoundsEvent.emitLocal(this);
5296
+ layout.resized = undefined;
5195
5297
  }
5298
+ if (this.__hasWorldEvent)
5299
+ BoundsEvent.emitWorld(this);
5196
5300
  },
5197
5301
  __updateLocalBounds() {
5198
5302
  const layout = this.__layout;
@@ -5201,12 +5305,12 @@ const LeafBounds = {
5201
5305
  this.__updatePath();
5202
5306
  this.__updateRenderPath();
5203
5307
  this.__updateBoxBounds();
5204
- layout.resized = true;
5308
+ layout.resized = 'inner';
5205
5309
  }
5206
5310
  if (layout.localBoxChanged) {
5207
5311
  if (this.__local)
5208
5312
  this.__updateLocalBoxBounds();
5209
- layout.localBoxChanged = false;
5313
+ layout.localBoxChanged = undefined;
5210
5314
  if (layout.strokeSpread)
5211
5315
  layout.strokeChanged = true;
5212
5316
  if (layout.renderSpread)
@@ -5214,7 +5318,7 @@ const LeafBounds = {
5214
5318
  if (this.parent)
5215
5319
  this.parent.__layout.boxChange();
5216
5320
  }
5217
- layout.boxChanged = false;
5321
+ layout.boxChanged = undefined;
5218
5322
  if (layout.strokeChanged) {
5219
5323
  layout.strokeSpread = this.__updateStrokeSpread();
5220
5324
  if (layout.strokeSpread) {
@@ -5226,12 +5330,12 @@ const LeafBounds = {
5226
5330
  else {
5227
5331
  layout.spreadStrokeCancel();
5228
5332
  }
5229
- layout.strokeChanged = false;
5333
+ layout.strokeChanged = undefined;
5230
5334
  if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
5231
5335
  layout.renderChanged = true;
5232
5336
  if (this.parent)
5233
5337
  this.parent.__layout.strokeChange();
5234
- layout.resized = true;
5338
+ layout.resized = 'inner';
5235
5339
  }
5236
5340
  if (layout.renderChanged) {
5237
5341
  layout.renderSpread = this.__updateRenderSpread();
@@ -5244,11 +5348,12 @@ const LeafBounds = {
5244
5348
  else {
5245
5349
  layout.spreadRenderCancel();
5246
5350
  }
5247
- layout.renderChanged = false;
5351
+ layout.renderChanged = undefined;
5248
5352
  if (this.parent)
5249
5353
  this.parent.__layout.renderChange();
5250
5354
  }
5251
- layout.boundsChanged = false;
5355
+ layout.resized || (layout.resized = 'local');
5356
+ layout.boundsChanged = undefined;
5252
5357
  },
5253
5358
  __updateLocalBoxBounds() {
5254
5359
  if (this.__hasMotionPath)
@@ -5308,7 +5413,7 @@ const LeafBounds = {
5308
5413
  },
5309
5414
  __updateRenderBounds() {
5310
5415
  const layout = this.__layout;
5311
- layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
5416
+ layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
5312
5417
  }
5313
5418
  };
5314
5419
 
@@ -5413,7 +5518,7 @@ const BranchRender = {
5413
5518
  const { LEAF, create } = IncrementId;
5414
5519
  const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
5415
5520
  const { toOuterOf } = BoundsHelper;
5416
- const { copy: copy$3, move } = PointHelper;
5521
+ const { copy: copy$4, move } = PointHelper;
5417
5522
  const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
5418
5523
  let Leaf = class Leaf {
5419
5524
  get tag() { return this.__tag; }
@@ -5626,7 +5731,7 @@ let Leaf = class Leaf {
5626
5731
  }
5627
5732
  else {
5628
5733
  if (to)
5629
- copy$3(to, world);
5734
+ copy$4(to, world);
5630
5735
  }
5631
5736
  }
5632
5737
  localToWorld(local, to, distance, relative) {
@@ -5635,7 +5740,7 @@ let Leaf = class Leaf {
5635
5740
  }
5636
5741
  else {
5637
5742
  if (to)
5638
- copy$3(to, local);
5743
+ copy$4(to, local);
5639
5744
  }
5640
5745
  }
5641
5746
  worldToInner(world, to, distance, relative) {
@@ -5788,7 +5893,7 @@ let Leaf = class Leaf {
5788
5893
  off(_type, _listener, _options) { }
5789
5894
  on_(_type, _listener, _bind, _options) { return undefined; }
5790
5895
  off_(_id) { }
5791
- once(_type, _listener, _capture) { }
5896
+ once(_type, _listener, _captureOrBind, _capture) { }
5792
5897
  emit(_type, _event, _capture) { }
5793
5898
  emitEvent(_event, _capture) { }
5794
5899
  hasEvent(_type, _capture) { return false; }
@@ -6125,7 +6230,7 @@ class LeafLevelList {
6125
6230
  }
6126
6231
  }
6127
6232
 
6128
- const version = "1.6.1";
6233
+ const version = "1.6.3";
6129
6234
 
6130
6235
  class LeaferCanvas extends LeaferCanvasBase {
6131
6236
  get allowBackgroundColor() { return true; }
@@ -6284,17 +6389,15 @@ class Watcher {
6284
6389
  this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
6285
6390
  this.__updatedList = new LeafList();
6286
6391
  this.totalTimes++;
6287
- this.changed = false;
6288
- this.hasVisible = false;
6289
- this.hasRemove = false;
6290
- this.hasAdd = false;
6392
+ this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
6291
6393
  }
6292
6394
  __listenEvents() {
6293
- const { target } = this;
6294
6395
  this.__eventIds = [
6295
- target.on_(PropertyEvent.CHANGE, this.__onAttrChange, this),
6296
- target.on_([ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this),
6297
- target.on_(WatchEvent.REQUEST, this.__onRquestData, this)
6396
+ this.target.on_([
6397
+ [PropertyEvent.CHANGE, this.__onAttrChange, this],
6398
+ [[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
6399
+ [WatchEvent.REQUEST, this.__onRquestData, this]
6400
+ ])
6298
6401
  ];
6299
6402
  }
6300
6403
  __removeListenEvents() {
@@ -6304,13 +6407,12 @@ class Watcher {
6304
6407
  if (this.target) {
6305
6408
  this.stop();
6306
6409
  this.__removeListenEvents();
6307
- this.target = null;
6308
- this.__updatedList = null;
6410
+ this.target = this.__updatedList = null;
6309
6411
  }
6310
6412
  }
6311
6413
  }
6312
6414
 
6313
- const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateAllWorldOpacity } = LeafHelper;
6415
+ const { updateAllMatrix: updateAllMatrix$1, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
6314
6416
  const { pushAllChildBranch, pushAllParent } = BranchHelper;
6315
6417
  function updateMatrix(updateList, levelList) {
6316
6418
  let layout;
@@ -6353,15 +6455,7 @@ function updateBounds(boundsList) {
6353
6455
  });
6354
6456
  }
6355
6457
  function updateChange(updateList) {
6356
- let layout;
6357
- updateList.list.forEach(leaf => {
6358
- layout = leaf.__layout;
6359
- if (layout.opacityChanged)
6360
- updateAllWorldOpacity(leaf);
6361
- if (layout.stateStyleChanged)
6362
- setTimeout(() => layout.stateStyleChanged && leaf.updateState());
6363
- leaf.__updateChange();
6364
- });
6458
+ updateList.list.forEach(updateOneChange);
6365
6459
  }
6366
6460
 
6367
6461
  const { worldBounds } = LeafBoundsHelper;
@@ -6418,7 +6512,7 @@ class Layouter {
6418
6512
  this.disabled = true;
6419
6513
  }
6420
6514
  layout() {
6421
- if (!this.running)
6515
+ if (this.layouting || !this.running)
6422
6516
  return;
6423
6517
  const { target } = this;
6424
6518
  this.times = 0;
@@ -6501,12 +6595,10 @@ class Layouter {
6501
6595
  }
6502
6596
  static fullLayout(target) {
6503
6597
  updateAllMatrix(target, true);
6504
- if (target.isBranch) {
6598
+ if (target.isBranch)
6505
6599
  BranchHelper.updateBounds(target);
6506
- }
6507
- else {
6600
+ else
6508
6601
  LeafHelper.updateBounds(target);
6509
- }
6510
6602
  updateAllChange(target);
6511
6603
  }
6512
6604
  addExtra(leaf) {
@@ -6529,11 +6621,12 @@ class Layouter {
6529
6621
  this.__updatedList = event.data.updatedList;
6530
6622
  }
6531
6623
  __listenEvents() {
6532
- const { target } = this;
6533
6624
  this.__eventIds = [
6534
- target.on_(LayoutEvent.REQUEST, this.layout, this),
6535
- target.on_(LayoutEvent.AGAIN, this.layoutAgain, this),
6536
- target.on_(WatchEvent.DATA, this.__onReceiveWatchData, this)
6625
+ this.target.on_([
6626
+ [LayoutEvent.REQUEST, this.layout, this],
6627
+ [LayoutEvent.AGAIN, this.layoutAgain, this],
6628
+ [WatchEvent.DATA, this.__onReceiveWatchData, this]
6629
+ ])
6537
6630
  ];
6538
6631
  }
6539
6632
  __removeListenEvents() {
@@ -6764,12 +6857,13 @@ class Renderer {
6764
6857
  this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
6765
6858
  }
6766
6859
  __listenEvents() {
6767
- const { target } = this;
6768
6860
  this.__eventIds = [
6769
- target.on_(RenderEvent.REQUEST, this.update, this),
6770
- target.on_(LayoutEvent.END, this.__onLayoutEnd, this),
6771
- target.on_(RenderEvent.AGAIN, this.renderAgain, this),
6772
- target.on_(ResizeEvent.RESIZE, this.__onResize, this)
6861
+ this.target.on_([
6862
+ [RenderEvent.REQUEST, this.update, this],
6863
+ [LayoutEvent.END, this.__onLayoutEnd, this],
6864
+ [RenderEvent.AGAIN, this.renderAgain, this],
6865
+ [ResizeEvent.RESIZE, this.__onResize, this]
6866
+ ])
6773
6867
  ];
6774
6868
  }
6775
6869
  __removeListenEvents() {
@@ -6828,8 +6922,32 @@ function zoomLayerType() {
6828
6922
  };
6829
6923
  }
6830
6924
 
6925
+ function hasTransparent$3(color) {
6926
+ if (!color || color.length === 7 || color.length === 4)
6927
+ return false;
6928
+ if (color === 'transparent')
6929
+ return true;
6930
+ const first = color[0];
6931
+ if (first === '#') {
6932
+ switch (color.length) {
6933
+ case 5: return color[4] !== 'f' && color[4] !== 'F';
6934
+ case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
6935
+ }
6936
+ }
6937
+ else if (first === 'r' || first === 'h') {
6938
+ if (color[3] === 'a') {
6939
+ const i = color.lastIndexOf(',');
6940
+ if (i > -1)
6941
+ return parseFloat(color.slice(i + 1)) < 1;
6942
+ }
6943
+ }
6944
+ return false;
6945
+ }
6946
+
6831
6947
  const TextConvert = {};
6832
- const ColorConvert = {};
6948
+ const ColorConvert = {
6949
+ hasTransparent: hasTransparent$3
6950
+ };
6833
6951
  const UnitConvert = {
6834
6952
  number(value, percentRefer) {
6835
6953
  return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
@@ -6855,6 +6973,7 @@ const Transition = {
6855
6973
  };
6856
6974
 
6857
6975
  const { parse, objectToCanvasData } = PathConvert;
6976
+ const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
6858
6977
  const emptyPaint = {};
6859
6978
  const debug$1 = Debug.get('UIData');
6860
6979
  class UIData extends LeafData {
@@ -6913,38 +7032,22 @@ class UIData extends LeafData {
6913
7032
  if (this.__naturalWidth)
6914
7033
  this.__removeNaturalSize();
6915
7034
  if (typeof value === 'string' || !value) {
6916
- if (this.__isFills) {
6917
- this.__removeInput('fill');
6918
- PaintImage.recycleImage('fill', this);
6919
- this.__isFills = false;
6920
- this.__pixelFill && (this.__pixelFill = false);
6921
- }
7035
+ stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
7036
+ this.__isFills && this.__removePaint('fill', true);
6922
7037
  this._fill = value;
6923
7038
  }
6924
7039
  else if (typeof value === 'object') {
6925
- this.__setInput('fill', value);
6926
- const layout = this.__leaf.__layout;
6927
- layout.boxChanged || layout.boxChange();
6928
- this.__isFills = true;
6929
- this._fill || (this._fill = emptyPaint);
7040
+ this.__setPaint('fill', value);
6930
7041
  }
6931
7042
  }
6932
7043
  setStroke(value) {
6933
7044
  if (typeof value === 'string' || !value) {
6934
- if (this.__isStrokes) {
6935
- this.__removeInput('stroke');
6936
- PaintImage.recycleImage('stroke', this);
6937
- this.__isStrokes = false;
6938
- this.__pixelStroke && (this.__pixelStroke = false);
6939
- }
7045
+ stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
7046
+ this.__isStrokes && this.__removePaint('stroke', true);
6940
7047
  this._stroke = value;
6941
7048
  }
6942
7049
  else if (typeof value === 'object') {
6943
- this.__setInput('stroke', value);
6944
- const layout = this.__leaf.__layout;
6945
- layout.boxChanged || layout.boxChange();
6946
- this.__isStrokes = true;
6947
- this._stroke || (this._stroke = emptyPaint);
7050
+ this.__setPaint('stroke', value);
6948
7051
  }
6949
7052
  }
6950
7053
  setPath(value) {
@@ -6974,7 +7077,34 @@ class UIData extends LeafData {
6974
7077
  Paint.compute('fill', this.__leaf);
6975
7078
  if (stroke)
6976
7079
  Paint.compute('stroke', this.__leaf);
6977
- this.__needComputePaint = false;
7080
+ this.__needComputePaint = undefined;
7081
+ }
7082
+ __setPaint(attrName, value) {
7083
+ this.__setInput(attrName, value);
7084
+ const layout = this.__leaf.__layout;
7085
+ layout.boxChanged || layout.boxChange();
7086
+ if (value instanceof Array && !value.length) {
7087
+ this.__removePaint(attrName);
7088
+ }
7089
+ else {
7090
+ if (attrName === 'fill')
7091
+ this.__isFills = true, this._fill || (this._fill = emptyPaint);
7092
+ else
7093
+ this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
7094
+ }
7095
+ }
7096
+ __removePaint(attrName, removeInput) {
7097
+ if (removeInput)
7098
+ this.__removeInput(attrName);
7099
+ PaintImage.recycleImage(attrName, this);
7100
+ if (attrName === 'fill') {
7101
+ stintSet$2(this, '__isAlphaPixelFill', undefined);
7102
+ this._fill = this.__isFills = undefined;
7103
+ }
7104
+ else {
7105
+ stintSet$2(this, '__isAlphaPixelStroke', undefined);
7106
+ this._stroke = this.__isStrokes = undefined;
7107
+ }
6978
7108
  }
6979
7109
  }
6980
7110
  function setArray(data, key, value) {
@@ -6982,10 +7112,10 @@ function setArray(data, key, value) {
6982
7112
  if (value instanceof Array) {
6983
7113
  if (value.some((item) => item.visible === false))
6984
7114
  value = value.filter((item) => item.visible !== false);
6985
- value.length || (value = null);
7115
+ value.length || (value = undefined);
6986
7116
  }
6987
7117
  else
6988
- value = value && value.visible !== false ? [value] : null;
7118
+ value = value && value.visible !== false ? [value] : undefined;
6989
7119
  data['_' + key] = value;
6990
7120
  }
6991
7121
 
@@ -7049,13 +7179,11 @@ class TextData extends UIData {
7049
7179
  setFontWeight(value) {
7050
7180
  if (typeof value === 'string') {
7051
7181
  this.__setInput('fontWeight', value);
7052
- this._fontWeight = fontWeightMap[value] || 400;
7053
- }
7054
- else {
7055
- if (this.__input)
7056
- this.__removeInput('fontWeight');
7057
- this._fontWeight = value;
7182
+ value = fontWeightMap[value] || 400;
7058
7183
  }
7184
+ else if (this.__input)
7185
+ this.__removeInput('fontWeight');
7186
+ this._fontWeight = value;
7059
7187
  }
7060
7188
  setBoxStyle(value) {
7061
7189
  let t = this.__leaf, box = t.__box;
@@ -7090,8 +7218,6 @@ class ImageData extends RectData {
7090
7218
  this._url = value;
7091
7219
  }
7092
7220
  __setImageFill(value) {
7093
- if (this.__leaf.image)
7094
- this.__leaf.image = null;
7095
7221
  this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
7096
7222
  }
7097
7223
  __getData() {
@@ -7157,21 +7283,19 @@ const UIBounds = {
7157
7283
  }
7158
7284
  };
7159
7285
 
7286
+ const { stintSet: stintSet$1 } = DataHelper;
7160
7287
  const UIRender = {
7161
7288
  __updateChange() {
7162
- const data = this.__, w = this.__world;
7289
+ const data = this.__;
7163
7290
  if (data.__useEffect) {
7164
- const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7165
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7291
+ const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7292
+ stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !(shadow[0].box && data.__isTransparentFill) && fill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
7293
+ data.__useEffect = !!(shadow || otherEffect);
7166
7294
  }
7167
- const half = data.__hasHalf;
7168
- w.half !== half && (w.half = half);
7295
+ stintSet$1(this.__world, 'half', data.__hasHalf);
7296
+ stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7169
7297
  data.__checkSingle();
7170
- const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
7171
- if (complex)
7172
- data.__complex = true;
7173
- else
7174
- data.__complex && (data.__complex = false);
7298
+ stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7175
7299
  },
7176
7300
  __drawFast(canvas, options) {
7177
7301
  drawFast(this, canvas, options);
@@ -7181,21 +7305,23 @@ const UIRender = {
7181
7305
  if (data.__complex) {
7182
7306
  if (data.__needComputePaint)
7183
7307
  data.__computePaint();
7184
- const { fill, stroke, __drawAfterFill } = data;
7308
+ const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
7185
7309
  this.__drawRenderPath(canvas);
7186
- if (data.__useEffect) {
7310
+ if (data.__useEffect && !__isFastShadow) {
7187
7311
  const shape = Paint.shape(this, canvas, options);
7188
7312
  this.__nowWorld = this.__getNowWorld(options);
7189
7313
  const { shadow, innerShadow, filter } = data;
7190
7314
  if (shadow)
7191
7315
  Effect.shadow(this, canvas, shape);
7316
+ if (__fillAfterStroke)
7317
+ data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7192
7318
  if (fill)
7193
7319
  data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
7194
7320
  if (__drawAfterFill)
7195
7321
  this.__drawAfterFill(canvas, options);
7196
7322
  if (innerShadow)
7197
7323
  Effect.innerShadow(this, canvas, shape);
7198
- if (stroke)
7324
+ if (stroke && !__fillAfterStroke)
7199
7325
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7200
7326
  if (filter)
7201
7327
  Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
@@ -7204,21 +7330,27 @@ const UIRender = {
7204
7330
  shape.canvas.recycle();
7205
7331
  }
7206
7332
  else {
7333
+ if (__fillAfterStroke)
7334
+ data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7335
+ if (__isFastShadow) {
7336
+ const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
7337
+ canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
7338
+ }
7207
7339
  if (fill)
7208
7340
  data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
7341
+ if (__isFastShadow)
7342
+ canvas.restore();
7209
7343
  if (__drawAfterFill)
7210
7344
  this.__drawAfterFill(canvas, options);
7211
- if (stroke)
7345
+ if (stroke && !__fillAfterStroke)
7212
7346
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7213
7347
  }
7214
7348
  }
7215
7349
  else {
7216
- if (data.__pathInputed) {
7350
+ if (data.__pathInputed)
7217
7351
  drawFast(this, canvas, options);
7218
- }
7219
- else {
7352
+ else
7220
7353
  this.__drawFast(canvas, options);
7221
- }
7222
7354
  }
7223
7355
  },
7224
7356
  __renderShape(canvas, options, ignoreFill, ignoreStroke) {
@@ -7227,11 +7359,11 @@ const UIRender = {
7227
7359
  const { fill, stroke } = this.__;
7228
7360
  this.__drawRenderPath(canvas);
7229
7361
  if (fill && !ignoreFill)
7230
- this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7362
+ this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7231
7363
  if (this.__.__isCanvas)
7232
7364
  this.__drawAfterFill(canvas, options);
7233
7365
  if (stroke && !ignoreStroke)
7234
- this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7366
+ this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7235
7367
  }
7236
7368
  },
7237
7369
  __drawAfterFill(canvas, options) {
@@ -7246,13 +7378,15 @@ const UIRender = {
7246
7378
  }
7247
7379
  };
7248
7380
  function drawFast(ui, canvas, options) {
7249
- const { fill, stroke, __drawAfterFill } = ui.__;
7381
+ const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
7250
7382
  ui.__drawRenderPath(canvas);
7383
+ if (__fillAfterStroke)
7384
+ Paint.stroke(stroke, ui, canvas);
7251
7385
  if (fill)
7252
7386
  Paint.fill(fill, ui, canvas);
7253
7387
  if (__drawAfterFill)
7254
7388
  ui.__drawAfterFill(canvas, options);
7255
- if (stroke)
7389
+ if (stroke && !__fillAfterStroke)
7256
7390
  Paint.stroke(stroke, ui, canvas);
7257
7391
  }
7258
7392
 
@@ -7382,6 +7516,9 @@ let UI = UI_1 = class UI extends Leaf {
7382
7516
  else
7383
7517
  drawer.rect(x, y, width, height);
7384
7518
  }
7519
+ drawImagePlaceholder(canvas, _image) {
7520
+ Paint.fill(this.__.placeholderColor, this, canvas);
7521
+ }
7385
7522
  animate(_keyframe, _options, _type, _isTemp) {
7386
7523
  return Plugin.need('animate');
7387
7524
  }
@@ -7618,6 +7755,12 @@ __decorate([
7618
7755
  __decorate([
7619
7756
  effectType()
7620
7757
  ], UI.prototype, "filter", void 0);
7758
+ __decorate([
7759
+ surfaceType()
7760
+ ], UI.prototype, "placeholderColor", void 0);
7761
+ __decorate([
7762
+ dataType(100)
7763
+ ], UI.prototype, "placeholderDelay", void 0);
7621
7764
  __decorate([
7622
7765
  dataType({})
7623
7766
  ], UI.prototype, "data", void 0);
@@ -8019,15 +8162,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8019
8162
  }
8020
8163
  __listenEvents() {
8021
8164
  const runId = Run.start('FirstCreate ' + this.innerName);
8022
- this.once(LeaferEvent.START, () => Run.end(runId));
8023
- this.once(LayoutEvent.START, () => this.updateLazyBounds());
8024
- this.once(RenderEvent.START, () => this.__onCreated());
8025
- this.once(RenderEvent.END, () => this.__onViewReady());
8026
- this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
8165
+ this.once([
8166
+ [LeaferEvent.START, () => Run.end(runId)],
8167
+ [LayoutEvent.START, this.updateLazyBounds, this],
8168
+ [RenderEvent.START, this.__onCreated, this],
8169
+ [RenderEvent.END, this.__onViewReady, this]
8170
+ ]);
8171
+ this.__eventIds.push(this.on_([
8172
+ [WatchEvent.DATA, this.__onWatchData, this],
8173
+ [LayoutEvent.END, this.__onLayoutEnd, this],
8174
+ [RenderEvent.NEXT, this.__onNextRender, this]
8175
+ ]));
8027
8176
  }
8028
8177
  __removeListenEvents() {
8029
8178
  this.off_(this.__eventIds);
8030
- this.__eventIds.length = 0;
8031
8179
  }
8032
8180
  destroy(sync) {
8033
8181
  const doDestory = () => {
@@ -8087,8 +8235,8 @@ Rect = __decorate([
8087
8235
  registerUI()
8088
8236
  ], Rect);
8089
8237
 
8090
- const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
8091
- const rect = Rect.prototype, group = Group.prototype;
8238
+ const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
8239
+ const rect$1 = Rect.prototype, group = Group.prototype;
8092
8240
  const childrenRenderBounds = {};
8093
8241
  let Box = class Box extends Group {
8094
8242
  get __tag() { return 'Box'; }
@@ -8133,15 +8281,15 @@ let Box = class Box extends Group {
8133
8281
  const { renderBounds } = this.__layout;
8134
8282
  if (this.children.length) {
8135
8283
  super.__updateRenderBounds();
8136
- copy$2(childrenRenderBounds, renderBounds);
8284
+ copy$3(childrenRenderBounds, renderBounds);
8137
8285
  this.__updateRectRenderBounds();
8138
- isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
8286
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8139
8287
  if (isOverflow && this.__.overflow !== 'hide')
8140
8288
  add(renderBounds, childrenRenderBounds);
8141
8289
  }
8142
8290
  else
8143
8291
  this.__updateRectRenderBounds();
8144
- this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8292
+ DataHelper.stintSet(this, 'isOverflow', isOverflow);
8145
8293
  }
8146
8294
  __updateRectRenderBounds() { }
8147
8295
  __updateRectChange() { }
@@ -8185,25 +8333,25 @@ __decorate([
8185
8333
  affectRenderBoundsType('show')
8186
8334
  ], Box.prototype, "overflow", void 0);
8187
8335
  __decorate([
8188
- rewrite(rect.__updateStrokeSpread)
8336
+ rewrite(rect$1.__updateStrokeSpread)
8189
8337
  ], Box.prototype, "__updateStrokeSpread", null);
8190
8338
  __decorate([
8191
- rewrite(rect.__updateRenderSpread)
8339
+ rewrite(rect$1.__updateRenderSpread)
8192
8340
  ], Box.prototype, "__updateRectRenderSpread", null);
8193
8341
  __decorate([
8194
- rewrite(rect.__updateBoxBounds)
8342
+ rewrite(rect$1.__updateBoxBounds)
8195
8343
  ], Box.prototype, "__updateRectBoxBounds", null);
8196
8344
  __decorate([
8197
- rewrite(rect.__updateStrokeBounds)
8345
+ rewrite(rect$1.__updateStrokeBounds)
8198
8346
  ], Box.prototype, "__updateStrokeBounds", null);
8199
8347
  __decorate([
8200
- rewrite(rect.__updateRenderBounds)
8348
+ rewrite(rect$1.__updateRenderBounds)
8201
8349
  ], Box.prototype, "__updateRectRenderBounds", null);
8202
8350
  __decorate([
8203
- rewrite(rect.__updateChange)
8351
+ rewrite(rect$1.__updateChange)
8204
8352
  ], Box.prototype, "__updateRectChange", null);
8205
8353
  __decorate([
8206
- rewrite(rect.__render)
8354
+ rewrite(rect$1.__render)
8207
8355
  ], Box.prototype, "__renderRect", null);
8208
8356
  __decorate([
8209
8357
  rewrite(group.__render)
@@ -8445,17 +8593,10 @@ Star = __decorate([
8445
8593
 
8446
8594
  let Image = class Image extends Rect {
8447
8595
  get __tag() { return 'Image'; }
8448
- get ready() { return this.image ? this.image.ready : false; }
8596
+ get ready() { const { image } = this; return image && image.ready; }
8597
+ get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
8449
8598
  constructor(data) {
8450
8599
  super(data);
8451
- this.on(ImageEvent.LOADED, (e) => {
8452
- if (e.attrName === 'fill' && e.attrValue.url === this.url)
8453
- this.image = e.image;
8454
- });
8455
- }
8456
- destroy() {
8457
- this.image = null;
8458
- super.destroy();
8459
8600
  }
8460
8601
  };
8461
8602
  __decorate([
@@ -8471,11 +8612,11 @@ const MyImage = Image;
8471
8612
 
8472
8613
  let Canvas = class Canvas extends Rect {
8473
8614
  get __tag() { return 'Canvas'; }
8615
+ get context() { return this.canvas.context; }
8474
8616
  get ready() { return !this.url; }
8475
8617
  constructor(data) {
8476
8618
  super(data);
8477
8619
  this.canvas = Creator.canvas(this.__);
8478
- this.context = this.canvas.context;
8479
8620
  if (data && data.url)
8480
8621
  this.drawImage(data.url);
8481
8622
  }
@@ -8519,7 +8660,7 @@ let Canvas = class Canvas extends Rect {
8519
8660
  destroy() {
8520
8661
  if (this.canvas) {
8521
8662
  this.canvas.destroy();
8522
- this.canvas = this.context = null;
8663
+ this.canvas = null;
8523
8664
  }
8524
8665
  super.destroy();
8525
8666
  }
@@ -8565,7 +8706,7 @@ let Text = class Text extends UI {
8565
8706
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
8566
8707
  data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
8567
8708
  data.__clipText = textOverflow !== 'show' && !data.__autoSize;
8568
- data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
8709
+ data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
8569
8710
  }
8570
8711
  __updateBoxBounds() {
8571
8712
  const data = this.__;
@@ -8595,12 +8736,11 @@ let Text = class Text extends UI {
8595
8736
  super.__updateBoxBounds();
8596
8737
  if (italic)
8597
8738
  b.width += fontSize * 0.16;
8598
- const isOverflow = !includes(b, contentBounds) || undefined;
8599
- if (isOverflow)
8739
+ DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
8740
+ if (this.isOverflow)
8600
8741
  setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
8601
8742
  else
8602
8743
  data.__textBoxBounds = b;
8603
- this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8604
8744
  }
8605
8745
  __onUpdateSize() {
8606
8746
  if (this.__box)
@@ -8663,6 +8803,9 @@ __decorate([
8663
8803
  __decorate([
8664
8804
  boundsType('')
8665
8805
  ], Text.prototype, "text", void 0);
8806
+ __decorate([
8807
+ boundsType('')
8808
+ ], Text.prototype, "placeholder", void 0);
8666
8809
  __decorate([
8667
8810
  boundsType('caption')
8668
8811
  ], Text.prototype, "fontFamily", void 0);
@@ -8782,8 +8925,10 @@ function penPathType() {
8782
8925
  }
8783
8926
 
8784
8927
  function fillText(ui, canvas) {
8785
- let row, data = ui.__.__textDrawData;
8786
- const { rows, decorationY } = data;
8928
+ const data = ui.__, { rows, decorationY } = data.__textDrawData;
8929
+ if (data.__isPlacehold && data.placeholderColor)
8930
+ canvas.fillStyle = data.placeholderColor;
8931
+ let row;
8787
8932
  for (let i = 0, len = rows.length; i < len; i++) {
8788
8933
  row = rows[i];
8789
8934
  if (row.text)
@@ -8792,7 +8937,7 @@ function fillText(ui, canvas) {
8792
8937
  row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
8793
8938
  }
8794
8939
  if (decorationY) {
8795
- const { decorationColor, decorationHeight } = data;
8940
+ const { decorationColor, decorationHeight } = data.__textDrawData;
8796
8941
  if (decorationColor)
8797
8942
  canvas.fillStyle = decorationColor;
8798
8943
  rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
@@ -8801,65 +8946,596 @@ function fillText(ui, canvas) {
8801
8946
 
8802
8947
  function fill(fill, ui, canvas) {
8803
8948
  canvas.fillStyle = fill;
8804
- ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
8949
+ fillPathOrText(ui, canvas);
8805
8950
  }
8806
8951
  function fills(fills, ui, canvas) {
8807
8952
  let item;
8808
- const { windingRule, __font } = ui.__;
8809
8953
  for (let i = 0, len = fills.length; i < len; i++) {
8810
8954
  item = fills[i];
8811
- if (item.image && PaintImage.checkImage(ui, canvas, item, !__font))
8812
- continue;
8813
- if (item.style) {
8814
- canvas.fillStyle = item.style;
8815
- if (item.transform) {
8816
- canvas.save();
8817
- canvas.transform(item.transform);
8818
- if (item.blendMode)
8819
- canvas.blendMode = item.blendMode;
8820
- __font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
8821
- canvas.restore();
8955
+ if (item.image) {
8956
+ if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
8957
+ continue;
8958
+ if (!item.style) {
8959
+ if (!i && item.image.isPlacehold)
8960
+ ui.drawImagePlaceholder(canvas, item.image);
8961
+ continue;
8822
8962
  }
8823
- else {
8824
- if (item.blendMode) {
8825
- canvas.saveBlendMode(item.blendMode);
8826
- __font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
8827
- canvas.restoreBlendMode();
8828
- }
8829
- else {
8830
- __font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
8831
- }
8963
+ }
8964
+ canvas.fillStyle = item.style;
8965
+ if (item.transform) {
8966
+ canvas.save();
8967
+ canvas.transform(item.transform);
8968
+ if (item.blendMode)
8969
+ canvas.blendMode = item.blendMode;
8970
+ fillPathOrText(ui, canvas);
8971
+ canvas.restore();
8972
+ }
8973
+ else {
8974
+ if (item.blendMode) {
8975
+ canvas.saveBlendMode(item.blendMode);
8976
+ fillPathOrText(ui, canvas);
8977
+ canvas.restoreBlendMode();
8832
8978
  }
8979
+ else
8980
+ fillPathOrText(ui, canvas);
8833
8981
  }
8834
8982
  }
8835
8983
  }
8984
+ function fillPathOrText(ui, canvas) {
8985
+ ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
8986
+ }
8987
+
8988
+ let App = class App extends Leafer {
8989
+ get __tag() { return 'App'; }
8990
+ get isApp() { return true; }
8991
+ constructor(userConfig, data) {
8992
+ super(userConfig, data);
8993
+ }
8994
+ init(userConfig, parentApp) {
8995
+ super.init(userConfig, parentApp);
8996
+ if (userConfig) {
8997
+ const { ground, tree, sky, editor } = userConfig;
8998
+ if (ground)
8999
+ this.ground = this.addLeafer(ground);
9000
+ if (tree || editor)
9001
+ this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
9002
+ if (sky || editor)
9003
+ this.sky = this.addLeafer(sky);
9004
+ if (editor)
9005
+ Creator.editor(editor, this);
9006
+ }
9007
+ }
9008
+ __setApp() {
9009
+ const { canvas } = this;
9010
+ const { realCanvas, view } = this.config;
9011
+ if (realCanvas || view === this.canvas.view || !canvas.parentView)
9012
+ this.realCanvas = true;
9013
+ else
9014
+ canvas.unrealCanvas();
9015
+ this.leafer = this;
9016
+ this.watcher.disable();
9017
+ this.layouter.disable();
9018
+ }
9019
+ __updateLocalBounds() {
9020
+ this.forEach(leafer => leafer.updateLayout());
9021
+ super.__updateLocalBounds();
9022
+ }
9023
+ start() {
9024
+ super.start();
9025
+ this.forEach(leafer => leafer.start());
9026
+ }
9027
+ stop() {
9028
+ this.forEach(leafer => leafer.stop());
9029
+ super.stop();
9030
+ }
9031
+ unlockLayout() {
9032
+ super.unlockLayout();
9033
+ this.forEach(leafer => leafer.unlockLayout());
9034
+ }
9035
+ lockLayout() {
9036
+ super.lockLayout();
9037
+ this.forEach(leafer => leafer.lockLayout());
9038
+ }
9039
+ forceRender(bounds, sync) {
9040
+ this.forEach(leafer => leafer.forceRender(bounds, sync));
9041
+ }
9042
+ addLeafer(merge) {
9043
+ const leafer = new Leafer(merge);
9044
+ this.add(leafer);
9045
+ return leafer;
9046
+ }
9047
+ add(leafer, index) {
9048
+ if (!leafer.view) {
9049
+ if (this.realCanvas && !this.canvas.bounds) {
9050
+ setTimeout(() => this.add(leafer, index), 10);
9051
+ return;
9052
+ }
9053
+ leafer.init(this.__getChildConfig(leafer.userConfig), this);
9054
+ }
9055
+ super.add(leafer, index);
9056
+ if (index !== undefined)
9057
+ leafer.canvas.childIndex = index;
9058
+ this.__listenChildEvents(leafer);
9059
+ }
9060
+ forEach(fn) {
9061
+ this.children.forEach(fn);
9062
+ }
9063
+ __onCreated() {
9064
+ this.created = this.children.every(child => child.created);
9065
+ }
9066
+ __onReady() {
9067
+ if (this.children.every(child => child.ready))
9068
+ super.__onReady();
9069
+ }
9070
+ __onViewReady() {
9071
+ if (this.children.every(child => child.viewReady))
9072
+ super.__onViewReady();
9073
+ }
9074
+ __onChildRenderEnd(e) {
9075
+ this.renderer.addBlock(e.renderBounds);
9076
+ if (this.viewReady)
9077
+ this.renderer.update();
9078
+ }
9079
+ __render(canvas, options) {
9080
+ if (canvas.context)
9081
+ this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
9082
+ }
9083
+ __onResize(event) {
9084
+ this.forEach(leafer => leafer.resize(event));
9085
+ super.__onResize(event);
9086
+ }
9087
+ updateLayout() {
9088
+ this.forEach(leafer => leafer.updateLayout());
9089
+ }
9090
+ __getChildConfig(userConfig) {
9091
+ const config = Object.assign({}, this.config);
9092
+ config.hittable = config.realCanvas = undefined;
9093
+ if (userConfig)
9094
+ DataHelper.assign(config, userConfig);
9095
+ if (this.autoLayout)
9096
+ DataHelper.copyAttrs(config, this, canvasSizeAttrs);
9097
+ config.view = this.realCanvas ? undefined : this.view;
9098
+ config.fill = undefined;
9099
+ return config;
9100
+ }
9101
+ __listenChildEvents(leafer) {
9102
+ leafer.once([
9103
+ [LayoutEvent.END, this.__onReady, this],
9104
+ [RenderEvent.START, this.__onCreated, this],
9105
+ [RenderEvent.END, this.__onViewReady, this]
9106
+ ]);
9107
+ if (this.realCanvas)
9108
+ this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
9109
+ }
9110
+ };
9111
+ App = __decorate([
9112
+ registerUI()
9113
+ ], App);
9114
+
9115
+ const downKeyMap = {};
9116
+ const Keyboard = {
9117
+ isHoldSpaceKey() {
9118
+ return Keyboard.isHold('Space');
9119
+ },
9120
+ isHold(code) {
9121
+ return downKeyMap[code];
9122
+ },
9123
+ setDownCode(code) {
9124
+ if (!downKeyMap[code])
9125
+ downKeyMap[code] = true;
9126
+ },
9127
+ setUpCode(code) {
9128
+ downKeyMap[code] = false;
9129
+ }
9130
+ };
9131
+
9132
+ const PointerButton = {
9133
+ LEFT: 1,
9134
+ RIGHT: 2,
9135
+ MIDDLE: 4,
9136
+ defaultLeft(event) { if (!event.buttons)
9137
+ event.buttons = 1; },
9138
+ left(event) { return event.buttons === 1; },
9139
+ right(event) { return event.buttons === 2; },
9140
+ middle(event) { return event.buttons === 4; }
9141
+ };
9142
+
9143
+ class UIEvent extends Event {
9144
+ get spaceKey() { return Keyboard.isHoldSpaceKey(); }
9145
+ get left() { return PointerButton.left(this); }
9146
+ get right() { return PointerButton.right(this); }
9147
+ get middle() { return PointerButton.middle(this); }
9148
+ constructor(params) {
9149
+ super(params.type);
9150
+ this.bubbles = true;
9151
+ Object.assign(this, params);
9152
+ }
9153
+ getBoxPoint(relative) {
9154
+ return (relative || this.current).getBoxPoint(this);
9155
+ }
9156
+ getInnerPoint(relative) {
9157
+ return (relative || this.current).getInnerPoint(this);
9158
+ }
9159
+ getLocalPoint(relative) {
9160
+ return (relative || this.current).getLocalPoint(this);
9161
+ }
9162
+ getPagePoint() {
9163
+ return this.current.getPagePoint(this);
9164
+ }
9165
+ getInner(relative) { return this.getInnerPoint(relative); }
9166
+ getLocal(relative) { return this.getLocalPoint(relative); }
9167
+ getPage() { return this.getPagePoint(); }
9168
+ static changeName(oldName, newName) {
9169
+ EventCreator.changeName(oldName, newName);
9170
+ }
9171
+ }
9172
+
9173
+ let PointerEvent = class PointerEvent extends UIEvent {
9174
+ };
9175
+ PointerEvent.POINTER = 'pointer';
9176
+ PointerEvent.BEFORE_DOWN = 'pointer.before_down';
9177
+ PointerEvent.BEFORE_MOVE = 'pointer.before_move';
9178
+ PointerEvent.BEFORE_UP = 'pointer.before_up';
9179
+ PointerEvent.DOWN = 'pointer.down';
9180
+ PointerEvent.MOVE = 'pointer.move';
9181
+ PointerEvent.UP = 'pointer.up';
9182
+ PointerEvent.OVER = 'pointer.over';
9183
+ PointerEvent.OUT = 'pointer.out';
9184
+ PointerEvent.ENTER = 'pointer.enter';
9185
+ PointerEvent.LEAVE = 'pointer.leave';
9186
+ PointerEvent.TAP = 'tap';
9187
+ PointerEvent.DOUBLE_TAP = 'double_tap';
9188
+ PointerEvent.CLICK = 'click';
9189
+ PointerEvent.DOUBLE_CLICK = 'double_click';
9190
+ PointerEvent.LONG_PRESS = 'long_press';
9191
+ PointerEvent.LONG_TAP = 'long_tap';
9192
+ PointerEvent.MENU = 'pointer.menu';
9193
+ PointerEvent.MENU_TAP = 'pointer.menu_tap';
9194
+ PointerEvent = __decorate([
9195
+ registerUIEvent()
9196
+ ], PointerEvent);
9197
+
9198
+ const tempMove = {};
9199
+ let DragEvent = class DragEvent extends PointerEvent {
9200
+ static setList(data) {
9201
+ this.list = data instanceof LeafList ? data : new LeafList(data);
9202
+ }
9203
+ static setData(data) {
9204
+ this.data = data;
9205
+ }
9206
+ static getValidMove(leaf, start, total) {
9207
+ const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
9208
+ PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9209
+ if (dragBounds)
9210
+ this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9211
+ if (draggable === 'x')
9212
+ move.y = 0;
9213
+ if (draggable === 'y')
9214
+ move.x = 0;
9215
+ return move;
9216
+ }
9217
+ static getMoveInDragBounds(childBox, dragBounds, move, change) {
9218
+ const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9219
+ const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9220
+ if (!change)
9221
+ move = Object.assign({}, move);
9222
+ if (BoundsHelper.includes(childBox, dragBounds)) {
9223
+ if (x > dragBounds.x)
9224
+ move.x += dragBounds.x - x;
9225
+ else if (right < boundsRight)
9226
+ move.x += boundsRight - right;
9227
+ if (y > dragBounds.y)
9228
+ move.y += dragBounds.y - y;
9229
+ else if (bottom < boundsBottom)
9230
+ move.y += boundsBottom - bottom;
9231
+ }
9232
+ else {
9233
+ if (x < dragBounds.x)
9234
+ move.x += dragBounds.x - x;
9235
+ else if (right > boundsRight)
9236
+ move.x += boundsRight - right;
9237
+ if (y < dragBounds.y)
9238
+ move.y += dragBounds.y - y;
9239
+ else if (bottom > boundsBottom)
9240
+ move.y += boundsBottom - bottom;
9241
+ }
9242
+ return move;
9243
+ }
9244
+ getPageMove(total) {
9245
+ this.assignMove(total);
9246
+ return this.current.getPagePoint(tempMove, null, true);
9247
+ }
9248
+ getInnerMove(relative, total) {
9249
+ if (!relative)
9250
+ relative = this.current;
9251
+ this.assignMove(total);
9252
+ return relative.getInnerPoint(tempMove, null, true);
9253
+ }
9254
+ getLocalMove(relative, total) {
9255
+ if (!relative)
9256
+ relative = this.current;
9257
+ this.assignMove(total);
9258
+ return relative.getLocalPoint(tempMove, null, true);
9259
+ }
9260
+ getPageTotal() {
9261
+ return this.getPageMove(true);
9262
+ }
9263
+ getInnerTotal(relative) {
9264
+ return this.getInnerMove(relative, true);
9265
+ }
9266
+ getLocalTotal(relative) {
9267
+ return this.getLocalMove(relative, true);
9268
+ }
9269
+ getPageBounds() {
9270
+ const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
9271
+ BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
9272
+ BoundsHelper.unsign(bounds);
9273
+ return bounds;
9274
+ }
9275
+ assignMove(total) {
9276
+ tempMove.x = total ? this.totalX : this.moveX;
9277
+ tempMove.y = total ? this.totalY : this.moveY;
9278
+ }
9279
+ };
9280
+ DragEvent.BEFORE_DRAG = 'drag.before_drag';
9281
+ DragEvent.START = 'drag.start';
9282
+ DragEvent.DRAG = 'drag';
9283
+ DragEvent.END = 'drag.end';
9284
+ DragEvent.OVER = 'drag.over';
9285
+ DragEvent.OUT = 'drag.out';
9286
+ DragEvent.ENTER = 'drag.enter';
9287
+ DragEvent.LEAVE = 'drag.leave';
9288
+ DragEvent = __decorate([
9289
+ registerUIEvent()
9290
+ ], DragEvent);
9291
+
9292
+ let DropEvent = class DropEvent extends PointerEvent {
9293
+ static setList(data) {
9294
+ DragEvent.setList(data);
9295
+ }
9296
+ static setData(data) {
9297
+ DragEvent.setData(data);
9298
+ }
9299
+ };
9300
+ DropEvent.DROP = 'drop';
9301
+ DropEvent = __decorate([
9302
+ registerUIEvent()
9303
+ ], DropEvent);
9304
+
9305
+ let MoveEvent = class MoveEvent extends DragEvent {
9306
+ };
9307
+ MoveEvent.BEFORE_MOVE = 'move.before_move';
9308
+ MoveEvent.START = 'move.start';
9309
+ MoveEvent.MOVE = 'move';
9310
+ MoveEvent.END = 'move.end';
9311
+ MoveEvent = __decorate([
9312
+ registerUIEvent()
9313
+ ], MoveEvent);
9314
+
9315
+ let RotateEvent = class RotateEvent extends PointerEvent {
9316
+ };
9317
+ RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
9318
+ RotateEvent.START = 'rotate.start';
9319
+ RotateEvent.ROTATE = 'rotate';
9320
+ RotateEvent.END = 'rotate.end';
9321
+ RotateEvent = __decorate([
9322
+ registerUIEvent()
9323
+ ], RotateEvent);
9324
+
9325
+ let SwipeEvent = class SwipeEvent extends DragEvent {
9326
+ };
9327
+ SwipeEvent.SWIPE = 'swipe';
9328
+ SwipeEvent.LEFT = 'swipe.left';
9329
+ SwipeEvent.RIGHT = 'swipe.right';
9330
+ SwipeEvent.UP = 'swipe.up';
9331
+ SwipeEvent.DOWN = 'swipe.down';
9332
+ SwipeEvent = __decorate([
9333
+ registerUIEvent()
9334
+ ], SwipeEvent);
9335
+
9336
+ let ZoomEvent = class ZoomEvent extends PointerEvent {
9337
+ };
9338
+ ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
9339
+ ZoomEvent.START = 'zoom.start';
9340
+ ZoomEvent.ZOOM = 'zoom';
9341
+ ZoomEvent.END = 'zoom.end';
9342
+ ZoomEvent = __decorate([
9343
+ registerUIEvent()
9344
+ ], ZoomEvent);
9345
+
9346
+ let KeyEvent = class KeyEvent extends UIEvent {
9347
+ };
9348
+ KeyEvent.DOWN = 'key.down';
9349
+ KeyEvent.HOLD = 'key.hold';
9350
+ KeyEvent.UP = 'key.up';
9351
+ KeyEvent = __decorate([
9352
+ registerUIEvent()
9353
+ ], KeyEvent);
9354
+
9355
+ new LeafList();
9356
+
9357
+ Debug.get('emit');
9358
+
9359
+ const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
9360
+ const inner = {};
9361
+ const leaf = Leaf.prototype;
9362
+ leaf.__hitWorld = function (point) {
9363
+ const data = this.__;
9364
+ if (!data.hitSelf)
9365
+ return false;
9366
+ const world = this.__world, layout = this.__layout;
9367
+ const isSmall = world.width < 10 && world.height < 10;
9368
+ if (data.hitRadius) {
9369
+ copy$2(inner, point), point = inner;
9370
+ setRadius(point, data.hitRadius);
9371
+ }
9372
+ toInnerRadiusPointOf(point, world, inner);
9373
+ if (data.hitBox || isSmall) {
9374
+ if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
9375
+ return true;
9376
+ if (isSmall)
9377
+ return false;
9378
+ }
9379
+ if (layout.hitCanvasChanged || !this.__hitCanvas) {
9380
+ this.__updateHitCanvas();
9381
+ if (!layout.boundsChanged)
9382
+ layout.hitCanvasChanged = false;
9383
+ }
9384
+ return this.__hit(inner);
9385
+ };
9386
+ leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
9387
+ leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
9388
+ 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); };
9389
+ leaf.__drawHitPath = function (canvas) { if (canvas)
9390
+ this.__drawRenderPath(canvas); };
9391
+
9392
+ const matrix = new Matrix();
9393
+ const ui$1 = UI.prototype;
9394
+ ui$1.__updateHitCanvas = function () {
9395
+ if (this.__box)
9396
+ this.__box.__updateHitCanvas();
9397
+ const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
9398
+ const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
9399
+ const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
9400
+ const isHitPixel = isHitPixelFill || isHitPixelStroke;
9401
+ if (!this.__hitCanvas)
9402
+ this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
9403
+ const h = this.__hitCanvas;
9404
+ if (isHitPixel) {
9405
+ const { renderBounds } = this.__layout;
9406
+ const size = Platform.image.hitCanvasSize;
9407
+ const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
9408
+ const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
9409
+ h.resize({ width, height, pixelRatio: 1 });
9410
+ h.clear();
9411
+ ImageManager.patternLocked = true;
9412
+ this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
9413
+ ImageManager.patternLocked = false;
9414
+ h.resetTransform();
9415
+ data.__isHitPixel = true;
9416
+ }
9417
+ else {
9418
+ data.__isHitPixel && (data.__isHitPixel = false);
9419
+ }
9420
+ this.__drawHitPath(h);
9421
+ h.setStrokeOptions(data);
9422
+ };
9423
+ ui$1.__hit = function (inner) {
9424
+ if (this.__box && this.__box.__hit(inner))
9425
+ return true;
9426
+ const data = this.__;
9427
+ if (data.__isHitPixel && this.__hitPixel(inner))
9428
+ return true;
9429
+ const { hitFill } = data;
9430
+ const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
9431
+ if (needHitFillPath && this.__hitFill(inner))
9432
+ return true;
9433
+ const { hitStroke, __strokeWidth } = data;
9434
+ const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
9435
+ if (!needHitFillPath && !needHitStrokePath)
9436
+ return false;
9437
+ const radiusWidth = inner.radiusX * 2;
9438
+ let hitWidth = radiusWidth;
9439
+ if (needHitStrokePath) {
9440
+ switch (data.strokeAlign) {
9441
+ case 'inside':
9442
+ hitWidth += __strokeWidth * 2;
9443
+ if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9444
+ return true;
9445
+ hitWidth = radiusWidth;
9446
+ break;
9447
+ case 'center':
9448
+ hitWidth += __strokeWidth;
9449
+ break;
9450
+ case 'outside':
9451
+ hitWidth += __strokeWidth * 2;
9452
+ if (!needHitFillPath) {
9453
+ if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
9454
+ return true;
9455
+ hitWidth = radiusWidth;
9456
+ }
9457
+ break;
9458
+ }
9459
+ }
9460
+ return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
9461
+ };
9462
+
9463
+ const ui = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
9464
+ rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
9465
+ if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
9466
+ ui.__updateHitCanvas.call(this);
9467
+ else if (this.__hitCanvas)
9468
+ this.__hitCanvas = null;
9469
+ };
9470
+ rect.__hitFill = box$1.__hitFill = function (inner) {
9471
+ return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
9472
+ };
9473
+
9474
+ Text.prototype.__drawHitPath = function (canvas) {
9475
+ const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
9476
+ canvas.beginPath();
9477
+ if (__letterSpacing < 0)
9478
+ this.__drawPathByBox(canvas);
9479
+ else
9480
+ data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
9481
+ };
9482
+
9483
+ function getSelector(ui) {
9484
+ return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
9485
+ }
9486
+ Group.prototype.pick = function (hitPoint, options) {
9487
+ options || (options = emptyData);
9488
+ this.updateLayout();
9489
+ return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
9490
+ };
9491
+
9492
+ const canvas = LeaferCanvasBase.prototype;
9493
+ canvas.hitFill = function (point, fillRule) {
9494
+ return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
9495
+ };
9496
+ canvas.hitStroke = function (point, strokeWidth) {
9497
+ this.strokeWidth = strokeWidth;
9498
+ return this.context.isPointInStroke(point.x, point.y);
9499
+ };
9500
+ canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
9501
+ let { x, y, radiusX, radiusY } = radiusPoint;
9502
+ if (offset)
9503
+ x -= offset.x, y -= offset.y;
9504
+ tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
9505
+ const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
9506
+ for (let i = 0, len = data.length; i < len; i += 4) {
9507
+ if (data[i + 3] > 0)
9508
+ return true;
9509
+ }
9510
+ return data[3] > 0;
9511
+ };
8836
9512
 
8837
9513
  function strokeText(stroke, ui, canvas) {
8838
- const { strokeAlign } = ui.__;
8839
- const isStrokes = typeof stroke !== 'string';
8840
- switch (strokeAlign) {
9514
+ switch (ui.__.strokeAlign) {
8841
9515
  case 'center':
8842
- canvas.setStroke(isStrokes ? undefined : stroke, ui.__.strokeWidth, ui.__);
8843
- isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
9516
+ drawCenter$1(stroke, 1, ui, canvas);
8844
9517
  break;
8845
9518
  case 'inside':
8846
- drawAlignStroke('inside', stroke, isStrokes, ui, canvas);
9519
+ drawAlign(stroke, 'inside', ui, canvas);
8847
9520
  break;
8848
9521
  case 'outside':
8849
- drawAlignStroke('outside', stroke, isStrokes, ui, canvas);
9522
+ ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
8850
9523
  break;
8851
9524
  }
8852
9525
  }
8853
- function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
8854
- const { __strokeWidth, __font } = ui.__;
9526
+ function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
9527
+ const data = ui.__;
9528
+ canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
9529
+ data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
9530
+ }
9531
+ function drawAlign(stroke, align, ui, canvas) {
8855
9532
  const out = canvas.getSameCanvas(true, true);
8856
- out.setStroke(isStrokes ? undefined : stroke, __strokeWidth * 2, ui.__);
8857
- out.font = __font;
8858
- isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
9533
+ out.font = ui.__.__font;
9534
+ drawCenter$1(stroke, 2, ui, out);
8859
9535
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
8860
9536
  fillText(ui, out);
8861
9537
  out.blendMode = 'normal';
8862
- if (ui.__worldFlipped)
9538
+ if (ui.__worldFlipped || Platform.fullImageShadow)
8863
9539
  canvas.copyWorldByReset(out, ui.__nowWorld);
8864
9540
  else
8865
9541
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
@@ -8901,90 +9577,60 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
8901
9577
  }
8902
9578
 
8903
9579
  function stroke(stroke, ui, canvas) {
8904
- const options = ui.__;
8905
- const { __strokeWidth, strokeAlign, __font } = options;
8906
- if (!__strokeWidth)
9580
+ const data = ui.__;
9581
+ if (!data.__strokeWidth)
8907
9582
  return;
8908
- if (__font) {
9583
+ if (data.__font) {
8909
9584
  strokeText(stroke, ui, canvas);
8910
9585
  }
8911
9586
  else {
8912
- switch (strokeAlign) {
9587
+ switch (data.strokeAlign) {
8913
9588
  case 'center':
8914
- canvas.setStroke(stroke, __strokeWidth, options);
8915
- canvas.stroke();
8916
- if (options.__useArrow)
8917
- strokeArrow(ui, canvas);
9589
+ drawCenter(stroke, 1, ui, canvas);
8918
9590
  break;
8919
9591
  case 'inside':
8920
- canvas.save();
8921
- canvas.setStroke(stroke, __strokeWidth * 2, options);
8922
- options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
8923
- canvas.stroke();
8924
- canvas.restore();
9592
+ drawInside(stroke, ui, canvas);
8925
9593
  break;
8926
9594
  case 'outside':
8927
- const out = canvas.getSameCanvas(true, true);
8928
- out.setStroke(stroke, __strokeWidth * 2, options);
8929
- ui.__drawRenderPath(out);
8930
- out.stroke();
8931
- options.windingRule ? out.clip(options.windingRule) : out.clip();
8932
- out.clearWorld(ui.__layout.renderBounds);
8933
- if (ui.__worldFlipped)
8934
- canvas.copyWorldByReset(out, ui.__nowWorld);
8935
- else
8936
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
8937
- out.recycle(ui.__nowWorld);
9595
+ drawOutside(stroke, ui, canvas);
8938
9596
  break;
8939
9597
  }
8940
9598
  }
8941
9599
  }
8942
9600
  function strokes(strokes, ui, canvas) {
8943
- const options = ui.__;
8944
- const { __strokeWidth, strokeAlign, __font } = options;
8945
- if (!__strokeWidth)
8946
- return;
8947
- if (__font) {
8948
- strokeText(strokes, ui, canvas);
9601
+ stroke(strokes, ui, canvas);
9602
+ }
9603
+ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
9604
+ const data = ui.__;
9605
+ canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
9606
+ data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
9607
+ if (data.__useArrow)
9608
+ Paint.strokeArrow(stroke, ui, canvas);
9609
+ }
9610
+ function drawInside(stroke, ui, canvas) {
9611
+ const data = ui.__;
9612
+ canvas.save();
9613
+ data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
9614
+ drawCenter(stroke, 2, ui, canvas);
9615
+ canvas.restore();
9616
+ }
9617
+ function drawOutside(stroke, ui, canvas) {
9618
+ const data = ui.__;
9619
+ if (data.__fillAfterStroke) {
9620
+ drawCenter(stroke, 2, ui, canvas);
8949
9621
  }
8950
9622
  else {
8951
- switch (strokeAlign) {
8952
- case 'center':
8953
- canvas.setStroke(undefined, __strokeWidth, options);
8954
- drawStrokesStyle(strokes, false, ui, canvas);
8955
- if (options.__useArrow)
8956
- strokeArrow(ui, canvas);
8957
- break;
8958
- case 'inside':
8959
- canvas.save();
8960
- canvas.setStroke(undefined, __strokeWidth * 2, options);
8961
- options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
8962
- drawStrokesStyle(strokes, false, ui, canvas);
8963
- canvas.restore();
8964
- break;
8965
- case 'outside':
8966
- const { renderBounds } = ui.__layout;
8967
- const out = canvas.getSameCanvas(true, true);
8968
- ui.__drawRenderPath(out);
8969
- out.setStroke(undefined, __strokeWidth * 2, options);
8970
- drawStrokesStyle(strokes, false, ui, out);
8971
- options.windingRule ? out.clip(options.windingRule) : out.clip();
8972
- out.clearWorld(renderBounds);
8973
- if (ui.__worldFlipped)
8974
- canvas.copyWorldByReset(out, ui.__nowWorld);
8975
- else
8976
- canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
8977
- out.recycle(ui.__nowWorld);
8978
- break;
8979
- }
8980
- }
8981
- }
8982
- function strokeArrow(ui, canvas) {
8983
- if (ui.__.dashPattern) {
8984
- canvas.beginPath();
8985
- ui.__drawPathByData(canvas, ui.__.__pathForArrow);
8986
- canvas.dashPattern = null;
8987
- canvas.stroke();
9623
+ const { renderBounds } = ui.__layout;
9624
+ const out = canvas.getSameCanvas(true, true);
9625
+ ui.__drawRenderPath(out);
9626
+ drawCenter(stroke, 2, ui, out);
9627
+ data.windingRule ? out.clip(data.windingRule) : out.clip();
9628
+ out.clearWorld(renderBounds);
9629
+ if (ui.__worldFlipped || Platform.fullImageShadow)
9630
+ canvas.copyWorldByReset(out, ui.__nowWorld);
9631
+ else
9632
+ canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
9633
+ out.recycle(ui.__nowWorld);
8988
9634
  }
8989
9635
  }
8990
9636
 
@@ -9031,9 +9677,10 @@ function shape(ui, current, options) {
9031
9677
  }
9032
9678
 
9033
9679
  let recycleMap;
9680
+ const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
9034
9681
  function compute(attrName, ui) {
9035
9682
  const data = ui.__, leafPaints = [];
9036
- let paints = data.__input[attrName], hasOpacityPixel;
9683
+ let paints = data.__input[attrName], isAlphaPixel, isTransparent;
9037
9684
  if (!(paints instanceof Array))
9038
9685
  paints = [paints];
9039
9686
  recycleMap = PaintImage.recycleImage(attrName, data);
@@ -9043,35 +9690,62 @@ function compute(attrName, ui) {
9043
9690
  leafPaints.push(item);
9044
9691
  }
9045
9692
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
9046
- if (leafPaints.length && leafPaints[0].image)
9047
- hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
9048
- attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
9693
+ if (leafPaints.length) {
9694
+ if (leafPaints.every(item => item.isTransparent)) {
9695
+ if (leafPaints.some(item => item.image))
9696
+ isAlphaPixel = true;
9697
+ isTransparent = true;
9698
+ }
9699
+ }
9700
+ if (attrName === 'fill') {
9701
+ stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
9702
+ stintSet(data, '__isTransparentFill', isTransparent);
9703
+ }
9704
+ else {
9705
+ stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
9706
+ stintSet(data, '__isTransparentStroke', isTransparent);
9707
+ }
9049
9708
  }
9050
9709
  function getLeafPaint(attrName, paint, ui) {
9051
9710
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
9052
9711
  return undefined;
9712
+ let data;
9053
9713
  const { boxBounds } = ui.__layout;
9054
9714
  switch (paint.type) {
9055
- case 'solid':
9056
- let { type, blendMode, color, opacity } = paint;
9057
- return { type, blendMode, style: ColorConvert.string(color, opacity) };
9058
9715
  case 'image':
9059
- return PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
9716
+ data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
9717
+ break;
9060
9718
  case 'linear':
9061
- return PaintGradient.linearGradient(paint, boxBounds);
9719
+ data = PaintGradient.linearGradient(paint, boxBounds);
9720
+ break;
9062
9721
  case 'radial':
9063
- return PaintGradient.radialGradient(paint, boxBounds);
9722
+ data = PaintGradient.radialGradient(paint, boxBounds);
9723
+ break;
9064
9724
  case 'angular':
9065
- return PaintGradient.conicGradient(paint, boxBounds);
9725
+ data = PaintGradient.conicGradient(paint, boxBounds);
9726
+ break;
9727
+ case 'solid':
9728
+ const { type, blendMode, color, opacity } = paint;
9729
+ data = { type, blendMode, style: ColorConvert.string(color, opacity) };
9730
+ break;
9066
9731
  default:
9067
- return paint.r !== undefined ? { type: 'solid', style: ColorConvert.string(paint) } : undefined;
9732
+ if (paint.r !== undefined)
9733
+ data = { type: 'solid', style: ColorConvert.string(paint) };
9734
+ }
9735
+ if (data) {
9736
+ if (typeof data.style === 'string' && hasTransparent$1(data.style))
9737
+ data.isTransparent = true;
9738
+ if (paint.blendMode)
9739
+ data.blendMode = paint.blendMode;
9068
9740
  }
9741
+ return data;
9069
9742
  }
9070
9743
 
9071
9744
  const PaintModule = {
9072
9745
  compute,
9073
9746
  fill,
9074
9747
  fills,
9748
+ fillPathOrText,
9075
9749
  fillText,
9076
9750
  stroke,
9077
9751
  strokes,
@@ -9130,12 +9804,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
9130
9804
 
9131
9805
  const { get: get$2, translate } = MatrixHelper;
9132
9806
  const tempBox = new Bounds();
9133
- const tempPoint = {};
9134
9807
  const tempScaleData = {};
9808
+ const tempImage = {};
9135
9809
  function createData(leafPaint, image, paint, box) {
9136
- const { blendMode, changeful, sync } = paint;
9137
- if (blendMode)
9138
- leafPaint.blendMode = blendMode;
9810
+ const { changeful, sync } = paint;
9139
9811
  if (changeful)
9140
9812
  leafPaint.changeful = changeful;
9141
9813
  if (sync)
@@ -9143,38 +9815,38 @@ function createData(leafPaint, image, paint, box) {
9143
9815
  leafPaint.data = getPatternData(paint, box, image);
9144
9816
  }
9145
9817
  function getPatternData(paint, box, image) {
9146
- let { width, height } = image;
9147
9818
  if (paint.padding)
9148
9819
  box = tempBox.set(box).shrink(paint.padding);
9149
9820
  if (paint.mode === 'strench')
9150
9821
  paint.mode = 'stretch';
9822
+ let { width, height } = image;
9151
9823
  const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
9152
9824
  const sameBox = box.width === width && box.height === height;
9153
9825
  const data = { mode };
9154
9826
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
9155
- const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
9156
- let x = 0, y = 0, scaleX, scaleY;
9827
+ BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
9828
+ let scaleX, scaleY;
9157
9829
  if (!mode || mode === 'cover' || mode === 'fit') {
9158
9830
  if (!sameBox || rotation) {
9159
- const sw = box.width / swapWidth, sh = box.height / swapHeight;
9160
- scaleX = scaleY = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
9161
- x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
9831
+ scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
9832
+ BoundsHelper.put(box, image, align, scaleX, false, tempImage);
9833
+ BoundsHelper.scale(tempImage, scaleX, scaleY, true);
9162
9834
  }
9163
9835
  }
9164
- else if (scale || size) {
9165
- MathHelper.getScaleData(scale, size, image, tempScaleData);
9166
- scaleX = tempScaleData.scaleX;
9167
- scaleY = tempScaleData.scaleY;
9168
- }
9169
- if (align) {
9170
- const imageBounds = { x, y, width: swapWidth, height: swapHeight };
9171
- if (scaleX)
9172
- imageBounds.width *= scaleX, imageBounds.height *= scaleY;
9173
- AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
9174
- x += tempPoint.x, y += tempPoint.y;
9836
+ else {
9837
+ if (scale || size) {
9838
+ MathHelper.getScaleData(scale, size, image, tempScaleData);
9839
+ scaleX = tempScaleData.scaleX;
9840
+ scaleY = tempScaleData.scaleY;
9841
+ }
9842
+ if (align) {
9843
+ if (scaleX)
9844
+ BoundsHelper.scale(tempImage, scaleX, scaleY, true);
9845
+ AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
9846
+ }
9175
9847
  }
9176
9848
  if (offset)
9177
- x += offset.x, y += offset.y;
9849
+ PointHelper.move(tempImage, offset);
9178
9850
  switch (mode) {
9179
9851
  case 'stretch':
9180
9852
  if (!sameBox)
@@ -9182,12 +9854,12 @@ function getPatternData(paint, box, image) {
9182
9854
  break;
9183
9855
  case 'normal':
9184
9856
  case 'clip':
9185
- if (x || y || scaleX || rotation)
9186
- clipMode(data, box, x, y, scaleX, scaleY, rotation);
9857
+ if (tempImage.x || tempImage.y || scaleX || rotation)
9858
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
9187
9859
  break;
9188
9860
  case 'repeat':
9189
9861
  if (!sameBox || scaleX || rotation)
9190
- repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
9862
+ repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
9191
9863
  if (!repeat)
9192
9864
  data.repeat = 'repeat';
9193
9865
  break;
@@ -9195,7 +9867,7 @@ function getPatternData(paint, box, image) {
9195
9867
  case 'cover':
9196
9868
  default:
9197
9869
  if (scaleX)
9198
- fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
9870
+ fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
9199
9871
  }
9200
9872
  if (!data.transform) {
9201
9873
  if (box.x || box.y) {
@@ -9228,6 +9900,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
9228
9900
  }
9229
9901
  else {
9230
9902
  leafPaint = { type: paint.type, image };
9903
+ if (image.hasAlphaPixel)
9904
+ leafPaint.isTransparent = true;
9231
9905
  cache = image.use > 1 ? { leafPaint, paint, boxBounds: box.set(boxBounds) } : null;
9232
9906
  }
9233
9907
  if (firstUse || image.loading)
@@ -9252,7 +9926,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
9252
9926
  ignoreRender(ui, false);
9253
9927
  if (!ui.destroyed) {
9254
9928
  if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
9255
- if (image.hasOpacityPixel)
9929
+ if (image.hasAlphaPixel)
9256
9930
  ui.__layout.hitCanvasChanged = true;
9257
9931
  ui.forceUpdate('surface');
9258
9932
  }
@@ -9264,6 +9938,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
9264
9938
  onLoadError(ui, event, error);
9265
9939
  leafPaint.loadId = null;
9266
9940
  });
9941
+ if (ui.placeholderColor) {
9942
+ if (!ui.placeholderDelay)
9943
+ image.isPlacehold = true;
9944
+ else
9945
+ setTimeout(() => {
9946
+ if (!image.ready) {
9947
+ image.isPlacehold = true;
9948
+ ui.forceUpdate('surface');
9949
+ }
9950
+ }, ui.placeholderDelay);
9951
+ }
9267
9952
  }
9268
9953
  return leafPaint;
9269
9954
  }
@@ -9469,32 +10154,33 @@ const PaintImageModule = {
9469
10154
  repeatMode
9470
10155
  };
9471
10156
 
9472
- const { toPoint: toPoint$2 } = AroundHelper;
10157
+ const { toPoint: toPoint$2 } = AroundHelper, { hasTransparent } = ColorConvert;
9473
10158
  const realFrom$2 = {};
9474
10159
  const realTo$2 = {};
9475
10160
  function linearGradient(paint, box) {
9476
- let { from, to, type, blendMode, opacity } = paint;
10161
+ let { from, to, type, opacity } = paint;
9477
10162
  toPoint$2(from || 'top', box, realFrom$2);
9478
10163
  toPoint$2(to || 'bottom', box, realTo$2);
9479
10164
  const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
9480
- applyStops(style, paint.stops, opacity);
9481
10165
  const data = { type, style };
9482
- if (blendMode)
9483
- data.blendMode = blendMode;
10166
+ applyStops(data, style, paint.stops, opacity);
9484
10167
  return data;
9485
10168
  }
9486
- function applyStops(gradient, stops, opacity) {
10169
+ function applyStops(data, gradient, stops, opacity) {
9487
10170
  if (stops) {
9488
- let stop;
10171
+ let stop, color, offset, isTransparent;
9489
10172
  for (let i = 0, len = stops.length; i < len; i++) {
9490
10173
  stop = stops[i];
9491
- if (typeof stop === 'string') {
9492
- gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
9493
- }
9494
- else {
9495
- gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
9496
- }
10174
+ if (typeof stop === 'string')
10175
+ offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
10176
+ else
10177
+ offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
10178
+ gradient.addColorStop(offset, color);
10179
+ if (!isTransparent && hasTransparent(color))
10180
+ isTransparent = true;
9497
10181
  }
10182
+ if (isTransparent)
10183
+ data.isTransparent = true;
9498
10184
  }
9499
10185
  }
9500
10186
 
@@ -9504,17 +10190,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
9504
10190
  const realFrom$1 = {};
9505
10191
  const realTo$1 = {};
9506
10192
  function radialGradient(paint, box) {
9507
- let { from, to, type, opacity, blendMode, stretch } = paint;
10193
+ let { from, to, type, opacity, stretch } = paint;
9508
10194
  toPoint$1(from || 'center', box, realFrom$1);
9509
10195
  toPoint$1(to || 'bottom', box, realTo$1);
9510
10196
  const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
9511
- applyStops(style, paint.stops, opacity);
9512
10197
  const data = { type, style };
10198
+ applyStops(data, style, paint.stops, opacity);
9513
10199
  const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
9514
10200
  if (transform)
9515
10201
  data.transform = transform;
9516
- if (blendMode)
9517
- data.blendMode = blendMode;
9518
10202
  return data;
9519
10203
  }
9520
10204
  function getTransform(box, from, to, stretch, rotate90) {
@@ -9540,17 +10224,15 @@ const { toPoint } = AroundHelper;
9540
10224
  const realFrom = {};
9541
10225
  const realTo = {};
9542
10226
  function conicGradient(paint, box) {
9543
- let { from, to, type, opacity, blendMode, stretch } = paint;
10227
+ let { from, to, type, opacity, stretch } = paint;
9544
10228
  toPoint(from || 'center', box, realFrom);
9545
10229
  toPoint(to || 'bottom', box, realTo);
9546
10230
  const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
9547
- applyStops(style, paint.stops, opacity);
9548
10231
  const data = { type, style };
10232
+ applyStops(data, style, paint.stops, opacity);
9549
10233
  const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
9550
10234
  if (transform)
9551
10235
  data.transform = transform;
9552
- if (blendMode)
9553
- data.blendMode = blendMode;
9554
10236
  return data;
9555
10237
  }
9556
10238
 
@@ -9883,6 +10565,8 @@ function createRows(drawData, content, style) {
9883
10565
  lastCharType = null;
9884
10566
  startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
9885
10567
  word = { data: [] }, row = { words: [] };
10568
+ if (__letterSpacing)
10569
+ content = [...content];
9886
10570
  for (let i = 0, len = content.length; i < len; i++) {
9887
10571
  char = content[i];
9888
10572
  if (char === '\n') {
@@ -10296,5 +10980,4 @@ Object.assign(Effect, EffectModule);
10296
10980
 
10297
10981
  useCanvas();
10298
10982
 
10299
- export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
10300
- //# sourceMappingURL=worker.module.js.map
10983
+ export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$2 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };