leafer-game 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/web.js +87 -54
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +87 -54
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/web.module.js
CHANGED
|
@@ -292,7 +292,7 @@ const FourNumberHelper = {
|
|
|
292
292
|
return to;
|
|
293
293
|
},
|
|
294
294
|
setTemp(top, right, bottom, left) {
|
|
295
|
-
return set$
|
|
295
|
+
return set$4(tempFour, top, right, bottom, left);
|
|
296
296
|
},
|
|
297
297
|
toTempAB(a, b, change) {
|
|
298
298
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -332,22 +332,22 @@ const FourNumberHelper = {
|
|
|
332
332
|
max(t, other, change) {
|
|
333
333
|
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
334
334
|
toTempAB(t, other, change);
|
|
335
|
-
return set$
|
|
335
|
+
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]));
|
|
336
336
|
},
|
|
337
337
|
add(t, other, change) {
|
|
338
338
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
339
339
|
toTempAB(t, other, change);
|
|
340
|
-
return set$
|
|
340
|
+
return set$4(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
341
341
|
},
|
|
342
342
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
343
343
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
344
344
|
const to = change ? t : [];
|
|
345
345
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
346
|
-
return set$
|
|
346
|
+
return set$4(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
349
|
|
|
350
|
-
const {set: set$
|
|
350
|
+
const {set: set$4, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
351
351
|
|
|
352
352
|
const {round: round$6, pow: pow$2, max: max$4, floor: floor$3, PI: PI$4} = Math;
|
|
353
353
|
|
|
@@ -874,7 +874,7 @@ const PointHelper = {
|
|
|
874
874
|
return y1 + (y2 - y1) / 2;
|
|
875
875
|
},
|
|
876
876
|
getDistance(t, point) {
|
|
877
|
-
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
877
|
+
return getDistanceFrom$1(t.x, t.y, point.x, point.y);
|
|
878
878
|
},
|
|
879
879
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
880
880
|
const x = abs$7(x2 - x1);
|
|
@@ -882,7 +882,7 @@ const PointHelper = {
|
|
|
882
882
|
return sqrt$4(x * x + y * y);
|
|
883
883
|
},
|
|
884
884
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
885
|
-
return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
885
|
+
return min$2(getDistanceFrom$1(x1, y1, x2, y2), getDistanceFrom$1(x2, y2, x3, y3));
|
|
886
886
|
},
|
|
887
887
|
getAngle(t, to, radiusX, radiusY) {
|
|
888
888
|
return getAtan2(t, to, radiusX, radiusY) / OneRadian;
|
|
@@ -925,7 +925,7 @@ const PointHelper = {
|
|
|
925
925
|
|
|
926
926
|
const P$5 = PointHelper;
|
|
927
927
|
|
|
928
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$9, setRadius: setRadius, getAtan2: getAtan2} = P$5;
|
|
928
|
+
const {getDistanceFrom: getDistanceFrom$1, copy: copy$9, setRadius: setRadius, getAtan2: getAtan2} = P$5;
|
|
929
929
|
|
|
930
930
|
class Point {
|
|
931
931
|
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
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
7026
7029
|
|
|
@@ -9535,7 +9538,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
|
|
|
9535
9538
|
|
|
9536
9539
|
Frame = __decorate([ registerUI() ], Frame);
|
|
9537
9540
|
|
|
9538
|
-
const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$1, set: set$
|
|
9541
|
+
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 = {};
|
|
9539
9542
|
|
|
9540
9543
|
let Ellipse = class Ellipse extends UI {
|
|
9541
9544
|
get __tag() {
|
|
@@ -9550,34 +9553,28 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9550
9553
|
if (hasAngle) closedAngle = abs$4(endAngle - startAngle) === 360;
|
|
9551
9554
|
if (innerRadius) {
|
|
9552
9555
|
const drawInnerEllipse = innerRadius < 1 || closed;
|
|
9553
|
-
|
|
9556
|
+
const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
|
|
9554
9557
|
if (hasAngle) {
|
|
9558
|
+
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
|
|
9555
9559
|
if (drawInnerEllipse) {
|
|
9556
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
|
|
9557
9560
|
if (closedAngle) {
|
|
9558
|
-
|
|
9559
|
-
set$1(tempCenter, rx, ry);
|
|
9561
|
+
closePath$2(path);
|
|
9562
|
+
set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
|
|
9560
9563
|
rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
|
|
9561
9564
|
moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
|
|
9562
9565
|
}
|
|
9563
|
-
|
|
9564
|
-
outerEndAngle = startAngle;
|
|
9565
|
-
outerAnticlockwise = true;
|
|
9566
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
|
|
9566
9567
|
} else {
|
|
9567
9568
|
if (!closedAngle) open = true;
|
|
9568
9569
|
}
|
|
9569
9570
|
} else {
|
|
9571
|
+
ellipse(path, rx, ry, rx, ry);
|
|
9570
9572
|
if (drawInnerEllipse) {
|
|
9571
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
9572
9573
|
closePath$2(path);
|
|
9573
|
-
moveTo$3(path,
|
|
9574
|
-
|
|
9575
|
-
outerAnticlockwise = true;
|
|
9576
|
-
} else {
|
|
9577
|
-
outerEndAngle = 360;
|
|
9574
|
+
moveTo$3(path, rx + innerRx, ry);
|
|
9575
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
|
|
9578
9576
|
}
|
|
9579
9577
|
}
|
|
9580
|
-
ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
|
|
9581
9578
|
} else {
|
|
9582
9579
|
if (hasAngle) {
|
|
9583
9580
|
if (!closedAngle) {
|
|
@@ -9686,7 +9683,7 @@ Star = __decorate([ registerUI() ], Star);
|
|
|
9686
9683
|
|
|
9687
9684
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
9688
9685
|
|
|
9689
|
-
const {rotate: rotate$1, getAngle: getAngle$
|
|
9686
|
+
const {rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
9690
9687
|
|
|
9691
9688
|
let Line = class Line extends UI {
|
|
9692
9689
|
get __tag() {
|
|
@@ -9704,7 +9701,7 @@ let Line = class Line extends UI {
|
|
|
9704
9701
|
}
|
|
9705
9702
|
set toPoint(value) {
|
|
9706
9703
|
this.width = getDistance$3(defaultPoint, value);
|
|
9707
|
-
this.rotation = getAngle$
|
|
9704
|
+
this.rotation = getAngle$2(defaultPoint, value);
|
|
9708
9705
|
if (this.height) this.height = 0;
|
|
9709
9706
|
}
|
|
9710
9707
|
__updatePath() {
|
|
@@ -11477,7 +11474,8 @@ ui$5.__hit = function(inner, forceHitFill) {
|
|
|
11477
11474
|
const {hitFill: hitFill} = data;
|
|
11478
11475
|
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
|
|
11479
11476
|
if (needHitFillPath && this.__hitFill(inner)) return true;
|
|
11480
|
-
const {hitStroke: hitStroke,
|
|
11477
|
+
const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
|
|
11478
|
+
const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
|
|
11481
11479
|
const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
|
|
11482
11480
|
if (!needHitFillPath && !needHitStrokePath) return false;
|
|
11483
11481
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -12472,7 +12470,7 @@ function getGapValue(gap, size, totalSize, rows) {
|
|
|
12472
12470
|
|
|
12473
12471
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
12474
12472
|
|
|
12475
|
-
const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
12473
|
+
const {get: get$2, set: set$1, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
12476
12474
|
|
|
12477
12475
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
12478
12476
|
const transform = get$2(), {x: x, y: y} = box;
|
|
@@ -12497,7 +12495,7 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
12497
12495
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
12498
12496
|
if (clipScaleX) {
|
|
12499
12497
|
if (rotation || skew) {
|
|
12500
|
-
set(tempMatrix$1);
|
|
12498
|
+
set$1(tempMatrix$1);
|
|
12501
12499
|
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
12502
12500
|
multiplyParent(transform, tempMatrix$1);
|
|
12503
12501
|
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
@@ -12748,7 +12746,7 @@ function applyStops(data, gradient, stops, opacity) {
|
|
|
12748
12746
|
}
|
|
12749
12747
|
}
|
|
12750
12748
|
|
|
12751
|
-
const {getAngle: getAngle, getDistance: getDistance$2} = PointHelper;
|
|
12749
|
+
const {getAngle: getAngle$1, getDistance: getDistance$2} = PointHelper;
|
|
12752
12750
|
|
|
12753
12751
|
const {get: get, rotateOfOuter: rotateOfOuter, scaleOfOuter: scaleOfOuter} = MatrixHelper;
|
|
12754
12752
|
|
|
@@ -12777,7 +12775,7 @@ function getTransform(box, from, to, stretch, rotate90) {
|
|
|
12777
12775
|
let transform;
|
|
12778
12776
|
const {width: width, height: height} = box;
|
|
12779
12777
|
if (width !== height || stretch) {
|
|
12780
|
-
const angle = getAngle(from, to);
|
|
12778
|
+
const angle = getAngle$1(from, to);
|
|
12781
12779
|
transform = get();
|
|
12782
12780
|
if (rotate90) {
|
|
12783
12781
|
scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
|
|
@@ -15264,7 +15262,7 @@ const HighBezierHelper = {
|
|
|
15264
15262
|
|
|
15265
15263
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
15266
15264
|
|
|
15267
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
|
|
15265
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper, {set: set, getAngle: getAngle, getDistanceFrom: getDistanceFrom, getDistancePoint: getDistancePoint} = PointHelper;
|
|
15268
15266
|
|
|
15269
15267
|
const tempPoint = {}, tempFrom = {};
|
|
15270
15268
|
|
|
@@ -15302,16 +15300,19 @@ const HighCurveHelper = {
|
|
|
15302
15300
|
},
|
|
15303
15301
|
getMotionPathData(data) {
|
|
15304
15302
|
let total = 0, distance, segments = [];
|
|
15305
|
-
let i = 0, x = 0, y = 0, toX, toY, command, closed;
|
|
15303
|
+
let i = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command, closed;
|
|
15306
15304
|
const len = data.length;
|
|
15307
15305
|
while (i < len) {
|
|
15308
15306
|
command = data[i];
|
|
15309
15307
|
switch (command) {
|
|
15310
15308
|
case M:
|
|
15309
|
+
startX = data[i + 1];
|
|
15310
|
+
startY = data[i + 2];
|
|
15311
|
+
|
|
15311
15312
|
case L:
|
|
15312
15313
|
toX = data[i + 1];
|
|
15313
15314
|
toY = data[i + 2];
|
|
15314
|
-
distance = command === L && i > 0 ?
|
|
15315
|
+
distance = command === L && i > 0 ? getDistanceFrom(x, y, toX, toY) : 0;
|
|
15315
15316
|
x = toX;
|
|
15316
15317
|
y = toY;
|
|
15317
15318
|
i += 3;
|
|
@@ -15328,7 +15329,9 @@ const HighCurveHelper = {
|
|
|
15328
15329
|
|
|
15329
15330
|
case Z:
|
|
15330
15331
|
closed = true;
|
|
15332
|
+
distance = getDistanceFrom(x, y, startX, startY);
|
|
15331
15333
|
i += 1;
|
|
15334
|
+
break;
|
|
15332
15335
|
|
|
15333
15336
|
default:
|
|
15334
15337
|
distance = 0;
|
|
@@ -15349,25 +15352,26 @@ const HighCurveHelper = {
|
|
|
15349
15352
|
if (offsetX) motionDistance += offsetX;
|
|
15350
15353
|
if (motionDistance > total) motionDistance = motionDistance % total;
|
|
15351
15354
|
let nowDistance = 0, distance, to = {};
|
|
15352
|
-
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
15355
|
+
let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
|
|
15353
15356
|
let x1, y1, x2, y2, t;
|
|
15354
15357
|
const len = data.length;
|
|
15355
15358
|
while (i < len) {
|
|
15356
15359
|
command = data[i];
|
|
15357
15360
|
switch (command) {
|
|
15358
15361
|
case M:
|
|
15362
|
+
startX = data[i + 1];
|
|
15363
|
+
startY = data[i + 2];
|
|
15364
|
+
|
|
15359
15365
|
case L:
|
|
15360
15366
|
toX = data[i + 1];
|
|
15361
15367
|
toY = data[i + 2];
|
|
15362
15368
|
distance = segments[index];
|
|
15363
15369
|
if (nowDistance + distance >= motionDistance || !distanceData.total) {
|
|
15364
|
-
to
|
|
15365
|
-
to.y = toY;
|
|
15370
|
+
set(to, toX, toY);
|
|
15366
15371
|
if (i) {
|
|
15367
|
-
tempFrom
|
|
15368
|
-
tempFrom
|
|
15369
|
-
|
|
15370
|
-
to.rotation = PointHelper.getAngle(tempFrom, to);
|
|
15372
|
+
set(tempFrom, x, y);
|
|
15373
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
15374
|
+
to.rotation = getAngle(tempFrom, to);
|
|
15371
15375
|
return to;
|
|
15372
15376
|
} else {
|
|
15373
15377
|
const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
|
|
@@ -15397,7 +15401,19 @@ const HighCurveHelper = {
|
|
|
15397
15401
|
break;
|
|
15398
15402
|
|
|
15399
15403
|
case Z:
|
|
15404
|
+
toX = startX;
|
|
15405
|
+
toY = startY;
|
|
15406
|
+
distance = segments[index];
|
|
15407
|
+
if (nowDistance + distance >= motionDistance) {
|
|
15408
|
+
set(tempFrom, x, y), set(to, toX, toY);
|
|
15409
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
15410
|
+
to.rotation = getAngle(tempFrom, to);
|
|
15411
|
+
return to;
|
|
15412
|
+
}
|
|
15413
|
+
x = toX;
|
|
15414
|
+
y = toY;
|
|
15400
15415
|
i += 1;
|
|
15416
|
+
break;
|
|
15401
15417
|
|
|
15402
15418
|
default:
|
|
15403
15419
|
distance = 0;
|
|
@@ -15411,26 +15427,27 @@ const HighCurveHelper = {
|
|
|
15411
15427
|
const {segments: segments, data: data} = distanceData, path = [];
|
|
15412
15428
|
motionDistance = UnitConvert.number(motionDistance, distanceData.total);
|
|
15413
15429
|
let total = 0, distance, cutDistance, to = {};
|
|
15414
|
-
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
15430
|
+
let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
|
|
15415
15431
|
let x1, y1, x2, y2, t;
|
|
15416
15432
|
const len = data.length;
|
|
15417
15433
|
while (i < len) {
|
|
15418
15434
|
command = data[i];
|
|
15419
15435
|
switch (command) {
|
|
15420
15436
|
case M:
|
|
15437
|
+
startX = data[i + 1];
|
|
15438
|
+
startY = data[i + 2];
|
|
15439
|
+
|
|
15421
15440
|
case L:
|
|
15422
15441
|
toX = data[i + 1];
|
|
15423
15442
|
toY = data[i + 2];
|
|
15424
15443
|
distance = segments[index];
|
|
15425
15444
|
if (total + distance > motionDistance || !distanceData.total) {
|
|
15426
15445
|
if (!i) x = toX, y = toY;
|
|
15427
|
-
tempFrom
|
|
15428
|
-
|
|
15429
|
-
to.x = toX;
|
|
15430
|
-
to.y = toY;
|
|
15446
|
+
set(tempFrom, x, y);
|
|
15447
|
+
set(to, toX, toY);
|
|
15431
15448
|
cutDistance = float(motionDistance - total);
|
|
15432
15449
|
if (cutDistance) {
|
|
15433
|
-
|
|
15450
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
15434
15451
|
path.push(command, to.x, to.y);
|
|
15435
15452
|
}
|
|
15436
15453
|
return path;
|
|
@@ -15461,8 +15478,24 @@ const HighCurveHelper = {
|
|
|
15461
15478
|
break;
|
|
15462
15479
|
|
|
15463
15480
|
case Z:
|
|
15481
|
+
toX = startX;
|
|
15482
|
+
toY = startY;
|
|
15483
|
+
distance = segments[index];
|
|
15484
|
+
if (total + distance > motionDistance) {
|
|
15485
|
+
set(tempFrom, x, y);
|
|
15486
|
+
set(to, toX, toY);
|
|
15487
|
+
cutDistance = float(motionDistance - total);
|
|
15488
|
+
if (cutDistance) {
|
|
15489
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
15490
|
+
path.push(L, to.x, to.y);
|
|
15491
|
+
}
|
|
15492
|
+
return path;
|
|
15493
|
+
}
|
|
15494
|
+
x = toX;
|
|
15495
|
+
y = toY;
|
|
15464
15496
|
i += 1;
|
|
15465
15497
|
path.push(command);
|
|
15498
|
+
break;
|
|
15466
15499
|
|
|
15467
15500
|
default:
|
|
15468
15501
|
distance = 0;
|