leafer-draw 2.1.5 → 2.1.7
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 +8 -5
- package/dist/web.esm.js +8 -5
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +94 -62
- 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 +94 -62
- 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
|
@@ -268,7 +268,7 @@ var LeaferUI = function(exports) {
|
|
|
268
268
|
return to;
|
|
269
269
|
},
|
|
270
270
|
setTemp(top, right, bottom, left) {
|
|
271
|
-
return set$
|
|
271
|
+
return set$3(tempFour, top, right, bottom, left);
|
|
272
272
|
},
|
|
273
273
|
toTempAB(a, b, change) {
|
|
274
274
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -308,21 +308,21 @@ var LeaferUI = function(exports) {
|
|
|
308
308
|
max(t, other, change) {
|
|
309
309
|
if (isNumber(t) && isNumber(other)) return max$4(t, other);
|
|
310
310
|
toTempAB(t, other, change);
|
|
311
|
-
return set$
|
|
311
|
+
return set$3(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]));
|
|
312
312
|
},
|
|
313
313
|
add(t, other, change) {
|
|
314
314
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
315
315
|
toTempAB(t, other, change);
|
|
316
|
-
return set$
|
|
316
|
+
return set$3(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
317
317
|
},
|
|
318
318
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
319
319
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
320
320
|
const to = change ? t : [];
|
|
321
321
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
322
|
-
return set$
|
|
322
|
+
return set$3(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
|
-
const {set: set$
|
|
325
|
+
const {set: set$3, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
326
326
|
const {round: round$3, pow: pow$1, max: max$3, floor: floor$2, PI: PI$3} = Math;
|
|
327
327
|
const tempScaleData$1 = {};
|
|
328
328
|
const MathHelper = {
|
|
@@ -434,7 +434,7 @@ var LeaferUI = function(exports) {
|
|
|
434
434
|
}
|
|
435
435
|
const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
|
|
436
436
|
const {float: float$2} = MathHelper;
|
|
437
|
-
const tempPoint$
|
|
437
|
+
const tempPoint$4 = {};
|
|
438
438
|
function getWorld() {
|
|
439
439
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
440
440
|
scaleX: 1,
|
|
@@ -491,8 +491,8 @@ var LeaferUI = function(exports) {
|
|
|
491
491
|
to.f = t.f * pixelRatio;
|
|
492
492
|
},
|
|
493
493
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
494
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
495
|
-
M$6.scaleOfInner(t, tempPoint$
|
|
494
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
495
|
+
M$6.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
496
496
|
},
|
|
497
497
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
498
498
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -510,8 +510,8 @@ var LeaferUI = function(exports) {
|
|
|
510
510
|
t.d = c * sinR + d * cosR;
|
|
511
511
|
},
|
|
512
512
|
rotateOfOuter(t, origin, rotation) {
|
|
513
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
514
|
-
M$6.rotateOfInner(t, tempPoint$
|
|
513
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
514
|
+
M$6.rotateOfInner(t, tempPoint$4, rotation);
|
|
515
515
|
},
|
|
516
516
|
rotateOfInner(t, origin, rotation) {
|
|
517
517
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -532,8 +532,8 @@ var LeaferUI = function(exports) {
|
|
|
532
532
|
}
|
|
533
533
|
},
|
|
534
534
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
535
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
536
|
-
M$6.skewOfInner(t, tempPoint$
|
|
535
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
536
|
+
M$6.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
537
537
|
},
|
|
538
538
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
539
539
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -730,7 +730,7 @@ var LeaferUI = function(exports) {
|
|
|
730
730
|
const M$6 = MatrixHelper;
|
|
731
731
|
const {float: float$1} = MathHelper;
|
|
732
732
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
733
|
-
const {sin: sin$4, cos: cos$4, abs: abs$
|
|
733
|
+
const {sin: sin$4, cos: cos$4, abs: abs$5, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2} = Math;
|
|
734
734
|
const PointHelper = {
|
|
735
735
|
defaultPoint: getPointData(),
|
|
736
736
|
tempPoint: {},
|
|
@@ -766,15 +766,15 @@ var LeaferUI = function(exports) {
|
|
|
766
766
|
t.x += (t.x - origin.x) * (scaleX - 1);
|
|
767
767
|
t.y += (t.y - origin.y) * (scaleY - 1);
|
|
768
768
|
},
|
|
769
|
-
rotate(t, rotation, origin) {
|
|
769
|
+
rotate(t, rotation, origin, radiusX = 1, radiusY = 1) {
|
|
770
770
|
if (!origin) origin = P$5.defaultPoint;
|
|
771
771
|
rotation *= OneRadian;
|
|
772
772
|
const cosR = cos$4(rotation);
|
|
773
773
|
const sinR = sin$4(rotation);
|
|
774
|
-
const rx = t.x - origin.x;
|
|
775
|
-
const ry = t.y - origin.y;
|
|
776
|
-
t.x = origin.x + rx * cosR - ry * sinR;
|
|
777
|
-
t.y = origin.y + rx * sinR + ry * cosR;
|
|
774
|
+
const rx = (t.x - origin.x) / radiusX;
|
|
775
|
+
const ry = (t.y - origin.y) / radiusY;
|
|
776
|
+
t.x = origin.x + (rx * cosR - ry * sinR) * radiusX;
|
|
777
|
+
t.y = origin.y + (rx * sinR + ry * cosR) * radiusY;
|
|
778
778
|
},
|
|
779
779
|
tempToInnerOf(t, matrix) {
|
|
780
780
|
const {tempPoint: temp} = P$5;
|
|
@@ -827,15 +827,15 @@ var LeaferUI = function(exports) {
|
|
|
827
827
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
828
828
|
},
|
|
829
829
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
830
|
-
const x = abs$
|
|
831
|
-
const y = abs$
|
|
830
|
+
const x = abs$5(x2 - x1);
|
|
831
|
+
const y = abs$5(y2 - y1);
|
|
832
832
|
return sqrt$2(x * x + y * y);
|
|
833
833
|
},
|
|
834
834
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
835
835
|
return min$1(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
836
836
|
},
|
|
837
|
-
getAngle(t, to) {
|
|
838
|
-
return getAtan2(t, to) / OneRadian;
|
|
837
|
+
getAngle(t, to, radiusX, radiusY) {
|
|
838
|
+
return getAtan2(t, to, radiusX, radiusY) / OneRadian;
|
|
839
839
|
},
|
|
840
840
|
getRotation(t, origin, to, toOrigin) {
|
|
841
841
|
if (!toOrigin) toOrigin = origin;
|
|
@@ -849,8 +849,8 @@ var LeaferUI = function(exports) {
|
|
|
849
849
|
const d = toY - toOriginY;
|
|
850
850
|
return Math.atan2(a * d - b * c, a * c + b * d);
|
|
851
851
|
},
|
|
852
|
-
getAtan2(t, to) {
|
|
853
|
-
return atan2$2(to.y - t.y, to.x - t.x);
|
|
852
|
+
getAtan2(t, to, radiusX = 1, radiusY = 1) {
|
|
853
|
+
return atan2$2((to.y - t.y) / radiusY, (to.x - t.x) / radiusX);
|
|
854
854
|
},
|
|
855
855
|
getDistancePoint(t, to, distance, changeTo, fromTo) {
|
|
856
856
|
const r = getAtan2(t, to);
|
|
@@ -946,7 +946,7 @@ var LeaferUI = function(exports) {
|
|
|
946
946
|
return this;
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
const tempPoint$
|
|
949
|
+
const tempPoint$3 = new Point;
|
|
950
950
|
class Matrix {
|
|
951
951
|
constructor(a, b, c, d, e, f) {
|
|
952
952
|
this.set(a, b, c, d, e, f);
|
|
@@ -2520,11 +2520,11 @@ var LeaferUI = function(exports) {
|
|
|
2520
2520
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2521
2521
|
}
|
|
2522
2522
|
};
|
|
2523
|
-
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil, abs: abs$
|
|
2523
|
+
const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil, abs: abs$4, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
|
|
2524
2524
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2525
|
-
const {set: set$
|
|
2525
|
+
const {set: set$2, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2526
2526
|
const {M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5} = PathCommandMap;
|
|
2527
|
-
const tempPoint$
|
|
2527
|
+
const tempPoint$2 = {};
|
|
2528
2528
|
const BezierHelper = {
|
|
2529
2529
|
points(data, originPoints, curve, close) {
|
|
2530
2530
|
let points = toNumberPoints(originPoints);
|
|
@@ -2592,14 +2592,14 @@ var LeaferUI = function(exports) {
|
|
|
2592
2592
|
const lenCB = hypot(CBx, CBy);
|
|
2593
2593
|
let totalRadian = endRadian - startRadian;
|
|
2594
2594
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2595
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2595
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$4(totalRadian - PI$2) < 1e-12) {
|
|
2596
2596
|
if (data) data.push(L$6, x1, y1);
|
|
2597
2597
|
if (setPointBounds) {
|
|
2598
2598
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
2599
2599
|
addPoint$1(setPointBounds, x1, y1);
|
|
2600
2600
|
}
|
|
2601
|
-
if (setStartPoint) set$
|
|
2602
|
-
if (setEndPoint) set$
|
|
2601
|
+
if (setStartPoint) set$2(setStartPoint, fromX, fromY);
|
|
2602
|
+
if (setEndPoint) set$2(setEndPoint, x1, y1);
|
|
2603
2603
|
return;
|
|
2604
2604
|
}
|
|
2605
2605
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2625,7 +2625,7 @@ var LeaferUI = function(exports) {
|
|
|
2625
2625
|
let totalRadian = endRadian - startRadian;
|
|
2626
2626
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2627
2627
|
if (anticlockwise) totalRadian -= PI2;
|
|
2628
|
-
const parts = ceil(abs$
|
|
2628
|
+
const parts = ceil(abs$4(totalRadian / PI_2));
|
|
2629
2629
|
const partRadian = totalRadian / parts;
|
|
2630
2630
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2631
2631
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2639,7 +2639,7 @@ var LeaferUI = function(exports) {
|
|
|
2639
2639
|
let fromX = cx + x, fromY = cy + y;
|
|
2640
2640
|
if (data) data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2641
2641
|
if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
|
|
2642
|
-
if (setStartPoint) set$
|
|
2642
|
+
if (setStartPoint) set$2(setStartPoint, fromX, fromY);
|
|
2643
2643
|
for (let i = 0; i < parts; i++) {
|
|
2644
2644
|
endCos = cos$3(endRadian);
|
|
2645
2645
|
endSin = sin$3(endRadian);
|
|
@@ -2658,7 +2658,7 @@ var LeaferUI = function(exports) {
|
|
|
2658
2658
|
startRadian = endRadian;
|
|
2659
2659
|
endRadian += partRadian;
|
|
2660
2660
|
}
|
|
2661
|
-
if (setEndPoint) set$
|
|
2661
|
+
if (setEndPoint) set$2(setEndPoint, cx + x, cy + y);
|
|
2662
2662
|
},
|
|
2663
2663
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2664
2664
|
data.push(C$4, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2694,8 +2694,8 @@ var LeaferUI = function(exports) {
|
|
|
2694
2694
|
addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2695
2695
|
addPoint$1(pointBounds, toX, toY);
|
|
2696
2696
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2697
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2698
|
-
addPoint$1(pointBounds, tempPoint$
|
|
2697
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
|
|
2698
|
+
addPoint$1(pointBounds, tempPoint$2.x, tempPoint$2.y);
|
|
2699
2699
|
}
|
|
2700
2700
|
},
|
|
2701
2701
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3119,7 +3119,7 @@ var LeaferUI = function(exports) {
|
|
|
3119
3119
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3120
3120
|
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;
|
|
3121
3121
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3122
|
-
const {tan: tan, min: min, abs: abs$
|
|
3122
|
+
const {tan: tan, min: min, abs: abs$3} = Math;
|
|
3123
3123
|
const startPoint = {};
|
|
3124
3124
|
const PathCommandDataHelper = {
|
|
3125
3125
|
beginPath(data) {
|
|
@@ -3177,7 +3177,7 @@ var LeaferUI = function(exports) {
|
|
|
3177
3177
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3178
3178
|
if (!isUndefined(lastX)) {
|
|
3179
3179
|
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3180
|
-
radius = min(radius, min(r, r * abs$
|
|
3180
|
+
radius = min(radius, min(r, r * abs$3(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3181
3181
|
}
|
|
3182
3182
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3183
3183
|
},
|
|
@@ -3499,7 +3499,7 @@ var LeaferUI = function(exports) {
|
|
|
3499
3499
|
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
3500
3500
|
const PathCorner = {
|
|
3501
3501
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3502
|
-
let command, lastCommand, commandLen;
|
|
3502
|
+
let command, lastCommand, commandLen, startXIndex, startYIndex, smoothLen;
|
|
3503
3503
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3504
3504
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3505
3505
|
const len = data.length, three = len === 9;
|
|
@@ -3508,6 +3508,11 @@ var LeaferUI = function(exports) {
|
|
|
3508
3508
|
command = data[i];
|
|
3509
3509
|
switch (command) {
|
|
3510
3510
|
case M:
|
|
3511
|
+
smoothLen = smooth.length;
|
|
3512
|
+
if (smoothLen && lastCommand !== Z) {
|
|
3513
|
+
smooth[startXIndex] = startX;
|
|
3514
|
+
smooth[startYIndex] = startY;
|
|
3515
|
+
}
|
|
3511
3516
|
startX = lastX = data[i + 1];
|
|
3512
3517
|
startY = lastY = data[i + 2];
|
|
3513
3518
|
i += 3;
|
|
@@ -3518,6 +3523,8 @@ var LeaferUI = function(exports) {
|
|
|
3518
3523
|
} else {
|
|
3519
3524
|
smooth.push(M, startX, startY);
|
|
3520
3525
|
}
|
|
3526
|
+
startXIndex = smoothLen + 1;
|
|
3527
|
+
startYIndex = smoothLen + 2;
|
|
3521
3528
|
break;
|
|
3522
3529
|
|
|
3523
3530
|
case L$1:
|
|
@@ -3556,8 +3563,8 @@ var LeaferUI = function(exports) {
|
|
|
3556
3563
|
lastCommand = command;
|
|
3557
3564
|
}
|
|
3558
3565
|
if (command !== Z) {
|
|
3559
|
-
smooth[
|
|
3560
|
-
smooth[
|
|
3566
|
+
smooth[startXIndex] = startX;
|
|
3567
|
+
smooth[startYIndex] = startY;
|
|
3561
3568
|
}
|
|
3562
3569
|
return smooth;
|
|
3563
3570
|
}
|
|
@@ -5642,7 +5649,7 @@ var LeaferUI = function(exports) {
|
|
|
5642
5649
|
}
|
|
5643
5650
|
};
|
|
5644
5651
|
const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
|
|
5645
|
-
const {toPoint: toPoint$3, tempPoint: tempPoint} = AroundHelper;
|
|
5652
|
+
const {toPoint: toPoint$3, tempPoint: tempPoint$1} = AroundHelper;
|
|
5646
5653
|
const LeafMatrix = {
|
|
5647
5654
|
__updateWorldMatrix() {
|
|
5648
5655
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
@@ -5662,8 +5669,8 @@ var LeaferUI = function(exports) {
|
|
|
5662
5669
|
local.e = data.x + data.offsetX;
|
|
5663
5670
|
local.f = data.y + data.offsetY;
|
|
5664
5671
|
if (data.around || data.origin) {
|
|
5665
|
-
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint);
|
|
5666
|
-
translateInner(local, -tempPoint.x, -tempPoint.y, !data.around);
|
|
5672
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
5673
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y, !data.around);
|
|
5667
5674
|
}
|
|
5668
5675
|
}
|
|
5669
5676
|
this.__layout.matrixChanged = undefined;
|
|
@@ -6560,7 +6567,7 @@ var LeaferUI = function(exports) {
|
|
|
6560
6567
|
this.levelMap = null;
|
|
6561
6568
|
}
|
|
6562
6569
|
}
|
|
6563
|
-
const version = "2.1.
|
|
6570
|
+
const version = "2.1.7";
|
|
6564
6571
|
const debug$4 = Debug.get("LeaferCanvas");
|
|
6565
6572
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6566
6573
|
set zIndex(zIndex) {
|
|
@@ -8044,6 +8051,7 @@ var LeaferUI = function(exports) {
|
|
|
8044
8051
|
this.set(keyframe);
|
|
8045
8052
|
return Plugin.need("animate");
|
|
8046
8053
|
}
|
|
8054
|
+
killAnimate(_type, _nextStyle) {}
|
|
8047
8055
|
export(_filename, _options) {
|
|
8048
8056
|
return Plugin.need("export");
|
|
8049
8057
|
}
|
|
@@ -8691,31 +8699,52 @@ var LeaferUI = function(exports) {
|
|
|
8691
8699
|
__decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
|
|
8692
8700
|
__decorate([ affectRenderBoundsType("hide") ], exports.Frame.prototype, "overflow", void 0);
|
|
8693
8701
|
exports.Frame = __decorate([ registerUI() ], exports.Frame);
|
|
8694
|
-
const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper;
|
|
8702
|
+
const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint, set: set$1, rotate: rotate$2} = PointHelper, {abs: abs$2} = Math, tempCenter = {};
|
|
8695
8703
|
exports.Ellipse = class Ellipse extends exports.UI {
|
|
8696
8704
|
get __tag() {
|
|
8697
8705
|
return "Ellipse";
|
|
8698
8706
|
}
|
|
8699
8707
|
__updatePath() {
|
|
8700
|
-
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = data;
|
|
8708
|
+
const data = this.__, {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle, closed: closed} = data;
|
|
8701
8709
|
const rx = width / 2, ry = height / 2;
|
|
8702
8710
|
const path = data.path = [];
|
|
8703
|
-
let open;
|
|
8711
|
+
let open, hasAngle, closedAngle;
|
|
8712
|
+
if (startAngle || endAngle) hasAngle = true;
|
|
8713
|
+
if (hasAngle) closedAngle = abs$2(endAngle - startAngle) === 360;
|
|
8704
8714
|
if (innerRadius) {
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8715
|
+
const drawInnerEllipse = innerRadius < 1 || closed;
|
|
8716
|
+
let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
|
|
8717
|
+
if (hasAngle) {
|
|
8718
|
+
if (drawInnerEllipse) {
|
|
8719
|
+
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
|
|
8720
|
+
if (closedAngle) {
|
|
8721
|
+
set$1(tempPoint, width, ry);
|
|
8722
|
+
set$1(tempCenter, rx, ry);
|
|
8723
|
+
rotate$2(tempPoint, endAngle, tempCenter, rx, ry);
|
|
8724
|
+
moveTo$3(path, tempPoint.x, tempPoint.y);
|
|
8725
|
+
}
|
|
8726
|
+
outerStartAngle = endAngle;
|
|
8727
|
+
outerEndAngle = startAngle;
|
|
8728
|
+
outerAnticlockwise = true;
|
|
8729
|
+
} else {
|
|
8730
|
+
if (!closedAngle) open = true;
|
|
8731
|
+
}
|
|
8708
8732
|
} else {
|
|
8709
|
-
if (
|
|
8733
|
+
if (drawInnerEllipse) {
|
|
8710
8734
|
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
8735
|
+
closePath$2(path);
|
|
8711
8736
|
moveTo$3(path, width, ry);
|
|
8737
|
+
outerStartAngle = 360;
|
|
8738
|
+
outerAnticlockwise = true;
|
|
8739
|
+
} else {
|
|
8740
|
+
outerEndAngle = 360;
|
|
8712
8741
|
}
|
|
8713
|
-
ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
|
|
8714
8742
|
}
|
|
8743
|
+
ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
|
|
8715
8744
|
} else {
|
|
8716
|
-
if (
|
|
8717
|
-
moveTo$3(path, rx, ry);
|
|
8718
|
-
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle
|
|
8745
|
+
if (hasAngle) {
|
|
8746
|
+
if (!closedAngle) moveTo$3(path, rx, ry);
|
|
8747
|
+
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
|
|
8719
8748
|
} else {
|
|
8720
8749
|
ellipse(path, rx, ry, rx, ry);
|
|
8721
8750
|
}
|
|
@@ -9471,6 +9500,7 @@ var LeaferUI = function(exports) {
|
|
|
9471
9500
|
if (data.__autoSide) {
|
|
9472
9501
|
ui.forceUpdate("width");
|
|
9473
9502
|
LeafHelper.updateBounds(ui);
|
|
9503
|
+
ui.__layout.boundsChanged = true;
|
|
9474
9504
|
if (ui.__proxyData) {
|
|
9475
9505
|
ui.setProxyAttr("width", data.width);
|
|
9476
9506
|
ui.setProxyAttr("height", data.height);
|
|
@@ -9478,7 +9508,7 @@ var LeaferUI = function(exports) {
|
|
|
9478
9508
|
needUpdate = false;
|
|
9479
9509
|
}
|
|
9480
9510
|
}
|
|
9481
|
-
if (paint.mode === "brush") PaintImage.brush(
|
|
9511
|
+
if (paint.mode === "brush") PaintImage.brush(ui, attrName, leafPaint);
|
|
9482
9512
|
if (!leafPaint.data) {
|
|
9483
9513
|
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
9484
9514
|
const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
|
|
@@ -9562,8 +9592,9 @@ var LeaferUI = function(exports) {
|
|
|
9562
9592
|
break;
|
|
9563
9593
|
|
|
9564
9594
|
case "repeat":
|
|
9565
|
-
case "brush":
|
|
9566
9595
|
if (!sameBox || scaleX || rotation || skew) PaintImage.repeatMode(data, box, width, height, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, align, paint.freeTransform);
|
|
9596
|
+
|
|
9597
|
+
case "brush":
|
|
9567
9598
|
if (!repeat) data.repeat = "repeat";
|
|
9568
9599
|
const count = isObject(repeat);
|
|
9569
9600
|
if (gap || count) data.gap = getGapData(gap, count && repeat, tempImage.width, tempImage.height, box);
|
|
@@ -9574,7 +9605,7 @@ var LeaferUI = function(exports) {
|
|
|
9574
9605
|
default:
|
|
9575
9606
|
if (scaleX) PaintImage.fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9576
9607
|
}
|
|
9577
|
-
if (!data.transform) {
|
|
9608
|
+
if (!data.transform && mode !== "brush") {
|
|
9578
9609
|
if (box.x || box.y) translate$1(data.transform = get$3(), box.x, box.y);
|
|
9579
9610
|
}
|
|
9580
9611
|
if (scaleX) {
|
|
@@ -9690,8 +9721,9 @@ var LeaferUI = function(exports) {
|
|
|
9690
9721
|
let {scaleX: scaleX, scaleY: scaleY} = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions), id = paint.film ? paint.nowIndex : scaleX + "-" + scaleY;
|
|
9691
9722
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9692
9723
|
if (!(Platform.image.isLarge(paint.image, scaleX, scaleY) && !paint.data.repeat)) {
|
|
9693
|
-
const {image: image, brush: brush, data: data} = paint, {
|
|
9694
|
-
let imageMatrix, xGap, yGap, {width: width, height: height} = image;
|
|
9724
|
+
const {image: image, brush: brush, data: data} = paint, {transform: transform, gap: gap} = data, fixScale = PaintImage.getPatternFixScale(paint, scaleX, scaleY);
|
|
9725
|
+
let imageMatrix, xGap, yGap, {width: width, height: height} = image, {opacity: opacity} = paint.originPaint;
|
|
9726
|
+
if (brush || opacity === 1) opacity = undefined;
|
|
9695
9727
|
if (fixScale) scaleX *= fixScale, scaleY *= fixScale;
|
|
9696
9728
|
width *= scaleX;
|
|
9697
9729
|
height *= scaleY;
|
|
@@ -10784,7 +10816,7 @@ var LeaferUI = function(exports) {
|
|
|
10784
10816
|
exports.surfaceType = surfaceType;
|
|
10785
10817
|
exports.tempBounds = tempBounds$2;
|
|
10786
10818
|
exports.tempMatrix = tempMatrix$2;
|
|
10787
|
-
exports.tempPoint = tempPoint$
|
|
10819
|
+
exports.tempPoint = tempPoint$3;
|
|
10788
10820
|
exports.tryToNumber = tryToNumber;
|
|
10789
10821
|
exports.useCanvas = useCanvas;
|
|
10790
10822
|
exports.useModule = useModule;
|