@leafer-draw/miniapp 1.9.9 → 1.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.cjs +30 -19
- package/dist/miniapp.esm.js +30 -19
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +91 -144
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/miniapp.module.js
CHANGED
|
@@ -263,7 +263,7 @@ const FourNumberHelper = {
|
|
|
263
263
|
return to;
|
|
264
264
|
},
|
|
265
265
|
setTemp(top, right, bottom, left) {
|
|
266
|
-
return set$
|
|
266
|
+
return set$2(tempFour, top, right, bottom, left);
|
|
267
267
|
},
|
|
268
268
|
toTempAB(a, b, change) {
|
|
269
269
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -303,22 +303,22 @@ const FourNumberHelper = {
|
|
|
303
303
|
max(t, other, change) {
|
|
304
304
|
if (isNumber(t) && isNumber(other)) return max$4(t, other);
|
|
305
305
|
toTempAB(t, other, change);
|
|
306
|
-
return set$
|
|
306
|
+
return set$2(tempTo, max$4(tempA[0], tempB[0]), max$4(tempA[1], tempB[1]), max$4(tempA[2], tempB[2]), max$4(tempA[3], tempB[3]));
|
|
307
307
|
},
|
|
308
308
|
add(t, other, change) {
|
|
309
309
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
310
310
|
toTempAB(t, other, change);
|
|
311
|
-
return set$
|
|
311
|
+
return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
312
312
|
},
|
|
313
313
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
314
314
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
315
315
|
const to = change ? t : [];
|
|
316
316
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
317
|
-
return set$
|
|
317
|
+
return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
320
|
|
|
321
|
-
const {set: set$
|
|
321
|
+
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
322
322
|
|
|
323
323
|
const {round: round$3, pow: pow$1, PI: PI$3} = Math;
|
|
324
324
|
|
|
@@ -418,7 +418,7 @@ function getMatrixData() {
|
|
|
418
418
|
|
|
419
419
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
420
420
|
|
|
421
|
-
const {float: float$
|
|
421
|
+
const {float: float$1} = MathHelper;
|
|
422
422
|
|
|
423
423
|
const tempPoint$3 = {};
|
|
424
424
|
|
|
@@ -669,12 +669,12 @@ const MatrixHelper = {
|
|
|
669
669
|
const cosR = c / scaleY;
|
|
670
670
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
671
671
|
}
|
|
672
|
-
const cosR = float$
|
|
672
|
+
const cosR = float$1(cos$5(rotation));
|
|
673
673
|
const sinR = sin$5(rotation);
|
|
674
|
-
scaleX = float$
|
|
675
|
-
skewX = cosR ? float$
|
|
676
|
-
skewY = cosR ? float$
|
|
677
|
-
rotation = float$
|
|
674
|
+
scaleX = float$1(scaleX), scaleY = float$1(scaleY);
|
|
675
|
+
skewX = cosR ? float$1((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
676
|
+
skewY = cosR ? float$1((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
677
|
+
rotation = float$1(rotation / OneRadian);
|
|
678
678
|
} else {
|
|
679
679
|
scaleX = a;
|
|
680
680
|
scaleY = d;
|
|
@@ -720,7 +720,7 @@ const M$6 = MatrixHelper;
|
|
|
720
720
|
|
|
721
721
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
722
722
|
|
|
723
|
-
const {sin: sin$4, cos: cos$4, abs: abs$
|
|
723
|
+
const {sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
|
|
724
724
|
|
|
725
725
|
const PointHelper = {
|
|
726
726
|
defaultPoint: getPointData(),
|
|
@@ -813,8 +813,8 @@ const PointHelper = {
|
|
|
813
813
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
814
814
|
},
|
|
815
815
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
816
|
-
const x = abs$
|
|
817
|
-
const y = abs$
|
|
816
|
+
const x = abs$4(x2 - x1);
|
|
817
|
+
const y = abs$4(y2 - y1);
|
|
818
818
|
return sqrt$2(x * x + y * y);
|
|
819
819
|
},
|
|
820
820
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -1200,7 +1200,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPo
|
|
|
1200
1200
|
|
|
1201
1201
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1202
1202
|
|
|
1203
|
-
const {float: float
|
|
1203
|
+
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1204
1204
|
|
|
1205
1205
|
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1206
1206
|
|
|
@@ -1375,10 +1375,10 @@ const BoundsHelper = {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
},
|
|
1377
1377
|
float(t, maxLength) {
|
|
1378
|
-
t.x = float
|
|
1379
|
-
t.y = float
|
|
1380
|
-
t.width = float
|
|
1381
|
-
t.height = float
|
|
1378
|
+
t.x = float(t.x, maxLength);
|
|
1379
|
+
t.y = float(t.y, maxLength);
|
|
1380
|
+
t.width = float(t.width, maxLength);
|
|
1381
|
+
t.height = float(t.height, maxLength);
|
|
1382
1382
|
},
|
|
1383
1383
|
add(t, bounds, isPoint) {
|
|
1384
1384
|
right$1 = t.x + t.width;
|
|
@@ -1714,17 +1714,17 @@ class Debug {
|
|
|
1714
1714
|
showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
|
|
1715
1715
|
}
|
|
1716
1716
|
log(...messages) {
|
|
1717
|
-
if (D$
|
|
1718
|
-
if (D$
|
|
1719
|
-
if (D$
|
|
1717
|
+
if (D$4.enable) {
|
|
1718
|
+
if (D$4.filterList.length && D$4.filterList.every(name => name !== this.name)) return;
|
|
1719
|
+
if (D$4.excludeList.length && D$4.excludeList.some(name => name === this.name)) return;
|
|
1720
1720
|
console.log("%c" + this.name, "color:#21ae62", ...messages);
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
1723
|
tip(...messages) {
|
|
1724
|
-
if (D$
|
|
1724
|
+
if (D$4.enable) this.warn(...messages);
|
|
1725
1725
|
}
|
|
1726
1726
|
warn(...messages) {
|
|
1727
|
-
if (D$
|
|
1727
|
+
if (D$4.showWarn) console.warn(this.name, ...messages);
|
|
1728
1728
|
}
|
|
1729
1729
|
repeat(name, ...messages) {
|
|
1730
1730
|
if (!this.repeatMap[name]) {
|
|
@@ -1752,7 +1752,7 @@ function getNameList(name) {
|
|
|
1752
1752
|
return name;
|
|
1753
1753
|
}
|
|
1754
1754
|
|
|
1755
|
-
const D$
|
|
1755
|
+
const D$4 = Debug;
|
|
1756
1756
|
|
|
1757
1757
|
const debug$e = Debug.get("RunTime");
|
|
1758
1758
|
|
|
@@ -2592,11 +2592,11 @@ const RectHelper = {
|
|
|
2592
2592
|
}
|
|
2593
2593
|
};
|
|
2594
2594
|
|
|
2595
|
-
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2595
|
+
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2596
2596
|
|
|
2597
2597
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2598
2598
|
|
|
2599
|
-
const {set: set, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2599
|
+
const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2600
2600
|
|
|
2601
2601
|
const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
|
|
2602
2602
|
|
|
@@ -2667,14 +2667,14 @@ const BezierHelper = {
|
|
|
2667
2667
|
const lenCB = hypot(CBx, CBy);
|
|
2668
2668
|
let totalRadian = endRadian - startRadian;
|
|
2669
2669
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2670
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2670
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$3(totalRadian - PI$2) < 1e-12) {
|
|
2671
2671
|
if (data) data.push(L$6, x1, y1);
|
|
2672
2672
|
if (setPointBounds) {
|
|
2673
2673
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
2674
2674
|
addPoint$1(setPointBounds, x1, y1);
|
|
2675
2675
|
}
|
|
2676
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2677
|
-
if (setEndPoint) set(setEndPoint, x1, y1);
|
|
2676
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2677
|
+
if (setEndPoint) set$1(setEndPoint, x1, y1);
|
|
2678
2678
|
return;
|
|
2679
2679
|
}
|
|
2680
2680
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2700,7 +2700,7 @@ const BezierHelper = {
|
|
|
2700
2700
|
let totalRadian = endRadian - startRadian;
|
|
2701
2701
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2702
2702
|
if (anticlockwise) totalRadian -= PI2;
|
|
2703
|
-
const parts = ceil$1(abs$
|
|
2703
|
+
const parts = ceil$1(abs$3(totalRadian / PI_2));
|
|
2704
2704
|
const partRadian = totalRadian / parts;
|
|
2705
2705
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2706
2706
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2714,7 +2714,7 @@ const BezierHelper = {
|
|
|
2714
2714
|
let fromX = cx + x, fromY = cy + y;
|
|
2715
2715
|
if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2716
2716
|
if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
|
|
2717
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2717
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2718
2718
|
for (let i = 0; i < parts; i++) {
|
|
2719
2719
|
endCos = cos$3(endRadian);
|
|
2720
2720
|
endSin = sin$3(endRadian);
|
|
@@ -2733,7 +2733,7 @@ const BezierHelper = {
|
|
|
2733
2733
|
startRadian = endRadian;
|
|
2734
2734
|
endRadian += partRadian;
|
|
2735
2735
|
}
|
|
2736
|
-
if (setEndPoint) set(setEndPoint, cx + x, cy + y);
|
|
2736
|
+
if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
|
|
2737
2737
|
},
|
|
2738
2738
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2739
2739
|
data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2842,7 +2842,7 @@ const EllipseHelper = {
|
|
|
2842
2842
|
}
|
|
2843
2843
|
};
|
|
2844
2844
|
|
|
2845
|
-
const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$
|
|
2845
|
+
const {M: M$4, m: m, L: L$5, l: l, H: H, h: h, V: V, v: v, C: C$3, c: c, S: S, s: s, Q: Q$3, q: q, T: T, t: t, A: A, a: a, Z: Z$4, z: z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3} = PathCommandMap;
|
|
2846
2846
|
|
|
2847
2847
|
const {rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2848
2848
|
|
|
@@ -3062,7 +3062,7 @@ const PathConvert = {
|
|
|
3062
3062
|
i += 5;
|
|
3063
3063
|
break;
|
|
3064
3064
|
|
|
3065
|
-
case D$
|
|
3065
|
+
case D$3:
|
|
3066
3066
|
x = old[i + 1];
|
|
3067
3067
|
y = old[i + 2];
|
|
3068
3068
|
curveMode ? roundRect$2(data, x, y, old[i + 3], old[i + 4], [ old[i + 5], old[i + 6], old[i + 7], old[i + 8] ]) : copyData(data, old, i, 9);
|
|
@@ -3163,11 +3163,11 @@ const PathConvert = {
|
|
|
3163
3163
|
|
|
3164
3164
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3165
3165
|
|
|
3166
|
-
const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$
|
|
3166
|
+
const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2} = PathCommandMap;
|
|
3167
3167
|
|
|
3168
3168
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3169
3169
|
|
|
3170
|
-
const {tan: tan, min: min, abs: abs$
|
|
3170
|
+
const {tan: tan, min: min, abs: abs$2} = Math;
|
|
3171
3171
|
|
|
3172
3172
|
const startPoint = {};
|
|
3173
3173
|
|
|
@@ -3199,7 +3199,7 @@ const PathCommandDataHelper = {
|
|
|
3199
3199
|
} else {
|
|
3200
3200
|
const fourCorners = MathHelper.fourNumber(cornerRadius);
|
|
3201
3201
|
if (fourCorners) {
|
|
3202
|
-
data.push(D$
|
|
3202
|
+
data.push(D$2, x, y, width, height, ...fourCorners);
|
|
3203
3203
|
} else {
|
|
3204
3204
|
data.push(N$2, x, y, width, height);
|
|
3205
3205
|
}
|
|
@@ -3225,7 +3225,7 @@ const PathCommandDataHelper = {
|
|
|
3225
3225
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3226
3226
|
if (!isUndefined(lastX)) {
|
|
3227
3227
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3228
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3228
|
+
radius = min(radius, min(d / 2, d / 2 * abs$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3229
3229
|
}
|
|
3230
3230
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3231
3231
|
},
|
|
@@ -3338,7 +3338,7 @@ class PathCreator {
|
|
|
3338
3338
|
paint() {}
|
|
3339
3339
|
}
|
|
3340
3340
|
|
|
3341
|
-
const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$
|
|
3341
|
+
const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1} = PathCommandMap;
|
|
3342
3342
|
|
|
3343
3343
|
const debug$a = Debug.get("PathDrawer");
|
|
3344
3344
|
|
|
@@ -3380,7 +3380,7 @@ const PathDrawer = {
|
|
|
3380
3380
|
i += 5;
|
|
3381
3381
|
break;
|
|
3382
3382
|
|
|
3383
|
-
case D$
|
|
3383
|
+
case D$1:
|
|
3384
3384
|
drawer.roundRect(data[i + 1], data[i + 2], data[i + 3], data[i + 4], [ data[i + 5], data[i + 6], data[i + 7], data[i + 8] ]);
|
|
3385
3385
|
i += 9;
|
|
3386
3386
|
break;
|
|
@@ -3423,7 +3423,7 @@ const PathDrawer = {
|
|
|
3423
3423
|
}
|
|
3424
3424
|
};
|
|
3425
3425
|
|
|
3426
|
-
const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D
|
|
3426
|
+
const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D, X: X, G: G, F: F$1, O: O, P: P, U: U} = PathCommandMap;
|
|
3427
3427
|
|
|
3428
3428
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3429
3429
|
|
|
@@ -3499,12 +3499,12 @@ const PathBounds = {
|
|
|
3499
3499
|
i += 5;
|
|
3500
3500
|
break;
|
|
3501
3501
|
|
|
3502
|
-
case D
|
|
3502
|
+
case D:
|
|
3503
3503
|
case X:
|
|
3504
3504
|
x = data[i + 1];
|
|
3505
3505
|
y = data[i + 2];
|
|
3506
3506
|
addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
|
|
3507
|
-
i += command === D
|
|
3507
|
+
i += command === D ? 9 : 6;
|
|
3508
3508
|
break;
|
|
3509
3509
|
|
|
3510
3510
|
case G:
|
|
@@ -3840,7 +3840,12 @@ class TaskProcessor {
|
|
|
3840
3840
|
runTask() {
|
|
3841
3841
|
const task = this.list[this.index];
|
|
3842
3842
|
if (!task) {
|
|
3843
|
-
this.nextTask();
|
|
3843
|
+
this.timer = setTimeout(() => this.nextTask());
|
|
3844
|
+
return;
|
|
3845
|
+
}
|
|
3846
|
+
if (task.isCancel) {
|
|
3847
|
+
this.index++;
|
|
3848
|
+
this.runTask();
|
|
3844
3849
|
return;
|
|
3845
3850
|
}
|
|
3846
3851
|
task.run().then(() => {
|
|
@@ -3871,16 +3876,15 @@ class TaskProcessor {
|
|
|
3871
3876
|
}
|
|
3872
3877
|
setParallelList() {
|
|
3873
3878
|
let task;
|
|
3879
|
+
const {config: config, list: list, index: index} = this;
|
|
3874
3880
|
this.parallelList = [];
|
|
3875
3881
|
this.parallelSuccessNumber = 0;
|
|
3876
|
-
let end =
|
|
3877
|
-
if (end >
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
this.parallelList.push(task);
|
|
3882
|
-
} else {
|
|
3883
|
-
break;
|
|
3882
|
+
let end = index + config.parallel;
|
|
3883
|
+
if (end > list.length) end = list.length;
|
|
3884
|
+
if (config.parallel > 1) {
|
|
3885
|
+
for (let i = index; i < end; i++) {
|
|
3886
|
+
task = list[i];
|
|
3887
|
+
if (task.parallel) this.parallelList.push(task); else break;
|
|
3884
3888
|
}
|
|
3885
3889
|
}
|
|
3886
3890
|
}
|
|
@@ -6815,7 +6819,7 @@ class LeafLevelList {
|
|
|
6815
6819
|
}
|
|
6816
6820
|
}
|
|
6817
6821
|
|
|
6818
|
-
const version = "1.9.
|
|
6822
|
+
const version = "1.9.11";
|
|
6819
6823
|
|
|
6820
6824
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6821
6825
|
get allowBackgroundColor() {
|
|
@@ -8003,12 +8007,12 @@ class ImageData extends RectData {
|
|
|
8003
8007
|
}
|
|
8004
8008
|
__getData() {
|
|
8005
8009
|
const data = super.__getData();
|
|
8006
|
-
delete data.fill;
|
|
8010
|
+
if (data.url) delete data.fill;
|
|
8007
8011
|
return data;
|
|
8008
8012
|
}
|
|
8009
8013
|
__getInputData(names, options) {
|
|
8010
8014
|
const data = super.__getInputData(names, options);
|
|
8011
|
-
delete data.fill;
|
|
8015
|
+
if (data.url) delete data.fill;
|
|
8012
8016
|
return data;
|
|
8013
8017
|
}
|
|
8014
8018
|
}
|
|
@@ -8065,74 +8069,6 @@ const UIBounds = {
|
|
|
8065
8069
|
}
|
|
8066
8070
|
};
|
|
8067
8071
|
|
|
8068
|
-
const {float: float} = MathHelper;
|
|
8069
|
-
|
|
8070
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
8071
|
-
|
|
8072
|
-
const DragBoundsHelper = {
|
|
8073
|
-
limitMove(leaf, move) {
|
|
8074
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8075
|
-
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
8076
|
-
D.axisMove(leaf, move);
|
|
8077
|
-
},
|
|
8078
|
-
limitScaleOf(leaf, origin, scale) {
|
|
8079
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8080
|
-
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
8081
|
-
},
|
|
8082
|
-
axisMove(leaf, move) {
|
|
8083
|
-
const {draggable: draggable} = leaf;
|
|
8084
|
-
if (draggable === "x") move.y = 0;
|
|
8085
|
-
if (draggable === "y") move.x = 0;
|
|
8086
|
-
},
|
|
8087
|
-
getDragBounds(leaf) {
|
|
8088
|
-
const {dragBounds: dragBounds} = leaf;
|
|
8089
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
8090
|
-
},
|
|
8091
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
8092
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
8093
|
-
},
|
|
8094
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8095
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8096
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8097
|
-
if (!change) move = Object.assign({}, move);
|
|
8098
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8099
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8100
|
-
} else {
|
|
8101
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8102
|
-
}
|
|
8103
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8104
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8105
|
-
} else {
|
|
8106
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8107
|
-
}
|
|
8108
|
-
move.x = float(move.x);
|
|
8109
|
-
move.y = float(move.y);
|
|
8110
|
-
return move;
|
|
8111
|
-
},
|
|
8112
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
8113
|
-
if (!change) scale = Object.assign({}, scale);
|
|
8114
|
-
let fitScaleX, fitScaleY;
|
|
8115
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
8116
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
8117
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
8118
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8119
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
8120
|
-
} else {
|
|
8121
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
8122
|
-
}
|
|
8123
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8124
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
8125
|
-
} else {
|
|
8126
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
8127
|
-
}
|
|
8128
|
-
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
8129
|
-
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
8130
|
-
return scale;
|
|
8131
|
-
}
|
|
8132
|
-
};
|
|
8133
|
-
|
|
8134
|
-
const D = DragBoundsHelper;
|
|
8135
|
-
|
|
8136
8072
|
const {stintSet: stintSet$1} = DataHelper;
|
|
8137
8073
|
|
|
8138
8074
|
const UIRender = {
|
|
@@ -9953,7 +9889,14 @@ const PaintModule = {
|
|
|
9953
9889
|
|
|
9954
9890
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
9955
9891
|
|
|
9956
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9892
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9893
|
+
|
|
9894
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
9895
|
+
const transform = get$3();
|
|
9896
|
+
translate$1(transform, box.x, box.y);
|
|
9897
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
9898
|
+
data.transform = transform;
|
|
9899
|
+
}
|
|
9957
9900
|
|
|
9958
9901
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9959
9902
|
const transform = get$3();
|
|
@@ -9970,8 +9913,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
9970
9913
|
const transform = get$3();
|
|
9971
9914
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
9972
9915
|
if (clipScaleX) {
|
|
9973
|
-
|
|
9974
|
-
|
|
9916
|
+
if (rotation || skew) {
|
|
9917
|
+
set(tempMatrix$1);
|
|
9918
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
9919
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9920
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
9975
9921
|
}
|
|
9976
9922
|
data.transform = transform;
|
|
9977
9923
|
}
|
|
@@ -10067,7 +10013,10 @@ function getPatternData(paint, box, image) {
|
|
|
10067
10013
|
if (offset) PointHelper.move(tempImage, offset);
|
|
10068
10014
|
switch (mode) {
|
|
10069
10015
|
case "stretch":
|
|
10070
|
-
if (!sameBox)
|
|
10016
|
+
if (!sameBox) {
|
|
10017
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
10018
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
10019
|
+
}
|
|
10071
10020
|
break;
|
|
10072
10021
|
|
|
10073
10022
|
case "normal":
|
|
@@ -10076,7 +10025,7 @@ function getPatternData(paint, box, image) {
|
|
|
10076
10025
|
let clipScaleX, clipScaleY;
|
|
10077
10026
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
10078
10027
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
10079
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
10028
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
10080
10029
|
}
|
|
10081
10030
|
break;
|
|
10082
10031
|
|
|
@@ -10093,17 +10042,14 @@ function getPatternData(paint, box, image) {
|
|
|
10093
10042
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10094
10043
|
}
|
|
10095
10044
|
if (!data.transform) {
|
|
10096
|
-
if (box.x || box.y)
|
|
10097
|
-
data.transform = get$2();
|
|
10098
|
-
translate(data.transform, box.x, box.y);
|
|
10099
|
-
}
|
|
10045
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
10100
10046
|
}
|
|
10101
|
-
|
|
10047
|
+
data.width = width;
|
|
10048
|
+
data.height = height;
|
|
10049
|
+
if (scaleX) {
|
|
10102
10050
|
data.scaleX = scaleX;
|
|
10103
10051
|
data.scaleY = scaleY;
|
|
10104
10052
|
}
|
|
10105
|
-
data.width = width;
|
|
10106
|
-
data.height = height;
|
|
10107
10053
|
if (opacity) data.opacity = opacity;
|
|
10108
10054
|
if (filters) data.filters = filters;
|
|
10109
10055
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -10235,7 +10181,7 @@ function ignoreRender(ui, value) {
|
|
|
10235
10181
|
|
|
10236
10182
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
10237
10183
|
|
|
10238
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
10184
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
10239
10185
|
|
|
10240
10186
|
function createPattern(ui, paint, pixelRatio) {
|
|
10241
10187
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -10246,8 +10192,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10246
10192
|
scaleX *= pixelRatio;
|
|
10247
10193
|
scaleY *= pixelRatio;
|
|
10248
10194
|
if (sx) {
|
|
10249
|
-
sx = abs(sx);
|
|
10250
|
-
sy = abs(sy);
|
|
10195
|
+
sx = abs$1(sx);
|
|
10196
|
+
sy = abs$1(sy);
|
|
10251
10197
|
imageMatrix = get$1();
|
|
10252
10198
|
copy$1(imageMatrix, transform);
|
|
10253
10199
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -10389,6 +10335,7 @@ const PaintImageModule = {
|
|
|
10389
10335
|
recycleImage: recycleImage,
|
|
10390
10336
|
createData: createData,
|
|
10391
10337
|
getPatternData: getPatternData,
|
|
10338
|
+
stretchMode: stretchMode,
|
|
10392
10339
|
fillOrFitMode: fillOrFitMode,
|
|
10393
10340
|
clipMode: clipMode,
|
|
10394
10341
|
repeatMode: repeatMode
|
|
@@ -10499,7 +10446,7 @@ const PaintGradientModule = {
|
|
|
10499
10446
|
getTransform: getTransform
|
|
10500
10447
|
};
|
|
10501
10448
|
|
|
10502
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
10449
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
10503
10450
|
|
|
10504
10451
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
10505
10452
|
|
|
@@ -10543,7 +10490,7 @@ function shadow(ui, current, shape) {
|
|
|
10543
10490
|
function getShadowRenderSpread(_ui, shadow) {
|
|
10544
10491
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
10545
10492
|
shadow.forEach(item => {
|
|
10546
|
-
x = item.x || 0, y = item.y || 0,
|
|
10493
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
10547
10494
|
top = max(top, spread + blur - y);
|
|
10548
10495
|
right = max(right, spread + blur + x);
|
|
10549
10496
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -10554,11 +10501,11 @@ function getShadowRenderSpread(_ui, shadow) {
|
|
|
10554
10501
|
|
|
10555
10502
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
10556
10503
|
if (shadow.spread) {
|
|
10557
|
-
const
|
|
10504
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
10558
10505
|
tempMatrix.set().scaleOfOuter({
|
|
10559
10506
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
10560
10507
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
10561
|
-
},
|
|
10508
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
10562
10509
|
return tempMatrix;
|
|
10563
10510
|
}
|
|
10564
10511
|
return undefined;
|
|
@@ -11264,4 +11211,4 @@ try {
|
|
|
11264
11211
|
if (wx) useCanvas("miniapp", wx);
|
|
11265
11212
|
} catch (_a) {}
|
|
11266
11213
|
|
|
11267
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9,
|
|
11214
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, FourNumberHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, 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, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|