leafer-game 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.
@@ -292,7 +292,7 @@ const FourNumberHelper = {
292
292
  return to;
293
293
  },
294
294
  setTemp(top, right, bottom, left) {
295
- return set$3(tempFour, top, right, bottom, left);
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$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]));
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$3(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
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$3(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
346
+ return set$4(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
347
347
  }
348
348
  };
349
349
 
350
- const {set: set$3, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
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$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);
@@ -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.writable) target.prototype[name] = module.prototype[name];
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.3";
7026
+ const version = "2.2.5";
7024
7027
 
7025
7028
  const debug$5 = Debug.get("LeaferCanvas");
7026
7029
 
@@ -8027,7 +8030,7 @@ class Picker {
8027
8030
  if (child.__hitWorld(point, onlyHitMask && child.mask === "path" ? true : undefined)) {
8028
8031
  const {parent: parent, mask: mask} = child;
8029
8032
  if (parent && parent.__hasMask && mask && !(mask === "clipping" || mask === "clipping-path")) {
8030
- if (!parent.children.some(item => !item.mask && item.__hitWorld(point))) return;
8033
+ if (!parent.children.some(item => !item.mask && this.isHitLeaf(item, point))) return;
8031
8034
  }
8032
8035
  const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
8033
8036
  if (hitThrough) {
@@ -8037,6 +8040,15 @@ class Picker {
8037
8040
  findList.add(leaf);
8038
8041
  }
8039
8042
  }
8043
+ isHitLeaf(leaf, point) {
8044
+ if (leaf.isBranch) {
8045
+ const {findList: findList} = this, old = findList.length;
8046
+ this.eachFind([ leaf ], false);
8047
+ const count = findList.length - old;
8048
+ for (let i = 0; i < count; i++) findList.remove(findList.indexAt(findList.length - 1));
8049
+ return !!count;
8050
+ } else return leaf.__hitWorld(point);
8051
+ }
8040
8052
  clear() {
8041
8053
  this.point = null;
8042
8054
  this.findList = null;
@@ -9535,7 +9547,7 @@ __decorate([ affectRenderBoundsType("hide") ], Frame.prototype, "overflow", void
9535
9547
 
9536
9548
  Frame = __decorate([ registerUI() ], Frame);
9537
9549
 
9538
- 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 = {};
9550
+ 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
9551
 
9540
9552
  let Ellipse = class Ellipse extends UI {
9541
9553
  get __tag() {
@@ -9550,34 +9562,28 @@ let Ellipse = class Ellipse extends UI {
9550
9562
  if (hasAngle) closedAngle = abs$4(endAngle - startAngle) === 360;
9551
9563
  if (innerRadius) {
9552
9564
  const drawInnerEllipse = innerRadius < 1 || closed;
9553
- let outerStartAngle = startAngle, outerEndAngle = endAngle, outerAnticlockwise;
9565
+ const innerRx = rx * innerRadius, innerRy = ry * innerRadius;
9554
9566
  if (hasAngle) {
9567
+ ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle);
9555
9568
  if (drawInnerEllipse) {
9556
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle);
9557
9569
  if (closedAngle) {
9558
- set$1(tempPoint$1, width, ry);
9559
- set$1(tempCenter, rx, ry);
9570
+ closePath$2(path);
9571
+ set$2(tempPoint$1, rx + innerRx, ry), set$2(tempCenter, rx, ry);
9560
9572
  rotate$2(tempPoint$1, endAngle, tempCenter, rx, ry);
9561
9573
  moveTo$3(path, tempPoint$1.x, tempPoint$1.y);
9562
9574
  }
9563
- outerStartAngle = endAngle;
9564
- outerEndAngle = startAngle;
9565
- outerAnticlockwise = true;
9575
+ ellipse(path, rx, ry, innerRx, innerRy, 0, endAngle, startAngle, true);
9566
9576
  } else {
9567
9577
  if (!closedAngle) open = true;
9568
9578
  }
9569
9579
  } else {
9580
+ ellipse(path, rx, ry, rx, ry);
9570
9581
  if (drawInnerEllipse) {
9571
- ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
9572
9582
  closePath$2(path);
9573
- moveTo$3(path, width, ry);
9574
- outerStartAngle = 360;
9575
- outerAnticlockwise = true;
9576
- } else {
9577
- outerEndAngle = 360;
9583
+ moveTo$3(path, rx + innerRx, ry);
9584
+ ellipse(path, rx, ry, innerRx, innerRy, 0, 360, 0, true);
9578
9585
  }
9579
9586
  }
9580
- ellipse(path, rx, ry, rx, ry, 0, outerStartAngle, outerEndAngle, outerAnticlockwise);
9581
9587
  } else {
9582
9588
  if (hasAngle) {
9583
9589
  if (!closedAngle) {
@@ -9686,7 +9692,7 @@ Star = __decorate([ registerUI() ], Star);
9686
9692
 
9687
9693
  const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9688
9694
 
9689
- const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9695
+ const {rotate: rotate$1, getAngle: getAngle$2, getDistance: getDistance$3, defaultPoint: defaultPoint} = PointHelper;
9690
9696
 
9691
9697
  let Line = class Line extends UI {
9692
9698
  get __tag() {
@@ -9704,7 +9710,7 @@ let Line = class Line extends UI {
9704
9710
  }
9705
9711
  set toPoint(value) {
9706
9712
  this.width = getDistance$3(defaultPoint, value);
9707
- this.rotation = getAngle$1(defaultPoint, value);
9713
+ this.rotation = getAngle$2(defaultPoint, value);
9708
9714
  if (this.height) this.height = 0;
9709
9715
  }
9710
9716
  __updatePath() {
@@ -11477,7 +11483,8 @@ ui$5.__hit = function(inner, forceHitFill) {
11477
11483
  const {hitFill: hitFill} = data;
11478
11484
  const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
11479
11485
  if (needHitFillPath && this.__hitFill(inner)) return true;
11480
- const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
11486
+ const {hitStroke: hitStroke, strokeScaleFixed: strokeScaleFixed} = data;
11487
+ const strokeWidth = data.__maxStrokeWidth * (strokeScaleFixed ? this.getRenderScaleData(true, strokeScaleFixed, false).scaleX : 1);
11481
11488
  const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
11482
11489
  if (!needHitFillPath && !needHitStrokePath) return false;
11483
11490
  const radiusWidth = inner.radiusX * 2;
@@ -12472,7 +12479,7 @@ function getGapValue(gap, size, totalSize, rows) {
12472
12479
 
12473
12480
  let origin = {}, tempMatrix$1 = getMatrixData();
12474
12481
 
12475
- const {get: get$2, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate, skew: skewHelper} = MatrixHelper;
12482
+ 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
12483
 
12477
12484
  function stretchMode(data, box, scaleX, scaleY) {
12478
12485
  const transform = get$2(), {x: x, y: y} = box;
@@ -12497,7 +12504,7 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
12497
12504
  layout(transform, box, x, y, scaleX, scaleY, rotation, skew);
12498
12505
  if (clipScaleX) {
12499
12506
  if (rotation || skew) {
12500
- set(tempMatrix$1);
12507
+ set$1(tempMatrix$1);
12501
12508
  scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
12502
12509
  multiplyParent(transform, tempMatrix$1);
12503
12510
  } else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
@@ -12748,7 +12755,7 @@ function applyStops(data, gradient, stops, opacity) {
12748
12755
  }
12749
12756
  }
12750
12757
 
12751
- const {getAngle: getAngle, getDistance: getDistance$2} = PointHelper;
12758
+ const {getAngle: getAngle$1, getDistance: getDistance$2} = PointHelper;
12752
12759
 
12753
12760
  const {get: get, rotateOfOuter: rotateOfOuter, scaleOfOuter: scaleOfOuter} = MatrixHelper;
12754
12761
 
@@ -12777,7 +12784,7 @@ function getTransform(box, from, to, stretch, rotate90) {
12777
12784
  let transform;
12778
12785
  const {width: width, height: height} = box;
12779
12786
  if (width !== height || stretch) {
12780
- const angle = getAngle(from, to);
12787
+ const angle = getAngle$1(from, to);
12781
12788
  transform = get();
12782
12789
  if (rotate90) {
12783
12790
  scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
@@ -15264,7 +15271,7 @@ const HighBezierHelper = {
15264
15271
 
15265
15272
  const {getDistance: getDistance} = HighBezierHelper;
15266
15273
 
15267
- const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
15274
+ const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper, {set: set, getAngle: getAngle, getDistanceFrom: getDistanceFrom, getDistancePoint: getDistancePoint} = PointHelper;
15268
15275
 
15269
15276
  const tempPoint = {}, tempFrom = {};
15270
15277
 
@@ -15302,16 +15309,19 @@ const HighCurveHelper = {
15302
15309
  },
15303
15310
  getMotionPathData(data) {
15304
15311
  let total = 0, distance, segments = [];
15305
- let i = 0, x = 0, y = 0, toX, toY, command, closed;
15312
+ let i = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command, closed;
15306
15313
  const len = data.length;
15307
15314
  while (i < len) {
15308
15315
  command = data[i];
15309
15316
  switch (command) {
15310
15317
  case M:
15318
+ startX = data[i + 1];
15319
+ startY = data[i + 2];
15320
+
15311
15321
  case L:
15312
15322
  toX = data[i + 1];
15313
15323
  toY = data[i + 2];
15314
- distance = command === L && i > 0 ? PointHelper.getDistanceFrom(x, y, toX, toY) : 0;
15324
+ distance = command === L && i > 0 ? getDistanceFrom(x, y, toX, toY) : 0;
15315
15325
  x = toX;
15316
15326
  y = toY;
15317
15327
  i += 3;
@@ -15328,7 +15338,9 @@ const HighCurveHelper = {
15328
15338
 
15329
15339
  case Z:
15330
15340
  closed = true;
15341
+ distance = getDistanceFrom(x, y, startX, startY);
15331
15342
  i += 1;
15343
+ break;
15332
15344
 
15333
15345
  default:
15334
15346
  distance = 0;
@@ -15349,25 +15361,26 @@ const HighCurveHelper = {
15349
15361
  if (offsetX) motionDistance += offsetX;
15350
15362
  if (motionDistance > total) motionDistance = motionDistance % total;
15351
15363
  let nowDistance = 0, distance, to = {};
15352
- let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
15364
+ let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
15353
15365
  let x1, y1, x2, y2, t;
15354
15366
  const len = data.length;
15355
15367
  while (i < len) {
15356
15368
  command = data[i];
15357
15369
  switch (command) {
15358
15370
  case M:
15371
+ startX = data[i + 1];
15372
+ startY = data[i + 2];
15373
+
15359
15374
  case L:
15360
15375
  toX = data[i + 1];
15361
15376
  toY = data[i + 2];
15362
15377
  distance = segments[index];
15363
15378
  if (nowDistance + distance >= motionDistance || !distanceData.total) {
15364
- to.x = toX;
15365
- to.y = toY;
15379
+ set(to, toX, toY);
15366
15380
  if (i) {
15367
- tempFrom.x = x;
15368
- tempFrom.y = y;
15369
- PointHelper.getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
15370
- to.rotation = PointHelper.getAngle(tempFrom, to);
15381
+ set(tempFrom, x, y);
15382
+ getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
15383
+ to.rotation = getAngle(tempFrom, to);
15371
15384
  return to;
15372
15385
  } else {
15373
15386
  const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
@@ -15397,7 +15410,19 @@ const HighCurveHelper = {
15397
15410
  break;
15398
15411
 
15399
15412
  case Z:
15413
+ toX = startX;
15414
+ toY = startY;
15415
+ distance = segments[index];
15416
+ if (nowDistance + distance >= motionDistance) {
15417
+ set(tempFrom, x, y), set(to, toX, toY);
15418
+ getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
15419
+ to.rotation = getAngle(tempFrom, to);
15420
+ return to;
15421
+ }
15422
+ x = toX;
15423
+ y = toY;
15400
15424
  i += 1;
15425
+ break;
15401
15426
 
15402
15427
  default:
15403
15428
  distance = 0;
@@ -15411,26 +15436,27 @@ const HighCurveHelper = {
15411
15436
  const {segments: segments, data: data} = distanceData, path = [];
15412
15437
  motionDistance = UnitConvert.number(motionDistance, distanceData.total);
15413
15438
  let total = 0, distance, cutDistance, to = {};
15414
- let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
15439
+ let i = 0, index = 0, x = 0, y = 0, startX = 0, startY = 0, toX, toY, command;
15415
15440
  let x1, y1, x2, y2, t;
15416
15441
  const len = data.length;
15417
15442
  while (i < len) {
15418
15443
  command = data[i];
15419
15444
  switch (command) {
15420
15445
  case M:
15446
+ startX = data[i + 1];
15447
+ startY = data[i + 2];
15448
+
15421
15449
  case L:
15422
15450
  toX = data[i + 1];
15423
15451
  toY = data[i + 2];
15424
15452
  distance = segments[index];
15425
15453
  if (total + distance > motionDistance || !distanceData.total) {
15426
15454
  if (!i) x = toX, y = toY;
15427
- tempFrom.x = x;
15428
- tempFrom.y = y;
15429
- to.x = toX;
15430
- to.y = toY;
15455
+ set(tempFrom, x, y);
15456
+ set(to, toX, toY);
15431
15457
  cutDistance = float(motionDistance - total);
15432
15458
  if (cutDistance) {
15433
- PointHelper.getDistancePoint(tempFrom, to, cutDistance, true);
15459
+ getDistancePoint(tempFrom, to, cutDistance, true);
15434
15460
  path.push(command, to.x, to.y);
15435
15461
  }
15436
15462
  return path;
@@ -15461,8 +15487,24 @@ const HighCurveHelper = {
15461
15487
  break;
15462
15488
 
15463
15489
  case Z:
15490
+ toX = startX;
15491
+ toY = startY;
15492
+ distance = segments[index];
15493
+ if (total + distance > motionDistance) {
15494
+ set(tempFrom, x, y);
15495
+ set(to, toX, toY);
15496
+ cutDistance = float(motionDistance - total);
15497
+ if (cutDistance) {
15498
+ getDistancePoint(tempFrom, to, cutDistance, true);
15499
+ path.push(L, to.x, to.y);
15500
+ }
15501
+ return path;
15502
+ }
15503
+ x = toX;
15504
+ y = toY;
15464
15505
  i += 1;
15465
15506
  path.push(command);
15507
+ break;
15466
15508
 
15467
15509
  default:
15468
15510
  distance = 0;