@leafer-draw/worker 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/worker.cjs +30 -19
- package/dist/worker.esm.js +30 -19
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +89 -140
- 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 +91 -144
- 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:
|
|
@@ -3611,7 +3611,12 @@ var LeaferUI = function(exports) {
|
|
|
3611
3611
|
runTask() {
|
|
3612
3612
|
const task = this.list[this.index];
|
|
3613
3613
|
if (!task) {
|
|
3614
|
-
this.nextTask();
|
|
3614
|
+
this.timer = setTimeout(() => this.nextTask());
|
|
3615
|
+
return;
|
|
3616
|
+
}
|
|
3617
|
+
if (task.isCancel) {
|
|
3618
|
+
this.index++;
|
|
3619
|
+
this.runTask();
|
|
3615
3620
|
return;
|
|
3616
3621
|
}
|
|
3617
3622
|
task.run().then(() => {
|
|
@@ -3642,16 +3647,15 @@ var LeaferUI = function(exports) {
|
|
|
3642
3647
|
}
|
|
3643
3648
|
setParallelList() {
|
|
3644
3649
|
let task;
|
|
3650
|
+
const {config: config, list: list, index: index} = this;
|
|
3645
3651
|
this.parallelList = [];
|
|
3646
3652
|
this.parallelSuccessNumber = 0;
|
|
3647
|
-
let end =
|
|
3648
|
-
if (end >
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
this.parallelList.push(task);
|
|
3653
|
-
} else {
|
|
3654
|
-
break;
|
|
3653
|
+
let end = index + config.parallel;
|
|
3654
|
+
if (end > list.length) end = list.length;
|
|
3655
|
+
if (config.parallel > 1) {
|
|
3656
|
+
for (let i = index; i < end; i++) {
|
|
3657
|
+
task = list[i];
|
|
3658
|
+
if (task.parallel) this.parallelList.push(task); else break;
|
|
3655
3659
|
}
|
|
3656
3660
|
}
|
|
3657
3661
|
}
|
|
@@ -6409,7 +6413,7 @@ var LeaferUI = function(exports) {
|
|
|
6409
6413
|
this.levelMap = null;
|
|
6410
6414
|
}
|
|
6411
6415
|
}
|
|
6412
|
-
const version = "1.9.
|
|
6416
|
+
const version = "1.9.11";
|
|
6413
6417
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6414
6418
|
get allowBackgroundColor() {
|
|
6415
6419
|
return true;
|
|
@@ -7376,12 +7380,12 @@ var LeaferUI = function(exports) {
|
|
|
7376
7380
|
}
|
|
7377
7381
|
__getData() {
|
|
7378
7382
|
const data = super.__getData();
|
|
7379
|
-
delete data.fill;
|
|
7383
|
+
if (data.url) delete data.fill;
|
|
7380
7384
|
return data;
|
|
7381
7385
|
}
|
|
7382
7386
|
__getInputData(names, options) {
|
|
7383
7387
|
const data = super.__getInputData(names, options);
|
|
7384
|
-
delete data.fill;
|
|
7388
|
+
if (data.url) delete data.fill;
|
|
7385
7389
|
return data;
|
|
7386
7390
|
}
|
|
7387
7391
|
}
|
|
@@ -7434,70 +7438,6 @@ var LeaferUI = function(exports) {
|
|
|
7434
7438
|
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
7435
7439
|
}
|
|
7436
7440
|
};
|
|
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
7441
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7502
7442
|
const UIRender = {
|
|
7503
7443
|
__updateChange() {
|
|
@@ -9092,7 +9032,13 @@ var LeaferUI = function(exports) {
|
|
|
9092
9032
|
shape: shape
|
|
9093
9033
|
};
|
|
9094
9034
|
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;
|
|
9035
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9036
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
9037
|
+
const transform = get$3();
|
|
9038
|
+
translate$1(transform, box.x, box.y);
|
|
9039
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
9040
|
+
data.transform = transform;
|
|
9041
|
+
}
|
|
9096
9042
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9097
9043
|
const transform = get$3();
|
|
9098
9044
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -9107,8 +9053,11 @@ var LeaferUI = function(exports) {
|
|
|
9107
9053
|
const transform = get$3();
|
|
9108
9054
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
9109
9055
|
if (clipScaleX) {
|
|
9110
|
-
|
|
9111
|
-
|
|
9056
|
+
if (rotation || skew) {
|
|
9057
|
+
set(tempMatrix$1);
|
|
9058
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
9059
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9060
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
9112
9061
|
}
|
|
9113
9062
|
data.transform = transform;
|
|
9114
9063
|
}
|
|
@@ -9196,7 +9145,10 @@ var LeaferUI = function(exports) {
|
|
|
9196
9145
|
if (offset) PointHelper.move(tempImage, offset);
|
|
9197
9146
|
switch (mode) {
|
|
9198
9147
|
case "stretch":
|
|
9199
|
-
if (!sameBox)
|
|
9148
|
+
if (!sameBox) {
|
|
9149
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
9150
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
9151
|
+
}
|
|
9200
9152
|
break;
|
|
9201
9153
|
|
|
9202
9154
|
case "normal":
|
|
@@ -9205,7 +9157,7 @@ var LeaferUI = function(exports) {
|
|
|
9205
9157
|
let clipScaleX, clipScaleY;
|
|
9206
9158
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
9207
9159
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
9208
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
9160
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
9209
9161
|
}
|
|
9210
9162
|
break;
|
|
9211
9163
|
|
|
@@ -9222,17 +9174,14 @@ var LeaferUI = function(exports) {
|
|
|
9222
9174
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9223
9175
|
}
|
|
9224
9176
|
if (!data.transform) {
|
|
9225
|
-
if (box.x || box.y)
|
|
9226
|
-
data.transform = get$2();
|
|
9227
|
-
translate(data.transform, box.x, box.y);
|
|
9228
|
-
}
|
|
9177
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
9229
9178
|
}
|
|
9230
|
-
|
|
9179
|
+
data.width = width;
|
|
9180
|
+
data.height = height;
|
|
9181
|
+
if (scaleX) {
|
|
9231
9182
|
data.scaleX = scaleX;
|
|
9232
9183
|
data.scaleY = scaleY;
|
|
9233
9184
|
}
|
|
9234
|
-
data.width = width;
|
|
9235
|
-
data.height = height;
|
|
9236
9185
|
if (opacity) data.opacity = opacity;
|
|
9237
9186
|
if (filters) data.filters = filters;
|
|
9238
9187
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -9351,7 +9300,7 @@ var LeaferUI = function(exports) {
|
|
|
9351
9300
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
9352
9301
|
}
|
|
9353
9302
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
9354
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
9303
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
9355
9304
|
function createPattern(ui, paint, pixelRatio) {
|
|
9356
9305
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9357
9306
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -9361,8 +9310,8 @@ var LeaferUI = function(exports) {
|
|
|
9361
9310
|
scaleX *= pixelRatio;
|
|
9362
9311
|
scaleY *= pixelRatio;
|
|
9363
9312
|
if (sx) {
|
|
9364
|
-
sx = abs(sx);
|
|
9365
|
-
sy = abs(sy);
|
|
9313
|
+
sx = abs$1(sx);
|
|
9314
|
+
sy = abs$1(sy);
|
|
9366
9315
|
imageMatrix = get$1();
|
|
9367
9316
|
copy$1(imageMatrix, transform);
|
|
9368
9317
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -9500,6 +9449,7 @@ var LeaferUI = function(exports) {
|
|
|
9500
9449
|
recycleImage: recycleImage,
|
|
9501
9450
|
createData: createData,
|
|
9502
9451
|
getPatternData: getPatternData,
|
|
9452
|
+
stretchMode: stretchMode,
|
|
9503
9453
|
fillOrFitMode: fillOrFitMode,
|
|
9504
9454
|
clipMode: clipMode,
|
|
9505
9455
|
repeatMode: repeatMode
|
|
@@ -9591,7 +9541,7 @@ var LeaferUI = function(exports) {
|
|
|
9591
9541
|
conicGradient: conicGradient,
|
|
9592
9542
|
getTransform: getTransform
|
|
9593
9543
|
};
|
|
9594
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
9544
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
9595
9545
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
9596
9546
|
const offsetOutBounds$1 = {};
|
|
9597
9547
|
function shadow(ui, current, shape) {
|
|
@@ -9631,7 +9581,7 @@ var LeaferUI = function(exports) {
|
|
|
9631
9581
|
function getShadowRenderSpread(_ui, shadow) {
|
|
9632
9582
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
9633
9583
|
shadow.forEach(item => {
|
|
9634
|
-
x = item.x || 0, y = item.y || 0,
|
|
9584
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
9635
9585
|
top = max(top, spread + blur - y);
|
|
9636
9586
|
right = max(right, spread + blur + x);
|
|
9637
9587
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -9641,11 +9591,11 @@ var LeaferUI = function(exports) {
|
|
|
9641
9591
|
}
|
|
9642
9592
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
9643
9593
|
if (shadow.spread) {
|
|
9644
|
-
const
|
|
9594
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
9645
9595
|
tempMatrix.set().scaleOfOuter({
|
|
9646
9596
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
9647
9597
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
9648
|
-
},
|
|
9598
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
9649
9599
|
return tempMatrix;
|
|
9650
9600
|
}
|
|
9651
9601
|
return undefined;
|
|
@@ -10291,7 +10241,6 @@ var LeaferUI = function(exports) {
|
|
|
10291
10241
|
exports.Creator = Creator;
|
|
10292
10242
|
exports.DataHelper = DataHelper;
|
|
10293
10243
|
exports.Debug = Debug;
|
|
10294
|
-
exports.DragBoundsHelper = DragBoundsHelper;
|
|
10295
10244
|
exports.Effect = Effect;
|
|
10296
10245
|
exports.EllipseData = EllipseData;
|
|
10297
10246
|
exports.EllipseHelper = EllipseHelper;
|