@leafer-editor/worker 1.12.1 → 1.12.2
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.
- package/dist/worker.js +217 -143
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +223 -143
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +17 -17
package/dist/worker.module.js
CHANGED
|
@@ -216,7 +216,7 @@ class LeafData {
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
const {floor: floor$2, max: max$
|
|
219
|
+
const {floor: floor$2, max: max$7} = Math;
|
|
220
220
|
|
|
221
221
|
const Platform = {
|
|
222
222
|
toURL(text, fileType) {
|
|
@@ -242,7 +242,7 @@ const Platform = {
|
|
|
242
242
|
return url;
|
|
243
243
|
},
|
|
244
244
|
resize(image, width, height, xGap, yGap, clip, smooth, opacity, _filters) {
|
|
245
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
245
|
+
const canvas = Platform.origin.createCanvas(max$7(floor$2(width + (xGap || 0)), 1), max$7(floor$2(height + (yGap || 0)), 1));
|
|
246
246
|
const ctx = canvas.getContext("2d");
|
|
247
247
|
if (opacity) ctx.globalAlpha = opacity;
|
|
248
248
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -289,7 +289,7 @@ const I$2 = IncrementId;
|
|
|
289
289
|
|
|
290
290
|
let tempA, tempB, tempTo;
|
|
291
291
|
|
|
292
|
-
const {max: max$
|
|
292
|
+
const {max: max$6} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
293
293
|
|
|
294
294
|
const FourNumberHelper = {
|
|
295
295
|
zero: [ ...tempFour ],
|
|
@@ -341,9 +341,9 @@ const FourNumberHelper = {
|
|
|
341
341
|
return data;
|
|
342
342
|
},
|
|
343
343
|
max(t, other, change) {
|
|
344
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
344
|
+
if (isNumber(t) && isNumber(other)) return max$6(t, other);
|
|
345
345
|
toTempAB(t, other, change);
|
|
346
|
-
return set$2(tempTo, max$
|
|
346
|
+
return set$2(tempTo, max$6(tempA[0], tempB[0]), max$6(tempA[1], tempB[1]), max$6(tempA[2], tempB[2]), max$6(tempA[3], tempB[3]));
|
|
347
347
|
},
|
|
348
348
|
add(t, other, change) {
|
|
349
349
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
@@ -360,7 +360,7 @@ const FourNumberHelper = {
|
|
|
360
360
|
|
|
361
361
|
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
362
362
|
|
|
363
|
-
const {round: round$3, pow: pow$1, max: max$
|
|
363
|
+
const {round: round$3, pow: pow$1, max: max$5, floor: floor$1, PI: PI$3} = Math;
|
|
364
364
|
|
|
365
365
|
const MathHelper = {
|
|
366
366
|
within(value, min, max) {
|
|
@@ -414,7 +414,7 @@ const MathHelper = {
|
|
|
414
414
|
}
|
|
415
415
|
},
|
|
416
416
|
getFloorScale(num, min = 1) {
|
|
417
|
-
return max$
|
|
417
|
+
return max$5(floor$1(num), min) / num;
|
|
418
418
|
},
|
|
419
419
|
randInt: randInt,
|
|
420
420
|
randColor(opacity) {
|
|
@@ -461,9 +461,9 @@ function getMatrixData() {
|
|
|
461
461
|
|
|
462
462
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
463
463
|
|
|
464
|
-
const {float: float$
|
|
464
|
+
const {float: float$3} = MathHelper;
|
|
465
465
|
|
|
466
|
-
const tempPoint$
|
|
466
|
+
const tempPoint$4 = {};
|
|
467
467
|
|
|
468
468
|
function getWorld() {
|
|
469
469
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -522,8 +522,8 @@ const MatrixHelper = {
|
|
|
522
522
|
to.f = t.f * pixelRatio;
|
|
523
523
|
},
|
|
524
524
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
525
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
526
|
-
M$a.scaleOfInner(t, tempPoint$
|
|
525
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
526
|
+
M$a.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
527
527
|
},
|
|
528
528
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
529
529
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -541,8 +541,8 @@ const MatrixHelper = {
|
|
|
541
541
|
t.d = c * sinR + d * cosR;
|
|
542
542
|
},
|
|
543
543
|
rotateOfOuter(t, origin, rotation) {
|
|
544
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
545
|
-
M$a.rotateOfInner(t, tempPoint$
|
|
544
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
545
|
+
M$a.rotateOfInner(t, tempPoint$4, rotation);
|
|
546
546
|
},
|
|
547
547
|
rotateOfInner(t, origin, rotation) {
|
|
548
548
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -563,8 +563,8 @@ const MatrixHelper = {
|
|
|
563
563
|
}
|
|
564
564
|
},
|
|
565
565
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
566
|
-
M$a.toInnerPoint(t, origin, tempPoint$
|
|
567
|
-
M$a.skewOfInner(t, tempPoint$
|
|
566
|
+
M$a.toInnerPoint(t, origin, tempPoint$4);
|
|
567
|
+
M$a.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
568
568
|
},
|
|
569
569
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
570
570
|
M$a.translateInner(t, origin.x, origin.y);
|
|
@@ -712,12 +712,12 @@ const MatrixHelper = {
|
|
|
712
712
|
const cosR = c / scaleY;
|
|
713
713
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
714
714
|
}
|
|
715
|
-
const cosR = float$
|
|
715
|
+
const cosR = float$3(cos$5(rotation));
|
|
716
716
|
const sinR = sin$5(rotation);
|
|
717
|
-
scaleX = float$
|
|
718
|
-
skewX = cosR ? float$
|
|
719
|
-
skewY = cosR ? float$
|
|
720
|
-
rotation = float$
|
|
717
|
+
scaleX = float$3(scaleX), scaleY = float$3(scaleY);
|
|
718
|
+
skewX = cosR ? float$3((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
719
|
+
skewY = cosR ? float$3((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
720
|
+
rotation = float$3(rotation / OneRadian);
|
|
721
721
|
} else {
|
|
722
722
|
scaleX = a;
|
|
723
723
|
scaleY = d;
|
|
@@ -761,9 +761,11 @@ const MatrixHelper = {
|
|
|
761
761
|
|
|
762
762
|
const M$a = MatrixHelper;
|
|
763
763
|
|
|
764
|
+
const {float: float$2} = MathHelper;
|
|
765
|
+
|
|
764
766
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
765
767
|
|
|
766
|
-
const {sin: sin$4, cos: cos$4, abs: abs$9, sqrt: sqrt$2, atan2: atan2$2, min: min$
|
|
768
|
+
const {sin: sin$4, cos: cos$4, abs: abs$9, sqrt: sqrt$2, atan2: atan2$2, min: min$3, round: round$2} = Math;
|
|
767
769
|
|
|
768
770
|
const PointHelper = {
|
|
769
771
|
defaultPoint: getPointData(),
|
|
@@ -812,22 +814,27 @@ const PointHelper = {
|
|
|
812
814
|
},
|
|
813
815
|
tempToInnerOf(t, matrix) {
|
|
814
816
|
const {tempPoint: temp} = P$7;
|
|
815
|
-
copy$
|
|
817
|
+
copy$c(temp, t);
|
|
816
818
|
toInnerPoint$2(matrix, temp, temp);
|
|
817
819
|
return temp;
|
|
818
820
|
},
|
|
819
821
|
tempToOuterOf(t, matrix) {
|
|
820
822
|
const {tempPoint: temp} = P$7;
|
|
821
|
-
copy$
|
|
823
|
+
copy$c(temp, t);
|
|
822
824
|
toOuterPoint$3(matrix, temp, temp);
|
|
823
825
|
return temp;
|
|
824
826
|
},
|
|
825
827
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
826
828
|
const {tempRadiusPoint: temp} = P$7;
|
|
827
|
-
copy$
|
|
829
|
+
copy$c(temp, t);
|
|
828
830
|
P$7.toInnerRadiusPointOf(t, matrix, temp);
|
|
829
831
|
return temp;
|
|
830
832
|
},
|
|
833
|
+
copyRadiusPoint(t, point, x, y) {
|
|
834
|
+
copy$c(t, point);
|
|
835
|
+
setRadius(t, x, y);
|
|
836
|
+
return t;
|
|
837
|
+
},
|
|
831
838
|
toInnerRadiusPointOf(t, matrix, to) {
|
|
832
839
|
to || (to = t);
|
|
833
840
|
toInnerPoint$2(matrix, t, to);
|
|
@@ -861,7 +868,7 @@ const PointHelper = {
|
|
|
861
868
|
return sqrt$2(x * x + y * y);
|
|
862
869
|
},
|
|
863
870
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
864
|
-
return min$
|
|
871
|
+
return min$3(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
865
872
|
},
|
|
866
873
|
getAngle(t, to) {
|
|
867
874
|
return getAtan2(t, to) / OneRadian;
|
|
@@ -895,7 +902,7 @@ const PointHelper = {
|
|
|
895
902
|
return points;
|
|
896
903
|
},
|
|
897
904
|
isSame(t, point) {
|
|
898
|
-
return t.x === point.x && t.y === point.y;
|
|
905
|
+
return float$2(t.x) === float$2(point.x) && float$2(t.y) === float$2(point.y);
|
|
899
906
|
},
|
|
900
907
|
reset(t) {
|
|
901
908
|
P$7.reset(t);
|
|
@@ -904,7 +911,7 @@ const PointHelper = {
|
|
|
904
911
|
|
|
905
912
|
const P$7 = PointHelper;
|
|
906
913
|
|
|
907
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$
|
|
914
|
+
const {getDistanceFrom: getDistanceFrom, copy: copy$c, setRadius: setRadius, getAtan2: getAtan2} = P$7;
|
|
908
915
|
|
|
909
916
|
class Point {
|
|
910
917
|
constructor(x, y) {
|
|
@@ -979,7 +986,7 @@ class Point {
|
|
|
979
986
|
}
|
|
980
987
|
}
|
|
981
988
|
|
|
982
|
-
const tempPoint$
|
|
989
|
+
const tempPoint$3 = new Point;
|
|
983
990
|
|
|
984
991
|
class Matrix {
|
|
985
992
|
constructor(a, b, c, d, e, f) {
|
|
@@ -1315,7 +1322,7 @@ const BoundsHelper = {
|
|
|
1315
1322
|
return t;
|
|
1316
1323
|
},
|
|
1317
1324
|
toOffsetOutBounds(t, to, offsetBounds) {
|
|
1318
|
-
if (!to) to = t; else copy$
|
|
1325
|
+
if (!to) to = t; else copy$b(to, t);
|
|
1319
1326
|
if (!offsetBounds) offsetBounds = t;
|
|
1320
1327
|
to.offsetX = B.maxX(offsetBounds);
|
|
1321
1328
|
to.offsetY = B.maxY(offsetBounds);
|
|
@@ -1462,7 +1469,7 @@ const BoundsHelper = {
|
|
|
1462
1469
|
if (bounds && (bounds.width || bounds.height)) {
|
|
1463
1470
|
if (first) {
|
|
1464
1471
|
first = false;
|
|
1465
|
-
if (!addMode) copy$
|
|
1472
|
+
if (!addMode) copy$b(t, bounds);
|
|
1466
1473
|
} else {
|
|
1467
1474
|
add$2(t, bounds);
|
|
1468
1475
|
}
|
|
@@ -1549,7 +1556,7 @@ const BoundsHelper = {
|
|
|
1549
1556
|
|
|
1550
1557
|
const B = BoundsHelper;
|
|
1551
1558
|
|
|
1552
|
-
const {add: add$2, copy: copy$
|
|
1559
|
+
const {add: add$2, copy: copy$b} = B;
|
|
1553
1560
|
|
|
1554
1561
|
class Bounds {
|
|
1555
1562
|
get minX() {
|
|
@@ -2247,7 +2254,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
|
|
|
2247
2254
|
|
|
2248
2255
|
__decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
|
|
2249
2256
|
|
|
2250
|
-
const {copy: copy$
|
|
2257
|
+
const {copy: copy$a, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2251
2258
|
|
|
2252
2259
|
const minSize = {
|
|
2253
2260
|
width: 1,
|
|
@@ -2407,7 +2414,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2407
2414
|
const {pixelRatio: pixelRatio} = this;
|
|
2408
2415
|
this.filter = `blur(${blur * pixelRatio}px)`;
|
|
2409
2416
|
}
|
|
2410
|
-
copyWorld(canvas, from, to, blendMode, ceilPixel
|
|
2417
|
+
copyWorld(canvas, from, to, blendMode, ceilPixel) {
|
|
2411
2418
|
if (blendMode) this.blendMode = blendMode;
|
|
2412
2419
|
if (from) {
|
|
2413
2420
|
this.setTempPixelBounds(from, ceilPixel);
|
|
@@ -2418,7 +2425,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2418
2425
|
}
|
|
2419
2426
|
if (blendMode) this.blendMode = "source-over";
|
|
2420
2427
|
}
|
|
2421
|
-
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel
|
|
2428
|
+
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel) {
|
|
2422
2429
|
if (fromWorld.b || fromWorld.c) {
|
|
2423
2430
|
this.save();
|
|
2424
2431
|
this.resetTransform();
|
|
@@ -2431,7 +2438,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2431
2438
|
if (blendMode) this.blendMode = "source-over";
|
|
2432
2439
|
}
|
|
2433
2440
|
}
|
|
2434
|
-
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel
|
|
2441
|
+
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel) {
|
|
2435
2442
|
this.resetTransform();
|
|
2436
2443
|
this.copyWorld(canvas, from, to, blendMode, ceilPixel);
|
|
2437
2444
|
if (!onlyResetTransform) this.useWorldTransform();
|
|
@@ -2501,7 +2508,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2501
2508
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2502
2509
|
const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2503
2510
|
canvas.save();
|
|
2504
|
-
if (useSameWorldTransform) copy$
|
|
2511
|
+
if (useSameWorldTransform) copy$a(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2505
2512
|
if (useSameSmooth) canvas.smooth = this.smooth;
|
|
2506
2513
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
2507
2514
|
return canvas;
|
|
@@ -2642,7 +2649,7 @@ const RectHelper = {
|
|
|
2642
2649
|
}
|
|
2643
2650
|
};
|
|
2644
2651
|
|
|
2645
|
-
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil, abs: abs$8, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2652
|
+
const {sin: sin$3, cos: cos$3, hypot: hypot$1, atan2: atan2$1, ceil: ceil, abs: abs$8, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2646
2653
|
|
|
2647
2654
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2648
2655
|
|
|
@@ -2650,7 +2657,7 @@ const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
|
2650
2657
|
|
|
2651
2658
|
const {M: M$9, L: L$9, C: C$7, Q: Q$7, Z: Z$7} = PathCommandMap;
|
|
2652
2659
|
|
|
2653
|
-
const tempPoint$
|
|
2660
|
+
const tempPoint$2 = {};
|
|
2654
2661
|
|
|
2655
2662
|
const BezierHelper = {
|
|
2656
2663
|
points(data, originPoints, curve, close) {
|
|
@@ -2658,7 +2665,7 @@ const BezierHelper = {
|
|
|
2658
2665
|
data.push(M$9, points[0], points[1]);
|
|
2659
2666
|
if (curve && points.length > 5) {
|
|
2660
2667
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
2661
|
-
let ba, cb, d, len = points.length;
|
|
2668
|
+
let baX, baY, ba, cb, d, len = points.length;
|
|
2662
2669
|
const t = curve === true ? .5 : curve;
|
|
2663
2670
|
if (close) {
|
|
2664
2671
|
points = [ points[len - 2], points[len - 1], ...points, points[0], points[1], points[2], points[3] ];
|
|
@@ -2671,7 +2678,9 @@ const BezierHelper = {
|
|
|
2671
2678
|
bY = points[i + 1];
|
|
2672
2679
|
cX = points[i + 2];
|
|
2673
2680
|
cY = points[i + 3];
|
|
2674
|
-
|
|
2681
|
+
baX = bX - aX;
|
|
2682
|
+
baY = bY - aY;
|
|
2683
|
+
ba = sqrt$1(pow(baX, 2) + pow(baY, 2));
|
|
2675
2684
|
cb = sqrt$1(pow(cX - bX, 2) + pow(cY - bY, 2));
|
|
2676
2685
|
if (!ba && !cb) continue;
|
|
2677
2686
|
d = ba + cb;
|
|
@@ -2684,7 +2693,7 @@ const BezierHelper = {
|
|
|
2684
2693
|
if (i === 2) {
|
|
2685
2694
|
if (!close) data.push(Q$7, c1X, c1Y, bX, bY);
|
|
2686
2695
|
} else {
|
|
2687
|
-
data.push(C$7, c2X, c2Y, c1X, c1Y, bX, bY);
|
|
2696
|
+
if (baX || baY) data.push(C$7, c2X, c2Y, c1X, c1Y, bX, bY);
|
|
2688
2697
|
}
|
|
2689
2698
|
c2X = bX + cb * cX;
|
|
2690
2699
|
c2Y = bY + cb * cY;
|
|
@@ -2713,8 +2722,8 @@ const BezierHelper = {
|
|
|
2713
2722
|
const CBy = toY - y1;
|
|
2714
2723
|
let startRadian = atan2$1(BAy, BAx);
|
|
2715
2724
|
let endRadian = atan2$1(CBy, CBx);
|
|
2716
|
-
const lenBA = hypot(BAx, BAy);
|
|
2717
|
-
const lenCB = hypot(CBx, CBy);
|
|
2725
|
+
const lenBA = hypot$1(BAx, BAy);
|
|
2726
|
+
const lenCB = hypot$1(CBx, CBy);
|
|
2718
2727
|
let totalRadian = endRadian - startRadian;
|
|
2719
2728
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2720
2729
|
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$8(totalRadian - PI$2) < 1e-12) {
|
|
@@ -2819,8 +2828,8 @@ const BezierHelper = {
|
|
|
2819
2828
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
|
|
2820
2829
|
addPoint$2(pointBounds, toX, toY);
|
|
2821
2830
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2822
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2823
|
-
addPoint$2(pointBounds, tempPoint$
|
|
2831
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
|
|
2832
|
+
addPoint$2(pointBounds, tempPoint$2.x, tempPoint$2.y);
|
|
2824
2833
|
}
|
|
2825
2834
|
},
|
|
2826
2835
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3230,7 +3239,7 @@ const {M: M$7, L: L$7, C: C$5, Q: Q$5, Z: Z$5, N: N$4, D: D$5, X: X$4, G: G$4, F
|
|
|
3230
3239
|
|
|
3231
3240
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3232
3241
|
|
|
3233
|
-
const {tan: tan, min: min$
|
|
3242
|
+
const {tan: tan, min: min$2, abs: abs$7} = Math;
|
|
3234
3243
|
|
|
3235
3244
|
const startPoint = {};
|
|
3236
3245
|
|
|
@@ -3269,6 +3278,7 @@ const PathCommandDataHelper = {
|
|
|
3269
3278
|
}
|
|
3270
3279
|
},
|
|
3271
3280
|
ellipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
3281
|
+
if (radiusX === radiusY) return arc$2(data, x, y, radiusX, startAngle, endAngle, anticlockwise);
|
|
3272
3282
|
if (isNull(rotation)) {
|
|
3273
3283
|
data.push(F$5, x, y, radiusX, radiusY);
|
|
3274
3284
|
} else {
|
|
@@ -3281,6 +3291,7 @@ const PathCommandDataHelper = {
|
|
|
3281
3291
|
if (isNull(startAngle)) {
|
|
3282
3292
|
data.push(P$4, x, y, radius);
|
|
3283
3293
|
} else {
|
|
3294
|
+
if (isNull(startAngle)) startAngle = 0;
|
|
3284
3295
|
if (isNull(endAngle)) endAngle = 360;
|
|
3285
3296
|
data.push(O$5, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3286
3297
|
}
|
|
@@ -3288,7 +3299,7 @@ const PathCommandDataHelper = {
|
|
|
3288
3299
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3289
3300
|
if (!isUndefined(lastX)) {
|
|
3290
3301
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3291
|
-
radius = min$
|
|
3302
|
+
radius = min$2(radius, min$2(d / 2, d / 2 * abs$7(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3292
3303
|
}
|
|
3293
3304
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3294
3305
|
},
|
|
@@ -3490,7 +3501,7 @@ const {M: M$5, L: L$5, C: C$3, Q: Q$3, Z: Z$3, N: N$2, D: D$3, X: X$2, G: G$2, F
|
|
|
3490
3501
|
|
|
3491
3502
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3492
3503
|
|
|
3493
|
-
const {addPointBounds: addPointBounds, copy: copy$
|
|
3504
|
+
const {addPointBounds: addPointBounds, copy: copy$9, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
3494
3505
|
|
|
3495
3506
|
const debug$d = Debug.get("PathBounds");
|
|
3496
3507
|
|
|
@@ -3572,7 +3583,7 @@ const PathBounds = {
|
|
|
3572
3583
|
|
|
3573
3584
|
case G$2:
|
|
3574
3585
|
ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
|
|
3575
|
-
i === 0 ? copy$
|
|
3586
|
+
i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3576
3587
|
x = setEndPoint.x;
|
|
3577
3588
|
y = setEndPoint.y;
|
|
3578
3589
|
i += 9;
|
|
@@ -3590,7 +3601,7 @@ const PathBounds = {
|
|
|
3590
3601
|
|
|
3591
3602
|
case O$3:
|
|
3592
3603
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3593
|
-
i === 0 ? copy$
|
|
3604
|
+
i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3594
3605
|
x = setEndPoint.x;
|
|
3595
3606
|
y = setEndPoint.y;
|
|
3596
3607
|
i += 7;
|
|
@@ -3607,7 +3618,7 @@ const PathBounds = {
|
|
|
3607
3618
|
|
|
3608
3619
|
case U$2:
|
|
3609
3620
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3610
|
-
i === 0 ? copy$
|
|
3621
|
+
i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3611
3622
|
x = setEndPoint.x;
|
|
3612
3623
|
y = setEndPoint.y;
|
|
3613
3624
|
i += 6;
|
|
@@ -3631,6 +3642,7 @@ const PathCorner = {
|
|
|
3631
3642
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3632
3643
|
let command, lastCommand, commandLen;
|
|
3633
3644
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3645
|
+
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3634
3646
|
const len = data.length;
|
|
3635
3647
|
const smooth = [];
|
|
3636
3648
|
while (i < len) {
|
|
@@ -4046,7 +4058,9 @@ const R = Resource;
|
|
|
4046
4058
|
const ImageManager = {
|
|
4047
4059
|
maxRecycled: 10,
|
|
4048
4060
|
recycledList: [],
|
|
4049
|
-
patternTasker: new TaskProcessor
|
|
4061
|
+
patternTasker: new TaskProcessor({
|
|
4062
|
+
parallel: 1
|
|
4063
|
+
}),
|
|
4050
4064
|
get(config) {
|
|
4051
4065
|
let image = Resource.get(config.url);
|
|
4052
4066
|
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
@@ -4627,7 +4641,7 @@ function registerUIEvent() {
|
|
|
4627
4641
|
};
|
|
4628
4642
|
}
|
|
4629
4643
|
|
|
4630
|
-
const {copy: copy$
|
|
4644
|
+
const {copy: copy$8, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
|
|
4631
4645
|
|
|
4632
4646
|
const matrix$3 = {}, {round: round} = Math;
|
|
4633
4647
|
|
|
@@ -4725,7 +4739,7 @@ const LeafHelper = {
|
|
|
4725
4739
|
if (scaleY) transition = scaleY;
|
|
4726
4740
|
scaleY = scaleX;
|
|
4727
4741
|
}
|
|
4728
|
-
copy$
|
|
4742
|
+
copy$8(matrix$3, o);
|
|
4729
4743
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4730
4744
|
if (L$3.hasHighPosition(t)) {
|
|
4731
4745
|
L$3.setTransform(t, matrix$3, resize, transition);
|
|
@@ -4744,7 +4758,7 @@ const LeafHelper = {
|
|
|
4744
4758
|
},
|
|
4745
4759
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4746
4760
|
const o = t.__localMatrix;
|
|
4747
|
-
copy$
|
|
4761
|
+
copy$8(matrix$3, o);
|
|
4748
4762
|
rotateOfOuter$2(matrix$3, origin, angle);
|
|
4749
4763
|
if (L$3.hasHighPosition(t)) L$3.setTransform(t, matrix$3, false, transition); else t.set({
|
|
4750
4764
|
x: t.x + matrix$3.e - o.e,
|
|
@@ -4756,18 +4770,18 @@ const LeafHelper = {
|
|
|
4756
4770
|
L$3.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4757
4771
|
},
|
|
4758
4772
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4759
|
-
copy$
|
|
4773
|
+
copy$8(matrix$3, t.__localMatrix);
|
|
4760
4774
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4761
4775
|
L$3.setTransform(t, matrix$3, resize, transition);
|
|
4762
4776
|
},
|
|
4763
4777
|
transformWorld(t, transform, resize, transition) {
|
|
4764
|
-
copy$
|
|
4778
|
+
copy$8(matrix$3, t.worldTransform);
|
|
4765
4779
|
multiplyParent$3(matrix$3, transform);
|
|
4766
4780
|
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4767
4781
|
L$3.setTransform(t, matrix$3, resize, transition);
|
|
4768
4782
|
},
|
|
4769
4783
|
transform(t, transform, resize, transition) {
|
|
4770
|
-
copy$
|
|
4784
|
+
copy$8(matrix$3, t.localTransform);
|
|
4771
4785
|
multiplyParent$3(matrix$3, transform);
|
|
4772
4786
|
L$3.setTransform(t, matrix$3, resize, transition);
|
|
4773
4787
|
},
|
|
@@ -4805,7 +4819,7 @@ const LeafHelper = {
|
|
|
4805
4819
|
return innerOrigin;
|
|
4806
4820
|
},
|
|
4807
4821
|
getRelativeWorld(t, relative, temp) {
|
|
4808
|
-
copy$
|
|
4822
|
+
copy$8(matrix$3, t.worldTransform);
|
|
4809
4823
|
divideParent(matrix$3, relative.scrollWorldTransform);
|
|
4810
4824
|
return temp ? matrix$3 : Object.assign({}, matrix$3);
|
|
4811
4825
|
},
|
|
@@ -5013,7 +5027,7 @@ const WaitHelper = {
|
|
|
5013
5027
|
|
|
5014
5028
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2} = LeafHelper;
|
|
5015
5029
|
|
|
5016
|
-
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$
|
|
5030
|
+
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$7} = BoundsHelper;
|
|
5017
5031
|
|
|
5018
5032
|
const localContent = "_localContentBounds";
|
|
5019
5033
|
|
|
@@ -5252,7 +5266,7 @@ class LeafLayout {
|
|
|
5252
5266
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
5253
5267
|
}
|
|
5254
5268
|
if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
|
|
5255
|
-
copy$
|
|
5269
|
+
copy$7(layoutBounds, bounds);
|
|
5256
5270
|
PointHelper.copy(layoutBounds, point);
|
|
5257
5271
|
if (unscale) {
|
|
5258
5272
|
const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
|
|
@@ -5874,7 +5888,7 @@ const LeafDataProxy = {
|
|
|
5874
5888
|
|
|
5875
5889
|
const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
|
|
5876
5890
|
|
|
5877
|
-
const {toPoint: toPoint$4, tempPoint: tempPoint} = AroundHelper;
|
|
5891
|
+
const {toPoint: toPoint$4, tempPoint: tempPoint$1} = AroundHelper;
|
|
5878
5892
|
|
|
5879
5893
|
const LeafMatrix = {
|
|
5880
5894
|
__updateWorldMatrix() {
|
|
@@ -5894,8 +5908,8 @@ const LeafMatrix = {
|
|
|
5894
5908
|
local.e = data.x + data.offsetX;
|
|
5895
5909
|
local.f = data.y + data.offsetY;
|
|
5896
5910
|
if (data.around || data.origin) {
|
|
5897
|
-
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5898
|
-
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5911
|
+
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
5912
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y, !data.around);
|
|
5899
5913
|
}
|
|
5900
5914
|
}
|
|
5901
5915
|
this.__layout.matrixChanged = undefined;
|
|
@@ -5906,7 +5920,7 @@ const {updateMatrix: updateMatrix$2, updateAllMatrix: updateAllMatrix$2} = LeafH
|
|
|
5906
5920
|
|
|
5907
5921
|
const {updateBounds: updateBounds$1} = BranchHelper;
|
|
5908
5922
|
|
|
5909
|
-
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$
|
|
5923
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$2, copy: copy$6} = BoundsHelper;
|
|
5910
5924
|
|
|
5911
5925
|
const {toBounds: toBounds$1} = PathBounds;
|
|
5912
5926
|
|
|
@@ -6017,7 +6031,7 @@ const LeafBounds = {
|
|
|
6017
6031
|
},
|
|
6018
6032
|
__updateRenderBounds(_bounds) {
|
|
6019
6033
|
const layout = this.__layout, {renderSpread: renderSpread} = layout;
|
|
6020
|
-
isNumber(renderSpread) && renderSpread <= 0 ? copy$
|
|
6034
|
+
isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$2(layout.renderBounds, layout.boxBounds, renderSpread);
|
|
6021
6035
|
}
|
|
6022
6036
|
};
|
|
6023
6037
|
|
|
@@ -6122,7 +6136,7 @@ const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: m
|
|
|
6122
6136
|
|
|
6123
6137
|
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
6124
6138
|
|
|
6125
|
-
const {copy: copy$
|
|
6139
|
+
const {copy: copy$5, move: move$4} = PointHelper;
|
|
6126
6140
|
|
|
6127
6141
|
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;
|
|
6128
6142
|
|
|
@@ -6441,14 +6455,14 @@ let Leaf = class Leaf {
|
|
|
6441
6455
|
if (this.parent) {
|
|
6442
6456
|
this.parent.worldToInner(world, to, distance, relative);
|
|
6443
6457
|
} else {
|
|
6444
|
-
if (to) copy$
|
|
6458
|
+
if (to) copy$5(to, world);
|
|
6445
6459
|
}
|
|
6446
6460
|
}
|
|
6447
6461
|
localToWorld(local, to, distance, relative) {
|
|
6448
6462
|
if (this.parent) {
|
|
6449
6463
|
this.parent.innerToWorld(local, to, distance, relative);
|
|
6450
6464
|
} else {
|
|
6451
|
-
if (to) copy$
|
|
6465
|
+
if (to) copy$5(to, local);
|
|
6452
6466
|
}
|
|
6453
6467
|
}
|
|
6454
6468
|
worldToInner(world, to, distance, relative) {
|
|
@@ -6923,7 +6937,7 @@ class LeafLevelList {
|
|
|
6923
6937
|
}
|
|
6924
6938
|
}
|
|
6925
6939
|
|
|
6926
|
-
const version = "1.12.
|
|
6940
|
+
const version = "1.12.2";
|
|
6927
6941
|
|
|
6928
6942
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6929
6943
|
get allowBackgroundColor() {
|
|
@@ -7572,6 +7586,10 @@ class Renderer {
|
|
|
7572
7586
|
|
|
7573
7587
|
Renderer.clipSpread = 10;
|
|
7574
7588
|
|
|
7589
|
+
const tempPoint = {};
|
|
7590
|
+
|
|
7591
|
+
const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
|
|
7592
|
+
|
|
7575
7593
|
const {hitRadiusPoint: hitRadiusPoint$1} = BoundsHelper;
|
|
7576
7594
|
|
|
7577
7595
|
class Picker {
|
|
@@ -7698,15 +7716,15 @@ class Picker {
|
|
|
7698
7716
|
this.eachFind(branch.children, branch.__onlyHitMask);
|
|
7699
7717
|
}
|
|
7700
7718
|
eachFind(children, hitMask) {
|
|
7701
|
-
let child, hit;
|
|
7719
|
+
let child, hit, data;
|
|
7702
7720
|
const {point: point} = this, len = children.length;
|
|
7703
7721
|
for (let i = len - 1; i > -1; i--) {
|
|
7704
|
-
child = children[i];
|
|
7705
|
-
if (!
|
|
7706
|
-
hit = child.
|
|
7722
|
+
child = children[i], data = child.__;
|
|
7723
|
+
if (!data.visible || hitMask && !data.mask) continue;
|
|
7724
|
+
hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint, point, data.hitRadius) : point);
|
|
7707
7725
|
if (child.isBranch) {
|
|
7708
7726
|
if (hit || child.__ignoreHitWorld) {
|
|
7709
|
-
if (child.isBranchLeaf &&
|
|
7727
|
+
if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
|
|
7710
7728
|
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7711
7729
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7712
7730
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
@@ -8193,7 +8211,7 @@ class CanvasData extends RectData {
|
|
|
8193
8211
|
}
|
|
8194
8212
|
}
|
|
8195
8213
|
|
|
8196
|
-
const {max: max$
|
|
8214
|
+
const {max: max$4, add: add$1} = FourNumberHelper;
|
|
8197
8215
|
|
|
8198
8216
|
const UIBounds = {
|
|
8199
8217
|
__updateStrokeSpread() {
|
|
@@ -8209,7 +8227,7 @@ const UIBounds = {
|
|
|
8209
8227
|
}
|
|
8210
8228
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
8211
8229
|
if (box) {
|
|
8212
|
-
spread = max$
|
|
8230
|
+
spread = max$4(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
8213
8231
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
8214
8232
|
}
|
|
8215
8233
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -8219,15 +8237,15 @@ const UIBounds = {
|
|
|
8219
8237
|
let spread = 0;
|
|
8220
8238
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
8221
8239
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
8222
|
-
if (blur) spread = max$
|
|
8240
|
+
if (blur) spread = max$4(spread, blur);
|
|
8223
8241
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
8224
8242
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
8225
8243
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
8226
8244
|
let shapeSpread = spread;
|
|
8227
|
-
if (innerShadow) shapeSpread = max$
|
|
8228
|
-
if (backgroundBlur) shapeSpread = max$
|
|
8245
|
+
if (innerShadow) shapeSpread = max$4(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
8246
|
+
if (backgroundBlur) shapeSpread = max$4(shapeSpread, backgroundBlur);
|
|
8229
8247
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
8230
|
-
return box ? max$
|
|
8248
|
+
return box ? max$4(box.__updateRenderSpread(), spread) : spread;
|
|
8231
8249
|
}
|
|
8232
8250
|
};
|
|
8233
8251
|
|
|
@@ -8283,7 +8301,7 @@ const UIRender = {
|
|
|
8283
8301
|
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
8284
8302
|
}
|
|
8285
8303
|
} else {
|
|
8286
|
-
if (data.
|
|
8304
|
+
if (data.__pathForRender) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
|
|
8287
8305
|
}
|
|
8288
8306
|
},
|
|
8289
8307
|
__drawShape(canvas, options) {
|
|
@@ -8407,7 +8425,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8407
8425
|
getPath(curve, pathForRender) {
|
|
8408
8426
|
this.__layout.update();
|
|
8409
8427
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
8410
|
-
if (!path) pen.set(path = []), this.__drawPathByBox(pen);
|
|
8428
|
+
if (!path) pen.set(path = []), this.__drawPathByBox(pen, !pathForRender);
|
|
8411
8429
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
8412
8430
|
}
|
|
8413
8431
|
getPathString(curve, pathForRender, floatLength) {
|
|
@@ -8435,17 +8453,18 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8435
8453
|
}
|
|
8436
8454
|
__drawPath(canvas) {
|
|
8437
8455
|
canvas.beginPath();
|
|
8438
|
-
this.__drawPathByData(canvas, this.__.path);
|
|
8456
|
+
this.__drawPathByData(canvas, this.__.path, true);
|
|
8439
8457
|
}
|
|
8440
|
-
__drawPathByData(drawer, data) {
|
|
8441
|
-
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
|
|
8458
|
+
__drawPathByData(drawer, data, ignoreCornerRadius) {
|
|
8459
|
+
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer, ignoreCornerRadius);
|
|
8442
8460
|
}
|
|
8443
|
-
__drawPathByBox(drawer) {
|
|
8461
|
+
__drawPathByBox(drawer, ignoreCornerRadius) {
|
|
8444
8462
|
const {x: x, y: y, width: width, height: height} = this.__layout.boxBounds;
|
|
8445
|
-
if (this.__.cornerRadius) {
|
|
8463
|
+
if (this.__.cornerRadius && !ignoreCornerRadius) {
|
|
8446
8464
|
const {cornerRadius: cornerRadius} = this.__;
|
|
8447
8465
|
drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
|
|
8448
8466
|
} else drawer.rect(x, y, width, height);
|
|
8467
|
+
drawer.closePath();
|
|
8449
8468
|
}
|
|
8450
8469
|
drawImagePlaceholder(_paint, canvas, renderOptions) {
|
|
8451
8470
|
Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
|
|
@@ -8714,6 +8733,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8714
8733
|
get layoutLocked() {
|
|
8715
8734
|
return !this.layouter.running;
|
|
8716
8735
|
}
|
|
8736
|
+
get view() {
|
|
8737
|
+
return this.canvas && this.canvas.view;
|
|
8738
|
+
}
|
|
8717
8739
|
get FPS() {
|
|
8718
8740
|
return this.renderer ? this.renderer.FPS : 60;
|
|
8719
8741
|
}
|
|
@@ -8765,7 +8787,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8765
8787
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
8766
8788
|
if (this.isApp) this.__setApp();
|
|
8767
8789
|
this.__checkAutoLayout();
|
|
8768
|
-
this.view = canvas.view;
|
|
8769
8790
|
if (!parentApp) {
|
|
8770
8791
|
this.selector = Creator.selector(this);
|
|
8771
8792
|
this.interaction = Creator.interaction(this, canvas, this.selector, config);
|
|
@@ -9045,7 +9066,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
9045
9066
|
if (this.canvasManager) this.canvasManager.destroy();
|
|
9046
9067
|
}
|
|
9047
9068
|
if (this.canvas) this.canvas.destroy();
|
|
9048
|
-
this.config.view = this.
|
|
9069
|
+
this.config.view = this.parentApp = null;
|
|
9049
9070
|
if (this.userConfig) this.userConfig.view = null;
|
|
9050
9071
|
super.destroy();
|
|
9051
9072
|
setTimeout(() => {
|
|
@@ -9229,7 +9250,6 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9229
9250
|
if (startAngle || endAngle) {
|
|
9230
9251
|
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
|
|
9231
9252
|
ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
|
|
9232
|
-
if (innerRadius < 1) closePath$2(path);
|
|
9233
9253
|
} else {
|
|
9234
9254
|
if (innerRadius < 1) {
|
|
9235
9255
|
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
@@ -9237,16 +9257,16 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9237
9257
|
}
|
|
9238
9258
|
ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
|
|
9239
9259
|
}
|
|
9240
|
-
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
9241
9260
|
} else {
|
|
9242
9261
|
if (startAngle || endAngle) {
|
|
9243
9262
|
moveTo$3(path, rx, ry);
|
|
9244
9263
|
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
|
|
9245
|
-
closePath$2(path);
|
|
9246
9264
|
} else {
|
|
9247
9265
|
ellipse(path, rx, ry, rx, ry);
|
|
9248
9266
|
}
|
|
9249
9267
|
}
|
|
9268
|
+
closePath$2(path);
|
|
9269
|
+
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
9250
9270
|
}
|
|
9251
9271
|
};
|
|
9252
9272
|
|
|
@@ -9897,7 +9917,7 @@ class UIEvent extends Event {
|
|
|
9897
9917
|
}
|
|
9898
9918
|
}
|
|
9899
9919
|
|
|
9900
|
-
const {min: min, max: max$
|
|
9920
|
+
const {min: min$1, max: max$3, abs: abs$6} = Math, {float: float, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
9901
9921
|
|
|
9902
9922
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9903
9923
|
|
|
@@ -9954,7 +9974,7 @@ const DragBoundsHelper = {
|
|
|
9954
9974
|
bSize = float(tempDragBounds.maxX - tempContent.maxX);
|
|
9955
9975
|
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9956
9976
|
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9957
|
-
correctScaleX *= max$
|
|
9977
|
+
correctScaleX *= max$3(aScale, bScale);
|
|
9958
9978
|
} else {
|
|
9959
9979
|
if (scale.x < 0) {
|
|
9960
9980
|
if (float(minX(content) - minX(dragBounds)) <= 0 || float(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
@@ -9964,7 +9984,7 @@ const DragBoundsHelper = {
|
|
|
9964
9984
|
bSize = float(tempContent.maxX - tempDragBounds.maxX);
|
|
9965
9985
|
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9966
9986
|
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9967
|
-
correctScaleX *= min(aScale, bScale);
|
|
9987
|
+
correctScaleX *= min$1(aScale, bScale);
|
|
9968
9988
|
}
|
|
9969
9989
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9970
9990
|
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
@@ -9972,9 +9992,9 @@ const DragBoundsHelper = {
|
|
|
9972
9992
|
bSize = float(tempDragBounds.maxY - tempContent.maxY);
|
|
9973
9993
|
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
9974
9994
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9975
|
-
correctScaleY *= max$
|
|
9995
|
+
correctScaleY *= max$3(aScale, bScale);
|
|
9976
9996
|
if (lockRatio) {
|
|
9977
|
-
aScale = max$
|
|
9997
|
+
aScale = max$3(abs$6(correctScaleX), abs$6(correctScaleY));
|
|
9978
9998
|
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
9979
9999
|
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
9980
10000
|
}
|
|
@@ -9987,7 +10007,7 @@ const DragBoundsHelper = {
|
|
|
9987
10007
|
bSize = float(tempContent.maxY - tempDragBounds.maxY);
|
|
9988
10008
|
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
9989
10009
|
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9990
|
-
correctScaleY *= min(aScale, bScale);
|
|
10010
|
+
correctScaleY *= min$1(aScale, bScale);
|
|
9991
10011
|
}
|
|
9992
10012
|
scale.x *= isFinite$1(correctScaleX) ? correctScaleX : 1;
|
|
9993
10013
|
scale.y *= isFinite$1(correctScaleY) ? correctScaleY : 1;
|
|
@@ -10136,6 +10156,8 @@ MoveEvent.START = "move.start";
|
|
|
10136
10156
|
|
|
10137
10157
|
MoveEvent.MOVE = "move";
|
|
10138
10158
|
|
|
10159
|
+
MoveEvent.DRAG_ANIMATE = "move.drag_animate";
|
|
10160
|
+
|
|
10139
10161
|
MoveEvent.END = "move.end";
|
|
10140
10162
|
|
|
10141
10163
|
MoveEvent = __decorate([ registerUIEvent() ], MoveEvent);
|
|
@@ -10234,6 +10256,7 @@ const InteractionHelper = {
|
|
|
10234
10256
|
ctrlKey: e.ctrlKey,
|
|
10235
10257
|
shiftKey: e.shiftKey,
|
|
10236
10258
|
metaKey: e.metaKey,
|
|
10259
|
+
time: Date.now(),
|
|
10237
10260
|
buttons: isUndefined(e.buttons) ? 1 : e.buttons === 0 ? pointerUpButtons : e.buttons,
|
|
10238
10261
|
origin: e
|
|
10239
10262
|
};
|
|
@@ -10269,6 +10292,7 @@ const {getDragEventData: getDragEventData, getDropEventData: getDropEventData, g
|
|
|
10269
10292
|
|
|
10270
10293
|
class Dragger {
|
|
10271
10294
|
constructor(interaction) {
|
|
10295
|
+
this.dragDataList = [];
|
|
10272
10296
|
this.interaction = interaction;
|
|
10273
10297
|
}
|
|
10274
10298
|
setDragData(data) {
|
|
@@ -10331,6 +10355,7 @@ class Dragger {
|
|
|
10331
10355
|
this.dragData = getDragEventData(downData, dragData, data);
|
|
10332
10356
|
if (throughPath) this.dragData.throughPath = throughPath;
|
|
10333
10357
|
this.dragData.path = path;
|
|
10358
|
+
this.dragDataList.push(this.dragData);
|
|
10334
10359
|
if (this.moving) {
|
|
10335
10360
|
data.moving = true;
|
|
10336
10361
|
this.dragData.moveType = "drag";
|
|
@@ -10381,9 +10406,9 @@ class Dragger {
|
|
|
10381
10406
|
interaction.emit(DragEvent.ENTER, data, path, dragEnterPath);
|
|
10382
10407
|
this.dragEnterPath = path;
|
|
10383
10408
|
}
|
|
10384
|
-
dragEnd(data
|
|
10409
|
+
dragEnd(data) {
|
|
10385
10410
|
if (!this.dragging && !this.moving) return;
|
|
10386
|
-
if (this.checkDragEndAnimate(data
|
|
10411
|
+
if (this.checkDragEndAnimate(data)) return;
|
|
10387
10412
|
this.dragEndReal(data);
|
|
10388
10413
|
}
|
|
10389
10414
|
dragEndReal(data) {
|
|
@@ -10425,11 +10450,13 @@ class Dragger {
|
|
|
10425
10450
|
}
|
|
10426
10451
|
dragReset() {
|
|
10427
10452
|
DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
|
|
10453
|
+
this.dragDataList = [];
|
|
10428
10454
|
}
|
|
10429
10455
|
checkDragEndAnimate(_data, _speed) {
|
|
10430
10456
|
return false;
|
|
10431
10457
|
}
|
|
10432
10458
|
animate(_func, _off) {}
|
|
10459
|
+
stopAnimate() {}
|
|
10433
10460
|
checkDragOut(_data) {}
|
|
10434
10461
|
autoMoveOnDragOut(_data) {}
|
|
10435
10462
|
autoMoveCancel() {}
|
|
@@ -10823,6 +10850,9 @@ class InteractionBase {
|
|
|
10823
10850
|
this.pointerHover(hoverData);
|
|
10824
10851
|
}
|
|
10825
10852
|
}
|
|
10853
|
+
stopDragAnimate() {
|
|
10854
|
+
this.dragger.stopAnimate();
|
|
10855
|
+
}
|
|
10826
10856
|
updateDownData(data, options, merge) {
|
|
10827
10857
|
const {downData: downData} = this;
|
|
10828
10858
|
if (!data && downData) data = downData;
|
|
@@ -11006,7 +11036,7 @@ Platform.getSelector = function(leaf) {
|
|
|
11006
11036
|
return leaf.leafer ? leaf.leafer.selector : Platform.selector || (Platform.selector = Creator.selector());
|
|
11007
11037
|
};
|
|
11008
11038
|
|
|
11009
|
-
const {toInnerRadiusPointOf: toInnerRadiusPointOf,
|
|
11039
|
+
const {toInnerRadiusPointOf: toInnerRadiusPointOf, copyRadiusPoint: copyRadiusPoint} = PointHelper;
|
|
11010
11040
|
|
|
11011
11041
|
const {hitRadiusPoint: hitRadiusPoint, hitPoint: hitPoint} = BoundsHelper;
|
|
11012
11042
|
|
|
@@ -11016,8 +11046,7 @@ const leaf$1 = Leaf.prototype;
|
|
|
11016
11046
|
|
|
11017
11047
|
leaf$1.hit = function(worldPoint, hitRadius = 0) {
|
|
11018
11048
|
this.updateLayout();
|
|
11019
|
-
|
|
11020
|
-
setRadius(worldRadiusPoint, hitRadius);
|
|
11049
|
+
copyRadiusPoint(worldRadiusPoint, worldPoint, hitRadius);
|
|
11021
11050
|
const world = this.__world;
|
|
11022
11051
|
if (hitRadius ? !hitRadiusPoint(world, worldRadiusPoint) : !hitPoint(world, worldRadiusPoint)) return false;
|
|
11023
11052
|
return this.isBranch ? Platform.getSelector(this).hitPoint(Object.assign({}, worldRadiusPoint), hitRadius, {
|
|
@@ -11031,8 +11060,8 @@ leaf$1.__hitWorld = function(point, forceHitFill) {
|
|
|
11031
11060
|
const world = this.__world, layout = this.__layout;
|
|
11032
11061
|
const isSmall = world.width < 10 && world.height < 10;
|
|
11033
11062
|
if (data.hitRadius) {
|
|
11034
|
-
|
|
11035
|
-
|
|
11063
|
+
copyRadiusPoint(inner, point, data.hitRadius);
|
|
11064
|
+
point = inner;
|
|
11036
11065
|
}
|
|
11037
11066
|
toInnerRadiusPointOf(point, world, inner);
|
|
11038
11067
|
if (data.hitBox || isSmall) {
|
|
@@ -11840,10 +11869,12 @@ const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$5} = Math;
|
|
|
11840
11869
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
11841
11870
|
if (!paint.patternTask) {
|
|
11842
11871
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
11843
|
-
paint
|
|
11844
|
-
if (canvas.bounds.hit(ui.__nowWorld)) PaintImage.createPattern(paint, ui, canvas, renderOptions);
|
|
11872
|
+
PaintImage.createPattern(paint, ui, canvas, renderOptions);
|
|
11845
11873
|
ui.forceUpdate("surface");
|
|
11846
|
-
}),
|
|
11874
|
+
}), 0, () => {
|
|
11875
|
+
paint.patternTask = null;
|
|
11876
|
+
return canvas.bounds.hit(ui.__nowWorld);
|
|
11877
|
+
});
|
|
11847
11878
|
}
|
|
11848
11879
|
}
|
|
11849
11880
|
|
|
@@ -12093,7 +12124,7 @@ const PaintGradientModule = {
|
|
|
12093
12124
|
getTransform: getTransform
|
|
12094
12125
|
};
|
|
12095
12126
|
|
|
12096
|
-
const {copy: copy$3, move: move$2, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$
|
|
12127
|
+
const {copy: copy$3, move: move$2, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$4} = Math;
|
|
12097
12128
|
|
|
12098
12129
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
12099
12130
|
|
|
@@ -12138,10 +12169,10 @@ function getShadowRenderSpread(_ui, shadow) {
|
|
|
12138
12169
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
12139
12170
|
shadow.forEach(item => {
|
|
12140
12171
|
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$4(item.spread || 0);
|
|
12141
|
-
top = max$
|
|
12142
|
-
right = max$
|
|
12143
|
-
bottom = max$
|
|
12144
|
-
left = max$
|
|
12172
|
+
top = max$2(top, spread + blur - y);
|
|
12173
|
+
right = max$2(right, spread + blur + x);
|
|
12174
|
+
bottom = max$2(bottom, spread + blur + y);
|
|
12175
|
+
left = max$2(left, spread + blur - x);
|
|
12145
12176
|
});
|
|
12146
12177
|
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
12147
12178
|
}
|
|
@@ -13020,7 +13051,11 @@ class Stroker extends UI {
|
|
|
13020
13051
|
matrix$1.half = strokeWidth % 2;
|
|
13021
13052
|
canvas.setWorld(matrix$1, options.matrix);
|
|
13022
13053
|
canvas.beginPath();
|
|
13023
|
-
if (
|
|
13054
|
+
if (this.strokePathType === "path") {
|
|
13055
|
+
leaf.__drawPath(canvas);
|
|
13056
|
+
} else {
|
|
13057
|
+
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
13058
|
+
}
|
|
13024
13059
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
13025
13060
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
13026
13061
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
@@ -13037,6 +13072,8 @@ class Stroker extends UI {
|
|
|
13037
13072
|
|
|
13038
13073
|
__decorate([ targetAttr(onTarget$1) ], Stroker.prototype, "target", void 0);
|
|
13039
13074
|
|
|
13075
|
+
__decorate([ surfaceType("render-path") ], Stroker.prototype, "strokePathType", void 0);
|
|
13076
|
+
|
|
13040
13077
|
function onTarget$1(stroker) {
|
|
13041
13078
|
const value = stroker.target;
|
|
13042
13079
|
stroker.list = value ? isArray(value) ? value : [ value ] : [];
|
|
@@ -13151,10 +13188,11 @@ class EditSelect extends Group {
|
|
|
13151
13188
|
}
|
|
13152
13189
|
update() {
|
|
13153
13190
|
this.hoverStroker.update();
|
|
13154
|
-
const {stroke: stroke, strokeWidth: strokeWidth, selectedStyle: selectedStyle} = this.editor.mergedConfig;
|
|
13191
|
+
const {stroke: stroke, strokeWidth: strokeWidth, selectedPathType: selectedPathType, selectedStyle: selectedStyle} = this.editor.mergedConfig;
|
|
13155
13192
|
this.targetStroker.update(Object.assign({
|
|
13156
13193
|
stroke: stroke,
|
|
13157
|
-
strokeWidth: strokeWidth && Math.max(1, strokeWidth / 2)
|
|
13194
|
+
strokeWidth: strokeWidth && Math.max(1, strokeWidth / 2),
|
|
13195
|
+
strokePathType: selectedPathType
|
|
13158
13196
|
}, selectedStyle || {}));
|
|
13159
13197
|
}
|
|
13160
13198
|
onPointerMove(e) {
|
|
@@ -14539,7 +14577,7 @@ class TransformTool {
|
|
|
14539
14577
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
14540
14578
|
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
|
|
14541
14579
|
if (e instanceof ZoomEvent) {
|
|
14542
|
-
around = target.getBoxPoint(e);
|
|
14580
|
+
if (!around) around = target.getBoxPoint(e);
|
|
14543
14581
|
totalMove = e.totalScale;
|
|
14544
14582
|
} else {
|
|
14545
14583
|
totalMove = e.getInnerTotal(target);
|
|
@@ -15596,7 +15634,11 @@ function addViewport(leafer, mergeConfig, custom) {
|
|
|
15596
15634
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
15597
15635
|
if (leafer.isApp || custom) return;
|
|
15598
15636
|
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, e => {
|
|
15599
|
-
|
|
15637
|
+
const move = leafer.getValidMove(e.moveX, e.moveY, false);
|
|
15638
|
+
leafer.zoomLayer.move(move);
|
|
15639
|
+
}), leafer.on_(MoveEvent.DRAG_ANIMATE, () => {
|
|
15640
|
+
const move = leafer.getValidMove(0, 0);
|
|
15641
|
+
if (move.x || move.y) leafer.interaction.stopDragAnimate();
|
|
15600
15642
|
}), leafer.on_(MoveEvent.END, e => {
|
|
15601
15643
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
15602
15644
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
@@ -15747,7 +15789,7 @@ const MultiTouchHelper = {
|
|
|
15747
15789
|
|
|
15748
15790
|
const M$2 = MultiTouchHelper;
|
|
15749
15791
|
|
|
15750
|
-
const {abs: abs$1, max: max} = Math, {sign: sign, within: within} = MathHelper;
|
|
15792
|
+
const {abs: abs$1, max: max$1} = Math, {sign: sign, within: within} = MathHelper;
|
|
15751
15793
|
|
|
15752
15794
|
const WheelEventHelper = {
|
|
15753
15795
|
getMove(event, config) {
|
|
@@ -15758,8 +15800,8 @@ const WheelEventHelper = {
|
|
|
15758
15800
|
deltaY = 0;
|
|
15759
15801
|
}
|
|
15760
15802
|
const absX = abs$1(deltaX), absY = abs$1(deltaY);
|
|
15761
|
-
if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX);
|
|
15762
|
-
if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY);
|
|
15803
|
+
if (absX > 50) deltaX = max$1(50, absX / 3) * sign(deltaX);
|
|
15804
|
+
if (absY > 50) deltaY = max$1(50, absY / 3) * sign(deltaY);
|
|
15763
15805
|
return {
|
|
15764
15806
|
x: -deltaX * moveSpeed * 2,
|
|
15765
15807
|
y: -deltaY * moveSpeed * 2
|
|
@@ -15909,7 +15951,7 @@ leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
|
15909
15951
|
if (type.includes("x")) move.y = 0; else if (type.includes("y")) move.x = 0; else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0;
|
|
15910
15952
|
if (checkLimit && type.includes("limit")) {
|
|
15911
15953
|
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
15912
|
-
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "
|
|
15954
|
+
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "auto", move, true);
|
|
15913
15955
|
if (type.includes("x")) move.y = 0; else if (type.includes("y")) move.x = 0;
|
|
15914
15956
|
}
|
|
15915
15957
|
}
|
|
@@ -16017,22 +16059,52 @@ interaction.multiTouch = function(data, list) {
|
|
|
16017
16059
|
|
|
16018
16060
|
const dragger = Dragger.prototype;
|
|
16019
16061
|
|
|
16020
|
-
const {abs: abs} = Math;
|
|
16062
|
+
const {abs: abs, min: min, max: max, hypot: hypot} = Math;
|
|
16021
16063
|
|
|
16022
|
-
dragger.checkDragEndAnimate = function(data
|
|
16023
|
-
const {
|
|
16024
|
-
const
|
|
16025
|
-
const dragAnimate = this.canAnimate && this.moving && (absMoveX > minMove || absMoveY > minMove) && this.interaction.m.dragAnimate;
|
|
16064
|
+
dragger.checkDragEndAnimate = function(data) {
|
|
16065
|
+
const {interaction: interaction} = this;
|
|
16066
|
+
const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate;
|
|
16026
16067
|
if (dragAnimate) {
|
|
16027
|
-
const inertia =
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
this.
|
|
16033
|
-
|
|
16034
|
-
|
|
16035
|
-
|
|
16068
|
+
const inertia = isNumber(dragAnimate) ? dragAnimate : .95;
|
|
16069
|
+
const stopMove = .15;
|
|
16070
|
+
const maxMove = 150;
|
|
16071
|
+
let moveX = 0, moveY = 0, flickSpeed = 0;
|
|
16072
|
+
let totalWeight = 0, weight, w = 3, s, frame;
|
|
16073
|
+
const {dragDataList: dragDataList} = this, len = dragDataList.length;
|
|
16074
|
+
for (let i = len - 1; i >= max(len - 3, 0); i--) {
|
|
16075
|
+
frame = dragDataList[i];
|
|
16076
|
+
if (frame.time && Date.now() - frame.time > 100) break;
|
|
16077
|
+
weight = w--;
|
|
16078
|
+
moveX += frame.moveX * weight;
|
|
16079
|
+
moveY += frame.moveY * weight;
|
|
16080
|
+
totalWeight += weight;
|
|
16081
|
+
s = hypot(frame.moveX, frame.moveY);
|
|
16082
|
+
if (s > flickSpeed) flickSpeed = s;
|
|
16083
|
+
}
|
|
16084
|
+
if (totalWeight) moveX /= totalWeight, moveY /= totalWeight;
|
|
16085
|
+
if (flickSpeed > 8) {
|
|
16086
|
+
const t = min((flickSpeed - 8) / 17, 1);
|
|
16087
|
+
const boost = 1.15 + t * (1.6 - 1.15);
|
|
16088
|
+
moveX *= boost;
|
|
16089
|
+
moveY *= boost;
|
|
16090
|
+
}
|
|
16091
|
+
const maxAbs = max(abs(moveX), abs(moveY));
|
|
16092
|
+
if (maxAbs > maxMove) {
|
|
16093
|
+
s = maxMove / maxAbs;
|
|
16094
|
+
moveX *= s;
|
|
16095
|
+
moveY *= s;
|
|
16096
|
+
}
|
|
16097
|
+
const step = () => {
|
|
16098
|
+
moveX *= inertia;
|
|
16099
|
+
moveY *= inertia;
|
|
16100
|
+
data = Object.assign({}, data);
|
|
16101
|
+
if (abs(moveX) < stopMove && abs(moveY) < stopMove) return this.dragEndReal(data);
|
|
16102
|
+
PointHelper.move(data, moveX, moveY);
|
|
16103
|
+
this.drag(data);
|
|
16104
|
+
this.animate(step);
|
|
16105
|
+
interaction.emit(MoveEvent.DRAG_ANIMATE, data);
|
|
16106
|
+
};
|
|
16107
|
+
this.animate(step);
|
|
16036
16108
|
}
|
|
16037
16109
|
return dragAnimate;
|
|
16038
16110
|
};
|
|
@@ -16043,6 +16115,13 @@ dragger.animate = function(func, off) {
|
|
|
16043
16115
|
this.animateWait = func;
|
|
16044
16116
|
};
|
|
16045
16117
|
|
|
16118
|
+
dragger.stopAnimate = function() {
|
|
16119
|
+
this.animate(null, "off");
|
|
16120
|
+
this.interaction.target.nextRender(() => {
|
|
16121
|
+
if (this.dragData) this.dragEndReal(this.dragData);
|
|
16122
|
+
});
|
|
16123
|
+
};
|
|
16124
|
+
|
|
16046
16125
|
dragger.checkDragOut = function(data) {
|
|
16047
16126
|
const {interaction: interaction} = this;
|
|
16048
16127
|
this.autoMoveCancel();
|
|
@@ -16114,7 +16193,6 @@ function getFixBounds(bounds, scaleBounds) {
|
|
|
16114
16193
|
Plugin.add("view");
|
|
16115
16194
|
|
|
16116
16195
|
Leafer.prototype.zoom = function(zoomType, optionsOrPadding, scroll, transition) {
|
|
16117
|
-
this.killAnimate();
|
|
16118
16196
|
let padding;
|
|
16119
16197
|
if (isData(optionsOrPadding)) {
|
|
16120
16198
|
padding = optionsOrPadding.padding;
|
|
@@ -16127,8 +16205,9 @@ Leafer.prototype.zoom = function(zoomType, optionsOrPadding, scroll, transition)
|
|
|
16127
16205
|
x: limitBounds.x + limitBounds.width / 2,
|
|
16128
16206
|
y: limitBounds.y + limitBounds.height / 2
|
|
16129
16207
|
};
|
|
16208
|
+
zoomLayer.killAnimate();
|
|
16130
16209
|
let changeScale;
|
|
16131
|
-
const {x: x, y: y, scaleX: scaleX, scaleY: scaleY} = zoomLayer.__;
|
|
16210
|
+
const {x: x, y: y, scaleX: scaleX, scaleY: scaleY} = zoomLayer.__, {boxBounds: boxBounds} = zoomLayer;
|
|
16132
16211
|
if (isString(zoomType)) {
|
|
16133
16212
|
switch (zoomType) {
|
|
16134
16213
|
case "in":
|
|
@@ -16140,16 +16219,16 @@ Leafer.prototype.zoom = function(zoomType, optionsOrPadding, scroll, transition)
|
|
|
16140
16219
|
break;
|
|
16141
16220
|
|
|
16142
16221
|
case "fit":
|
|
16143
|
-
zoomType =
|
|
16222
|
+
zoomType = boxBounds;
|
|
16144
16223
|
break;
|
|
16145
16224
|
|
|
16146
16225
|
case "fit-width":
|
|
16147
|
-
zoomType = new Bounds(
|
|
16226
|
+
zoomType = new Bounds(boxBounds);
|
|
16148
16227
|
zoomType.height = 0;
|
|
16149
16228
|
break;
|
|
16150
16229
|
|
|
16151
16230
|
case "fit-height":
|
|
16152
|
-
zoomType = new Bounds(
|
|
16231
|
+
zoomType = new Bounds(boxBounds);
|
|
16153
16232
|
zoomType.width = 0;
|
|
16154
16233
|
break;
|
|
16155
16234
|
}
|
|
@@ -16794,6 +16873,7 @@ class Finder {
|
|
|
16794
16873
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
16795
16874
|
child = children[i];
|
|
16796
16875
|
result = method(child, options);
|
|
16876
|
+
if (typeof result === "boolean") result = result ? 1 : 0;
|
|
16797
16877
|
if (result === Yes || result === YesAndSkip) {
|
|
16798
16878
|
if (list) {
|
|
16799
16879
|
list.push(child);
|
|
@@ -17502,4 +17582,4 @@ HTMLText = __decorate([ registerUI() ], HTMLText);
|
|
|
17502
17582
|
|
|
17503
17583
|
Plugin.add("html");
|
|
17504
17584
|
|
|
17505
|
-
export { AlignHelper, 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, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, 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, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, 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$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$
|
|
17585
|
+
export { AlignHelper, 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, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, 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, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, 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$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|