leafer-game 2.2.2 → 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 +102 -57
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +102 -57
- 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);
|
|
@@ -3926,7 +3929,7 @@ var LeaferUI = function(exports) {
|
|
|
3926
3929
|
patternTasker: Resource.queue,
|
|
3927
3930
|
get(config, type) {
|
|
3928
3931
|
let image = Resource.get(config.url);
|
|
3929
|
-
if (!image) Resource.set(config.url, image = type
|
|
3932
|
+
if (!image) Resource.set(config.url, image = Creator[type || "image"](config));
|
|
3930
3933
|
image.use++;
|
|
3931
3934
|
return image;
|
|
3932
3935
|
},
|
|
@@ -5933,6 +5936,9 @@ var LeaferUI = function(exports) {
|
|
|
5933
5936
|
get isLeafer() {
|
|
5934
5937
|
return false;
|
|
5935
5938
|
}
|
|
5939
|
+
get isFrame() {
|
|
5940
|
+
return false;
|
|
5941
|
+
}
|
|
5936
5942
|
get isBranch() {
|
|
5937
5943
|
return false;
|
|
5938
5944
|
}
|
|
@@ -6074,6 +6080,16 @@ var LeaferUI = function(exports) {
|
|
|
6074
6080
|
}
|
|
6075
6081
|
}
|
|
6076
6082
|
}
|
|
6083
|
+
__bindFrame(frame) {
|
|
6084
|
+
if (this.isFrame && frame !== null) frame = this;
|
|
6085
|
+
this.frame = frame;
|
|
6086
|
+
if (this.isBranch) {
|
|
6087
|
+
const {children: children} = this;
|
|
6088
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
6089
|
+
children[i].__bindFrame(frame);
|
|
6090
|
+
}
|
|
6091
|
+
}
|
|
6092
|
+
}
|
|
6077
6093
|
setAttr(name, value) {
|
|
6078
6094
|
this[name] = value;
|
|
6079
6095
|
}
|
|
@@ -6376,6 +6392,7 @@ var LeaferUI = function(exports) {
|
|
|
6376
6392
|
childLayout.boxChanged || childLayout.boxChange();
|
|
6377
6393
|
childLayout.matrixChanged || childLayout.matrixChange();
|
|
6378
6394
|
if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD);
|
|
6395
|
+
if (this.isFrame) child.__bindFrame(this);
|
|
6379
6396
|
if (this.leafer) {
|
|
6380
6397
|
child.__bindLeafer(this.leafer);
|
|
6381
6398
|
if (this.leafer.created) this.__emitChildEvent(ChildEvent.ADD, child);
|
|
@@ -6435,6 +6452,7 @@ var LeaferUI = function(exports) {
|
|
|
6435
6452
|
if (this.leafer.hitCanvasManager) this.leafer.hitCanvasManager.clear();
|
|
6436
6453
|
}
|
|
6437
6454
|
}
|
|
6455
|
+
if (this.isFrame) child.__bindFrame(null);
|
|
6438
6456
|
}
|
|
6439
6457
|
__emitChildEvent(type, child) {
|
|
6440
6458
|
const event = new ChildEvent(type, child, this);
|
|
@@ -6588,7 +6606,7 @@ var LeaferUI = function(exports) {
|
|
|
6588
6606
|
this.levelMap = null;
|
|
6589
6607
|
}
|
|
6590
6608
|
}
|
|
6591
|
-
const version = "2.2.
|
|
6609
|
+
const version = "2.2.4";
|
|
6592
6610
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6593
6611
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6594
6612
|
set zIndex(zIndex) {
|
|
@@ -8154,9 +8172,6 @@ var LeaferUI = function(exports) {
|
|
|
8154
8172
|
get app() {
|
|
8155
8173
|
return this.leafer && this.leafer.app;
|
|
8156
8174
|
}
|
|
8157
|
-
get isFrame() {
|
|
8158
|
-
return false;
|
|
8159
|
-
}
|
|
8160
8175
|
set strokeWidthFixed(value) {
|
|
8161
8176
|
this.strokeScaleFixed = value;
|
|
8162
8177
|
}
|
|
@@ -8912,7 +8927,7 @@ var LeaferUI = function(exports) {
|
|
|
8912
8927
|
__decorate([ surfaceType("#FFFFFF") ], exports.Frame.prototype, "fill", void 0);
|
|
8913
8928
|
__decorate([ affectRenderBoundsType("hide") ], exports.Frame.prototype, "overflow", void 0);
|
|
8914
8929
|
exports.Frame = __decorate([ registerUI() ], exports.Frame);
|
|
8915
|
-
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 = {};
|
|
8916
8931
|
exports.Ellipse = class Ellipse extends exports.UI {
|
|
8917
8932
|
get __tag() {
|
|
8918
8933
|
return "Ellipse";
|
|
@@ -8926,34 +8941,28 @@ var LeaferUI = function(exports) {
|
|
|
8926
8941
|
if (hasAngle) closedAngle = abs$4(endAngle - startAngle) === 360;
|
|
8927
8942
|
if (innerRadius) {
|
|
8928
8943
|
const drawInnerEllipse = innerRadius < 1 || closed;
|
|
8929
|
-
|
|
8944
|
+
const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
|
|
8930
8945
|
if (hasAngle) {
|
|
8946
|
+
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
|
|
8931
8947
|
if (drawInnerEllipse) {
|
|
8932
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
|
|
8933
8948
|
if (closedAngle) {
|
|
8934
|
-
|
|
8935
|
-
set$1(tempCenter, rx, ry);
|
|
8949
|
+
closePath$2(path);
|
|
8950
|
+
set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
|
|
8936
8951
|
rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
|
|
8937
8952
|
moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
|
|
8938
8953
|
}
|
|
8939
|
-
|
|
8940
|
-
outerEndAngle = startAngle;
|
|
8941
|
-
outerAnticlockwise = true;
|
|
8954
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
|
|
8942
8955
|
} else {
|
|
8943
8956
|
if (!closedAngle) open = true;
|
|
8944
8957
|
}
|
|
8945
8958
|
} else {
|
|
8959
|
+
ellipse(path, rx, ry, rx, ry);
|
|
8946
8960
|
if (drawInnerEllipse) {
|
|
8947
|
-
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
8948
8961
|
closePath$2(path);
|
|
8949
|
-
moveTo$3(path,
|
|
8950
|
-
|
|
8951
|
-
outerAnticlockwise = true;
|
|
8952
|
-
} else {
|
|
8953
|
-
outerEndAngle = 360;
|
|
8962
|
+
moveTo$3(path, rx + innerRx, ry);
|
|
8963
|
+
ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
|
|
8954
8964
|
}
|
|
8955
8965
|
}
|
|
8956
|
-
ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
|
|
8957
8966
|
} else {
|
|
8958
8967
|
if (hasAngle) {
|
|
8959
8968
|
if (!closedAngle) {
|
|
@@ -9038,7 +9047,7 @@ var LeaferUI = function(exports) {
|
|
|
9038
9047
|
__decorate([ pathType(0) ], exports.Star.prototype, "startAngle", void 0);
|
|
9039
9048
|
exports.Star = __decorate([ registerUI() ], exports.Star);
|
|
9040
9049
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
9041
|
-
const {rotate: rotate$1, getAngle: getAngle$
|
|
9050
|
+
const {rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
|
|
9042
9051
|
exports.Line = class Line extends exports.UI {
|
|
9043
9052
|
get __tag() {
|
|
9044
9053
|
return "Line";
|
|
@@ -9055,7 +9064,7 @@ var LeaferUI = function(exports) {
|
|
|
9055
9064
|
}
|
|
9056
9065
|
set toPoint(value) {
|
|
9057
9066
|
this.width = getDistance$3(defaultPoint, value);
|
|
9058
|
-
this.rotation = getAngle$
|
|
9067
|
+
this.rotation = getAngle$2(defaultPoint, value);
|
|
9059
9068
|
if (this.height) this.height = 0;
|
|
9060
9069
|
}
|
|
9061
9070
|
__updatePath() {
|
|
@@ -10650,7 +10659,8 @@ var LeaferUI = function(exports) {
|
|
|
10650
10659
|
const {hitFill: hitFill} = data;
|
|
10651
10660
|
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
|
|
10652
10661
|
if (needHitFillPath && this.__hitFill(inner)) return true;
|
|
10653
|
-
const {hitStroke: hitStroke,
|
|
10662
|
+
const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
|
|
10663
|
+
const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
|
|
10654
10664
|
const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
|
|
10655
10665
|
if (!needHitFillPath && !needHitStrokePath) return false;
|
|
10656
10666
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -11591,7 +11601,7 @@ var LeaferUI = function(exports) {
|
|
|
11591
11601
|
return gap === "auto" ? value < 0 ? 0 : value : value;
|
|
11592
11602
|
}
|
|
11593
11603
|
let origin = {}, tempMatrix$1 = getMatrixData();
|
|
11594
|
-
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;
|
|
11595
11605
|
function stretchMode(data, box, scaleX, scaleY) {
|
|
11596
11606
|
const transform = get$2(), {x: x, y: y} = box;
|
|
11597
11607
|
if (x || y) translate(transform, x, y); else if (scaleX > 0 && scaleY > 0) transform.onlyScale = true;
|
|
@@ -11613,7 +11623,7 @@ var LeaferUI = function(exports) {
|
|
|
11613
11623
|
layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11614
11624
|
if (clipScaleX) {
|
|
11615
11625
|
if (rotation || skew) {
|
|
11616
|
-
set(tempMatrix$1);
|
|
11626
|
+
set$1(tempMatrix$1);
|
|
11617
11627
|
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
11618
11628
|
multiplyParent(transform, tempMatrix$1);
|
|
11619
11629
|
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
@@ -11846,7 +11856,7 @@ var LeaferUI = function(exports) {
|
|
|
11846
11856
|
if (isTransparent) data.isTransparent = true;
|
|
11847
11857
|
}
|
|
11848
11858
|
}
|
|
11849
|
-
const {getAngle: getAngle, getDistance: getDistance$2} = PointHelper;
|
|
11859
|
+
const {getAngle: getAngle$1, getDistance: getDistance$2} = PointHelper;
|
|
11850
11860
|
const {get: get, rotateOfOuter: rotateOfOuter, scaleOfOuter: scaleOfOuter} = MatrixHelper;
|
|
11851
11861
|
const {toPoint: toPoint$1} = AroundHelper;
|
|
11852
11862
|
const realFrom$1 = {};
|
|
@@ -11869,7 +11879,7 @@ var LeaferUI = function(exports) {
|
|
|
11869
11879
|
let transform;
|
|
11870
11880
|
const {width: width, height: height} = box;
|
|
11871
11881
|
if (width !== height || stretch) {
|
|
11872
|
-
const angle = getAngle(from, to);
|
|
11882
|
+
const angle = getAngle$1(from, to);
|
|
11873
11883
|
transform = get();
|
|
11874
11884
|
if (rotate90) {
|
|
11875
11885
|
scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
|
|
@@ -14111,7 +14121,7 @@ var LeaferUI = function(exports) {
|
|
|
14111
14121
|
}
|
|
14112
14122
|
};
|
|
14113
14123
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
14114
|
-
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;
|
|
14115
14125
|
const tempPoint = {}, tempFrom = {};
|
|
14116
14126
|
const HighCurveHelper = {
|
|
14117
14127
|
transform(data, matrix) {
|
|
@@ -14147,16 +14157,19 @@ var LeaferUI = function(exports) {
|
|
|
14147
14157
|
},
|
|
14148
14158
|
getMotionPathData(data) {
|
|
14149
14159
|
let total = 0, distance, segments = [];
|
|
14150
|
-
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;
|
|
14151
14161
|
const len = data.length;
|
|
14152
14162
|
while (i < len) {
|
|
14153
14163
|
command = data[i];
|
|
14154
14164
|
switch (command) {
|
|
14155
14165
|
case M:
|
|
14166
|
+
startX = data[i + 1];
|
|
14167
|
+
startY = data[i + 2];
|
|
14168
|
+
|
|
14156
14169
|
case L:
|
|
14157
14170
|
toX = data[i + 1];
|
|
14158
14171
|
toY = data[i + 2];
|
|
14159
|
-
distance = command === L && i > 0 ?
|
|
14172
|
+
distance = command === L && i > 0 ? getDistanceFrom(x, y, toX, toY) : 0;
|
|
14160
14173
|
x = toX;
|
|
14161
14174
|
y = toY;
|
|
14162
14175
|
i += 3;
|
|
@@ -14173,7 +14186,9 @@ var LeaferUI = function(exports) {
|
|
|
14173
14186
|
|
|
14174
14187
|
case Z:
|
|
14175
14188
|
closed = true;
|
|
14189
|
+
distance = getDistanceFrom(x, y, startX, startY);
|
|
14176
14190
|
i += 1;
|
|
14191
|
+
break;
|
|
14177
14192
|
|
|
14178
14193
|
default:
|
|
14179
14194
|
distance = 0;
|
|
@@ -14194,25 +14209,26 @@ var LeaferUI = function(exports) {
|
|
|
14194
14209
|
if (offsetX) motionDistance += offsetX;
|
|
14195
14210
|
if (motionDistance > total) motionDistance = motionDistance % total;
|
|
14196
14211
|
let nowDistance = 0, distance, to = {};
|
|
14197
|
-
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;
|
|
14198
14213
|
let x1, y1, x2, y2, t;
|
|
14199
14214
|
const len = data.length;
|
|
14200
14215
|
while (i < len) {
|
|
14201
14216
|
command = data[i];
|
|
14202
14217
|
switch (command) {
|
|
14203
14218
|
case M:
|
|
14219
|
+
startX = data[i + 1];
|
|
14220
|
+
startY = data[i + 2];
|
|
14221
|
+
|
|
14204
14222
|
case L:
|
|
14205
14223
|
toX = data[i + 1];
|
|
14206
14224
|
toY = data[i + 2];
|
|
14207
14225
|
distance = segments[index];
|
|
14208
14226
|
if (nowDistance + distance >= motionDistance || !distanceData.total) {
|
|
14209
|
-
to
|
|
14210
|
-
to.y = toY;
|
|
14227
|
+
set(to, toX, toY);
|
|
14211
14228
|
if (i) {
|
|
14212
|
-
tempFrom
|
|
14213
|
-
tempFrom
|
|
14214
|
-
|
|
14215
|
-
to.rotation = PointHelper.getAngle(tempFrom, to);
|
|
14229
|
+
set(tempFrom, x, y);
|
|
14230
|
+
getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
14231
|
+
to.rotation = getAngle(tempFrom, to);
|
|
14216
14232
|
return to;
|
|
14217
14233
|
} else {
|
|
14218
14234
|
const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
|
|
@@ -14242,7 +14258,19 @@ var LeaferUI = function(exports) {
|
|
|
14242
14258
|
break;
|
|
14243
14259
|
|
|
14244
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;
|
|
14245
14272
|
i += 1;
|
|
14273
|
+
break;
|
|
14246
14274
|
|
|
14247
14275
|
default:
|
|
14248
14276
|
distance = 0;
|
|
@@ -14256,26 +14284,27 @@ var LeaferUI = function(exports) {
|
|
|
14256
14284
|
const {segments: segments, data: data} = distanceData, path = [];
|
|
14257
14285
|
motionDistance = UnitConvert.number(motionDistance, distanceData.total);
|
|
14258
14286
|
let total = 0, distance, cutDistance, to = {};
|
|
14259
|
-
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;
|
|
14260
14288
|
let x1, y1, x2, y2, t;
|
|
14261
14289
|
const len = data.length;
|
|
14262
14290
|
while (i < len) {
|
|
14263
14291
|
command = data[i];
|
|
14264
14292
|
switch (command) {
|
|
14265
14293
|
case M:
|
|
14294
|
+
startX = data[i + 1];
|
|
14295
|
+
startY = data[i + 2];
|
|
14296
|
+
|
|
14266
14297
|
case L:
|
|
14267
14298
|
toX = data[i + 1];
|
|
14268
14299
|
toY = data[i + 2];
|
|
14269
14300
|
distance = segments[index];
|
|
14270
14301
|
if (total + distance > motionDistance || !distanceData.total) {
|
|
14271
14302
|
if (!i) x = toX, y = toY;
|
|
14272
|
-
tempFrom
|
|
14273
|
-
|
|
14274
|
-
to.x = toX;
|
|
14275
|
-
to.y = toY;
|
|
14303
|
+
set(tempFrom, x, y);
|
|
14304
|
+
set(to, toX, toY);
|
|
14276
14305
|
cutDistance = float(motionDistance - total);
|
|
14277
14306
|
if (cutDistance) {
|
|
14278
|
-
|
|
14307
|
+
getDistancePoint(tempFrom, to, cutDistance, true);
|
|
14279
14308
|
path.push(command, to.x, to.y);
|
|
14280
14309
|
}
|
|
14281
14310
|
return path;
|
|
@@ -14306,8 +14335,24 @@ var LeaferUI = function(exports) {
|
|
|
14306
14335
|
break;
|
|
14307
14336
|
|
|
14308
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;
|
|
14309
14353
|
i += 1;
|
|
14310
14354
|
path.push(command);
|
|
14355
|
+
break;
|
|
14311
14356
|
|
|
14312
14357
|
default:
|
|
14313
14358
|
distance = 0;
|