@leafer-game/miniapp 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.
@@ -253,7 +253,7 @@ const FourNumberHelper = {
253
253
  return to;
254
254
  },
255
255
  setTemp(top, right, bottom, left) {
256
- return set$3(tempFour, top, right, bottom, left);
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$3(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]));
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$3(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
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$3(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
307
+ return set$4(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
308
308
  }
309
309
  };
310
310
 
311
- const {set: set$3, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
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$2, toNumberPoints: toNumberPoints} = PointHelper;
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$2(setStartPoint, fromX, fromY);
2794
- if (setEndPoint) set$2(setEndPoint, x1, y1);
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) totalRadian -= PI2;
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$2(setStartPoint, fromX, fromY);
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$2(setEndPoint, cx + x, cy + y);
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);
@@ -4168,7 +4171,7 @@ const ImageManager = {
4168
4171
  patternTasker: Resource.queue,
4169
4172
  get(config, type) {
4170
4173
  let image = Resource.get(config.url);
4171
- if (!image) Resource.set(config.url, image = type === "film" ? Creator.film(config) : Creator.image(config));
4174
+ if (!image) Resource.set(config.url, image = Creator[type || "image"](config));
4172
4175
  image.use++;
4173
4176
  return image;
4174
4177
  },
@@ -6340,6 +6343,9 @@ let Leaf = class Leaf {
6340
6343
  get isLeafer() {
6341
6344
  return false;
6342
6345
  }
6346
+ get isFrame() {
6347
+ return false;
6348
+ }
6343
6349
  get isBranch() {
6344
6350
  return false;
6345
6351
  }
@@ -6481,6 +6487,16 @@ let Leaf = class Leaf {
6481
6487
  }
6482
6488
  }
6483
6489
  }
6490
+ __bindFrame(frame) {
6491
+ if (this.isFrame && frame !== null) frame = this;
6492
+ this.frame = frame;
6493
+ if (this.isBranch) {
6494
+ const {children: children} = this;
6495
+ for (let i = 0, len = children.length; i < len; i++) {
6496
+ children[i].__bindFrame(frame);
6497
+ }
6498
+ }
6499
+ }
6484
6500
  setAttr(name, value) {
6485
6501
  this[name] = value;
6486
6502
  }
@@ -6789,6 +6805,7 @@ let Branch = class Branch extends Leaf {
6789
6805
  childLayout.boxChanged || childLayout.boxChange();
6790
6806
  childLayout.matrixChanged || childLayout.matrixChange();
6791
6807
  if (child.__bubbleMap) child.__emitLifeEvent(ChildEvent.ADD);
6808
+ if (this.isFrame) child.__bindFrame(this);
6792
6809
  if (this.leafer) {
6793
6810
  child.__bindLeafer(this.leafer);
6794
6811
  if (this.leafer.created) this.__emitChildEvent(ChildEvent.ADD, child);
@@ -6848,6 +6865,7 @@ let Branch = class Branch extends Leaf {
6848
6865
  if (this.leafer.hitCanvasManager) this.leafer.hitCanvasManager.clear();
6849
6866
  }
6850
6867
  }
6868
+ if (this.isFrame) child.__bindFrame(null);
6851
6869
  }
6852
6870
  __emitChildEvent(type, child) {
6853
6871
  const event = new ChildEvent(type, child, this);
@@ -7005,7 +7023,7 @@ class LeafLevelList {
7005
7023
  }
7006
7024
  }
7007
7025
 
7008
- const version = "2.2.1";
7026
+ const version = "2.2.4";
7009
7027
 
7010
7028
  class LeaferCanvas extends LeaferCanvasBase {
7011
7029
  get allowBackgroundColor() {
@@ -8617,9 +8635,6 @@ let UI = UI_1 = class UI extends Leaf {
8617
8635
  get app() {
8618
8636
  return this.leafer && this.leafer.app;
8619
8637
  }
8620
- get isFrame() {
8621
- return false;
8622
- }
8623
8638
  set strokeWidthFixed(value) {
8624
8639
  this.strokeScaleFixed = value;
8625
8640
  }
@@ -9488,7 +9503,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
9488
9503
 
9489
9504
  Frame = __decorate([ registerUI() ], Frame);
9490
9505
 
9491
- const {moveTo: moveTo$3, closePath: closePath$2, ellipse: ellipse} = PathCommandDataHelper, {tempPoint: tempPoint$1, set: set$1, rotate: rotate$2} = PointHelper, {abs: abs$4} = Math, tempCenter = {};
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 = {};
9492
9507
 
9493
9508
  let Ellipse = class Ellipse extends UI {
9494
9509
  get __tag() {
@@ -9503,34 +9518,28 @@ let Ellipse = class Ellipse extends UI {
9503
9518
  if (hasAngle) closedAngle = abs$4(endAngle - startAngle) === 360;
9504
9519
  if (innerRadius) {
9505
9520
  const drawInnerEllipse = innerRadius < 1 || closed;
9506
- let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9521
+ const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
9507
9522
  if (hasAngle) {
9523
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9508
9524
  if (drawInnerEllipse) {
9509
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9510
9525
  if (closedAngle) {
9511
- set$1(tempPoint$1, width, ry);
9512
- set$1(tempCenter, rx, ry);
9526
+ closePath$2(path);
9527
+ set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
9513
9528
  rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
9514
9529
  moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
9515
9530
  }
9516
- outerStartAngle = endAngle;
9517
- outerEndAngle = startAngle;
9518
- outerAnticlockwise = true;
9531
+ ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9519
9532
  } else {
9520
9533
  if (!closedAngle) open = true;
9521
9534
  }
9522
9535
  } else {
9536
+ ellipse(path, rx, ry, rx, ry);
9523
9537
  if (drawInnerEllipse) {
9524
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
9525
9538
  closePath$2(path);
9526
- moveTo$3(path, width, ry);
9527
- outerStartAngle = 360;
9528
- outerAnticlockwise = true;
9529
- } else {
9530
- outerEndAngle = 360;
9539
+ moveTo$3(path, rx + innerRx, ry);
9540
+ ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
9531
9541
  }
9532
9542
  }
9533
- ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9534
9543
  } else {
9535
9544
  if (hasAngle) {
9536
9545
  if (!closedAngle) {
@@ -9639,7 +9648,7 @@ Star = __decorate([ registerUI() ], Star);
9639
9648
 
9640
9649
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9641
9650
 
9642
- const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9651
+ const {rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9643
9652
 
9644
9653
  let Line = class Line extends UI {
9645
9654
  get __tag() {
@@ -9657,7 +9666,7 @@ let Line = class Line extends UI {
9657
9666
  }
9658
9667
  set toPoint(value) {
9659
9668
  this.width = getDistance$3(defaultPoint, value);
9660
- this.rotation = getAngle$1(defaultPoint, value);
9669
+ this.rotation = getAngle$2(defaultPoint, value);
9661
9670
  if (this.height) this.height = 0;
9662
9671
  }
9663
9672
  __updatePath() {
@@ -11430,7 +11439,8 @@ ui$5.__hit = function(inner, forceHitFill) {
11430
11439
  const {hitFill: hitFill} = data;
11431
11440
  const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
11432
11441
  if (needHitFillPath && this.__hitFill(inner)) return true;
11433
- const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
11442
+ const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
11443
+ const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
11434
11444
  const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
11435
11445
  if (!needHitFillPath && !needHitStrokePath) return false;
11436
11446
  const radiusWidth = inner.radiusX * 2;
@@ -12205,7 +12215,7 @@ function getGapValue(gap, size, totalSize, rows) {
12205
12215
 
12206
12216
  let origin = {}, tempMatrix$1 = getMatrixData();
12207
12217
 
12208
- 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;
12209
12219
 
12210
12220
  function stretchMode(data, box, scaleX, scaleY) {
12211
12221
  const transform = get$2(), {x: x, y: y} = box;
@@ -12230,7 +12240,7 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
12230
12240
  layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
12231
12241
  if (clipScaleX) {
12232
12242
  if (rotation || skew) {
12233
- set(tempMatrix$1);
12243
+ set$1(tempMatrix$1);
12234
12244
  scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
12235
12245
  multiplyParent(transform, tempMatrix$1);
12236
12246
  } else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
@@ -12481,7 +12491,7 @@ function applyStops(data, gradient, stops, opacity) {
12481
12491
  }
12482
12492
  }
12483
12493
 
12484
- const {getAngle: getAngle, getDistance: getDistance$2} = PointHelper;
12494
+ const {getAngle: getAngle$1, getDistance: getDistance$2} = PointHelper;
12485
12495
 
12486
12496
  const {get: get, rotateOfOuter: rotateOfOuter, scaleOfOuter: scaleOfOuter} = MatrixHelper;
12487
12497
 
@@ -12510,7 +12520,7 @@ function getTransform(box, from, to, stretch, rotate90) {
12510
12520
  let transform;
12511
12521
  const {width: width, height: height} = box;
12512
12522
  if (width !== height || stretch) {
12513
- const angle = getAngle(from, to);
12523
+ const angle = getAngle$1(from, to);
12514
12524
  transform = get();
12515
12525
  if (rotate90) {
12516
12526
  scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
@@ -15003,7 +15013,7 @@ const HighBezierHelper = {
15003
15013
 
15004
15014
  const {getDistance: getDistance} = HighBezierHelper;
15005
15015
 
15006
- 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;
15007
15017
 
15008
15018
  const tempPoint = {}, tempFrom = {};
15009
15019
 
@@ -15041,16 +15051,19 @@ const HighCurveHelper = {
15041
15051
  },
15042
15052
  getMotionPathData(data) {
15043
15053
  let total = 0, distance, segments = [];
15044
- 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;
15045
15055
  const len = data.length;
15046
15056
  while (i < len) {
15047
15057
  command = data[i];
15048
15058
  switch (command) {
15049
15059
  case M:
15060
+ startX = data[i + 1];
15061
+ startY = data[i + 2];
15062
+
15050
15063
  case L:
15051
15064
  toX = data[i + 1];
15052
15065
  toY = data[i + 2];
15053
- distance = command === L && i > 0 ? PointHelper.getDistanceFrom(x, y, toX, toY) : 0;
15066
+ distance = command === L && i > 0 ? getDistanceFrom(x, y, toX, toY) : 0;
15054
15067
  x = toX;
15055
15068
  y = toY;
15056
15069
  i += 3;
@@ -15067,7 +15080,9 @@ const HighCurveHelper = {
15067
15080
 
15068
15081
  case Z:
15069
15082
  closed = true;
15083
+ distance = getDistanceFrom(x, y, startX, startY);
15070
15084
  i += 1;
15085
+ break;
15071
15086
 
15072
15087
  default:
15073
15088
  distance = 0;
@@ -15088,25 +15103,26 @@ const HighCurveHelper = {
15088
15103
  if (offsetX) motionDistance += offsetX;
15089
15104
  if (motionDistance > total) motionDistance = motionDistance % total;
15090
15105
  let nowDistance = 0, distance, to = {};
15091
- 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;
15092
15107
  let x1, y1, x2, y2, t;
15093
15108
  const len = data.length;
15094
15109
  while (i < len) {
15095
15110
  command = data[i];
15096
15111
  switch (command) {
15097
15112
  case M:
15113
+ startX = data[i + 1];
15114
+ startY = data[i + 2];
15115
+
15098
15116
  case L:
15099
15117
  toX = data[i + 1];
15100
15118
  toY = data[i + 2];
15101
15119
  distance = segments[index];
15102
15120
  if (nowDistance + distance >= motionDistance || !distanceData.total) {
15103
- to.x = toX;
15104
- to.y = toY;
15121
+ set(to, toX, toY);
15105
15122
  if (i) {
15106
- tempFrom.x = x;
15107
- tempFrom.y = y;
15108
- PointHelper.getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
15109
- to.rotation = PointHelper.getAngle(tempFrom, to);
15123
+ set(tempFrom, x, y);
15124
+ getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
15125
+ to.rotation = getAngle(tempFrom, to);
15110
15126
  return to;
15111
15127
  } else {
15112
15128
  const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
@@ -15136,7 +15152,19 @@ const HighCurveHelper = {
15136
15152
  break;
15137
15153
 
15138
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;
15139
15166
  i += 1;
15167
+ break;
15140
15168
 
15141
15169
  default:
15142
15170
  distance = 0;
@@ -15150,26 +15178,27 @@ const HighCurveHelper = {
15150
15178
  const {segments: segments, data: data} = distanceData, path = [];
15151
15179
  motionDistance = UnitConvert.number(motionDistance, distanceData.total);
15152
15180
  let total = 0, distance, cutDistance, to = {};
15153
- 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;
15154
15182
  let x1, y1, x2, y2, t;
15155
15183
  const len = data.length;
15156
15184
  while (i < len) {
15157
15185
  command = data[i];
15158
15186
  switch (command) {
15159
15187
  case M:
15188
+ startX = data[i + 1];
15189
+ startY = data[i + 2];
15190
+
15160
15191
  case L:
15161
15192
  toX = data[i + 1];
15162
15193
  toY = data[i + 2];
15163
15194
  distance = segments[index];
15164
15195
  if (total + distance > motionDistance || !distanceData.total) {
15165
15196
  if (!i) x = toX, y = toY;
15166
- tempFrom.x = x;
15167
- tempFrom.y = y;
15168
- to.x = toX;
15169
- to.y = toY;
15197
+ set(tempFrom, x, y);
15198
+ set(to, toX, toY);
15170
15199
  cutDistance = float(motionDistance - total);
15171
15200
  if (cutDistance) {
15172
- PointHelper.getDistancePoint(tempFrom, to, cutDistance, true);
15201
+ getDistancePoint(tempFrom, to, cutDistance, true);
15173
15202
  path.push(command, to.x, to.y);
15174
15203
  }
15175
15204
  return path;
@@ -15200,8 +15229,24 @@ const HighCurveHelper = {
15200
15229
  break;
15201
15230
 
15202
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;
15203
15247
  i += 1;
15204
15248
  path.push(command);
15249
+ break;
15205
15250
 
15206
15251
  default:
15207
15252
  distance = 0;