@leafer/worker 2.0.5 → 2.0.7
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.cjs +11 -0
- package/dist/worker.esm.js +2 -0
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +451 -169
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +462 -169
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +27 -26
- package/src/index.ts +1 -0
- package/types/index.d.ts +1 -0
package/dist/worker.js
CHANGED
|
@@ -491,13 +491,13 @@ var LeaferUI = function(exports) {
|
|
|
491
491
|
to.f = t.f * pixelRatio;
|
|
492
492
|
},
|
|
493
493
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
494
|
-
M$
|
|
495
|
-
M$
|
|
494
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
495
|
+
M$c.scaleOfInner(t, tempPoint$5, scaleX, scaleY);
|
|
496
496
|
},
|
|
497
497
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
498
|
-
M$
|
|
499
|
-
M$
|
|
500
|
-
M$
|
|
498
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
499
|
+
M$c.scale(t, scaleX, scaleY);
|
|
500
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
501
501
|
},
|
|
502
502
|
rotate(t, rotation) {
|
|
503
503
|
const {a: a, b: b, c: c, d: d} = t;
|
|
@@ -510,13 +510,13 @@ var LeaferUI = function(exports) {
|
|
|
510
510
|
t.d = c * sinR + d * cosR;
|
|
511
511
|
},
|
|
512
512
|
rotateOfOuter(t, origin, rotation) {
|
|
513
|
-
M$
|
|
514
|
-
M$
|
|
513
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
514
|
+
M$c.rotateOfInner(t, tempPoint$5, rotation);
|
|
515
515
|
},
|
|
516
516
|
rotateOfInner(t, origin, rotation) {
|
|
517
|
-
M$
|
|
518
|
-
M$
|
|
519
|
-
M$
|
|
517
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
518
|
+
M$c.rotate(t, rotation);
|
|
519
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
520
520
|
},
|
|
521
521
|
skew(t, skewX, skewY) {
|
|
522
522
|
const {a: a, b: b, c: c, d: d} = t;
|
|
@@ -532,13 +532,13 @@ var LeaferUI = function(exports) {
|
|
|
532
532
|
}
|
|
533
533
|
},
|
|
534
534
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
535
|
-
M$
|
|
536
|
-
M$
|
|
535
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
536
|
+
M$c.skewOfInner(t, tempPoint$5, skewX, skewY);
|
|
537
537
|
},
|
|
538
538
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
539
|
-
M$
|
|
540
|
-
M$
|
|
541
|
-
M$
|
|
539
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
540
|
+
M$c.skew(t, skewX, skewY);
|
|
541
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
542
542
|
},
|
|
543
543
|
multiply(t, child) {
|
|
544
544
|
const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
|
|
@@ -577,15 +577,15 @@ var LeaferUI = function(exports) {
|
|
|
577
577
|
to.f = e * parent.b + f * parent.d + parent.f;
|
|
578
578
|
},
|
|
579
579
|
divide(t, child) {
|
|
580
|
-
M$
|
|
580
|
+
M$c.multiply(t, M$c.tempInvert(child));
|
|
581
581
|
},
|
|
582
582
|
divideParent(t, parent) {
|
|
583
|
-
M$
|
|
583
|
+
M$c.multiplyParent(t, M$c.tempInvert(parent));
|
|
584
584
|
},
|
|
585
585
|
tempInvert(t) {
|
|
586
|
-
const {tempMatrix: tempMatrix} = M$
|
|
587
|
-
M$
|
|
588
|
-
M$
|
|
586
|
+
const {tempMatrix: tempMatrix} = M$c;
|
|
587
|
+
M$c.copy(tempMatrix, t);
|
|
588
|
+
M$c.invert(tempMatrix);
|
|
589
589
|
return tempMatrix;
|
|
590
590
|
},
|
|
591
591
|
invert(t) {
|
|
@@ -663,7 +663,7 @@ var LeaferUI = function(exports) {
|
|
|
663
663
|
}
|
|
664
664
|
t.e = x;
|
|
665
665
|
t.f = y;
|
|
666
|
-
if (origin = origin || around) M$
|
|
666
|
+
if (origin = origin || around) M$c.translateInner(t, -origin.x, -origin.y, !around);
|
|
667
667
|
},
|
|
668
668
|
getLayout(t, origin, around, firstSkewY) {
|
|
669
669
|
const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
|
|
@@ -724,10 +724,10 @@ var LeaferUI = function(exports) {
|
|
|
724
724
|
return world;
|
|
725
725
|
},
|
|
726
726
|
reset(t) {
|
|
727
|
-
M$
|
|
727
|
+
M$c.set(t);
|
|
728
728
|
}
|
|
729
729
|
};
|
|
730
|
-
const M$
|
|
730
|
+
const M$c = MatrixHelper;
|
|
731
731
|
const {float: float$5} = MathHelper;
|
|
732
732
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
733
733
|
const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
|
|
@@ -2521,12 +2521,12 @@ var LeaferUI = function(exports) {
|
|
|
2521
2521
|
const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$9, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2522
2522
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2523
2523
|
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2524
|
-
const {M: M$
|
|
2524
|
+
const {M: M$b, L: L$b, C: C$9, Q: Q$7, Z: Z$9} = PathCommandMap;
|
|
2525
2525
|
const tempPoint$3 = {};
|
|
2526
2526
|
const BezierHelper = {
|
|
2527
2527
|
points(data, originPoints, curve, close) {
|
|
2528
2528
|
let points = toNumberPoints$1(originPoints);
|
|
2529
|
-
data.push(M$
|
|
2529
|
+
data.push(M$b, points[0], points[1]);
|
|
2530
2530
|
if (curve && points.length > 5) {
|
|
2531
2531
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
2532
2532
|
let baX, baY, ba, cb, d, len = points.length;
|
|
@@ -2557,7 +2557,7 @@ var LeaferUI = function(exports) {
|
|
|
2557
2557
|
if (i === 2) {
|
|
2558
2558
|
if (!close) data.push(Q$7, c1X, c1Y, bX, bY);
|
|
2559
2559
|
} else {
|
|
2560
|
-
if (baX || baY) data.push(C$
|
|
2560
|
+
if (baX || baY) data.push(C$9, c2X, c2Y, c1X, c1Y, bX, bY);
|
|
2561
2561
|
}
|
|
2562
2562
|
c2X = bX + cb * cX;
|
|
2563
2563
|
c2Y = bY + cb * cY;
|
|
@@ -2565,10 +2565,10 @@ var LeaferUI = function(exports) {
|
|
|
2565
2565
|
if (!close) data.push(Q$7, c2X, c2Y, points[len - 2], points[len - 1]);
|
|
2566
2566
|
} else {
|
|
2567
2567
|
for (let i = 2, len = points.length; i < len; i += 2) {
|
|
2568
|
-
data.push(L$
|
|
2568
|
+
data.push(L$b, points[i], points[i + 1]);
|
|
2569
2569
|
}
|
|
2570
2570
|
}
|
|
2571
|
-
if (close) data.push(Z$
|
|
2571
|
+
if (close) data.push(Z$9);
|
|
2572
2572
|
},
|
|
2573
2573
|
rect(data, x, y, width, height) {
|
|
2574
2574
|
PathHelper.creator.path = data;
|
|
@@ -2591,7 +2591,7 @@ var LeaferUI = function(exports) {
|
|
|
2591
2591
|
let totalRadian = endRadian - startRadian;
|
|
2592
2592
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2593
2593
|
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$9(totalRadian - PI$3) < 1e-12) {
|
|
2594
|
-
if (data) data.push(L$
|
|
2594
|
+
if (data) data.push(L$b, x1, y1);
|
|
2595
2595
|
if (setPointBounds) {
|
|
2596
2596
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
2597
2597
|
addPoint$2(setPointBounds, x1, y1);
|
|
@@ -2635,7 +2635,7 @@ var LeaferUI = function(exports) {
|
|
|
2635
2635
|
let startX = x = rotationCos * radiusX * startCos - rotationSin * radiusY * startSin;
|
|
2636
2636
|
let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
|
|
2637
2637
|
let fromX = cx + x, fromY = cy + y;
|
|
2638
|
-
if (data) data.push(data.length ? L$
|
|
2638
|
+
if (data) data.push(data.length ? L$b : M$b, fromX, fromY);
|
|
2639
2639
|
if (setPointBounds) setPoint$4(setPointBounds, fromX, fromY);
|
|
2640
2640
|
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2641
2641
|
for (let i = 0; i < parts; i++) {
|
|
@@ -2647,7 +2647,7 @@ var LeaferUI = function(exports) {
|
|
|
2647
2647
|
y1 = cy + startY - control * (rotationSin * radiusX * startSin - rotationCos * radiusY * startCos);
|
|
2648
2648
|
x2 = cx + x + control * (rotationCos * radiusX * endSin + rotationSin * radiusY * endCos);
|
|
2649
2649
|
y2 = cy + y + control * (rotationSin * radiusX * endSin - rotationCos * radiusY * endCos);
|
|
2650
|
-
if (data) data.push(C$
|
|
2650
|
+
if (data) data.push(C$9, x1, y1, x2, y2, cx + x, cy + y);
|
|
2651
2651
|
if (setPointBounds) toTwoPointBounds$1(cx + startX, cy + startY, x1, y1, x2, y2, cx + x, cy + y, setPointBounds, true);
|
|
2652
2652
|
startX = x;
|
|
2653
2653
|
startY = y;
|
|
@@ -2659,7 +2659,7 @@ var LeaferUI = function(exports) {
|
|
|
2659
2659
|
if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
|
|
2660
2660
|
},
|
|
2661
2661
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2662
|
-
data.push(C$
|
|
2662
|
+
data.push(C$9, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
2663
2663
|
},
|
|
2664
2664
|
toTwoPointBoundsByQuadraticCurve(fromX, fromY, x1, y1, toX, toY, pointBounds, addMode) {
|
|
2665
2665
|
toTwoPointBounds$1(fromX, fromY, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY, pointBounds, addMode);
|
|
@@ -2709,6 +2709,32 @@ var LeaferUI = function(exports) {
|
|
|
2709
2709
|
getDerivative(t, fromV, v1, v2, toV) {
|
|
2710
2710
|
const o = 1 - t;
|
|
2711
2711
|
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2712
|
+
},
|
|
2713
|
+
cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
2714
|
+
if (t <= 0) return {
|
|
2715
|
+
left: null,
|
|
2716
|
+
right: [ x1, y1, x2, y2, toX, toY ]
|
|
2717
|
+
}; else if (t >= 1) return {
|
|
2718
|
+
left: [ x1, y1, x2, y2, toX, toY ],
|
|
2719
|
+
right: null
|
|
2720
|
+
};
|
|
2721
|
+
const u = 1 - t;
|
|
2722
|
+
const leftX1 = fromX * u + x1 * t;
|
|
2723
|
+
const leftY1 = fromY * u + y1 * t;
|
|
2724
|
+
const P12x = x1 * u + x2 * t;
|
|
2725
|
+
const P12y = y1 * u + y2 * t;
|
|
2726
|
+
const rightX2 = x2 * u + toX * t;
|
|
2727
|
+
const rightY2 = y2 * u + toY * t;
|
|
2728
|
+
const leftX2 = leftX1 * u + P12x * t;
|
|
2729
|
+
const leftY2 = leftY1 * u + P12y * t;
|
|
2730
|
+
const rightX1 = P12x * u + rightX2 * t;
|
|
2731
|
+
const rightY1 = P12y * u + rightY2 * t;
|
|
2732
|
+
const leftX = leftX2 * u + rightX1 * t;
|
|
2733
|
+
const leftY = leftY2 * u + rightY1 * t;
|
|
2734
|
+
return {
|
|
2735
|
+
left: [ leftX1, leftY1, leftX2, leftY2, leftX, leftY ],
|
|
2736
|
+
right: [ rightX1, rightY1, rightX2, rightY2, toX, toY ]
|
|
2737
|
+
};
|
|
2712
2738
|
}
|
|
2713
2739
|
};
|
|
2714
2740
|
const {getPointAndSet: getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$8} = BezierHelper;
|
|
@@ -2768,8 +2794,8 @@ var LeaferUI = function(exports) {
|
|
|
2768
2794
|
return [];
|
|
2769
2795
|
}
|
|
2770
2796
|
};
|
|
2771
|
-
const {M: M$
|
|
2772
|
-
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$
|
|
2797
|
+
const {M: M$a, m: m, L: L$a, l: l, H: H, h: h, V: V, v: v, C: C$8, c: c, S: S$1, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$8, 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;
|
|
2798
|
+
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$4, arc: arc$3, ellipse: ellipse$6, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2773
2799
|
const {ellipticalArc: ellipticalArc} = EllipseHelper;
|
|
2774
2800
|
const debug$f = Debug.get("PathConvert");
|
|
2775
2801
|
const setEndPoint$1 = {};
|
|
@@ -2855,10 +2881,10 @@ var LeaferUI = function(exports) {
|
|
|
2855
2881
|
old[i + 1] += x;
|
|
2856
2882
|
old[i + 2] += y;
|
|
2857
2883
|
|
|
2858
|
-
case M$
|
|
2884
|
+
case M$a:
|
|
2859
2885
|
x = old[i + 1];
|
|
2860
2886
|
y = old[i + 2];
|
|
2861
|
-
data.push(M$
|
|
2887
|
+
data.push(M$a, x, y);
|
|
2862
2888
|
i += 3;
|
|
2863
2889
|
break;
|
|
2864
2890
|
|
|
@@ -2867,7 +2893,7 @@ var LeaferUI = function(exports) {
|
|
|
2867
2893
|
|
|
2868
2894
|
case H:
|
|
2869
2895
|
x = old[i + 1];
|
|
2870
|
-
data.push(L$
|
|
2896
|
+
data.push(L$a, x, y);
|
|
2871
2897
|
i += 2;
|
|
2872
2898
|
break;
|
|
2873
2899
|
|
|
@@ -2876,7 +2902,7 @@ var LeaferUI = function(exports) {
|
|
|
2876
2902
|
|
|
2877
2903
|
case V:
|
|
2878
2904
|
y = old[i + 1];
|
|
2879
|
-
data.push(L$
|
|
2905
|
+
data.push(L$a, x, y);
|
|
2880
2906
|
i += 2;
|
|
2881
2907
|
break;
|
|
2882
2908
|
|
|
@@ -2884,10 +2910,10 @@ var LeaferUI = function(exports) {
|
|
|
2884
2910
|
old[i + 1] += x;
|
|
2885
2911
|
old[i + 2] += y;
|
|
2886
2912
|
|
|
2887
|
-
case L$
|
|
2913
|
+
case L$a:
|
|
2888
2914
|
x = old[i + 1];
|
|
2889
2915
|
y = old[i + 2];
|
|
2890
|
-
data.push(L$
|
|
2916
|
+
data.push(L$a, x, y);
|
|
2891
2917
|
i += 3;
|
|
2892
2918
|
break;
|
|
2893
2919
|
|
|
@@ -2899,14 +2925,14 @@ var LeaferUI = function(exports) {
|
|
|
2899
2925
|
command = S$1;
|
|
2900
2926
|
|
|
2901
2927
|
case S$1:
|
|
2902
|
-
smooth = lastCommand === C$
|
|
2928
|
+
smooth = lastCommand === C$8 || lastCommand === S$1;
|
|
2903
2929
|
x1 = smooth ? x * 2 - controlX : old[i + 1];
|
|
2904
2930
|
y1 = smooth ? y * 2 - controlY : old[i + 2];
|
|
2905
2931
|
controlX = old[i + 1];
|
|
2906
2932
|
controlY = old[i + 2];
|
|
2907
2933
|
x = old[i + 3];
|
|
2908
2934
|
y = old[i + 4];
|
|
2909
|
-
data.push(C$
|
|
2935
|
+
data.push(C$8, x1, y1, controlX, controlY, x, y);
|
|
2910
2936
|
i += 5;
|
|
2911
2937
|
break;
|
|
2912
2938
|
|
|
@@ -2917,14 +2943,14 @@ var LeaferUI = function(exports) {
|
|
|
2917
2943
|
old[i + 4] += y;
|
|
2918
2944
|
old[i + 5] += x;
|
|
2919
2945
|
old[i + 6] += y;
|
|
2920
|
-
command = C$
|
|
2946
|
+
command = C$8;
|
|
2921
2947
|
|
|
2922
|
-
case C$
|
|
2948
|
+
case C$8:
|
|
2923
2949
|
controlX = old[i + 3];
|
|
2924
2950
|
controlY = old[i + 4];
|
|
2925
2951
|
x = old[i + 5];
|
|
2926
2952
|
y = old[i + 6];
|
|
2927
|
-
data.push(C$
|
|
2953
|
+
data.push(C$8, old[i + 1], old[i + 2], controlX, controlY, x, y);
|
|
2928
2954
|
i += 7;
|
|
2929
2955
|
break;
|
|
2930
2956
|
|
|
@@ -2971,8 +2997,8 @@ var LeaferUI = function(exports) {
|
|
|
2971
2997
|
break;
|
|
2972
2998
|
|
|
2973
2999
|
case z:
|
|
2974
|
-
case Z$
|
|
2975
|
-
data.push(Z$
|
|
3000
|
+
case Z$8:
|
|
3001
|
+
data.push(Z$8);
|
|
2976
3002
|
i++;
|
|
2977
3003
|
break;
|
|
2978
3004
|
|
|
@@ -3026,7 +3052,7 @@ var LeaferUI = function(exports) {
|
|
|
3026
3052
|
break;
|
|
3027
3053
|
|
|
3028
3054
|
case U$5:
|
|
3029
|
-
arcTo$
|
|
3055
|
+
arcTo$4(curveMode ? data : copyData(data, old, i, 6), x, y, old[i + 1], old[i + 2], old[i + 3], old[i + 4], old[i + 5], null, setEndPoint$1);
|
|
3030
3056
|
x = setEndPoint$1.x;
|
|
3031
3057
|
y = setEndPoint$1.y;
|
|
3032
3058
|
i += 6;
|
|
@@ -3048,15 +3074,15 @@ var LeaferUI = function(exports) {
|
|
|
3048
3074
|
list.forEach(item => {
|
|
3049
3075
|
switch (item.name) {
|
|
3050
3076
|
case "M":
|
|
3051
|
-
data.push(M$
|
|
3077
|
+
data.push(M$a, item.x, item.y);
|
|
3052
3078
|
break;
|
|
3053
3079
|
|
|
3054
3080
|
case "L":
|
|
3055
|
-
data.push(L$
|
|
3081
|
+
data.push(L$a, item.x, item.y);
|
|
3056
3082
|
break;
|
|
3057
3083
|
|
|
3058
3084
|
case "C":
|
|
3059
|
-
data.push(C$
|
|
3085
|
+
data.push(C$8, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
|
|
3060
3086
|
break;
|
|
3061
3087
|
|
|
3062
3088
|
case "Q":
|
|
@@ -3064,7 +3090,7 @@ var LeaferUI = function(exports) {
|
|
|
3064
3090
|
break;
|
|
3065
3091
|
|
|
3066
3092
|
case "Z":
|
|
3067
|
-
data.push(Z$
|
|
3093
|
+
data.push(Z$8);
|
|
3068
3094
|
}
|
|
3069
3095
|
});
|
|
3070
3096
|
return data;
|
|
@@ -3086,7 +3112,7 @@ var LeaferUI = function(exports) {
|
|
|
3086
3112
|
}
|
|
3087
3113
|
};
|
|
3088
3114
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3089
|
-
const {M: M$
|
|
3115
|
+
const {M: M$9, L: L$9, C: C$7, Q: Q$5, Z: Z$7, 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;
|
|
3090
3116
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3091
3117
|
const {tan: tan, min: min$2, abs: abs$8} = Math;
|
|
3092
3118
|
const startPoint = {};
|
|
@@ -3095,19 +3121,19 @@ var LeaferUI = function(exports) {
|
|
|
3095
3121
|
data.length = 0;
|
|
3096
3122
|
},
|
|
3097
3123
|
moveTo(data, x, y) {
|
|
3098
|
-
data.push(M$
|
|
3124
|
+
data.push(M$9, x, y);
|
|
3099
3125
|
},
|
|
3100
3126
|
lineTo(data, x, y) {
|
|
3101
|
-
data.push(L$
|
|
3127
|
+
data.push(L$9, x, y);
|
|
3102
3128
|
},
|
|
3103
3129
|
bezierCurveTo(data, x1, y1, x2, y2, x, y) {
|
|
3104
|
-
data.push(C$
|
|
3130
|
+
data.push(C$7, x1, y1, x2, y2, x, y);
|
|
3105
3131
|
},
|
|
3106
3132
|
quadraticCurveTo(data, x1, y1, x, y) {
|
|
3107
3133
|
data.push(Q$5, x1, y1, x, y);
|
|
3108
3134
|
},
|
|
3109
3135
|
closePath(data) {
|
|
3110
|
-
data.push(Z$
|
|
3136
|
+
data.push(Z$7);
|
|
3111
3137
|
},
|
|
3112
3138
|
rect(data, x, y, width, height) {
|
|
3113
3139
|
data.push(N$4, x, y, width, height);
|
|
@@ -3152,12 +3178,12 @@ var LeaferUI = function(exports) {
|
|
|
3152
3178
|
},
|
|
3153
3179
|
drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
3154
3180
|
BezierHelper.ellipse(null, x, y, radiusX, radiusY, isNull(rotation) ? 0 : rotation, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
3155
|
-
data.push(M$
|
|
3181
|
+
data.push(M$9, startPoint.x, startPoint.y);
|
|
3156
3182
|
ellipse$5(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
3157
3183
|
},
|
|
3158
3184
|
drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
3159
3185
|
BezierHelper.arc(null, x, y, radius, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
3160
|
-
data.push(M$
|
|
3186
|
+
data.push(M$9, startPoint.x, startPoint.y);
|
|
3161
3187
|
arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
3162
3188
|
},
|
|
3163
3189
|
drawPoints(data, points, curve, close) {
|
|
@@ -3165,7 +3191,7 @@ var LeaferUI = function(exports) {
|
|
|
3165
3191
|
}
|
|
3166
3192
|
};
|
|
3167
3193
|
const {ellipse: ellipse$5, arc: arc$2} = PathCommandDataHelper;
|
|
3168
|
-
const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$4, arc: arc$1, arcTo: arcTo$
|
|
3194
|
+
const {moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo: quadraticCurveTo, bezierCurveTo: bezierCurveTo, closePath: closePath$3, beginPath: beginPath, rect: rect$2, roundRect: roundRect$1, ellipse: ellipse$4, arc: arc$1, arcTo: arcTo$3, drawEllipse: drawEllipse, drawArc: drawArc, drawPoints: drawPoints$2} = PathCommandDataHelper;
|
|
3169
3195
|
class PathCreator {
|
|
3170
3196
|
set path(value) {
|
|
3171
3197
|
this.__path = value;
|
|
@@ -3231,7 +3257,7 @@ var LeaferUI = function(exports) {
|
|
|
3231
3257
|
return this;
|
|
3232
3258
|
}
|
|
3233
3259
|
arcTo(x1, y1, x2, y2, radius) {
|
|
3234
|
-
arcTo$
|
|
3260
|
+
arcTo$3(this.__path, x1, y1, x2, y2, radius);
|
|
3235
3261
|
this.paint();
|
|
3236
3262
|
return this;
|
|
3237
3263
|
}
|
|
@@ -3255,7 +3281,7 @@ var LeaferUI = function(exports) {
|
|
|
3255
3281
|
}
|
|
3256
3282
|
paint() {}
|
|
3257
3283
|
}
|
|
3258
|
-
const {M: M$
|
|
3284
|
+
const {M: M$8, L: L$8, C: C$6, Q: Q$4, Z: Z$6, 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;
|
|
3259
3285
|
const debug$e = Debug.get("PathDrawer");
|
|
3260
3286
|
const PathDrawer = {
|
|
3261
3287
|
drawPathByData(drawer, data) {
|
|
@@ -3265,17 +3291,17 @@ var LeaferUI = function(exports) {
|
|
|
3265
3291
|
while (i < len) {
|
|
3266
3292
|
command = data[i];
|
|
3267
3293
|
switch (command) {
|
|
3268
|
-
case M$
|
|
3294
|
+
case M$8:
|
|
3269
3295
|
drawer.moveTo(data[i + 1], data[i + 2]);
|
|
3270
3296
|
i += 3;
|
|
3271
3297
|
break;
|
|
3272
3298
|
|
|
3273
|
-
case L$
|
|
3299
|
+
case L$8:
|
|
3274
3300
|
drawer.lineTo(data[i + 1], data[i + 2]);
|
|
3275
3301
|
i += 3;
|
|
3276
3302
|
break;
|
|
3277
3303
|
|
|
3278
|
-
case C$
|
|
3304
|
+
case C$6:
|
|
3279
3305
|
drawer.bezierCurveTo(data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6]);
|
|
3280
3306
|
i += 7;
|
|
3281
3307
|
break;
|
|
@@ -3285,7 +3311,7 @@ var LeaferUI = function(exports) {
|
|
|
3285
3311
|
i += 5;
|
|
3286
3312
|
break;
|
|
3287
3313
|
|
|
3288
|
-
case Z$
|
|
3314
|
+
case Z$6:
|
|
3289
3315
|
drawer.closePath();
|
|
3290
3316
|
i += 1;
|
|
3291
3317
|
break;
|
|
@@ -3337,8 +3363,8 @@ var LeaferUI = function(exports) {
|
|
|
3337
3363
|
}
|
|
3338
3364
|
}
|
|
3339
3365
|
};
|
|
3340
|
-
const {M: M$
|
|
3341
|
-
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$
|
|
3366
|
+
const {M: M$7, L: L$7, C: C$5, Q: Q$3, Z: Z$5, 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;
|
|
3367
|
+
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$2, arc: arc, ellipse: ellipse$3} = BezierHelper;
|
|
3342
3368
|
const {addPointBounds: addPointBounds, copy: copy$9, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
3343
3369
|
const debug$d = Debug.get("PathBounds");
|
|
3344
3370
|
let radius, radiusX, radiusY;
|
|
@@ -3357,22 +3383,22 @@ var LeaferUI = function(exports) {
|
|
|
3357
3383
|
while (i < len) {
|
|
3358
3384
|
command = data[i];
|
|
3359
3385
|
if (i === 0) {
|
|
3360
|
-
if (command === Z$
|
|
3386
|
+
if (command === Z$5 || command === C$5 || command === Q$3) {
|
|
3361
3387
|
setPoint$3(setPointBounds, x, y);
|
|
3362
3388
|
} else {
|
|
3363
3389
|
setPoint$3(setPointBounds, data[i + 1], data[i + 2]);
|
|
3364
3390
|
}
|
|
3365
3391
|
}
|
|
3366
3392
|
switch (command) {
|
|
3367
|
-
case M$
|
|
3368
|
-
case L$
|
|
3393
|
+
case M$7:
|
|
3394
|
+
case L$7:
|
|
3369
3395
|
x = data[i + 1];
|
|
3370
3396
|
y = data[i + 2];
|
|
3371
3397
|
addPoint$1(setPointBounds, x, y);
|
|
3372
3398
|
i += 3;
|
|
3373
3399
|
break;
|
|
3374
3400
|
|
|
3375
|
-
case C$
|
|
3401
|
+
case C$5:
|
|
3376
3402
|
toX = data[i + 5];
|
|
3377
3403
|
toY = data[i + 6];
|
|
3378
3404
|
toTwoPointBounds(x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], toX, toY, tempPointBounds);
|
|
@@ -3394,7 +3420,7 @@ var LeaferUI = function(exports) {
|
|
|
3394
3420
|
i += 5;
|
|
3395
3421
|
break;
|
|
3396
3422
|
|
|
3397
|
-
case Z$
|
|
3423
|
+
case Z$5:
|
|
3398
3424
|
i += 1;
|
|
3399
3425
|
break;
|
|
3400
3426
|
|
|
@@ -3449,7 +3475,7 @@ var LeaferUI = function(exports) {
|
|
|
3449
3475
|
break;
|
|
3450
3476
|
|
|
3451
3477
|
case U$2:
|
|
3452
|
-
arcTo$
|
|
3478
|
+
arcTo$2(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3453
3479
|
i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3454
3480
|
x = setEndPoint.x;
|
|
3455
3481
|
y = setEndPoint.y;
|
|
@@ -3463,9 +3489,9 @@ var LeaferUI = function(exports) {
|
|
|
3463
3489
|
}
|
|
3464
3490
|
}
|
|
3465
3491
|
};
|
|
3466
|
-
const {M: M$
|
|
3467
|
-
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
3468
|
-
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
3492
|
+
const {M: M$6, L: L$6, Z: Z$4} = PathCommandMap;
|
|
3493
|
+
const {getCenterX: getCenterX$1, getCenterY: getCenterY$1} = PointHelper;
|
|
3494
|
+
const {arcTo: arcTo$1} = PathCommandDataHelper;
|
|
3469
3495
|
const PathCorner = {
|
|
3470
3496
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3471
3497
|
let command, lastCommand, commandLen;
|
|
@@ -3476,43 +3502,43 @@ var LeaferUI = function(exports) {
|
|
|
3476
3502
|
while (i < len) {
|
|
3477
3503
|
command = data[i];
|
|
3478
3504
|
switch (command) {
|
|
3479
|
-
case M$
|
|
3505
|
+
case M$6:
|
|
3480
3506
|
startX = lastX = data[i + 1];
|
|
3481
3507
|
startY = lastY = data[i + 2];
|
|
3482
3508
|
i += 3;
|
|
3483
|
-
if (data[i] === L$
|
|
3509
|
+
if (data[i] === L$6) {
|
|
3484
3510
|
secondX = data[i + 1];
|
|
3485
3511
|
secondY = data[i + 2];
|
|
3486
|
-
three ? smooth.push(M$
|
|
3512
|
+
three ? smooth.push(M$6, startX, startY) : smooth.push(M$6, getCenterX$1(startX, secondX), getCenterY$1(startY, secondY));
|
|
3487
3513
|
} else {
|
|
3488
|
-
smooth.push(M$
|
|
3514
|
+
smooth.push(M$6, startX, startY);
|
|
3489
3515
|
}
|
|
3490
3516
|
break;
|
|
3491
3517
|
|
|
3492
|
-
case L$
|
|
3518
|
+
case L$6:
|
|
3493
3519
|
x = data[i + 1];
|
|
3494
3520
|
y = data[i + 2];
|
|
3495
3521
|
i += 3;
|
|
3496
3522
|
switch (data[i]) {
|
|
3497
|
-
case L$
|
|
3498
|
-
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3523
|
+
case L$6:
|
|
3524
|
+
arcTo$1(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3499
3525
|
break;
|
|
3500
3526
|
|
|
3501
|
-
case Z$
|
|
3502
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3527
|
+
case Z$4:
|
|
3528
|
+
arcTo$1(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3503
3529
|
break;
|
|
3504
3530
|
|
|
3505
3531
|
default:
|
|
3506
|
-
smooth.push(L$
|
|
3532
|
+
smooth.push(L$6, x, y);
|
|
3507
3533
|
}
|
|
3508
3534
|
lastX = x;
|
|
3509
3535
|
lastY = y;
|
|
3510
3536
|
break;
|
|
3511
3537
|
|
|
3512
|
-
case Z$
|
|
3513
|
-
if (lastCommand !== Z$
|
|
3514
|
-
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3515
|
-
smooth.push(Z$
|
|
3538
|
+
case Z$4:
|
|
3539
|
+
if (lastCommand !== Z$4) {
|
|
3540
|
+
arcTo$1(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3541
|
+
smooth.push(Z$4);
|
|
3516
3542
|
}
|
|
3517
3543
|
i += 1;
|
|
3518
3544
|
break;
|
|
@@ -3524,7 +3550,7 @@ var LeaferUI = function(exports) {
|
|
|
3524
3550
|
}
|
|
3525
3551
|
lastCommand = command;
|
|
3526
3552
|
}
|
|
3527
|
-
if (command !== Z$
|
|
3553
|
+
if (command !== Z$4) {
|
|
3528
3554
|
smooth[1] = startX;
|
|
3529
3555
|
smooth[2] = startY;
|
|
3530
3556
|
}
|
|
@@ -4492,7 +4518,7 @@ var LeaferUI = function(exports) {
|
|
|
4492
4518
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4493
4519
|
leaf.__updateChange();
|
|
4494
4520
|
if (layout.surfaceChanged) {
|
|
4495
|
-
if (leaf.__hasComplex) L$
|
|
4521
|
+
if (leaf.__hasComplex) L$5.updateComplex(leaf);
|
|
4496
4522
|
layout.surfaceChanged = false;
|
|
4497
4523
|
}
|
|
4498
4524
|
},
|
|
@@ -4528,7 +4554,7 @@ var LeaferUI = function(exports) {
|
|
|
4528
4554
|
y: y
|
|
4529
4555
|
};
|
|
4530
4556
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4531
|
-
L$
|
|
4557
|
+
L$5.moveLocal(t, local.x, local.y, transition);
|
|
4532
4558
|
},
|
|
4533
4559
|
moveLocal(t, x, y = 0, transition) {
|
|
4534
4560
|
if (isObject(x)) y = x.y, x = x.x;
|
|
@@ -4541,7 +4567,7 @@ var LeaferUI = function(exports) {
|
|
|
4541
4567
|
}, transition) : (t.x = x, t.y = y);
|
|
4542
4568
|
},
|
|
4543
4569
|
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
4544
|
-
L$
|
|
4570
|
+
L$5.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
|
|
4545
4571
|
},
|
|
4546
4572
|
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
|
|
4547
4573
|
const o = t.__localMatrix;
|
|
@@ -4551,8 +4577,8 @@ var LeaferUI = function(exports) {
|
|
|
4551
4577
|
}
|
|
4552
4578
|
copy$8(matrix$3, o);
|
|
4553
4579
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4554
|
-
if (L$
|
|
4555
|
-
L$
|
|
4580
|
+
if (L$5.hasHighPosition(t)) {
|
|
4581
|
+
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4556
4582
|
} else {
|
|
4557
4583
|
const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.f - o.f;
|
|
4558
4584
|
if (transition && !resize) t.animate({
|
|
@@ -4564,41 +4590,41 @@ var LeaferUI = function(exports) {
|
|
|
4564
4590
|
}
|
|
4565
4591
|
},
|
|
4566
4592
|
rotateOfWorld(t, origin, angle, transition) {
|
|
4567
|
-
L$
|
|
4593
|
+
L$5.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
|
|
4568
4594
|
},
|
|
4569
4595
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4570
4596
|
const o = t.__localMatrix;
|
|
4571
4597
|
copy$8(matrix$3, o);
|
|
4572
4598
|
rotateOfOuter$2(matrix$3, origin, angle);
|
|
4573
|
-
if (L$
|
|
4599
|
+
if (L$5.hasHighPosition(t)) L$5.setTransform(t, matrix$3, false, transition); else t.set({
|
|
4574
4600
|
x: t.x + matrix$3.e - o.e,
|
|
4575
4601
|
y: t.y + matrix$3.f - o.f,
|
|
4576
4602
|
rotation: MathHelper.formatRotation(t.rotation + angle)
|
|
4577
4603
|
}, transition);
|
|
4578
4604
|
},
|
|
4579
4605
|
skewOfWorld(t, origin, skewX, skewY, resize, transition) {
|
|
4580
|
-
L$
|
|
4606
|
+
L$5.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4581
4607
|
},
|
|
4582
4608
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4583
4609
|
copy$8(matrix$3, t.__localMatrix);
|
|
4584
4610
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4585
|
-
L$
|
|
4611
|
+
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4586
4612
|
},
|
|
4587
4613
|
transformWorld(t, transform, resize, transition) {
|
|
4588
4614
|
copy$8(matrix$3, t.worldTransform);
|
|
4589
4615
|
multiplyParent$3(matrix$3, transform);
|
|
4590
4616
|
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4591
|
-
L$
|
|
4617
|
+
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4592
4618
|
},
|
|
4593
4619
|
transform(t, transform, resize, transition) {
|
|
4594
4620
|
copy$8(matrix$3, t.localTransform);
|
|
4595
4621
|
multiplyParent$3(matrix$3, transform);
|
|
4596
|
-
L$
|
|
4622
|
+
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4597
4623
|
},
|
|
4598
4624
|
setTransform(t, transform, resize, transition) {
|
|
4599
|
-
const data = t.__, originPoint = data.origin && L$
|
|
4600
|
-
const layout = getLayout(transform, originPoint, data.around && L$
|
|
4601
|
-
if (L$
|
|
4625
|
+
const data = t.__, originPoint = data.origin && L$5.getInnerOrigin(t, data.origin);
|
|
4626
|
+
const layout = getLayout(transform, originPoint, data.around && L$5.getInnerOrigin(t, data.around));
|
|
4627
|
+
if (L$5.hasOffset(t)) {
|
|
4602
4628
|
layout.x -= data.offsetX;
|
|
4603
4629
|
layout.y -= data.offsetY;
|
|
4604
4630
|
}
|
|
@@ -4607,7 +4633,7 @@ var LeaferUI = function(exports) {
|
|
|
4607
4633
|
delete layout.scaleX, delete layout.scaleY;
|
|
4608
4634
|
if (originPoint) {
|
|
4609
4635
|
BoundsHelper.scale(t.boxBounds, Math.abs(scaleX), Math.abs(scaleY));
|
|
4610
|
-
const changedPoint = L$
|
|
4636
|
+
const changedPoint = L$5.getInnerOrigin(t, data.origin);
|
|
4611
4637
|
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4612
4638
|
}
|
|
4613
4639
|
t.set(layout);
|
|
@@ -4617,11 +4643,11 @@ var LeaferUI = function(exports) {
|
|
|
4617
4643
|
getFlipTransform(t, axis) {
|
|
4618
4644
|
const m = getMatrixData();
|
|
4619
4645
|
const sign = axis === "x" ? 1 : -1;
|
|
4620
|
-
scaleOfOuter$2(m, L$
|
|
4646
|
+
scaleOfOuter$2(m, L$5.getLocalOrigin(t, "center"), -1 * sign, 1 * sign);
|
|
4621
4647
|
return m;
|
|
4622
4648
|
},
|
|
4623
4649
|
getLocalOrigin(t, origin) {
|
|
4624
|
-
return PointHelper.tempToOuterOf(L$
|
|
4650
|
+
return PointHelper.tempToOuterOf(L$5.getInnerOrigin(t, origin), t.localTransform);
|
|
4625
4651
|
},
|
|
4626
4652
|
getInnerOrigin(t, origin) {
|
|
4627
4653
|
const innerOrigin = {};
|
|
@@ -4637,11 +4663,11 @@ var LeaferUI = function(exports) {
|
|
|
4637
4663
|
updateOuterBounds(_t) {},
|
|
4638
4664
|
cacheId(_t) {},
|
|
4639
4665
|
drop(t, parent, index, resize) {
|
|
4640
|
-
t.setTransform(L$
|
|
4666
|
+
t.setTransform(L$5.getRelativeWorld(t, parent, true), resize);
|
|
4641
4667
|
parent.add(t, index);
|
|
4642
4668
|
},
|
|
4643
4669
|
hasHighPosition(t) {
|
|
4644
|
-
return t.origin || t.around || L$
|
|
4670
|
+
return t.origin || t.around || L$5.hasOffset(t);
|
|
4645
4671
|
},
|
|
4646
4672
|
hasOffset(t) {
|
|
4647
4673
|
return t.offsetX || t.offsetY;
|
|
@@ -4661,12 +4687,12 @@ var LeaferUI = function(exports) {
|
|
|
4661
4687
|
const x = move.x * speed, y = move.y * speed;
|
|
4662
4688
|
move.x -= x, move.y -= y;
|
|
4663
4689
|
t.move(x, y);
|
|
4664
|
-
Platform.requestRender(() => L$
|
|
4690
|
+
Platform.requestRender(() => L$5.animateMove(t, move, speed));
|
|
4665
4691
|
}
|
|
4666
4692
|
}
|
|
4667
4693
|
};
|
|
4668
|
-
const L$
|
|
4669
|
-
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$
|
|
4694
|
+
const L$5 = LeafHelper;
|
|
4695
|
+
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$5;
|
|
4670
4696
|
function getTempLocal(t, worldPoint) {
|
|
4671
4697
|
t.updateLayout();
|
|
4672
4698
|
return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
|
|
@@ -6637,7 +6663,7 @@ var LeaferUI = function(exports) {
|
|
|
6637
6663
|
this.levelMap = null;
|
|
6638
6664
|
}
|
|
6639
6665
|
}
|
|
6640
|
-
const version = "2.0.
|
|
6666
|
+
const version = "2.0.7";
|
|
6641
6667
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6642
6668
|
get allowBackgroundColor() {
|
|
6643
6669
|
return true;
|
|
@@ -8045,6 +8071,7 @@ var LeaferUI = function(exports) {
|
|
|
8045
8071
|
createProxyData() {
|
|
8046
8072
|
return undefined;
|
|
8047
8073
|
}
|
|
8074
|
+
clearProxyData() {}
|
|
8048
8075
|
find(_condition, _options) {
|
|
8049
8076
|
return Plugin.need("find");
|
|
8050
8077
|
}
|
|
@@ -8085,7 +8112,7 @@ var LeaferUI = function(exports) {
|
|
|
8085
8112
|
__updateRenderPath(updateCache) {
|
|
8086
8113
|
const data = this.__;
|
|
8087
8114
|
if (data.path) {
|
|
8088
|
-
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8115
|
+
data.__pathForRender = data.cornerRadius || data.path.radius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8089
8116
|
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8090
8117
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8091
8118
|
}
|
|
@@ -8804,7 +8831,7 @@ var LeaferUI = function(exports) {
|
|
|
8804
8831
|
}
|
|
8805
8832
|
}
|
|
8806
8833
|
if (!open) closePath$2(path);
|
|
8807
|
-
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
8834
|
+
if (Platform.ellipseToCurve || data.__useArrow || data.cornerRadius) data.path = this.getPath(true);
|
|
8808
8835
|
}
|
|
8809
8836
|
};
|
|
8810
8837
|
__decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
|
|
@@ -8822,7 +8849,7 @@ var LeaferUI = function(exports) {
|
|
|
8822
8849
|
const data = this.__;
|
|
8823
8850
|
const path = data.path = [];
|
|
8824
8851
|
if (data.points) {
|
|
8825
|
-
drawPoints$1(path, data.points, data.curve,
|
|
8852
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
8826
8853
|
} else {
|
|
8827
8854
|
const {width: width, height: height, sides: sides} = data;
|
|
8828
8855
|
const rx = width / 2, ry = height / 2;
|
|
@@ -10963,17 +10990,19 @@ var LeaferUI = function(exports) {
|
|
|
10963
10990
|
return leafPaint;
|
|
10964
10991
|
}
|
|
10965
10992
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
10993
|
+
let needUpdate = true;
|
|
10966
10994
|
const data = ui.__;
|
|
10967
10995
|
if (attrName === "fill" && !data.__naturalWidth) {
|
|
10968
10996
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
10969
10997
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
10970
10998
|
if (data.__autoSide) {
|
|
10971
10999
|
ui.forceUpdate("width");
|
|
11000
|
+
LeafHelper.updateBounds(ui);
|
|
10972
11001
|
if (ui.__proxyData) {
|
|
10973
11002
|
ui.setProxyAttr("width", data.width);
|
|
10974
11003
|
ui.setProxyAttr("height", data.height);
|
|
10975
11004
|
}
|
|
10976
|
-
|
|
11005
|
+
needUpdate = false;
|
|
10977
11006
|
}
|
|
10978
11007
|
}
|
|
10979
11008
|
if (!leafPaint.data) {
|
|
@@ -10983,7 +11012,7 @@ var LeaferUI = function(exports) {
|
|
|
10983
11012
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
10984
11013
|
}
|
|
10985
11014
|
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
10986
|
-
return
|
|
11015
|
+
return needUpdate;
|
|
10987
11016
|
}
|
|
10988
11017
|
function onLoad(ui, event) {
|
|
10989
11018
|
emit(ui, ImageEvent.LOAD, event);
|
|
@@ -11386,10 +11415,10 @@ var LeaferUI = function(exports) {
|
|
|
11386
11415
|
const realFrom = {};
|
|
11387
11416
|
const realTo = {};
|
|
11388
11417
|
function conicGradient(paint, box) {
|
|
11389
|
-
let {from: from, to: to, type: type, opacity: opacity, stretch: stretch} = paint;
|
|
11418
|
+
let {from: from, to: to, type: type, opacity: opacity, rotation: rotation, stretch: stretch} = paint;
|
|
11390
11419
|
toPoint$1(from || "center", box, realFrom);
|
|
11391
11420
|
toPoint$1(to || "bottom", box, realTo);
|
|
11392
|
-
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance$1(realFrom, realTo));
|
|
11421
|
+
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(rotation ? rotation * OneRadian : 0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance$1(realFrom, realTo));
|
|
11393
11422
|
const data = {
|
|
11394
11423
|
type: type,
|
|
11395
11424
|
style: style
|
|
@@ -12144,11 +12173,7 @@ var LeaferUI = function(exports) {
|
|
|
12144
12173
|
});
|
|
12145
12174
|
if (isObject(check)) value = check; else if (check === false) return;
|
|
12146
12175
|
}
|
|
12147
|
-
if (t.hasDimOthers)
|
|
12148
|
-
t.setDimOthers(false);
|
|
12149
|
-
t.setBright(false);
|
|
12150
|
-
t.hasDimOthers = undefined;
|
|
12151
|
-
}
|
|
12176
|
+
if (t.hasDimOthers) t.cancelDimOthers();
|
|
12152
12177
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
12153
12178
|
if (t.single) {
|
|
12154
12179
|
delete t.element.syncEventer;
|
|
@@ -13055,6 +13080,8 @@ var LeaferUI = function(exports) {
|
|
|
13055
13080
|
editor.setDimOthers(dimOthers);
|
|
13056
13081
|
editor.setBright(!!dimOthers || bright);
|
|
13057
13082
|
editor.hasDimOthers = true;
|
|
13083
|
+
} else if (editor.hasDimOthers) {
|
|
13084
|
+
editor.cancelDimOthers();
|
|
13058
13085
|
}
|
|
13059
13086
|
if (spread) BoundsHelper.spread(bounds, spread);
|
|
13060
13087
|
if (this.view.worldOpacity) {
|
|
@@ -14044,6 +14071,11 @@ var LeaferUI = function(exports) {
|
|
|
14044
14071
|
setBright(value) {
|
|
14045
14072
|
this.setDimOthers(value, "bright", this.list);
|
|
14046
14073
|
}
|
|
14074
|
+
cancelDimOthers() {
|
|
14075
|
+
this.setDimOthers(false);
|
|
14076
|
+
this.setBright(false);
|
|
14077
|
+
this.hasDimOthers = undefined;
|
|
14078
|
+
}
|
|
14047
14079
|
update() {
|
|
14048
14080
|
if (this.editing) {
|
|
14049
14081
|
if (!this.element.parent) return this.cancel();
|
|
@@ -14495,7 +14527,7 @@ var LeaferUI = function(exports) {
|
|
|
14495
14527
|
}
|
|
14496
14528
|
};
|
|
14497
14529
|
exports.LineEditTool = __decorate([ registerEditTool() ], exports.LineEditTool);
|
|
14498
|
-
const {M: M$
|
|
14530
|
+
const {M: M$5, L: L$4, C: C$4, Q: Q$2, Z: Z$3, 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;
|
|
14499
14531
|
const PathScaler = {
|
|
14500
14532
|
scale(data, scaleX, scaleY) {
|
|
14501
14533
|
if (!data) return;
|
|
@@ -14504,13 +14536,13 @@ var LeaferUI = function(exports) {
|
|
|
14504
14536
|
while (i < len) {
|
|
14505
14537
|
command = data[i];
|
|
14506
14538
|
switch (command) {
|
|
14507
|
-
case M$
|
|
14508
|
-
case L$
|
|
14539
|
+
case M$5:
|
|
14540
|
+
case L$4:
|
|
14509
14541
|
scalePoints(data, scaleX, scaleY, i, 1);
|
|
14510
14542
|
i += 3;
|
|
14511
14543
|
break;
|
|
14512
14544
|
|
|
14513
|
-
case C$
|
|
14545
|
+
case C$4:
|
|
14514
14546
|
scalePoints(data, scaleX, scaleY, i, 3);
|
|
14515
14547
|
i += 7;
|
|
14516
14548
|
break;
|
|
@@ -14520,7 +14552,7 @@ var LeaferUI = function(exports) {
|
|
|
14520
14552
|
i += 5;
|
|
14521
14553
|
break;
|
|
14522
14554
|
|
|
14523
|
-
case Z$
|
|
14555
|
+
case Z$3:
|
|
14524
14556
|
i += 1;
|
|
14525
14557
|
break;
|
|
14526
14558
|
|
|
@@ -15104,13 +15136,13 @@ var LeaferUI = function(exports) {
|
|
|
15104
15136
|
return "rotate";
|
|
15105
15137
|
},
|
|
15106
15138
|
detect(data, config) {
|
|
15107
|
-
const {state: state} = M$
|
|
15108
|
-
const type = M$
|
|
15139
|
+
const {state: state} = M$4;
|
|
15140
|
+
const type = M$4.getType(data, config);
|
|
15109
15141
|
if (!state.totalData) {
|
|
15110
15142
|
state.startTime = Date.now();
|
|
15111
15143
|
state.center = data.center;
|
|
15112
15144
|
}
|
|
15113
|
-
M$
|
|
15145
|
+
M$4.add(data, state.totalData);
|
|
15114
15146
|
state.totalData = data;
|
|
15115
15147
|
if (type === state.type) {
|
|
15116
15148
|
state.typeCount++;
|
|
@@ -15119,7 +15151,7 @@ var LeaferUI = function(exports) {
|
|
|
15119
15151
|
state.type = type;
|
|
15120
15152
|
state.typeCount = 1;
|
|
15121
15153
|
}
|
|
15122
|
-
if (Date.now() - state.startTime >= (config.time || 160)) return M$
|
|
15154
|
+
if (Date.now() - state.startTime >= (config.time || 160)) return M$4.getType(state.totalData, config);
|
|
15123
15155
|
return "none";
|
|
15124
15156
|
},
|
|
15125
15157
|
add(data, add) {
|
|
@@ -15130,14 +15162,14 @@ var LeaferUI = function(exports) {
|
|
|
15130
15162
|
data.center = add.center;
|
|
15131
15163
|
},
|
|
15132
15164
|
reset() {
|
|
15133
|
-
const {state: state} = M$
|
|
15165
|
+
const {state: state} = M$4;
|
|
15134
15166
|
state.type = "none";
|
|
15135
15167
|
state.typeCount = 0;
|
|
15136
15168
|
state.startTime = 0;
|
|
15137
15169
|
state.totalData = null;
|
|
15138
15170
|
}
|
|
15139
15171
|
};
|
|
15140
|
-
const M$
|
|
15172
|
+
const M$4 = MultiTouchHelper;
|
|
15141
15173
|
const {abs: abs$2, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
15142
15174
|
const WheelEventHelper = {
|
|
15143
15175
|
getMove(event, config) {
|
|
@@ -15867,7 +15899,7 @@ var LeaferUI = function(exports) {
|
|
|
15867
15899
|
__decorate([ dataProcessor(ArrowData) ], exports.Arrow.prototype, "__", void 0);
|
|
15868
15900
|
__decorate([ arrowType("angle") ], exports.Arrow.prototype, "endArrow", void 0);
|
|
15869
15901
|
exports.Arrow = __decorate([ registerUI() ], exports.Arrow);
|
|
15870
|
-
const {M: M$
|
|
15902
|
+
const {M: M$3, L: L$3, C: C$3, Q: Q$1, O: O$1} = PathCommandMap;
|
|
15871
15903
|
const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
|
|
15872
15904
|
const point$1 = {};
|
|
15873
15905
|
const PathMatrixHelper = {
|
|
@@ -15876,13 +15908,13 @@ var LeaferUI = function(exports) {
|
|
|
15876
15908
|
while (i < len) {
|
|
15877
15909
|
command = data[i];
|
|
15878
15910
|
switch (command) {
|
|
15879
|
-
case M$
|
|
15880
|
-
case L$
|
|
15911
|
+
case M$3:
|
|
15912
|
+
case L$3:
|
|
15881
15913
|
setPoint$2(data, i + 1, x, y, scaleX, scaleY, rotation, origin);
|
|
15882
15914
|
i += 3;
|
|
15883
15915
|
break;
|
|
15884
15916
|
|
|
15885
|
-
case C$
|
|
15917
|
+
case C$3:
|
|
15886
15918
|
for (j = 1; j < 6; j += 2) setPoint$2(data, i + j, x, y, scaleX, scaleY, rotation, origin);
|
|
15887
15919
|
i += 7;
|
|
15888
15920
|
break;
|
|
@@ -16082,7 +16114,7 @@ var LeaferUI = function(exports) {
|
|
|
16082
16114
|
if (fill) arrowData.fill = fill;
|
|
16083
16115
|
return arrowData;
|
|
16084
16116
|
}
|
|
16085
|
-
const {M: M$
|
|
16117
|
+
const {M: M$2, L: L$2, C: C$2, Q: Q, Z: Z$2, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
|
|
16086
16118
|
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
16087
16119
|
const {stintSet: stintSet$1} = DataHelper;
|
|
16088
16120
|
const connectPoint = {};
|
|
@@ -16101,8 +16133,8 @@ var LeaferUI = function(exports) {
|
|
|
16101
16133
|
while (i < len) {
|
|
16102
16134
|
command = data[i];
|
|
16103
16135
|
switch (command) {
|
|
16104
|
-
case M$
|
|
16105
|
-
case L$
|
|
16136
|
+
case M$2:
|
|
16137
|
+
case L$2:
|
|
16106
16138
|
if (count < 2 || i + 6 >= len) {
|
|
16107
16139
|
copy(old, now);
|
|
16108
16140
|
copyFrom(now, data[i + 1], data[i + 2]);
|
|
@@ -16111,7 +16143,7 @@ var LeaferUI = function(exports) {
|
|
|
16111
16143
|
i += 3;
|
|
16112
16144
|
break;
|
|
16113
16145
|
|
|
16114
|
-
case C$
|
|
16146
|
+
case C$2:
|
|
16115
16147
|
if (count === 1 || i + 7 >= len - 3) {
|
|
16116
16148
|
copyPoints(data, last, now, i + 3);
|
|
16117
16149
|
old.x = data[i + 1], old.y = data[i + 2];
|
|
@@ -16127,7 +16159,7 @@ var LeaferUI = function(exports) {
|
|
|
16127
16159
|
i += 5;
|
|
16128
16160
|
break;
|
|
16129
16161
|
|
|
16130
|
-
case Z$
|
|
16162
|
+
case Z$2:
|
|
16131
16163
|
return;
|
|
16132
16164
|
|
|
16133
16165
|
case N:
|
|
@@ -16171,8 +16203,8 @@ var LeaferUI = function(exports) {
|
|
|
16171
16203
|
break;
|
|
16172
16204
|
}
|
|
16173
16205
|
count++;
|
|
16174
|
-
if (count === 1 && command !== M$
|
|
16175
|
-
if (count === 2 && useStartArrow) copy(second, command === L$
|
|
16206
|
+
if (count === 1 && command !== M$2) return;
|
|
16207
|
+
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame(old, first) ? last : old);
|
|
16176
16208
|
if (i === len) {
|
|
16177
16209
|
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
16178
16210
|
if (useStartArrow) {
|
|
@@ -16194,11 +16226,11 @@ var LeaferUI = function(exports) {
|
|
|
16194
16226
|
getDistancePoint(now, last, -connectPoint.x, true);
|
|
16195
16227
|
let index;
|
|
16196
16228
|
switch (command) {
|
|
16197
|
-
case L$
|
|
16229
|
+
case L$2:
|
|
16198
16230
|
index = i - 3 + 1;
|
|
16199
16231
|
break;
|
|
16200
16232
|
|
|
16201
|
-
case C$
|
|
16233
|
+
case C$2:
|
|
16202
16234
|
index = i - 7 + 5;
|
|
16203
16235
|
break;
|
|
16204
16236
|
|
|
@@ -17790,7 +17822,7 @@ var LeaferUI = function(exports) {
|
|
|
17790
17822
|
}
|
|
17791
17823
|
};
|
|
17792
17824
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
17793
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float$1} = MathHelper;
|
|
17825
|
+
const {M: M$1, L: L$1, C: C$1, Z: Z$1} = PathCommandMap, {float: float$1} = MathHelper;
|
|
17794
17826
|
const tempPoint = {}, tempFrom = {};
|
|
17795
17827
|
const HighCurveHelper = {
|
|
17796
17828
|
transform(data, matrix) {
|
|
@@ -17799,18 +17831,18 @@ var LeaferUI = function(exports) {
|
|
|
17799
17831
|
while (i < len) {
|
|
17800
17832
|
command = data[i];
|
|
17801
17833
|
switch (command) {
|
|
17802
|
-
case M:
|
|
17803
|
-
case L:
|
|
17834
|
+
case M$1:
|
|
17835
|
+
case L$1:
|
|
17804
17836
|
HighCurveHelper.transformPoints(data, matrix, i, 1);
|
|
17805
17837
|
i += 3;
|
|
17806
17838
|
break;
|
|
17807
17839
|
|
|
17808
|
-
case C:
|
|
17840
|
+
case C$1:
|
|
17809
17841
|
HighCurveHelper.transformPoints(data, matrix, i, 3);
|
|
17810
17842
|
i += 7;
|
|
17811
17843
|
break;
|
|
17812
17844
|
|
|
17813
|
-
case Z:
|
|
17845
|
+
case Z$1:
|
|
17814
17846
|
i += 1;
|
|
17815
17847
|
}
|
|
17816
17848
|
}
|
|
@@ -17831,17 +17863,17 @@ var LeaferUI = function(exports) {
|
|
|
17831
17863
|
while (i < len) {
|
|
17832
17864
|
command = data[i];
|
|
17833
17865
|
switch (command) {
|
|
17834
|
-
case M:
|
|
17835
|
-
case L:
|
|
17866
|
+
case M$1:
|
|
17867
|
+
case L$1:
|
|
17836
17868
|
toX = data[i + 1];
|
|
17837
17869
|
toY = data[i + 2];
|
|
17838
|
-
distance = command === L && i > 0 ? PointHelper.getDistanceFrom(x, y, toX, toY) : 0;
|
|
17870
|
+
distance = command === L$1 && i > 0 ? PointHelper.getDistanceFrom(x, y, toX, toY) : 0;
|
|
17839
17871
|
x = toX;
|
|
17840
17872
|
y = toY;
|
|
17841
17873
|
i += 3;
|
|
17842
17874
|
break;
|
|
17843
17875
|
|
|
17844
|
-
case C:
|
|
17876
|
+
case C$1:
|
|
17845
17877
|
toX = data[i + 5];
|
|
17846
17878
|
toY = data[i + 6];
|
|
17847
17879
|
distance = HighBezierHelper.getDistance(x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], toX, toY);
|
|
@@ -17850,7 +17882,7 @@ var LeaferUI = function(exports) {
|
|
|
17850
17882
|
i += 7;
|
|
17851
17883
|
break;
|
|
17852
17884
|
|
|
17853
|
-
case Z:
|
|
17885
|
+
case Z$1:
|
|
17854
17886
|
i += 1;
|
|
17855
17887
|
|
|
17856
17888
|
default:
|
|
@@ -17875,8 +17907,8 @@ var LeaferUI = function(exports) {
|
|
|
17875
17907
|
while (i < len) {
|
|
17876
17908
|
command = data[i];
|
|
17877
17909
|
switch (command) {
|
|
17878
|
-
case M:
|
|
17879
|
-
case L:
|
|
17910
|
+
case M$1:
|
|
17911
|
+
case L$1:
|
|
17880
17912
|
toX = data[i + 1];
|
|
17881
17913
|
toY = data[i + 2];
|
|
17882
17914
|
distance = segments[index];
|
|
@@ -17895,7 +17927,7 @@ var LeaferUI = function(exports) {
|
|
|
17895
17927
|
i += 3;
|
|
17896
17928
|
break;
|
|
17897
17929
|
|
|
17898
|
-
case C:
|
|
17930
|
+
case C$1:
|
|
17899
17931
|
toX = data[i + 5];
|
|
17900
17932
|
toY = data[i + 6];
|
|
17901
17933
|
distance = segments[index];
|
|
@@ -17911,7 +17943,7 @@ var LeaferUI = function(exports) {
|
|
|
17911
17943
|
i += 7;
|
|
17912
17944
|
break;
|
|
17913
17945
|
|
|
17914
|
-
case Z:
|
|
17946
|
+
case Z$1:
|
|
17915
17947
|
i += 1;
|
|
17916
17948
|
|
|
17917
17949
|
default:
|
|
@@ -17932,8 +17964,8 @@ var LeaferUI = function(exports) {
|
|
|
17932
17964
|
while (i < len) {
|
|
17933
17965
|
command = data[i];
|
|
17934
17966
|
switch (command) {
|
|
17935
|
-
case M:
|
|
17936
|
-
case L:
|
|
17967
|
+
case M$1:
|
|
17968
|
+
case L$1:
|
|
17937
17969
|
toX = data[i + 1];
|
|
17938
17970
|
toY = data[i + 2];
|
|
17939
17971
|
distance = segments[index];
|
|
@@ -17956,7 +17988,7 @@ var LeaferUI = function(exports) {
|
|
|
17956
17988
|
path.push(command, x, y);
|
|
17957
17989
|
break;
|
|
17958
17990
|
|
|
17959
|
-
case C:
|
|
17991
|
+
case C$1:
|
|
17960
17992
|
x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
|
|
17961
17993
|
toX = data[i + 5];
|
|
17962
17994
|
toY = data[i + 6];
|
|
@@ -17975,7 +18007,7 @@ var LeaferUI = function(exports) {
|
|
|
17975
18007
|
path.push(command, x1, y1, x2, y2, toX, toY);
|
|
17976
18008
|
break;
|
|
17977
18009
|
|
|
17978
|
-
case Z:
|
|
18010
|
+
case Z$1:
|
|
17979
18011
|
i += 1;
|
|
17980
18012
|
path.push(command);
|
|
17981
18013
|
|
|
@@ -19322,6 +19354,256 @@ var LeaferUI = function(exports) {
|
|
|
19322
19354
|
__decorate([ boundsType("") ], exports.ImageBox.prototype, "url", void 0);
|
|
19323
19355
|
exports.ImageBox = __decorate([ registerUI() ], exports.ImageBox);
|
|
19324
19356
|
Plugin.add("box");
|
|
19357
|
+
function getTangentDistance(r, x, y, lastX, lastY, nextX, nextY) {
|
|
19358
|
+
const ux = lastX - x, uy = lastY - y;
|
|
19359
|
+
const vx = nextX - x, vy = nextY - y;
|
|
19360
|
+
const lenU = Math.sqrt(ux * ux + uy * uy);
|
|
19361
|
+
const lenV = Math.sqrt(vx * vx + vy * vy);
|
|
19362
|
+
if (lenU < .001 || lenV < .001) return 0;
|
|
19363
|
+
const cosTheta = (ux * vx + uy * vy) / (lenU * lenV);
|
|
19364
|
+
const safeCos = Math.max(-.99999, Math.min(.99999, cosTheta));
|
|
19365
|
+
let d = r * Math.sqrt((1 - safeCos) / (1 + safeCos));
|
|
19366
|
+
const maxD = Math.min(lenU / 2, lenV / 2);
|
|
19367
|
+
return Math.min(d, maxD);
|
|
19368
|
+
}
|
|
19369
|
+
function getCorrectT(d, x, y, x1, y1, x2, y2, toX, toY) {
|
|
19370
|
+
if (d <= 0) return 0;
|
|
19371
|
+
const chordLen = Math.sqrt(Math.pow(toX - x, 2) + Math.pow(toY - y, 2));
|
|
19372
|
+
if (d >= chordLen) return .5;
|
|
19373
|
+
const vx0 = 3 * (x1 - x);
|
|
19374
|
+
const vy0 = 3 * (y1 - y);
|
|
19375
|
+
let v0mag = Math.sqrt(vx0 * vx0 + vy0 * vy0);
|
|
19376
|
+
if (v0mag < 1e-6) v0mag = chordLen || 1;
|
|
19377
|
+
let t = Math.min(.5, d / v0mag);
|
|
19378
|
+
const tempP = {
|
|
19379
|
+
x: 0,
|
|
19380
|
+
y: 0
|
|
19381
|
+
};
|
|
19382
|
+
for (let i = 0; i < 5; i++) {
|
|
19383
|
+
BezierHelper.getPointAndSet(t, x, y, x1, y1, x2, y2, toX, toY, tempP);
|
|
19384
|
+
const dx = tempP.x - x;
|
|
19385
|
+
const dy = tempP.y - y;
|
|
19386
|
+
const currentDist = Math.sqrt(dx * dx + dy * dy);
|
|
19387
|
+
if (currentDist < 1e-6) {
|
|
19388
|
+
t = t * 1.5;
|
|
19389
|
+
continue;
|
|
19390
|
+
}
|
|
19391
|
+
const vxt = BezierHelper.getDerivative(t, x, x1, x2, toX);
|
|
19392
|
+
const vyt = BezierHelper.getDerivative(t, y, y1, y2, toY);
|
|
19393
|
+
const f_prime = (dx * vxt + dy * vyt) / currentDist;
|
|
19394
|
+
if (Math.abs(f_prime) < 1e-6) break;
|
|
19395
|
+
const deltaT = (currentDist - d) / f_prime;
|
|
19396
|
+
const nextT = t - deltaT;
|
|
19397
|
+
const safeNextT = Math.max(0, Math.min(.6, nextT));
|
|
19398
|
+
if (Math.abs(safeNextT - t) < 1e-5) {
|
|
19399
|
+
t = safeNextT;
|
|
19400
|
+
break;
|
|
19401
|
+
}
|
|
19402
|
+
t = safeNextT;
|
|
19403
|
+
}
|
|
19404
|
+
return Math.max(0, Math.min(.5, t));
|
|
19405
|
+
}
|
|
19406
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
|
|
19407
|
+
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
19408
|
+
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
19409
|
+
PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
19410
|
+
const radius = data.radius;
|
|
19411
|
+
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true);
|
|
19412
|
+
let command, lastCommand, commandLen;
|
|
19413
|
+
let i = 0, countCommand = 0, x = 0, y = 0, startX = 0, startY = 0, startR = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0, r, x1, y1, x2, y2, toX, toY;
|
|
19414
|
+
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
19415
|
+
const len = data.length, three = len === 9;
|
|
19416
|
+
const smooth = [];
|
|
19417
|
+
while (i < len) {
|
|
19418
|
+
command = data[i];
|
|
19419
|
+
r = radius ? isUndefined(radius[countCommand]) ? cornerRadius : radius[countCommand] : cornerRadius;
|
|
19420
|
+
switch (command) {
|
|
19421
|
+
case M:
|
|
19422
|
+
startX = lastX = data[i + 1];
|
|
19423
|
+
startY = lastY = data[i + 2];
|
|
19424
|
+
startR = r;
|
|
19425
|
+
i += 3;
|
|
19426
|
+
const end = findEndPoint(data, i);
|
|
19427
|
+
switch (data[i]) {
|
|
19428
|
+
case L:
|
|
19429
|
+
secondX = data[i + 1];
|
|
19430
|
+
secondY = data[i + 2];
|
|
19431
|
+
if (three) smooth.push(M, startX, startY); else {
|
|
19432
|
+
if (end) smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY)); else smooth.push(M, startX, startY);
|
|
19433
|
+
}
|
|
19434
|
+
break;
|
|
19435
|
+
|
|
19436
|
+
case C:
|
|
19437
|
+
if (end) {
|
|
19438
|
+
const {left: left, right: right} = setAfterC(data, i, r, end.x, end.y, startX, startY, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6]);
|
|
19439
|
+
if (left && right) {
|
|
19440
|
+
smooth.push(M, secondX = left[4], secondY = left[5]);
|
|
19441
|
+
break;
|
|
19442
|
+
}
|
|
19443
|
+
}
|
|
19444
|
+
|
|
19445
|
+
default:
|
|
19446
|
+
smooth.push(M, secondX = startX, secondY = startY);
|
|
19447
|
+
}
|
|
19448
|
+
break;
|
|
19449
|
+
|
|
19450
|
+
case L:
|
|
19451
|
+
x = data[i + 1];
|
|
19452
|
+
y = data[i + 2];
|
|
19453
|
+
i += 3;
|
|
19454
|
+
switch (data[i]) {
|
|
19455
|
+
case L:
|
|
19456
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], r, lastX, lastY, three);
|
|
19457
|
+
break;
|
|
19458
|
+
|
|
19459
|
+
case C:
|
|
19460
|
+
const {left: left, right: right} = setAfterC(data, i, r, lastX, lastY, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6]);
|
|
19461
|
+
if (left && right) arcTo(smooth, x, y, left[4], left[5], r, lastX, lastY, three); else smooth.push(L, x, y);
|
|
19462
|
+
break;
|
|
19463
|
+
|
|
19464
|
+
case Z:
|
|
19465
|
+
arcTo(smooth, x, y, startX, startY, r, lastX, lastY, three);
|
|
19466
|
+
break;
|
|
19467
|
+
|
|
19468
|
+
default:
|
|
19469
|
+
smooth.push(L, x, y);
|
|
19470
|
+
}
|
|
19471
|
+
lastX = x;
|
|
19472
|
+
lastY = y;
|
|
19473
|
+
break;
|
|
19474
|
+
|
|
19475
|
+
case C:
|
|
19476
|
+
x1 = data[i + 1];
|
|
19477
|
+
y1 = data[i + 2];
|
|
19478
|
+
x2 = data[i + 3];
|
|
19479
|
+
y2 = data[i + 4];
|
|
19480
|
+
x = data[i + 5];
|
|
19481
|
+
y = data[i + 6];
|
|
19482
|
+
i += 7;
|
|
19483
|
+
switch (data[i]) {
|
|
19484
|
+
case L:
|
|
19485
|
+
toX = data[i + 1], toY = data[i + 2];
|
|
19486
|
+
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
19487
|
+
break;
|
|
19488
|
+
|
|
19489
|
+
case C:
|
|
19490
|
+
smooth.push(C, x1, y1, x2, y2, x, y);
|
|
19491
|
+
break;
|
|
19492
|
+
|
|
19493
|
+
case Z:
|
|
19494
|
+
toX = startX, toY = startY;
|
|
19495
|
+
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
19496
|
+
break;
|
|
19497
|
+
}
|
|
19498
|
+
lastX = x;
|
|
19499
|
+
lastY = y;
|
|
19500
|
+
break;
|
|
19501
|
+
|
|
19502
|
+
case Z:
|
|
19503
|
+
if (lastCommand !== Z) {
|
|
19504
|
+
arcTo(smooth, startX, startY, secondX, secondY, startR, lastX, lastY, three);
|
|
19505
|
+
smooth.push(Z);
|
|
19506
|
+
}
|
|
19507
|
+
i += 1;
|
|
19508
|
+
break;
|
|
19509
|
+
|
|
19510
|
+
default:
|
|
19511
|
+
commandLen = PathNumberCommandLengthMap[command];
|
|
19512
|
+
for (let j = 0; j < commandLen; j++) smooth.push(data[i + j]);
|
|
19513
|
+
i += commandLen;
|
|
19514
|
+
}
|
|
19515
|
+
lastCommand = command;
|
|
19516
|
+
countCommand++;
|
|
19517
|
+
}
|
|
19518
|
+
return smooth;
|
|
19519
|
+
};
|
|
19520
|
+
function isNeedConvert(data) {
|
|
19521
|
+
let command, i = 0;
|
|
19522
|
+
const len = data.length;
|
|
19523
|
+
while (i < len) {
|
|
19524
|
+
command = data[i];
|
|
19525
|
+
switch (command) {
|
|
19526
|
+
case M:
|
|
19527
|
+
i += 3;
|
|
19528
|
+
break;
|
|
19529
|
+
|
|
19530
|
+
case L:
|
|
19531
|
+
i += 3;
|
|
19532
|
+
break;
|
|
19533
|
+
|
|
19534
|
+
case C:
|
|
19535
|
+
i += 7;
|
|
19536
|
+
break;
|
|
19537
|
+
|
|
19538
|
+
case Z:
|
|
19539
|
+
i += 1;
|
|
19540
|
+
break;
|
|
19541
|
+
|
|
19542
|
+
default:
|
|
19543
|
+
return true;
|
|
19544
|
+
}
|
|
19545
|
+
}
|
|
19546
|
+
return false;
|
|
19547
|
+
}
|
|
19548
|
+
function findEndPoint(data, i) {
|
|
19549
|
+
let command, commandLen, x, y;
|
|
19550
|
+
const len = data.length;
|
|
19551
|
+
while (i < len) {
|
|
19552
|
+
command = data[i];
|
|
19553
|
+
switch (command) {
|
|
19554
|
+
case M:
|
|
19555
|
+
return undefined;
|
|
19556
|
+
|
|
19557
|
+
case L:
|
|
19558
|
+
x = data[i + 1];
|
|
19559
|
+
y = data[i + 2];
|
|
19560
|
+
i += 3;
|
|
19561
|
+
break;
|
|
19562
|
+
|
|
19563
|
+
case C:
|
|
19564
|
+
x = data[i + 5];
|
|
19565
|
+
y = data[i + 6];
|
|
19566
|
+
i += 7;
|
|
19567
|
+
break;
|
|
19568
|
+
|
|
19569
|
+
case Z:
|
|
19570
|
+
return {
|
|
19571
|
+
x: x,
|
|
19572
|
+
y: y
|
|
19573
|
+
};
|
|
19574
|
+
|
|
19575
|
+
default:
|
|
19576
|
+
commandLen = PathNumberCommandLengthMap[command];
|
|
19577
|
+
i += commandLen;
|
|
19578
|
+
}
|
|
19579
|
+
}
|
|
19580
|
+
return undefined;
|
|
19581
|
+
}
|
|
19582
|
+
function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
19583
|
+
const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, x1, y1);
|
|
19584
|
+
const t = getCorrectT(d, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19585
|
+
const two = BezierHelper.cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19586
|
+
const {left: left, right: right} = two;
|
|
19587
|
+
if (left && right) {
|
|
19588
|
+
data[i + 1] = right[0];
|
|
19589
|
+
data[i + 2] = right[1];
|
|
19590
|
+
data[i + 3] = right[2];
|
|
19591
|
+
data[i + 4] = right[3];
|
|
19592
|
+
}
|
|
19593
|
+
return two;
|
|
19594
|
+
}
|
|
19595
|
+
function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY, nextX, nextY, three) {
|
|
19596
|
+
const d = getTangentDistance(cornerRadius, toX, toY, x2, y2, nextX, nextY);
|
|
19597
|
+
const t = getCorrectT(d, toX, toY, x2, y2, x1, y1, fromX, fromY);
|
|
19598
|
+
const {left: left, right: right} = BezierHelper.cut(1 - t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19599
|
+
if (left && right) {
|
|
19600
|
+
smooth.push(C, left[0], left[1], left[2], left[3], left[4], left[5]);
|
|
19601
|
+
arcTo(smooth, toX, toY, nextX, nextY, cornerRadius, left[4], left[5], three);
|
|
19602
|
+
} else {
|
|
19603
|
+
smooth.push(C, x1, y1, x2, y2, toX, toY);
|
|
19604
|
+
}
|
|
19605
|
+
}
|
|
19606
|
+
Plugin.add("corner");
|
|
19325
19607
|
exports.AlignHelper = AlignHelper;
|
|
19326
19608
|
exports.AnimateEasing = AnimateEasing;
|
|
19327
19609
|
exports.AnimateEvent = AnimateEvent;
|