@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.module.js
CHANGED
|
@@ -531,13 +531,13 @@ const MatrixHelper = {
|
|
|
531
531
|
to.f = t.f * pixelRatio;
|
|
532
532
|
},
|
|
533
533
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
534
|
-
M$
|
|
535
|
-
M$
|
|
534
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
535
|
+
M$c.scaleOfInner(t, tempPoint$5, scaleX, scaleY);
|
|
536
536
|
},
|
|
537
537
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
538
|
-
M$
|
|
539
|
-
M$
|
|
540
|
-
M$
|
|
538
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
539
|
+
M$c.scale(t, scaleX, scaleY);
|
|
540
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
541
541
|
},
|
|
542
542
|
rotate(t, rotation) {
|
|
543
543
|
const {a: a, b: b, c: c, d: d} = t;
|
|
@@ -550,13 +550,13 @@ const MatrixHelper = {
|
|
|
550
550
|
t.d = c * sinR + d * cosR;
|
|
551
551
|
},
|
|
552
552
|
rotateOfOuter(t, origin, rotation) {
|
|
553
|
-
M$
|
|
554
|
-
M$
|
|
553
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
554
|
+
M$c.rotateOfInner(t, tempPoint$5, rotation);
|
|
555
555
|
},
|
|
556
556
|
rotateOfInner(t, origin, rotation) {
|
|
557
|
-
M$
|
|
558
|
-
M$
|
|
559
|
-
M$
|
|
557
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
558
|
+
M$c.rotate(t, rotation);
|
|
559
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
560
560
|
},
|
|
561
561
|
skew(t, skewX, skewY) {
|
|
562
562
|
const {a: a, b: b, c: c, d: d} = t;
|
|
@@ -572,13 +572,13 @@ const MatrixHelper = {
|
|
|
572
572
|
}
|
|
573
573
|
},
|
|
574
574
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
575
|
-
M$
|
|
576
|
-
M$
|
|
575
|
+
M$c.toInnerPoint(t, origin, tempPoint$5);
|
|
576
|
+
M$c.skewOfInner(t, tempPoint$5, skewX, skewY);
|
|
577
577
|
},
|
|
578
578
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
579
|
-
M$
|
|
580
|
-
M$
|
|
581
|
-
M$
|
|
579
|
+
M$c.translateInner(t, origin.x, origin.y);
|
|
580
|
+
M$c.skew(t, skewX, skewY);
|
|
581
|
+
M$c.translateInner(t, -origin.x, -origin.y);
|
|
582
582
|
},
|
|
583
583
|
multiply(t, child) {
|
|
584
584
|
const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
|
|
@@ -617,15 +617,15 @@ const MatrixHelper = {
|
|
|
617
617
|
to.f = e * parent.b + f * parent.d + parent.f;
|
|
618
618
|
},
|
|
619
619
|
divide(t, child) {
|
|
620
|
-
M$
|
|
620
|
+
M$c.multiply(t, M$c.tempInvert(child));
|
|
621
621
|
},
|
|
622
622
|
divideParent(t, parent) {
|
|
623
|
-
M$
|
|
623
|
+
M$c.multiplyParent(t, M$c.tempInvert(parent));
|
|
624
624
|
},
|
|
625
625
|
tempInvert(t) {
|
|
626
|
-
const {tempMatrix: tempMatrix} = M$
|
|
627
|
-
M$
|
|
628
|
-
M$
|
|
626
|
+
const {tempMatrix: tempMatrix} = M$c;
|
|
627
|
+
M$c.copy(tempMatrix, t);
|
|
628
|
+
M$c.invert(tempMatrix);
|
|
629
629
|
return tempMatrix;
|
|
630
630
|
},
|
|
631
631
|
invert(t) {
|
|
@@ -703,7 +703,7 @@ const MatrixHelper = {
|
|
|
703
703
|
}
|
|
704
704
|
t.e = x;
|
|
705
705
|
t.f = y;
|
|
706
|
-
if (origin = origin || around) M$
|
|
706
|
+
if (origin = origin || around) M$c.translateInner(t, -origin.x, -origin.y, !around);
|
|
707
707
|
},
|
|
708
708
|
getLayout(t, origin, around, firstSkewY) {
|
|
709
709
|
const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
|
|
@@ -764,11 +764,11 @@ const MatrixHelper = {
|
|
|
764
764
|
return world;
|
|
765
765
|
},
|
|
766
766
|
reset(t) {
|
|
767
|
-
M$
|
|
767
|
+
M$c.set(t);
|
|
768
768
|
}
|
|
769
769
|
};
|
|
770
770
|
|
|
771
|
-
const M$
|
|
771
|
+
const M$c = MatrixHelper;
|
|
772
772
|
|
|
773
773
|
const {float: float$5} = MathHelper;
|
|
774
774
|
|
|
@@ -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() {
|
|
@@ -8542,6 +8568,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8542
8568
|
createProxyData() {
|
|
8543
8569
|
return undefined;
|
|
8544
8570
|
}
|
|
8571
|
+
clearProxyData() {}
|
|
8545
8572
|
find(_condition, _options) {
|
|
8546
8573
|
return Plugin.need("find");
|
|
8547
8574
|
}
|
|
@@ -8582,7 +8609,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8582
8609
|
__updateRenderPath(updateCache) {
|
|
8583
8610
|
const data = this.__;
|
|
8584
8611
|
if (data.path) {
|
|
8585
|
-
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8612
|
+
data.__pathForRender = data.cornerRadius || data.path.radius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
8586
8613
|
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8587
8614
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8588
8615
|
}
|
|
@@ -9415,7 +9442,7 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9415
9442
|
}
|
|
9416
9443
|
}
|
|
9417
9444
|
if (!open) closePath$2(path);
|
|
9418
|
-
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9445
|
+
if (Platform.ellipseToCurve || data.__useArrow || data.cornerRadius) data.path = this.getPath(true);
|
|
9419
9446
|
}
|
|
9420
9447
|
};
|
|
9421
9448
|
|
|
@@ -9441,7 +9468,7 @@ let Polygon = class Polygon extends UI {
|
|
|
9441
9468
|
const data = this.__;
|
|
9442
9469
|
const path = data.path = [];
|
|
9443
9470
|
if (data.points) {
|
|
9444
|
-
drawPoints$1(path, data.points, data.curve,
|
|
9471
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9445
9472
|
} else {
|
|
9446
9473
|
const {width: width, height: height, sides: sides} = data;
|
|
9447
9474
|
const rx = width / 2, ry = height / 2;
|
|
@@ -11809,17 +11836,19 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
11809
11836
|
}
|
|
11810
11837
|
|
|
11811
11838
|
function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds) {
|
|
11839
|
+
let needUpdate = true;
|
|
11812
11840
|
const data = ui.__;
|
|
11813
11841
|
if (attrName === "fill" && !data.__naturalWidth) {
|
|
11814
11842
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
11815
11843
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
11816
11844
|
if (data.__autoSide) {
|
|
11817
11845
|
ui.forceUpdate("width");
|
|
11846
|
+
LeafHelper.updateBounds(ui);
|
|
11818
11847
|
if (ui.__proxyData) {
|
|
11819
11848
|
ui.setProxyAttr("width", data.width);
|
|
11820
11849
|
ui.setProxyAttr("height", data.height);
|
|
11821
11850
|
}
|
|
11822
|
-
|
|
11851
|
+
needUpdate = false;
|
|
11823
11852
|
}
|
|
11824
11853
|
}
|
|
11825
11854
|
if (!leafPaint.data) {
|
|
@@ -11829,7 +11858,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
11829
11858
|
if (clip || opacity && opacity < 1 || blendMode) leafPaint.complex = clip ? 2 : true;
|
|
11830
11859
|
}
|
|
11831
11860
|
if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui);
|
|
11832
|
-
return
|
|
11861
|
+
return needUpdate;
|
|
11833
11862
|
}
|
|
11834
11863
|
|
|
11835
11864
|
function onLoad(ui, event) {
|
|
@@ -12279,10 +12308,10 @@ const realFrom = {};
|
|
|
12279
12308
|
const realTo = {};
|
|
12280
12309
|
|
|
12281
12310
|
function conicGradient(paint, box) {
|
|
12282
|
-
let {from: from, to: to, type: type, opacity: opacity, stretch: stretch} = paint;
|
|
12311
|
+
let {from: from, to: to, type: type, opacity: opacity, rotation: rotation, stretch: stretch} = paint;
|
|
12283
12312
|
toPoint$1(from || "center", box, realFrom);
|
|
12284
12313
|
toPoint$1(to || "bottom", box, realTo);
|
|
12285
|
-
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));
|
|
12314
|
+
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));
|
|
12286
12315
|
const data = {
|
|
12287
12316
|
type: type,
|
|
12288
12317
|
style: style
|
|
@@ -13127,11 +13156,7 @@ function targetAttr(fn) {
|
|
|
13127
13156
|
});
|
|
13128
13157
|
if (isObject(check)) value = check; else if (check === false) return;
|
|
13129
13158
|
}
|
|
13130
|
-
if (t.hasDimOthers)
|
|
13131
|
-
t.setDimOthers(false);
|
|
13132
|
-
t.setBright(false);
|
|
13133
|
-
t.hasDimOthers = undefined;
|
|
13134
|
-
}
|
|
13159
|
+
if (t.hasDimOthers) t.cancelDimOthers();
|
|
13135
13160
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
13136
13161
|
if (t.single) {
|
|
13137
13162
|
delete t.element.syncEventer;
|
|
@@ -14064,6 +14089,8 @@ class EditBox extends Group {
|
|
|
14064
14089
|
editor.setDimOthers(dimOthers);
|
|
14065
14090
|
editor.setBright(!!dimOthers || bright);
|
|
14066
14091
|
editor.hasDimOthers = true;
|
|
14092
|
+
} else if (editor.hasDimOthers) {
|
|
14093
|
+
editor.cancelDimOthers();
|
|
14067
14094
|
}
|
|
14068
14095
|
if (spread) BoundsHelper.spread(bounds, spread);
|
|
14069
14096
|
if (this.view.worldOpacity) {
|
|
@@ -15103,6 +15130,11 @@ let Editor = class Editor extends Group {
|
|
|
15103
15130
|
setBright(value) {
|
|
15104
15131
|
this.setDimOthers(value, "bright", this.list);
|
|
15105
15132
|
}
|
|
15133
|
+
cancelDimOthers() {
|
|
15134
|
+
this.setDimOthers(false);
|
|
15135
|
+
this.setBright(false);
|
|
15136
|
+
this.hasDimOthers = undefined;
|
|
15137
|
+
}
|
|
15106
15138
|
update() {
|
|
15107
15139
|
if (this.editing) {
|
|
15108
15140
|
if (!this.element.parent) return this.cancel();
|
|
@@ -15566,7 +15598,7 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
15566
15598
|
|
|
15567
15599
|
LineEditTool = __decorate([ registerEditTool() ], LineEditTool);
|
|
15568
15600
|
|
|
15569
|
-
const {M: M$
|
|
15601
|
+
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;
|
|
15570
15602
|
|
|
15571
15603
|
const PathScaler = {
|
|
15572
15604
|
scale(data, scaleX, scaleY) {
|
|
@@ -15576,13 +15608,13 @@ const PathScaler = {
|
|
|
15576
15608
|
while (i < len) {
|
|
15577
15609
|
command = data[i];
|
|
15578
15610
|
switch (command) {
|
|
15579
|
-
case M$
|
|
15580
|
-
case L$
|
|
15611
|
+
case M$5:
|
|
15612
|
+
case L$4:
|
|
15581
15613
|
scalePoints(data, scaleX, scaleY, i, 1);
|
|
15582
15614
|
i += 3;
|
|
15583
15615
|
break;
|
|
15584
15616
|
|
|
15585
|
-
case C$
|
|
15617
|
+
case C$4:
|
|
15586
15618
|
scalePoints(data, scaleX, scaleY, i, 3);
|
|
15587
15619
|
i += 7;
|
|
15588
15620
|
break;
|
|
@@ -15592,7 +15624,7 @@ const PathScaler = {
|
|
|
15592
15624
|
i += 5;
|
|
15593
15625
|
break;
|
|
15594
15626
|
|
|
15595
|
-
case Z$
|
|
15627
|
+
case Z$3:
|
|
15596
15628
|
i += 1;
|
|
15597
15629
|
break;
|
|
15598
15630
|
|
|
@@ -16229,13 +16261,13 @@ const MultiTouchHelper = {
|
|
|
16229
16261
|
return "rotate";
|
|
16230
16262
|
},
|
|
16231
16263
|
detect(data, config) {
|
|
16232
|
-
const {state: state} = M$
|
|
16233
|
-
const type = M$
|
|
16264
|
+
const {state: state} = M$4;
|
|
16265
|
+
const type = M$4.getType(data, config);
|
|
16234
16266
|
if (!state.totalData) {
|
|
16235
16267
|
state.startTime = Date.now();
|
|
16236
16268
|
state.center = data.center;
|
|
16237
16269
|
}
|
|
16238
|
-
M$
|
|
16270
|
+
M$4.add(data, state.totalData);
|
|
16239
16271
|
state.totalData = data;
|
|
16240
16272
|
if (type === state.type) {
|
|
16241
16273
|
state.typeCount++;
|
|
@@ -16244,7 +16276,7 @@ const MultiTouchHelper = {
|
|
|
16244
16276
|
state.type = type;
|
|
16245
16277
|
state.typeCount = 1;
|
|
16246
16278
|
}
|
|
16247
|
-
if (Date.now() - state.startTime >= (config.time || 160)) return M$
|
|
16279
|
+
if (Date.now() - state.startTime >= (config.time || 160)) return M$4.getType(state.totalData, config);
|
|
16248
16280
|
return "none";
|
|
16249
16281
|
},
|
|
16250
16282
|
add(data, add) {
|
|
@@ -16255,7 +16287,7 @@ const MultiTouchHelper = {
|
|
|
16255
16287
|
data.center = add.center;
|
|
16256
16288
|
},
|
|
16257
16289
|
reset() {
|
|
16258
|
-
const {state: state} = M$
|
|
16290
|
+
const {state: state} = M$4;
|
|
16259
16291
|
state.type = "none";
|
|
16260
16292
|
state.typeCount = 0;
|
|
16261
16293
|
state.startTime = 0;
|
|
@@ -16263,7 +16295,7 @@ const MultiTouchHelper = {
|
|
|
16263
16295
|
}
|
|
16264
16296
|
};
|
|
16265
16297
|
|
|
16266
|
-
const M$
|
|
16298
|
+
const M$4 = MultiTouchHelper;
|
|
16267
16299
|
|
|
16268
16300
|
const {abs: abs$2, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
16269
16301
|
|
|
@@ -17044,7 +17076,7 @@ __decorate([ arrowType("angle") ], Arrow.prototype, "endArrow", void 0);
|
|
|
17044
17076
|
|
|
17045
17077
|
Arrow = __decorate([ registerUI() ], Arrow);
|
|
17046
17078
|
|
|
17047
|
-
const {M: M$
|
|
17079
|
+
const {M: M$3, L: L$3, C: C$3, Q: Q$1, O: O$1} = PathCommandMap;
|
|
17048
17080
|
|
|
17049
17081
|
const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
|
|
17050
17082
|
|
|
@@ -17056,13 +17088,13 @@ const PathMatrixHelper = {
|
|
|
17056
17088
|
while (i < len) {
|
|
17057
17089
|
command = data[i];
|
|
17058
17090
|
switch (command) {
|
|
17059
|
-
case M$
|
|
17060
|
-
case L$
|
|
17091
|
+
case M$3:
|
|
17092
|
+
case L$3:
|
|
17061
17093
|
setPoint$2(data, i + 1, x, y, scaleX, scaleY, rotation, origin);
|
|
17062
17094
|
i += 3;
|
|
17063
17095
|
break;
|
|
17064
17096
|
|
|
17065
|
-
case C$
|
|
17097
|
+
case C$3:
|
|
17066
17098
|
for (j = 1; j < 6; j += 2) setPoint$2(data, i + j, x, y, scaleX, scaleY, rotation, origin);
|
|
17067
17099
|
i += 7;
|
|
17068
17100
|
break;
|
|
@@ -17302,7 +17334,7 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
|
|
|
17302
17334
|
return arrowData;
|
|
17303
17335
|
}
|
|
17304
17336
|
|
|
17305
|
-
const {M: M$
|
|
17337
|
+
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;
|
|
17306
17338
|
|
|
17307
17339
|
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
17308
17340
|
|
|
@@ -17327,8 +17359,8 @@ const PathArrowModule = {
|
|
|
17327
17359
|
while (i < len) {
|
|
17328
17360
|
command = data[i];
|
|
17329
17361
|
switch (command) {
|
|
17330
|
-
case M$
|
|
17331
|
-
case L$
|
|
17362
|
+
case M$2:
|
|
17363
|
+
case L$2:
|
|
17332
17364
|
if (count < 2 || i + 6 >= len) {
|
|
17333
17365
|
copy(old, now);
|
|
17334
17366
|
copyFrom(now, data[i + 1], data[i + 2]);
|
|
@@ -17337,7 +17369,7 @@ const PathArrowModule = {
|
|
|
17337
17369
|
i += 3;
|
|
17338
17370
|
break;
|
|
17339
17371
|
|
|
17340
|
-
case C$
|
|
17372
|
+
case C$2:
|
|
17341
17373
|
if (count === 1 || i + 7 >= len - 3) {
|
|
17342
17374
|
copyPoints(data, last, now, i + 3);
|
|
17343
17375
|
old.x = data[i + 1], old.y = data[i + 2];
|
|
@@ -17353,7 +17385,7 @@ const PathArrowModule = {
|
|
|
17353
17385
|
i += 5;
|
|
17354
17386
|
break;
|
|
17355
17387
|
|
|
17356
|
-
case Z$
|
|
17388
|
+
case Z$2:
|
|
17357
17389
|
return;
|
|
17358
17390
|
|
|
17359
17391
|
case N:
|
|
@@ -17397,8 +17429,8 @@ const PathArrowModule = {
|
|
|
17397
17429
|
break;
|
|
17398
17430
|
}
|
|
17399
17431
|
count++;
|
|
17400
|
-
if (count === 1 && command !== M$
|
|
17401
|
-
if (count === 2 && useStartArrow) copy(second, command === L$
|
|
17432
|
+
if (count === 1 && command !== M$2) return;
|
|
17433
|
+
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame(old, first) ? last : old);
|
|
17402
17434
|
if (i === len) {
|
|
17403
17435
|
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
17404
17436
|
if (useStartArrow) {
|
|
@@ -17420,11 +17452,11 @@ const PathArrowModule = {
|
|
|
17420
17452
|
getDistancePoint(now, last, -connectPoint.x, true);
|
|
17421
17453
|
let index;
|
|
17422
17454
|
switch (command) {
|
|
17423
|
-
case L$
|
|
17455
|
+
case L$2:
|
|
17424
17456
|
index = i - 3 + 1;
|
|
17425
17457
|
break;
|
|
17426
17458
|
|
|
17427
|
-
case C$
|
|
17459
|
+
case C$2:
|
|
17428
17460
|
index = i - 7 + 5;
|
|
17429
17461
|
break;
|
|
17430
17462
|
|
|
@@ -19166,7 +19198,7 @@ const HighBezierHelper = {
|
|
|
19166
19198
|
|
|
19167
19199
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
19168
19200
|
|
|
19169
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float$1} = MathHelper;
|
|
19201
|
+
const {M: M$1, L: L$1, C: C$1, Z: Z$1} = PathCommandMap, {float: float$1} = MathHelper;
|
|
19170
19202
|
|
|
19171
19203
|
const tempPoint = {}, tempFrom = {};
|
|
19172
19204
|
|
|
@@ -19177,18 +19209,18 @@ const HighCurveHelper = {
|
|
|
19177
19209
|
while (i < len) {
|
|
19178
19210
|
command = data[i];
|
|
19179
19211
|
switch (command) {
|
|
19180
|
-
case M:
|
|
19181
|
-
case L:
|
|
19212
|
+
case M$1:
|
|
19213
|
+
case L$1:
|
|
19182
19214
|
HighCurveHelper.transformPoints(data, matrix, i, 1);
|
|
19183
19215
|
i += 3;
|
|
19184
19216
|
break;
|
|
19185
19217
|
|
|
19186
|
-
case C:
|
|
19218
|
+
case C$1:
|
|
19187
19219
|
HighCurveHelper.transformPoints(data, matrix, i, 3);
|
|
19188
19220
|
i += 7;
|
|
19189
19221
|
break;
|
|
19190
19222
|
|
|
19191
|
-
case Z:
|
|
19223
|
+
case Z$1:
|
|
19192
19224
|
i += 1;
|
|
19193
19225
|
}
|
|
19194
19226
|
}
|
|
@@ -19209,17 +19241,17 @@ const HighCurveHelper = {
|
|
|
19209
19241
|
while (i < len) {
|
|
19210
19242
|
command = data[i];
|
|
19211
19243
|
switch (command) {
|
|
19212
|
-
case M:
|
|
19213
|
-
case L:
|
|
19244
|
+
case M$1:
|
|
19245
|
+
case L$1:
|
|
19214
19246
|
toX = data[i + 1];
|
|
19215
19247
|
toY = data[i + 2];
|
|
19216
|
-
distance = command === L && i > 0 ? PointHelper.getDistanceFrom(x, y, toX, toY) : 0;
|
|
19248
|
+
distance = command === L$1 && i > 0 ? PointHelper.getDistanceFrom(x, y, toX, toY) : 0;
|
|
19217
19249
|
x = toX;
|
|
19218
19250
|
y = toY;
|
|
19219
19251
|
i += 3;
|
|
19220
19252
|
break;
|
|
19221
19253
|
|
|
19222
|
-
case C:
|
|
19254
|
+
case C$1:
|
|
19223
19255
|
toX = data[i + 5];
|
|
19224
19256
|
toY = data[i + 6];
|
|
19225
19257
|
distance = HighBezierHelper.getDistance(x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], toX, toY);
|
|
@@ -19228,7 +19260,7 @@ const HighCurveHelper = {
|
|
|
19228
19260
|
i += 7;
|
|
19229
19261
|
break;
|
|
19230
19262
|
|
|
19231
|
-
case Z:
|
|
19263
|
+
case Z$1:
|
|
19232
19264
|
i += 1;
|
|
19233
19265
|
|
|
19234
19266
|
default:
|
|
@@ -19253,8 +19285,8 @@ const HighCurveHelper = {
|
|
|
19253
19285
|
while (i < len) {
|
|
19254
19286
|
command = data[i];
|
|
19255
19287
|
switch (command) {
|
|
19256
|
-
case M:
|
|
19257
|
-
case L:
|
|
19288
|
+
case M$1:
|
|
19289
|
+
case L$1:
|
|
19258
19290
|
toX = data[i + 1];
|
|
19259
19291
|
toY = data[i + 2];
|
|
19260
19292
|
distance = segments[index];
|
|
@@ -19273,7 +19305,7 @@ const HighCurveHelper = {
|
|
|
19273
19305
|
i += 3;
|
|
19274
19306
|
break;
|
|
19275
19307
|
|
|
19276
|
-
case C:
|
|
19308
|
+
case C$1:
|
|
19277
19309
|
toX = data[i + 5];
|
|
19278
19310
|
toY = data[i + 6];
|
|
19279
19311
|
distance = segments[index];
|
|
@@ -19289,7 +19321,7 @@ const HighCurveHelper = {
|
|
|
19289
19321
|
i += 7;
|
|
19290
19322
|
break;
|
|
19291
19323
|
|
|
19292
|
-
case Z:
|
|
19324
|
+
case Z$1:
|
|
19293
19325
|
i += 1;
|
|
19294
19326
|
|
|
19295
19327
|
default:
|
|
@@ -19310,8 +19342,8 @@ const HighCurveHelper = {
|
|
|
19310
19342
|
while (i < len) {
|
|
19311
19343
|
command = data[i];
|
|
19312
19344
|
switch (command) {
|
|
19313
|
-
case M:
|
|
19314
|
-
case L:
|
|
19345
|
+
case M$1:
|
|
19346
|
+
case L$1:
|
|
19315
19347
|
toX = data[i + 1];
|
|
19316
19348
|
toY = data[i + 2];
|
|
19317
19349
|
distance = segments[index];
|
|
@@ -19334,7 +19366,7 @@ const HighCurveHelper = {
|
|
|
19334
19366
|
path.push(command, x, y);
|
|
19335
19367
|
break;
|
|
19336
19368
|
|
|
19337
|
-
case C:
|
|
19369
|
+
case C$1:
|
|
19338
19370
|
x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
|
|
19339
19371
|
toX = data[i + 5];
|
|
19340
19372
|
toY = data[i + 6];
|
|
@@ -19353,7 +19385,7 @@ const HighCurveHelper = {
|
|
|
19353
19385
|
path.push(command, x1, y1, x2, y2, toX, toY);
|
|
19354
19386
|
break;
|
|
19355
19387
|
|
|
19356
|
-
case Z:
|
|
19388
|
+
case Z$1:
|
|
19357
19389
|
i += 1;
|
|
19358
19390
|
path.push(command);
|
|
19359
19391
|
|
|
@@ -20874,4 +20906,265 @@ ImageBox = __decorate([ registerUI() ], ImageBox);
|
|
|
20874
20906
|
|
|
20875
20907
|
Plugin.add("box");
|
|
20876
20908
|
|
|
20909
|
+
function getTangentDistance(r, x, y, lastX, lastY, nextX, nextY) {
|
|
20910
|
+
const ux = lastX - x, uy = lastY - y;
|
|
20911
|
+
const vx = nextX - x, vy = nextY - y;
|
|
20912
|
+
const lenU = Math.sqrt(ux * ux + uy * uy);
|
|
20913
|
+
const lenV = Math.sqrt(vx * vx + vy * vy);
|
|
20914
|
+
if (lenU < .001 || lenV < .001) return 0;
|
|
20915
|
+
const cosTheta = (ux * vx + uy * vy) / (lenU * lenV);
|
|
20916
|
+
const safeCos = Math.max(-.99999, Math.min(.99999, cosTheta));
|
|
20917
|
+
let d = r * Math.sqrt((1 - safeCos) / (1 + safeCos));
|
|
20918
|
+
const maxD = Math.min(lenU / 2, lenV / 2);
|
|
20919
|
+
return Math.min(d, maxD);
|
|
20920
|
+
}
|
|
20921
|
+
|
|
20922
|
+
function getCorrectT(d, x, y, x1, y1, x2, y2, toX, toY) {
|
|
20923
|
+
if (d <= 0) return 0;
|
|
20924
|
+
const chordLen = Math.sqrt(Math.pow(toX - x, 2) + Math.pow(toY - y, 2));
|
|
20925
|
+
if (d >= chordLen) return .5;
|
|
20926
|
+
const vx0 = 3 * (x1 - x);
|
|
20927
|
+
const vy0 = 3 * (y1 - y);
|
|
20928
|
+
let v0mag = Math.sqrt(vx0 * vx0 + vy0 * vy0);
|
|
20929
|
+
if (v0mag < 1e-6) v0mag = chordLen || 1;
|
|
20930
|
+
let t = Math.min(.5, d / v0mag);
|
|
20931
|
+
const tempP = {
|
|
20932
|
+
x: 0,
|
|
20933
|
+
y: 0
|
|
20934
|
+
};
|
|
20935
|
+
for (let i = 0; i < 5; i++) {
|
|
20936
|
+
BezierHelper.getPointAndSet(t, x, y, x1, y1, x2, y2, toX, toY, tempP);
|
|
20937
|
+
const dx = tempP.x - x;
|
|
20938
|
+
const dy = tempP.y - y;
|
|
20939
|
+
const currentDist = Math.sqrt(dx * dx + dy * dy);
|
|
20940
|
+
if (currentDist < 1e-6) {
|
|
20941
|
+
t = t * 1.5;
|
|
20942
|
+
continue;
|
|
20943
|
+
}
|
|
20944
|
+
const vxt = BezierHelper.getDerivative(t, x, x1, x2, toX);
|
|
20945
|
+
const vyt = BezierHelper.getDerivative(t, y, y1, y2, toY);
|
|
20946
|
+
const f_prime = (dx * vxt + dy * vyt) / currentDist;
|
|
20947
|
+
if (Math.abs(f_prime) < 1e-6) break;
|
|
20948
|
+
const deltaT = (currentDist - d) / f_prime;
|
|
20949
|
+
const nextT = t - deltaT;
|
|
20950
|
+
const safeNextT = Math.max(0, Math.min(.6, nextT));
|
|
20951
|
+
if (Math.abs(safeNextT - t) < 1e-5) {
|
|
20952
|
+
t = safeNextT;
|
|
20953
|
+
break;
|
|
20954
|
+
}
|
|
20955
|
+
t = safeNextT;
|
|
20956
|
+
}
|
|
20957
|
+
return Math.max(0, Math.min(.5, t));
|
|
20958
|
+
}
|
|
20959
|
+
|
|
20960
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
|
|
20961
|
+
|
|
20962
|
+
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
20963
|
+
|
|
20964
|
+
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
20965
|
+
|
|
20966
|
+
PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
20967
|
+
const radius = data.radius;
|
|
20968
|
+
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true);
|
|
20969
|
+
let command, lastCommand, commandLen;
|
|
20970
|
+
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;
|
|
20971
|
+
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
20972
|
+
const len = data.length, three = len === 9;
|
|
20973
|
+
const smooth = [];
|
|
20974
|
+
while (i < len) {
|
|
20975
|
+
command = data[i];
|
|
20976
|
+
r = radius ? isUndefined(radius[countCommand]) ? cornerRadius : radius[countCommand] : cornerRadius;
|
|
20977
|
+
switch (command) {
|
|
20978
|
+
case M:
|
|
20979
|
+
startX = lastX = data[i + 1];
|
|
20980
|
+
startY = lastY = data[i + 2];
|
|
20981
|
+
startR = r;
|
|
20982
|
+
i += 3;
|
|
20983
|
+
const end = findEndPoint(data, i);
|
|
20984
|
+
switch (data[i]) {
|
|
20985
|
+
case L:
|
|
20986
|
+
secondX = data[i + 1];
|
|
20987
|
+
secondY = data[i + 2];
|
|
20988
|
+
if (three) smooth.push(M, startX, startY); else {
|
|
20989
|
+
if (end) smooth.push(M, getCenterX(startX, secondX), getCenterY(startY, secondY)); else smooth.push(M, startX, startY);
|
|
20990
|
+
}
|
|
20991
|
+
break;
|
|
20992
|
+
|
|
20993
|
+
case C:
|
|
20994
|
+
if (end) {
|
|
20995
|
+
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]);
|
|
20996
|
+
if (left && right) {
|
|
20997
|
+
smooth.push(M, secondX = left[4], secondY = left[5]);
|
|
20998
|
+
break;
|
|
20999
|
+
}
|
|
21000
|
+
}
|
|
21001
|
+
|
|
21002
|
+
default:
|
|
21003
|
+
smooth.push(M, secondX = startX, secondY = startY);
|
|
21004
|
+
}
|
|
21005
|
+
break;
|
|
21006
|
+
|
|
21007
|
+
case L:
|
|
21008
|
+
x = data[i + 1];
|
|
21009
|
+
y = data[i + 2];
|
|
21010
|
+
i += 3;
|
|
21011
|
+
switch (data[i]) {
|
|
21012
|
+
case L:
|
|
21013
|
+
arcTo(smooth, x, y, data[i + 1], data[i + 2], r, lastX, lastY, three);
|
|
21014
|
+
break;
|
|
21015
|
+
|
|
21016
|
+
case C:
|
|
21017
|
+
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]);
|
|
21018
|
+
if (left && right) arcTo(smooth, x, y, left[4], left[5], r, lastX, lastY, three); else smooth.push(L, x, y);
|
|
21019
|
+
break;
|
|
21020
|
+
|
|
21021
|
+
case Z:
|
|
21022
|
+
arcTo(smooth, x, y, startX, startY, r, lastX, lastY, three);
|
|
21023
|
+
break;
|
|
21024
|
+
|
|
21025
|
+
default:
|
|
21026
|
+
smooth.push(L, x, y);
|
|
21027
|
+
}
|
|
21028
|
+
lastX = x;
|
|
21029
|
+
lastY = y;
|
|
21030
|
+
break;
|
|
21031
|
+
|
|
21032
|
+
case C:
|
|
21033
|
+
x1 = data[i + 1];
|
|
21034
|
+
y1 = data[i + 2];
|
|
21035
|
+
x2 = data[i + 3];
|
|
21036
|
+
y2 = data[i + 4];
|
|
21037
|
+
x = data[i + 5];
|
|
21038
|
+
y = data[i + 6];
|
|
21039
|
+
i += 7;
|
|
21040
|
+
switch (data[i]) {
|
|
21041
|
+
case L:
|
|
21042
|
+
toX = data[i + 1], toY = data[i + 2];
|
|
21043
|
+
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
21044
|
+
break;
|
|
21045
|
+
|
|
21046
|
+
case C:
|
|
21047
|
+
smooth.push(C, x1, y1, x2, y2, x, y);
|
|
21048
|
+
break;
|
|
21049
|
+
|
|
21050
|
+
case Z:
|
|
21051
|
+
toX = startX, toY = startY;
|
|
21052
|
+
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
21053
|
+
break;
|
|
21054
|
+
}
|
|
21055
|
+
lastX = x;
|
|
21056
|
+
lastY = y;
|
|
21057
|
+
break;
|
|
21058
|
+
|
|
21059
|
+
case Z:
|
|
21060
|
+
if (lastCommand !== Z) {
|
|
21061
|
+
arcTo(smooth, startX, startY, secondX, secondY, startR, lastX, lastY, three);
|
|
21062
|
+
smooth.push(Z);
|
|
21063
|
+
}
|
|
21064
|
+
i += 1;
|
|
21065
|
+
break;
|
|
21066
|
+
|
|
21067
|
+
default:
|
|
21068
|
+
commandLen = PathNumberCommandLengthMap[command];
|
|
21069
|
+
for (let j = 0; j < commandLen; j++) smooth.push(data[i + j]);
|
|
21070
|
+
i += commandLen;
|
|
21071
|
+
}
|
|
21072
|
+
lastCommand = command;
|
|
21073
|
+
countCommand++;
|
|
21074
|
+
}
|
|
21075
|
+
return smooth;
|
|
21076
|
+
};
|
|
21077
|
+
|
|
21078
|
+
function isNeedConvert(data) {
|
|
21079
|
+
let command, i = 0;
|
|
21080
|
+
const len = data.length;
|
|
21081
|
+
while (i < len) {
|
|
21082
|
+
command = data[i];
|
|
21083
|
+
switch (command) {
|
|
21084
|
+
case M:
|
|
21085
|
+
i += 3;
|
|
21086
|
+
break;
|
|
21087
|
+
|
|
21088
|
+
case L:
|
|
21089
|
+
i += 3;
|
|
21090
|
+
break;
|
|
21091
|
+
|
|
21092
|
+
case C:
|
|
21093
|
+
i += 7;
|
|
21094
|
+
break;
|
|
21095
|
+
|
|
21096
|
+
case Z:
|
|
21097
|
+
i += 1;
|
|
21098
|
+
break;
|
|
21099
|
+
|
|
21100
|
+
default:
|
|
21101
|
+
return true;
|
|
21102
|
+
}
|
|
21103
|
+
}
|
|
21104
|
+
return false;
|
|
21105
|
+
}
|
|
21106
|
+
|
|
21107
|
+
function findEndPoint(data, i) {
|
|
21108
|
+
let command, commandLen, x, y;
|
|
21109
|
+
const len = data.length;
|
|
21110
|
+
while (i < len) {
|
|
21111
|
+
command = data[i];
|
|
21112
|
+
switch (command) {
|
|
21113
|
+
case M:
|
|
21114
|
+
return undefined;
|
|
21115
|
+
|
|
21116
|
+
case L:
|
|
21117
|
+
x = data[i + 1];
|
|
21118
|
+
y = data[i + 2];
|
|
21119
|
+
i += 3;
|
|
21120
|
+
break;
|
|
21121
|
+
|
|
21122
|
+
case C:
|
|
21123
|
+
x = data[i + 5];
|
|
21124
|
+
y = data[i + 6];
|
|
21125
|
+
i += 7;
|
|
21126
|
+
break;
|
|
21127
|
+
|
|
21128
|
+
case Z:
|
|
21129
|
+
return {
|
|
21130
|
+
x: x,
|
|
21131
|
+
y: y
|
|
21132
|
+
};
|
|
21133
|
+
|
|
21134
|
+
default:
|
|
21135
|
+
commandLen = PathNumberCommandLengthMap[command];
|
|
21136
|
+
i += commandLen;
|
|
21137
|
+
}
|
|
21138
|
+
}
|
|
21139
|
+
return undefined;
|
|
21140
|
+
}
|
|
21141
|
+
|
|
21142
|
+
function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
21143
|
+
const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, x1, y1);
|
|
21144
|
+
const t = getCorrectT(d, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21145
|
+
const two = BezierHelper.cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21146
|
+
const {left: left, right: right} = two;
|
|
21147
|
+
if (left && right) {
|
|
21148
|
+
data[i + 1] = right[0];
|
|
21149
|
+
data[i + 2] = right[1];
|
|
21150
|
+
data[i + 3] = right[2];
|
|
21151
|
+
data[i + 4] = right[3];
|
|
21152
|
+
}
|
|
21153
|
+
return two;
|
|
21154
|
+
}
|
|
21155
|
+
|
|
21156
|
+
function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY, nextX, nextY, three) {
|
|
21157
|
+
const d = getTangentDistance(cornerRadius, toX, toY, x2, y2, nextX, nextY);
|
|
21158
|
+
const t = getCorrectT(d, toX, toY, x2, y2, x1, y1, fromX, fromY);
|
|
21159
|
+
const {left: left, right: right} = BezierHelper.cut(1 - t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21160
|
+
if (left && right) {
|
|
21161
|
+
smooth.push(C, left[0], left[1], left[2], left[3], left[4], left[5]);
|
|
21162
|
+
arcTo(smooth, toX, toY, nextX, nextY, cornerRadius, left[4], left[5], three);
|
|
21163
|
+
} else {
|
|
21164
|
+
smooth.push(C, x1, y1, x2, y2, toX, toY);
|
|
21165
|
+
}
|
|
21166
|
+
}
|
|
21167
|
+
|
|
21168
|
+
Plugin.add("corner");
|
|
21169
|
+
|
|
20877
21170
|
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, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, 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, TextEditor, 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 };
|