@leafer/worker 2.0.6 → 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 +436 -160
- 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 +447 -160
- 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() {
|
|
@@ -8583,7 +8609,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8583
8609
|
__updateRenderPath(updateCache) {
|
|
8584
8610
|
const data = this.__;
|
|
8585
8611
|
if (data.path) {
|
|
8586
|
-
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;
|
|
8587
8613
|
if (data.__useArrow) PathArrow.addArrows(this, updateCache);
|
|
8588
8614
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
8589
8615
|
}
|
|
@@ -9416,7 +9442,7 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9416
9442
|
}
|
|
9417
9443
|
}
|
|
9418
9444
|
if (!open) closePath$2(path);
|
|
9419
|
-
if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
|
|
9445
|
+
if (Platform.ellipseToCurve || data.__useArrow || data.cornerRadius) data.path = this.getPath(true);
|
|
9420
9446
|
}
|
|
9421
9447
|
};
|
|
9422
9448
|
|
|
@@ -9442,7 +9468,7 @@ let Polygon = class Polygon extends UI {
|
|
|
9442
9468
|
const data = this.__;
|
|
9443
9469
|
const path = data.path = [];
|
|
9444
9470
|
if (data.points) {
|
|
9445
|
-
drawPoints$1(path, data.points, data.curve,
|
|
9471
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9446
9472
|
} else {
|
|
9447
9473
|
const {width: width, height: height, sides: sides} = data;
|
|
9448
9474
|
const rx = width / 2, ry = height / 2;
|
|
@@ -15572,7 +15598,7 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
15572
15598
|
|
|
15573
15599
|
LineEditTool = __decorate([ registerEditTool() ], LineEditTool);
|
|
15574
15600
|
|
|
15575
|
-
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;
|
|
15576
15602
|
|
|
15577
15603
|
const PathScaler = {
|
|
15578
15604
|
scale(data, scaleX, scaleY) {
|
|
@@ -15582,13 +15608,13 @@ const PathScaler = {
|
|
|
15582
15608
|
while (i < len) {
|
|
15583
15609
|
command = data[i];
|
|
15584
15610
|
switch (command) {
|
|
15585
|
-
case M$
|
|
15586
|
-
case L$
|
|
15611
|
+
case M$5:
|
|
15612
|
+
case L$4:
|
|
15587
15613
|
scalePoints(data, scaleX, scaleY, i, 1);
|
|
15588
15614
|
i += 3;
|
|
15589
15615
|
break;
|
|
15590
15616
|
|
|
15591
|
-
case C$
|
|
15617
|
+
case C$4:
|
|
15592
15618
|
scalePoints(data, scaleX, scaleY, i, 3);
|
|
15593
15619
|
i += 7;
|
|
15594
15620
|
break;
|
|
@@ -15598,7 +15624,7 @@ const PathScaler = {
|
|
|
15598
15624
|
i += 5;
|
|
15599
15625
|
break;
|
|
15600
15626
|
|
|
15601
|
-
case Z$
|
|
15627
|
+
case Z$3:
|
|
15602
15628
|
i += 1;
|
|
15603
15629
|
break;
|
|
15604
15630
|
|
|
@@ -16235,13 +16261,13 @@ const MultiTouchHelper = {
|
|
|
16235
16261
|
return "rotate";
|
|
16236
16262
|
},
|
|
16237
16263
|
detect(data, config) {
|
|
16238
|
-
const {state: state} = M$
|
|
16239
|
-
const type = M$
|
|
16264
|
+
const {state: state} = M$4;
|
|
16265
|
+
const type = M$4.getType(data, config);
|
|
16240
16266
|
if (!state.totalData) {
|
|
16241
16267
|
state.startTime = Date.now();
|
|
16242
16268
|
state.center = data.center;
|
|
16243
16269
|
}
|
|
16244
|
-
M$
|
|
16270
|
+
M$4.add(data, state.totalData);
|
|
16245
16271
|
state.totalData = data;
|
|
16246
16272
|
if (type === state.type) {
|
|
16247
16273
|
state.typeCount++;
|
|
@@ -16250,7 +16276,7 @@ const MultiTouchHelper = {
|
|
|
16250
16276
|
state.type = type;
|
|
16251
16277
|
state.typeCount = 1;
|
|
16252
16278
|
}
|
|
16253
|
-
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);
|
|
16254
16280
|
return "none";
|
|
16255
16281
|
},
|
|
16256
16282
|
add(data, add) {
|
|
@@ -16261,7 +16287,7 @@ const MultiTouchHelper = {
|
|
|
16261
16287
|
data.center = add.center;
|
|
16262
16288
|
},
|
|
16263
16289
|
reset() {
|
|
16264
|
-
const {state: state} = M$
|
|
16290
|
+
const {state: state} = M$4;
|
|
16265
16291
|
state.type = "none";
|
|
16266
16292
|
state.typeCount = 0;
|
|
16267
16293
|
state.startTime = 0;
|
|
@@ -16269,7 +16295,7 @@ const MultiTouchHelper = {
|
|
|
16269
16295
|
}
|
|
16270
16296
|
};
|
|
16271
16297
|
|
|
16272
|
-
const M$
|
|
16298
|
+
const M$4 = MultiTouchHelper;
|
|
16273
16299
|
|
|
16274
16300
|
const {abs: abs$2, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
16275
16301
|
|
|
@@ -17050,7 +17076,7 @@ __decorate([ arrowType("angle") ], Arrow.prototype, "endArrow", void 0);
|
|
|
17050
17076
|
|
|
17051
17077
|
Arrow = __decorate([ registerUI() ], Arrow);
|
|
17052
17078
|
|
|
17053
|
-
const {M: M$
|
|
17079
|
+
const {M: M$3, L: L$3, C: C$3, Q: Q$1, O: O$1} = PathCommandMap;
|
|
17054
17080
|
|
|
17055
17081
|
const {rotate: rotate$1, copyFrom: copyFrom$1, scale: scale$1} = PointHelper;
|
|
17056
17082
|
|
|
@@ -17062,13 +17088,13 @@ const PathMatrixHelper = {
|
|
|
17062
17088
|
while (i < len) {
|
|
17063
17089
|
command = data[i];
|
|
17064
17090
|
switch (command) {
|
|
17065
|
-
case M$
|
|
17066
|
-
case L$
|
|
17091
|
+
case M$3:
|
|
17092
|
+
case L$3:
|
|
17067
17093
|
setPoint$2(data, i + 1, x, y, scaleX, scaleY, rotation, origin);
|
|
17068
17094
|
i += 3;
|
|
17069
17095
|
break;
|
|
17070
17096
|
|
|
17071
|
-
case C$
|
|
17097
|
+
case C$3:
|
|
17072
17098
|
for (j = 1; j < 6; j += 2) setPoint$2(data, i + j, x, y, scaleX, scaleY, rotation, origin);
|
|
17073
17099
|
i += 7;
|
|
17074
17100
|
break;
|
|
@@ -17308,7 +17334,7 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
|
|
|
17308
17334
|
return arrowData;
|
|
17309
17335
|
}
|
|
17310
17336
|
|
|
17311
|
-
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;
|
|
17312
17338
|
|
|
17313
17339
|
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
17314
17340
|
|
|
@@ -17333,8 +17359,8 @@ const PathArrowModule = {
|
|
|
17333
17359
|
while (i < len) {
|
|
17334
17360
|
command = data[i];
|
|
17335
17361
|
switch (command) {
|
|
17336
|
-
case M$
|
|
17337
|
-
case L$
|
|
17362
|
+
case M$2:
|
|
17363
|
+
case L$2:
|
|
17338
17364
|
if (count < 2 || i + 6 >= len) {
|
|
17339
17365
|
copy(old, now);
|
|
17340
17366
|
copyFrom(now, data[i + 1], data[i + 2]);
|
|
@@ -17343,7 +17369,7 @@ const PathArrowModule = {
|
|
|
17343
17369
|
i += 3;
|
|
17344
17370
|
break;
|
|
17345
17371
|
|
|
17346
|
-
case C$
|
|
17372
|
+
case C$2:
|
|
17347
17373
|
if (count === 1 || i + 7 >= len - 3) {
|
|
17348
17374
|
copyPoints(data, last, now, i + 3);
|
|
17349
17375
|
old.x = data[i + 1], old.y = data[i + 2];
|
|
@@ -17359,7 +17385,7 @@ const PathArrowModule = {
|
|
|
17359
17385
|
i += 5;
|
|
17360
17386
|
break;
|
|
17361
17387
|
|
|
17362
|
-
case Z$
|
|
17388
|
+
case Z$2:
|
|
17363
17389
|
return;
|
|
17364
17390
|
|
|
17365
17391
|
case N:
|
|
@@ -17403,8 +17429,8 @@ const PathArrowModule = {
|
|
|
17403
17429
|
break;
|
|
17404
17430
|
}
|
|
17405
17431
|
count++;
|
|
17406
|
-
if (count === 1 && command !== M$
|
|
17407
|
-
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);
|
|
17408
17434
|
if (i === len) {
|
|
17409
17435
|
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
17410
17436
|
if (useStartArrow) {
|
|
@@ -17426,11 +17452,11 @@ const PathArrowModule = {
|
|
|
17426
17452
|
getDistancePoint(now, last, -connectPoint.x, true);
|
|
17427
17453
|
let index;
|
|
17428
17454
|
switch (command) {
|
|
17429
|
-
case L$
|
|
17455
|
+
case L$2:
|
|
17430
17456
|
index = i - 3 + 1;
|
|
17431
17457
|
break;
|
|
17432
17458
|
|
|
17433
|
-
case C$
|
|
17459
|
+
case C$2:
|
|
17434
17460
|
index = i - 7 + 5;
|
|
17435
17461
|
break;
|
|
17436
17462
|
|
|
@@ -19172,7 +19198,7 @@ const HighBezierHelper = {
|
|
|
19172
19198
|
|
|
19173
19199
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
19174
19200
|
|
|
19175
|
-
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;
|
|
19176
19202
|
|
|
19177
19203
|
const tempPoint = {}, tempFrom = {};
|
|
19178
19204
|
|
|
@@ -19183,18 +19209,18 @@ const HighCurveHelper = {
|
|
|
19183
19209
|
while (i < len) {
|
|
19184
19210
|
command = data[i];
|
|
19185
19211
|
switch (command) {
|
|
19186
|
-
case M:
|
|
19187
|
-
case L:
|
|
19212
|
+
case M$1:
|
|
19213
|
+
case L$1:
|
|
19188
19214
|
HighCurveHelper.transformPoints(data, matrix, i, 1);
|
|
19189
19215
|
i += 3;
|
|
19190
19216
|
break;
|
|
19191
19217
|
|
|
19192
|
-
case C:
|
|
19218
|
+
case C$1:
|
|
19193
19219
|
HighCurveHelper.transformPoints(data, matrix, i, 3);
|
|
19194
19220
|
i += 7;
|
|
19195
19221
|
break;
|
|
19196
19222
|
|
|
19197
|
-
case Z:
|
|
19223
|
+
case Z$1:
|
|
19198
19224
|
i += 1;
|
|
19199
19225
|
}
|
|
19200
19226
|
}
|
|
@@ -19215,17 +19241,17 @@ const HighCurveHelper = {
|
|
|
19215
19241
|
while (i < len) {
|
|
19216
19242
|
command = data[i];
|
|
19217
19243
|
switch (command) {
|
|
19218
|
-
case M:
|
|
19219
|
-
case L:
|
|
19244
|
+
case M$1:
|
|
19245
|
+
case L$1:
|
|
19220
19246
|
toX = data[i + 1];
|
|
19221
19247
|
toY = data[i + 2];
|
|
19222
|
-
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;
|
|
19223
19249
|
x = toX;
|
|
19224
19250
|
y = toY;
|
|
19225
19251
|
i += 3;
|
|
19226
19252
|
break;
|
|
19227
19253
|
|
|
19228
|
-
case C:
|
|
19254
|
+
case C$1:
|
|
19229
19255
|
toX = data[i + 5];
|
|
19230
19256
|
toY = data[i + 6];
|
|
19231
19257
|
distance = HighBezierHelper.getDistance(x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], toX, toY);
|
|
@@ -19234,7 +19260,7 @@ const HighCurveHelper = {
|
|
|
19234
19260
|
i += 7;
|
|
19235
19261
|
break;
|
|
19236
19262
|
|
|
19237
|
-
case Z:
|
|
19263
|
+
case Z$1:
|
|
19238
19264
|
i += 1;
|
|
19239
19265
|
|
|
19240
19266
|
default:
|
|
@@ -19259,8 +19285,8 @@ const HighCurveHelper = {
|
|
|
19259
19285
|
while (i < len) {
|
|
19260
19286
|
command = data[i];
|
|
19261
19287
|
switch (command) {
|
|
19262
|
-
case M:
|
|
19263
|
-
case L:
|
|
19288
|
+
case M$1:
|
|
19289
|
+
case L$1:
|
|
19264
19290
|
toX = data[i + 1];
|
|
19265
19291
|
toY = data[i + 2];
|
|
19266
19292
|
distance = segments[index];
|
|
@@ -19279,7 +19305,7 @@ const HighCurveHelper = {
|
|
|
19279
19305
|
i += 3;
|
|
19280
19306
|
break;
|
|
19281
19307
|
|
|
19282
|
-
case C:
|
|
19308
|
+
case C$1:
|
|
19283
19309
|
toX = data[i + 5];
|
|
19284
19310
|
toY = data[i + 6];
|
|
19285
19311
|
distance = segments[index];
|
|
@@ -19295,7 +19321,7 @@ const HighCurveHelper = {
|
|
|
19295
19321
|
i += 7;
|
|
19296
19322
|
break;
|
|
19297
19323
|
|
|
19298
|
-
case Z:
|
|
19324
|
+
case Z$1:
|
|
19299
19325
|
i += 1;
|
|
19300
19326
|
|
|
19301
19327
|
default:
|
|
@@ -19316,8 +19342,8 @@ const HighCurveHelper = {
|
|
|
19316
19342
|
while (i < len) {
|
|
19317
19343
|
command = data[i];
|
|
19318
19344
|
switch (command) {
|
|
19319
|
-
case M:
|
|
19320
|
-
case L:
|
|
19345
|
+
case M$1:
|
|
19346
|
+
case L$1:
|
|
19321
19347
|
toX = data[i + 1];
|
|
19322
19348
|
toY = data[i + 2];
|
|
19323
19349
|
distance = segments[index];
|
|
@@ -19340,7 +19366,7 @@ const HighCurveHelper = {
|
|
|
19340
19366
|
path.push(command, x, y);
|
|
19341
19367
|
break;
|
|
19342
19368
|
|
|
19343
|
-
case C:
|
|
19369
|
+
case C$1:
|
|
19344
19370
|
x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
|
|
19345
19371
|
toX = data[i + 5];
|
|
19346
19372
|
toY = data[i + 6];
|
|
@@ -19359,7 +19385,7 @@ const HighCurveHelper = {
|
|
|
19359
19385
|
path.push(command, x1, y1, x2, y2, toX, toY);
|
|
19360
19386
|
break;
|
|
19361
19387
|
|
|
19362
|
-
case Z:
|
|
19388
|
+
case Z$1:
|
|
19363
19389
|
i += 1;
|
|
19364
19390
|
path.push(command);
|
|
19365
19391
|
|
|
@@ -20880,4 +20906,265 @@ ImageBox = __decorate([ registerUI() ], ImageBox);
|
|
|
20880
20906
|
|
|
20881
20907
|
Plugin.add("box");
|
|
20882
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
|
+
|
|
20883
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 };
|