@leafer-game/miniapp 2.2.3 → 2.2.4
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/miniapp.module.js +87 -54
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/miniapp.module.js
CHANGED
|
@@ -253,7 +253,7 @@ const FourNumberHelper = {
|
|
|
253
253
|
return to;
|
|
254
254
|
},
|
|
255
255
|
setTemp(top, right, bottom, left) {
|
|
256
|
-
return set$
|
|
256
|
+
return set$4(tempFour, top, right, bottom, left);
|
|
257
257
|
},
|
|
258
258
|
toTempAB(a, b, change) {
|
|
259
259
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -293,22 +293,22 @@ const FourNumberHelper = {
|
|
|
293
293
|
max(t, other, change) {
|
|
294
294
|
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
295
295
|
toTempAB(t, other, change);
|
|
296
|
-
return set$
|
|
296
|
+
return set$4(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
|
|
297
297
|
},
|
|
298
298
|
add(t, other, change) {
|
|
299
299
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
300
300
|
toTempAB(t, other, change);
|
|
301
|
-
return set$
|
|
301
|
+
return set$4(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
302
302
|
},
|
|
303
303
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
304
304
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
305
305
|
const to = change ? t : [];
|
|
306
306
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
307
|
-
return set$
|
|
307
|
+
return set$4(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
308
308
|
}
|
|
309
309
|
};
|
|
310
310
|
|
|
311
|
-
const {set: set$
|
|
311
|
+
const {set: set$4, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
312
312
|
|
|
313
313
|
const {round: round$6, pow: pow$2, max: max$4, floor: floor$3, PI: PI$4} = Math;
|
|
314
314
|
|
|
@@ -835,7 +835,7 @@ const PointHelper = {
|
|
|
835
835
|
return y1 + (y2 - y1) / 2;
|
|
836
836
|
},
|
|
837
837
|
getDistance(t, point) {
|
|
838
|
-
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
838
|
+
return getDistanceFrom$1(t.x, t.y, point.x, point.y);
|
|
839
839
|
},
|
|
840
840
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
841
841
|
const x = abs$7(x2 - x1);
|
|
@@ -843,7 +843,7 @@ const PointHelper = {
|
|
|
843
843
|
return sqrt$4(x * x + y * y);
|
|
844
844
|
},
|
|
845
845
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
846
|
-
return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
846
|
+
return min$2(getDistanceFrom$1(x1, y1, x2, y2), getDistanceFrom$1(x2, y2, x3, y3));
|
|
847
847
|
},
|
|
848
848
|
getAngle(t, to, radiusX, radiusY) {
|
|
849
849
|
return getAtan2(t, to, radiusX, radiusY) / OneRadian;
|
|
@@ -886,7 +886,7 @@ const PointHelper = {
|
|
|
886
886
|
|
|
887
887
|
const P$5 = PointHelper;
|
|
888
888
|
|
|
889
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$9, setRadius: setRadius, getAtan2: getAtan2} = P$5;
|
|
889
|
+
const {getDistanceFrom: getDistanceFrom$1, copy: copy$9, setRadius: setRadius, getAtan2: getAtan2} = P$5;
|
|
890
890
|
|
|
891
891
|
class Point {
|
|
892
892
|
constructor(x, y) {
|
|
@@ -2711,7 +2711,7 @@ const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs:
|
|
|
2711
2711
|
|
|
2712
2712
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2713
2713
|
|
|
2714
|
-
const {set: set$
|
|
2714
|
+
const {set: set$3, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2715
2715
|
|
|
2716
2716
|
const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$6} = PathCommandMap;
|
|
2717
2717
|
|
|
@@ -2790,8 +2790,8 @@ const BezierHelper = {
|
|
|
2790
2790
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
2791
2791
|
addPoint$1(setPointBounds, x1, y1);
|
|
2792
2792
|
}
|
|
2793
|
-
if (setStartPoint) set$
|
|
2794
|
-
if (setEndPoint) set$
|
|
2793
|
+
if (setStartPoint) set$3(setStartPoint, fromX, fromY);
|
|
2794
|
+
if (setEndPoint) set$3(setEndPoint, x1, y1);
|
|
2795
2795
|
return;
|
|
2796
2796
|
}
|
|
2797
2797
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2816,7 +2816,10 @@ const BezierHelper = {
|
|
|
2816
2816
|
if (endRadian < 0) endRadian += PI2;
|
|
2817
2817
|
let totalRadian = endRadian - startRadian;
|
|
2818
2818
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2819
|
-
if (anticlockwise)
|
|
2819
|
+
if (anticlockwise) {
|
|
2820
|
+
const closedAngle = abs$6(endAngle - startAngle) === 360;
|
|
2821
|
+
if (closedAngle) totalRadian = -PI2; else totalRadian -= PI2;
|
|
2822
|
+
}
|
|
2820
2823
|
const parts = ceil$1(abs$6(totalRadian / PI_2));
|
|
2821
2824
|
const partRadian = totalRadian / parts;
|
|
2822
2825
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
@@ -2831,7 +2834,7 @@ const BezierHelper = {
|
|
|
2831
2834
|
let fromX = cx + x, fromY = cy + y;
|
|
2832
2835
|
if (data) data.push(data.length ? L$7 : M$6, fromX, fromY);
|
|
2833
2836
|
if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
|
|
2834
|
-
if (setStartPoint) set$
|
|
2837
|
+
if (setStartPoint) set$3(setStartPoint, fromX, fromY);
|
|
2835
2838
|
for (let i = 0; i < parts; i++) {
|
|
2836
2839
|
endCos = cos$4(endRadian);
|
|
2837
2840
|
endSin = sin$4(endRadian);
|
|
@@ -2850,7 +2853,7 @@ const BezierHelper = {
|
|
|
2850
2853
|
startRadian = endRadian;
|
|
2851
2854
|
endRadian += partRadian;
|
|
2852
2855
|
}
|
|
2853
|
-
if (setEndPoint) set$
|
|
2856
|
+
if (setEndPoint) set$3(setEndPoint, cx + x, cy + y);
|
|
2854
2857
|
},
|
|
2855
2858
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2856
2859
|
data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -6802,11 +6805,11 @@ let Branch = class Branch extends Leaf {
|
|
|
6802
6805
|
childLayout.boxChanged || childLayout.boxChange();
|
|
6803
6806
|
childLayout.matrixChanged || childLayout.matrixChange();
|
|
6804
6807
|
if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD);
|
|
6808
|
+
if (this.isFrame) child.__bindFrame(this);
|
|
6805
6809
|
if (this.leafer) {
|
|
6806
6810
|
child.__bindLeafer(this.leafer);
|
|
6807
6811
|
if (this.leafer.created) this.__emitChildEvent(ChildEvent.ADD, child);
|
|
6808
6812
|
}
|
|
6809
|
-
if (this.isFrame) child.__bindFrame(this);
|
|
6810
6813
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
6811
6814
|
}
|
|
6812
6815
|
addMany(...children) {
|
|
@@ -7020,7 +7023,7 @@ class LeafLevelList {
|
|
|
7020
7023
|
}
|
|
7021
7024
|
}
|
|
7022
7025
|
|
|
7023
|
-
const version = "2.2.
|
|
7026
|
+
const version = "2.2.4";
|
|
7024
7027
|
|
|
7025
7028
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7026
7029
|
get allowBackgroundColor() {
|
|
@@ -9500,7 +9503,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
|
|
|
9500
9503
|
|
|
9501
9504
|
Frame = __decorate([ registerUI() ], Frame);
|
|
9502
9505
|
|
|
9503
|
-
const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$1, set: set$
|
|
9506
|
+
const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$1, set: set$2, rotate: rotate$2} = PointHelper, {abs: abs$4} = Math, tempCenter = {};
|
|
9504
9507
|
|
|
9505
9508
|
let Ellipse = class Ellipse extends UI {
|
|
9506
9509
|
get __tag() {
|
|
@@ -9515,34 +9518,28 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9515
9518
|
if (hasAngle) closedAngle = abs$4(endAngle - startAngle) === 360;
|
|
9516
9519
|
if (innerRadius) {
|
|
9517
9520
|
const drawInnerEllipse = innerRadius < 1 || closed;
|
|
9518
|
-
|
|
9521
|
+
const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
|
|
9519
9522
|
if (hasAngle) {
|
|
9523
|
+
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
|
|
9520
9524
|
if (drawInnerEllipse) {
|
|
9521
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
|
|
9522
9525
|
if (closedAngle) {
|
|
9523
|
-
|
|
9524
|
-
set$1(tempCenter, rx, ry);
|
|
9526
|
+
closePath$2(path);
|
|
9527
|
+
set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
|
|
9525
9528
|
rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
|
|
9526
9529
|
moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
|
|
9527
9530
|
}
|
|
9528
|
-
|
|
9529
|
-
outerEndAngle = startAngle;
|
|
9530
|
-
outerAnticlockwise = true;
|
|
9531
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
|
|
9531
9532
|
} else {
|
|
9532
9533
|
if (!closedAngle) open = true;
|
|
9533
9534
|
}
|
|
9534
9535
|
} else {
|
|
9536
|
+
ellipse(path, rx, ry, rx, ry);
|
|
9535
9537
|
if (drawInnerEllipse) {
|
|
9536
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
9537
9538
|
closePath$2(path);
|
|
9538
|
-
moveTo$3(path,
|
|
9539
|
-
|
|
9540
|
-
outerAnticlockwise = true;
|
|
9541
|
-
} else {
|
|
9542
|
-
outerEndAngle = 360;
|
|
9539
|
+
moveTo$3(path, rx + innerRx, ry);
|
|
9540
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
|
|
9543
9541
|
}
|
|
9544
9542
|
}
|
|
9545
|
-
ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
|
|
9546
9543
|
} else {
|
|
9547
9544
|
if (hasAngle) {
|
|
9548
9545
|
if (!closedAngle) {
|
|
@@ -9651,7 +9648,7 @@ Star = __decorate([ registerUI() ], Star);
|
|
|
9651
9648
|
|
|
9652
9649
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
9653
9650
|
|
|
9654
|
-
const {rotate: rotate$1, getAngle: getAngle$
|
|
9651
|
+
const {rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
9655
9652
|
|
|
9656
9653
|
let Line = class Line extends UI {
|
|
9657
9654
|
get __tag() {
|
|
@@ -9669,7 +9666,7 @@ let Line = class Line extends UI {
|
|
|
9669
9666
|
}
|
|
9670
9667
|
set toPoint(value) {
|
|
9671
9668
|
this.width = getDistance$3(defaultPoint, value);
|
|
9672
|
-
this.rotation = getAngle$
|
|
9669
|
+
this.rotation = getAngle$2(defaultPoint, value);
|
|
9673
9670
|
if (this.height) this.height = 0;
|
|
9674
9671
|
}
|
|
9675
9672
|
__updatePath() {
|
|
@@ -11442,7 +11439,8 @@ ui$5.__hit = function(inner, forceHitFill) {
|
|
|
11442
11439
|
const {hitFill: hitFill} = data;
|
|
11443
11440
|
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
|
|
11444
11441
|
if (needHitFillPath && this.__hitFill(inner)) return true;
|
|
11445
|
-
const {hitStroke: hitStroke,
|
|
11442
|
+
const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
|
|
11443
|
+
const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
|
|
11446
11444
|
const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
|
|
11447
11445
|
if (!needHitFillPath && !needHitStrokePath) return false;
|
|
11448
11446
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -12217,7 +12215,7 @@ function getGapValue(gap, size, totalSize, rows) {
|
|
|
12217
12215
|
|
|
12218
12216
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
12219
12217
|
|
|
12220
|
-
const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
12218
|
+
const {get: get$2, set: set$1, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
12221
12219
|
|
|
12222
12220
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
12223
12221
|
const transform = get$2(), {x: x, y: y} = box;
|
|
@@ -12242,7 +12240,7 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
12242
12240
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
12243
12241
|
if (clipScaleX) {
|
|
12244
12242
|
if (rotation || skew) {
|
|
12245
|
-
set(tempMatrix$1);
|
|
12243
|
+
set$1(tempMatrix$1);
|
|
12246
12244
|
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
12247
12245
|
multiplyParent(transform, tempMatrix$1);
|
|
12248
12246
|
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
@@ -12493,7 +12491,7 @@ function applyStops(data, gradient, stops, opacity) {
|
|
|
12493
12491
|
}
|
|
12494
12492
|
}
|
|
12495
12493
|
|
|
12496
|
-
const {getAngle: getAngle, getDistance: getDistance$2} = PointHelper;
|
|
12494
|
+
const {getAngle: getAngle$1, getDistance: getDistance$2} = PointHelper;
|
|
12497
12495
|
|
|
12498
12496
|
const {get: get, rotateOfOuter: rotateOfOuter, scaleOfOuter: scaleOfOuter} = MatrixHelper;
|
|
12499
12497
|
|
|
@@ -12522,7 +12520,7 @@ function getTransform(box, from, to, stretch, rotate90) {
|
|
|
12522
12520
|
let transform;
|
|
12523
12521
|
const {width: width, height: height} = box;
|
|
12524
12522
|
if (width !== height || stretch) {
|
|
12525
|
-
const angle = getAngle(from, to);
|
|
12523
|
+
const angle = getAngle$1(from, to);
|
|
12526
12524
|
transform = get();
|
|
12527
12525
|
if (rotate90) {
|
|
12528
12526
|
scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
|
|
@@ -15015,7 +15013,7 @@ const HighBezierHelper = {
|
|
|
15015
15013
|
|
|
15016
15014
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
15017
15015
|
|
|
15018
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
|
|
15016
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper, {set: set, getAngle: getAngle, getDistanceFrom: getDistanceFrom, getDistancePoint: getDistancePoint} = PointHelper;
|
|
15019
15017
|
|
|
15020
15018
|
const tempPoint = {}, tempFrom = {};
|
|
15021
15019
|
|
|
@@ -15053,16 +15051,19 @@ const HighCurveHelper = {
|
|
|
15053
15051
|
},
|
|
15054
15052
|
getMotionPathData(data) {
|
|
15055
15053
|
let total = 0, distance, segments = [];
|
|
15056
|
-
let i = 0, x = 0, y = 0, toX, toY, command, closed;
|
|
15054
|
+
let i = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command, closed;
|
|
15057
15055
|
const len = data.length;
|
|
15058
15056
|
while (i < len) {
|
|
15059
15057
|
command = data[i];
|
|
15060
15058
|
switch (command) {
|
|
15061
15059
|
case M:
|
|
15060
|
+
startX = data[i + 1];
|
|
15061
|
+
startY = data[i + 2];
|
|
15062
|
+
|
|
15062
15063
|
case L:
|
|
15063
15064
|
toX = data[i + 1];
|
|
15064
15065
|
toY = data[i + 2];
|
|
15065
|
-
distance = command === L && i > 0 ?
|
|
15066
|
+
distance = command === L && i > 0 ? getDistanceFrom(x, y, toX, toY) : 0;
|
|
15066
15067
|
x = toX;
|
|
15067
15068
|
y = toY;
|
|
15068
15069
|
i += 3;
|
|
@@ -15079,7 +15080,9 @@ const HighCurveHelper = {
|
|
|
15079
15080
|
|
|
15080
15081
|
case Z:
|
|
15081
15082
|
closed = true;
|
|
15083
|
+
distance = getDistanceFrom(x, y, startX, startY);
|
|
15082
15084
|
i += 1;
|
|
15085
|
+
break;
|
|
15083
15086
|
|
|
15084
15087
|
default:
|
|
15085
15088
|
distance = 0;
|
|
@@ -15100,25 +15103,26 @@ const HighCurveHelper = {
|
|
|
15100
15103
|
if (offsetX) motionDistance += offsetX;
|
|
15101
15104
|
if (motionDistance > total) motionDistance = motionDistance % total;
|
|
15102
15105
|
let nowDistance = 0, distance, to = {};
|
|
15103
|
-
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
15106
|
+
let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
|
|
15104
15107
|
let x1, y1, x2, y2, t;
|
|
15105
15108
|
const len = data.length;
|
|
15106
15109
|
while (i < len) {
|
|
15107
15110
|
command = data[i];
|
|
15108
15111
|
switch (command) {
|
|
15109
15112
|
case M:
|
|
15113
|
+
startX = data[i + 1];
|
|
15114
|
+
startY = data[i + 2];
|
|
15115
|
+
|
|
15110
15116
|
case L:
|
|
15111
15117
|
toX = data[i + 1];
|
|
15112
15118
|
toY = data[i + 2];
|
|
15113
15119
|
distance = segments[index];
|
|
15114
15120
|
if (nowDistance + distance >= motionDistance || !distanceData.total) {
|
|
15115
|
-
to
|
|
15116
|
-
to.y = toY;
|
|
15121
|
+
set(to, toX, toY);
|
|
15117
15122
|
if (i) {
|
|
15118
|
-
tempFrom
|
|
15119
|
-
tempFrom
|
|
15120
|
-
|
|
15121
|
-
to.rotation = PointHelper.getAngle(tempFrom, to);
|
|
15123
|
+
set(tempFrom, x, y);
|
|
15124
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
15125
|
+
to.rotation = getAngle(tempFrom, to);
|
|
15122
15126
|
return to;
|
|
15123
15127
|
} else {
|
|
15124
15128
|
const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
|
|
@@ -15148,7 +15152,19 @@ const HighCurveHelper = {
|
|
|
15148
15152
|
break;
|
|
15149
15153
|
|
|
15150
15154
|
case Z:
|
|
15155
|
+
toX = startX;
|
|
15156
|
+
toY = startY;
|
|
15157
|
+
distance = segments[index];
|
|
15158
|
+
if (nowDistance + distance >= motionDistance) {
|
|
15159
|
+
set(tempFrom, x, y), set(to, toX, toY);
|
|
15160
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
15161
|
+
to.rotation = getAngle(tempFrom, to);
|
|
15162
|
+
return to;
|
|
15163
|
+
}
|
|
15164
|
+
x = toX;
|
|
15165
|
+
y = toY;
|
|
15151
15166
|
i += 1;
|
|
15167
|
+
break;
|
|
15152
15168
|
|
|
15153
15169
|
default:
|
|
15154
15170
|
distance = 0;
|
|
@@ -15162,26 +15178,27 @@ const HighCurveHelper = {
|
|
|
15162
15178
|
const {segments: segments, data: data} = distanceData, path = [];
|
|
15163
15179
|
motionDistance = UnitConvert.number(motionDistance, distanceData.total);
|
|
15164
15180
|
let total = 0, distance, cutDistance, to = {};
|
|
15165
|
-
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
15181
|
+
let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
|
|
15166
15182
|
let x1, y1, x2, y2, t;
|
|
15167
15183
|
const len = data.length;
|
|
15168
15184
|
while (i < len) {
|
|
15169
15185
|
command = data[i];
|
|
15170
15186
|
switch (command) {
|
|
15171
15187
|
case M:
|
|
15188
|
+
startX = data[i + 1];
|
|
15189
|
+
startY = data[i + 2];
|
|
15190
|
+
|
|
15172
15191
|
case L:
|
|
15173
15192
|
toX = data[i + 1];
|
|
15174
15193
|
toY = data[i + 2];
|
|
15175
15194
|
distance = segments[index];
|
|
15176
15195
|
if (total + distance > motionDistance || !distanceData.total) {
|
|
15177
15196
|
if (!i) x = toX, y = toY;
|
|
15178
|
-
tempFrom
|
|
15179
|
-
|
|
15180
|
-
to.x = toX;
|
|
15181
|
-
to.y = toY;
|
|
15197
|
+
set(tempFrom, x, y);
|
|
15198
|
+
set(to, toX, toY);
|
|
15182
15199
|
cutDistance = float(motionDistance - total);
|
|
15183
15200
|
if (cutDistance) {
|
|
15184
|
-
|
|
15201
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
15185
15202
|
path.push(command, to.x, to.y);
|
|
15186
15203
|
}
|
|
15187
15204
|
return path;
|
|
@@ -15212,8 +15229,24 @@ const HighCurveHelper = {
|
|
|
15212
15229
|
break;
|
|
15213
15230
|
|
|
15214
15231
|
case Z:
|
|
15232
|
+
toX = startX;
|
|
15233
|
+
toY = startY;
|
|
15234
|
+
distance = segments[index];
|
|
15235
|
+
if (total + distance > motionDistance) {
|
|
15236
|
+
set(tempFrom, x, y);
|
|
15237
|
+
set(to, toX, toY);
|
|
15238
|
+
cutDistance = float(motionDistance - total);
|
|
15239
|
+
if (cutDistance) {
|
|
15240
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
15241
|
+
path.push(L, to.x, to.y);
|
|
15242
|
+
}
|
|
15243
|
+
return path;
|
|
15244
|
+
}
|
|
15245
|
+
x = toX;
|
|
15246
|
+
y = toY;
|
|
15215
15247
|
i += 1;
|
|
15216
15248
|
path.push(command);
|
|
15249
|
+
break;
|
|
15217
15250
|
|
|
15218
15251
|
default:
|
|
15219
15252
|
distance = 0;
|