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.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$f = 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$c = 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$b = 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$a = 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
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6414
6418
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6415
6419
|
set zIndex(zIndex) {
|
|
@@ -7582,12 +7586,12 @@ var LeaferUI = function(exports) {
|
|
|
7582
7586
|
}
|
|
7583
7587
|
__getData() {
|
|
7584
7588
|
const data = super.__getData();
|
|
7585
|
-
delete data.fill;
|
|
7589
|
+
if (data.url) delete data.fill;
|
|
7586
7590
|
return data;
|
|
7587
7591
|
}
|
|
7588
7592
|
__getInputData(names, options) {
|
|
7589
7593
|
const data = super.__getInputData(names, options);
|
|
7590
|
-
delete data.fill;
|
|
7594
|
+
if (data.url) delete data.fill;
|
|
7591
7595
|
return data;
|
|
7592
7596
|
}
|
|
7593
7597
|
}
|
|
@@ -7640,70 +7644,6 @@ var LeaferUI = function(exports) {
|
|
|
7640
7644
|
return box ? max$2(box.__updateRenderSpread(), spread) : spread;
|
|
7641
7645
|
}
|
|
7642
7646
|
};
|
|
7643
|
-
const {float: float} = MathHelper;
|
|
7644
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7645
|
-
const DragBoundsHelper = {
|
|
7646
|
-
limitMove(leaf, move) {
|
|
7647
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7648
|
-
if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7649
|
-
D.axisMove(leaf, move);
|
|
7650
|
-
},
|
|
7651
|
-
limitScaleOf(leaf, origin, scale) {
|
|
7652
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7653
|
-
if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7654
|
-
},
|
|
7655
|
-
axisMove(leaf, move) {
|
|
7656
|
-
const {draggable: draggable} = leaf;
|
|
7657
|
-
if (draggable === "x") move.y = 0;
|
|
7658
|
-
if (draggable === "y") move.x = 0;
|
|
7659
|
-
},
|
|
7660
|
-
getDragBounds(leaf) {
|
|
7661
|
-
const {dragBounds: dragBounds} = leaf;
|
|
7662
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7663
|
-
},
|
|
7664
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7665
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7666
|
-
},
|
|
7667
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7668
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7669
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7670
|
-
if (!change) move = Object.assign({}, move);
|
|
7671
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7672
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7673
|
-
} else {
|
|
7674
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7675
|
-
}
|
|
7676
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7677
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7678
|
-
} else {
|
|
7679
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7680
|
-
}
|
|
7681
|
-
move.x = float(move.x);
|
|
7682
|
-
move.y = float(move.y);
|
|
7683
|
-
return move;
|
|
7684
|
-
},
|
|
7685
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7686
|
-
if (!change) scale = Object.assign({}, scale);
|
|
7687
|
-
let fitScaleX, fitScaleY;
|
|
7688
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7689
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
7690
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7691
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7692
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
7693
|
-
} else {
|
|
7694
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7695
|
-
}
|
|
7696
|
-
if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7697
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
7698
|
-
} else {
|
|
7699
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7700
|
-
}
|
|
7701
|
-
scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7702
|
-
scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7703
|
-
return scale;
|
|
7704
|
-
}
|
|
7705
|
-
};
|
|
7706
|
-
const D = DragBoundsHelper;
|
|
7707
7647
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7708
7648
|
const UIRender = {
|
|
7709
7649
|
__updateChange() {
|
|
@@ -9298,7 +9238,13 @@ var LeaferUI = function(exports) {
|
|
|
9298
9238
|
shape: shape
|
|
9299
9239
|
};
|
|
9300
9240
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
9301
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9241
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
9242
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
9243
|
+
const transform = get$3();
|
|
9244
|
+
translate$1(transform, box.x, box.y);
|
|
9245
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
9246
|
+
data.transform = transform;
|
|
9247
|
+
}
|
|
9302
9248
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9303
9249
|
const transform = get$3();
|
|
9304
9250
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -9313,8 +9259,11 @@ var LeaferUI = function(exports) {
|
|
|
9313
9259
|
const transform = get$3();
|
|
9314
9260
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
9315
9261
|
if (clipScaleX) {
|
|
9316
|
-
|
|
9317
|
-
|
|
9262
|
+
if (rotation || skew) {
|
|
9263
|
+
set(tempMatrix$1);
|
|
9264
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
9265
|
+
multiplyParent(transform, tempMatrix$1);
|
|
9266
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
9318
9267
|
}
|
|
9319
9268
|
data.transform = transform;
|
|
9320
9269
|
}
|
|
@@ -9402,7 +9351,10 @@ var LeaferUI = function(exports) {
|
|
|
9402
9351
|
if (offset) PointHelper.move(tempImage, offset);
|
|
9403
9352
|
switch (mode) {
|
|
9404
9353
|
case "stretch":
|
|
9405
|
-
if (!sameBox)
|
|
9354
|
+
if (!sameBox) {
|
|
9355
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
9356
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
9357
|
+
}
|
|
9406
9358
|
break;
|
|
9407
9359
|
|
|
9408
9360
|
case "normal":
|
|
@@ -9411,7 +9363,7 @@ var LeaferUI = function(exports) {
|
|
|
9411
9363
|
let clipScaleX, clipScaleY;
|
|
9412
9364
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
9413
9365
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
9414
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
9366
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
9415
9367
|
}
|
|
9416
9368
|
break;
|
|
9417
9369
|
|
|
@@ -9428,17 +9380,14 @@ var LeaferUI = function(exports) {
|
|
|
9428
9380
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9429
9381
|
}
|
|
9430
9382
|
if (!data.transform) {
|
|
9431
|
-
if (box.x || box.y)
|
|
9432
|
-
data.transform = get$2();
|
|
9433
|
-
translate(data.transform, box.x, box.y);
|
|
9434
|
-
}
|
|
9383
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
9435
9384
|
}
|
|
9436
|
-
|
|
9385
|
+
data.width = width;
|
|
9386
|
+
data.height = height;
|
|
9387
|
+
if (scaleX) {
|
|
9437
9388
|
data.scaleX = scaleX;
|
|
9438
9389
|
data.scaleY = scaleY;
|
|
9439
9390
|
}
|
|
9440
|
-
data.width = width;
|
|
9441
|
-
data.height = height;
|
|
9442
9391
|
if (opacity) data.opacity = opacity;
|
|
9443
9392
|
if (filters) data.filters = filters;
|
|
9444
9393
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -9557,7 +9506,7 @@ var LeaferUI = function(exports) {
|
|
|
9557
9506
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
9558
9507
|
}
|
|
9559
9508
|
const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
|
|
9560
|
-
const {floor: floor, ceil: ceil, max: max$1, abs: abs} = Math;
|
|
9509
|
+
const {floor: floor, ceil: ceil, max: max$1, abs: abs$1} = Math;
|
|
9561
9510
|
function createPattern(ui, paint, pixelRatio) {
|
|
9562
9511
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9563
9512
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -9567,8 +9516,8 @@ var LeaferUI = function(exports) {
|
|
|
9567
9516
|
scaleX *= pixelRatio;
|
|
9568
9517
|
scaleY *= pixelRatio;
|
|
9569
9518
|
if (sx) {
|
|
9570
|
-
sx = abs(sx);
|
|
9571
|
-
sy = abs(sy);
|
|
9519
|
+
sx = abs$1(sx);
|
|
9520
|
+
sy = abs$1(sy);
|
|
9572
9521
|
imageMatrix = get$1();
|
|
9573
9522
|
copy$1(imageMatrix, transform);
|
|
9574
9523
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -9706,6 +9655,7 @@ var LeaferUI = function(exports) {
|
|
|
9706
9655
|
recycleImage: recycleImage,
|
|
9707
9656
|
createData: createData,
|
|
9708
9657
|
getPatternData: getPatternData,
|
|
9658
|
+
stretchMode: stretchMode,
|
|
9709
9659
|
fillOrFitMode: fillOrFitMode,
|
|
9710
9660
|
clipMode: clipMode,
|
|
9711
9661
|
repeatMode: repeatMode
|
|
@@ -9797,7 +9747,7 @@ var LeaferUI = function(exports) {
|
|
|
9797
9747
|
conicGradient: conicGradient,
|
|
9798
9748
|
getTransform: getTransform
|
|
9799
9749
|
};
|
|
9800
|
-
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max} = Math;
|
|
9750
|
+
const {copy: copy, move: move, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max, abs: abs} = Math;
|
|
9801
9751
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
9802
9752
|
const offsetOutBounds$1 = {};
|
|
9803
9753
|
function shadow(ui, current, shape) {
|
|
@@ -9837,7 +9787,7 @@ var LeaferUI = function(exports) {
|
|
|
9837
9787
|
function getShadowRenderSpread(_ui, shadow) {
|
|
9838
9788
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
9839
9789
|
shadow.forEach(item => {
|
|
9840
|
-
x = item.x || 0, y = item.y || 0,
|
|
9790
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs(item.spread || 0);
|
|
9841
9791
|
top = max(top, spread + blur - y);
|
|
9842
9792
|
right = max(right, spread + blur + x);
|
|
9843
9793
|
bottom = max(bottom, spread + blur + y);
|
|
@@ -9847,11 +9797,11 @@ var LeaferUI = function(exports) {
|
|
|
9847
9797
|
}
|
|
9848
9798
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
9849
9799
|
if (shadow.spread) {
|
|
9850
|
-
const
|
|
9800
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
9851
9801
|
tempMatrix.set().scaleOfOuter({
|
|
9852
9802
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
9853
9803
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
9854
|
-
},
|
|
9804
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
9855
9805
|
return tempMatrix;
|
|
9856
9806
|
}
|
|
9857
9807
|
return undefined;
|
|
@@ -10497,7 +10447,6 @@ var LeaferUI = function(exports) {
|
|
|
10497
10447
|
exports.Creator = Creator;
|
|
10498
10448
|
exports.DataHelper = DataHelper;
|
|
10499
10449
|
exports.Debug = Debug;
|
|
10500
|
-
exports.DragBoundsHelper = DragBoundsHelper;
|
|
10501
10450
|
exports.Effect = Effect;
|
|
10502
10451
|
exports.EllipseData = EllipseData;
|
|
10503
10452
|
exports.EllipseHelper = EllipseHelper;
|