leafer-draw 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/web.cjs +30 -19
- package/dist/web.esm.js +30 -19
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +89 -140
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +91 -144
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.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$f = 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$b = 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
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6821
6825
|
|
|
@@ -8056,12 +8060,12 @@ class ImageData extends RectData {
|
|
|
8056
8060
|
}
|
|
8057
8061
|
__getData() {
|
|
8058
8062
|
const data = super.__getData();
|
|
8059
|
-
delete data.fill;
|
|
8063
|
+
if (data.url) delete data.fill;
|
|
8060
8064
|
return data;
|
|
8061
8065
|
}
|
|
8062
8066
|
__getInputData(names, options) {
|
|
8063
8067
|
const data = super.__getInputData(names, options);
|
|
8064
|
-
delete data.fill;
|
|
8068
|
+
if (data.url) delete data.fill;
|
|
8065
8069
|
return data;
|
|
8066
8070
|
}
|
|
8067
8071
|
}
|
|
@@ -8118,74 +8122,6 @@ const UIBounds = {
|
|
|
8118
8122
|
}
|
|
8119
8123
|
};
|
|
8120
8124
|
|
|
8121
|
-
const {float: float} = MathHelper;
|
|
8122
|
-
|
|
8123
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
8124
|
-
|
|
8125
|
-
const DragBoundsHelper = {
|
|
8126
|
-
limitMove(leaf, move) {
|
|
8127
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8128
|
-
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
8129
|
-
D.axisMove(leaf, move);
|
|
8130
|
-
},
|
|
8131
|
-
limitScaleOf(leaf, origin, scale) {
|
|
8132
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8133
|
-
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
8134
|
-
},
|
|
8135
|
-
axisMove(leaf, move) {
|
|
8136
|
-
const {draggable: draggable} = leaf;
|
|
8137
|
-
if (draggable === "x") move.y = 0;
|
|
8138
|
-
if (draggable === "y") move.x = 0;
|
|
8139
|
-
},
|
|
8140
|
-
getDragBounds(leaf) {
|
|
8141
|
-
const {dragBounds: dragBounds} = leaf;
|
|
8142
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
8143
|
-
},
|
|
8144
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
8145
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
8146
|
-
},
|
|
8147
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8148
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8149
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8150
|
-
if (!change) move = Object.assign({}, move);
|
|
8151
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8152
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8153
|
-
} else {
|
|
8154
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8155
|
-
}
|
|
8156
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8157
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8158
|
-
} else {
|
|
8159
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8160
|
-
}
|
|
8161
|
-
move.x = float(move.x);
|
|
8162
|
-
move.y = float(move.y);
|
|
8163
|
-
return move;
|
|
8164
|
-
},
|
|
8165
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
8166
|
-
if (!change) scale = Object.assign({}, scale);
|
|
8167
|
-
let fitScaleX, fitScaleY;
|
|
8168
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
8169
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
8170
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
8171
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8172
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
8173
|
-
} else {
|
|
8174
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
8175
|
-
}
|
|
8176
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8177
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
8178
|
-
} else {
|
|
8179
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
8180
|
-
}
|
|
8181
|
-
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
8182
|
-
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
8183
|
-
return scale;
|
|
8184
|
-
}
|
|
8185
|
-
};
|
|
8186
|
-
|
|
8187
|
-
const D = DragBoundsHelper;
|
|
8188
|
-
|
|
8189
8125
|
const {stintSet: stintSet$1} = DataHelper;
|
|
8190
8126
|
|
|
8191
8127
|
const UIRender = {
|
|
@@ -10006,7 +9942,14 @@ const PaintModule = {
|
|
|
10006
9942
|
|
|
10007
9943
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
10008
9944
|
|
|
10009
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9945
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9946
|
+
|
|
9947
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
9948
|
+
const transform = get$3();
|
|
9949
|
+
translate$1(transform, box.x, box.y);
|
|
9950
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
9951
|
+
data.transform = transform;
|
|
9952
|
+
}
|
|
10010
9953
|
|
|
10011
9954
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10012
9955
|
const transform = get$3();
|
|
@@ -10023,8 +9966,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
10023
9966
|
const transform = get$3();
|
|
10024
9967
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10025
9968
|
if (clipScaleX) {
|
|
10026
|
-
|
|
10027
|
-
|
|
9969
|
+
if (rotation || skew) {
|
|
9970
|
+
set(tempMatrix$1);
|
|
9971
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
9972
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9973
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
10028
9974
|
}
|
|
10029
9975
|
data.transform = transform;
|
|
10030
9976
|
}
|
|
@@ -10120,7 +10066,10 @@ function getPatternData(paint, box, image) {
|
|
|
10120
10066
|
if (offset) PointHelper.move(tempImage, offset);
|
|
10121
10067
|
switch (mode) {
|
|
10122
10068
|
case "stretch":
|
|
10123
|
-
if (!sameBox)
|
|
10069
|
+
if (!sameBox) {
|
|
10070
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
10071
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
10072
|
+
}
|
|
10124
10073
|
break;
|
|
10125
10074
|
|
|
10126
10075
|
case "normal":
|
|
@@ -10129,7 +10078,7 @@ function getPatternData(paint, box, image) {
|
|
|
10129
10078
|
let clipScaleX, clipScaleY;
|
|
10130
10079
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
10131
10080
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
10132
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
10081
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
10133
10082
|
}
|
|
10134
10083
|
break;
|
|
10135
10084
|
|
|
@@ -10146,17 +10095,14 @@ function getPatternData(paint, box, image) {
|
|
|
10146
10095
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10147
10096
|
}
|
|
10148
10097
|
if (!data.transform) {
|
|
10149
|
-
if (box.x || box.y)
|
|
10150
|
-
data.transform = get$2();
|
|
10151
|
-
translate(data.transform, box.x, box.y);
|
|
10152
|
-
}
|
|
10098
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
10153
10099
|
}
|
|
10154
|
-
|
|
10100
|
+
data.width = width;
|
|
10101
|
+
data.height = height;
|
|
10102
|
+
if (scaleX) {
|
|
10155
10103
|
data.scaleX = scaleX;
|
|
10156
10104
|
data.scaleY = scaleY;
|
|
10157
10105
|
}
|
|
10158
|
-
data.width = width;
|
|
10159
|
-
data.height = height;
|
|
10160
10106
|
if (opacity) data.opacity = opacity;
|
|
10161
10107
|
if (filters) data.filters = filters;
|
|
10162
10108
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -10288,7 +10234,7 @@ function ignoreRender(ui, value) {
|
|
|
10288
10234
|
|
|
10289
10235
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
10290
10236
|
|
|
10291
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
10237
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
10292
10238
|
|
|
10293
10239
|
function createPattern(ui, paint, pixelRatio) {
|
|
10294
10240
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -10299,8 +10245,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10299
10245
|
scaleX *= pixelRatio;
|
|
10300
10246
|
scaleY *= pixelRatio;
|
|
10301
10247
|
if (sx) {
|
|
10302
|
-
sx = abs(sx);
|
|
10303
|
-
sy = abs(sy);
|
|
10248
|
+
sx = abs$1(sx);
|
|
10249
|
+
sy = abs$1(sy);
|
|
10304
10250
|
imageMatrix = get$1();
|
|
10305
10251
|
copy$1(imageMatrix, transform);
|
|
10306
10252
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -10442,6 +10388,7 @@ const PaintImageModule = {
|
|
|
10442
10388
|
recycleImage: recycleImage,
|
|
10443
10389
|
createData: createData,
|
|
10444
10390
|
getPatternData: getPatternData,
|
|
10391
|
+
stretchMode: stretchMode,
|
|
10445
10392
|
fillOrFitMode: fillOrFitMode,
|
|
10446
10393
|
clipMode: clipMode,
|
|
10447
10394
|
repeatMode: repeatMode
|
|
@@ -10552,7 +10499,7 @@ const PaintGradientModule = {
|
|
|
10552
10499
|
getTransform: getTransform
|
|
10553
10500
|
};
|
|
10554
10501
|
|
|
10555
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
10502
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
10556
10503
|
|
|
10557
10504
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
10558
10505
|
|
|
@@ -10596,7 +10543,7 @@ function shadow(ui, current, shape) {
|
|
|
10596
10543
|
function getShadowRenderSpread(_ui, shadow) {
|
|
10597
10544
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
10598
10545
|
shadow.forEach(item => {
|
|
10599
|
-
x = item.x || 0, y = item.y || 0,
|
|
10546
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
10600
10547
|
top = max(top, spread + blur - y);
|
|
10601
10548
|
right = max(right, spread + blur + x);
|
|
10602
10549
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -10607,11 +10554,11 @@ function getShadowRenderSpread(_ui, shadow) {
|
|
|
10607
10554
|
|
|
10608
10555
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
10609
10556
|
if (shadow.spread) {
|
|
10610
|
-
const
|
|
10557
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
10611
10558
|
tempMatrix.set().scaleOfOuter({
|
|
10612
10559
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
10613
10560
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
10614
|
-
},
|
|
10561
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
10615
10562
|
return tempMatrix;
|
|
10616
10563
|
}
|
|
10617
10564
|
return undefined;
|
|
@@ -11315,4 +11262,4 @@ Object.assign(Effect, EffectModule);
|
|
|
11315
11262
|
|
|
11316
11263
|
useCanvas();
|
|
11317
11264
|
|
|
11318
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9,
|
|
11265
|
+
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$1 as 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 };
|