leafer-draw 1.9.8 → 1.9.10
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 +33 -21
- package/dist/web.esm.js +34 -22
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +79 -133
- 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 +81 -137
- 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:
|
|
@@ -6815,7 +6815,7 @@ class LeafLevelList {
|
|
|
6815
6815
|
}
|
|
6816
6816
|
}
|
|
6817
6817
|
|
|
6818
|
-
const version = "1.9.
|
|
6818
|
+
const version = "1.9.10";
|
|
6819
6819
|
|
|
6820
6820
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6821
6821
|
|
|
@@ -8056,12 +8056,12 @@ class ImageData extends RectData {
|
|
|
8056
8056
|
}
|
|
8057
8057
|
__getData() {
|
|
8058
8058
|
const data = super.__getData();
|
|
8059
|
-
delete data.fill;
|
|
8059
|
+
if (data.url) delete data.fill;
|
|
8060
8060
|
return data;
|
|
8061
8061
|
}
|
|
8062
8062
|
__getInputData(names, options) {
|
|
8063
8063
|
const data = super.__getInputData(names, options);
|
|
8064
|
-
delete data.fill;
|
|
8064
|
+
if (data.url) delete data.fill;
|
|
8065
8065
|
return data;
|
|
8066
8066
|
}
|
|
8067
8067
|
}
|
|
@@ -8118,74 +8118,6 @@ const UIBounds = {
|
|
|
8118
8118
|
}
|
|
8119
8119
|
};
|
|
8120
8120
|
|
|
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
8121
|
const {stintSet: stintSet$1} = DataHelper;
|
|
8190
8122
|
|
|
8191
8123
|
const UIRender = {
|
|
@@ -10006,7 +9938,14 @@ const PaintModule = {
|
|
|
10006
9938
|
|
|
10007
9939
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
10008
9940
|
|
|
10009
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9941
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9942
|
+
|
|
9943
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
9944
|
+
const transform = get$3();
|
|
9945
|
+
translate$1(transform, box.x, box.y);
|
|
9946
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
9947
|
+
data.transform = transform;
|
|
9948
|
+
}
|
|
10010
9949
|
|
|
10011
9950
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10012
9951
|
const transform = get$3();
|
|
@@ -10023,8 +9962,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
10023
9962
|
const transform = get$3();
|
|
10024
9963
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10025
9964
|
if (clipScaleX) {
|
|
10026
|
-
|
|
10027
|
-
|
|
9965
|
+
if (rotation || skew) {
|
|
9966
|
+
set(tempMatrix$1);
|
|
9967
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
9968
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9969
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
10028
9970
|
}
|
|
10029
9971
|
data.transform = transform;
|
|
10030
9972
|
}
|
|
@@ -10120,7 +10062,10 @@ function getPatternData(paint, box, image) {
|
|
|
10120
10062
|
if (offset) PointHelper.move(tempImage, offset);
|
|
10121
10063
|
switch (mode) {
|
|
10122
10064
|
case "stretch":
|
|
10123
|
-
if (!sameBox)
|
|
10065
|
+
if (!sameBox) {
|
|
10066
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
10067
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
10068
|
+
}
|
|
10124
10069
|
break;
|
|
10125
10070
|
|
|
10126
10071
|
case "normal":
|
|
@@ -10129,7 +10074,7 @@ function getPatternData(paint, box, image) {
|
|
|
10129
10074
|
let clipScaleX, clipScaleY;
|
|
10130
10075
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
10131
10076
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
10132
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
10077
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
10133
10078
|
}
|
|
10134
10079
|
break;
|
|
10135
10080
|
|
|
@@ -10146,17 +10091,14 @@ function getPatternData(paint, box, image) {
|
|
|
10146
10091
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10147
10092
|
}
|
|
10148
10093
|
if (!data.transform) {
|
|
10149
|
-
if (box.x || box.y)
|
|
10150
|
-
data.transform = get$2();
|
|
10151
|
-
translate(data.transform, box.x, box.y);
|
|
10152
|
-
}
|
|
10094
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
10153
10095
|
}
|
|
10154
|
-
|
|
10096
|
+
data.width = width;
|
|
10097
|
+
data.height = height;
|
|
10098
|
+
if (scaleX) {
|
|
10155
10099
|
data.scaleX = scaleX;
|
|
10156
10100
|
data.scaleY = scaleY;
|
|
10157
10101
|
}
|
|
10158
|
-
data.width = width;
|
|
10159
|
-
data.height = height;
|
|
10160
10102
|
if (opacity) data.opacity = opacity;
|
|
10161
10103
|
if (filters) data.filters = filters;
|
|
10162
10104
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -10288,7 +10230,7 @@ function ignoreRender(ui, value) {
|
|
|
10288
10230
|
|
|
10289
10231
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
10290
10232
|
|
|
10291
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
10233
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
10292
10234
|
|
|
10293
10235
|
function createPattern(ui, paint, pixelRatio) {
|
|
10294
10236
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -10299,8 +10241,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10299
10241
|
scaleX *= pixelRatio;
|
|
10300
10242
|
scaleY *= pixelRatio;
|
|
10301
10243
|
if (sx) {
|
|
10302
|
-
sx = abs(sx);
|
|
10303
|
-
sy = abs(sy);
|
|
10244
|
+
sx = abs$1(sx);
|
|
10245
|
+
sy = abs$1(sy);
|
|
10304
10246
|
imageMatrix = get$1();
|
|
10305
10247
|
copy$1(imageMatrix, transform);
|
|
10306
10248
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -10442,6 +10384,7 @@ const PaintImageModule = {
|
|
|
10442
10384
|
recycleImage: recycleImage,
|
|
10443
10385
|
createData: createData,
|
|
10444
10386
|
getPatternData: getPatternData,
|
|
10387
|
+
stretchMode: stretchMode,
|
|
10445
10388
|
fillOrFitMode: fillOrFitMode,
|
|
10446
10389
|
clipMode: clipMode,
|
|
10447
10390
|
repeatMode: repeatMode
|
|
@@ -10552,7 +10495,7 @@ const PaintGradientModule = {
|
|
|
10552
10495
|
getTransform: getTransform
|
|
10553
10496
|
};
|
|
10554
10497
|
|
|
10555
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
10498
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
10556
10499
|
|
|
10557
10500
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
10558
10501
|
|
|
@@ -10572,8 +10515,8 @@ function shadow(ui, current, shape) {
|
|
|
10572
10515
|
const sx = Math.abs(nowWorld.scaleX);
|
|
10573
10516
|
if (sx > 1) otherScale = 1 / sx;
|
|
10574
10517
|
}
|
|
10575
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
10576
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
10518
|
+
other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, ColorConvert.string(item.color));
|
|
10519
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
10577
10520
|
if (transform) other.setTransform(transform);
|
|
10578
10521
|
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
10579
10522
|
if (transform) other.resetTransform();
|
|
@@ -10596,7 +10539,7 @@ function shadow(ui, current, shape) {
|
|
|
10596
10539
|
function getShadowRenderSpread(_ui, shadow) {
|
|
10597
10540
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
10598
10541
|
shadow.forEach(item => {
|
|
10599
|
-
x = item.x || 0, y = item.y || 0,
|
|
10542
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
10600
10543
|
top = max(top, spread + blur - y);
|
|
10601
10544
|
right = max(right, spread + blur + x);
|
|
10602
10545
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -10649,8 +10592,8 @@ function innerShadow(ui, current, shape) {
|
|
|
10649
10592
|
if (sx > 1) otherScale = 1 / sx;
|
|
10650
10593
|
}
|
|
10651
10594
|
other.save();
|
|
10652
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
10653
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
10595
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
10596
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
10654
10597
|
if (transform) other.setTransform(transform);
|
|
10655
10598
|
drawWorldShadow(other, offsetOutBounds, shape);
|
|
10656
10599
|
other.restore();
|
|
@@ -11286,6 +11229,7 @@ const TextConvertModule = {
|
|
|
11286
11229
|
};
|
|
11287
11230
|
|
|
11288
11231
|
function string(color, opacity) {
|
|
11232
|
+
if (!color) return "#000";
|
|
11289
11233
|
const doOpacity = isNumber(opacity) && opacity < 1;
|
|
11290
11234
|
if (isString(color)) {
|
|
11291
11235
|
if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
|
|
@@ -11314,4 +11258,4 @@ Object.assign(Effect, EffectModule);
|
|
|
11314
11258
|
|
|
11315
11259
|
useCanvas();
|
|
11316
11260
|
|
|
11317
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9,
|
|
11261
|
+
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 };
|