@leafer-draw/worker 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/worker.cjs +33 -21
- package/dist/worker.esm.js +34 -22
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +79 -133
- 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 +81 -137
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/worker.js
CHANGED
|
@@ -243,7 +243,7 @@ var LeaferUI = function(exports) {
|
|
|
243
243
|
return to;
|
|
244
244
|
},
|
|
245
245
|
setTemp(top, right, bottom, left) {
|
|
246
|
-
return set$
|
|
246
|
+
return set$2(tempFour, top, right, bottom, left);
|
|
247
247
|
},
|
|
248
248
|
toTempAB(a, b, change) {
|
|
249
249
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -283,21 +283,21 @@ var LeaferUI = function(exports) {
|
|
|
283
283
|
max(t, other, change) {
|
|
284
284
|
if (isNumber(t) && isNumber(other)) return max$4(t, other);
|
|
285
285
|
toTempAB(t, other, change);
|
|
286
|
-
return set$
|
|
286
|
+
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]));
|
|
287
287
|
},
|
|
288
288
|
add(t, other, change) {
|
|
289
289
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
290
290
|
toTempAB(t, other, change);
|
|
291
|
-
return set$
|
|
291
|
+
return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
292
292
|
},
|
|
293
293
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
294
294
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
295
295
|
const to = change ? t : [];
|
|
296
296
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
297
|
-
return set$
|
|
297
|
+
return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
|
-
const {set: set$
|
|
300
|
+
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
301
301
|
const {round: round$3, pow: pow$1, PI: PI$3} = Math;
|
|
302
302
|
const MathHelper = {
|
|
303
303
|
within(value, min, max) {
|
|
@@ -386,7 +386,7 @@ var LeaferUI = function(exports) {
|
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
389
|
-
const {float: float$
|
|
389
|
+
const {float: float$1} = MathHelper;
|
|
390
390
|
const tempPoint$3 = {};
|
|
391
391
|
function getWorld() {
|
|
392
392
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -634,12 +634,12 @@ var LeaferUI = function(exports) {
|
|
|
634
634
|
const cosR = c / scaleY;
|
|
635
635
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
636
636
|
}
|
|
637
|
-
const cosR = float$
|
|
637
|
+
const cosR = float$1(cos$5(rotation));
|
|
638
638
|
const sinR = sin$5(rotation);
|
|
639
|
-
scaleX = float$
|
|
640
|
-
skewX = cosR ? float$
|
|
641
|
-
skewY = cosR ? float$
|
|
642
|
-
rotation = float$
|
|
639
|
+
scaleX = float$1(scaleX), scaleY = float$1(scaleY);
|
|
640
|
+
skewX = cosR ? float$1((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
641
|
+
skewY = cosR ? float$1((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
642
|
+
rotation = float$1(rotation / OneRadian);
|
|
643
643
|
} else {
|
|
644
644
|
scaleX = a;
|
|
645
645
|
scaleY = d;
|
|
@@ -682,7 +682,7 @@ var LeaferUI = function(exports) {
|
|
|
682
682
|
};
|
|
683
683
|
const M$6 = MatrixHelper;
|
|
684
684
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
685
|
-
const {sin: sin$4, cos: cos$4, abs: abs$
|
|
685
|
+
const {sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
|
|
686
686
|
const PointHelper = {
|
|
687
687
|
defaultPoint: getPointData(),
|
|
688
688
|
tempPoint: {},
|
|
@@ -774,8 +774,8 @@ var LeaferUI = function(exports) {
|
|
|
774
774
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
775
775
|
},
|
|
776
776
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
777
|
-
const x = abs$
|
|
778
|
-
const y = abs$
|
|
777
|
+
const x = abs$4(x2 - x1);
|
|
778
|
+
const y = abs$4(y2 - y1);
|
|
779
779
|
return sqrt$2(x * x + y * y);
|
|
780
780
|
},
|
|
781
781
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -1140,7 +1140,7 @@ var LeaferUI = function(exports) {
|
|
|
1140
1140
|
};
|
|
1141
1141
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
1142
1142
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1143
|
-
const {float: float
|
|
1143
|
+
const {float: float, fourNumber: fourNumber} = MathHelper;
|
|
1144
1144
|
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1145
1145
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
1146
1146
|
const point = {};
|
|
@@ -1309,10 +1309,10 @@ var LeaferUI = function(exports) {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
},
|
|
1311
1311
|
float(t, maxLength) {
|
|
1312
|
-
t.x = float
|
|
1313
|
-
t.y = float
|
|
1314
|
-
t.width = float
|
|
1315
|
-
t.height = float
|
|
1312
|
+
t.x = float(t.x, maxLength);
|
|
1313
|
+
t.y = float(t.y, maxLength);
|
|
1314
|
+
t.width = float(t.width, maxLength);
|
|
1315
|
+
t.height = float(t.height, maxLength);
|
|
1316
1316
|
},
|
|
1317
1317
|
add(t, bounds, isPoint) {
|
|
1318
1318
|
right$1 = t.x + t.width;
|
|
@@ -1640,17 +1640,17 @@ var LeaferUI = function(exports) {
|
|
|
1640
1640
|
showHit ? canvas.stroke() : canvas.strokeWorld(w, color);
|
|
1641
1641
|
}
|
|
1642
1642
|
log(...messages) {
|
|
1643
|
-
if (D$
|
|
1644
|
-
if (D$
|
|
1645
|
-
if (D$
|
|
1643
|
+
if (D$4.enable) {
|
|
1644
|
+
if (D$4.filterList.length && D$4.filterList.every(name => name !== this.name)) return;
|
|
1645
|
+
if (D$4.excludeList.length && D$4.excludeList.some(name => name === this.name)) return;
|
|
1646
1646
|
console.log("%c" + this.name, "color:#21ae62", ...messages);
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
1649
|
tip(...messages) {
|
|
1650
|
-
if (D$
|
|
1650
|
+
if (D$4.enable) this.warn(...messages);
|
|
1651
1651
|
}
|
|
1652
1652
|
warn(...messages) {
|
|
1653
|
-
if (D$
|
|
1653
|
+
if (D$4.showWarn) console.warn(this.name, ...messages);
|
|
1654
1654
|
}
|
|
1655
1655
|
repeat(name, ...messages) {
|
|
1656
1656
|
if (!this.repeatMap[name]) {
|
|
@@ -1673,7 +1673,7 @@ var LeaferUI = function(exports) {
|
|
|
1673
1673
|
if (!name) name = []; else if (isString(name)) name = [ name ];
|
|
1674
1674
|
return name;
|
|
1675
1675
|
}
|
|
1676
|
-
const D$
|
|
1676
|
+
const D$4 = Debug;
|
|
1677
1677
|
const debug$e = Debug.get("RunTime");
|
|
1678
1678
|
const Run = {
|
|
1679
1679
|
currentId: 0,
|
|
@@ -2417,9 +2417,9 @@ var LeaferUI = function(exports) {
|
|
|
2417
2417
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2418
2418
|
}
|
|
2419
2419
|
};
|
|
2420
|
-
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2420
|
+
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;
|
|
2421
2421
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2422
|
-
const {set: set, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2422
|
+
const {set: set$1, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2423
2423
|
const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
|
|
2424
2424
|
const tempPoint$1 = {};
|
|
2425
2425
|
const BezierHelper = {
|
|
@@ -2487,14 +2487,14 @@ var LeaferUI = function(exports) {
|
|
|
2487
2487
|
const lenCB = hypot(CBx, CBy);
|
|
2488
2488
|
let totalRadian = endRadian - startRadian;
|
|
2489
2489
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2490
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2490
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$3(totalRadian - PI$2) < 1e-12) {
|
|
2491
2491
|
if (data) data.push(L$6, x1, y1);
|
|
2492
2492
|
if (setPointBounds) {
|
|
2493
2493
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
2494
2494
|
addPoint$1(setPointBounds, x1, y1);
|
|
2495
2495
|
}
|
|
2496
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2497
|
-
if (setEndPoint) set(setEndPoint, x1, y1);
|
|
2496
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2497
|
+
if (setEndPoint) set$1(setEndPoint, x1, y1);
|
|
2498
2498
|
return;
|
|
2499
2499
|
}
|
|
2500
2500
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2520,7 +2520,7 @@ var LeaferUI = function(exports) {
|
|
|
2520
2520
|
let totalRadian = endRadian - startRadian;
|
|
2521
2521
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2522
2522
|
if (anticlockwise) totalRadian -= PI2;
|
|
2523
|
-
const parts = ceil$1(abs$
|
|
2523
|
+
const parts = ceil$1(abs$3(totalRadian / PI_2));
|
|
2524
2524
|
const partRadian = totalRadian / parts;
|
|
2525
2525
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2526
2526
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2534,7 +2534,7 @@ var LeaferUI = function(exports) {
|
|
|
2534
2534
|
let fromX = cx + x, fromY = cy + y;
|
|
2535
2535
|
if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2536
2536
|
if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
|
|
2537
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2537
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2538
2538
|
for (let i = 0; i < parts; i++) {
|
|
2539
2539
|
endCos = cos$3(endRadian);
|
|
2540
2540
|
endSin = sin$3(endRadian);
|
|
@@ -2553,7 +2553,7 @@ var LeaferUI = function(exports) {
|
|
|
2553
2553
|
startRadian = endRadian;
|
|
2554
2554
|
endRadian += partRadian;
|
|
2555
2555
|
}
|
|
2556
|
-
if (setEndPoint) set(setEndPoint, cx + x, cy + y);
|
|
2556
|
+
if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
|
|
2557
2557
|
},
|
|
2558
2558
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2559
2559
|
data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2657,7 +2657,7 @@ var LeaferUI = function(exports) {
|
|
|
2657
2657
|
}
|
|
2658
2658
|
}
|
|
2659
2659
|
};
|
|
2660
|
-
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$
|
|
2660
|
+
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;
|
|
2661
2661
|
const {rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2662
2662
|
const {ellipticalArc: ellipticalArc} = EllipseHelper;
|
|
2663
2663
|
const debug$b = Debug.get("PathConvert");
|
|
@@ -2872,7 +2872,7 @@ var LeaferUI = function(exports) {
|
|
|
2872
2872
|
i += 5;
|
|
2873
2873
|
break;
|
|
2874
2874
|
|
|
2875
|
-
case D$
|
|
2875
|
+
case D$3:
|
|
2876
2876
|
x = old[i + 1];
|
|
2877
2877
|
y = old[i + 2];
|
|
2878
2878
|
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);
|
|
@@ -2971,9 +2971,9 @@ var LeaferUI = function(exports) {
|
|
|
2971
2971
|
}
|
|
2972
2972
|
};
|
|
2973
2973
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
2974
|
-
const {M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$
|
|
2974
|
+
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;
|
|
2975
2975
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
2976
|
-
const {tan: tan, min: min, abs: abs$
|
|
2976
|
+
const {tan: tan, min: min, abs: abs$2} = Math;
|
|
2977
2977
|
const startPoint = {};
|
|
2978
2978
|
const PathCommandDataHelper = {
|
|
2979
2979
|
beginPath(data) {
|
|
@@ -3003,7 +3003,7 @@ var LeaferUI = function(exports) {
|
|
|
3003
3003
|
} else {
|
|
3004
3004
|
const fourCorners = MathHelper.fourNumber(cornerRadius);
|
|
3005
3005
|
if (fourCorners) {
|
|
3006
|
-
data.push(D$
|
|
3006
|
+
data.push(D$2, x, y, width, height, ...fourCorners);
|
|
3007
3007
|
} else {
|
|
3008
3008
|
data.push(N$2, x, y, width, height);
|
|
3009
3009
|
}
|
|
@@ -3029,7 +3029,7 @@ var LeaferUI = function(exports) {
|
|
|
3029
3029
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3030
3030
|
if (!isUndefined(lastX)) {
|
|
3031
3031
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3032
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3032
|
+
radius = min(radius, min(d / 2, d / 2 * abs$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3033
3033
|
}
|
|
3034
3034
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3035
3035
|
},
|
|
@@ -3138,7 +3138,7 @@ var LeaferUI = function(exports) {
|
|
|
3138
3138
|
}
|
|
3139
3139
|
paint() {}
|
|
3140
3140
|
}
|
|
3141
|
-
const {M: M$2, L: L$3, C: C$1, Q: Q$1, Z: Z$2, N: N$1, D: D$
|
|
3141
|
+
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;
|
|
3142
3142
|
const debug$a = Debug.get("PathDrawer");
|
|
3143
3143
|
const PathDrawer = {
|
|
3144
3144
|
drawPathByData(drawer, data) {
|
|
@@ -3178,7 +3178,7 @@ var LeaferUI = function(exports) {
|
|
|
3178
3178
|
i += 5;
|
|
3179
3179
|
break;
|
|
3180
3180
|
|
|
3181
|
-
case D$
|
|
3181
|
+
case D$1:
|
|
3182
3182
|
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] ]);
|
|
3183
3183
|
i += 9;
|
|
3184
3184
|
break;
|
|
@@ -3220,7 +3220,7 @@ var LeaferUI = function(exports) {
|
|
|
3220
3220
|
}
|
|
3221
3221
|
}
|
|
3222
3222
|
};
|
|
3223
|
-
const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D
|
|
3223
|
+
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;
|
|
3224
3224
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3225
3225
|
const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
|
|
3226
3226
|
const debug$9 = Debug.get("PathBounds");
|
|
@@ -3288,12 +3288,12 @@ var LeaferUI = function(exports) {
|
|
|
3288
3288
|
i += 5;
|
|
3289
3289
|
break;
|
|
3290
3290
|
|
|
3291
|
-
case D
|
|
3291
|
+
case D:
|
|
3292
3292
|
case X:
|
|
3293
3293
|
x = data[i + 1];
|
|
3294
3294
|
y = data[i + 2];
|
|
3295
3295
|
addBounds(setPointBounds, x, y, data[i + 3], data[i + 4]);
|
|
3296
|
-
i += command === D
|
|
3296
|
+
i += command === D ? 9 : 6;
|
|
3297
3297
|
break;
|
|
3298
3298
|
|
|
3299
3299
|
case G:
|
|
@@ -6409,7 +6409,7 @@ var LeaferUI = function(exports) {
|
|
|
6409
6409
|
this.levelMap = null;
|
|
6410
6410
|
}
|
|
6411
6411
|
}
|
|
6412
|
-
const version = "1.9.
|
|
6412
|
+
const version = "1.9.10";
|
|
6413
6413
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6414
6414
|
get allowBackgroundColor() {
|
|
6415
6415
|
return true;
|
|
@@ -7376,12 +7376,12 @@ var LeaferUI = function(exports) {
|
|
|
7376
7376
|
}
|
|
7377
7377
|
__getData() {
|
|
7378
7378
|
const data = super.__getData();
|
|
7379
|
-
delete data.fill;
|
|
7379
|
+
if (data.url) delete data.fill;
|
|
7380
7380
|
return data;
|
|
7381
7381
|
}
|
|
7382
7382
|
__getInputData(names, options) {
|
|
7383
7383
|
const data = super.__getInputData(names, options);
|
|
7384
|
-
delete data.fill;
|
|
7384
|
+
if (data.url) delete data.fill;
|
|
7385
7385
|
return data;
|
|
7386
7386
|
}
|
|
7387
7387
|
}
|
|
@@ -7434,70 +7434,6 @@ var LeaferUI = function(exports) {
|
|
|
7434
7434
|
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
7435
7435
|
}
|
|
7436
7436
|
};
|
|
7437
|
-
const {float: float} = MathHelper;
|
|
7438
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7439
|
-
const DragBoundsHelper = {
|
|
7440
|
-
limitMove(leaf, move) {
|
|
7441
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7442
|
-
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7443
|
-
D.axisMove(leaf, move);
|
|
7444
|
-
},
|
|
7445
|
-
limitScaleOf(leaf, origin, scale) {
|
|
7446
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7447
|
-
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7448
|
-
},
|
|
7449
|
-
axisMove(leaf, move) {
|
|
7450
|
-
const {draggable: draggable} = leaf;
|
|
7451
|
-
if (draggable === "x") move.y = 0;
|
|
7452
|
-
if (draggable === "y") move.x = 0;
|
|
7453
|
-
},
|
|
7454
|
-
getDragBounds(leaf) {
|
|
7455
|
-
const {dragBounds: dragBounds} = leaf;
|
|
7456
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7457
|
-
},
|
|
7458
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7459
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7460
|
-
},
|
|
7461
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7462
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7463
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7464
|
-
if (!change) move = Object.assign({}, move);
|
|
7465
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7466
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7467
|
-
} else {
|
|
7468
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7469
|
-
}
|
|
7470
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7471
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7472
|
-
} else {
|
|
7473
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7474
|
-
}
|
|
7475
|
-
move.x = float(move.x);
|
|
7476
|
-
move.y = float(move.y);
|
|
7477
|
-
return move;
|
|
7478
|
-
},
|
|
7479
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7480
|
-
if (!change) scale = Object.assign({}, scale);
|
|
7481
|
-
let fitScaleX, fitScaleY;
|
|
7482
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7483
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
7484
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7485
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7486
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
7487
|
-
} else {
|
|
7488
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7489
|
-
}
|
|
7490
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7491
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
7492
|
-
} else {
|
|
7493
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7494
|
-
}
|
|
7495
|
-
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7496
|
-
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7497
|
-
return scale;
|
|
7498
|
-
}
|
|
7499
|
-
};
|
|
7500
|
-
const D = DragBoundsHelper;
|
|
7501
7437
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7502
7438
|
const UIRender = {
|
|
7503
7439
|
__updateChange() {
|
|
@@ -9092,7 +9028,13 @@ var LeaferUI = function(exports) {
|
|
|
9092
9028
|
shape: shape
|
|
9093
9029
|
};
|
|
9094
9030
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
9095
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9031
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9032
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
9033
|
+
const transform = get$3();
|
|
9034
|
+
translate$1(transform, box.x, box.y);
|
|
9035
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
9036
|
+
data.transform = transform;
|
|
9037
|
+
}
|
|
9096
9038
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9097
9039
|
const transform = get$3();
|
|
9098
9040
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -9107,8 +9049,11 @@ var LeaferUI = function(exports) {
|
|
|
9107
9049
|
const transform = get$3();
|
|
9108
9050
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
9109
9051
|
if (clipScaleX) {
|
|
9110
|
-
|
|
9111
|
-
|
|
9052
|
+
if (rotation || skew) {
|
|
9053
|
+
set(tempMatrix$1);
|
|
9054
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
9055
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9056
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
9112
9057
|
}
|
|
9113
9058
|
data.transform = transform;
|
|
9114
9059
|
}
|
|
@@ -9196,7 +9141,10 @@ var LeaferUI = function(exports) {
|
|
|
9196
9141
|
if (offset) PointHelper.move(tempImage, offset);
|
|
9197
9142
|
switch (mode) {
|
|
9198
9143
|
case "stretch":
|
|
9199
|
-
if (!sameBox)
|
|
9144
|
+
if (!sameBox) {
|
|
9145
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
9146
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
9147
|
+
}
|
|
9200
9148
|
break;
|
|
9201
9149
|
|
|
9202
9150
|
case "normal":
|
|
@@ -9205,7 +9153,7 @@ var LeaferUI = function(exports) {
|
|
|
9205
9153
|
let clipScaleX, clipScaleY;
|
|
9206
9154
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
9207
9155
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
9208
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
9156
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
9209
9157
|
}
|
|
9210
9158
|
break;
|
|
9211
9159
|
|
|
@@ -9222,17 +9170,14 @@ var LeaferUI = function(exports) {
|
|
|
9222
9170
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9223
9171
|
}
|
|
9224
9172
|
if (!data.transform) {
|
|
9225
|
-
if (box.x || box.y)
|
|
9226
|
-
data.transform = get$2();
|
|
9227
|
-
translate(data.transform, box.x, box.y);
|
|
9228
|
-
}
|
|
9173
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
9229
9174
|
}
|
|
9230
|
-
|
|
9175
|
+
data.width = width;
|
|
9176
|
+
data.height = height;
|
|
9177
|
+
if (scaleX) {
|
|
9231
9178
|
data.scaleX = scaleX;
|
|
9232
9179
|
data.scaleY = scaleY;
|
|
9233
9180
|
}
|
|
9234
|
-
data.width = width;
|
|
9235
|
-
data.height = height;
|
|
9236
9181
|
if (opacity) data.opacity = opacity;
|
|
9237
9182
|
if (filters) data.filters = filters;
|
|
9238
9183
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -9351,7 +9296,7 @@ var LeaferUI = function(exports) {
|
|
|
9351
9296
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
9352
9297
|
}
|
|
9353
9298
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
9354
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
9299
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
9355
9300
|
function createPattern(ui, paint, pixelRatio) {
|
|
9356
9301
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9357
9302
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -9361,8 +9306,8 @@ var LeaferUI = function(exports) {
|
|
|
9361
9306
|
scaleX *= pixelRatio;
|
|
9362
9307
|
scaleY *= pixelRatio;
|
|
9363
9308
|
if (sx) {
|
|
9364
|
-
sx = abs(sx);
|
|
9365
|
-
sy = abs(sy);
|
|
9309
|
+
sx = abs$1(sx);
|
|
9310
|
+
sy = abs$1(sy);
|
|
9366
9311
|
imageMatrix = get$1();
|
|
9367
9312
|
copy$1(imageMatrix, transform);
|
|
9368
9313
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -9500,6 +9445,7 @@ var LeaferUI = function(exports) {
|
|
|
9500
9445
|
recycleImage: recycleImage,
|
|
9501
9446
|
createData: createData,
|
|
9502
9447
|
getPatternData: getPatternData,
|
|
9448
|
+
stretchMode: stretchMode,
|
|
9503
9449
|
fillOrFitMode: fillOrFitMode,
|
|
9504
9450
|
clipMode: clipMode,
|
|
9505
9451
|
repeatMode: repeatMode
|
|
@@ -9591,7 +9537,7 @@ var LeaferUI = function(exports) {
|
|
|
9591
9537
|
conicGradient: conicGradient,
|
|
9592
9538
|
getTransform: getTransform
|
|
9593
9539
|
};
|
|
9594
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
9540
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
9595
9541
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
9596
9542
|
const offsetOutBounds$1 = {};
|
|
9597
9543
|
function shadow(ui, current, shape) {
|
|
@@ -9608,8 +9554,8 @@ var LeaferUI = function(exports) {
|
|
|
9608
9554
|
const sx = Math.abs(nowWorld.scaleX);
|
|
9609
9555
|
if (sx > 1) otherScale = 1 / sx;
|
|
9610
9556
|
}
|
|
9611
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
9612
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
9557
|
+
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));
|
|
9558
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
9613
9559
|
if (transform) other.setTransform(transform);
|
|
9614
9560
|
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
9615
9561
|
if (transform) other.resetTransform();
|
|
@@ -9631,7 +9577,7 @@ var LeaferUI = function(exports) {
|
|
|
9631
9577
|
function getShadowRenderSpread(_ui, shadow) {
|
|
9632
9578
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
9633
9579
|
shadow.forEach(item => {
|
|
9634
|
-
x = item.x || 0, y = item.y || 0,
|
|
9580
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
9635
9581
|
top = max(top, spread + blur - y);
|
|
9636
9582
|
right = max(right, spread + blur + x);
|
|
9637
9583
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -9679,8 +9625,8 @@ var LeaferUI = function(exports) {
|
|
|
9679
9625
|
if (sx > 1) otherScale = 1 / sx;
|
|
9680
9626
|
}
|
|
9681
9627
|
other.save();
|
|
9682
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
9683
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
9628
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
9629
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
9684
9630
|
if (transform) other.setTransform(transform);
|
|
9685
9631
|
drawWorldShadow(other, offsetOutBounds, shape);
|
|
9686
9632
|
other.restore();
|
|
@@ -10254,6 +10200,7 @@ var LeaferUI = function(exports) {
|
|
|
10254
10200
|
getDrawData: getDrawData
|
|
10255
10201
|
};
|
|
10256
10202
|
function string(color, opacity) {
|
|
10203
|
+
if (!color) return "#000";
|
|
10257
10204
|
const doOpacity = isNumber(opacity) && opacity < 1;
|
|
10258
10205
|
if (isString(color)) {
|
|
10259
10206
|
if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
|
|
@@ -10290,7 +10237,6 @@ var LeaferUI = function(exports) {
|
|
|
10290
10237
|
exports.Creator = Creator;
|
|
10291
10238
|
exports.DataHelper = DataHelper;
|
|
10292
10239
|
exports.Debug = Debug;
|
|
10293
|
-
exports.DragBoundsHelper = DragBoundsHelper;
|
|
10294
10240
|
exports.Effect = Effect;
|
|
10295
10241
|
exports.EllipseData = EllipseData;
|
|
10296
10242
|
exports.EllipseHelper = EllipseHelper;
|