@leafer/miniapp 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/miniapp.cjs +11 -0
- package/dist/miniapp.esm.js +2 -0
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +462 -169
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +25 -24
- package/src/index.ts +1 -0
- package/types/index.d.ts +1 -0
package/dist/miniapp.module.js
CHANGED
|
@@ -492,13 +492,13 @@ const MatrixHelper = {
|
|
|
492
492
|
to.f = t.f * pixelRatio;
|
|
493
493
|
},
|
|
494
494
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
495
|
-
M$
|
|
496
|
-
M$
|
|
495
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
496
|
+
M$c.scaleOfInner(t, tempPoint$5, scaleX, scaleY);
|
|
497
497
|
},
|
|
498
498
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
499
|
-
M$
|
|
500
|
-
M$
|
|
501
|
-
M$
|
|
499
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
500
|
+
M$c.scale(t, scaleX, scaleY);
|
|
501
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
502
502
|
},
|
|
503
503
|
rotate(t, rotation) {
|
|
504
504
|
const {a: a, b: b, c: c, d: d} = t;
|
|
@@ -511,13 +511,13 @@ const MatrixHelper = {
|
|
|
511
511
|
t.d = c * sinR + d * cosR;
|
|
512
512
|
},
|
|
513
513
|
rotateOfOuter(t, origin, rotation) {
|
|
514
|
-
M$
|
|
515
|
-
M$
|
|
514
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
515
|
+
M$c.rotateOfInner(t, tempPoint$5, rotation);
|
|
516
516
|
},
|
|
517
517
|
rotateOfInner(t, origin, rotation) {
|
|
518
|
-
M$
|
|
519
|
-
M$
|
|
520
|
-
M$
|
|
518
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
519
|
+
M$c.rotate(t, rotation);
|
|
520
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
521
521
|
},
|
|
522
522
|
skew(t, skewX, skewY) {
|
|
523
523
|
const {a: a, b: b, c: c, d: d} = t;
|
|
@@ -533,13 +533,13 @@ const MatrixHelper = {
|
|
|
533
533
|
}
|
|
534
534
|
},
|
|
535
535
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
536
|
-
M$
|
|
537
|
-
M$
|
|
536
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
537
|
+
M$c.skewOfInner(t, tempPoint$5, skewX, skewY);
|
|
538
538
|
},
|
|
539
539
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
540
|
-
M$
|
|
541
|
-
M$
|
|
542
|
-
M$
|
|
540
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
541
|
+
M$c.skew(t, skewX, skewY);
|
|
542
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
543
543
|
},
|
|
544
544
|
multiply(t, child) {
|
|
545
545
|
const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
|
|
@@ -578,15 +578,15 @@ const MatrixHelper = {
|
|
|
578
578
|
to.f = e * parent.b + f * parent.d + parent.f;
|
|
579
579
|
},
|
|
580
580
|
divide(t, child) {
|
|
581
|
-
M$
|
|
581
|
+
M$c.multiply(t, M$c.tempInvert(child));
|
|
582
582
|
},
|
|
583
583
|
divideParent(t, parent) {
|
|
584
|
-
M$
|
|
584
|
+
M$c.multiplyParent(t, M$c.tempInvert(parent));
|
|
585
585
|
},
|
|
586
586
|
tempInvert(t) {
|
|
587
|
-
const {tempMatrix: tempMatrix} = M$
|
|
588
|
-
M$
|
|
589
|
-
M$
|
|
587
|
+
const {tempMatrix: tempMatrix} = M$c;
|
|
588
|
+
M$c.copy(tempMatrix, t);
|
|
589
|
+
M$c.invert(tempMatrix);
|
|
590
590
|
return tempMatrix;
|
|
591
591
|
},
|
|
592
592
|
invert(t) {
|
|
@@ -664,7 +664,7 @@ const MatrixHelper = {
|
|
|
664
664
|
}
|
|
665
665
|
t.e = x;
|
|
666
666
|
t.f = y;
|
|
667
|
-
if (origin = origin || around) M$
|
|
667
|
+
if (origin = origin || around) M$c.translateInner(t, -origin.x, -origin.y, !around);
|
|
668
668
|
},
|
|
669
669
|
getLayout(t, origin, around, firstSkewY) {
|
|
670
670
|
const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
|
|
@@ -725,11 +725,11 @@ const MatrixHelper = {
|
|
|
725
725
|
return world;
|
|
726
726
|
},
|
|
727
727
|
reset(t) {
|
|
728
|
-
M$
|
|
728
|
+
M$c.set(t);
|
|
729
729
|
}
|
|
730
730
|
};
|
|
731
731
|
|
|
732
|
-
const M$
|
|
732
|
+
const M$c = MatrixHelper;
|
|
733
733
|
|
|
734
734
|
const {float: float$5} = MathHelper;
|
|
735
735
|
|
|
@@ -2706,14 +2706,14 @@ const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
|
2706
2706
|
|
|
2707
2707
|
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2708
2708
|
|
|
2709
|
-
const {M: M$
|
|
2709
|
+
const {M: M$b, L: L$b, C: C$9, Q: Q$7, Z: Z$9} = PathCommandMap;
|
|
2710
2710
|
|
|
2711
2711
|
const tempPoint$3 = {};
|
|
2712
2712
|
|
|
2713
2713
|
const BezierHelper = {
|
|
2714
2714
|
points(data, originPoints, curve, close) {
|
|
2715
2715
|
let points = toNumberPoints$1(originPoints);
|
|
2716
|
-
data.push(M$
|
|
2716
|
+
data.push(M$b, points[0], points[1]);
|
|
2717
2717
|
if (curve && points.length > 5) {
|
|
2718
2718
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
2719
2719
|
let baX, baY, ba, cb, d, len = points.length;
|
|
@@ -2744,7 +2744,7 @@ const BezierHelper = {
|
|
|
2744
2744
|
if (i === 2) {
|
|
2745
2745
|
if (!close) data.push(Q$7, c1X, c1Y, bX, bY);
|
|
2746
2746
|
} else {
|
|
2747
|
-
if (baX || baY) data.push(C$
|
|
2747
|
+
if (baX || baY) data.push(C$9, c2X, c2Y, c1X, c1Y, bX, bY);
|
|
2748
2748
|
}
|
|
2749
2749
|
c2X = bX + cb * cX;
|
|
2750
2750
|
c2Y = bY + cb * cY;
|
|
@@ -2752,10 +2752,10 @@ const BezierHelper = {
|
|
|
2752
2752
|
if (!close) data.push(Q$7, c2X, c2Y, points[len - 2], points[len - 1]);
|
|
2753
2753
|
} else {
|
|
2754
2754
|
for (let i = 2, len = points.length; i < len; i += 2) {
|
|
2755
|
-
data.push(L$
|
|
2755
|
+
data.push(L$b, points[i], points[i + 1]);
|
|
2756
2756
|
}
|
|
2757
2757
|
}
|
|
2758
|
-
if (close) data.push(Z$
|
|
2758
|
+
if (close) data.push(Z$9);
|
|
2759
2759
|
},
|
|
2760
2760
|
rect(data, x, y, width, height) {
|
|
2761
2761
|
PathHelper.creator.path = data;
|
|
@@ -2778,7 +2778,7 @@ const BezierHelper = {
|
|
|
2778
2778
|
let totalRadian = endRadian - startRadian;
|
|
2779
2779
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2780
2780
|
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$9(totalRadian - PI$3) < 1e-12) {
|
|
2781
|
-
if (data) data.push(L$
|
|
2781
|
+
if (data) data.push(L$b, x1, y1);
|
|
2782
2782
|
if (setPointBounds) {
|
|
2783
2783
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
2784
2784
|
addPoint$2(setPointBounds, x1, y1);
|
|
@@ -2822,7 +2822,7 @@ const BezierHelper = {
|
|
|
2822
2822
|
let startX = x = rotationCos * radiusX * startCos - rotationSin * radiusY * startSin;
|
|
2823
2823
|
let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
|
|
2824
2824
|
let fromX = cx + x, fromY = cy + y;
|
|
2825
|
-
if (data) data.push(data.length ? L$
|
|
2825
|
+
if (data) data.push(data.length ? L$b : M$b, fromX, fromY);
|
|
2826
2826
|
if (setPointBounds) setPoint$4(setPointBounds, fromX, fromY);
|
|
2827
2827
|
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2828
2828
|
for (let i = 0; i < parts; i++) {
|
|
@@ -2834,7 +2834,7 @@ const BezierHelper = {
|
|
|
2834
2834
|
y1 = cy + startY - control * (rotationSin * radiusX * startSin - rotationCos * radiusY * startCos);
|
|
2835
2835
|
x2 = cx + x + control * (rotationCos * radiusX * endSin + rotationSin * radiusY * endCos);
|
|
2836
2836
|
y2 = cy + y + control * (rotationSin * radiusX * endSin - rotationCos * radiusY * endCos);
|
|
2837
|
-
if (data) data.push(C$
|
|
2837
|
+
if (data) data.push(C$9, x1, y1, x2, y2, cx + x, cy + y);
|
|
2838
2838
|
if (setPointBounds) toTwoPointBounds$1(cx + startX, cy + startY, x1, y1, x2, y2, cx + x, cy + y, setPointBounds, true);
|
|
2839
2839
|
startX = x;
|
|
2840
2840
|
startY = y;
|
|
@@ -2846,7 +2846,7 @@ const BezierHelper = {
|
|
|
2846
2846
|
if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
|
|
2847
2847
|
},
|
|
2848
2848
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2849
|
-
data.push(C$
|
|
2849
|
+
data.push(C$9, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
2850
2850
|
},
|
|
2851
2851
|
toTwoPointBoundsByQuadraticCurve(fromX, fromY, x1, y1, toX, toY, pointBounds, addMode) {
|
|
2852
2852
|
toTwoPointBounds$1(fromX, fromY, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY, pointBounds, addMode);
|
|
@@ -2896,6 +2896,32 @@ const BezierHelper = {
|
|
|
2896
2896
|
getDerivative(t, fromV, v1, v2, toV) {
|
|
2897
2897
|
const o = 1 - t;
|
|
2898
2898
|
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2899
|
+
},
|
|
2900
|
+
cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
2901
|
+
if (t <= 0) return {
|
|
2902
|
+
left: null,
|
|
2903
|
+
right: [ x1, y1, x2, y2, toX, toY ]
|
|
2904
|
+
}; else if (t >= 1) return {
|
|
2905
|
+
left: [ x1, y1, x2, y2, toX, toY ],
|
|
2906
|
+
right: null
|
|
2907
|
+
};
|
|
2908
|
+
const u = 1 - t;
|
|
2909
|
+
const leftX1 = fromX * u + x1 * t;
|
|
2910
|
+
const leftY1 = fromY * u + y1 * t;
|
|
2911
|
+
const P12x = x1 * u + x2 * t;
|
|
2912
|
+
const P12y = y1 * u + y2 * t;
|
|
2913
|
+
const rightX2 = x2 * u + toX * t;
|
|
2914
|
+
const rightY2 = y2 * u + toY * t;
|
|
2915
|
+
const leftX2 = leftX1 * u + P12x * t;
|
|
2916
|
+
const leftY2 = leftY1 * u + P12y * t;
|
|
2917
|
+
const rightX1 = P12x * u + rightX2 * t;
|
|
2918
|
+
const rightY1 = P12y * u + rightY2 * t;
|
|
2919
|
+
const leftX = leftX2 * u + rightX1 * t;
|
|
2920
|
+
const leftY = leftY2 * u + rightY1 * t;
|
|
2921
|
+
return {
|
|
2922
|
+
left: [ leftX1, leftY1, leftX2, leftY2, leftX, leftY ],
|
|
2923
|
+
right: [ rightX1, rightY1, rightX2, rightY2, toX, toY ]
|
|
2924
|
+
};
|
|
2899
2925
|
}
|
|
2900
2926
|
};
|
|
2901
2927
|
|
|
@@ -2961,9 +2987,9 @@ const PathCommandNodeHelper = {
|
|
|
2961
2987
|
}
|
|
2962
2988
|
};
|
|
2963
2989
|
|
|
2964
|
-
const {M: M$
|
|
2990
|
+
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;
|
|
2965
2991
|
|
|
2966
|
-
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$
|
|
2992
|
+
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$4, arc: arc$3, ellipse: ellipse$6, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2967
2993
|
|
|
2968
2994
|
const {ellipticalArc: ellipticalArc} = EllipseHelper;
|
|
2969
2995
|
|
|
@@ -3053,10 +3079,10 @@ const PathConvert = {
|
|
|
3053
3079
|
old[i + 1] += x;
|
|
3054
3080
|
old[i + 2] += y;
|
|
3055
3081
|
|
|
3056
|
-
case M$
|
|
3082
|
+
case M$a:
|
|
3057
3083
|
x = old[i + 1];
|
|
3058
3084
|
y = old[i + 2];
|
|
3059
|
-
data.push(M$
|
|
3085
|
+
data.push(M$a, x, y);
|
|
3060
3086
|
i += 3;
|
|
3061
3087
|
break;
|
|
3062
3088
|
|
|
@@ -3065,7 +3091,7 @@ const PathConvert = {
|
|
|
3065
3091
|
|
|
3066
3092
|
case H:
|
|
3067
3093
|
x = old[i + 1];
|
|
3068
|
-
data.push(L$
|
|
3094
|
+
data.push(L$a, x, y);
|
|
3069
3095
|
i += 2;
|
|
3070
3096
|
break;
|
|
3071
3097
|
|
|
@@ -3074,7 +3100,7 @@ const PathConvert = {
|
|
|
3074
3100
|
|
|
3075
3101
|
case V:
|
|
3076
3102
|
y = old[i + 1];
|
|
3077
|
-
data.push(L$
|
|
3103
|
+
data.push(L$a, x, y);
|
|
3078
3104
|
i += 2;
|
|
3079
3105
|
break;
|
|
3080
3106
|
|
|
@@ -3082,10 +3108,10 @@ const PathConvert = {
|
|
|
3082
3108
|
old[i + 1] += x;
|
|
3083
3109
|
old[i + 2] += y;
|
|
3084
3110
|
|
|
3085
|
-
case L$
|
|
3111
|
+
case L$a:
|
|
3086
3112
|
x = old[i + 1];
|
|
3087
3113
|
y = old[i + 2];
|
|
3088
|
-
data.push(L$
|
|
3114
|
+
data.push(L$a, x, y);
|
|
3089
3115
|
i += 3;
|
|
3090
3116
|
break;
|
|
3091
3117
|
|
|
@@ -3097,14 +3123,14 @@ const PathConvert = {
|
|
|
3097
3123
|
command = S$1;
|
|
3098
3124
|
|
|
3099
3125
|
case S$1:
|
|
3100
|
-
smooth = lastCommand === C$
|
|
3126
|
+
smooth = lastCommand === C$8 || lastCommand === S$1;
|
|
3101
3127
|
x1 = smooth ? x * 2 - controlX : old[i + 1];
|
|
3102
3128
|
y1 = smooth ? y * 2 - controlY : old[i + 2];
|
|
3103
3129
|
controlX = old[i + 1];
|
|
3104
3130
|
controlY = old[i + 2];
|
|
3105
3131
|
x = old[i + 3];
|
|
3106
3132
|
y = old[i + 4];
|
|
3107
|
-
data.push(C$
|
|
3133
|
+
data.push(C$8, x1, y1, controlX, controlY, x, y);
|
|
3108
3134
|
i += 5;
|
|
3109
3135
|
break;
|
|
3110
3136
|
|
|
@@ -3115,14 +3141,14 @@ const PathConvert = {
|
|
|
3115
3141
|
old[i + 4] += y;
|
|
3116
3142
|
old[i + 5] += x;
|
|
3117
3143
|
old[i + 6] += y;
|
|
3118
|
-
command = C$
|
|
3144
|
+
command = C$8;
|
|
3119
3145
|
|
|
3120
|
-
case C$
|
|
3146
|
+
case C$8:
|
|
3121
3147
|
controlX = old[i + 3];
|
|
3122
3148
|
controlY = old[i + 4];
|
|
3123
3149
|
x = old[i + 5];
|
|
3124
3150
|
y = old[i + 6];
|
|
3125
|
-
data.push(C$
|
|
3151
|
+
data.push(C$8, old[i + 1], old[i + 2], controlX, controlY, x, y);
|
|
3126
3152
|
i += 7;
|
|
3127
3153
|
break;
|
|
3128
3154
|
|
|
@@ -3169,8 +3195,8 @@ const PathConvert = {
|
|
|
3169
3195
|
break;
|
|
3170
3196
|
|
|
3171
3197
|
case z:
|
|
3172
|
-
case Z$
|
|
3173
|
-
data.push(Z$
|
|
3198
|
+
case Z$8:
|
|
3199
|
+
data.push(Z$8);
|
|
3174
3200
|
i++;
|
|
3175
3201
|
break;
|
|
3176
3202
|
|
|
@@ -3224,7 +3250,7 @@ const PathConvert = {
|
|
|
3224
3250
|
break;
|
|
3225
3251
|
|
|
3226
3252
|
case U$5:
|
|
3227
|
-
arcTo$
|
|
3253
|
+
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);
|
|
3228
3254
|
x = setEndPoint$1.x;
|
|
3229
3255
|
y = setEndPoint$1.y;
|
|
3230
3256
|
i += 6;
|
|
@@ -3246,15 +3272,15 @@ const PathConvert = {
|
|
|
3246
3272
|
list.forEach(item => {
|
|
3247
3273
|
switch (item.name) {
|
|
3248
3274
|
case "M":
|
|
3249
|
-
data.push(M$
|
|
3275
|
+
data.push(M$a, item.x, item.y);
|
|
3250
3276
|
break;
|
|
3251
3277
|
|
|
3252
3278
|
case "L":
|
|
3253
|
-
data.push(L$
|
|
3279
|
+
data.push(L$a, item.x, item.y);
|
|
3254
3280
|
break;
|
|
3255
3281
|
|
|
3256
3282
|
case "C":
|
|
3257
|
-
data.push(C$
|
|
3283
|
+
data.push(C$8, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
|
|
3258
3284
|
break;
|
|
3259
3285
|
|
|
3260
3286
|
case "Q":
|
|
@@ -3262,7 +3288,7 @@ const PathConvert = {
|
|
|
3262
3288
|
break;
|
|
3263
3289
|
|
|
3264
3290
|
case "Z":
|
|
3265
|
-
data.push(Z$
|
|
3291
|
+
data.push(Z$8);
|
|
3266
3292
|
}
|
|
3267
3293
|
});
|
|
3268
3294
|
return data;
|
|
@@ -3286,7 +3312,7 @@ const PathConvert = {
|
|
|
3286
3312
|
|
|
3287
3313
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3288
3314
|
|
|
3289
|
-
const {M: M$
|
|
3315
|
+
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;
|
|
3290
3316
|
|
|
3291
3317
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3292
3318
|
|
|
@@ -3299,19 +3325,19 @@ const PathCommandDataHelper = {
|
|
|
3299
3325
|
data.length = 0;
|
|
3300
3326
|
},
|
|
3301
3327
|
moveTo(data, x, y) {
|
|
3302
|
-
data.push(M$
|
|
3328
|
+
data.push(M$9, x, y);
|
|
3303
3329
|
},
|
|
3304
3330
|
lineTo(data, x, y) {
|
|
3305
|
-
data.push(L$
|
|
3331
|
+
data.push(L$9, x, y);
|
|
3306
3332
|
},
|
|
3307
3333
|
bezierCurveTo(data, x1, y1, x2, y2, x, y) {
|
|
3308
|
-
data.push(C$
|
|
3334
|
+
data.push(C$7, x1, y1, x2, y2, x, y);
|
|
3309
3335
|
},
|
|
3310
3336
|
quadraticCurveTo(data, x1, y1, x, y) {
|
|
3311
3337
|
data.push(Q$5, x1, y1, x, y);
|
|
3312
3338
|
},
|
|
3313
3339
|
closePath(data) {
|
|
3314
|
-
data.push(Z$
|
|
3340
|
+
data.push(Z$7);
|
|
3315
3341
|
},
|
|
3316
3342
|
rect(data, x, y, width, height) {
|
|
3317
3343
|
data.push(N$4, x, y, width, height);
|
|
@@ -3356,12 +3382,12 @@ const PathCommandDataHelper = {
|
|
|
3356
3382
|
},
|
|
3357
3383
|
drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
3358
3384
|
BezierHelper.ellipse(null, x, y, radiusX, radiusY, isNull(rotation) ? 0 : rotation, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
3359
|
-
data.push(M$
|
|
3385
|
+
data.push(M$9, startPoint.x, startPoint.y);
|
|
3360
3386
|
ellipse$5(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
3361
3387
|
},
|
|
3362
3388
|
drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
3363
3389
|
BezierHelper.arc(null, x, y, radius, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
3364
|
-
data.push(M$
|
|
3390
|
+
data.push(M$9, startPoint.x, startPoint.y);
|
|
3365
3391
|
arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
3366
3392
|
},
|
|
3367
3393
|
drawPoints(data, points, curve, close) {
|
|
@@ -3371,7 +3397,7 @@ const PathCommandDataHelper = {
|
|
|
3371
3397
|
|
|
3372
3398
|
const {ellipse: ellipse$5, arc: arc$2} = PathCommandDataHelper;
|
|
3373
3399
|
|
|
3374
|
-
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$
|
|
3400
|
+
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;
|
|
3375
3401
|
|
|
3376
3402
|
class PathCreator {
|
|
3377
3403
|
set path(value) {
|
|
@@ -3438,7 +3464,7 @@ class PathCreator {
|
|
|
3438
3464
|
return this;
|
|
3439
3465
|
}
|
|
3440
3466
|
arcTo(x1, y1, x2, y2, radius) {
|
|
3441
|
-
arcTo$
|
|
3467
|
+
arcTo$3(this.__path, x1, y1, x2, y2, radius);
|
|
3442
3468
|
this.paint();
|
|
3443
3469
|
return this;
|
|
3444
3470
|
}
|
|
@@ -3463,7 +3489,7 @@ class PathCreator {
|
|
|
3463
3489
|
paint() {}
|
|
3464
3490
|
}
|
|
3465
3491
|
|
|
3466
|
-
const {M: M$
|
|
3492
|
+
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;
|
|
3467
3493
|
|
|
3468
3494
|
const debug$e = Debug.get("PathDrawer");
|
|
3469
3495
|
|
|
@@ -3475,17 +3501,17 @@ const PathDrawer = {
|
|
|
3475
3501
|
while (i < len) {
|
|
3476
3502
|
command = data[i];
|
|
3477
3503
|
switch (command) {
|
|
3478
|
-
case M$
|
|
3504
|
+
case M$8:
|
|
3479
3505
|
drawer.moveTo(data[i + 1], data[i + 2]);
|
|
3480
3506
|
i += 3;
|
|
3481
3507
|
break;
|
|
3482
3508
|
|
|
3483
|
-
case L$
|
|
3509
|
+
case L$8:
|
|
3484
3510
|
drawer.lineTo(data[i + 1], data[i + 2]);
|
|
3485
3511
|
i += 3;
|
|
3486
3512
|
break;
|
|
3487
3513
|
|
|
3488
|
-
case C$
|
|
3514
|
+
case C$6:
|
|
3489
3515
|
drawer.bezierCurveTo(data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6]);
|
|
3490
3516
|
i += 7;
|
|
3491
3517
|
break;
|
|
@@ -3495,7 +3521,7 @@ const PathDrawer = {
|
|
|
3495
3521
|
i += 5;
|
|
3496
3522
|
break;
|
|
3497
3523
|
|
|
3498
|
-
case Z$
|
|
3524
|
+
case Z$6:
|
|
3499
3525
|
drawer.closePath();
|
|
3500
3526
|
i += 1;
|
|
3501
3527
|
break;
|
|
@@ -3548,9 +3574,9 @@ const PathDrawer = {
|
|
|
3548
3574
|
}
|
|
3549
3575
|
};
|
|
3550
3576
|
|
|
3551
|
-
const {M: M$
|
|
3577
|
+
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;
|
|
3552
3578
|
|
|
3553
|
-
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$
|
|
3579
|
+
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$2, arc: arc, ellipse: ellipse$3} = BezierHelper;
|
|
3554
3580
|
|
|
3555
3581
|
const {addPointBounds: addPointBounds, copy: copy$9, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
3556
3582
|
|
|
@@ -3576,22 +3602,22 @@ const PathBounds = {
|
|
|
3576
3602
|
while (i < len) {
|
|
3577
3603
|
command = data[i];
|
|
3578
3604
|
if (i === 0) {
|
|
3579
|
-
if (command === Z$
|
|
3605
|
+
if (command === Z$5 || command === C$5 || command === Q$3) {
|
|
3580
3606
|
setPoint$3(setPointBounds, x, y);
|
|
3581
3607
|
} else {
|
|
3582
3608
|
setPoint$3(setPointBounds, data[i + 1], data[i + 2]);
|
|
3583
3609
|
}
|
|
3584
3610
|
}
|
|
3585
3611
|
switch (command) {
|
|
3586
|
-
case M$
|
|
3587
|
-
case L$
|
|
3612
|
+
case M$7:
|
|
3613
|
+
case L$7:
|
|
3588
3614
|
x = data[i + 1];
|
|
3589
3615
|
y = data[i + 2];
|
|
3590
3616
|
addPoint$1(setPointBounds, x, y);
|
|
3591
3617
|
i += 3;
|
|
3592
3618
|
break;
|
|
3593
3619
|
|
|
3594
|
-
case C$
|
|
3620
|
+
case C$5:
|
|
3595
3621
|
toX = data[i + 5];
|
|
3596
3622
|
toY = data[i + 6];
|
|
3597
3623
|
toTwoPointBounds(x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], toX, toY, tempPointBounds);
|
|
@@ -3613,7 +3639,7 @@ const PathBounds = {
|
|
|
3613
3639
|
i += 5;
|
|
3614
3640
|
break;
|
|
3615
3641
|
|
|
3616
|
-
case Z$
|
|
3642
|
+
case Z$5:
|
|
3617
3643
|
i += 1;
|
|
3618
3644
|
break;
|
|
3619
3645
|
|
|
@@ -3668,7 +3694,7 @@ const PathBounds = {
|
|
|
3668
3694
|
break;
|
|
3669
3695
|
|
|
3670
3696
|
case U$2:
|
|
3671
|
-
arcTo$
|
|
3697
|
+
arcTo$2(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3672
3698
|
i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3673
3699
|
x = setEndPoint.x;
|
|
3674
3700
|
y = setEndPoint.y;
|
|
@@ -3683,11 +3709,11 @@ const PathBounds = {
|
|
|
3683
3709
|
}
|
|
3684
3710
|
};
|
|
3685
3711
|
|
|
3686
|
-
const {M: M$
|
|
3712
|
+
const {M: M$6, L: L$6, Z: Z$4} = PathCommandMap;
|
|
3687
3713
|
|
|
3688
|
-
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
3714
|
+
const {getCenterX: getCenterX$1, getCenterY: getCenterY$1} = PointHelper;
|
|
3689
3715
|
|
|
3690
|
-
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
3716
|
+
const {arcTo: arcTo$1} = PathCommandDataHelper;
|
|
3691
3717
|
|
|
3692
3718
|
const PathCorner = {
|
|
3693
3719
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
@@ -3699,43 +3725,43 @@ const PathCorner = {
|
|
|
3699
3725
|
while (i < len) {
|
|
3700
3726
|
command = data[i];
|
|
3701
3727
|
switch (command) {
|
|
3702
|
-
case M$
|
|
3728
|
+
case M$6:
|
|
3703
3729
|
startX = lastX = data[i + 1];
|
|
3704
3730
|
startY = lastY = data[i + 2];
|
|
3705
3731
|
i += 3;
|
|
3706
|
-
if (data[i] === L$
|
|
3732
|
+
if (data[i] === L$6) {
|
|
3707
3733
|
secondX = data[i + 1];
|
|
3708
3734
|
secondY = data[i + 2];
|
|
3709
|
-
three ? smooth.push(M$
|
|
3735
|
+
three ? smooth.push(M$6, startX, startY) : smooth.push(M$6, getCenterX$1(startX, secondX), getCenterY$1(startY, secondY));
|
|
3710
3736
|
} else {
|
|
3711
|
-
smooth.push(M$
|
|
3737
|
+
smooth.push(M$6, startX, startY);
|
|
3712
3738
|
}
|
|
3713
3739
|
break;
|
|
3714
3740
|
|
|
3715
|
-
case L$
|
|
3741
|
+
case L$6:
|
|
3716
3742
|
x = data[i + 1];
|
|
3717
3743
|
y = data[i + 2];
|
|
3718
3744
|
i += 3;
|
|
3719
3745
|
switch (data[i]) {
|
|
3720
|
-
case L$
|
|
3721
|
-
arcTo(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3746
|
+
case L$6:
|
|
3747
|
+
arcTo$1(smooth, x, y, data[i + 1], data[i + 2], cornerRadius, lastX, lastY, three);
|
|
3722
3748
|
break;
|
|
3723
3749
|
|
|
3724
|
-
case Z$
|
|
3725
|
-
arcTo(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3750
|
+
case Z$4:
|
|
3751
|
+
arcTo$1(smooth, x, y, startX, startY, cornerRadius, lastX, lastY, three);
|
|
3726
3752
|
break;
|
|
3727
3753
|
|
|
3728
3754
|
default:
|
|
3729
|
-
smooth.push(L$
|
|
3755
|
+
smooth.push(L$6, x, y);
|
|
3730
3756
|
}
|
|
3731
3757
|
lastX = x;
|
|
3732
3758
|
lastY = y;
|
|
3733
3759
|
break;
|
|
3734
3760
|
|
|
3735
|
-
case Z$
|
|
3736
|
-
if (lastCommand !== Z$
|
|
3737
|
-
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3738
|
-
smooth.push(Z$
|
|
3761
|
+
case Z$4:
|
|
3762
|
+
if (lastCommand !== Z$4) {
|
|
3763
|
+
arcTo$1(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY, three);
|
|
3764
|
+
smooth.push(Z$4);
|
|
3739
3765
|
}
|
|
3740
3766
|
i += 1;
|
|
3741
3767
|
break;
|
|
@@ -3747,7 +3773,7 @@ const PathCorner = {
|
|
|
3747
3773
|
}
|
|
3748
3774
|
lastCommand = command;
|
|
3749
3775
|
}
|
|
3750
|
-
if (command !== Z$
|
|
3776
|
+
if (command !== Z$4) {
|
|
3751
3777
|
smooth[1] = startX;
|
|
3752
3778
|
smooth[2] = startY;
|
|
3753
3779
|
}
|
|
@@ -4789,7 +4815,7 @@ const LeafHelper = {
|
|
|
4789
4815
|
if (layout.opacityChanged) updateAllWorldOpacity(leaf);
|
|
4790
4816
|
leaf.__updateChange();
|
|
4791
4817
|
if (layout.surfaceChanged) {
|
|
4792
|
-
if (leaf.__hasComplex) L$
|
|
4818
|
+
if (leaf.__hasComplex) L$5.updateComplex(leaf);
|
|
4793
4819
|
layout.surfaceChanged = false;
|
|
4794
4820
|
}
|
|
4795
4821
|
},
|
|
@@ -4825,7 +4851,7 @@ const LeafHelper = {
|
|
|
4825
4851
|
y: y
|
|
4826
4852
|
};
|
|
4827
4853
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4828
|
-
L$
|
|
4854
|
+
L$5.moveLocal(t, local.x, local.y, transition);
|
|
4829
4855
|
},
|
|
4830
4856
|
moveLocal(t, x, y = 0, transition) {
|
|
4831
4857
|
if (isObject(x)) y = x.y, x = x.x;
|
|
@@ -4838,7 +4864,7 @@ const LeafHelper = {
|
|
|
4838
4864
|
}, transition) : (t.x = x, t.y = y);
|
|
4839
4865
|
},
|
|
4840
4866
|
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
4841
|
-
L$
|
|
4867
|
+
L$5.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
|
|
4842
4868
|
},
|
|
4843
4869
|
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
|
|
4844
4870
|
const o = t.__localMatrix;
|
|
@@ -4848,8 +4874,8 @@ const LeafHelper = {
|
|
|
4848
4874
|
}
|
|
4849
4875
|
copy$8(matrix$3, o);
|
|
4850
4876
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4851
|
-
if (L$
|
|
4852
|
-
L$
|
|
4877
|
+
if (L$5.hasHighPosition(t)) {
|
|
4878
|
+
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4853
4879
|
} else {
|
|
4854
4880
|
const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.f - o.f;
|
|
4855
4881
|
if (transition && !resize) t.animate({
|
|
@@ -4861,41 +4887,41 @@ const LeafHelper = {
|
|
|
4861
4887
|
}
|
|
4862
4888
|
},
|
|
4863
4889
|
rotateOfWorld(t, origin, angle, transition) {
|
|
4864
|
-
L$
|
|
4890
|
+
L$5.rotateOfLocal(t, getTempLocal(t, origin), angle, transition);
|
|
4865
4891
|
},
|
|
4866
4892
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4867
4893
|
const o = t.__localMatrix;
|
|
4868
4894
|
copy$8(matrix$3, o);
|
|
4869
4895
|
rotateOfOuter$2(matrix$3, origin, angle);
|
|
4870
|
-
if (L$
|
|
4896
|
+
if (L$5.hasHighPosition(t)) L$5.setTransform(t, matrix$3, false, transition); else t.set({
|
|
4871
4897
|
x: t.x + matrix$3.e - o.e,
|
|
4872
4898
|
y: t.y + matrix$3.f - o.f,
|
|
4873
4899
|
rotation: MathHelper.formatRotation(t.rotation + angle)
|
|
4874
4900
|
}, transition);
|
|
4875
4901
|
},
|
|
4876
4902
|
skewOfWorld(t, origin, skewX, skewY, resize, transition) {
|
|
4877
|
-
L$
|
|
4903
|
+
L$5.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4878
4904
|
},
|
|
4879
4905
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4880
4906
|
copy$8(matrix$3, t.__localMatrix);
|
|
4881
4907
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4882
|
-
L$
|
|
4908
|
+
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4883
4909
|
},
|
|
4884
4910
|
transformWorld(t, transform, resize, transition) {
|
|
4885
4911
|
copy$8(matrix$3, t.worldTransform);
|
|
4886
4912
|
multiplyParent$3(matrix$3, transform);
|
|
4887
4913
|
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4888
|
-
L$
|
|
4914
|
+
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4889
4915
|
},
|
|
4890
4916
|
transform(t, transform, resize, transition) {
|
|
4891
4917
|
copy$8(matrix$3, t.localTransform);
|
|
4892
4918
|
multiplyParent$3(matrix$3, transform);
|
|
4893
|
-
L$
|
|
4919
|
+
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4894
4920
|
},
|
|
4895
4921
|
setTransform(t, transform, resize, transition) {
|
|
4896
|
-
const data = t.__, originPoint = data.origin && L$
|
|
4897
|
-
const layout = getLayout(transform, originPoint, data.around && L$
|
|
4898
|
-
if (L$
|
|
4922
|
+
const data = t.__, originPoint = data.origin && L$5.getInnerOrigin(t, data.origin);
|
|
4923
|
+
const layout = getLayout(transform, originPoint, data.around && L$5.getInnerOrigin(t, data.around));
|
|
4924
|
+
if (L$5.hasOffset(t)) {
|
|
4899
4925
|
layout.x -= data.offsetX;
|
|
4900
4926
|
layout.y -= data.offsetY;
|
|
4901
4927
|
}
|
|
@@ -4904,7 +4930,7 @@ const LeafHelper = {
|
|
|
4904
4930
|
delete layout.scaleX, delete layout.scaleY;
|
|
4905
4931
|
if (originPoint) {
|
|
4906
4932
|
BoundsHelper.scale(t.boxBounds, Math.abs(scaleX), Math.abs(scaleY));
|
|
4907
|
-
const changedPoint = L$
|
|
4933
|
+
const changedPoint = L$5.getInnerOrigin(t, data.origin);
|
|
4908
4934
|
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4909
4935
|
}
|
|
4910
4936
|
t.set(layout);
|
|
@@ -4914,11 +4940,11 @@ const LeafHelper = {
|
|
|
4914
4940
|
getFlipTransform(t, axis) {
|
|
4915
4941
|
const m = getMatrixData();
|
|
4916
4942
|
const sign = axis === "x" ? 1 : -1;
|
|
4917
|
-
scaleOfOuter$2(m, L$
|
|
4943
|
+
scaleOfOuter$2(m, L$5.getLocalOrigin(t, "center"), -1 * sign, 1 * sign);
|
|
4918
4944
|
return m;
|
|
4919
4945
|
},
|
|
4920
4946
|
getLocalOrigin(t, origin) {
|
|
4921
|
-
return PointHelper.tempToOuterOf(L$
|
|
4947
|
+
return PointHelper.tempToOuterOf(L$5.getInnerOrigin(t, origin), t.localTransform);
|
|
4922
4948
|
},
|
|
4923
4949
|
getInnerOrigin(t, origin) {
|
|
4924
4950
|
const innerOrigin = {};
|
|
@@ -4934,11 +4960,11 @@ const LeafHelper = {
|
|
|
4934
4960
|
updateOuterBounds(_t) {},
|
|
4935
4961
|
cacheId(_t) {},
|
|
4936
4962
|
drop(t, parent, index, resize) {
|
|
4937
|
-
t.setTransform(L$
|
|
4963
|
+
t.setTransform(L$5.getRelativeWorld(t, parent, true), resize);
|
|
4938
4964
|
parent.add(t, index);
|
|
4939
4965
|
},
|
|
4940
4966
|
hasHighPosition(t) {
|
|
4941
|
-
return t.origin || t.around || L$
|
|
4967
|
+
return t.origin || t.around || L$5.hasOffset(t);
|
|
4942
4968
|
},
|
|
4943
4969
|
hasOffset(t) {
|
|
4944
4970
|
return t.offsetX || t.offsetY;
|
|
@@ -4958,14 +4984,14 @@ const LeafHelper = {
|
|
|
4958
4984
|
const x = move.x * speed, y = move.y * speed;
|
|
4959
4985
|
move.x -= x, move.y -= y;
|
|
4960
4986
|
t.move(x, y);
|
|
4961
|
-
Platform.requestRender(() => L$
|
|
4987
|
+
Platform.requestRender(() => L$5.animateMove(t, move, speed));
|
|
4962
4988
|
}
|
|
4963
4989
|
}
|
|
4964
4990
|
};
|
|
4965
4991
|
|
|
4966
|
-
const L$
|
|
4992
|
+
const L$5 = LeafHelper;
|
|
4967
4993
|
|
|
4968
|
-
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$
|
|
4994
|
+
const {updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L$5;
|
|
4969
4995
|
|
|
4970
4996
|
function getTempLocal(t, worldPoint) {
|
|
4971
4997
|
t.updateLayout();
|
|
@@ -7053,7 +7079,7 @@ class LeafLevelList {
|
|
|
7053
7079
|
}
|
|
7054
7080
|
}
|
|
7055
7081
|
|
|
7056
|
-
const version = "2.0.
|
|
7082
|
+
const version = "2.0.7";
|
|
7057
7083
|
|
|
7058
7084
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7059
7085
|
get allowBackgroundColor() {
|
|
@@ -8696,6 +8722,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8696
8722
|
createProxyData() {
|
|
8697
8723
|
return undefined;
|
|
8698
8724
|
}
|
|
8725
|
+
clearProxyData() {}
|
|
8699
8726
|
find(_condition, _options) {
|
|
8700
8727
|
return Plugin.need("find");
|
|
8701
8728
|
}
|
|
@@ -8736,7 +8763,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8736
8763
|
__updateRenderPath(updateCache) {
|
|
8737
8764
|
const data = this.__;
|
|
8738
8765
|
if (data.path) {
|
|
8739
|
-
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8766
|
+
data.__pathForRender = data.cornerRadius || data.path.radius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8740
8767
|
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8741
8768
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8742
8769
|
}
|
|
@@ -9569,7 +9596,7 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9569
9596
|
}
|
|
9570
9597
|
}
|
|
9571
9598
|
if (!open) closePath$2(path);
|
|
9572
|
-
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9599
|
+
if (Platform.ellipseToCurve || data.__useArrow || data.cornerRadius) data.path = this.getPath(true);
|
|
9573
9600
|
}
|
|
9574
9601
|
};
|
|
9575
9602
|
|
|
@@ -9595,7 +9622,7 @@ let Polygon = class Polygon extends UI {
|
|
|
9595
9622
|
const data = this.__;
|
|
9596
9623
|
const path = data.path = [];
|
|
9597
9624
|
if (data.points) {
|
|
9598
|
-
drawPoints$1(path, data.points, data.curve,
|
|
9625
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9599
9626
|
} else {
|
|
9600
9627
|
const {width: width, height: height, sides: sides} = data;
|
|
9601
9628
|
const rx = width / 2, ry = height / 2;
|
|
@@ -12075,17 +12102,19 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
12075
12102
|
}
|
|
12076
12103
|
|
|
12077
12104
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
12105
|
+
let needUpdate = true;
|
|
12078
12106
|
const data = ui.__;
|
|
12079
12107
|
if (attrName === "fill" && !data.__naturalWidth) {
|
|
12080
12108
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
12081
12109
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
12082
12110
|
if (data.__autoSide) {
|
|
12083
12111
|
ui.forceUpdate("width");
|
|
12112
|
+
LeafHelper.updateBounds(ui);
|
|
12084
12113
|
if (ui.__proxyData) {
|
|
12085
12114
|
ui.setProxyAttr("width", data.width);
|
|
12086
12115
|
ui.setProxyAttr("height", data.height);
|
|
12087
12116
|
}
|
|
12088
|
-
|
|
12117
|
+
needUpdate = false;
|
|
12089
12118
|
}
|
|
12090
12119
|
}
|
|
12091
12120
|
if (!leafPaint.data) {
|
|
@@ -12095,7 +12124,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
12095
12124
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
12096
12125
|
}
|
|
12097
12126
|
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
12098
|
-
return
|
|
12127
|
+
return needUpdate;
|
|
12099
12128
|
}
|
|
12100
12129
|
|
|
12101
12130
|
function onLoad(ui, event) {
|
|
@@ -12545,10 +12574,10 @@ const realFrom = {};
|
|
|
12545
12574
|
const realTo = {};
|
|
12546
12575
|
|
|
12547
12576
|
function conicGradient(paint, box) {
|
|
12548
|
-
let {from: from, to: to, type: type, opacity: opacity, stretch: stretch} = paint;
|
|
12577
|
+
let {from: from, to: to, type: type, opacity: opacity, rotation: rotation, stretch: stretch} = paint;
|
|
12549
12578
|
toPoint$1(from || "center", box, realFrom);
|
|
12550
12579
|
toPoint$1(to || "bottom", box, realTo);
|
|
12551
|
-
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));
|
|
12580
|
+
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));
|
|
12552
12581
|
const data = {
|
|
12553
12582
|
type: type,
|
|
12554
12583
|
style: style
|
|
@@ -13399,11 +13428,7 @@ function targetAttr(fn) {
|
|
|
13399
13428
|
});
|
|
13400
13429
|
if (isObject(check)) value = check; else if (check === false) return;
|
|
13401
13430
|
}
|
|
13402
|
-
if (t.hasDimOthers)
|
|
13403
|
-
t.setDimOthers(false);
|
|
13404
|
-
t.setBright(false);
|
|
13405
|
-
t.hasDimOthers = undefined;
|
|
13406
|
-
}
|
|
13431
|
+
if (t.hasDimOthers) t.cancelDimOthers();
|
|
13407
13432
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
13408
13433
|
if (t.single) {
|
|
13409
13434
|
delete t.element.syncEventer;
|
|
@@ -14336,6 +14361,8 @@ class EditBox extends Group {
|
|
|
14336
14361
|
editor.setDimOthers(dimOthers);
|
|
14337
14362
|
editor.setBright(!!dimOthers || bright);
|
|
14338
14363
|
editor.hasDimOthers = true;
|
|
14364
|
+
} else if (editor.hasDimOthers) {
|
|
14365
|
+
editor.cancelDimOthers();
|
|
14339
14366
|
}
|
|
14340
14367
|
if (spread) BoundsHelper.spread(bounds, spread);
|
|
14341
14368
|
if (this.view.worldOpacity) {
|
|
@@ -15375,6 +15402,11 @@ let Editor = class Editor extends Group {
|
|
|
15375
15402
|
setBright(value) {
|
|
15376
15403
|
this.setDimOthers(value, "bright", this.list);
|
|
15377
15404
|
}
|
|
15405
|
+
cancelDimOthers() {
|
|
15406
|
+
this.setDimOthers(false);
|
|
15407
|
+
this.setBright(false);
|
|
15408
|
+
this.hasDimOthers = undefined;
|
|
15409
|
+
}
|
|
15378
15410
|
update() {
|
|
15379
15411
|
if (this.editing) {
|
|
15380
15412
|
if (!this.element.parent) return this.cancel();
|
|
@@ -15838,7 +15870,7 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
15838
15870
|
|
|
15839
15871
|
LineEditTool = __decorate([ registerEditTool() ], LineEditTool);
|
|
15840
15872
|
|
|
15841
|
-
const {M: M$
|
|
15873
|
+
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;
|
|
15842
15874
|
|
|
15843
15875
|
const PathScaler = {
|
|
15844
15876
|
scale(data, scaleX, scaleY) {
|
|
@@ -15848,13 +15880,13 @@ const PathScaler = {
|
|
|
15848
15880
|
while (i < len) {
|
|
15849
15881
|
command = data[i];
|
|
15850
15882
|
switch (command) {
|
|
15851
|
-
case M$
|
|
15852
|
-
case L$
|
|
15883
|
+
case M$5:
|
|
15884
|
+
case L$4:
|
|
15853
15885
|
scalePoints(data, scaleX, scaleY, i, 1);
|
|
15854
15886
|
i += 3;
|
|
15855
15887
|
break;
|
|
15856
15888
|
|
|
15857
|
-
case C$
|
|
15889
|
+
case C$4:
|
|
15858
15890
|
scalePoints(data, scaleX, scaleY, i, 3);
|
|
15859
15891
|
i += 7;
|
|
15860
15892
|
break;
|
|
@@ -15864,7 +15896,7 @@ const PathScaler = {
|
|
|
15864
15896
|
i += 5;
|
|
15865
15897
|
break;
|
|
15866
15898
|
|
|
15867
|
-
case Z$
|
|
15899
|
+
case Z$3:
|
|
15868
15900
|
i += 1;
|
|
15869
15901
|
break;
|
|
15870
15902
|
|
|
@@ -16245,13 +16277,13 @@ const MultiTouchHelper = {
|
|
|
16245
16277
|
return "rotate";
|
|
16246
16278
|
},
|
|
16247
16279
|
detect(data, config) {
|
|
16248
|
-
const {state: state} = M$
|
|
16249
|
-
const type = M$
|
|
16280
|
+
const {state: state} = M$4;
|
|
16281
|
+
const type = M$4.getType(data, config);
|
|
16250
16282
|
if (!state.totalData) {
|
|
16251
16283
|
state.startTime = Date.now();
|
|
16252
16284
|
state.center = data.center;
|
|
16253
16285
|
}
|
|
16254
|
-
M$
|
|
16286
|
+
M$4.add(data, state.totalData);
|
|
16255
16287
|
state.totalData = data;
|
|
16256
16288
|
if (type === state.type) {
|
|
16257
16289
|
state.typeCount++;
|
|
@@ -16260,7 +16292,7 @@ const MultiTouchHelper = {
|
|
|
16260
16292
|
state.type = type;
|
|
16261
16293
|
state.typeCount = 1;
|
|
16262
16294
|
}
|
|
16263
|
-
if (Date.now() - state.startTime >= (config.time || 160)) return M$
|
|
16295
|
+
if (Date.now() - state.startTime >= (config.time || 160)) return M$4.getType(state.totalData, config);
|
|
16264
16296
|
return "none";
|
|
16265
16297
|
},
|
|
16266
16298
|
add(data, add) {
|
|
@@ -16271,7 +16303,7 @@ const MultiTouchHelper = {
|
|
|
16271
16303
|
data.center = add.center;
|
|
16272
16304
|
},
|
|
16273
16305
|
reset() {
|
|
16274
|
-
const {state: state} = M$
|
|
16306
|
+
const {state: state} = M$4;
|
|
16275
16307
|
state.type = "none";
|
|
16276
16308
|
state.typeCount = 0;
|
|
16277
16309
|
state.startTime = 0;
|
|
@@ -16279,7 +16311,7 @@ const MultiTouchHelper = {
|
|
|
16279
16311
|
}
|
|
16280
16312
|
};
|
|
16281
16313
|
|
|
16282
|
-
const M$
|
|
16314
|
+
const M$4 = MultiTouchHelper;
|
|
16283
16315
|
|
|
16284
16316
|
const {abs: abs$2, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
16285
16317
|
|
|
@@ -16921,7 +16953,7 @@ __decorate([ arrowType("angle") ], Arrow.prototype, "endArrow", void 0);
|
|
|
16921
16953
|
|
|
16922
16954
|
Arrow = __decorate([ registerUI() ], Arrow);
|
|
16923
16955
|
|
|
16924
|
-
const {M: M$
|
|
16956
|
+
const {M: M$3, L: L$3, C: C$3, Q: Q$1, O: O$1} = PathCommandMap;
|
|
16925
16957
|
|
|
16926
16958
|
const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
|
|
16927
16959
|
|
|
@@ -16933,13 +16965,13 @@ const PathMatrixHelper = {
|
|
|
16933
16965
|
while (i < len) {
|
|
16934
16966
|
command = data[i];
|
|
16935
16967
|
switch (command) {
|
|
16936
|
-
case M$
|
|
16937
|
-
case L$
|
|
16968
|
+
case M$3:
|
|
16969
|
+
case L$3:
|
|
16938
16970
|
setPoint$2(data, i + 1, x, y, scaleX, scaleY, rotation, origin);
|
|
16939
16971
|
i += 3;
|
|
16940
16972
|
break;
|
|
16941
16973
|
|
|
16942
|
-
case C$
|
|
16974
|
+
case C$3:
|
|
16943
16975
|
for (j = 1; j < 6; j += 2) setPoint$2(data, i + j, x, y, scaleX, scaleY, rotation, origin);
|
|
16944
16976
|
i += 7;
|
|
16945
16977
|
break;
|
|
@@ -17179,7 +17211,7 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
|
|
|
17179
17211
|
return arrowData;
|
|
17180
17212
|
}
|
|
17181
17213
|
|
|
17182
|
-
const {M: M$
|
|
17214
|
+
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;
|
|
17183
17215
|
|
|
17184
17216
|
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
17185
17217
|
|
|
@@ -17204,8 +17236,8 @@ const PathArrowModule = {
|
|
|
17204
17236
|
while (i < len) {
|
|
17205
17237
|
command = data[i];
|
|
17206
17238
|
switch (command) {
|
|
17207
|
-
case M$
|
|
17208
|
-
case L$
|
|
17239
|
+
case M$2:
|
|
17240
|
+
case L$2:
|
|
17209
17241
|
if (count < 2 || i + 6 >= len) {
|
|
17210
17242
|
copy(old, now);
|
|
17211
17243
|
copyFrom(now, data[i + 1], data[i + 2]);
|
|
@@ -17214,7 +17246,7 @@ const PathArrowModule = {
|
|
|
17214
17246
|
i += 3;
|
|
17215
17247
|
break;
|
|
17216
17248
|
|
|
17217
|
-
case C$
|
|
17249
|
+
case C$2:
|
|
17218
17250
|
if (count === 1 || i + 7 >= len - 3) {
|
|
17219
17251
|
copyPoints(data, last, now, i + 3);
|
|
17220
17252
|
old.x = data[i + 1], old.y = data[i + 2];
|
|
@@ -17230,7 +17262,7 @@ const PathArrowModule = {
|
|
|
17230
17262
|
i += 5;
|
|
17231
17263
|
break;
|
|
17232
17264
|
|
|
17233
|
-
case Z$
|
|
17265
|
+
case Z$2:
|
|
17234
17266
|
return;
|
|
17235
17267
|
|
|
17236
17268
|
case N:
|
|
@@ -17274,8 +17306,8 @@ const PathArrowModule = {
|
|
|
17274
17306
|
break;
|
|
17275
17307
|
}
|
|
17276
17308
|
count++;
|
|
17277
|
-
if (count === 1 && command !== M$
|
|
17278
|
-
if (count === 2 && useStartArrow) copy(second, command === L$
|
|
17309
|
+
if (count === 1 && command !== M$2) return;
|
|
17310
|
+
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame(old, first) ? last : old);
|
|
17279
17311
|
if (i === len) {
|
|
17280
17312
|
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
17281
17313
|
if (useStartArrow) {
|
|
@@ -17297,11 +17329,11 @@ const PathArrowModule = {
|
|
|
17297
17329
|
getDistancePoint(now, last, -connectPoint.x, true);
|
|
17298
17330
|
let index;
|
|
17299
17331
|
switch (command) {
|
|
17300
|
-
case L$
|
|
17332
|
+
case L$2:
|
|
17301
17333
|
index = i - 3 + 1;
|
|
17302
17334
|
break;
|
|
17303
17335
|
|
|
17304
|
-
case C$
|
|
17336
|
+
case C$2:
|
|
17305
17337
|
index = i - 7 + 5;
|
|
17306
17338
|
break;
|
|
17307
17339
|
|
|
@@ -19043,7 +19075,7 @@ const HighBezierHelper = {
|
|
|
19043
19075
|
|
|
19044
19076
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
19045
19077
|
|
|
19046
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float$1} = MathHelper;
|
|
19078
|
+
const {M: M$1, L: L$1, C: C$1, Z: Z$1} = PathCommandMap, {float: float$1} = MathHelper;
|
|
19047
19079
|
|
|
19048
19080
|
const tempPoint = {}, tempFrom = {};
|
|
19049
19081
|
|
|
@@ -19054,18 +19086,18 @@ const HighCurveHelper = {
|
|
|
19054
19086
|
while (i < len) {
|
|
19055
19087
|
command = data[i];
|
|
19056
19088
|
switch (command) {
|
|
19057
|
-
case M:
|
|
19058
|
-
case L:
|
|
19089
|
+
case M$1:
|
|
19090
|
+
case L$1:
|
|
19059
19091
|
HighCurveHelper.transformPoints(data, matrix, i, 1);
|
|
19060
19092
|
i += 3;
|
|
19061
19093
|
break;
|
|
19062
19094
|
|
|
19063
|
-
case C:
|
|
19095
|
+
case C$1:
|
|
19064
19096
|
HighCurveHelper.transformPoints(data, matrix, i, 3);
|
|
19065
19097
|
i += 7;
|
|
19066
19098
|
break;
|
|
19067
19099
|
|
|
19068
|
-
case Z:
|
|
19100
|
+
case Z$1:
|
|
19069
19101
|
i += 1;
|
|
19070
19102
|
}
|
|
19071
19103
|
}
|
|
@@ -19086,17 +19118,17 @@ const HighCurveHelper = {
|
|
|
19086
19118
|
while (i < len) {
|
|
19087
19119
|
command = data[i];
|
|
19088
19120
|
switch (command) {
|
|
19089
|
-
case M:
|
|
19090
|
-
case L:
|
|
19121
|
+
case M$1:
|
|
19122
|
+
case L$1:
|
|
19091
19123
|
toX = data[i + 1];
|
|
19092
19124
|
toY = data[i + 2];
|
|
19093
|
-
distance = command === L && i > 0 ? PointHelper.getDistanceFrom(x, y, toX, toY) : 0;
|
|
19125
|
+
distance = command === L$1 && i > 0 ? PointHelper.getDistanceFrom(x, y, toX, toY) : 0;
|
|
19094
19126
|
x = toX;
|
|
19095
19127
|
y = toY;
|
|
19096
19128
|
i += 3;
|
|
19097
19129
|
break;
|
|
19098
19130
|
|
|
19099
|
-
case C:
|
|
19131
|
+
case C$1:
|
|
19100
19132
|
toX = data[i + 5];
|
|
19101
19133
|
toY = data[i + 6];
|
|
19102
19134
|
distance = HighBezierHelper.getDistance(x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], toX, toY);
|
|
@@ -19105,7 +19137,7 @@ const HighCurveHelper = {
|
|
|
19105
19137
|
i += 7;
|
|
19106
19138
|
break;
|
|
19107
19139
|
|
|
19108
|
-
case Z:
|
|
19140
|
+
case Z$1:
|
|
19109
19141
|
i += 1;
|
|
19110
19142
|
|
|
19111
19143
|
default:
|
|
@@ -19130,8 +19162,8 @@ const HighCurveHelper = {
|
|
|
19130
19162
|
while (i < len) {
|
|
19131
19163
|
command = data[i];
|
|
19132
19164
|
switch (command) {
|
|
19133
|
-
case M:
|
|
19134
|
-
case L:
|
|
19165
|
+
case M$1:
|
|
19166
|
+
case L$1:
|
|
19135
19167
|
toX = data[i + 1];
|
|
19136
19168
|
toY = data[i + 2];
|
|
19137
19169
|
distance = segments[index];
|
|
@@ -19150,7 +19182,7 @@ const HighCurveHelper = {
|
|
|
19150
19182
|
i += 3;
|
|
19151
19183
|
break;
|
|
19152
19184
|
|
|
19153
|
-
case C:
|
|
19185
|
+
case C$1:
|
|
19154
19186
|
toX = data[i + 5];
|
|
19155
19187
|
toY = data[i + 6];
|
|
19156
19188
|
distance = segments[index];
|
|
@@ -19166,7 +19198,7 @@ const HighCurveHelper = {
|
|
|
19166
19198
|
i += 7;
|
|
19167
19199
|
break;
|
|
19168
19200
|
|
|
19169
|
-
case Z:
|
|
19201
|
+
case Z$1:
|
|
19170
19202
|
i += 1;
|
|
19171
19203
|
|
|
19172
19204
|
default:
|
|
@@ -19187,8 +19219,8 @@ const HighCurveHelper = {
|
|
|
19187
19219
|
while (i < len) {
|
|
19188
19220
|
command = data[i];
|
|
19189
19221
|
switch (command) {
|
|
19190
|
-
case M:
|
|
19191
|
-
case L:
|
|
19222
|
+
case M$1:
|
|
19223
|
+
case L$1:
|
|
19192
19224
|
toX = data[i + 1];
|
|
19193
19225
|
toY = data[i + 2];
|
|
19194
19226
|
distance = segments[index];
|
|
@@ -19211,7 +19243,7 @@ const HighCurveHelper = {
|
|
|
19211
19243
|
path.push(command, x, y);
|
|
19212
19244
|
break;
|
|
19213
19245
|
|
|
19214
|
-
case C:
|
|
19246
|
+
case C$1:
|
|
19215
19247
|
x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
|
|
19216
19248
|
toX = data[i + 5];
|
|
19217
19249
|
toY = data[i + 6];
|
|
@@ -19230,7 +19262,7 @@ const HighCurveHelper = {
|
|
|
19230
19262
|
path.push(command, x1, y1, x2, y2, toX, toY);
|
|
19231
19263
|
break;
|
|
19232
19264
|
|
|
19233
|
-
case Z:
|
|
19265
|
+
case Z$1:
|
|
19234
19266
|
i += 1;
|
|
19235
19267
|
path.push(command);
|
|
19236
19268
|
|
|
@@ -20751,4 +20783,265 @@ ImageBox = __decorate([ registerUI() ], ImageBox);
|
|
|
20751
20783
|
|
|
20752
20784
|
Plugin.add("box");
|
|
20753
20785
|
|
|
20786
|
+
function getTangentDistance(r, x, y, lastX, lastY, nextX, nextY) {
|
|
20787
|
+
const ux = lastX - x, uy = lastY - y;
|
|
20788
|
+
const vx = nextX - x, vy = nextY - y;
|
|
20789
|
+
const lenU = Math.sqrt(ux * ux + uy * uy);
|
|
20790
|
+
const lenV = Math.sqrt(vx * vx + vy * vy);
|
|
20791
|
+
if (lenU < .001 || lenV < .001) return 0;
|
|
20792
|
+
const cosTheta = (ux * vx + uy * vy) / (lenU * lenV);
|
|
20793
|
+
const safeCos = Math.max(-.99999, Math.min(.99999, cosTheta));
|
|
20794
|
+
let d = r * Math.sqrt((1 - safeCos) / (1 + safeCos));
|
|
20795
|
+
const maxD = Math.min(lenU / 2, lenV / 2);
|
|
20796
|
+
return Math.min(d, maxD);
|
|
20797
|
+
}
|
|
20798
|
+
|
|
20799
|
+
function getCorrectT(d, x, y, x1, y1, x2, y2, toX, toY) {
|
|
20800
|
+
if (d <= 0) return 0;
|
|
20801
|
+
const chordLen = Math.sqrt(Math.pow(toX - x, 2) + Math.pow(toY - y, 2));
|
|
20802
|
+
if (d >= chordLen) return .5;
|
|
20803
|
+
const vx0 = 3 * (x1 - x);
|
|
20804
|
+
const vy0 = 3 * (y1 - y);
|
|
20805
|
+
let v0mag = Math.sqrt(vx0 * vx0 + vy0 * vy0);
|
|
20806
|
+
if (v0mag < 1e-6) v0mag = chordLen || 1;
|
|
20807
|
+
let t = Math.min(.5, d / v0mag);
|
|
20808
|
+
const tempP = {
|
|
20809
|
+
x: 0,
|
|
20810
|
+
y: 0
|
|
20811
|
+
};
|
|
20812
|
+
for (let i = 0; i < 5; i++) {
|
|
20813
|
+
BezierHelper.getPointAndSet(t, x, y, x1, y1, x2, y2, toX, toY, tempP);
|
|
20814
|
+
const dx = tempP.x - x;
|
|
20815
|
+
const dy = tempP.y - y;
|
|
20816
|
+
const currentDist = Math.sqrt(dx * dx + dy * dy);
|
|
20817
|
+
if (currentDist < 1e-6) {
|
|
20818
|
+
t = t * 1.5;
|
|
20819
|
+
continue;
|
|
20820
|
+
}
|
|
20821
|
+
const vxt = BezierHelper.getDerivative(t, x, x1, x2, toX);
|
|
20822
|
+
const vyt = BezierHelper.getDerivative(t, y, y1, y2, toY);
|
|
20823
|
+
const f_prime = (dx * vxt + dy * vyt) / currentDist;
|
|
20824
|
+
if (Math.abs(f_prime) < 1e-6) break;
|
|
20825
|
+
const deltaT = (currentDist - d) / f_prime;
|
|
20826
|
+
const nextT = t - deltaT;
|
|
20827
|
+
const safeNextT = Math.max(0, Math.min(.6, nextT));
|
|
20828
|
+
if (Math.abs(safeNextT - t) < 1e-5) {
|
|
20829
|
+
t = safeNextT;
|
|
20830
|
+
break;
|
|
20831
|
+
}
|
|
20832
|
+
t = safeNextT;
|
|
20833
|
+
}
|
|
20834
|
+
return Math.max(0, Math.min(.5, t));
|
|
20835
|
+
}
|
|
20836
|
+
|
|
20837
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
|
|
20838
|
+
|
|
20839
|
+
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
20840
|
+
|
|
20841
|
+
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
20842
|
+
|
|
20843
|
+
PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
20844
|
+
const radius = data.radius;
|
|
20845
|
+
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true);
|
|
20846
|
+
let command, lastCommand, commandLen;
|
|
20847
|
+
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;
|
|
20848
|
+
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
20849
|
+
const len = data.length, three = len === 9;
|
|
20850
|
+
const smooth = [];
|
|
20851
|
+
while (i < len) {
|
|
20852
|
+
command = data[i];
|
|
20853
|
+
r = radius ? isUndefined(radius[countCommand]) ? cornerRadius : radius[countCommand] : cornerRadius;
|
|
20854
|
+
switch (command) {
|
|
20855
|
+
case M:
|
|
20856
|
+
startX = lastX = data[i + 1];
|
|
20857
|
+
startY = lastY = data[i + 2];
|
|
20858
|
+
startR = r;
|
|
20859
|
+
i += 3;
|
|
20860
|
+
const end = findEndPoint(data, i);
|
|
20861
|
+
switch (data[i]) {
|
|
20862
|
+
case L:
|
|
20863
|
+
secondX = data[i + 1];
|
|
20864
|
+
secondY = data[i + 2];
|
|
20865
|
+
if (three) smooth.push(M, startX, startY); else {
|
|
20866
|
+
if (end) smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY)); else smooth.push(M, startX, startY);
|
|
20867
|
+
}
|
|
20868
|
+
break;
|
|
20869
|
+
|
|
20870
|
+
case C:
|
|
20871
|
+
if (end) {
|
|
20872
|
+
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]);
|
|
20873
|
+
if (left && right) {
|
|
20874
|
+
smooth.push(M, secondX = left[4], secondY = left[5]);
|
|
20875
|
+
break;
|
|
20876
|
+
}
|
|
20877
|
+
}
|
|
20878
|
+
|
|
20879
|
+
default:
|
|
20880
|
+
smooth.push(M, secondX = startX, secondY = startY);
|
|
20881
|
+
}
|
|
20882
|
+
break;
|
|
20883
|
+
|
|
20884
|
+
case L:
|
|
20885
|
+
x = data[i + 1];
|
|
20886
|
+
y = data[i + 2];
|
|
20887
|
+
i += 3;
|
|
20888
|
+
switch (data[i]) {
|
|
20889
|
+
case L:
|
|
20890
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], r, lastX, lastY, three);
|
|
20891
|
+
break;
|
|
20892
|
+
|
|
20893
|
+
case C:
|
|
20894
|
+
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]);
|
|
20895
|
+
if (left && right) arcTo(smooth, x, y, left[4], left[5], r, lastX, lastY, three); else smooth.push(L, x, y);
|
|
20896
|
+
break;
|
|
20897
|
+
|
|
20898
|
+
case Z:
|
|
20899
|
+
arcTo(smooth, x, y, startX, startY, r, lastX, lastY, three);
|
|
20900
|
+
break;
|
|
20901
|
+
|
|
20902
|
+
default:
|
|
20903
|
+
smooth.push(L, x, y);
|
|
20904
|
+
}
|
|
20905
|
+
lastX = x;
|
|
20906
|
+
lastY = y;
|
|
20907
|
+
break;
|
|
20908
|
+
|
|
20909
|
+
case C:
|
|
20910
|
+
x1 = data[i + 1];
|
|
20911
|
+
y1 = data[i + 2];
|
|
20912
|
+
x2 = data[i + 3];
|
|
20913
|
+
y2 = data[i + 4];
|
|
20914
|
+
x = data[i + 5];
|
|
20915
|
+
y = data[i + 6];
|
|
20916
|
+
i += 7;
|
|
20917
|
+
switch (data[i]) {
|
|
20918
|
+
case L:
|
|
20919
|
+
toX = data[i + 1], toY = data[i + 2];
|
|
20920
|
+
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
20921
|
+
break;
|
|
20922
|
+
|
|
20923
|
+
case C:
|
|
20924
|
+
smooth.push(C, x1, y1, x2, y2, x, y);
|
|
20925
|
+
break;
|
|
20926
|
+
|
|
20927
|
+
case Z:
|
|
20928
|
+
toX = startX, toY = startY;
|
|
20929
|
+
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
20930
|
+
break;
|
|
20931
|
+
}
|
|
20932
|
+
lastX = x;
|
|
20933
|
+
lastY = y;
|
|
20934
|
+
break;
|
|
20935
|
+
|
|
20936
|
+
case Z:
|
|
20937
|
+
if (lastCommand !== Z) {
|
|
20938
|
+
arcTo(smooth, startX, startY, secondX, secondY, startR, lastX, lastY, three);
|
|
20939
|
+
smooth.push(Z);
|
|
20940
|
+
}
|
|
20941
|
+
i += 1;
|
|
20942
|
+
break;
|
|
20943
|
+
|
|
20944
|
+
default:
|
|
20945
|
+
commandLen = PathNumberCommandLengthMap[command];
|
|
20946
|
+
for (let j = 0; j < commandLen; j++) smooth.push(data[i + j]);
|
|
20947
|
+
i += commandLen;
|
|
20948
|
+
}
|
|
20949
|
+
lastCommand = command;
|
|
20950
|
+
countCommand++;
|
|
20951
|
+
}
|
|
20952
|
+
return smooth;
|
|
20953
|
+
};
|
|
20954
|
+
|
|
20955
|
+
function isNeedConvert(data) {
|
|
20956
|
+
let command, i = 0;
|
|
20957
|
+
const len = data.length;
|
|
20958
|
+
while (i < len) {
|
|
20959
|
+
command = data[i];
|
|
20960
|
+
switch (command) {
|
|
20961
|
+
case M:
|
|
20962
|
+
i += 3;
|
|
20963
|
+
break;
|
|
20964
|
+
|
|
20965
|
+
case L:
|
|
20966
|
+
i += 3;
|
|
20967
|
+
break;
|
|
20968
|
+
|
|
20969
|
+
case C:
|
|
20970
|
+
i += 7;
|
|
20971
|
+
break;
|
|
20972
|
+
|
|
20973
|
+
case Z:
|
|
20974
|
+
i += 1;
|
|
20975
|
+
break;
|
|
20976
|
+
|
|
20977
|
+
default:
|
|
20978
|
+
return true;
|
|
20979
|
+
}
|
|
20980
|
+
}
|
|
20981
|
+
return false;
|
|
20982
|
+
}
|
|
20983
|
+
|
|
20984
|
+
function findEndPoint(data, i) {
|
|
20985
|
+
let command, commandLen, x, y;
|
|
20986
|
+
const len = data.length;
|
|
20987
|
+
while (i < len) {
|
|
20988
|
+
command = data[i];
|
|
20989
|
+
switch (command) {
|
|
20990
|
+
case M:
|
|
20991
|
+
return undefined;
|
|
20992
|
+
|
|
20993
|
+
case L:
|
|
20994
|
+
x = data[i + 1];
|
|
20995
|
+
y = data[i + 2];
|
|
20996
|
+
i += 3;
|
|
20997
|
+
break;
|
|
20998
|
+
|
|
20999
|
+
case C:
|
|
21000
|
+
x = data[i + 5];
|
|
21001
|
+
y = data[i + 6];
|
|
21002
|
+
i += 7;
|
|
21003
|
+
break;
|
|
21004
|
+
|
|
21005
|
+
case Z:
|
|
21006
|
+
return {
|
|
21007
|
+
x: x,
|
|
21008
|
+
y: y
|
|
21009
|
+
};
|
|
21010
|
+
|
|
21011
|
+
default:
|
|
21012
|
+
commandLen = PathNumberCommandLengthMap[command];
|
|
21013
|
+
i += commandLen;
|
|
21014
|
+
}
|
|
21015
|
+
}
|
|
21016
|
+
return undefined;
|
|
21017
|
+
}
|
|
21018
|
+
|
|
21019
|
+
function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
21020
|
+
const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, x1, y1);
|
|
21021
|
+
const t = getCorrectT(d, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21022
|
+
const two = BezierHelper.cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21023
|
+
const {left: left, right: right} = two;
|
|
21024
|
+
if (left && right) {
|
|
21025
|
+
data[i + 1] = right[0];
|
|
21026
|
+
data[i + 2] = right[1];
|
|
21027
|
+
data[i + 3] = right[2];
|
|
21028
|
+
data[i + 4] = right[3];
|
|
21029
|
+
}
|
|
21030
|
+
return two;
|
|
21031
|
+
}
|
|
21032
|
+
|
|
21033
|
+
function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY, nextX, nextY, three) {
|
|
21034
|
+
const d = getTangentDistance(cornerRadius, toX, toY, x2, y2, nextX, nextY);
|
|
21035
|
+
const t = getCorrectT(d, toX, toY, x2, y2, x1, y1, fromX, fromY);
|
|
21036
|
+
const {left: left, right: right} = BezierHelper.cut(1 - t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21037
|
+
if (left && right) {
|
|
21038
|
+
smooth.push(C, left[0], left[1], left[2], left[3], left[4], left[5]);
|
|
21039
|
+
arcTo(smooth, toX, toY, nextX, nextY, cornerRadius, left[4], left[5], three);
|
|
21040
|
+
} else {
|
|
21041
|
+
smooth.push(C, x1, y1, x2, y2, toX, toY);
|
|
21042
|
+
}
|
|
21043
|
+
}
|
|
21044
|
+
|
|
21045
|
+
Plugin.add("corner");
|
|
21046
|
+
|
|
20754
21047
|
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, 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, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|