@leafer/worker 1.9.6 → 1.9.8

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.
@@ -247,18 +247,34 @@ class LeafData {
247
247
  }
248
248
  }
249
249
 
250
- const {round: round$6, pow: pow$2, PI: PI$4} = Math;
251
-
252
- const MathHelper = {
253
- within(value, min, max) {
254
- if (isObject(min)) max = min.max, min = min.min;
255
- if (!isUndefined(min) && value < min) value = min;
256
- if (!isUndefined(max) && value > max) value = max;
257
- return value;
250
+ let tempA, tempB, tempTo;
251
+
252
+ const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
253
+
254
+ const FourNumberHelper = {
255
+ zero: [ ...tempFour ],
256
+ tempFour: tempFour,
257
+ set(to, top, right, bottom, left) {
258
+ if (right === undefined) right = bottom = left = top;
259
+ to[0] = top;
260
+ to[1] = right;
261
+ to[2] = bottom;
262
+ to[3] = left;
263
+ return to;
264
+ },
265
+ setTemp(top, right, bottom, left) {
266
+ return set$1(tempFour, top, right, bottom, left);
267
+ },
268
+ toTempAB(a, b, change) {
269
+ tempTo = change ? isNumber(a) ? b : a : [];
270
+ if (isNumber(a)) tempA = setTemp(a), tempB = b; else if (isNumber(b)) tempA = a,
271
+ tempB = setTemp(b); else tempA = a, tempB = b;
272
+ if (tempA.length !== 4) tempA = get$5(tempA);
273
+ if (tempB.length !== 4) tempB = get$5(tempB);
258
274
  },
259
- fourNumber(num, maxValue) {
275
+ get(num, maxValue) {
260
276
  let data;
261
- if (isArray(num)) {
277
+ if (!isNumber(num)) {
262
278
  switch (num.length) {
263
279
  case 4:
264
280
  data = isUndefined(maxValue) ? num : [ ...num ];
@@ -281,9 +297,39 @@ const MathHelper = {
281
297
  }
282
298
  }
283
299
  if (!data) data = [ num, num, num, num ];
284
- if (maxValue) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
300
+ if (!isUndefined(maxValue)) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
285
301
  return data;
286
302
  },
303
+ max(t, other, change) {
304
+ if (isNumber(t) && isNumber(other)) return max$5(t, other);
305
+ toTempAB(t, other, change);
306
+ return set$1(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
307
+ },
308
+ add(t, other, change) {
309
+ if (isNumber(t) && isNumber(other)) return t + other;
310
+ toTempAB(t, other, change);
311
+ return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
312
+ },
313
+ swapAndScale(t, scaleX, scaleY, change) {
314
+ if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
315
+ const to = change ? t : [];
316
+ const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
317
+ return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
318
+ }
319
+ };
320
+
321
+ const {set: set$1, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
322
+
323
+ const {round: round$6, pow: pow$2, PI: PI$4} = Math;
324
+
325
+ const MathHelper = {
326
+ within(value, min, max) {
327
+ if (isObject(min)) max = min.max, min = min.min;
328
+ if (!isUndefined(min) && value < min) value = min;
329
+ if (!isUndefined(max) && value > max) value = max;
330
+ return value;
331
+ },
332
+ fourNumber: FourNumberHelper.get,
287
333
  formatRotation(rotation, unsign) {
288
334
  rotation %= 360;
289
335
  if (unsign) {
@@ -423,14 +469,23 @@ const MatrixHelper = {
423
469
  t.c *= scaleY;
424
470
  t.d *= scaleY;
425
471
  },
472
+ pixelScale(t, pixelRatio, to) {
473
+ to || (to = t);
474
+ to.a = t.a * pixelRatio;
475
+ to.b = t.b * pixelRatio;
476
+ to.c = t.c * pixelRatio;
477
+ to.d = t.d * pixelRatio;
478
+ to.e = t.e * pixelRatio;
479
+ to.f = t.f * pixelRatio;
480
+ },
426
481
  scaleOfOuter(t, origin, scaleX, scaleY) {
427
- M$a.toInnerPoint(t, origin, tempPoint$4);
428
- M$a.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
482
+ M$b.toInnerPoint(t, origin, tempPoint$4);
483
+ M$b.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
429
484
  },
430
485
  scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
431
- M$a.translateInner(t, origin.x, origin.y);
432
- M$a.scale(t, scaleX, scaleY);
433
- M$a.translateInner(t, -origin.x, -origin.y);
486
+ M$b.translateInner(t, origin.x, origin.y);
487
+ M$b.scale(t, scaleX, scaleY);
488
+ M$b.translateInner(t, -origin.x, -origin.y);
434
489
  },
435
490
  rotate(t, rotation) {
436
491
  const {a: a, b: b, c: c, d: d} = t;
@@ -443,13 +498,13 @@ const MatrixHelper = {
443
498
  t.d = c * sinR + d * cosR;
444
499
  },
445
500
  rotateOfOuter(t, origin, rotation) {
446
- M$a.toInnerPoint(t, origin, tempPoint$4);
447
- M$a.rotateOfInner(t, tempPoint$4, rotation);
501
+ M$b.toInnerPoint(t, origin, tempPoint$4);
502
+ M$b.rotateOfInner(t, tempPoint$4, rotation);
448
503
  },
449
504
  rotateOfInner(t, origin, rotation) {
450
- M$a.translateInner(t, origin.x, origin.y);
451
- M$a.rotate(t, rotation);
452
- M$a.translateInner(t, -origin.x, -origin.y);
505
+ M$b.translateInner(t, origin.x, origin.y);
506
+ M$b.rotate(t, rotation);
507
+ M$b.translateInner(t, -origin.x, -origin.y);
453
508
  },
454
509
  skew(t, skewX, skewY) {
455
510
  const {a: a, b: b, c: c, d: d} = t;
@@ -465,13 +520,13 @@ const MatrixHelper = {
465
520
  }
466
521
  },
467
522
  skewOfOuter(t, origin, skewX, skewY) {
468
- M$a.toInnerPoint(t, origin, tempPoint$4);
469
- M$a.skewOfInner(t, tempPoint$4, skewX, skewY);
523
+ M$b.toInnerPoint(t, origin, tempPoint$4);
524
+ M$b.skewOfInner(t, tempPoint$4, skewX, skewY);
470
525
  },
471
526
  skewOfInner(t, origin, skewX, skewY = 0) {
472
- M$a.translateInner(t, origin.x, origin.y);
473
- M$a.skew(t, skewX, skewY);
474
- M$a.translateInner(t, -origin.x, -origin.y);
527
+ M$b.translateInner(t, origin.x, origin.y);
528
+ M$b.skew(t, skewX, skewY);
529
+ M$b.translateInner(t, -origin.x, -origin.y);
475
530
  },
476
531
  multiply(t, child) {
477
532
  const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
@@ -510,15 +565,15 @@ const MatrixHelper = {
510
565
  to.f = e * parent.b + f * parent.d + parent.f;
511
566
  },
512
567
  divide(t, child) {
513
- M$a.multiply(t, M$a.tempInvert(child));
568
+ M$b.multiply(t, M$b.tempInvert(child));
514
569
  },
515
570
  divideParent(t, parent) {
516
- M$a.multiplyParent(t, M$a.tempInvert(parent));
571
+ M$b.multiplyParent(t, M$b.tempInvert(parent));
517
572
  },
518
573
  tempInvert(t) {
519
- const {tempMatrix: tempMatrix} = M$a;
520
- M$a.copy(tempMatrix, t);
521
- M$a.invert(tempMatrix);
574
+ const {tempMatrix: tempMatrix} = M$b;
575
+ M$b.copy(tempMatrix, t);
576
+ M$b.invert(tempMatrix);
522
577
  return tempMatrix;
523
578
  },
524
579
  invert(t) {
@@ -596,7 +651,7 @@ const MatrixHelper = {
596
651
  }
597
652
  t.e = x;
598
653
  t.f = y;
599
- if (origin = origin || around) M$a.translateInner(t, -origin.x, -origin.y, !around);
654
+ if (origin = origin || around) M$b.translateInner(t, -origin.x, -origin.y, !around);
600
655
  },
601
656
  getLayout(t, origin, around, firstSkewY) {
602
657
  const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
@@ -657,11 +712,11 @@ const MatrixHelper = {
657
712
  return world;
658
713
  },
659
714
  reset(t) {
660
- M$a.set(t);
715
+ M$b.set(t);
661
716
  }
662
717
  };
663
718
 
664
- const M$a = MatrixHelper;
719
+ const M$b = MatrixHelper;
665
720
 
666
721
  const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
667
722
 
@@ -922,6 +977,10 @@ class Matrix {
922
977
  this.scaleY *= y || x;
923
978
  return this;
924
979
  }
980
+ pixelScale(pixelRatio) {
981
+ MatrixHelper.pixelScale(this, pixelRatio);
982
+ return this;
983
+ }
925
984
  scaleOfOuter(origin, x, y) {
926
985
  MatrixHelper.scaleOfOuter(this, origin, x, y);
927
986
  return this;
@@ -1001,7 +1060,7 @@ class Matrix {
1001
1060
  }
1002
1061
  }
1003
1062
 
1004
- const tempMatrix$1 = new Matrix;
1063
+ const tempMatrix$2 = new Matrix;
1005
1064
 
1006
1065
  const TwoPointBoundsHelper = {
1007
1066
  tempPointBounds: {},
@@ -1151,10 +1210,10 @@ const point$2 = {};
1151
1210
 
1152
1211
  const toPoint$5 = {};
1153
1212
 
1154
- const tempBounds$2 = {};
1213
+ const tempBounds$3 = {};
1155
1214
 
1156
1215
  const BoundsHelper = {
1157
- tempBounds: tempBounds$2,
1216
+ tempBounds: tempBounds$3,
1158
1217
  set(t, x = 0, y = 0, width = 0, height = 0) {
1159
1218
  t.x = x;
1160
1219
  t.y = y;
@@ -1205,19 +1264,11 @@ const BoundsHelper = {
1205
1264
  B.move(t, x, y);
1206
1265
  return t;
1207
1266
  },
1208
- toOffsetOutBounds(t, to, parent) {
1209
- if (!to) {
1210
- to = t;
1211
- } else {
1212
- copy$c(to, t);
1213
- }
1214
- if (parent) {
1215
- to.offsetX = -(B.maxX(parent) - t.x);
1216
- to.offsetY = -(B.maxY(parent) - t.y);
1217
- } else {
1218
- to.offsetX = t.x + t.width;
1219
- to.offsetY = t.y + t.height;
1220
- }
1267
+ toOffsetOutBounds(t, to, offsetBounds) {
1268
+ if (!to) to = t; else copy$c(to, t);
1269
+ if (!offsetBounds) offsetBounds = t;
1270
+ to.offsetX = B.maxX(offsetBounds);
1271
+ to.offsetY = B.maxY(offsetBounds);
1221
1272
  B.move(to, -to.offsetX, -to.offsetY);
1222
1273
  },
1223
1274
  scale(t, scaleX, scaleY = scaleX, onlySize) {
@@ -1231,9 +1282,9 @@ const BoundsHelper = {
1231
1282
  t.height *= scaleY;
1232
1283
  },
1233
1284
  tempToOuterOf(t, matrix) {
1234
- B.copy(tempBounds$2, t);
1235
- B.toOuterOf(tempBounds$2, matrix);
1236
- return tempBounds$2;
1285
+ B.copy(tempBounds$3, t);
1286
+ B.toOuterOf(tempBounds$3, matrix);
1287
+ return tempBounds$3;
1237
1288
  },
1238
1289
  getOuterOf(t, matrix) {
1239
1290
  t = Object.assign({}, t);
@@ -1291,9 +1342,9 @@ const BoundsHelper = {
1291
1342
  put(t, put, align = "center", putScale = 1, changeSize = true, to) {
1292
1343
  to || (to = put);
1293
1344
  if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
1294
- tempBounds$2.width = changeSize ? put.width *= putScale : put.width * putScale;
1295
- tempBounds$2.height = changeSize ? put.height *= putScale : put.height * putScale;
1296
- AlignHelper.toPoint(align, tempBounds$2, t, to, true, true);
1345
+ tempBounds$3.width = changeSize ? put.width *= putScale : put.width * putScale;
1346
+ tempBounds$3.height = changeSize ? put.height *= putScale : put.height * putScale;
1347
+ AlignHelper.toPoint(align, tempBounds$3, t, to, true, true);
1297
1348
  },
1298
1349
  getSpread(t, spread, side) {
1299
1350
  const n = {};
@@ -1363,7 +1414,7 @@ const BoundsHelper = {
1363
1414
  first = false;
1364
1415
  if (!addMode) copy$c(t, bounds);
1365
1416
  } else {
1366
- add$1(t, bounds);
1417
+ add$2(t, bounds);
1367
1418
  }
1368
1419
  }
1369
1420
  }
@@ -1377,7 +1428,7 @@ const BoundsHelper = {
1377
1428
  B.set(t, point.x, point.y);
1378
1429
  },
1379
1430
  addPoint(t, point) {
1380
- add$1(t, point, true);
1431
+ add$2(t, point, true);
1381
1432
  },
1382
1433
  getPoints(t) {
1383
1434
  const {x: x, y: y, width: width, height: height} = t;
@@ -1448,7 +1499,7 @@ const BoundsHelper = {
1448
1499
 
1449
1500
  const B = BoundsHelper;
1450
1501
 
1451
- const {add: add$1, copy: copy$c} = B;
1502
+ const {add: add$2, copy: copy$c} = B;
1452
1503
 
1453
1504
  class Bounds {
1454
1505
  get minX() {
@@ -1593,7 +1644,7 @@ class Bounds {
1593
1644
  }
1594
1645
  }
1595
1646
 
1596
- const tempBounds$1 = new Bounds;
1647
+ const tempBounds$2 = new Bounds;
1597
1648
 
1598
1649
  class AutoBounds {
1599
1650
  constructor(top, right, bottom, left, width, height) {
@@ -2146,7 +2197,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
2146
2197
 
2147
2198
  __decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
2148
2199
 
2149
- const {copy: copy$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2200
+ const {copy: copy$b, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2150
2201
 
2151
2202
  const minSize = {
2152
2203
  width: 1,
@@ -2247,13 +2298,8 @@ class LeaferCanvasBase extends Canvas$1 {
2247
2298
  setWorld(matrix, parentMatrix) {
2248
2299
  const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
2249
2300
  if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
2250
- w.a = matrix.a * pixelRatio;
2251
- w.b = matrix.b * pixelRatio;
2252
- w.c = matrix.c * pixelRatio;
2253
- w.d = matrix.d * pixelRatio;
2254
- w.e = matrix.e * pixelRatio;
2255
- w.f = matrix.f * pixelRatio;
2256
- if (pixelSnap) {
2301
+ pixelScale(matrix, pixelRatio, w);
2302
+ if (pixelSnap && !matrix.ignorePixelSnap) {
2257
2303
  if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$4(w.e - .5) + .5, w.f = round$4(w.f - .5) + .5; else w.e = round$4(w.e),
2258
2304
  w.f = round$4(w.f);
2259
2305
  }
@@ -2552,14 +2598,14 @@ const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
2552
2598
 
2553
2599
  const {set: set, toNumberPoints: toNumberPoints$1} = PointHelper;
2554
2600
 
2555
- const {M: M$9, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
2601
+ const {M: M$a, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
2556
2602
 
2557
2603
  const tempPoint$2 = {};
2558
2604
 
2559
2605
  const BezierHelper = {
2560
2606
  points(data, originPoints, curve, close) {
2561
2607
  let points = toNumberPoints$1(originPoints);
2562
- data.push(M$9, points[0], points[1]);
2608
+ data.push(M$a, points[0], points[1]);
2563
2609
  if (curve && points.length > 5) {
2564
2610
  let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
2565
2611
  let ba, cb, d, len = points.length;
@@ -2666,7 +2712,7 @@ const BezierHelper = {
2666
2712
  let startX = x = rotationCos * radiusX * startCos - rotationSin * radiusY * startSin;
2667
2713
  let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
2668
2714
  let fromX = cx + x, fromY = cy + y;
2669
- if (data) data.push(data.length ? L$a : M$9, fromX, fromY);
2715
+ if (data) data.push(data.length ? L$a : M$a, fromX, fromY);
2670
2716
  if (setPointBounds) setPoint$4(setPointBounds, fromX, fromY);
2671
2717
  if (setStartPoint) set(setStartPoint, fromX, fromY);
2672
2718
  for (let i = 0; i < parts; i++) {
@@ -2796,7 +2842,7 @@ const EllipseHelper = {
2796
2842
  }
2797
2843
  };
2798
2844
 
2799
- const {M: M$8, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
2845
+ const {M: M$9, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
2800
2846
 
2801
2847
  const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
2802
2848
 
@@ -2888,10 +2934,10 @@ const PathConvert = {
2888
2934
  old[i + 1] += x;
2889
2935
  old[i + 2] += y;
2890
2936
 
2891
- case M$8:
2937
+ case M$9:
2892
2938
  x = old[i + 1];
2893
2939
  y = old[i + 2];
2894
- data.push(M$8, x, y);
2940
+ data.push(M$9, x, y);
2895
2941
  i += 3;
2896
2942
  break;
2897
2943
 
@@ -3078,7 +3124,7 @@ const PathConvert = {
3078
3124
  list.forEach(item => {
3079
3125
  switch (item.name) {
3080
3126
  case "M":
3081
- data.push(M$8, item.x, item.y);
3127
+ data.push(M$9, item.x, item.y);
3082
3128
  break;
3083
3129
 
3084
3130
  case "L":
@@ -3117,7 +3163,7 @@ const PathConvert = {
3117
3163
 
3118
3164
  const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
3119
3165
 
3120
- const {M: M$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
3166
+ const {M: M$8, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
3121
3167
 
3122
3168
  const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
3123
3169
 
@@ -3130,7 +3176,7 @@ const PathCommandDataHelper = {
3130
3176
  data.length = 0;
3131
3177
  },
3132
3178
  moveTo(data, x, y) {
3133
- data.push(M$7, x, y);
3179
+ data.push(M$8, x, y);
3134
3180
  },
3135
3181
  lineTo(data, x, y) {
3136
3182
  data.push(L$8, x, y);
@@ -3185,12 +3231,12 @@ const PathCommandDataHelper = {
3185
3231
  },
3186
3232
  drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
3187
3233
  BezierHelper.ellipse(null, x, y, radiusX, radiusY, isNull(rotation) ? 0 : rotation, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
3188
- data.push(M$7, startPoint.x, startPoint.y);
3234
+ data.push(M$8, startPoint.x, startPoint.y);
3189
3235
  ellipse$3(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
3190
3236
  },
3191
3237
  drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
3192
3238
  BezierHelper.arc(null, x, y, radius, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
3193
- data.push(M$7, startPoint.x, startPoint.y);
3239
+ data.push(M$8, startPoint.x, startPoint.y);
3194
3240
  arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
3195
3241
  },
3196
3242
  drawPoints(data, points, curve, close) {
@@ -3292,7 +3338,7 @@ class PathCreator {
3292
3338
  paint() {}
3293
3339
  }
3294
3340
 
3295
- const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3} = PathCommandMap;
3341
+ const {M: M$7, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3} = PathCommandMap;
3296
3342
 
3297
3343
  const debug$e = Debug.get("PathDrawer");
3298
3344
 
@@ -3304,7 +3350,7 @@ const PathDrawer = {
3304
3350
  while (i < len) {
3305
3351
  command = data[i];
3306
3352
  switch (command) {
3307
- case M$6:
3353
+ case M$7:
3308
3354
  drawer.moveTo(data[i + 1], data[i + 2]);
3309
3355
  i += 3;
3310
3356
  break;
@@ -3377,7 +3423,7 @@ const PathDrawer = {
3377
3423
  }
3378
3424
  };
3379
3425
 
3380
- const {M: M$5, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = PathCommandMap;
3426
+ const {M: M$6, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = PathCommandMap;
3381
3427
 
3382
3428
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3383
3429
 
@@ -3412,7 +3458,7 @@ const PathBounds = {
3412
3458
  }
3413
3459
  }
3414
3460
  switch (command) {
3415
- case M$5:
3461
+ case M$6:
3416
3462
  case L$6:
3417
3463
  x = data[i + 1];
3418
3464
  y = data[i + 2];
@@ -3512,7 +3558,7 @@ const PathBounds = {
3512
3558
  }
3513
3559
  };
3514
3560
 
3515
- const {M: M$4, L: L$5, Z: Z$3} = PathCommandMap;
3561
+ const {M: M$5, L: L$5, Z: Z$3} = PathCommandMap;
3516
3562
 
3517
3563
  const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
3518
3564
 
@@ -3527,16 +3573,16 @@ const PathCorner = {
3527
3573
  while (i < len) {
3528
3574
  command = data[i];
3529
3575
  switch (command) {
3530
- case M$4:
3576
+ case M$5:
3531
3577
  startX = lastX = data[i + 1];
3532
3578
  startY = lastY = data[i + 2];
3533
3579
  i += 3;
3534
3580
  if (data[i] === L$5) {
3535
3581
  secondX = data[i + 1];
3536
3582
  secondY = data[i + 2];
3537
- smooth.push(M$4, getCenterX(startX, secondX), getCenterY(startY, secondY));
3583
+ smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
3538
3584
  } else {
3539
- smooth.push(M$4, startX, startY);
3585
+ smooth.push(M$5, startX, startY);
3540
3586
  }
3541
3587
  break;
3542
3588
 
@@ -3977,7 +4023,7 @@ const I$1 = ImageManager;
3977
4023
 
3978
4024
  const {IMAGE: IMAGE, create: create$1} = IncrementId;
3979
4025
 
3980
- const {floor: floor$2, max: max$2} = Math;
4026
+ const {floor: floor$2, max: max$4} = Math;
3981
4027
 
3982
4028
  class LeaferImage {
3983
4029
  get url() {
@@ -4066,7 +4112,7 @@ class LeaferImage {
4066
4112
  }
4067
4113
  if (data) return data;
4068
4114
  }
4069
- const canvas = Platform.origin.createCanvas(max$2(floor$2(width + (xGap || 0)), 1), max$2(floor$2(height + (yGap || 0)), 1));
4115
+ const canvas = Platform.origin.createCanvas(max$4(floor$2(width + (xGap || 0)), 1), max$4(floor$2(height + (yGap || 0)), 1));
4070
4116
  const ctx = canvas.getContext("2d");
4071
4117
  if (opacity) ctx.globalAlpha = opacity;
4072
4118
  ctx.imageSmoothingEnabled = smooth === false ? false : true;
@@ -4265,6 +4311,18 @@ function surfaceType(defaultValue) {
4265
4311
  }));
4266
4312
  }
4267
4313
 
4314
+ function dimType(defaultValue) {
4315
+ return decorateLeafAttr(defaultValue, key => attr({
4316
+ set(value) {
4317
+ if (this.__setAttr(key, value)) {
4318
+ const data = this.__;
4319
+ DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
4320
+ this.__layout.surfaceChange();
4321
+ }
4322
+ }
4323
+ }));
4324
+ }
4325
+
4268
4326
  function opacityType(defaultValue) {
4269
4327
  return decorateLeafAttr(defaultValue, key => attr({
4270
4328
  set(value) {
@@ -4309,7 +4367,7 @@ function sortType(defaultValue) {
4309
4367
  return decorateLeafAttr(defaultValue, key => attr({
4310
4368
  set(value) {
4311
4369
  if (this.__setAttr(key, value)) {
4312
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
4370
+ this.__layout.surfaceChange();
4313
4371
  this.waitParent(() => {
4314
4372
  this.parent.__layout.childrenSortChange();
4315
4373
  });
@@ -4346,7 +4404,7 @@ function hitType(defaultValue) {
4346
4404
  set(value) {
4347
4405
  if (this.__setAttr(key, value)) {
4348
4406
  this.__layout.hitCanvasChanged = true;
4349
- if (Debug.showBounds === "hit") this.__layout.surfaceChanged || this.__layout.surfaceChange();
4407
+ if (Debug.showBounds === "hit") this.__layout.surfaceChange();
4350
4408
  if (this.leafer) this.leafer.updateCursor();
4351
4409
  }
4352
4410
  }
@@ -4848,7 +4906,7 @@ const WaitHelper = {
4848
4906
 
4849
4907
  const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
4850
4908
 
4851
- const {toOuterOf: toOuterOf$2, getPoints: getPoints, copy: copy$8} = BoundsHelper;
4909
+ const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$8} = BoundsHelper;
4852
4910
 
4853
4911
  const localContent = "_localContentBounds";
4854
4912
 
@@ -4871,7 +4929,7 @@ class LeafLayout {
4871
4929
  this._renderBounds = bounds;
4872
4930
  }
4873
4931
  get localContentBounds() {
4874
- toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
4932
+ toOuterOf$3(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
4875
4933
  return this[localContent];
4876
4934
  }
4877
4935
  get localStrokeBounds() {
@@ -4881,15 +4939,15 @@ class LeafLayout {
4881
4939
  return this._localRenderBounds || this;
4882
4940
  }
4883
4941
  get worldContentBounds() {
4884
- toOuterOf$2(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
4942
+ toOuterOf$3(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
4885
4943
  return this[worldContent];
4886
4944
  }
4887
4945
  get worldBoxBounds() {
4888
- toOuterOf$2(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
4946
+ toOuterOf$3(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
4889
4947
  return this[worldBox];
4890
4948
  }
4891
4949
  get worldStrokeBounds() {
4892
- toOuterOf$2(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
4950
+ toOuterOf$3(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
4893
4951
  return this[worldStroke];
4894
4952
  }
4895
4953
  get a() {
@@ -5741,14 +5799,14 @@ const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafH
5741
5799
 
5742
5800
  const {updateBounds: updateBounds$2} = BranchHelper;
5743
5801
 
5744
- const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$2, copy: copy$7} = BoundsHelper;
5802
+ const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$7} = BoundsHelper;
5745
5803
 
5746
5804
  const {toBounds: toBounds$1} = PathBounds;
5747
5805
 
5748
5806
  const LeafBounds = {
5749
5807
  __updateWorldBounds() {
5750
5808
  const layout = this.__layout;
5751
- toOuterOf$1(layout.renderBounds, this.__world, this.__world);
5809
+ toOuterOf$2(layout.renderBounds, this.__world, this.__world);
5752
5810
  if (layout.resized) {
5753
5811
  if (layout.resized === "inner") this.__onUpdateSize();
5754
5812
  if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
@@ -5804,13 +5862,13 @@ const LeafBounds = {
5804
5862
  __updateLocalBoxBounds() {
5805
5863
  if (this.__hasMotionPath) this.__updateMotionPath();
5806
5864
  if (this.__hasAutoLayout) this.__updateAutoLayout();
5807
- toOuterOf$1(this.__layout.boxBounds, this.__local, this.__local);
5865
+ toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
5808
5866
  },
5809
5867
  __updateLocalStrokeBounds() {
5810
- toOuterOf$1(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
5868
+ toOuterOf$2(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
5811
5869
  },
5812
5870
  __updateLocalRenderBounds() {
5813
- toOuterOf$1(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
5871
+ toOuterOf$2(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
5814
5872
  },
5815
5873
  __updateBoxBounds(_secondLayout, _bounds) {
5816
5874
  const b = this.__layout.boxBounds;
@@ -5848,11 +5906,11 @@ const LeafBounds = {
5848
5906
  },
5849
5907
  __updateStrokeBounds(_bounds) {
5850
5908
  const layout = this.__layout;
5851
- copyAndSpread$2(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5909
+ copyAndSpread$3(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5852
5910
  },
5853
5911
  __updateRenderBounds(_bounds) {
5854
- const layout = this.__layout;
5855
- layout.renderSpread > 0 ? copyAndSpread$2(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$7(layout.renderBounds, layout.strokeBounds);
5912
+ const layout = this.__layout, {renderSpread: renderSpread} = layout;
5913
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$7(layout.renderBounds, layout.strokeBounds) : copyAndSpread$3(layout.renderBounds, layout.boxBounds, renderSpread);
5856
5914
  }
5857
5915
  };
5858
5916
 
@@ -5861,6 +5919,7 @@ const LeafRender = {
5861
5919
  if (options.shape) return this.__renderShape(canvas, options);
5862
5920
  if (this.__worldOpacity) {
5863
5921
  const data = this.__;
5922
+ if (data.bright && !options.topRendering) return options.topList.add(this);
5864
5923
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5865
5924
  canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5866
5925
  if (this.__.__single) {
@@ -5909,7 +5968,9 @@ const BranchRender = {
5909
5968
  this.__nowWorld = this.__getNowWorld(options);
5910
5969
  if (this.__worldOpacity) {
5911
5970
  const data = this.__;
5912
- if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5971
+ if (data.__useDim) {
5972
+ if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5973
+ }
5913
5974
  if (data.__single && !this.isBranchLeaf) {
5914
5975
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5915
5976
  const tempCanvas = canvas.getSameCanvas(false, true);
@@ -5947,11 +6008,13 @@ const tempScaleData$1 = {};
5947
6008
 
5948
6009
  const {LEAF: LEAF, create: create} = IncrementId;
5949
6010
 
6011
+ const {stintSet: stintSet$3} = DataHelper;
6012
+
5950
6013
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
5951
6014
 
5952
- const {toOuterOf: toOuterOf} = BoundsHelper;
6015
+ const {toOuterOf: toOuterOf$1} = BoundsHelper;
5953
6016
 
5954
- const {copy: copy$6, move: move$6} = PointHelper;
6017
+ const {copy: copy$6, move: move$8} = PointHelper;
5955
6018
 
5956
6019
  const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
5957
6020
 
@@ -6227,8 +6290,9 @@ let Leaf = class Leaf {
6227
6290
  if (!this.__cameraWorld) this.__cameraWorld = {};
6228
6291
  const cameraWorld = this.__cameraWorld, world = this.__world;
6229
6292
  multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
6230
- toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
6231
- cameraWorld.half !== world.half && (cameraWorld.half = world.half);
6293
+ toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
6294
+ stintSet$3(cameraWorld, "half", world.half);
6295
+ stintSet$3(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6232
6296
  return cameraWorld;
6233
6297
  } else {
6234
6298
  return this.__world;
@@ -6262,7 +6326,7 @@ let Leaf = class Leaf {
6262
6326
  getWorldBounds(inner, relative, change) {
6263
6327
  const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
6264
6328
  const to = change ? inner : {};
6265
- toOuterOf(inner, matrix, to);
6329
+ toOuterOf$1(inner, matrix, to);
6266
6330
  return to;
6267
6331
  }
6268
6332
  worldToLocal(world, to, distance, relative) {
@@ -6295,7 +6359,7 @@ let Leaf = class Leaf {
6295
6359
  }
6296
6360
  getBoxPointByInner(inner, _relative, _distance, change) {
6297
6361
  const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
6298
- move$6(point, -x, -y);
6362
+ move$8(point, -x, -y);
6299
6363
  return point;
6300
6364
  }
6301
6365
  getInnerPoint(world, relative, distance, change) {
@@ -6305,7 +6369,7 @@ let Leaf = class Leaf {
6305
6369
  }
6306
6370
  getInnerPointByBox(box, _relative, _distance, change) {
6307
6371
  const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
6308
- move$6(point, x, y);
6372
+ move$8(point, x, y);
6309
6373
  return point;
6310
6374
  }
6311
6375
  getInnerPointByLocal(local, _relative, distance, change) {
@@ -6751,7 +6815,7 @@ class LeafLevelList {
6751
6815
  }
6752
6816
  }
6753
6817
 
6754
- const version = "1.9.6";
6818
+ const version = "1.9.8";
6755
6819
 
6756
6820
  class LeaferCanvas extends LeaferCanvasBase {
6757
6821
  get allowBackgroundColor() {
@@ -7176,6 +7240,7 @@ class Renderer {
7176
7240
  usePartRender: true,
7177
7241
  maxFPS: 120
7178
7242
  };
7243
+ this.frames = [];
7179
7244
  this.target = target;
7180
7245
  this.canvas = canvas;
7181
7246
  if (userConfig) this.config = DataHelper.default(userConfig, this.config);
@@ -7305,7 +7370,7 @@ class Renderer {
7305
7370
  };
7306
7371
  if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
7307
7372
  if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
7308
- this.target.__render(canvas, options);
7373
+ Platform.render(this.target, canvas, options);
7309
7374
  this.renderBounds = realBounds = realBounds || bounds;
7310
7375
  this.renderOptions = options;
7311
7376
  this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
@@ -7328,12 +7393,15 @@ class Renderer {
7328
7393
  const target = this.target;
7329
7394
  if (this.requestTime || !target) return;
7330
7395
  if (target.parentApp) return target.parentApp.requestRender(false);
7331
- const requestTime = this.requestTime = Date.now();
7396
+ this.requestTime = this.frameTime || Date.now();
7332
7397
  const render = () => {
7333
- const nowFPS = 1e3 / (Date.now() - requestTime);
7398
+ const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
7334
7399
  const {maxFPS: maxFPS} = this.config;
7335
- if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
7336
- this.FPS = Math.min(120, Math.ceil(nowFPS));
7400
+ if (maxFPS && nowFPS > maxFPS) return Platform.requestRender(render);
7401
+ const {frames: frames} = this;
7402
+ if (frames.length > 30) frames.shift();
7403
+ frames.push(nowFPS);
7404
+ this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
7337
7405
  this.requestTime = 0;
7338
7406
  this.checkRender();
7339
7407
  };
@@ -7581,6 +7649,15 @@ Object.assign(Creator, {
7581
7649
 
7582
7650
  Platform.layout = Layouter.fullLayout;
7583
7651
 
7652
+ Platform.render = function(target, canvas, options) {
7653
+ const topOptions = Object.assign(Object.assign({}, options), {
7654
+ topRendering: true
7655
+ });
7656
+ options.topList = new LeafList;
7657
+ target.__render(canvas, options);
7658
+ if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
7659
+ };
7660
+
7584
7661
  function effectType(defaultValue) {
7585
7662
  return decorateLeafAttr(defaultValue, key => attr({
7586
7663
  set(value) {
@@ -7980,39 +8057,41 @@ class CanvasData extends RectData {
7980
8057
  }
7981
8058
  }
7982
8059
 
8060
+ const {max: max$3, add: add$1} = FourNumberHelper;
8061
+
7983
8062
  const UIBounds = {
7984
8063
  __updateStrokeSpread() {
7985
- let width = 0, boxWidth = 0;
8064
+ let spread = 0, boxSpread = 0;
7986
8065
  const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
7987
8066
  if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
7988
- boxWidth = width = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
8067
+ boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
7989
8068
  if (!data.__boxStroke) {
7990
- const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
8069
+ const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
7991
8070
  const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
7992
- width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
8071
+ spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
7993
8072
  }
7994
8073
  }
7995
- if (data.__useArrow) width += strokeWidth * 5;
8074
+ if (data.__useArrow) spread += strokeWidth * 5;
7996
8075
  if (box) {
7997
- width = Math.max(box.__layout.strokeSpread = box.__updateStrokeSpread(), width);
7998
- boxWidth = box.__layout.strokeBoxSpread;
8076
+ spread = max$3(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
8077
+ boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
7999
8078
  }
8000
- this.__layout.strokeBoxSpread = boxWidth;
8001
- return width;
8079
+ this.__layout.strokeBoxSpread = boxSpread;
8080
+ return spread;
8002
8081
  },
8003
8082
  __updateRenderSpread() {
8004
- let width = 0;
8005
- const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
8006
- if (shadow) width = Effect.getShadowSpread(this, shadow);
8007
- if (blur) width = Math.max(width, blur);
8008
- if (filter) width += Filter.getSpread(filter);
8009
- if (renderSpread) width += renderSpread;
8010
- let shapeWidth = width = Math.ceil(width);
8011
- if (innerShadow) innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
8012
- if (backgroundBlur) shapeWidth = Math.max(shapeWidth, backgroundBlur);
8013
- this.__layout.renderShapeSpread = shapeWidth;
8014
- width += this.__layout.strokeSpread || 0;
8015
- return this.__box ? Math.max(this.__box.__updateRenderSpread(), width) : width;
8083
+ let spread = 0;
8084
+ const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
8085
+ if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
8086
+ if (blur) spread = max$3(spread, blur);
8087
+ if (filter) spread = add$1(spread, Filter.getSpread(filter));
8088
+ if (renderSpread) spread = add$1(spread, renderSpread);
8089
+ if (strokeSpread) spread = add$1(spread, strokeSpread);
8090
+ let shapeSpread = spread;
8091
+ if (innerShadow) shapeSpread = max$3(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
8092
+ if (backgroundBlur) shapeSpread = max$3(shapeSpread, backgroundBlur);
8093
+ this.__layout.renderShapeSpread = shapeSpread;
8094
+ return box ? max$3(box.__updateRenderSpread(), spread) : spread;
8016
8095
  }
8017
8096
  };
8018
8097
 
@@ -8356,9 +8435,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
8356
8435
 
8357
8436
  __decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
8358
8437
 
8359
- __decorate([ surfaceType(false) ], UI.prototype, "dim", void 0);
8438
+ __decorate([ dimType(false) ], UI.prototype, "dim", void 0);
8360
8439
 
8361
- __decorate([ surfaceType(false) ], UI.prototype, "dimskip", void 0);
8440
+ __decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
8362
8441
 
8363
8442
  __decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
8364
8443
 
@@ -9323,7 +9402,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
9323
9402
 
9324
9403
  Canvas = __decorate([ registerUI() ], Canvas);
9325
9404
 
9326
- const {copyAndSpread: copyAndSpread$1, includes: includes, spread: spread, setList: setList} = BoundsHelper;
9405
+ const {copyAndSpread: copyAndSpread$2, includes: includes, spread: spread, setList: setList} = BoundsHelper;
9327
9406
 
9328
9407
  let Text = class Text extends UI {
9329
9408
  get __tag() {
@@ -9370,13 +9449,13 @@ let Text = class Text extends UI {
9370
9449
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9371
9450
  }
9372
9451
  __updateRenderSpread() {
9373
- let width = super.__updateRenderSpread();
9374
- if (!width) width = this.isOverflow ? 1 : 0;
9375
- return width;
9452
+ let spread = super.__updateRenderSpread();
9453
+ if (!spread) spread = this.isOverflow ? 1 : 0;
9454
+ return spread;
9376
9455
  }
9377
9456
  __updateRenderBounds() {
9378
9457
  const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
9379
- copyAndSpread$1(renderBounds, this.__.__textBoxBounds, renderSpread);
9458
+ copyAndSpread$2(renderBounds, this.__.__textBoxBounds, renderSpread);
9380
9459
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9381
9460
  }
9382
9461
  __updateChange() {
@@ -9802,9 +9881,9 @@ let DragEvent = class DragEvent extends PointerEvent {
9802
9881
  static setData(data) {
9803
9882
  this.data = data;
9804
9883
  }
9805
- static getValidMove(leaf, start, total, checkLimit = true) {
9806
- const move = leaf.getLocalPoint(total, null, true);
9807
- PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9884
+ static getValidMove(leaf, localStart, worldTotal, checkLimit = true) {
9885
+ const move = leaf.getLocalPoint(worldTotal, null, true);
9886
+ PointHelper.move(move, localStart.x - leaf.x, localStart.y - leaf.y);
9808
9887
  if (checkLimit) this.limitMove(leaf, move);
9809
9888
  DragBoundsHelper.axisMove(leaf, move);
9810
9889
  return move;
@@ -10834,8 +10913,8 @@ ui$5.__updateHitCanvas = function() {
10834
10913
  if (isHitPixel) {
10835
10914
  const {renderBounds: renderBounds} = this.__layout;
10836
10915
  const size = Platform.image.hitCanvasSize;
10837
- const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
10838
- const {x: x, y: y, width: width, height: height} = tempBounds$1.set(renderBounds).scale(scale);
10916
+ const scale = h.hitScale = tempBounds$2.set(0, 0, size, size).getFitMatrix(renderBounds).a;
10917
+ const {x: x, y: y, width: width, height: height} = tempBounds$2.set(renderBounds).scale(scale);
10839
10918
  h.resize({
10840
10919
  width: width,
10841
10920
  height: height,
@@ -10932,8 +11011,8 @@ canvas$1.hitStroke = function(point, strokeWidth) {
10932
11011
  canvas$1.hitPixel = function(radiusPoint, offset, scale = 1) {
10933
11012
  let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
10934
11013
  if (offset) x -= offset.x, y -= offset.y;
10935
- tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
10936
- const {data: data} = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
11014
+ tempBounds$2.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
11015
+ const {data: data} = this.context.getImageData(tempBounds$2.x, tempBounds$2.y, tempBounds$2.width || 1, tempBounds$2.height || 1);
10937
11016
  for (let i = 0, len = data.length; i < len; i += 4) {
10938
11017
  if (data[i + 3] > 0) return true;
10939
11018
  }
@@ -11133,24 +11212,29 @@ function drawOutside(stroke, ui, canvas) {
11133
11212
  }
11134
11213
  }
11135
11214
 
11136
- const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
11215
+ const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
11216
+
11217
+ const tempBounds$1 = {};
11137
11218
 
11138
11219
  function shape(ui, current, options) {
11139
11220
  const canvas = current.getSameCanvas();
11140
- const nowWorld = ui.__nowWorld, currentBounds = current.bounds;
11141
- let bounds, matrix, fitMatrix, shapeBounds, worldCanvas;
11221
+ const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
11222
+ const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
11223
+ toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$1, layout.boxBounds, layout.strokeSpread),
11224
+ tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
11225
+ let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
11142
11226
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
11143
- if (currentBounds.includes(nowWorld)) {
11227
+ if (currentBounds.includes(nowWorldShapeBounds)) {
11144
11228
  worldCanvas = canvas;
11145
- bounds = shapeBounds = nowWorld;
11229
+ bounds = shapeBounds = nowWorldShapeBounds;
11230
+ renderBounds = nowWorld;
11146
11231
  } else {
11147
- const {renderShapeSpread: spread} = ui.__layout;
11148
11232
  let worldClipBounds;
11149
11233
  if (Platform.fullImageShadow) {
11150
- worldClipBounds = nowWorld;
11234
+ worldClipBounds = nowWorldShapeBounds;
11151
11235
  } else {
11152
- const spreadBounds = spread ? getSpread(currentBounds, scaleX === scaleY ? spread * scaleX : [ spread * scaleY, spread * scaleX ]) : currentBounds;
11153
- worldClipBounds = getIntersectData(spreadBounds, nowWorld);
11236
+ const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
11237
+ worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
11154
11238
  }
11155
11239
  fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
11156
11240
  let {a: fitScaleX, d: fitScaleY} = fitMatrix;
@@ -11160,8 +11244,10 @@ function shape(ui, current, options) {
11160
11244
  scaleX *= fitScaleX;
11161
11245
  scaleY *= fitScaleY;
11162
11246
  }
11163
- shapeBounds = getOuterOf(nowWorld, fitMatrix);
11247
+ shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
11164
11248
  bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
11249
+ renderBounds = getOuterOf(nowWorld, fitMatrix);
11250
+ move$7(renderBounds, -fitMatrix.e, -fitMatrix.f);
11165
11251
  const userMatrix = options.matrix;
11166
11252
  if (userMatrix) {
11167
11253
  matrix = new Matrix(fitMatrix);
@@ -11180,6 +11266,7 @@ function shape(ui, current, options) {
11180
11266
  matrix: matrix,
11181
11267
  fitMatrix: fitMatrix,
11182
11268
  bounds: bounds,
11269
+ renderBounds: renderBounds,
11183
11270
  worldCanvas: worldCanvas,
11184
11271
  shapeBounds: shapeBounds,
11185
11272
  scaleX: scaleX,
@@ -11283,7 +11370,7 @@ const PaintModule = {
11283
11370
  shape: shape
11284
11371
  };
11285
11372
 
11286
- let origin$1 = {}, tempMatrix = getMatrixData();
11373
+ let origin$1 = {}, tempMatrix$1 = getMatrixData();
11287
11374
 
11288
11375
  const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
11289
11376
 
@@ -11298,12 +11385,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
11298
11385
  data.transform = transform;
11299
11386
  }
11300
11387
 
11301
- function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
11388
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
11302
11389
  const transform = get$3();
11303
11390
  layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
11304
- if (clipSize) {
11305
- tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
11306
- multiplyParent(transform, tempMatrix);
11391
+ if (clipScaleX) {
11392
+ tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
11393
+ multiplyParent(transform, tempMatrix$1);
11307
11394
  }
11308
11395
  data.transform = transform;
11309
11396
  }
@@ -11404,7 +11491,12 @@ function getPatternData(paint, box, image) {
11404
11491
 
11405
11492
  case "normal":
11406
11493
  case "clip":
11407
- if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
11494
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
11495
+ let clipScaleX, clipScaleY;
11496
+ if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
11497
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
11498
+ if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
11499
+ }
11408
11500
  break;
11409
11501
 
11410
11502
  case "repeat":
@@ -11562,7 +11654,7 @@ function ignoreRender(ui, value) {
11562
11654
 
11563
11655
  const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
11564
11656
 
11565
- const {floor: floor$1, ceil: ceil$1, max: max$1, abs: abs$4} = Math;
11657
+ const {floor: floor$1, ceil: ceil$1, max: max$2, abs: abs$4} = Math;
11566
11658
 
11567
11659
  function createPattern(ui, paint, pixelRatio) {
11568
11660
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
@@ -11611,8 +11703,8 @@ function createPattern(ui, paint, pixelRatio) {
11611
11703
  if (transform || scaleX !== 1 || scaleY !== 1) {
11612
11704
  const canvasWidth = width + (xGap || 0);
11613
11705
  const canvasHeight = height + (yGap || 0);
11614
- scaleX /= canvasWidth / max$1(floor$1(canvasWidth), 1);
11615
- scaleY /= canvasHeight / max$1(floor$1(canvasHeight), 1);
11706
+ scaleX /= canvasWidth / max$2(floor$1(canvasWidth), 1);
11707
+ scaleY /= canvasHeight / max$2(floor$1(canvasHeight), 1);
11616
11708
  if (!imageMatrix) {
11617
11709
  imageMatrix = get$1();
11618
11710
  if (transform) copy$4(imageMatrix, transform);
@@ -11638,17 +11730,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
11638
11730
  if (allowDraw) {
11639
11731
  if (data.repeat) {
11640
11732
  allowDraw = false;
11641
- } else {
11642
- if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
11643
- let {width: width, height: height} = data;
11644
- width *= scaleX * pixelRatio;
11645
- height *= scaleY * pixelRatio;
11646
- if (data.scaleX) {
11647
- width *= data.scaleX;
11648
- height *= data.scaleY;
11649
- }
11650
- allowDraw = width * height > Platform.image.maxCacheSize;
11733
+ } else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
11734
+ let {width: width, height: height} = data;
11735
+ width *= scaleX * pixelRatio;
11736
+ height *= scaleY * pixelRatio;
11737
+ if (data.scaleX) {
11738
+ width *= data.scaleX;
11739
+ height *= data.scaleY;
11651
11740
  }
11741
+ allowDraw = width * height > Platform.image.maxCacheSize;
11652
11742
  }
11653
11743
  }
11654
11744
  if (allowDraw) {
@@ -11828,20 +11918,20 @@ const PaintGradientModule = {
11828
11918
  getTransform: getTransform
11829
11919
  };
11830
11920
 
11831
- const {copy: copy$3, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
11921
+ const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1} = Math;
11832
11922
 
11833
- const tempBounds = {};
11923
+ const tempBounds = {}, tempMatrix = new Matrix;
11834
11924
 
11835
11925
  const offsetOutBounds$1 = {};
11836
11926
 
11837
11927
  function shadow$1(ui, current, shape) {
11838
- let copyBounds, spreadScale;
11839
- const {__nowWorld: nowWorld, __layout: __layout} = ui;
11928
+ let copyBounds, transform;
11929
+ const {__nowWorld: nowWorld} = ui;
11840
11930
  const {shadow: shadow} = ui.__;
11841
- const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
11931
+ const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
11842
11932
  const other = current.getSameCanvas();
11843
11933
  const end = shadow.length - 1;
11844
- toOffsetOutBounds$1(bounds, offsetOutBounds$1);
11934
+ toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
11845
11935
  shadow.forEach((item, index) => {
11846
11936
  let otherScale = 1;
11847
11937
  if (item.scaleFixed) {
@@ -11849,54 +11939,61 @@ function shadow$1(ui, current, shape) {
11849
11939
  if (sx > 1) otherScale = 1 / sx;
11850
11940
  }
11851
11941
  other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
11852
- spreadScale = item.spread ? 1 + item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) * otherScale : 0;
11853
- drawWorldShadow(other, offsetOutBounds$1, spreadScale, shape);
11854
- copyBounds = bounds;
11942
+ transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
11943
+ if (transform) other.setTransform(transform);
11944
+ drawWorldShadow(other, offsetOutBounds$1, shape);
11945
+ if (transform) other.resetTransform();
11946
+ copyBounds = renderBounds;
11855
11947
  if (item.box) {
11856
11948
  other.restore();
11857
11949
  other.save();
11858
11950
  if (worldCanvas) {
11859
- other.copyWorld(other, bounds, nowWorld, "copy");
11951
+ other.copyWorld(other, renderBounds, nowWorld, "copy");
11860
11952
  copyBounds = nowWorld;
11861
11953
  }
11862
11954
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
11863
11955
  }
11864
- if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11956
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11865
11957
  if (end && index < end) other.clearWorld(copyBounds);
11866
11958
  });
11867
11959
  other.recycle(copyBounds);
11868
11960
  }
11869
11961
 
11870
- function getShadowSpread(_ui, shadow) {
11871
- let width = 0;
11872
- shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
11873
- return width;
11962
+ function getShadowRenderSpread(_ui, shadow) {
11963
+ let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
11964
+ shadow.forEach(item => {
11965
+ x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
11966
+ top = max$1(top, spread + blur - y);
11967
+ right = max$1(right, spread + blur + x);
11968
+ bottom = max$1(bottom, spread + blur + y);
11969
+ left = max$1(left, spread + blur - x);
11970
+ });
11971
+ return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
11874
11972
  }
11875
11973
 
11876
- function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
11877
- const {bounds: bounds, shapeBounds: shapeBounds} = shape;
11974
+ function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
11975
+ if (shadow.spread) {
11976
+ const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
11977
+ tempMatrix.set().scaleOfOuter({
11978
+ x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
11979
+ y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
11980
+ }, spreadScale);
11981
+ return tempMatrix;
11982
+ }
11983
+ return undefined;
11984
+ }
11985
+
11986
+ function drawWorldShadow(canvas, outBounds, shape) {
11987
+ const {shapeBounds: shapeBounds} = shape;
11988
+ let from, to;
11878
11989
  if (Platform.fullImageShadow) {
11879
11990
  copy$3(tempBounds, canvas.bounds);
11880
- tempBounds.x += outBounds.x - shapeBounds.x;
11881
- tempBounds.y += outBounds.y - shapeBounds.y;
11882
- if (spreadScale) {
11883
- const {fitMatrix: fitMatrix} = shape;
11884
- tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
11885
- tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
11886
- tempBounds.width *= spreadScale;
11887
- tempBounds.height *= spreadScale;
11888
- }
11889
- canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
11991
+ move$6(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
11992
+ from = canvas.bounds, to = tempBounds;
11890
11993
  } else {
11891
- if (spreadScale) {
11892
- copy$3(tempBounds, outBounds);
11893
- tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
11894
- tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
11895
- tempBounds.width *= spreadScale;
11896
- tempBounds.height *= spreadScale;
11897
- }
11898
- canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
11994
+ from = shapeBounds, to = outBounds;
11899
11995
  }
11996
+ canvas.copyWorld(shape.canvas, from, to);
11900
11997
  }
11901
11998
 
11902
11999
  const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
@@ -11904,13 +12001,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
11904
12001
  const offsetOutBounds = {};
11905
12002
 
11906
12003
  function innerShadow(ui, current, shape) {
11907
- let copyBounds, spreadScale;
11908
- const {__nowWorld: nowWorld, __layout: __layout} = ui;
12004
+ let copyBounds, transform;
12005
+ const {__nowWorld: nowWorld} = ui;
11909
12006
  const {innerShadow: innerShadow} = ui.__;
11910
- const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
12007
+ const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
11911
12008
  const other = current.getSameCanvas();
11912
12009
  const end = innerShadow.length - 1;
11913
- toOffsetOutBounds(bounds, offsetOutBounds);
12010
+ toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
11914
12011
  innerShadow.forEach((item, index) => {
11915
12012
  let otherScale = 1;
11916
12013
  if (item.scaleFixed) {
@@ -11919,16 +12016,17 @@ function innerShadow(ui, current, shape) {
11919
12016
  }
11920
12017
  other.save();
11921
12018
  other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
11922
- spreadScale = item.spread ? 1 - item.spread * 2 / (__layout.boxBounds.width + (__layout.strokeBoxSpread || 0) * 2) * otherScale : 0;
11923
- drawWorldShadow(other, offsetOutBounds, spreadScale, shape);
12019
+ transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
12020
+ if (transform) other.setTransform(transform);
12021
+ drawWorldShadow(other, offsetOutBounds, shape);
11924
12022
  other.restore();
11925
12023
  if (worldCanvas) {
11926
- other.copyWorld(other, bounds, nowWorld, "copy");
12024
+ other.copyWorld(other, renderBounds, nowWorld, "copy");
11927
12025
  other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
11928
12026
  copyBounds = nowWorld;
11929
12027
  } else {
11930
12028
  other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
11931
- copyBounds = bounds;
12029
+ copyBounds = renderBounds;
11932
12030
  }
11933
12031
  other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
11934
12032
  LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
@@ -11937,6 +12035,8 @@ function innerShadow(ui, current, shape) {
11937
12035
  other.recycle(copyBounds);
11938
12036
  }
11939
12037
 
12038
+ const getInnerShadowSpread = getShadowRenderSpread;
12039
+
11940
12040
  function blur(ui, current, origin) {
11941
12041
  const {blur: blur} = ui.__;
11942
12042
  origin.setWorldBlur(blur * ui.__nowWorld.a);
@@ -11951,10 +12051,12 @@ const EffectModule = {
11951
12051
  innerShadow: innerShadow,
11952
12052
  blur: blur,
11953
12053
  backgroundBlur: backgroundBlur,
11954
- getShadowSpread: getShadowSpread,
12054
+ getShadowRenderSpread: getShadowRenderSpread,
12055
+ getShadowTransform: getShadowTransform,
11955
12056
  isTransformShadow(_shadow) {
11956
12057
  return undefined;
11957
- }
12058
+ },
12059
+ getInnerShadowSpread: getInnerShadowSpread
11958
12060
  };
11959
12061
 
11960
12062
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -11971,6 +12073,7 @@ Group.prototype.__renderMask = function(canvas, options) {
11971
12073
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
11972
12074
  maskCanvas = contentCanvas = null;
11973
12075
  }
12076
+ if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
11974
12077
  maskOpacity = child.__.opacity;
11975
12078
  usedGrayscaleAlpha = false;
11976
12079
  if (mask === "path" || mask === "clipping-path") {
@@ -11988,7 +12091,6 @@ Group.prototype.__renderMask = function(canvas, options) {
11988
12091
  if (!contentCanvas) contentCanvas = getCanvas(canvas);
11989
12092
  child.__render(maskCanvas, options);
11990
12093
  }
11991
- if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
11992
12094
  continue;
11993
12095
  }
11994
12096
  const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
@@ -12621,22 +12723,25 @@ function targetAttr(fn) {
12621
12723
  set(value) {
12622
12724
  const old = this[privateKey];
12623
12725
  if (old !== value) {
12624
- if (this.config) {
12726
+ const t = this;
12727
+ if (t.config) {
12625
12728
  const isSelect = key === "target";
12626
12729
  if (isSelect) {
12627
- if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
12628
- if (this.single) this.element.syncEventer = null;
12629
- const {beforeSelect: beforeSelect} = this.config;
12730
+ const {beforeSelect: beforeSelect} = t.config;
12630
12731
  if (beforeSelect) {
12631
12732
  const check = beforeSelect({
12632
12733
  target: value
12633
12734
  });
12634
12735
  if (isObject(check)) value = check; else if (check === false) return;
12635
12736
  }
12737
+ t.setDimOthers(false);
12738
+ t.setBright(false);
12739
+ if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
12740
+ if (t.single) t.element.syncEventer = null;
12636
12741
  }
12637
12742
  const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
12638
12743
  if (this.hasEvent(type)) this.emitEvent(new EditorEvent(type, {
12639
- editor: this,
12744
+ editor: t,
12640
12745
  value: value,
12641
12746
  oldValue: old
12642
12747
  }));
@@ -12818,11 +12923,12 @@ class EditSelect extends Group {
12818
12923
  return !!this.originList;
12819
12924
  }
12820
12925
  get running() {
12821
- const {editor: editor} = this;
12822
- return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && this.app.mode === "normal";
12926
+ const {editor: editor, app: app} = this;
12927
+ return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && (app && app.mode === "normal");
12823
12928
  }
12824
12929
  get isMoveMode() {
12825
- return this.app && this.app.interaction.moveMode;
12930
+ const {app: app} = this;
12931
+ return app && app.interaction.moveMode;
12826
12932
  }
12827
12933
  constructor(editor) {
12828
12934
  super();
@@ -12885,12 +12991,12 @@ class EditSelect extends Group {
12885
12991
  onTap(e) {
12886
12992
  if (e.multiTouch) return;
12887
12993
  const {editor: editor} = this;
12888
- const {select: select} = editor.mergeConfig;
12994
+ const {select: select, selectKeep: selectKeep} = editor.mergeConfig;
12889
12995
  if (select === "tap") this.checkAndSelect(e); else if (this.waitSelect) this.waitSelect();
12890
12996
  if (this.needRemoveItem) {
12891
12997
  editor.removeItem(this.needRemoveItem);
12892
12998
  } else if (this.isMoveMode) {
12893
- editor.target = null;
12999
+ if (!selectKeep) editor.target = null;
12894
13000
  }
12895
13001
  }
12896
13002
  checkAndSelect(e) {
@@ -12905,7 +13011,7 @@ class EditSelect extends Group {
12905
13011
  editor.target = find;
12906
13012
  }
12907
13013
  } else if (this.allow(e.target)) {
12908
- if (!this.isHoldMultipleSelectKey(e)) editor.target = null;
13014
+ if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null;
12909
13015
  }
12910
13016
  }
12911
13017
  }
@@ -13024,91 +13130,95 @@ const {toPoint: toPoint} = AroundHelper;
13024
13130
  const {within: within$3, sign: sign$1} = MathHelper;
13025
13131
 
13026
13132
  const EditDataHelper = {
13027
- getScaleData(target, startBounds, direction, totalMove, lockRatio, around, flipable, scaleMode) {
13133
+ getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
13028
13134
  let align, origin = {}, scaleX = 1, scaleY = 1;
13029
13135
  const {boxBounds: boxBounds, widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldBoxBounds: worldBoxBounds} = target;
13030
13136
  const {width: width, height: height} = startBounds;
13031
- if (around) {
13032
- totalMove.x *= 2;
13033
- totalMove.y *= 2;
13034
- }
13035
13137
  const originChangedScaleX = target.scaleX / startBounds.scaleX;
13036
13138
  const originChangedScaleY = target.scaleY / startBounds.scaleY;
13037
13139
  const signX = sign$1(originChangedScaleX);
13038
13140
  const signY = sign$1(originChangedScaleY);
13039
13141
  const changedScaleX = scaleMode ? originChangedScaleX : signX * boxBounds.width / width;
13040
13142
  const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
13041
- totalMove.x *= scaleMode ? originChangedScaleX : signX;
13042
- totalMove.y *= scaleMode ? originChangedScaleY : signY;
13043
- const topScale = (-totalMove.y + height) / height;
13044
- const rightScale = (totalMove.x + width) / width;
13045
- const bottomScale = (totalMove.y + height) / height;
13046
- const leftScale = (-totalMove.x + width) / width;
13047
- switch (direction) {
13048
- case top$1:
13049
- scaleY = topScale;
13050
- align = "bottom";
13051
- break;
13143
+ if (isNumber(totalMoveOrScale)) {
13144
+ scaleX = scaleY = Math.sqrt(totalMoveOrScale);
13145
+ } else {
13146
+ if (around) {
13147
+ totalMoveOrScale.x *= 2;
13148
+ totalMoveOrScale.y *= 2;
13149
+ }
13150
+ totalMoveOrScale.x *= scaleMode ? originChangedScaleX : signX;
13151
+ totalMoveOrScale.y *= scaleMode ? originChangedScaleY : signY;
13152
+ const topScale = (-totalMoveOrScale.y + height) / height;
13153
+ const rightScale = (totalMoveOrScale.x + width) / width;
13154
+ const bottomScale = (totalMoveOrScale.y + height) / height;
13155
+ const leftScale = (-totalMoveOrScale.x + width) / width;
13156
+ switch (direction) {
13157
+ case top$1:
13158
+ scaleY = topScale;
13159
+ align = "bottom";
13160
+ break;
13052
13161
 
13053
- case right$2:
13054
- scaleX = rightScale;
13055
- align = "left";
13056
- break;
13162
+ case right$2:
13163
+ scaleX = rightScale;
13164
+ align = "left";
13165
+ break;
13057
13166
 
13058
- case bottom$1:
13059
- scaleY = bottomScale;
13060
- align = "top";
13061
- break;
13167
+ case bottom$1:
13168
+ scaleY = bottomScale;
13169
+ align = "top";
13170
+ break;
13062
13171
 
13063
- case left$2:
13064
- scaleX = leftScale;
13065
- align = "right";
13066
- break;
13172
+ case left$2:
13173
+ scaleX = leftScale;
13174
+ align = "right";
13175
+ break;
13067
13176
 
13068
- case topLeft$1:
13069
- scaleY = topScale;
13070
- scaleX = leftScale;
13071
- align = "bottom-right";
13072
- break;
13177
+ case topLeft$1:
13178
+ scaleY = topScale;
13179
+ scaleX = leftScale;
13180
+ align = "bottom-right";
13181
+ break;
13073
13182
 
13074
- case topRight$1:
13075
- scaleY = topScale;
13076
- scaleX = rightScale;
13077
- align = "bottom-left";
13078
- break;
13183
+ case topRight$1:
13184
+ scaleY = topScale;
13185
+ scaleX = rightScale;
13186
+ align = "bottom-left";
13187
+ break;
13079
13188
 
13080
- case bottomRight:
13081
- scaleY = bottomScale;
13082
- scaleX = rightScale;
13083
- align = "top-left";
13084
- break;
13189
+ case bottomRight:
13190
+ scaleY = bottomScale;
13191
+ scaleX = rightScale;
13192
+ align = "top-left";
13193
+ break;
13085
13194
 
13086
- case bottomLeft:
13087
- scaleY = bottomScale;
13088
- scaleX = leftScale;
13089
- align = "top-right";
13090
- }
13091
- if (lockRatio) {
13092
- if (lockRatio === "corner" && direction % 2) {
13093
- lockRatio = false;
13094
- } else {
13095
- let scale;
13096
- switch (direction) {
13097
- case top$1:
13098
- case bottom$1:
13099
- scale = scaleY;
13100
- break;
13195
+ case bottomLeft:
13196
+ scaleY = bottomScale;
13197
+ scaleX = leftScale;
13198
+ align = "top-right";
13199
+ }
13200
+ if (lockRatio) {
13201
+ if (lockRatio === "corner" && direction % 2) {
13202
+ lockRatio = false;
13203
+ } else {
13204
+ let scale;
13205
+ switch (direction) {
13206
+ case top$1:
13207
+ case bottom$1:
13208
+ scale = scaleY;
13209
+ break;
13101
13210
 
13102
- case left$2:
13103
- case right$2:
13104
- scale = scaleX;
13105
- break;
13211
+ case left$2:
13212
+ case right$2:
13213
+ scale = scaleX;
13214
+ break;
13106
13215
 
13107
- default:
13108
- scale = Math.sqrt(Math.abs(scaleX * scaleY));
13216
+ default:
13217
+ scale = Math.sqrt(Math.abs(scaleX * scaleY));
13218
+ }
13219
+ scaleX = scaleX < 0 ? -scale : scale;
13220
+ scaleY = scaleY < 0 ? -scale : scale;
13109
13221
  }
13110
- scaleX = scaleX < 0 ? -scale : scale;
13111
- scaleY = scaleY < 0 ? -scale : scale;
13112
13222
  }
13113
13223
  }
13114
13224
  const useScaleX = scaleX !== 1, useScaleY = scaleY !== 1;
@@ -13307,13 +13417,18 @@ const cacheCursors = {};
13307
13417
  function updatePointCursor(editBox, e) {
13308
13418
  const {enterPoint: point, dragging: dragging, skewing: skewing, resizing: resizing, flippedX: flippedX, flippedY: flippedY} = editBox;
13309
13419
  if (!point || !editBox.editor.editing || !editBox.canUse) return;
13420
+ if (point.name === "rect") return updateMoveCursor(editBox);
13310
13421
  if (point.name === "circle") return;
13311
- if (point.pointType === "button") {
13422
+ let {rotation: rotation} = editBox;
13423
+ const {pointType: pointType} = point, {moveCursor: moveCursor, resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
13424
+ if (pointType === "move") {
13425
+ point.cursor = moveCursor;
13426
+ if (!moveable) point.visible = false;
13427
+ return;
13428
+ } else if (pointType === "button") {
13312
13429
  if (!point.cursor) point.cursor = "pointer";
13313
13430
  return;
13314
13431
  }
13315
- let {rotation: rotation} = editBox;
13316
- const {pointType: pointType} = point, {resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
13317
13432
  let showResize = pointType.includes("resize");
13318
13433
  if (showResize && rotateable && (editBox.isHoldRotateKey(e) || !resizeable)) showResize = false;
13319
13434
  const showSkew = skewable && !showResize && (point.name === "resize-line" || pointType === "skew");
@@ -13391,10 +13506,13 @@ class EditBox extends Group {
13391
13506
  const {moveable: moveable, resizeable: resizeable, rotateable: rotateable} = this.mergeConfig;
13392
13507
  return isString(moveable) || isString(resizeable) || isString(rotateable);
13393
13508
  }
13509
+ get canDragLimitAnimate() {
13510
+ return this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds;
13511
+ }
13394
13512
  constructor(editor) {
13395
13513
  super();
13396
13514
  this.view = new Group;
13397
- this.rect = new Box({
13515
+ this.rect = new EditPoint({
13398
13516
  name: "rect",
13399
13517
  hitFill: "all",
13400
13518
  hitStroke: "none",
@@ -13456,12 +13574,13 @@ class EditBox extends Group {
13456
13574
  this.listenPointEvents(resizePoint, "resize", i);
13457
13575
  }
13458
13576
  this.listenPointEvents(circle, "rotate", 2);
13577
+ this.listenPointEvents(rect, "move", 8);
13459
13578
  view.addMany(...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints);
13460
13579
  this.add(view);
13461
13580
  }
13462
13581
  load() {
13463
- const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints} = this;
13464
- const {stroke: stroke, strokeWidth: strokeWidth} = mergeConfig;
13582
+ const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
13583
+ const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine} = mergeConfig;
13465
13584
  const pointsStyle = this.getPointsStyle();
13466
13585
  const middlePointsStyle = this.getMiddlePointsStyle();
13467
13586
  this.visible = !target.locked;
@@ -13470,6 +13589,10 @@ class EditBox extends Group {
13470
13589
  resizeP = resizePoints[i];
13471
13590
  resizeP.set(this.getPointStyle(i % 2 ? middlePointsStyle[(i - 1) / 2 % middlePointsStyle.length] : pointsStyle[i / 2 % pointsStyle.length]));
13472
13591
  resizeP.rotation = (i - (i % 2 ? 1 : 0)) / 2 * 90;
13592
+ if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
13593
+ pointType: "resize",
13594
+ rotation: (i - 1) / 2 * 90
13595
+ }, resizeLine || {}));
13473
13596
  }
13474
13597
  circle.set(this.getPointStyle(mergeConfig.circle || mergeConfig.rotatePoint || pointsStyle[0]));
13475
13598
  rect.set(Object.assign({
@@ -13514,10 +13637,12 @@ class EditBox extends Group {
13514
13637
  if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
13515
13638
  }
13516
13639
  updateBounds(bounds) {
13517
- const {editMask: editMask} = this.editor;
13518
- const {mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
13519
- const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
13640
+ const {editor: editor, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
13641
+ const {editMask: editMask} = editor;
13642
+ const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
13520
13643
  editMask.visible = mask ? true : 0;
13644
+ editor.setDimOthers(dimOthers);
13645
+ editor.setBright(!!dimOthers || bright);
13521
13646
  if (spread) BoundsHelper.spread(bounds, spread);
13522
13647
  if (this.view.worldOpacity) {
13523
13648
  const {width: width, height: height} = bounds;
@@ -13538,10 +13663,10 @@ class EditBox extends Group {
13538
13663
  resizeL.visible = resizeP.visible && !hideResizeLines;
13539
13664
  resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
13540
13665
  if ((i + 1) / 2 % 2) {
13541
- resizeL.width = width;
13666
+ resizeL.width = width + resizeL.height;
13542
13667
  if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
13543
13668
  } else {
13544
- resizeL.height = height;
13669
+ resizeL.width = height + resizeL.height;
13545
13670
  if (hideOnSmall && resizeP.width * 2 > height) resizeP.visible = false;
13546
13671
  }
13547
13672
  }
@@ -13617,10 +13742,9 @@ class EditBox extends Group {
13617
13742
  onDragStart(e) {
13618
13743
  this.dragging = true;
13619
13744
  const point = this.dragPoint = e.current, {pointType: pointType} = point;
13620
- const {editor: editor, dragStartData: dragStartData} = this, {target: target} = this, {moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable, hideOnMove: hideOnMove} = this.mergeConfig;
13621
- if (point.name === "rect") {
13745
+ const {moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = this.mergeConfig;
13746
+ if (pointType === "move") {
13622
13747
  moveable && (this.moving = true);
13623
- editor.opacity = hideOnMove ? 0 : 1;
13624
13748
  } else {
13625
13749
  if (pointType.includes("rotate") || this.isHoldRotateKey(e) || !resizeable) {
13626
13750
  rotateable && (this.rotating = true);
@@ -13629,69 +13753,74 @@ class EditBox extends Group {
13629
13753
  } else if (pointType === "resize") resizeable && (this.resizing = true);
13630
13754
  if (pointType === "skew") skewable && (this.skewing = true);
13631
13755
  }
13632
- dragStartData.x = e.x;
13633
- dragStartData.y = e.y;
13634
- dragStartData.point = {
13635
- x: target.x,
13636
- y: target.y
13637
- };
13638
- dragStartData.bounds = Object.assign({}, target.getLayoutBounds("box", "local"));
13639
- dragStartData.rotation = target.rotation;
13640
- if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
13641
- }
13642
- onDragEnd(e) {
13643
- if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
13644
- this.dragPoint = null;
13645
- this.resetDoing();
13646
- const {name: name, pointType: pointType} = e.current;
13647
- if (name === "rect") this.editor.opacity = 1;
13648
- if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = null;
13756
+ this.onTransformStart(e);
13649
13757
  }
13650
13758
  onDrag(e) {
13651
13759
  const {transformTool: transformTool, moving: moving, resizing: resizing, rotating: rotating, skewing: skewing} = this;
13652
13760
  if (moving) {
13653
13761
  transformTool.onMove(e);
13654
- updateMoveCursor(this);
13655
13762
  } else if (resizing || rotating || skewing) {
13656
13763
  const point = e.current;
13657
13764
  if (point.pointType) this.enterPoint = point;
13658
13765
  if (rotating) transformTool.onRotate(e);
13659
13766
  if (resizing) transformTool.onScale(e);
13660
13767
  if (skewing) transformTool.onSkew(e);
13661
- updatePointCursor(this, e);
13768
+ }
13769
+ updatePointCursor(this, e);
13770
+ }
13771
+ onDragEnd(e) {
13772
+ this.onTransformEnd(e);
13773
+ this.dragPoint = null;
13774
+ }
13775
+ onTransformStart(e) {
13776
+ if (this.canUse) {
13777
+ if (this.moving) this.editor.opacity = this.mergedConfig.hideOnMove ? 0 : 1;
13778
+ if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
13779
+ const {dragStartData: dragStartData, target: target} = this;
13780
+ dragStartData.x = e.x;
13781
+ dragStartData.y = e.y;
13782
+ dragStartData.totalOffset = getPointData();
13783
+ dragStartData.point = {
13784
+ x: target.x,
13785
+ y: target.y
13786
+ };
13787
+ dragStartData.bounds = Object.assign({}, target.getLayoutBounds("box", "local"));
13788
+ dragStartData.rotation = target.rotation;
13662
13789
  }
13663
13790
  }
13664
- resetDoing() {
13665
- if (this.canUse) this.dragging = this.gesturing = this.moving = this.resizing = this.rotating = this.skewing = false;
13791
+ onTransformEnd(e) {
13792
+ if (this.canUse) {
13793
+ if (this.canDragLimitAnimate && (e instanceof DragEvent || e instanceof MoveEvent)) this.transformTool.onMove(e);
13794
+ if (this.resizing) ResizeEvent.resizingKeys = null;
13795
+ this.dragging = this.gesturing = this.moving = this.resizing = this.rotating = this.skewing = false;
13796
+ this.editor.opacity = 1;
13797
+ this.update();
13798
+ }
13666
13799
  }
13667
13800
  onMove(e) {
13668
13801
  if (this.canGesture && e.moveType !== "drag") {
13669
13802
  e.stop();
13670
- if (isString(this.mergeConfig.moveable)) {
13803
+ if (isString(this.mergedConfig.moveable)) {
13671
13804
  this.gesturing = this.moving = true;
13672
- this.transformTool.onMove(e);
13805
+ e.type === MoveEvent.START ? this.onTransformStart(e) : this.transformTool.onMove(e);
13673
13806
  }
13674
13807
  }
13675
13808
  }
13676
- onMoveEnd(e) {
13677
- if (this.moving) this.transformTool.onMove(e);
13678
- this.resetDoing();
13679
- }
13680
13809
  onScale(e) {
13681
13810
  if (this.canGesture) {
13682
13811
  e.stop();
13683
- if (isString(this.mergeConfig.resizeable)) {
13812
+ if (isString(this.mergedConfig.resizeable)) {
13684
13813
  this.gesturing = this.resizing = true;
13685
- this.transformTool.onScale(e);
13814
+ e.type === ZoomEvent.START ? this.onTransformStart(e) : this.transformTool.onScale(e);
13686
13815
  }
13687
13816
  }
13688
13817
  }
13689
13818
  onRotate(e) {
13690
13819
  if (this.canGesture) {
13691
13820
  e.stop();
13692
- if (isString(this.mergeConfig.rotateable)) {
13821
+ if (isString(this.mergedConfig.rotateable)) {
13693
13822
  this.gesturing = this.rotating = true;
13694
- this.transformTool.onRotate(e);
13823
+ e.type === RotateEvent.START ? this.onTransformStart(e) : this.transformTool.onRotate(e);
13695
13824
  }
13696
13825
  }
13697
13826
  }
@@ -13704,8 +13833,7 @@ class EditBox extends Group {
13704
13833
  updatePointCursor(this, e);
13705
13834
  }
13706
13835
  onArrow(e) {
13707
- const {editor: editor, transformTool: transformTool} = this;
13708
- if (this.canUse && editor.editing && this.mergeConfig.keyEvent) {
13836
+ if (this.canUse && this.mergeConfig.keyEvent) {
13709
13837
  let x = 0, y = 0;
13710
13838
  const distance = e.shiftKey ? 10 : 1;
13711
13839
  switch (e.code) {
@@ -13724,7 +13852,7 @@ class EditBox extends Group {
13724
13852
  case "ArrowRight":
13725
13853
  x = distance;
13726
13854
  }
13727
- if (x || y) transformTool.move(x, y);
13855
+ if (x || y) this.transformTool.move(x, y);
13728
13856
  }
13729
13857
  }
13730
13858
  onDoubleTap(e) {
@@ -13755,19 +13883,17 @@ class EditBox extends Group {
13755
13883
  listenPointEvents(point, type, direction) {
13756
13884
  point.direction = direction;
13757
13885
  point.pointType = type;
13758
- const events = [ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.LEAVE, () => {
13759
- this.enterPoint = null;
13760
- } ] ];
13761
- if (point.name !== "circle") events.push([ PointerEvent.ENTER, e => {
13886
+ this.__eventIds.push(point.on_([ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.ENTER, e => {
13762
13887
  this.enterPoint = point, updatePointCursor(this, e);
13763
- } ]);
13764
- this.__eventIds.push(point.on_(events));
13888
+ } ], [ PointerEvent.LEAVE, () => {
13889
+ this.enterPoint = null;
13890
+ } ] ]));
13765
13891
  }
13766
13892
  __listenEvents() {
13767
13893
  const {rect: rect, editor: editor, __eventIds: events} = this;
13768
- events.push(rect.on_([ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.ENTER, () => updateMoveCursor(this) ], [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
13894
+ events.push(rect.on_([ [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
13769
13895
  this.waitLeafer(() => {
13770
- events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ MoveEvent.END, this.onMoveEnd, this ], [ ZoomEvent.END, this.resetDoing, this ], [ RotateEvent.END, this.resetDoing, this ] ]));
13896
+ events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ [ MoveEvent.START, MoveEvent.BEFORE_MOVE ], this.onMove, this, true ], [ [ ZoomEvent.START, ZoomEvent.BEFORE_ZOOM ], this.onScale, this, true ], [ [ RotateEvent.START, RotateEvent.BEFORE_ROTATE ], this.onRotate, this, true ], [ [ MoveEvent.END, ZoomEvent.END, RotateEvent.END ], this.onTransformEnd, this ] ]));
13771
13897
  });
13772
13898
  }
13773
13899
  __removeListenEvents() {
@@ -14165,56 +14291,61 @@ class TransformTool {
14165
14291
  const isMoveEnd = e.type === MoveEvent.END || e.type === DragEvent.END;
14166
14292
  const axisDrag = isString(target.draggable);
14167
14293
  const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
14294
+ const total = {
14295
+ x: e.totalX,
14296
+ y: e.totalY
14297
+ };
14168
14298
  if (e instanceof MoveEvent) {
14169
- move = e.getLocalMove(target);
14170
- if (checkLimitMove) DragEvent.limitMove(target, move);
14171
- } else {
14172
- const total = {
14173
- x: e.totalX,
14174
- y: e.totalY
14175
- };
14176
- if (e.shiftKey) {
14177
- if (Math.abs(total.x) > Math.abs(total.y)) total.y = 0; else total.x = 0;
14178
- }
14179
- move = DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
14299
+ PointHelper.move(total, target.getWorldPointByLocal(dragStartData.totalOffset, null, true));
14300
+ }
14301
+ if (e.shiftKey) {
14302
+ if (Math.abs(total.x) > Math.abs(total.y)) total.y = 0; else total.x = 0;
14180
14303
  }
14304
+ move = DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
14181
14305
  if (move.x || move.y) {
14182
14306
  if (dragLimitAnimate && !axisDrag && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
14183
14307
  }
14184
14308
  }
14185
14309
  onScale(e) {
14186
14310
  const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
14187
- let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig;
14311
+ let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
14188
14312
  if (e instanceof ZoomEvent) {
14189
- this.scaleOf(target.getBoxPoint(e), e.scale, e.scale);
14313
+ around = target.getBoxPoint(e);
14314
+ totalMove = e.totalScale;
14190
14315
  } else {
14191
- const {direction: direction} = e.current;
14192
- if (e.shiftKey || target.lockRatio) lockRatio = true;
14193
- const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, e.getInnerTotal(target), lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale");
14194
- if (this.editTool && this.editTool.onScaleWithDrag) {
14195
- data.drag = e;
14196
- this.scaleWithDrag(data);
14197
- } else {
14198
- this.scaleOf(data.origin, data.scaleX, data.scaleY);
14199
- }
14316
+ totalMove = e.getInnerTotal(target);
14317
+ }
14318
+ const {direction: direction} = e.current;
14319
+ if (e.shiftKey || target.lockRatio) lockRatio = true;
14320
+ const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale");
14321
+ const targetX = target.x, targetY = target.y;
14322
+ if (e instanceof DragEvent && this.editTool && this.editTool.onScaleWithDrag) {
14323
+ data.drag = e;
14324
+ this.scaleWithDrag(data);
14325
+ } else {
14326
+ this.scaleOf(data.origin, data.scaleX, data.scaleY);
14200
14327
  }
14328
+ PointHelper.move(dragStartData.totalOffset, target.x - targetX, target.y - targetY);
14201
14329
  }
14202
14330
  onRotate(e) {
14203
14331
  const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
14204
- const {around: around, rotateAround: rotateAround, rotateGap: rotateGap} = mergeConfig;
14332
+ const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey} = mergeConfig;
14205
14333
  const {direction: direction} = e.current;
14206
14334
  let origin, rotation;
14207
14335
  if (e instanceof RotateEvent) {
14208
14336
  rotation = e.rotation;
14209
14337
  origin = rotateAround ? AroundHelper.getPoint(rotateAround, target.boxBounds) : target.getBoxPoint(e);
14210
14338
  } else {
14211
- const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, e.shiftKey ? null : rotateAround || target.around || target.origin || around || "center");
14339
+ const isDiagonalRotate = diagonalRotateKey ? e.isHoldKeys(diagonalRotateKey) : e.shiftKey;
14340
+ const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center");
14212
14341
  rotation = dragStartData.rotation + data.rotation - target.rotation;
14213
14342
  origin = data.origin;
14214
14343
  }
14215
14344
  rotation = MathHelper.float(MathHelper.getGapRotation(rotation, rotateGap, target.rotation), 2);
14216
14345
  if (!rotation) return;
14346
+ const targetX = target.x, targetY = target.y;
14217
14347
  this.rotateOf(origin, rotation);
14348
+ PointHelper.move(dragStartData.totalOffset, target.x - targetX, target.y - targetY);
14218
14349
  }
14219
14350
  onSkew(e) {
14220
14351
  const {target: target, mergeConfig: mergeConfig} = this.editBox;
@@ -14493,6 +14624,16 @@ let Editor = class Editor extends Group {
14493
14624
  shiftItem(item) {
14494
14625
  this.hasItem(item) ? this.removeItem(item) : this.addItem(item);
14495
14626
  }
14627
+ setDimOthers(value, attrName = "dim", list) {
14628
+ if (!list) {
14629
+ const {dimTarget: dimTarget, targetLeafer: targetLeafer} = this;
14630
+ list = dimTarget ? isArray(dimTarget) ? dimTarget : [ dimTarget ] : [ targetLeafer ];
14631
+ }
14632
+ if (list[0] && list[0][attrName] !== (value || false)) list.forEach(item => DataHelper.stintSet(item, attrName, value));
14633
+ }
14634
+ setBright(value) {
14635
+ this.setDimOthers(value, "bright", this.list);
14636
+ }
14496
14637
  update() {
14497
14638
  if (this.editing) {
14498
14639
  if (!this.element.parent) return this.cancel();
@@ -14715,10 +14856,10 @@ let Editor = class Editor extends Group {
14715
14856
 
14716
14857
  __decorate([ mergeConfigAttr() ], Editor.prototype, "mergeConfig", void 0);
14717
14858
 
14718
- __decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
14719
-
14720
14859
  __decorate([ targetAttr(onTarget) ], Editor.prototype, "target", void 0);
14721
14860
 
14861
+ __decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
14862
+
14722
14863
  Editor = __decorate([ useModule(TransformTool, [ "editBox", "editTool", "emitEvent" ]) ], Editor);
14723
14864
 
14724
14865
  class InnerEditor {
@@ -14947,7 +15088,7 @@ let LineEditTool = class LineEditTool extends EditTool {
14947
15088
 
14948
15089
  LineEditTool = __decorate([ registerEditTool() ], LineEditTool);
14949
15090
 
14950
- const {M: M$3, L: L$3, C: C$3, Q: Q$2, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$1, O: O$2, P: P$1, U: U$1} = PathCommandMap;
15091
+ const {M: M$4, L: L$3, C: C$3, Q: Q$2, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$1, O: O$2, P: P$1, U: U$1} = PathCommandMap;
14951
15092
 
14952
15093
  const PathScaler = {
14953
15094
  scale(data, scaleX, scaleY) {
@@ -14957,7 +15098,7 @@ const PathScaler = {
14957
15098
  while (i < len) {
14958
15099
  command = data[i];
14959
15100
  switch (command) {
14960
- case M$3:
15101
+ case M$4:
14961
15102
  case L$3:
14962
15103
  scalePoints(data, scaleX, scaleY, i, 1);
14963
15104
  i += 3;
@@ -15411,28 +15552,24 @@ let TextEditor = class TextEditor extends InnerEditor {
15411
15552
  const data = text.__;
15412
15553
  if (data.__autoWidth) {
15413
15554
  width += 20;
15414
- if (data.autoSizeAlign) {
15415
- switch (data.textAlign) {
15416
- case "center":
15417
- offsetX = -width / 2;
15418
- break;
15555
+ switch (data.textAlign) {
15556
+ case "center":
15557
+ offsetX = data.autoSizeAlign ? -width / 2 : -10;
15558
+ break;
15419
15559
 
15420
- case "right":
15421
- offsetX = -width;
15422
- }
15560
+ case "right":
15561
+ offsetX = data.autoSizeAlign ? -width : -20;
15423
15562
  }
15424
15563
  }
15425
15564
  if (data.__autoHeight) {
15426
15565
  height += 20;
15427
- if (data.autoSizeAlign) {
15428
- switch (data.verticalAlign) {
15429
- case "middle":
15430
- offsetY = -height / 2;
15431
- break;
15566
+ switch (data.verticalAlign) {
15567
+ case "middle":
15568
+ offsetY = data.autoSizeAlign ? -height / 2 : -10;
15569
+ break;
15432
15570
 
15433
- case "bottom":
15434
- offsetY = -height;
15435
- }
15571
+ case "bottom":
15572
+ offsetY = data.autoSizeAlign ? -height : -20;
15436
15573
  }
15437
15574
  }
15438
15575
  const {x: x, y: y} = this.inBody ? text.app.clientBounds : text.app.tree.clientBounds;
@@ -15551,6 +15688,13 @@ register("design", design);
15551
15688
  register("document", document$1);
15552
15689
 
15553
15690
  const MultiTouchHelper = {
15691
+ state: {
15692
+ type: "none",
15693
+ typeCount: 0,
15694
+ startTime: 0,
15695
+ totalData: null,
15696
+ center: {}
15697
+ },
15554
15698
  getData(list) {
15555
15699
  const a = list[0], b = list[1];
15556
15700
  const lastCenter = PointHelper.getCenter(a.from, b.from);
@@ -15569,9 +15713,53 @@ const MultiTouchHelper = {
15569
15713
  rotation: rotation,
15570
15714
  center: center
15571
15715
  };
15716
+ },
15717
+ getType(data, config) {
15718
+ const moveScore = Math.hypot(data.move.x, data.move.y) / (config.move || 5);
15719
+ const scaleScore = Math.abs(data.scale - 1) / (config.scale || .03);
15720
+ const rotateScore = Math.abs(data.rotation) / (config.rotation || 2);
15721
+ if (moveScore < 1 && scaleScore < 1 && rotateScore < 1) return "none";
15722
+ if (moveScore >= scaleScore && moveScore >= rotateScore) return "move";
15723
+ if (scaleScore >= rotateScore) return "zoom";
15724
+ return "rotate";
15725
+ },
15726
+ detect(data, config) {
15727
+ const {state: state} = M$3;
15728
+ const type = M$3.getType(data, config);
15729
+ if (!state.totalData) {
15730
+ state.startTime = Date.now();
15731
+ state.center = data.center;
15732
+ }
15733
+ M$3.add(data, state.totalData);
15734
+ state.totalData = data;
15735
+ if (type === state.type) {
15736
+ state.typeCount++;
15737
+ if (state.typeCount >= (config.count || 3) && type !== "none") return type;
15738
+ } else {
15739
+ state.type = type;
15740
+ state.typeCount = 1;
15741
+ }
15742
+ if (Date.now() - state.startTime >= (config.time || 160)) return M$3.getType(state.totalData, config);
15743
+ return "none";
15744
+ },
15745
+ add(data, add) {
15746
+ if (!add) return;
15747
+ PointHelper.move(data.move, add.move);
15748
+ data.scale *= add.scale;
15749
+ data.rotation += add.rotation;
15750
+ data.center = add.center;
15751
+ },
15752
+ reset() {
15753
+ const {state: state} = M$3;
15754
+ state.type = "none";
15755
+ state.typeCount = 0;
15756
+ state.startTime = 0;
15757
+ state.totalData = null;
15572
15758
  }
15573
15759
  };
15574
15760
 
15761
+ const M$3 = MultiTouchHelper;
15762
+
15575
15763
  const {abs: abs$2, max: max} = Math, {sign: sign, within: within$2} = MathHelper;
15576
15764
 
15577
15765
  const WheelEventHelper = {
@@ -15611,9 +15799,20 @@ const WheelEventHelper = {
15611
15799
  }
15612
15800
  };
15613
15801
 
15802
+ let totalX, totalY, totalScale, totalRotation;
15803
+
15614
15804
  class Transformer {
15615
15805
  get transforming() {
15616
- return !!(this.moveData || this.zoomData || this.rotateData);
15806
+ return this.moving || this.zooming || this.rotating;
15807
+ }
15808
+ get moving() {
15809
+ return !!this.moveData;
15810
+ }
15811
+ get zooming() {
15812
+ return !!this.zoomData;
15813
+ }
15814
+ get rotating() {
15815
+ return !!this.rotateData;
15617
15816
  }
15618
15817
  constructor(interaction) {
15619
15818
  this.interaction = interaction;
@@ -15623,13 +15822,18 @@ class Transformer {
15623
15822
  if (!data.moveType) data.moveType = "move";
15624
15823
  if (!this.moveData) {
15625
15824
  this.setPath(data);
15825
+ totalX = 0, totalY = 0;
15626
15826
  this.moveData = Object.assign(Object.assign({}, data), {
15627
15827
  moveX: 0,
15628
- moveY: 0
15828
+ moveY: 0,
15829
+ totalX: totalX,
15830
+ totalY: totalY
15629
15831
  });
15630
15832
  interaction.emit(MoveEvent.START, this.moveData);
15631
15833
  }
15632
15834
  data.path = this.moveData.path;
15835
+ data.totalX = totalX = totalX + data.moveX;
15836
+ data.totalY = totalY = totalY + data.moveY;
15633
15837
  interaction.emit(MoveEvent.BEFORE_MOVE, data);
15634
15838
  interaction.emit(MoveEvent.MOVE, data);
15635
15839
  this.transformEndWait();
@@ -15638,12 +15842,15 @@ class Transformer {
15638
15842
  const {interaction: interaction} = this;
15639
15843
  if (!this.zoomData) {
15640
15844
  this.setPath(data);
15845
+ totalScale = 1;
15641
15846
  this.zoomData = Object.assign(Object.assign({}, data), {
15642
- scale: 1
15847
+ scale: 1,
15848
+ totalScale: totalScale
15643
15849
  });
15644
15850
  interaction.emit(ZoomEvent.START, this.zoomData);
15645
15851
  }
15646
15852
  data.path = this.zoomData.path;
15853
+ data.totalScale = totalScale = totalScale * data.scale;
15647
15854
  interaction.emit(ZoomEvent.BEFORE_ZOOM, data);
15648
15855
  interaction.emit(ZoomEvent.ZOOM, data);
15649
15856
  this.transformEndWait();
@@ -15652,12 +15859,15 @@ class Transformer {
15652
15859
  const {interaction: interaction} = this;
15653
15860
  if (!this.rotateData) {
15654
15861
  this.setPath(data);
15862
+ totalRotation = 0;
15655
15863
  this.rotateData = Object.assign(Object.assign({}, data), {
15656
- rotation: 0
15864
+ rotation: 0,
15865
+ totalRotation: totalRotation
15657
15866
  });
15658
15867
  interaction.emit(RotateEvent.START, this.rotateData);
15659
15868
  }
15660
15869
  data.path = this.rotateData.path;
15870
+ data.totalRotation = totalRotation = totalRotation + data.rotation;
15661
15871
  interaction.emit(RotateEvent.BEFORE_ROTATE, data);
15662
15872
  interaction.emit(RotateEvent.ROTATE, data);
15663
15873
  this.transformEndWait();
@@ -15676,9 +15886,16 @@ class Transformer {
15676
15886
  }
15677
15887
  transformEnd() {
15678
15888
  const {interaction: interaction, moveData: moveData, zoomData: zoomData, rotateData: rotateData} = this;
15679
- if (moveData) interaction.emit(MoveEvent.END, moveData);
15680
- if (zoomData) interaction.emit(ZoomEvent.END, zoomData);
15681
- if (rotateData) interaction.emit(RotateEvent.END, rotateData);
15889
+ if (moveData) interaction.emit(MoveEvent.END, Object.assign(Object.assign({}, moveData), {
15890
+ totalX: totalX,
15891
+ totalY: totalY
15892
+ }));
15893
+ if (zoomData) interaction.emit(ZoomEvent.END, Object.assign(Object.assign({}, zoomData), {
15894
+ totalScale: totalScale
15895
+ }));
15896
+ if (rotateData) interaction.emit(RotateEvent.END, Object.assign(Object.assign({}, rotateData), {
15897
+ totalRotation: totalRotation
15898
+ }));
15682
15899
  this.reset();
15683
15900
  }
15684
15901
  reset() {
@@ -15776,14 +15993,39 @@ interaction.wheel = function(data) {
15776
15993
  };
15777
15994
 
15778
15995
  interaction.multiTouch = function(data, list) {
15779
- if (this.config.multiTouch.disabled) return;
15780
- const {move: move, rotation: rotation, scale: scale, center: center} = MultiTouchHelper.getData(list);
15781
- Object.assign(data, center);
15782
- data.multiTouch = true;
15996
+ const {disabled: disabled, singleGesture: singleGesture} = this.config.multiTouch;
15997
+ if (disabled) return;
15783
15998
  this.pointerWaitCancel();
15784
- this.rotate(getRotateEventData(rotation, data));
15785
- this.zoom(getZoomEventData(scale, data));
15786
- this.move(getMoveEventData(move, data));
15999
+ let gestureData = MultiTouchHelper.getData(list);
16000
+ let {moving: moving, zooming: zooming, rotating: rotating} = this.transformer;
16001
+ if (singleGesture) {
16002
+ if (!this.transformer.transforming) {
16003
+ const type = MultiTouchHelper.detect(gestureData, isObject(singleGesture) ? singleGesture : {});
16004
+ switch (type) {
16005
+ case "move":
16006
+ moving = true;
16007
+ break;
16008
+
16009
+ case "zoom":
16010
+ zooming = true;
16011
+ break;
16012
+
16013
+ case "rotate":
16014
+ rotating = true;
16015
+ break;
16016
+
16017
+ default:
16018
+ return;
16019
+ }
16020
+ MultiTouchHelper.reset();
16021
+ }
16022
+ if (!moving) gestureData.center = MultiTouchHelper.state.center;
16023
+ } else moving = zooming = rotating = true;
16024
+ Object.assign(data, gestureData.center);
16025
+ data.multiTouch = true;
16026
+ if (rotating) this.rotate(getRotateEventData(gestureData.rotation, data));
16027
+ if (zooming) this.zoom(getZoomEventData(gestureData.scale, data));
16028
+ if (moving) this.move(getMoveEventData(gestureData.move, data));
15787
16029
  };
15788
16030
 
15789
16031
  const dragger = Dragger.prototype;
@@ -18801,6 +19043,18 @@ UI.addAttr("placeholderStyle", undefined, stateStyleType);
18801
19043
 
18802
19044
  UI.addAttr("button", false, dataType);
18803
19045
 
19046
+ ui$1.set = function(data, transition) {
19047
+ if (data) {
19048
+ if (transition) {
19049
+ if (transition === "temp") {
19050
+ this.lockNormalStyle = true;
19051
+ Object.assign(this, data);
19052
+ this.lockNormalStyle = false;
19053
+ } else this.animate(data, transition);
19054
+ } else Object.assign(this, data);
19055
+ }
19056
+ };
19057
+
18804
19058
  ui$1.focus = function(value = true) {
18805
19059
  this.waitLeafer(() => {
18806
19060
  let {focusData: focusData} = this.app.interaction;
@@ -19228,14 +19482,10 @@ const ExportModule = {
19228
19482
  renderOptions.bounds = canvas.bounds;
19229
19483
  }
19230
19484
  canvas.save();
19231
- if (isFrame && !isUndefined(fill)) {
19232
- const oldFill = leaf.get("fill");
19233
- leaf.fill = "";
19234
- leaf.__render(canvas, renderOptions);
19235
- leaf.fill = oldFill;
19236
- } else {
19237
- leaf.__render(canvas, renderOptions);
19238
- }
19485
+ const igroneFill = isFrame && !isUndefined(fill), oldFill = leaf.get("fill");
19486
+ if (igroneFill) leaf.fill = "";
19487
+ Platform.render(leaf, canvas, renderOptions);
19488
+ if (igroneFill) leaf.fill = oldFill;
19239
19489
  canvas.restore();
19240
19490
  if (sliceLeaf) sliceLeaf.__updateWorldOpacity();
19241
19491
  if (trim) {
@@ -19397,4 +19647,8 @@ Object.assign(Filter, {
19397
19647
  }
19398
19648
  });
19399
19649
 
19400
- 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, DragBoundsHelper, 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, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, TextEditor, TransformTool, 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, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
19650
+ Plugin.add("bright");
19651
+
19652
+ UI.addAttr("bright", false, dimType);
19653
+
19654
+ 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, DragBoundsHelper, 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, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, 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, TextEditor, TransformTool, 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, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };