poly-extrude 0.20.5 → 0.20.6

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * poly-extrude v0.20.5
2
+ * poly-extrude v0.20.6
3
3
  */
4
4
  (function (global, factory) {
5
5
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -2454,6 +2454,7 @@
2454
2454
  i++;
2455
2455
  continue;
2456
2456
  }
2457
+ let lastRepeat = false;
2457
2458
  // last vertex
2458
2459
  if (i === len - 1) {
2459
2460
  p1 = line[len - 2];
@@ -2478,6 +2479,16 @@
2478
2479
  }
2479
2480
  }
2480
2481
  }
2482
+ if (equal(p1, p2)) {
2483
+ lastRepeat = true;
2484
+ for (let j = line.indexOf(p1); j >= 0; j--) {
2485
+ const p = line[j];
2486
+ if (!equal(p, current)) {
2487
+ p1 = p;
2488
+ break;
2489
+ }
2490
+ }
2491
+ }
2481
2492
  }
2482
2493
  if (equal(p1, p2)) {
2483
2494
  console.error('not find next vertex:index:', i, line);
@@ -2489,7 +2500,7 @@
2489
2500
  let rangle = 0;
2490
2501
  const rad = Math.atan2(dy, dx);
2491
2502
  const angle = radToDeg(rad);
2492
- if (i === 0 || i === len - 1) {
2503
+ if (i === 0 || i === len - 1 || lastRepeat) {
2493
2504
  rangle = angle - 90;
2494
2505
  }
2495
2506
  else {