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.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$4(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$5(t, other);
|
|
310
310
|
toTempAB(t, other, change);
|
|
311
|
-
return set$
|
|
311
|
+
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]));
|
|
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$4(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$4(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
|
-
const {set: set$
|
|
325
|
+
const {set: set$4, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
326
326
|
const {round: round$6, pow: pow$2, max: max$4, floor: floor$3, PI: PI$4} = Math;
|
|
327
327
|
const tempScaleData$1 = {};
|
|
328
328
|
const MathHelper = {
|
|
@@ -829,7 +829,7 @@ var LeaferUI = function(exports) {
|
|
|
829
829
|
return y1 + (y2 - y1) / 2;
|
|
830
830
|
},
|
|
831
831
|
getDistance(t, point) {
|
|
832
|
-
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
832
|
+
return getDistanceFrom$1(t.x, t.y, point.x, point.y);
|
|
833
833
|
},
|
|
834
834
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
835
835
|
const x = abs$7(x2 - x1);
|
|
@@ -837,7 +837,7 @@ var LeaferUI = function(exports) {
|
|
|
837
837
|
return sqrt$4(x * x + y * y);
|
|
838
838
|
},
|
|
839
839
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
840
|
-
return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
840
|
+
return min$2(getDistanceFrom$1(x1, y1, x2, y2), getDistanceFrom$1(x2, y2, x3, y3));
|
|
841
841
|
},
|
|
842
842
|
getAngle(t, to, radiusX, radiusY) {
|
|
843
843
|
return getAtan2(t, to, radiusX, radiusY) / OneRadian;
|
|
@@ -878,7 +878,7 @@ var LeaferUI = function(exports) {
|
|
|
878
878
|
}
|
|
879
879
|
};
|
|
880
880
|
const P$5 = PointHelper;
|
|
881
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$9, setRadius: setRadius, getAtan2: getAtan2} = P$5;
|
|
881
|
+
const {getDistanceFrom: getDistanceFrom$1, copy: copy$9, setRadius: setRadius, getAtan2: getAtan2} = P$5;
|
|
882
882
|
class Point {
|
|
883
883
|
constructor(x, y) {
|
|
884
884
|
this.set(x, y);
|
|
@@ -2527,7 +2527,7 @@ var LeaferUI = function(exports) {
|
|
|
2527
2527
|
};
|
|
2528
2528
|
const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$6, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2529
2529
|
const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
|
|
2530
|
-
const {set: set$
|
|
2530
|
+
const {set: set$3, toNumberPoints: toNumberPoints} = PointHelper;
|
|
2531
2531
|
const {M: M$6, L: L$7, C: C$5, Q: Q$4, Z: Z$6} = PathCommandMap;
|
|
2532
2532
|
const tempPoint$4 = {};
|
|
2533
2533
|
const BezierHelper = {
|
|
@@ -2603,8 +2603,8 @@ var LeaferUI = function(exports) {
|
|
|
2603
2603
|
setPoint$1(setPointBounds, fromX, fromY);
|
|
2604
2604
|
addPoint$1(setPointBounds, x1, y1);
|
|
2605
2605
|
}
|
|
2606
|
-
if (setStartPoint) set$
|
|
2607
|
-
if (setEndPoint) set$
|
|
2606
|
+
if (setStartPoint) set$3(setStartPoint, fromX, fromY);
|
|
2607
|
+
if (setEndPoint) set$3(setEndPoint, x1, y1);
|
|
2608
2608
|
return;
|
|
2609
2609
|
}
|
|
2610
2610
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2629,7 +2629,10 @@ var LeaferUI = function(exports) {
|
|
|
2629
2629
|
if (endRadian < 0) endRadian += PI2;
|
|
2630
2630
|
let totalRadian = endRadian - startRadian;
|
|
2631
2631
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2632
|
-
if (anticlockwise)
|
|
2632
|
+
if (anticlockwise) {
|
|
2633
|
+
const closedAngle = abs$6(endAngle - startAngle) === 360;
|
|
2634
|
+
if (closedAngle) totalRadian = -PI2; else totalRadian -= PI2;
|
|
2635
|
+
}
|
|
2633
2636
|
const parts = ceil$1(abs$6(totalRadian / PI_2));
|
|
2634
2637
|
const partRadian = totalRadian / parts;
|
|
2635
2638
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
@@ -2644,7 +2647,7 @@ var LeaferUI = function(exports) {
|
|
|
2644
2647
|
let fromX = cx + x, fromY = cy + y;
|
|
2645
2648
|
if (data) data.push(data.length ? L$7 : M$6, fromX, fromY);
|
|
2646
2649
|
if (setPointBounds) setPoint$1(setPointBounds, fromX, fromY);
|
|
2647
|
-
if (setStartPoint) set$
|
|
2650
|
+
if (setStartPoint) set$3(setStartPoint, fromX, fromY);
|
|
2648
2651
|
for (let i = 0; i < parts; i++) {
|
|
2649
2652
|
endCos = cos$4(endRadian);
|
|
2650
2653
|
endSin = sin$4(endRadian);
|
|
@@ -2663,7 +2666,7 @@ var LeaferUI = function(exports) {
|
|
|
2663
2666
|
startRadian = endRadian;
|
|
2664
2667
|
endRadian += partRadian;
|
|
2665
2668
|
}
|
|
2666
|
-
if (setEndPoint) set$
|
|
2669
|
+
if (setEndPoint) set$3(setEndPoint, cx + x, cy + y);
|
|
2667
2670
|
},
|
|
2668
2671
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2669
2672
|
data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -6389,11 +6392,11 @@ var LeaferUI = function(exports) {
|
|
|
6389
6392
|
childLayout.boxChanged || childLayout.boxChange();
|
|
6390
6393
|
childLayout.matrixChanged || childLayout.matrixChange();
|
|
6391
6394
|
if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD);
|
|
6395
|
+
if (this.isFrame) child.__bindFrame(this);
|
|
6392
6396
|
if (this.leafer) {
|
|
6393
6397
|
child.__bindLeafer(this.leafer);
|
|
6394
6398
|
if (this.leafer.created) this.__emitChildEvent(ChildEvent.ADD, child);
|
|
6395
6399
|
}
|
|
6396
|
-
if (this.isFrame) child.__bindFrame(this);
|
|
6397
6400
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
6398
6401
|
}
|
|
6399
6402
|
addMany(...children) {
|
|
@@ -6603,7 +6606,7 @@ var LeaferUI = function(exports) {
|
|
|
6603
6606
|
this.levelMap = null;
|
|
6604
6607
|
}
|
|
6605
6608
|
}
|
|
6606
|
-
const version = "2.2.
|
|
6609
|
+
const version = "2.2.4";
|
|
6607
6610
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6608
6611
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6609
6612
|
set zIndex(zIndex) {
|
|
@@ -8924,7 +8927,7 @@ var LeaferUI = function(exports) {
|
|
|
8924
8927
|
__decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
|
|
8925
8928
|
__decorate([ affectRenderBoundsType("hide") ], exports.Frame.prototype, "overflow", void 0);
|
|
8926
8929
|
exports.Frame = __decorate([ registerUI() ], exports.Frame);
|
|
8927
|
-
const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$1, set: set$
|
|
8930
|
+
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 = {};
|
|
8928
8931
|
exports.Ellipse = class Ellipse extends exports.UI {
|
|
8929
8932
|
get __tag() {
|
|
8930
8933
|
return "Ellipse";
|
|
@@ -8938,34 +8941,28 @@ var LeaferUI = function(exports) {
|
|
|
8938
8941
|
if (hasAngle) closedAngle = abs$4(endAngle - startAngle) === 360;
|
|
8939
8942
|
if (innerRadius) {
|
|
8940
8943
|
const drawInnerEllipse = innerRadius < 1 || closed;
|
|
8941
|
-
|
|
8944
|
+
const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
|
|
8942
8945
|
if (hasAngle) {
|
|
8946
|
+
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
|
|
8943
8947
|
if (drawInnerEllipse) {
|
|
8944
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
|
|
8945
8948
|
if (closedAngle) {
|
|
8946
|
-
|
|
8947
|
-
set$1(tempCenter, rx, ry);
|
|
8949
|
+
closePath$2(path);
|
|
8950
|
+
set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
|
|
8948
8951
|
rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
|
|
8949
8952
|
moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
|
|
8950
8953
|
}
|
|
8951
|
-
|
|
8952
|
-
outerEndAngle = startAngle;
|
|
8953
|
-
outerAnticlockwise = true;
|
|
8954
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
|
|
8954
8955
|
} else {
|
|
8955
8956
|
if (!closedAngle) open = true;
|
|
8956
8957
|
}
|
|
8957
8958
|
} else {
|
|
8959
|
+
ellipse(path, rx, ry, rx, ry);
|
|
8958
8960
|
if (drawInnerEllipse) {
|
|
8959
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
8960
8961
|
closePath$2(path);
|
|
8961
|
-
moveTo$3(path,
|
|
8962
|
-
|
|
8963
|
-
outerAnticlockwise = true;
|
|
8964
|
-
} else {
|
|
8965
|
-
outerEndAngle = 360;
|
|
8962
|
+
moveTo$3(path, rx + innerRx, ry);
|
|
8963
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
|
|
8966
8964
|
}
|
|
8967
8965
|
}
|
|
8968
|
-
ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
|
|
8969
8966
|
} else {
|
|
8970
8967
|
if (hasAngle) {
|
|
8971
8968
|
if (!closedAngle) {
|
|
@@ -9050,7 +9047,7 @@ var LeaferUI = function(exports) {
|
|
|
9050
9047
|
__decorate([ pathType(0) ], exports.Star.prototype, "startAngle", void 0);
|
|
9051
9048
|
exports.Star = __decorate([ registerUI() ], exports.Star);
|
|
9052
9049
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
9053
|
-
const {rotate: rotate$1, getAngle: getAngle$
|
|
9050
|
+
const {rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
9054
9051
|
exports.Line = class Line extends exports.UI {
|
|
9055
9052
|
get __tag() {
|
|
9056
9053
|
return "Line";
|
|
@@ -9067,7 +9064,7 @@ var LeaferUI = function(exports) {
|
|
|
9067
9064
|
}
|
|
9068
9065
|
set toPoint(value) {
|
|
9069
9066
|
this.width = getDistance$3(defaultPoint, value);
|
|
9070
|
-
this.rotation = getAngle$
|
|
9067
|
+
this.rotation = getAngle$2(defaultPoint, value);
|
|
9071
9068
|
if (this.height) this.height = 0;
|
|
9072
9069
|
}
|
|
9073
9070
|
__updatePath() {
|
|
@@ -10662,7 +10659,8 @@ var LeaferUI = function(exports) {
|
|
|
10662
10659
|
const {hitFill: hitFill} = data;
|
|
10663
10660
|
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
|
|
10664
10661
|
if (needHitFillPath && this.__hitFill(inner)) return true;
|
|
10665
|
-
const {hitStroke: hitStroke,
|
|
10662
|
+
const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
|
|
10663
|
+
const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
|
|
10666
10664
|
const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
|
|
10667
10665
|
if (!needHitFillPath && !needHitStrokePath) return false;
|
|
10668
10666
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -11603,7 +11601,7 @@ var LeaferUI = function(exports) {
|
|
|
11603
11601
|
return gap === "auto" ? value < 0 ? 0 : value : value;
|
|
11604
11602
|
}
|
|
11605
11603
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
11606
|
-
const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11604
|
+
const {get: get$2, set: set$1, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
|
|
11607
11605
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
11608
11606
|
const transform = get$2(), {x: x, y: y} = box;
|
|
11609
11607
|
if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
|
|
@@ -11625,7 +11623,7 @@ var LeaferUI = function(exports) {
|
|
|
11625
11623
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11626
11624
|
if (clipScaleX) {
|
|
11627
11625
|
if (rotation || skew) {
|
|
11628
|
-
set(tempMatrix$1);
|
|
11626
|
+
set$1(tempMatrix$1);
|
|
11629
11627
|
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
11630
11628
|
multiplyParent(transform, tempMatrix$1);
|
|
11631
11629
|
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
@@ -11858,7 +11856,7 @@ var LeaferUI = function(exports) {
|
|
|
11858
11856
|
if (isTransparent) data.isTransparent = true;
|
|
11859
11857
|
}
|
|
11860
11858
|
}
|
|
11861
|
-
const {getAngle: getAngle, getDistance: getDistance$2} = PointHelper;
|
|
11859
|
+
const {getAngle: getAngle$1, getDistance: getDistance$2} = PointHelper;
|
|
11862
11860
|
const {get: get, rotateOfOuter: rotateOfOuter, scaleOfOuter: scaleOfOuter} = MatrixHelper;
|
|
11863
11861
|
const {toPoint: toPoint$1} = AroundHelper;
|
|
11864
11862
|
const realFrom$1 = {};
|
|
@@ -11881,7 +11879,7 @@ var LeaferUI = function(exports) {
|
|
|
11881
11879
|
let transform;
|
|
11882
11880
|
const {width: width, height: height} = box;
|
|
11883
11881
|
if (width !== height || stretch) {
|
|
11884
|
-
const angle = getAngle(from, to);
|
|
11882
|
+
const angle = getAngle$1(from, to);
|
|
11885
11883
|
transform = get();
|
|
11886
11884
|
if (rotate90) {
|
|
11887
11885
|
scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
|
|
@@ -14123,7 +14121,7 @@ var LeaferUI = function(exports) {
|
|
|
14123
14121
|
}
|
|
14124
14122
|
};
|
|
14125
14123
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
14126
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
|
|
14124
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper, {set: set, getAngle: getAngle, getDistanceFrom: getDistanceFrom, getDistancePoint: getDistancePoint} = PointHelper;
|
|
14127
14125
|
const tempPoint = {}, tempFrom = {};
|
|
14128
14126
|
const HighCurveHelper = {
|
|
14129
14127
|
transform(data, matrix) {
|
|
@@ -14159,16 +14157,19 @@ var LeaferUI = function(exports) {
|
|
|
14159
14157
|
},
|
|
14160
14158
|
getMotionPathData(data) {
|
|
14161
14159
|
let total = 0, distance, segments = [];
|
|
14162
|
-
let i = 0, x = 0, y = 0, toX, toY, command, closed;
|
|
14160
|
+
let i = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command, closed;
|
|
14163
14161
|
const len = data.length;
|
|
14164
14162
|
while (i < len) {
|
|
14165
14163
|
command = data[i];
|
|
14166
14164
|
switch (command) {
|
|
14167
14165
|
case M:
|
|
14166
|
+
startX = data[i + 1];
|
|
14167
|
+
startY = data[i + 2];
|
|
14168
|
+
|
|
14168
14169
|
case L:
|
|
14169
14170
|
toX = data[i + 1];
|
|
14170
14171
|
toY = data[i + 2];
|
|
14171
|
-
distance = command === L && i > 0 ?
|
|
14172
|
+
distance = command === L && i > 0 ? getDistanceFrom(x, y, toX, toY) : 0;
|
|
14172
14173
|
x = toX;
|
|
14173
14174
|
y = toY;
|
|
14174
14175
|
i += 3;
|
|
@@ -14185,7 +14186,9 @@ var LeaferUI = function(exports) {
|
|
|
14185
14186
|
|
|
14186
14187
|
case Z:
|
|
14187
14188
|
closed = true;
|
|
14189
|
+
distance = getDistanceFrom(x, y, startX, startY);
|
|
14188
14190
|
i += 1;
|
|
14191
|
+
break;
|
|
14189
14192
|
|
|
14190
14193
|
default:
|
|
14191
14194
|
distance = 0;
|
|
@@ -14206,25 +14209,26 @@ var LeaferUI = function(exports) {
|
|
|
14206
14209
|
if (offsetX) motionDistance += offsetX;
|
|
14207
14210
|
if (motionDistance > total) motionDistance = motionDistance % total;
|
|
14208
14211
|
let nowDistance = 0, distance, to = {};
|
|
14209
|
-
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
14212
|
+
let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
|
|
14210
14213
|
let x1, y1, x2, y2, t;
|
|
14211
14214
|
const len = data.length;
|
|
14212
14215
|
while (i < len) {
|
|
14213
14216
|
command = data[i];
|
|
14214
14217
|
switch (command) {
|
|
14215
14218
|
case M:
|
|
14219
|
+
startX = data[i + 1];
|
|
14220
|
+
startY = data[i + 2];
|
|
14221
|
+
|
|
14216
14222
|
case L:
|
|
14217
14223
|
toX = data[i + 1];
|
|
14218
14224
|
toY = data[i + 2];
|
|
14219
14225
|
distance = segments[index];
|
|
14220
14226
|
if (nowDistance + distance >= motionDistance || !distanceData.total) {
|
|
14221
|
-
to
|
|
14222
|
-
to.y = toY;
|
|
14227
|
+
set(to, toX, toY);
|
|
14223
14228
|
if (i) {
|
|
14224
|
-
tempFrom
|
|
14225
|
-
tempFrom
|
|
14226
|
-
|
|
14227
|
-
to.rotation = PointHelper.getAngle(tempFrom, to);
|
|
14229
|
+
set(tempFrom, x, y);
|
|
14230
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
14231
|
+
to.rotation = getAngle(tempFrom, to);
|
|
14228
14232
|
return to;
|
|
14229
14233
|
} else {
|
|
14230
14234
|
const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
|
|
@@ -14254,7 +14258,19 @@ var LeaferUI = function(exports) {
|
|
|
14254
14258
|
break;
|
|
14255
14259
|
|
|
14256
14260
|
case Z:
|
|
14261
|
+
toX = startX;
|
|
14262
|
+
toY = startY;
|
|
14263
|
+
distance = segments[index];
|
|
14264
|
+
if (nowDistance + distance >= motionDistance) {
|
|
14265
|
+
set(tempFrom, x, y), set(to, toX, toY);
|
|
14266
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
14267
|
+
to.rotation = getAngle(tempFrom, to);
|
|
14268
|
+
return to;
|
|
14269
|
+
}
|
|
14270
|
+
x = toX;
|
|
14271
|
+
y = toY;
|
|
14257
14272
|
i += 1;
|
|
14273
|
+
break;
|
|
14258
14274
|
|
|
14259
14275
|
default:
|
|
14260
14276
|
distance = 0;
|
|
@@ -14268,26 +14284,27 @@ var LeaferUI = function(exports) {
|
|
|
14268
14284
|
const {segments: segments, data: data} = distanceData, path = [];
|
|
14269
14285
|
motionDistance = UnitConvert.number(motionDistance, distanceData.total);
|
|
14270
14286
|
let total = 0, distance, cutDistance, to = {};
|
|
14271
|
-
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
14287
|
+
let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
|
|
14272
14288
|
let x1, y1, x2, y2, t;
|
|
14273
14289
|
const len = data.length;
|
|
14274
14290
|
while (i < len) {
|
|
14275
14291
|
command = data[i];
|
|
14276
14292
|
switch (command) {
|
|
14277
14293
|
case M:
|
|
14294
|
+
startX = data[i + 1];
|
|
14295
|
+
startY = data[i + 2];
|
|
14296
|
+
|
|
14278
14297
|
case L:
|
|
14279
14298
|
toX = data[i + 1];
|
|
14280
14299
|
toY = data[i + 2];
|
|
14281
14300
|
distance = segments[index];
|
|
14282
14301
|
if (total + distance > motionDistance || !distanceData.total) {
|
|
14283
14302
|
if (!i) x = toX, y = toY;
|
|
14284
|
-
tempFrom
|
|
14285
|
-
|
|
14286
|
-
to.x = toX;
|
|
14287
|
-
to.y = toY;
|
|
14303
|
+
set(tempFrom, x, y);
|
|
14304
|
+
set(to, toX, toY);
|
|
14288
14305
|
cutDistance = float(motionDistance - total);
|
|
14289
14306
|
if (cutDistance) {
|
|
14290
|
-
|
|
14307
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
14291
14308
|
path.push(command, to.x, to.y);
|
|
14292
14309
|
}
|
|
14293
14310
|
return path;
|
|
@@ -14318,8 +14335,24 @@ var LeaferUI = function(exports) {
|
|
|
14318
14335
|
break;
|
|
14319
14336
|
|
|
14320
14337
|
case Z:
|
|
14338
|
+
toX = startX;
|
|
14339
|
+
toY = startY;
|
|
14340
|
+
distance = segments[index];
|
|
14341
|
+
if (total + distance > motionDistance) {
|
|
14342
|
+
set(tempFrom, x, y);
|
|
14343
|
+
set(to, toX, toY);
|
|
14344
|
+
cutDistance = float(motionDistance - total);
|
|
14345
|
+
if (cutDistance) {
|
|
14346
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
14347
|
+
path.push(L, to.x, to.y);
|
|
14348
|
+
}
|
|
14349
|
+
return path;
|
|
14350
|
+
}
|
|
14351
|
+
x = toX;
|
|
14352
|
+
y = toY;
|
|
14321
14353
|
i += 1;
|
|
14322
14354
|
path.push(command);
|
|
14355
|
+
break;
|
|
14323
14356
|
|
|
14324
14357
|
default:
|
|
14325
14358
|
distance = 0;
|