@leafer/miniapp 1.6.2 → 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$6, cos: cos$6, acos, sqrt: sqrt$5 } = Math;
152
150
  const { float: float$2 } = MathHelper;
153
- const tempPoint$5 = {};
151
+ const tempPoint$4 = {};
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$a.toInnerPoint(t, origin, tempPoint$5);
197
- M$a.scaleOfInner(t, tempPoint$5, scaleX, scaleY);
194
+ M$a.toInnerPoint(t, origin, tempPoint$4);
195
+ M$a.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
198
196
  },
199
197
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
200
198
  M$a.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$a.toInnerPoint(t, origin, tempPoint$5);
216
- M$a.rotateOfInner(t, tempPoint$5, rotation);
213
+ M$a.toInnerPoint(t, origin, tempPoint$4);
214
+ M$a.rotateOfInner(t, tempPoint$4, rotation);
217
215
  },
218
216
  rotateOfInner(t, origin, rotation) {
219
217
  M$a.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$a.toInnerPoint(t, origin, tempPoint$5);
238
- M$a.skewOfInner(t, tempPoint$5, skewX, skewY);
235
+ M$a.toInnerPoint(t, origin, tempPoint$4);
236
+ M$a.skewOfInner(t, tempPoint$4, skewX, skewY);
239
237
  },
240
238
  skewOfInner(t, origin, skewX, skewY = 0) {
241
239
  M$a.translateInner(t, origin.x, origin.y);
@@ -464,8 +462,10 @@ const PointHelper = {
464
462
  t.y = halfPixel ? round$5(t.y - 0.5) + 0.5 : round$5(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)
@@ -643,7 +643,7 @@ class Point {
643
643
  return this;
644
644
  }
645
645
  }
646
- const tempPoint$4 = new Point();
646
+ const tempPoint$3 = 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$4 } = 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$6 } = AroundHelper;
869
+ const AlignHelper = {
870
+ toPoint(align, content, box, to, onlyBoxSize, onlyContentSize) {
871
+ toPoint$6(align, box, to, onlyBoxSize, content, onlyContentSize);
872
+ }
873
+ };
874
+
804
875
  const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$4 } = TwoPointBoundsHelper;
805
876
  const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
806
877
  const { float: float$1, fourNumber: fourNumber$1 } = MathHelper;
807
878
  const { floor: floor$1, ceil: ceil$3 } = Math;
808
879
  let right$4, bottom$3, boundsRight, boundsBottom;
809
880
  const point$2 = {};
810
- const toPoint$6 = {};
881
+ const toPoint$5 = {};
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;
@@ -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$2.x = t.x;
918
990
  point$2.y = t.y;
919
- toOuterPoint$2(matrix, point$2, toPoint$6);
920
- setPoint$5(tempPointBounds$1, toPoint$6.x, toPoint$6.y);
991
+ toOuterPoint$2(matrix, point$2, toPoint$5);
992
+ setPoint$5(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
921
993
  point$2.x = t.x + t.width;
922
- toOuterPoint$2(matrix, point$2, toPoint$6);
923
- addPoint$3(tempPointBounds$1, toPoint$6.x, toPoint$6.y);
994
+ toOuterPoint$2(matrix, point$2, toPoint$5);
995
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
924
996
  point$2.y = t.y + t.height;
925
- toOuterPoint$2(matrix, point$2, toPoint$6);
926
- addPoint$3(tempPointBounds$1, toPoint$6.x, toPoint$6.y);
997
+ toOuterPoint$2(matrix, point$2, toPoint$5);
998
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
927
999
  point$2.x = t.x;
928
- toOuterPoint$2(matrix, point$2, toPoint$6);
929
- addPoint$3(tempPointBounds$1, toPoint$6.x, toPoint$6.y);
1000
+ toOuterPoint$2(matrix, point$2, toPoint$5);
1001
+ addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
930
1002
  toBounds$4(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);
@@ -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$5 } = AroundHelper;
1309
- const AlignHelper = {
1310
- toPoint(align, contentBounds, bounds, to, onlySize) {
1311
- toPoint$5(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$h = 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: assign$1 } = DataHelper;
@@ -2385,7 +2409,7 @@ const { sin: sin$4, cos: cos$4, atan2: atan2$1, ceil: ceil$2, abs: abs$6, PI: PI
2385
2409
  const { setPoint: setPoint$4, addPoint: addPoint$2 } = TwoPointBoundsHelper;
2386
2410
  const { set, toNumberPoints: toNumberPoints$1 } = PointHelper;
2387
2411
  const { M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8 } = PathCommandMap;
2388
- const tempPoint$3 = {};
2412
+ const tempPoint$2 = {};
2389
2413
  const BezierHelper = {
2390
2414
  points(data, originPoints, curve, close) {
2391
2415
  let points = toNumberPoints$1(originPoints);
@@ -2407,6 +2431,8 @@ const BezierHelper = {
2407
2431
  cY = points[i + 3];
2408
2432
  ba = sqrt$3(pow$1(bX - aX, 2) + pow$1(bY - aY, 2));
2409
2433
  cb = sqrt$3(pow$1(cX - bX, 2) + pow$1(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$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
2577
2603
  addPoint$2(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$3);
2580
- addPoint$2(pointBounds, tempPoint$3.x, tempPoint$3.y);
2605
+ getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
2606
+ addPoint$2(pointBounds, tempPoint$2.x, tempPoint$2.y);
2581
2607
  }
2582
2608
  },
2583
2609
  getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
@@ -3386,7 +3412,7 @@ function canvasPatch(drawer) {
3386
3412
  }
3387
3413
 
3388
3414
  const FileHelper = {
3389
- opacityTypes: ['png', 'webp', 'svg'],
3415
+ alphaPixelTypes: ['png', 'webp', 'svg'],
3390
3416
  upperCaseTypeMap: {},
3391
3417
  mineType(type) {
3392
3418
  if (!type || type.startsWith('image'))
@@ -3413,7 +3439,7 @@ const FileHelper = {
3413
3439
  }
3414
3440
  };
3415
3441
  const F$2 = FileHelper;
3416
- F$2.opacityTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
3442
+ F$2.alphaPixelTypes.forEach(type => F$2.upperCaseTypeMap[type] = type.toUpperCase());
3417
3443
 
3418
3444
  const debug$c = Debug.get('TaskProcessor');
3419
3445
  class TaskItem {
@@ -3730,8 +3756,8 @@ const ImageManager = {
3730
3756
  list.length = 0;
3731
3757
  }
3732
3758
  },
3733
- hasOpacityPixel(config) {
3734
- return FileHelper.opacityTypes.some(item => I$1.isFormat(item, config));
3759
+ hasAlphaPixel(config) {
3760
+ return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
3735
3761
  },
3736
3762
  isFormat(format, config) {
3737
3763
  if (config.format === format)
@@ -3769,7 +3795,7 @@ class LeaferImage {
3769
3795
  this.setView(view.config ? view.view : view);
3770
3796
  }
3771
3797
  ImageManager.isFormat('svg', config) && (this.isSVG = true);
3772
- ImageManager.hasOpacityPixel(config) && (this.hasOpacityPixel = true);
3798
+ ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
3773
3799
  }
3774
3800
  load(onSuccess, onError) {
3775
3801
  if (!this.loading) {
@@ -4457,7 +4483,7 @@ const LeafBoundsHelper = {
4457
4483
  }
4458
4484
  };
4459
4485
 
4460
- const { updateBounds: updateBounds$3 } = LeafHelper;
4486
+ const { updateBounds: updateBounds$4 } = LeafHelper;
4461
4487
  const BranchHelper = {
4462
4488
  sort(a, b) {
4463
4489
  return (a.__.zIndex === b.__.zIndex) ? (a.__tempNumber - b.__tempNumber) : (a.__.zIndex - b.__.zIndex);
@@ -4519,11 +4545,11 @@ const BranchHelper = {
4519
4545
  branch = branchStack[i];
4520
4546
  children = branch.children;
4521
4547
  for (let j = 0, len = children.length; j < len; j++) {
4522
- updateBounds$3(children[j]);
4548
+ updateBounds$4(children[j]);
4523
4549
  }
4524
4550
  if (exclude && exclude === branch)
4525
4551
  continue;
4526
- updateBounds$3(branch);
4552
+ updateBounds$4(branch);
4527
4553
  }
4528
4554
  }
4529
4555
  };
@@ -4541,7 +4567,7 @@ const WaitHelper = {
4541
4567
  }
4542
4568
  };
4543
4569
 
4544
- const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
4570
+ const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3 } = LeafHelper;
4545
4571
  const { toOuterOf: toOuterOf$2, getPoints, copy: copy$9 } = BoundsHelper;
4546
4572
  const localContent = '_localContentBounds';
4547
4573
  const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
@@ -4585,7 +4611,9 @@ class LeafLayout {
4585
4611
  this._localRenderBounds = local;
4586
4612
  }
4587
4613
  update() {
4588
- const { leafer } = this.leaf;
4614
+ const { leaf } = this, { leafer } = leaf;
4615
+ if (leaf.isApp)
4616
+ return updateBounds$3(leaf);
4589
4617
  if (leafer) {
4590
4618
  if (leafer.ready)
4591
4619
  leafer.watcher.changed && leafer.layouter.layout();
@@ -4593,7 +4621,7 @@ class LeafLayout {
4593
4621
  leafer.start();
4594
4622
  }
4595
4623
  else {
4596
- let root = this.leaf;
4624
+ let root = leaf;
4597
4625
  while (root.parent && !root.parent.leafer) {
4598
4626
  root = root.parent;
4599
4627
  }
@@ -4815,7 +4843,7 @@ class LeafLayout {
4815
4843
  }
4816
4844
  childrenSortChange() {
4817
4845
  if (!this.childrenSortChanged) {
4818
- this.childrenSortChanged = true;
4846
+ this.childrenSortChanged = this.affectChildrenSort = true;
4819
4847
  this.leaf.forceUpdate('surface');
4820
4848
  }
4821
4849
  }
@@ -4882,6 +4910,40 @@ ImageEvent.LOAD = 'image.load';
4882
4910
  ImageEvent.LOADED = 'image.loaded';
4883
4911
  ImageEvent.ERROR = 'image.error';
4884
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
+
4885
4947
  class ResizeEvent extends Event {
4886
4948
  get bigger() {
4887
4949
  if (!this.old)
@@ -4978,9 +5040,12 @@ class Eventer {
4978
5040
  set event(map) { this.on(map); }
4979
5041
  on(type, listener, options) {
4980
5042
  if (!listener) {
4981
- let event, map = type;
4982
- for (let key in map)
4983
- 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);
4984
5049
  return;
4985
5050
  }
4986
5051
  let capture, once;
@@ -5010,6 +5075,8 @@ class Eventer {
5010
5075
  else {
5011
5076
  map[type] = [item];
5012
5077
  }
5078
+ if (boundsEventMap[type])
5079
+ BoundsEvent.checkHas(this, type, 'on');
5013
5080
  }
5014
5081
  });
5015
5082
  }
@@ -5031,6 +5098,8 @@ class Eventer {
5031
5098
  events.splice(index, 1);
5032
5099
  if (!events.length)
5033
5100
  delete map[type];
5101
+ if (boundsEventMap[type])
5102
+ BoundsEvent.checkHas(this, type, 'off');
5034
5103
  }
5035
5104
  }
5036
5105
  });
@@ -5050,19 +5119,31 @@ class Eventer {
5050
5119
  }
5051
5120
  }
5052
5121
  on_(type, listener, bind, options) {
5053
- if (bind)
5054
- listener = listener.bind(bind);
5055
- 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);
5056
5126
  return { type, current: this, listener, options };
5057
5127
  }
5058
5128
  off_(id) {
5059
5129
  if (!id)
5060
5130
  return;
5061
5131
  const list = id instanceof Array ? id : [id];
5062
- 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
+ });
5063
5138
  list.length = 0;
5064
5139
  }
5065
- 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;
5066
5147
  this.on(type, listener, { once: true, capture });
5067
5148
  }
5068
5149
  emit(type, event, capture) {
@@ -5174,7 +5255,7 @@ const LeafDataProxy = {
5174
5255
  };
5175
5256
 
5176
5257
  const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
5177
- const { toPoint: toPoint$4, tempPoint: tempPoint$2 } = AroundHelper;
5258
+ const { toPoint: toPoint$4, tempPoint: tempPoint$1 } = AroundHelper;
5178
5259
  const LeafMatrix = {
5179
5260
  __updateWorldMatrix() {
5180
5261
  multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
@@ -5183,19 +5264,19 @@ const LeafMatrix = {
5183
5264
  if (this.__local) {
5184
5265
  const layout = this.__layout, local = this.__local, data = this.__;
5185
5266
  if (layout.affectScaleOrRotation) {
5186
- if (layout.scaleChanged || layout.rotationChanged) {
5267
+ if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
5187
5268
  setLayout(local, data, null, null, layout.affectRotation);
5188
- layout.scaleChanged = layout.rotationChanged = false;
5269
+ layout.scaleChanged = layout.rotationChanged = undefined;
5189
5270
  }
5190
5271
  }
5191
5272
  local.e = data.x + data.offsetX;
5192
5273
  local.f = data.y + data.offsetY;
5193
5274
  if (data.around || data.origin) {
5194
- toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$2);
5195
- translateInner(local, -tempPoint$2.x, -tempPoint$2.y, !data.around);
5275
+ toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$1);
5276
+ translateInner(local, -tempPoint$1.x, -tempPoint$1.y, !data.around);
5196
5277
  }
5197
5278
  }
5198
- this.__layout.matrixChanged = false;
5279
+ this.__layout.matrixChanged = undefined;
5199
5280
  }
5200
5281
  };
5201
5282
 
@@ -5205,11 +5286,17 @@ const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$8 } =
5205
5286
  const { toBounds: toBounds$2 } = PathBounds;
5206
5287
  const LeafBounds = {
5207
5288
  __updateWorldBounds() {
5208
- toOuterOf$1(this.__layout.renderBounds, this.__world, this.__world);
5209
- if (this.__layout.resized) {
5210
- this.__onUpdateSize();
5211
- 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;
5212
5297
  }
5298
+ if (this.__hasWorldEvent)
5299
+ BoundsEvent.emitWorld(this);
5213
5300
  },
5214
5301
  __updateLocalBounds() {
5215
5302
  const layout = this.__layout;
@@ -5218,12 +5305,12 @@ const LeafBounds = {
5218
5305
  this.__updatePath();
5219
5306
  this.__updateRenderPath();
5220
5307
  this.__updateBoxBounds();
5221
- layout.resized = true;
5308
+ layout.resized = 'inner';
5222
5309
  }
5223
5310
  if (layout.localBoxChanged) {
5224
5311
  if (this.__local)
5225
5312
  this.__updateLocalBoxBounds();
5226
- layout.localBoxChanged = false;
5313
+ layout.localBoxChanged = undefined;
5227
5314
  if (layout.strokeSpread)
5228
5315
  layout.strokeChanged = true;
5229
5316
  if (layout.renderSpread)
@@ -5231,7 +5318,7 @@ const LeafBounds = {
5231
5318
  if (this.parent)
5232
5319
  this.parent.__layout.boxChange();
5233
5320
  }
5234
- layout.boxChanged = false;
5321
+ layout.boxChanged = undefined;
5235
5322
  if (layout.strokeChanged) {
5236
5323
  layout.strokeSpread = this.__updateStrokeSpread();
5237
5324
  if (layout.strokeSpread) {
@@ -5243,12 +5330,12 @@ const LeafBounds = {
5243
5330
  else {
5244
5331
  layout.spreadStrokeCancel();
5245
5332
  }
5246
- layout.strokeChanged = false;
5333
+ layout.strokeChanged = undefined;
5247
5334
  if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
5248
5335
  layout.renderChanged = true;
5249
5336
  if (this.parent)
5250
5337
  this.parent.__layout.strokeChange();
5251
- layout.resized = true;
5338
+ layout.resized = 'inner';
5252
5339
  }
5253
5340
  if (layout.renderChanged) {
5254
5341
  layout.renderSpread = this.__updateRenderSpread();
@@ -5261,11 +5348,12 @@ const LeafBounds = {
5261
5348
  else {
5262
5349
  layout.spreadRenderCancel();
5263
5350
  }
5264
- layout.renderChanged = false;
5351
+ layout.renderChanged = undefined;
5265
5352
  if (this.parent)
5266
5353
  this.parent.__layout.renderChange();
5267
5354
  }
5268
- layout.boundsChanged = false;
5355
+ layout.resized || (layout.resized = 'local');
5356
+ layout.boundsChanged = undefined;
5269
5357
  },
5270
5358
  __updateLocalBoxBounds() {
5271
5359
  if (this.__hasMotionPath)
@@ -5805,7 +5893,7 @@ let Leaf = class Leaf {
5805
5893
  off(_type, _listener, _options) { }
5806
5894
  on_(_type, _listener, _bind, _options) { return undefined; }
5807
5895
  off_(_id) { }
5808
- once(_type, _listener, _capture) { }
5896
+ once(_type, _listener, _captureOrBind, _capture) { }
5809
5897
  emit(_type, _event, _capture) { }
5810
5898
  emitEvent(_event, _capture) { }
5811
5899
  hasEvent(_type, _capture) { return false; }
@@ -6142,7 +6230,7 @@ class LeafLevelList {
6142
6230
  }
6143
6231
  }
6144
6232
 
6145
- const version = "1.6.2";
6233
+ const version = "1.6.3";
6146
6234
 
6147
6235
  class LeaferCanvas extends LeaferCanvasBase {
6148
6236
  get allowBackgroundColor() { return false; }
@@ -6440,17 +6528,15 @@ class Watcher {
6440
6528
  this.target.emitEvent(new WatchEvent(WatchEvent.DATA, { updatedList: this.updatedList }));
6441
6529
  this.__updatedList = new LeafList();
6442
6530
  this.totalTimes++;
6443
- this.changed = false;
6444
- this.hasVisible = false;
6445
- this.hasRemove = false;
6446
- this.hasAdd = false;
6531
+ this.changed = this.hasVisible = this.hasRemove = this.hasAdd = false;
6447
6532
  }
6448
6533
  __listenEvents() {
6449
- const { target } = this;
6450
6534
  this.__eventIds = [
6451
- target.on_(PropertyEvent.CHANGE, this.__onAttrChange, this),
6452
- target.on_([ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this),
6453
- target.on_(WatchEvent.REQUEST, this.__onRquestData, this)
6535
+ this.target.on_([
6536
+ [PropertyEvent.CHANGE, this.__onAttrChange, this],
6537
+ [[ChildEvent.ADD, ChildEvent.REMOVE], this.__onChildEvent, this],
6538
+ [WatchEvent.REQUEST, this.__onRquestData, this]
6539
+ ])
6454
6540
  ];
6455
6541
  }
6456
6542
  __removeListenEvents() {
@@ -6460,8 +6546,7 @@ class Watcher {
6460
6546
  if (this.target) {
6461
6547
  this.stop();
6462
6548
  this.__removeListenEvents();
6463
- this.target = null;
6464
- this.__updatedList = null;
6549
+ this.target = this.__updatedList = null;
6465
6550
  }
6466
6551
  }
6467
6552
  }
@@ -6566,7 +6651,7 @@ class Layouter {
6566
6651
  this.disabled = true;
6567
6652
  }
6568
6653
  layout() {
6569
- if (!this.running)
6654
+ if (this.layouting || !this.running)
6570
6655
  return;
6571
6656
  const { target } = this;
6572
6657
  this.times = 0;
@@ -6649,12 +6734,10 @@ class Layouter {
6649
6734
  }
6650
6735
  static fullLayout(target) {
6651
6736
  updateAllMatrix$1(target, true);
6652
- if (target.isBranch) {
6737
+ if (target.isBranch)
6653
6738
  BranchHelper.updateBounds(target);
6654
- }
6655
- else {
6739
+ else
6656
6740
  LeafHelper.updateBounds(target);
6657
- }
6658
6741
  updateAllChange(target);
6659
6742
  }
6660
6743
  addExtra(leaf) {
@@ -6677,11 +6760,12 @@ class Layouter {
6677
6760
  this.__updatedList = event.data.updatedList;
6678
6761
  }
6679
6762
  __listenEvents() {
6680
- const { target } = this;
6681
6763
  this.__eventIds = [
6682
- target.on_(LayoutEvent.REQUEST, this.layout, this),
6683
- target.on_(LayoutEvent.AGAIN, this.layoutAgain, this),
6684
- target.on_(WatchEvent.DATA, this.__onReceiveWatchData, this)
6764
+ this.target.on_([
6765
+ [LayoutEvent.REQUEST, this.layout, this],
6766
+ [LayoutEvent.AGAIN, this.layoutAgain, this],
6767
+ [WatchEvent.DATA, this.__onReceiveWatchData, this]
6768
+ ])
6685
6769
  ];
6686
6770
  }
6687
6771
  __removeListenEvents() {
@@ -6912,12 +6996,13 @@ class Renderer {
6912
6996
  this.target.emitEvent(new RenderEvent(type, this.times, bounds, options));
6913
6997
  }
6914
6998
  __listenEvents() {
6915
- const { target } = this;
6916
6999
  this.__eventIds = [
6917
- target.on_(RenderEvent.REQUEST, this.update, this),
6918
- target.on_(LayoutEvent.END, this.__onLayoutEnd, this),
6919
- target.on_(RenderEvent.AGAIN, this.renderAgain, this),
6920
- target.on_(ResizeEvent.RESIZE, this.__onResize, this)
7000
+ this.target.on_([
7001
+ [RenderEvent.REQUEST, this.update, this],
7002
+ [LayoutEvent.END, this.__onLayoutEnd, this],
7003
+ [RenderEvent.AGAIN, this.renderAgain, this],
7004
+ [ResizeEvent.RESIZE, this.__onResize, this]
7005
+ ])
6921
7006
  ];
6922
7007
  }
6923
7008
  __removeListenEvents() {
@@ -7133,8 +7218,32 @@ function zoomLayerType() {
7133
7218
  };
7134
7219
  }
7135
7220
 
7221
+ function hasTransparent$3(color) {
7222
+ if (!color || color.length === 7 || color.length === 4)
7223
+ return false;
7224
+ if (color === 'transparent')
7225
+ return true;
7226
+ const first = color[0];
7227
+ if (first === '#') {
7228
+ switch (color.length) {
7229
+ case 5: return color[4] !== 'f' && color[4] !== 'F';
7230
+ case 9: return (color[7] !== 'f' && color[7] !== 'F') || (color[8] !== 'f' && color[8] !== 'F');
7231
+ }
7232
+ }
7233
+ else if (first === 'r' || first === 'h') {
7234
+ if (color[3] === 'a') {
7235
+ const i = color.lastIndexOf(',');
7236
+ if (i > -1)
7237
+ return parseFloat(color.slice(i + 1)) < 1;
7238
+ }
7239
+ }
7240
+ return false;
7241
+ }
7242
+
7136
7243
  const TextConvert = {};
7137
- const ColorConvert = {};
7244
+ const ColorConvert = {
7245
+ hasTransparent: hasTransparent$3
7246
+ };
7138
7247
  const UnitConvert = {
7139
7248
  number(value, percentRefer) {
7140
7249
  return typeof value === 'object' ? (value.type === 'percent' ? value.value * percentRefer : value.value) : value;
@@ -7160,6 +7269,7 @@ const Transition = {
7160
7269
  };
7161
7270
 
7162
7271
  const { parse, objectToCanvasData } = PathConvert;
7272
+ const { stintSet: stintSet$2 } = DataHelper, { hasTransparent: hasTransparent$2 } = ColorConvert;
7163
7273
  const emptyPaint = {};
7164
7274
  const debug$5 = Debug.get('UIData');
7165
7275
  class UIData extends LeafData {
@@ -7218,38 +7328,22 @@ class UIData extends LeafData {
7218
7328
  if (this.__naturalWidth)
7219
7329
  this.__removeNaturalSize();
7220
7330
  if (typeof value === 'string' || !value) {
7221
- if (this.__isFills) {
7222
- this.__removeInput('fill');
7223
- PaintImage.recycleImage('fill', this);
7224
- this.__isFills = false;
7225
- this.__pixelFill && (this.__pixelFill = false);
7226
- }
7331
+ stintSet$2(this, '__isTransparentFill', hasTransparent$2(value));
7332
+ this.__isFills && this.__removePaint('fill', true);
7227
7333
  this._fill = value;
7228
7334
  }
7229
7335
  else if (typeof value === 'object') {
7230
- this.__setInput('fill', value);
7231
- const layout = this.__leaf.__layout;
7232
- layout.boxChanged || layout.boxChange();
7233
- this.__isFills = true;
7234
- this._fill || (this._fill = emptyPaint);
7336
+ this.__setPaint('fill', value);
7235
7337
  }
7236
7338
  }
7237
7339
  setStroke(value) {
7238
7340
  if (typeof value === 'string' || !value) {
7239
- if (this.__isStrokes) {
7240
- this.__removeInput('stroke');
7241
- PaintImage.recycleImage('stroke', this);
7242
- this.__isStrokes = false;
7243
- this.__pixelStroke && (this.__pixelStroke = false);
7244
- }
7341
+ stintSet$2(this, '__isTransparentStroke', hasTransparent$2(value));
7342
+ this.__isStrokes && this.__removePaint('stroke', true);
7245
7343
  this._stroke = value;
7246
7344
  }
7247
7345
  else if (typeof value === 'object') {
7248
- this.__setInput('stroke', value);
7249
- const layout = this.__leaf.__layout;
7250
- layout.boxChanged || layout.boxChange();
7251
- this.__isStrokes = true;
7252
- this._stroke || (this._stroke = emptyPaint);
7346
+ this.__setPaint('stroke', value);
7253
7347
  }
7254
7348
  }
7255
7349
  setPath(value) {
@@ -7279,7 +7373,34 @@ class UIData extends LeafData {
7279
7373
  Paint.compute('fill', this.__leaf);
7280
7374
  if (stroke)
7281
7375
  Paint.compute('stroke', this.__leaf);
7282
- this.__needComputePaint = false;
7376
+ this.__needComputePaint = undefined;
7377
+ }
7378
+ __setPaint(attrName, value) {
7379
+ this.__setInput(attrName, value);
7380
+ const layout = this.__leaf.__layout;
7381
+ layout.boxChanged || layout.boxChange();
7382
+ if (value instanceof Array && !value.length) {
7383
+ this.__removePaint(attrName);
7384
+ }
7385
+ else {
7386
+ if (attrName === 'fill')
7387
+ this.__isFills = true, this._fill || (this._fill = emptyPaint);
7388
+ else
7389
+ this.__isStrokes = true, this._stroke || (this._stroke = emptyPaint);
7390
+ }
7391
+ }
7392
+ __removePaint(attrName, removeInput) {
7393
+ if (removeInput)
7394
+ this.__removeInput(attrName);
7395
+ PaintImage.recycleImage(attrName, this);
7396
+ if (attrName === 'fill') {
7397
+ stintSet$2(this, '__isAlphaPixelFill', undefined);
7398
+ this._fill = this.__isFills = undefined;
7399
+ }
7400
+ else {
7401
+ stintSet$2(this, '__isAlphaPixelStroke', undefined);
7402
+ this._stroke = this.__isStrokes = undefined;
7403
+ }
7283
7404
  }
7284
7405
  }
7285
7406
  function setArray(data, key, value) {
@@ -7287,10 +7408,10 @@ function setArray(data, key, value) {
7287
7408
  if (value instanceof Array) {
7288
7409
  if (value.some((item) => item.visible === false))
7289
7410
  value = value.filter((item) => item.visible !== false);
7290
- value.length || (value = null);
7411
+ value.length || (value = undefined);
7291
7412
  }
7292
7413
  else
7293
- value = value && value.visible !== false ? [value] : null;
7414
+ value = value && value.visible !== false ? [value] : undefined;
7294
7415
  data['_' + key] = value;
7295
7416
  }
7296
7417
 
@@ -7393,8 +7514,6 @@ class ImageData extends RectData {
7393
7514
  this._url = value;
7394
7515
  }
7395
7516
  __setImageFill(value) {
7396
- if (this.__leaf.image)
7397
- this.__leaf.image = null;
7398
7517
  this.fill = value ? { type: 'image', mode: 'stretch', url: value } : undefined;
7399
7518
  }
7400
7519
  __getData() {
@@ -7460,21 +7579,19 @@ const UIBounds = {
7460
7579
  }
7461
7580
  };
7462
7581
 
7582
+ const { stintSet: stintSet$1 } = DataHelper;
7463
7583
  const UIRender = {
7464
7584
  __updateChange() {
7465
- const data = this.__, w = this.__world;
7585
+ const data = this.__;
7466
7586
  if (data.__useEffect) {
7467
- const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7468
- data.__useEffect = !!(shadow || innerShadow || blur || backgroundBlur || filter);
7587
+ const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7588
+ 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')));
7589
+ data.__useEffect = !!(shadow || otherEffect);
7469
7590
  }
7470
- const half = data.__hasHalf;
7471
- w.half !== half && (w.half = half);
7591
+ stintSet$1(this.__world, 'half', data.__hasHalf);
7592
+ stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7472
7593
  data.__checkSingle();
7473
- const complex = data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect;
7474
- if (complex)
7475
- data.__complex = true;
7476
- else
7477
- data.__complex && (data.__complex = false);
7594
+ stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7478
7595
  },
7479
7596
  __drawFast(canvas, options) {
7480
7597
  drawFast(this, canvas, options);
@@ -7484,21 +7601,23 @@ const UIRender = {
7484
7601
  if (data.__complex) {
7485
7602
  if (data.__needComputePaint)
7486
7603
  data.__computePaint();
7487
- const { fill, stroke, __drawAfterFill } = data;
7604
+ const { fill, stroke, __drawAfterFill, __fillAfterStroke, __isFastShadow } = data;
7488
7605
  this.__drawRenderPath(canvas);
7489
- if (data.__useEffect) {
7606
+ if (data.__useEffect && !__isFastShadow) {
7490
7607
  const shape = Paint.shape(this, canvas, options);
7491
7608
  this.__nowWorld = this.__getNowWorld(options);
7492
7609
  const { shadow, innerShadow, filter } = data;
7493
7610
  if (shadow)
7494
7611
  Effect.shadow(this, canvas, shape);
7612
+ if (__fillAfterStroke)
7613
+ data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7495
7614
  if (fill)
7496
7615
  data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
7497
7616
  if (__drawAfterFill)
7498
7617
  this.__drawAfterFill(canvas, options);
7499
7618
  if (innerShadow)
7500
7619
  Effect.innerShadow(this, canvas, shape);
7501
- if (stroke)
7620
+ if (stroke && !__fillAfterStroke)
7502
7621
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7503
7622
  if (filter)
7504
7623
  Filter.apply(filter, this, this.__nowWorld, canvas, originCanvas, shape);
@@ -7507,21 +7626,27 @@ const UIRender = {
7507
7626
  shape.canvas.recycle();
7508
7627
  }
7509
7628
  else {
7629
+ if (__fillAfterStroke)
7630
+ data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7631
+ if (__isFastShadow) {
7632
+ const shadow = data.shadow[0], { scaleX, scaleY } = this.__nowWorld;
7633
+ canvas.save(), canvas.setWorldShadow(shadow.x * scaleX, shadow.y * scaleY, shadow.blur * scaleX, ColorConvert.string(shadow.color));
7634
+ }
7510
7635
  if (fill)
7511
7636
  data.__isFills ? Paint.fills(fill, this, canvas) : Paint.fill(fill, this, canvas);
7637
+ if (__isFastShadow)
7638
+ canvas.restore();
7512
7639
  if (__drawAfterFill)
7513
7640
  this.__drawAfterFill(canvas, options);
7514
- if (stroke)
7641
+ if (stroke && !__fillAfterStroke)
7515
7642
  data.__isStrokes ? Paint.strokes(stroke, this, canvas) : Paint.stroke(stroke, this, canvas);
7516
7643
  }
7517
7644
  }
7518
7645
  else {
7519
- if (data.__pathInputed) {
7646
+ if (data.__pathInputed)
7520
7647
  drawFast(this, canvas, options);
7521
- }
7522
- else {
7648
+ else
7523
7649
  this.__drawFast(canvas, options);
7524
- }
7525
7650
  }
7526
7651
  },
7527
7652
  __renderShape(canvas, options, ignoreFill, ignoreStroke) {
@@ -7530,11 +7655,11 @@ const UIRender = {
7530
7655
  const { fill, stroke } = this.__;
7531
7656
  this.__drawRenderPath(canvas);
7532
7657
  if (fill && !ignoreFill)
7533
- this.__.__pixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7658
+ this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7534
7659
  if (this.__.__isCanvas)
7535
7660
  this.__drawAfterFill(canvas, options);
7536
7661
  if (stroke && !ignoreStroke)
7537
- this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7662
+ this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7538
7663
  }
7539
7664
  },
7540
7665
  __drawAfterFill(canvas, options) {
@@ -7549,13 +7674,15 @@ const UIRender = {
7549
7674
  }
7550
7675
  };
7551
7676
  function drawFast(ui, canvas, options) {
7552
- const { fill, stroke, __drawAfterFill } = ui.__;
7677
+ const { fill, stroke, __drawAfterFill, __fillAfterStroke } = ui.__;
7553
7678
  ui.__drawRenderPath(canvas);
7679
+ if (__fillAfterStroke)
7680
+ Paint.stroke(stroke, ui, canvas);
7554
7681
  if (fill)
7555
7682
  Paint.fill(fill, ui, canvas);
7556
7683
  if (__drawAfterFill)
7557
7684
  ui.__drawAfterFill(canvas, options);
7558
- if (stroke)
7685
+ if (stroke && !__fillAfterStroke)
7559
7686
  Paint.stroke(stroke, ui, canvas);
7560
7687
  }
7561
7688
 
@@ -7927,6 +8054,9 @@ __decorate([
7927
8054
  __decorate([
7928
8055
  surfaceType()
7929
8056
  ], UI.prototype, "placeholderColor", void 0);
8057
+ __decorate([
8058
+ dataType(100)
8059
+ ], UI.prototype, "placeholderDelay", void 0);
7930
8060
  __decorate([
7931
8061
  dataType({})
7932
8062
  ], UI.prototype, "data", void 0);
@@ -8328,15 +8458,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8328
8458
  }
8329
8459
  __listenEvents() {
8330
8460
  const runId = Run.start('FirstCreate ' + this.innerName);
8331
- this.once(LeaferEvent.START, () => Run.end(runId));
8332
- this.once(LayoutEvent.START, () => this.updateLazyBounds());
8333
- this.once(RenderEvent.START, () => this.__onCreated());
8334
- this.once(RenderEvent.END, () => this.__onViewReady());
8335
- this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
8461
+ this.once([
8462
+ [LeaferEvent.START, () => Run.end(runId)],
8463
+ [LayoutEvent.START, this.updateLazyBounds, this],
8464
+ [RenderEvent.START, this.__onCreated, this],
8465
+ [RenderEvent.END, this.__onViewReady, this]
8466
+ ]);
8467
+ this.__eventIds.push(this.on_([
8468
+ [WatchEvent.DATA, this.__onWatchData, this],
8469
+ [LayoutEvent.END, this.__onLayoutEnd, this],
8470
+ [RenderEvent.NEXT, this.__onNextRender, this]
8471
+ ]));
8336
8472
  }
8337
8473
  __removeListenEvents() {
8338
8474
  this.off_(this.__eventIds);
8339
- this.__eventIds.length = 0;
8340
8475
  }
8341
8476
  destroy(sync) {
8342
8477
  const doDestory = () => {
@@ -8444,13 +8579,13 @@ let Box = class Box extends Group {
8444
8579
  super.__updateRenderBounds();
8445
8580
  copy$6(childrenRenderBounds, renderBounds);
8446
8581
  this.__updateRectRenderBounds();
8447
- isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
8582
+ isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8448
8583
  if (isOverflow && this.__.overflow !== 'hide')
8449
8584
  add(renderBounds, childrenRenderBounds);
8450
8585
  }
8451
8586
  else
8452
8587
  this.__updateRectRenderBounds();
8453
- this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8588
+ DataHelper.stintSet(this, 'isOverflow', isOverflow);
8454
8589
  }
8455
8590
  __updateRectRenderBounds() { }
8456
8591
  __updateRectChange() { }
@@ -8754,18 +8889,10 @@ Star = __decorate([
8754
8889
 
8755
8890
  let Image = class Image extends Rect {
8756
8891
  get __tag() { return 'Image'; }
8757
- get ready() { return this.image ? this.image.ready : false; }
8892
+ get ready() { const { image } = this; return image && image.ready; }
8893
+ get image() { const { fill } = this.__; return fill instanceof Array && fill[0].image; }
8758
8894
  constructor(data) {
8759
8895
  super(data);
8760
- this.on_(ImageEvent.LOADED, this.__onLoaded, this);
8761
- }
8762
- __onLoaded(e) {
8763
- if (e.attrName === 'fill' && e.attrValue.url === this.url)
8764
- this.image = e.image;
8765
- }
8766
- destroy() {
8767
- this.image = null;
8768
- super.destroy();
8769
8896
  }
8770
8897
  };
8771
8898
  __decorate([
@@ -8781,11 +8908,11 @@ const MyImage = Image;
8781
8908
 
8782
8909
  let Canvas = class Canvas extends Rect {
8783
8910
  get __tag() { return 'Canvas'; }
8911
+ get context() { return this.canvas.context; }
8784
8912
  get ready() { return !this.url; }
8785
8913
  constructor(data) {
8786
8914
  super(data);
8787
8915
  this.canvas = Creator.canvas(this.__);
8788
- this.context = this.canvas.context;
8789
8916
  if (data && data.url)
8790
8917
  this.drawImage(data.url);
8791
8918
  }
@@ -8829,7 +8956,7 @@ let Canvas = class Canvas extends Rect {
8829
8956
  destroy() {
8830
8957
  if (this.canvas) {
8831
8958
  this.canvas.destroy();
8832
- this.canvas = this.context = null;
8959
+ this.canvas = null;
8833
8960
  }
8834
8961
  super.destroy();
8835
8962
  }
@@ -8905,12 +9032,11 @@ let Text = class Text extends UI {
8905
9032
  super.__updateBoxBounds();
8906
9033
  if (italic)
8907
9034
  b.width += fontSize * 0.16;
8908
- const isOverflow = !includes(b, contentBounds) || undefined;
8909
- if (isOverflow)
9035
+ DataHelper.stintSet(this, 'isOverflow', !includes(b, contentBounds));
9036
+ if (this.isOverflow)
8910
9037
  setList(data.__textBoxBounds = {}, [b, contentBounds]), layout.renderChanged = true;
8911
9038
  else
8912
9039
  data.__textBoxBounds = b;
8913
- this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
8914
9040
  }
8915
9041
  __onUpdateSize() {
8916
9042
  if (this.__box)
@@ -9111,7 +9237,7 @@ let App = class App extends Leafer {
9111
9237
  if (sky || editor)
9112
9238
  this.sky = this.addLeafer(sky);
9113
9239
  if (editor)
9114
- this.sky.add(this.editor = Creator.editor(editor));
9240
+ Creator.editor(editor, this);
9115
9241
  }
9116
9242
  }
9117
9243
  __setApp() {
@@ -9125,6 +9251,10 @@ let App = class App extends Leafer {
9125
9251
  this.watcher.disable();
9126
9252
  this.layouter.disable();
9127
9253
  }
9254
+ __updateLocalBounds() {
9255
+ this.forEach(leafer => leafer.updateLayout());
9256
+ super.__updateLocalBounds();
9257
+ }
9128
9258
  start() {
9129
9259
  super.start();
9130
9260
  this.forEach(leafer => leafer.start());
@@ -9182,12 +9312,8 @@ let App = class App extends Leafer {
9182
9312
  this.renderer.update();
9183
9313
  }
9184
9314
  __render(canvas, options) {
9185
- if (canvas.context) {
9186
- const m = options.matrix;
9187
- if (m)
9188
- canvas.setTransform(m.a, m.b, m.c, m.d, m.e, m.f);
9189
- this.forEach(leafer => canvas.copyWorld(leafer.canvas));
9190
- }
9315
+ if (canvas.context)
9316
+ this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
9191
9317
  }
9192
9318
  __onResize(event) {
9193
9319
  this.forEach(leafer => leafer.resize(event));
@@ -9208,9 +9334,11 @@ let App = class App extends Leafer {
9208
9334
  return config;
9209
9335
  }
9210
9336
  __listenChildEvents(leafer) {
9211
- leafer.once(LayoutEvent.END, () => this.__onReady());
9212
- leafer.once(RenderEvent.START, () => this.__onCreated());
9213
- leafer.once(RenderEvent.END, () => this.__onViewReady());
9337
+ leafer.once([
9338
+ [LayoutEvent.END, this.__onReady, this],
9339
+ [RenderEvent.START, this.__onCreated, this],
9340
+ [RenderEvent.END, this.__onViewReady, this]
9341
+ ]);
9214
9342
  if (this.realCanvas)
9215
9343
  this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
9216
9344
  }
@@ -9421,7 +9549,7 @@ MoveEvent = __decorate([
9421
9549
  registerUIEvent()
9422
9550
  ], MoveEvent);
9423
9551
 
9424
- let RotateEvent = class RotateEvent extends UIEvent {
9552
+ let RotateEvent = class RotateEvent extends PointerEvent {
9425
9553
  };
9426
9554
  RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
9427
9555
  RotateEvent.START = 'rotate.start';
@@ -9442,7 +9570,7 @@ SwipeEvent = __decorate([
9442
9570
  registerUIEvent()
9443
9571
  ], SwipeEvent);
9444
9572
 
9445
- let ZoomEvent = class ZoomEvent extends UIEvent {
9573
+ let ZoomEvent = class ZoomEvent extends PointerEvent {
9446
9574
  };
9447
9575
  ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
9448
9576
  ZoomEvent.START = 'zoom.start';
@@ -10285,8 +10413,8 @@ ui$5.__updateHitCanvas = function () {
10285
10413
  if (this.__box)
10286
10414
  this.__box.__updateHitCanvas();
10287
10415
  const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
10288
- const isHitPixelFill = (data.__pixelFill || data.__isCanvas) && data.hitFill === 'pixel';
10289
- const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
10416
+ const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
10417
+ const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
10290
10418
  const isHitPixel = isHitPixelFill || isHitPixelStroke;
10291
10419
  if (!this.__hitCanvas)
10292
10420
  this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
@@ -10317,11 +10445,11 @@ ui$5.__hit = function (inner) {
10317
10445
  if (data.__isHitPixel && this.__hitPixel(inner))
10318
10446
  return true;
10319
10447
  const { hitFill } = data;
10320
- const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__pixelFill || data.__isCanvas)))) || hitFill === 'all';
10448
+ const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
10321
10449
  if (needHitFillPath && this.__hitFill(inner))
10322
10450
  return true;
10323
10451
  const { hitStroke, __strokeWidth } = data;
10324
- const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__pixelStroke))) || hitStroke === 'all';
10452
+ const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
10325
10453
  if (!needHitFillPath && !needHitStrokePath)
10326
10454
  return false;
10327
10455
  const radiusWidth = inner.radiusX * 2;
@@ -10567,31 +10695,31 @@ function fillPathOrText(ui, canvas) {
10567
10695
  }
10568
10696
 
10569
10697
  function strokeText(stroke, ui, canvas) {
10570
- const { strokeAlign } = ui.__;
10571
- const isStrokes = typeof stroke !== 'string';
10572
- switch (strokeAlign) {
10698
+ switch (ui.__.strokeAlign) {
10573
10699
  case 'center':
10574
- canvas.setStroke(isStrokes ? undefined : stroke, ui.__.strokeWidth, ui.__);
10575
- isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
10700
+ drawCenter$1(stroke, 1, ui, canvas);
10576
10701
  break;
10577
10702
  case 'inside':
10578
- drawAlignStroke('inside', stroke, isStrokes, ui, canvas);
10703
+ drawAlign(stroke, 'inside', ui, canvas);
10579
10704
  break;
10580
10705
  case 'outside':
10581
- drawAlignStroke('outside', stroke, isStrokes, ui, canvas);
10706
+ ui.__.__fillAfterStroke ? drawCenter$1(stroke, 2, ui, canvas) : drawAlign(stroke, 'outside', ui, canvas);
10582
10707
  break;
10583
10708
  }
10584
10709
  }
10585
- function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
10586
- const { __strokeWidth, __font } = ui.__;
10710
+ function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
10711
+ const data = ui.__;
10712
+ canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
10713
+ data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
10714
+ }
10715
+ function drawAlign(stroke, align, ui, canvas) {
10587
10716
  const out = canvas.getSameCanvas(true, true);
10588
- out.setStroke(isStrokes ? undefined : stroke, __strokeWidth * 2, ui.__);
10589
- out.font = __font;
10590
- isStrokes ? drawStrokesStyle(stroke, true, ui, out) : drawTextStroke(ui, out);
10717
+ out.font = ui.__.__font;
10718
+ drawCenter$1(stroke, 2, ui, out);
10591
10719
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10592
10720
  fillText(ui, out);
10593
10721
  out.blendMode = 'normal';
10594
- if (ui.__worldFlipped)
10722
+ if (ui.__worldFlipped || Platform.fullImageShadow)
10595
10723
  canvas.copyWorldByReset(out, ui.__nowWorld);
10596
10724
  else
10597
10725
  canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
@@ -10633,90 +10761,60 @@ function drawStrokesStyle(strokes, isText, ui, canvas) {
10633
10761
  }
10634
10762
 
10635
10763
  function stroke(stroke, ui, canvas) {
10636
- const options = ui.__;
10637
- const { __strokeWidth, strokeAlign, __font } = options;
10638
- if (!__strokeWidth)
10764
+ const data = ui.__;
10765
+ if (!data.__strokeWidth)
10639
10766
  return;
10640
- if (__font) {
10767
+ if (data.__font) {
10641
10768
  strokeText(stroke, ui, canvas);
10642
10769
  }
10643
10770
  else {
10644
- switch (strokeAlign) {
10771
+ switch (data.strokeAlign) {
10645
10772
  case 'center':
10646
- canvas.setStroke(stroke, __strokeWidth, options);
10647
- canvas.stroke();
10648
- if (options.__useArrow)
10649
- strokeArrow(ui, canvas);
10773
+ drawCenter(stroke, 1, ui, canvas);
10650
10774
  break;
10651
10775
  case 'inside':
10652
- canvas.save();
10653
- canvas.setStroke(stroke, __strokeWidth * 2, options);
10654
- options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
10655
- canvas.stroke();
10656
- canvas.restore();
10776
+ drawInside(stroke, ui, canvas);
10657
10777
  break;
10658
10778
  case 'outside':
10659
- const out = canvas.getSameCanvas(true, true);
10660
- out.setStroke(stroke, __strokeWidth * 2, options);
10661
- ui.__drawRenderPath(out);
10662
- out.stroke();
10663
- options.windingRule ? out.clip(options.windingRule) : out.clip();
10664
- out.clearWorld(ui.__layout.renderBounds);
10665
- if (ui.__worldFlipped)
10666
- canvas.copyWorldByReset(out, ui.__nowWorld);
10667
- else
10668
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10669
- out.recycle(ui.__nowWorld);
10779
+ drawOutside(stroke, ui, canvas);
10670
10780
  break;
10671
10781
  }
10672
10782
  }
10673
10783
  }
10674
10784
  function strokes(strokes, ui, canvas) {
10675
- const options = ui.__;
10676
- const { __strokeWidth, strokeAlign, __font } = options;
10677
- if (!__strokeWidth)
10678
- return;
10679
- if (__font) {
10680
- strokeText(strokes, ui, canvas);
10785
+ stroke(strokes, ui, canvas);
10786
+ }
10787
+ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
10788
+ const data = ui.__;
10789
+ canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
10790
+ data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
10791
+ if (data.__useArrow)
10792
+ Paint.strokeArrow(stroke, ui, canvas);
10793
+ }
10794
+ function drawInside(stroke, ui, canvas) {
10795
+ const data = ui.__;
10796
+ canvas.save();
10797
+ data.windingRule ? canvas.clip(data.windingRule) : canvas.clip();
10798
+ drawCenter(stroke, 2, ui, canvas);
10799
+ canvas.restore();
10800
+ }
10801
+ function drawOutside(stroke, ui, canvas) {
10802
+ const data = ui.__;
10803
+ if (data.__fillAfterStroke) {
10804
+ drawCenter(stroke, 2, ui, canvas);
10681
10805
  }
10682
10806
  else {
10683
- switch (strokeAlign) {
10684
- case 'center':
10685
- canvas.setStroke(undefined, __strokeWidth, options);
10686
- drawStrokesStyle(strokes, false, ui, canvas);
10687
- if (options.__useArrow)
10688
- strokeArrow(ui, canvas);
10689
- break;
10690
- case 'inside':
10691
- canvas.save();
10692
- canvas.setStroke(undefined, __strokeWidth * 2, options);
10693
- options.windingRule ? canvas.clip(options.windingRule) : canvas.clip();
10694
- drawStrokesStyle(strokes, false, ui, canvas);
10695
- canvas.restore();
10696
- break;
10697
- case 'outside':
10698
- const { renderBounds } = ui.__layout;
10699
- const out = canvas.getSameCanvas(true, true);
10700
- ui.__drawRenderPath(out);
10701
- out.setStroke(undefined, __strokeWidth * 2, options);
10702
- drawStrokesStyle(strokes, false, ui, out);
10703
- options.windingRule ? out.clip(options.windingRule) : out.clip();
10704
- out.clearWorld(renderBounds);
10705
- if (ui.__worldFlipped)
10706
- canvas.copyWorldByReset(out, ui.__nowWorld);
10707
- else
10708
- canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
10709
- out.recycle(ui.__nowWorld);
10710
- break;
10711
- }
10712
- }
10713
- }
10714
- function strokeArrow(ui, canvas) {
10715
- if (ui.__.dashPattern) {
10716
- canvas.beginPath();
10717
- ui.__drawPathByData(canvas, ui.__.__pathForArrow);
10718
- canvas.dashPattern = null;
10719
- canvas.stroke();
10807
+ const { renderBounds } = ui.__layout;
10808
+ const out = canvas.getSameCanvas(true, true);
10809
+ ui.__drawRenderPath(out);
10810
+ drawCenter(stroke, 2, ui, out);
10811
+ data.windingRule ? out.clip(data.windingRule) : out.clip();
10812
+ out.clearWorld(renderBounds);
10813
+ if (ui.__worldFlipped || Platform.fullImageShadow)
10814
+ canvas.copyWorldByReset(out, ui.__nowWorld);
10815
+ else
10816
+ canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
10817
+ out.recycle(ui.__nowWorld);
10720
10818
  }
10721
10819
  }
10722
10820
 
@@ -10763,9 +10861,10 @@ function shape(ui, current, options) {
10763
10861
  }
10764
10862
 
10765
10863
  let recycleMap;
10864
+ const { stintSet } = DataHelper, { hasTransparent: hasTransparent$1 } = ColorConvert;
10766
10865
  function compute(attrName, ui) {
10767
10866
  const data = ui.__, leafPaints = [];
10768
- let paints = data.__input[attrName], hasOpacityPixel;
10867
+ let paints = data.__input[attrName], isAlphaPixel, isTransparent;
10769
10868
  if (!(paints instanceof Array))
10770
10869
  paints = [paints];
10771
10870
  recycleMap = PaintImage.recycleImage(attrName, data);
@@ -10775,29 +10874,55 @@ function compute(attrName, ui) {
10775
10874
  leafPaints.push(item);
10776
10875
  }
10777
10876
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
10778
- if (leafPaints.length && leafPaints[0].image)
10779
- hasOpacityPixel = leafPaints[0].image.hasOpacityPixel;
10780
- attrName === 'fill' ? data.__pixelFill = hasOpacityPixel : data.__pixelStroke = hasOpacityPixel;
10877
+ if (leafPaints.length) {
10878
+ if (leafPaints.every(item => item.isTransparent)) {
10879
+ if (leafPaints.some(item => item.image))
10880
+ isAlphaPixel = true;
10881
+ isTransparent = true;
10882
+ }
10883
+ }
10884
+ if (attrName === 'fill') {
10885
+ stintSet(data, '__isAlphaPixelFill', isAlphaPixel);
10886
+ stintSet(data, '__isTransparentFill', isTransparent);
10887
+ }
10888
+ else {
10889
+ stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
10890
+ stintSet(data, '__isTransparentStroke', isTransparent);
10891
+ }
10781
10892
  }
10782
10893
  function getLeafPaint(attrName, paint, ui) {
10783
10894
  if (typeof paint !== 'object' || paint.visible === false || paint.opacity === 0)
10784
10895
  return undefined;
10896
+ let data;
10785
10897
  const { boxBounds } = ui.__layout;
10786
10898
  switch (paint.type) {
10787
- case 'solid':
10788
- let { type, blendMode, color, opacity } = paint;
10789
- return { type, blendMode, style: ColorConvert.string(color, opacity) };
10790
10899
  case 'image':
10791
- return PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
10900
+ data = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
10901
+ break;
10792
10902
  case 'linear':
10793
- return PaintGradient.linearGradient(paint, boxBounds);
10903
+ data = PaintGradient.linearGradient(paint, boxBounds);
10904
+ break;
10794
10905
  case 'radial':
10795
- return PaintGradient.radialGradient(paint, boxBounds);
10906
+ data = PaintGradient.radialGradient(paint, boxBounds);
10907
+ break;
10796
10908
  case 'angular':
10797
- return PaintGradient.conicGradient(paint, boxBounds);
10909
+ data = PaintGradient.conicGradient(paint, boxBounds);
10910
+ break;
10911
+ case 'solid':
10912
+ const { type, blendMode, color, opacity } = paint;
10913
+ data = { type, blendMode, style: ColorConvert.string(color, opacity) };
10914
+ break;
10798
10915
  default:
10799
- return paint.r !== undefined ? { type: 'solid', style: ColorConvert.string(paint) } : undefined;
10916
+ if (paint.r !== undefined)
10917
+ data = { type: 'solid', style: ColorConvert.string(paint) };
10918
+ }
10919
+ if (data) {
10920
+ if (typeof data.style === 'string' && hasTransparent$1(data.style))
10921
+ data.isTransparent = true;
10922
+ if (paint.blendMode)
10923
+ data.blendMode = paint.blendMode;
10800
10924
  }
10925
+ return data;
10801
10926
  }
10802
10927
 
10803
10928
  const PaintModule = {
@@ -10863,12 +10988,10 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
10863
10988
 
10864
10989
  const { get: get$2, translate } = MatrixHelper;
10865
10990
  const tempBox = new Bounds();
10866
- const tempPoint$1 = {};
10867
10991
  const tempScaleData = {};
10992
+ const tempImage = {};
10868
10993
  function createData(leafPaint, image, paint, box) {
10869
- const { blendMode, changeful, sync } = paint;
10870
- if (blendMode)
10871
- leafPaint.blendMode = blendMode;
10994
+ const { changeful, sync } = paint;
10872
10995
  if (changeful)
10873
10996
  leafPaint.changeful = changeful;
10874
10997
  if (sync)
@@ -10876,38 +10999,38 @@ function createData(leafPaint, image, paint, box) {
10876
10999
  leafPaint.data = getPatternData(paint, box, image);
10877
11000
  }
10878
11001
  function getPatternData(paint, box, image) {
10879
- let { width, height } = image;
10880
11002
  if (paint.padding)
10881
11003
  box = tempBox.set(box).shrink(paint.padding);
10882
11004
  if (paint.mode === 'strench')
10883
11005
  paint.mode = 'stretch';
11006
+ let { width, height } = image;
10884
11007
  const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
10885
11008
  const sameBox = box.width === width && box.height === height;
10886
11009
  const data = { mode };
10887
11010
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
10888
- const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
10889
- let x = 0, y = 0, scaleX, scaleY;
11011
+ BoundsHelper.set(tempImage, 0, 0, swapSize ? height : width, swapSize ? width : height);
11012
+ let scaleX, scaleY;
10890
11013
  if (!mode || mode === 'cover' || mode === 'fit') {
10891
11014
  if (!sameBox || rotation) {
10892
- const sw = box.width / swapWidth, sh = box.height / swapHeight;
10893
- scaleX = scaleY = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
10894
- x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
11015
+ scaleX = scaleY = BoundsHelper.getFitScale(box, tempImage, mode !== 'fit');
11016
+ BoundsHelper.put(box, image, align, scaleX, false, tempImage);
11017
+ BoundsHelper.scale(tempImage, scaleX, scaleY, true);
10895
11018
  }
10896
11019
  }
10897
- else if (scale || size) {
10898
- MathHelper.getScaleData(scale, size, image, tempScaleData);
10899
- scaleX = tempScaleData.scaleX;
10900
- scaleY = tempScaleData.scaleY;
10901
- }
10902
- if (align) {
10903
- const imageBounds = { x, y, width: swapWidth, height: swapHeight };
10904
- if (scaleX)
10905
- imageBounds.width *= scaleX, imageBounds.height *= scaleY;
10906
- AlignHelper.toPoint(align, imageBounds, box, tempPoint$1, true);
10907
- x += tempPoint$1.x, y += tempPoint$1.y;
11020
+ else {
11021
+ if (scale || size) {
11022
+ MathHelper.getScaleData(scale, size, image, tempScaleData);
11023
+ scaleX = tempScaleData.scaleX;
11024
+ scaleY = tempScaleData.scaleY;
11025
+ }
11026
+ if (align) {
11027
+ if (scaleX)
11028
+ BoundsHelper.scale(tempImage, scaleX, scaleY, true);
11029
+ AlignHelper.toPoint(align, tempImage, box, tempImage, true, true);
11030
+ }
10908
11031
  }
10909
11032
  if (offset)
10910
- x += offset.x, y += offset.y;
11033
+ PointHelper.move(tempImage, offset);
10911
11034
  switch (mode) {
10912
11035
  case 'stretch':
10913
11036
  if (!sameBox)
@@ -10915,12 +11038,12 @@ function getPatternData(paint, box, image) {
10915
11038
  break;
10916
11039
  case 'normal':
10917
11040
  case 'clip':
10918
- if (x || y || scaleX || rotation)
10919
- clipMode(data, box, x, y, scaleX, scaleY, rotation);
11041
+ if (tempImage.x || tempImage.y || scaleX || rotation)
11042
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
10920
11043
  break;
10921
11044
  case 'repeat':
10922
11045
  if (!sameBox || scaleX || rotation)
10923
- repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
11046
+ repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, align);
10924
11047
  if (!repeat)
10925
11048
  data.repeat = 'repeat';
10926
11049
  break;
@@ -10928,7 +11051,7 @@ function getPatternData(paint, box, image) {
10928
11051
  case 'cover':
10929
11052
  default:
10930
11053
  if (scaleX)
10931
- fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
11054
+ fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
10932
11055
  }
10933
11056
  if (!data.transform) {
10934
11057
  if (box.x || box.y) {
@@ -10961,6 +11084,8 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10961
11084
  }
10962
11085
  else {
10963
11086
  leafPaint = { type: paint.type, image };
11087
+ if (image.hasAlphaPixel)
11088
+ leafPaint.isTransparent = true;
10964
11089
  cache$1 = image.use > 1 ? { leafPaint, paint, boxBounds: box$1.set(boxBounds) } : null;
10965
11090
  }
10966
11091
  if (firstUse || image.loading)
@@ -10985,7 +11110,7 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10985
11110
  ignoreRender(ui, false);
10986
11111
  if (!ui.destroyed) {
10987
11112
  if (checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds)) {
10988
- if (image.hasOpacityPixel)
11113
+ if (image.hasAlphaPixel)
10989
11114
  ui.__layout.hitCanvasChanged = true;
10990
11115
  ui.forceUpdate('surface');
10991
11116
  }
@@ -10997,13 +11122,17 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
10997
11122
  onLoadError(ui, event, error);
10998
11123
  leafPaint.loadId = null;
10999
11124
  });
11000
- if (ui.placeholderColor)
11001
- setTimeout(() => {
11002
- if (!(image.ready || image.isPlacehold)) {
11003
- image.isPlacehold = true;
11004
- ui.forceUpdate('surface');
11005
- }
11006
- }, 100);
11125
+ if (ui.placeholderColor) {
11126
+ if (!ui.placeholderDelay)
11127
+ image.isPlacehold = true;
11128
+ else
11129
+ setTimeout(() => {
11130
+ if (!image.ready) {
11131
+ image.isPlacehold = true;
11132
+ ui.forceUpdate('surface');
11133
+ }
11134
+ }, ui.placeholderDelay);
11135
+ }
11007
11136
  }
11008
11137
  return leafPaint;
11009
11138
  }
@@ -11209,32 +11338,33 @@ const PaintImageModule = {
11209
11338
  repeatMode
11210
11339
  };
11211
11340
 
11212
- const { toPoint: toPoint$3 } = AroundHelper;
11341
+ const { toPoint: toPoint$3 } = AroundHelper, { hasTransparent } = ColorConvert;
11213
11342
  const realFrom$2 = {};
11214
11343
  const realTo$2 = {};
11215
11344
  function linearGradient(paint, box) {
11216
- let { from, to, type, blendMode, opacity } = paint;
11345
+ let { from, to, type, opacity } = paint;
11217
11346
  toPoint$3(from || 'top', box, realFrom$2);
11218
11347
  toPoint$3(to || 'bottom', box, realTo$2);
11219
11348
  const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
11220
- applyStops(style, paint.stops, opacity);
11221
11349
  const data = { type, style };
11222
- if (blendMode)
11223
- data.blendMode = blendMode;
11350
+ applyStops(data, style, paint.stops, opacity);
11224
11351
  return data;
11225
11352
  }
11226
- function applyStops(gradient, stops, opacity) {
11353
+ function applyStops(data, gradient, stops, opacity) {
11227
11354
  if (stops) {
11228
- let stop;
11355
+ let stop, color, offset, isTransparent;
11229
11356
  for (let i = 0, len = stops.length; i < len; i++) {
11230
11357
  stop = stops[i];
11231
- if (typeof stop === 'string') {
11232
- gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
11233
- }
11234
- else {
11235
- gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
11236
- }
11358
+ if (typeof stop === 'string')
11359
+ offset = i / (len - 1), color = ColorConvert.string(stop, opacity);
11360
+ else
11361
+ offset = stop.offset, color = ColorConvert.string(stop.color, opacity);
11362
+ gradient.addColorStop(offset, color);
11363
+ if (!isTransparent && hasTransparent(color))
11364
+ isTransparent = true;
11237
11365
  }
11366
+ if (isTransparent)
11367
+ data.isTransparent = true;
11238
11368
  }
11239
11369
  }
11240
11370
 
@@ -11244,17 +11374,15 @@ const { toPoint: toPoint$2 } = AroundHelper;
11244
11374
  const realFrom$1 = {};
11245
11375
  const realTo$1 = {};
11246
11376
  function radialGradient(paint, box) {
11247
- let { from, to, type, opacity, blendMode, stretch } = paint;
11377
+ let { from, to, type, opacity, stretch } = paint;
11248
11378
  toPoint$2(from || 'center', box, realFrom$1);
11249
11379
  toPoint$2(to || 'bottom', box, realTo$1);
11250
11380
  const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$2(realFrom$1, realTo$1));
11251
- applyStops(style, paint.stops, opacity);
11252
11381
  const data = { type, style };
11382
+ applyStops(data, style, paint.stops, opacity);
11253
11383
  const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
11254
11384
  if (transform)
11255
11385
  data.transform = transform;
11256
- if (blendMode)
11257
- data.blendMode = blendMode;
11258
11386
  return data;
11259
11387
  }
11260
11388
  function getTransform(box, from, to, stretch, rotate90) {
@@ -11280,17 +11408,15 @@ const { toPoint: toPoint$1 } = AroundHelper;
11280
11408
  const realFrom = {};
11281
11409
  const realTo = {};
11282
11410
  function conicGradient(paint, box) {
11283
- let { from, to, type, opacity, blendMode, stretch } = paint;
11411
+ let { from, to, type, opacity, stretch } = paint;
11284
11412
  toPoint$1(from || 'center', box, realFrom);
11285
11413
  toPoint$1(to || 'bottom', box, realTo);
11286
11414
  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$1(realFrom, realTo));
11287
- applyStops(style, paint.stops, opacity);
11288
11415
  const data = { type, style };
11416
+ applyStops(data, style, paint.stops, opacity);
11289
11417
  const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
11290
11418
  if (transform)
11291
11419
  data.transform = transform;
11292
- if (blendMode)
11293
- data.blendMode = blendMode;
11294
11420
  return data;
11295
11421
  }
11296
11422
 
@@ -11623,6 +11749,8 @@ function createRows(drawData, content, style) {
11623
11749
  lastCharType = null;
11624
11750
  startCharSize = charWidth = charSize = wordWidth = rowWidth = 0;
11625
11751
  word = { data: [] }, row = { words: [] };
11752
+ if (__letterSpacing)
11753
+ content = [...content];
11626
11754
  for (let i = 0, len = content.length; i < len; i++) {
11627
11755
  char = content[i];
11628
11756
  if (char === '\n') {
@@ -12476,24 +12604,25 @@ class EditSelect extends Group {
12476
12604
  const { app } = editor;
12477
12605
  app.selector.proxy = editor;
12478
12606
  this.__eventIds = [
12479
- editor.on_(EditorEvent.HOVER, this.onHover, this),
12480
- editor.on_(EditorEvent.SELECT, this.onSelect, this),
12481
- app.on_(PointerEvent.MOVE, this.onPointerMove, this),
12482
- app.on_(PointerEvent.BEFORE_DOWN, this.onBeforeDown, this),
12483
- app.on_(PointerEvent.TAP, this.onTap, this),
12484
- app.on_(DragEvent.START, this.onDragStart, this, true),
12485
- app.on_(DragEvent.DRAG, this.onDrag, this),
12486
- app.on_(DragEvent.END, this.onDragEnd, this),
12487
- app.on_(MoveEvent.MOVE, this.onAutoMove, this),
12488
- app.on_([ZoomEvent.ZOOM, MoveEvent.MOVE], () => { this.editor.hoverTarget = null; }),
12607
+ editor.on_([
12608
+ [EditorEvent.HOVER, this.onHover, this],
12609
+ [EditorEvent.SELECT, this.onSelect, this]
12610
+ ]),
12611
+ app.on_([
12612
+ [PointerEvent.MOVE, this.onPointerMove, this],
12613
+ [PointerEvent.BEFORE_DOWN, this.onBeforeDown, this],
12614
+ [PointerEvent.TAP, this.onTap, this],
12615
+ [DragEvent.START, this.onDragStart, this, true],
12616
+ [DragEvent.DRAG, this.onDrag, this],
12617
+ [DragEvent.END, this.onDragEnd, this],
12618
+ [MoveEvent.MOVE, this.onAutoMove, this],
12619
+ [[ZoomEvent.ZOOM, MoveEvent.MOVE], () => { this.editor.hoverTarget = null; }],
12620
+ ])
12489
12621
  ];
12490
12622
  });
12491
12623
  }
12492
12624
  __removeListenEvents() {
12493
- if (this.__eventIds) {
12494
- this.off_(this.__eventIds);
12495
- this.__eventIds.length = 0;
12496
- }
12625
+ this.off_(this.__eventIds);
12497
12626
  }
12498
12627
  destroy() {
12499
12628
  this.editor = this.originList = this.needRemoveItem = null;
@@ -12782,6 +12911,10 @@ function toDataURL(svg, rotation) {
12782
12911
  }
12783
12912
 
12784
12913
  class EditPoint extends Box {
12914
+ constructor(data) {
12915
+ super(data);
12916
+ this.useFastShadow = true;
12917
+ }
12785
12918
  }
12786
12919
 
12787
12920
  const fourDirection = ['top', 'right', 'bottom', 'left'], editConfig = undefined;
@@ -13052,28 +13185,29 @@ class EditBox extends Group {
13052
13185
  const { editor } = this;
13053
13186
  point.direction = direction;
13054
13187
  point.pointType = type;
13055
- point.on_(DragEvent.START, this.onDragStart, this);
13056
- point.on_(DragEvent.DRAG, this.onDrag, this);
13057
- point.on_(DragEvent.END, this.onDragEnd, this);
13058
- point.on_(PointerEvent.LEAVE, () => this.enterPoint = null);
13188
+ const events = [
13189
+ [DragEvent.START, this.onDragStart, this],
13190
+ [DragEvent.DRAG, this.onDrag, this],
13191
+ [DragEvent.END, this.onDragEnd, this],
13192
+ [PointerEvent.LEAVE, () => { this.enterPoint = null; }],
13193
+ ];
13059
13194
  if (point.name !== 'circle')
13060
- point.on_(PointerEvent.ENTER, (e) => { this.enterPoint = point, updateCursor(editor, e); });
13195
+ events.push([PointerEvent.ENTER, (e) => { this.enterPoint = point, updateCursor(editor, e); }]);
13196
+ this.__eventIds.push(point.on_(events));
13061
13197
  }
13062
13198
  __listenEvents() {
13063
13199
  const { rect, editor } = this;
13064
- this.__eventIds = [
13065
- editor.on_(EditorEvent.SELECT, this.onSelect, this),
13066
- rect.on_(DragEvent.START, this.onDragStart, this),
13067
- rect.on_(DragEvent.DRAG, editor.onMove, editor),
13068
- rect.on_(DragEvent.END, this.onDragEnd, this),
13069
- rect.on_(PointerEvent.ENTER, () => updateMoveCursor(editor)),
13070
- rect.on_(PointerEvent.DOUBLE_TAP, this.onDoubleTap, this),
13071
- rect.on_(PointerEvent.LONG_PRESS, this.onLongPress, this)
13072
- ];
13200
+ this.__eventIds.push(editor.on_(EditorEvent.SELECT, this.onSelect, this), rect.on_([
13201
+ [DragEvent.START, this.onDragStart, this],
13202
+ [DragEvent.DRAG, editor.onMove, editor],
13203
+ [DragEvent.END, this.onDragEnd, this],
13204
+ [PointerEvent.ENTER, () => updateMoveCursor(editor)],
13205
+ [PointerEvent.DOUBLE_TAP, this.onDoubleTap, this],
13206
+ [PointerEvent.LONG_PRESS, this.onLongPress, this]
13207
+ ]));
13073
13208
  }
13074
13209
  __removeListenEvents() {
13075
13210
  this.off_(this.__eventIds);
13076
- this.__eventIds.length = 0;
13077
13211
  }
13078
13212
  destroy() {
13079
13213
  this.editor = null;
@@ -13815,12 +13949,14 @@ class Editor extends Group {
13815
13949
  const { app, leafer, editBox, editMask } = this;
13816
13950
  this.targetEventIds = [
13817
13951
  leafer.on_(RenderEvent.START, this.onRenderStart, this),
13818
- app.on_(RenderEvent.CHILD_START, this.onAppRenderStart, this),
13819
- app.on_(MoveEvent.BEFORE_MOVE, this.onMove, this, true),
13820
- app.on_(ZoomEvent.BEFORE_ZOOM, this.onScale, this, true),
13821
- app.on_(RotateEvent.BEFORE_ROTATE, this.onRotate, this, true),
13822
- app.on_([KeyEvent.HOLD, KeyEvent.UP], this.onKey, this),
13823
- app.on_(KeyEvent.DOWN, editBox.onArrow, editBox)
13952
+ app.on_([
13953
+ [RenderEvent.CHILD_START, this.onAppRenderStart, this],
13954
+ [MoveEvent.BEFORE_MOVE, this.onMove, this, true],
13955
+ [ZoomEvent.BEFORE_ZOOM, this.onScale, this, true],
13956
+ [RotateEvent.BEFORE_ROTATE, this.onRotate, this, true],
13957
+ [[KeyEvent.HOLD, KeyEvent.UP], this.onKey, this],
13958
+ [KeyEvent.DOWN, editBox.onArrow, editBox]
13959
+ ])
13824
13960
  ];
13825
13961
  if (editMask.visible)
13826
13962
  editMask.forceRender();
@@ -13830,7 +13966,6 @@ class Editor extends Group {
13830
13966
  const { targetEventIds, editMask } = this;
13831
13967
  if (targetEventIds.length) {
13832
13968
  this.off_(targetEventIds);
13833
- targetEventIds.length = 0;
13834
13969
  if (editMask.visible)
13835
13970
  editMask.forceRender();
13836
13971
  }
@@ -14299,7 +14434,12 @@ Box.prototype.__scaleResize = function (scaleX, scaleY) {
14299
14434
  Plugin.add('resize');
14300
14435
 
14301
14436
  Plugin.add('editor', 'resize');
14302
- Creator.editor = function (options) { return new Editor(options); };
14437
+ Creator.editor = function (options, app) {
14438
+ const editor = new Editor(options);
14439
+ if (app)
14440
+ app.sky.add(app.editor = editor);
14441
+ return editor;
14442
+ };
14303
14443
  Box.addAttr('textBox', false, dataType);
14304
14444
  UI.addAttr('editConfig', undefined, dataType);
14305
14445
  UI.addAttr('editOuter', (ui) => ui.__.__isLinePath ? 'LineEditTool' : 'EditTool', dataType);
@@ -14602,6 +14742,7 @@ interaction.multiTouch = function (data, list) {
14602
14742
  return;
14603
14743
  const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
14604
14744
  Object.assign(data, center);
14745
+ data.multiTouch = true;
14605
14746
  this.pointerWaitCancel();
14606
14747
  this.rotate(getRotateEventData(rotation, data));
14607
14748
  this.zoom(getZoomEventData(scale, data));
@@ -15141,6 +15282,16 @@ Plugin.add('arrow');
15141
15282
  UI.addAttr('startArrow', 'none', arrowType);
15142
15283
  UI.addAttr('endArrow', 'none', arrowType);
15143
15284
  Object.assign(PathArrow, PathArrowModule);
15285
+ Object.assign(Paint, {
15286
+ strokeArrow(_stroke, ui, canvas) {
15287
+ if (ui.__.dashPattern) {
15288
+ canvas.beginPath();
15289
+ ui.__drawPathByData(canvas, ui.__.__pathForArrow);
15290
+ canvas.dashPattern = null;
15291
+ canvas.stroke();
15292
+ }
15293
+ }
15294
+ });
15144
15295
 
15145
15296
  class FlowData extends BoxData {
15146
15297
  }
@@ -17754,10 +17905,9 @@ const ExportModule = {
17754
17905
  else {
17755
17906
  let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
17756
17907
  const { worldTransform, isLeafer, leafer, isFrame } = leaf;
17757
- const { slice, clip, trim, padding, onCanvas } = options;
17908
+ const { slice, clip, trim, screenshot, padding, onCanvas } = options;
17758
17909
  const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
17759
17910
  const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
17760
- const screenshot = options.screenshot || leaf.isApp;
17761
17911
  const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
17762
17912
  const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
17763
17913
  if (screenshot) {
@@ -17793,11 +17943,6 @@ const ExportModule = {
17793
17943
  const scaleData = { scaleX: 1, scaleY: 1 };
17794
17944
  MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
17795
17945
  let pixelRatio = options.pixelRatio || 1;
17796
- if (leaf.isApp) {
17797
- scaleData.scaleX *= pixelRatio;
17798
- scaleData.scaleY *= pixelRatio;
17799
- pixelRatio = leaf.app.pixelRatio;
17800
- }
17801
17946
  let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
17802
17947
  if (clip)
17803
17948
  x += clip.x, y += clip.y, width = clip.width, height = clip.height;
@@ -17952,4 +18097,4 @@ Object.assign(Filter, {
17952
18097
  }
17953
18098
  });
17954
18099
 
17955
- export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$4 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
18100
+ export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };