@leafer-game/miniapp 2.2.3 → 2.2.5
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 +98 -56
- 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);
|
|
@@ -4770,7 +4773,7 @@ function useModule(module, exclude) {
|
|
|
4770
4773
|
if (!excludeNames.includes(name) && (!exclude || !exclude.includes(name))) {
|
|
4771
4774
|
if (module.prototype) {
|
|
4772
4775
|
const d = getDescriptor(module.prototype, name);
|
|
4773
|
-
if (d
|
|
4776
|
+
if (d) Object.defineProperty(target.prototype, name, d);
|
|
4774
4777
|
} else {
|
|
4775
4778
|
target.prototype[name] = module[name];
|
|
4776
4779
|
}
|
|
@@ -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.5";
|
|
7024
7027
|
|
|
7025
7028
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7026
7029
|
get allowBackgroundColor() {
|
|
@@ -7992,7 +7995,7 @@ class Picker {
|
|
|
7992
7995
|
if (child.__hitWorld(point, onlyHitMask && child.mask === "path" ? true : undefined)) {
|
|
7993
7996
|
const {parent: parent, mask: mask} = child;
|
|
7994
7997
|
if (parent && parent.__hasMask && mask && !(mask === "clipping" || mask === "clipping-path")) {
|
|
7995
|
-
if (!parent.children.some(item => !item.mask &&
|
|
7998
|
+
if (!parent.children.some(item => !item.mask && this.isHitLeaf(item, point))) return;
|
|
7996
7999
|
}
|
|
7997
8000
|
const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
|
|
7998
8001
|
if (hitThrough) {
|
|
@@ -8002,6 +8005,15 @@ class Picker {
|
|
|
8002
8005
|
findList.add(leaf);
|
|
8003
8006
|
}
|
|
8004
8007
|
}
|
|
8008
|
+
isHitLeaf(leaf, point) {
|
|
8009
|
+
if (leaf.isBranch) {
|
|
8010
|
+
const {findList: findList} = this, old = findList.length;
|
|
8011
|
+
this.eachFind([ leaf ], false);
|
|
8012
|
+
const count = findList.length - old;
|
|
8013
|
+
for (let i = 0; i < count; i++) findList.remove(findList.indexAt(findList.length - 1));
|
|
8014
|
+
return !!count;
|
|
8015
|
+
} else return leaf.__hitWorld(point);
|
|
8016
|
+
}
|
|
8005
8017
|
clear() {
|
|
8006
8018
|
this.point = null;
|
|
8007
8019
|
this.findList = null;
|
|
@@ -9500,7 +9512,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
|
|
|
9500
9512
|
|
|
9501
9513
|
Frame = __decorate([ registerUI() ], Frame);
|
|
9502
9514
|
|
|
9503
|
-
const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$1, set: set$
|
|
9515
|
+
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
9516
|
|
|
9505
9517
|
let Ellipse = class Ellipse extends UI {
|
|
9506
9518
|
get __tag() {
|
|
@@ -9515,34 +9527,28 @@ let Ellipse = class Ellipse extends UI {
|
|
|
9515
9527
|
if (hasAngle) closedAngle = abs$4(endAngle - startAngle) === 360;
|
|
9516
9528
|
if (innerRadius) {
|
|
9517
9529
|
const drawInnerEllipse = innerRadius < 1 || closed;
|
|
9518
|
-
|
|
9530
|
+
const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
|
|
9519
9531
|
if (hasAngle) {
|
|
9532
|
+
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
|
|
9520
9533
|
if (drawInnerEllipse) {
|
|
9521
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
|
|
9522
9534
|
if (closedAngle) {
|
|
9523
|
-
|
|
9524
|
-
set$1(tempCenter, rx, ry);
|
|
9535
|
+
closePath$2(path);
|
|
9536
|
+
set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
|
|
9525
9537
|
rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
|
|
9526
9538
|
moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
|
|
9527
9539
|
}
|
|
9528
|
-
|
|
9529
|
-
outerEndAngle = startAngle;
|
|
9530
|
-
outerAnticlockwise = true;
|
|
9540
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
|
|
9531
9541
|
} else {
|
|
9532
9542
|
if (!closedAngle) open = true;
|
|
9533
9543
|
}
|
|
9534
9544
|
} else {
|
|
9545
|
+
ellipse(path, rx, ry, rx, ry);
|
|
9535
9546
|
if (drawInnerEllipse) {
|
|
9536
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
9537
9547
|
closePath$2(path);
|
|
9538
|
-
moveTo$3(path,
|
|
9539
|
-
|
|
9540
|
-
outerAnticlockwise = true;
|
|
9541
|
-
} else {
|
|
9542
|
-
outerEndAngle = 360;
|
|
9548
|
+
moveTo$3(path, rx + innerRx, ry);
|
|
9549
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
|
|
9543
9550
|
}
|
|
9544
9551
|
}
|
|
9545
|
-
ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
|
|
9546
9552
|
} else {
|
|
9547
9553
|
if (hasAngle) {
|
|
9548
9554
|
if (!closedAngle) {
|
|
@@ -9651,7 +9657,7 @@ Star = __decorate([ registerUI() ], Star);
|
|
|
9651
9657
|
|
|
9652
9658
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
9653
9659
|
|
|
9654
|
-
const {rotate: rotate$1, getAngle: getAngle$
|
|
9660
|
+
const {rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
9655
9661
|
|
|
9656
9662
|
let Line = class Line extends UI {
|
|
9657
9663
|
get __tag() {
|
|
@@ -9669,7 +9675,7 @@ let Line = class Line extends UI {
|
|
|
9669
9675
|
}
|
|
9670
9676
|
set toPoint(value) {
|
|
9671
9677
|
this.width = getDistance$3(defaultPoint, value);
|
|
9672
|
-
this.rotation = getAngle$
|
|
9678
|
+
this.rotation = getAngle$2(defaultPoint, value);
|
|
9673
9679
|
if (this.height) this.height = 0;
|
|
9674
9680
|
}
|
|
9675
9681
|
__updatePath() {
|
|
@@ -11442,7 +11448,8 @@ ui$5.__hit = function(inner, forceHitFill) {
|
|
|
11442
11448
|
const {hitFill: hitFill} = data;
|
|
11443
11449
|
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
|
|
11444
11450
|
if (needHitFillPath && this.__hitFill(inner)) return true;
|
|
11445
|
-
const {hitStroke: hitStroke,
|
|
11451
|
+
const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
|
|
11452
|
+
const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
|
|
11446
11453
|
const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
|
|
11447
11454
|
if (!needHitFillPath && !needHitStrokePath) return false;
|
|
11448
11455
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -12217,7 +12224,7 @@ function getGapValue(gap, size, totalSize, rows) {
|
|
|
12217
12224
|
|
|
12218
12225
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
12219
12226
|
|
|
12220
|
-
const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
12227
|
+
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
12228
|
|
|
12222
12229
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
12223
12230
|
const transform = get$2(), {x: x, y: y} = box;
|
|
@@ -12242,7 +12249,7 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
12242
12249
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
12243
12250
|
if (clipScaleX) {
|
|
12244
12251
|
if (rotation || skew) {
|
|
12245
|
-
set(tempMatrix$1);
|
|
12252
|
+
set$1(tempMatrix$1);
|
|
12246
12253
|
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
12247
12254
|
multiplyParent(transform, tempMatrix$1);
|
|
12248
12255
|
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
@@ -12493,7 +12500,7 @@ function applyStops(data, gradient, stops, opacity) {
|
|
|
12493
12500
|
}
|
|
12494
12501
|
}
|
|
12495
12502
|
|
|
12496
|
-
const {getAngle: getAngle, getDistance: getDistance$2} = PointHelper;
|
|
12503
|
+
const {getAngle: getAngle$1, getDistance: getDistance$2} = PointHelper;
|
|
12497
12504
|
|
|
12498
12505
|
const {get: get, rotateOfOuter: rotateOfOuter, scaleOfOuter: scaleOfOuter} = MatrixHelper;
|
|
12499
12506
|
|
|
@@ -12522,7 +12529,7 @@ function getTransform(box, from, to, stretch, rotate90) {
|
|
|
12522
12529
|
let transform;
|
|
12523
12530
|
const {width: width, height: height} = box;
|
|
12524
12531
|
if (width !== height || stretch) {
|
|
12525
|
-
const angle = getAngle(from, to);
|
|
12532
|
+
const angle = getAngle$1(from, to);
|
|
12526
12533
|
transform = get();
|
|
12527
12534
|
if (rotate90) {
|
|
12528
12535
|
scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
|
|
@@ -15015,7 +15022,7 @@ const HighBezierHelper = {
|
|
|
15015
15022
|
|
|
15016
15023
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
15017
15024
|
|
|
15018
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
|
|
15025
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper, {set: set, getAngle: getAngle, getDistanceFrom: getDistanceFrom, getDistancePoint: getDistancePoint} = PointHelper;
|
|
15019
15026
|
|
|
15020
15027
|
const tempPoint = {}, tempFrom = {};
|
|
15021
15028
|
|
|
@@ -15053,16 +15060,19 @@ const HighCurveHelper = {
|
|
|
15053
15060
|
},
|
|
15054
15061
|
getMotionPathData(data) {
|
|
15055
15062
|
let total = 0, distance, segments = [];
|
|
15056
|
-
let i = 0, x = 0, y = 0, toX, toY, command, closed;
|
|
15063
|
+
let i = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command, closed;
|
|
15057
15064
|
const len = data.length;
|
|
15058
15065
|
while (i < len) {
|
|
15059
15066
|
command = data[i];
|
|
15060
15067
|
switch (command) {
|
|
15061
15068
|
case M:
|
|
15069
|
+
startX = data[i + 1];
|
|
15070
|
+
startY = data[i + 2];
|
|
15071
|
+
|
|
15062
15072
|
case L:
|
|
15063
15073
|
toX = data[i + 1];
|
|
15064
15074
|
toY = data[i + 2];
|
|
15065
|
-
distance = command === L && i > 0 ?
|
|
15075
|
+
distance = command === L && i > 0 ? getDistanceFrom(x, y, toX, toY) : 0;
|
|
15066
15076
|
x = toX;
|
|
15067
15077
|
y = toY;
|
|
15068
15078
|
i += 3;
|
|
@@ -15079,7 +15089,9 @@ const HighCurveHelper = {
|
|
|
15079
15089
|
|
|
15080
15090
|
case Z:
|
|
15081
15091
|
closed = true;
|
|
15092
|
+
distance = getDistanceFrom(x, y, startX, startY);
|
|
15082
15093
|
i += 1;
|
|
15094
|
+
break;
|
|
15083
15095
|
|
|
15084
15096
|
default:
|
|
15085
15097
|
distance = 0;
|
|
@@ -15100,25 +15112,26 @@ const HighCurveHelper = {
|
|
|
15100
15112
|
if (offsetX) motionDistance += offsetX;
|
|
15101
15113
|
if (motionDistance > total) motionDistance = motionDistance % total;
|
|
15102
15114
|
let nowDistance = 0, distance, to = {};
|
|
15103
|
-
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
15115
|
+
let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
|
|
15104
15116
|
let x1, y1, x2, y2, t;
|
|
15105
15117
|
const len = data.length;
|
|
15106
15118
|
while (i < len) {
|
|
15107
15119
|
command = data[i];
|
|
15108
15120
|
switch (command) {
|
|
15109
15121
|
case M:
|
|
15122
|
+
startX = data[i + 1];
|
|
15123
|
+
startY = data[i + 2];
|
|
15124
|
+
|
|
15110
15125
|
case L:
|
|
15111
15126
|
toX = data[i + 1];
|
|
15112
15127
|
toY = data[i + 2];
|
|
15113
15128
|
distance = segments[index];
|
|
15114
15129
|
if (nowDistance + distance >= motionDistance || !distanceData.total) {
|
|
15115
|
-
to
|
|
15116
|
-
to.y = toY;
|
|
15130
|
+
set(to, toX, toY);
|
|
15117
15131
|
if (i) {
|
|
15118
|
-
tempFrom
|
|
15119
|
-
tempFrom
|
|
15120
|
-
|
|
15121
|
-
to.rotation = PointHelper.getAngle(tempFrom, to);
|
|
15132
|
+
set(tempFrom, x, y);
|
|
15133
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
15134
|
+
to.rotation = getAngle(tempFrom, to);
|
|
15122
15135
|
return to;
|
|
15123
15136
|
} else {
|
|
15124
15137
|
const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
|
|
@@ -15148,7 +15161,19 @@ const HighCurveHelper = {
|
|
|
15148
15161
|
break;
|
|
15149
15162
|
|
|
15150
15163
|
case Z:
|
|
15164
|
+
toX = startX;
|
|
15165
|
+
toY = startY;
|
|
15166
|
+
distance = segments[index];
|
|
15167
|
+
if (nowDistance + distance >= motionDistance) {
|
|
15168
|
+
set(tempFrom, x, y), set(to, toX, toY);
|
|
15169
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
15170
|
+
to.rotation = getAngle(tempFrom, to);
|
|
15171
|
+
return to;
|
|
15172
|
+
}
|
|
15173
|
+
x = toX;
|
|
15174
|
+
y = toY;
|
|
15151
15175
|
i += 1;
|
|
15176
|
+
break;
|
|
15152
15177
|
|
|
15153
15178
|
default:
|
|
15154
15179
|
distance = 0;
|
|
@@ -15162,26 +15187,27 @@ const HighCurveHelper = {
|
|
|
15162
15187
|
const {segments: segments, data: data} = distanceData, path = [];
|
|
15163
15188
|
motionDistance = UnitConvert.number(motionDistance, distanceData.total);
|
|
15164
15189
|
let total = 0, distance, cutDistance, to = {};
|
|
15165
|
-
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
15190
|
+
let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
|
|
15166
15191
|
let x1, y1, x2, y2, t;
|
|
15167
15192
|
const len = data.length;
|
|
15168
15193
|
while (i < len) {
|
|
15169
15194
|
command = data[i];
|
|
15170
15195
|
switch (command) {
|
|
15171
15196
|
case M:
|
|
15197
|
+
startX = data[i + 1];
|
|
15198
|
+
startY = data[i + 2];
|
|
15199
|
+
|
|
15172
15200
|
case L:
|
|
15173
15201
|
toX = data[i + 1];
|
|
15174
15202
|
toY = data[i + 2];
|
|
15175
15203
|
distance = segments[index];
|
|
15176
15204
|
if (total + distance > motionDistance || !distanceData.total) {
|
|
15177
15205
|
if (!i) x = toX, y = toY;
|
|
15178
|
-
tempFrom
|
|
15179
|
-
|
|
15180
|
-
to.x = toX;
|
|
15181
|
-
to.y = toY;
|
|
15206
|
+
set(tempFrom, x, y);
|
|
15207
|
+
set(to, toX, toY);
|
|
15182
15208
|
cutDistance = float(motionDistance - total);
|
|
15183
15209
|
if (cutDistance) {
|
|
15184
|
-
|
|
15210
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
15185
15211
|
path.push(command, to.x, to.y);
|
|
15186
15212
|
}
|
|
15187
15213
|
return path;
|
|
@@ -15212,8 +15238,24 @@ const HighCurveHelper = {
|
|
|
15212
15238
|
break;
|
|
15213
15239
|
|
|
15214
15240
|
case Z:
|
|
15241
|
+
toX = startX;
|
|
15242
|
+
toY = startY;
|
|
15243
|
+
distance = segments[index];
|
|
15244
|
+
if (total + distance > motionDistance) {
|
|
15245
|
+
set(tempFrom, x, y);
|
|
15246
|
+
set(to, toX, toY);
|
|
15247
|
+
cutDistance = float(motionDistance - total);
|
|
15248
|
+
if (cutDistance) {
|
|
15249
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
15250
|
+
path.push(L, to.x, to.y);
|
|
15251
|
+
}
|
|
15252
|
+
return path;
|
|
15253
|
+
}
|
|
15254
|
+
x = toX;
|
|
15255
|
+
y = toY;
|
|
15215
15256
|
i += 1;
|
|
15216
15257
|
path.push(command);
|
|
15258
|
+
break;
|
|
15217
15259
|
|
|
15218
15260
|
default:
|
|
15219
15261
|
distance = 0;
|