@wemap/routers 12.9.2 → 12.10.1

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/index.js CHANGED
@@ -439,6 +439,8 @@ class StepsBuilder {
439
439
  levelChangeType = "stairs";
440
440
  } else if (isMovingWalkway) {
441
441
  levelChangeType = "moving walkway";
442
+ } else {
443
+ levelChangeType = "incline plane";
442
444
  }
443
445
  let forceLevelChange;
444
446
  if ((areStairs || isElevator) && incline && !(previousStep == null ? void 0 : previousStep.levelChange)) {
@@ -528,15 +530,13 @@ class StepsBuilder {
528
530
  const previousBearing = coordsBeforeStep.bearingTo(stepInfo.coords);
529
531
  const nextBearing = stepInfo.coords.bearingTo(coordsAfterStep);
530
532
  let distance = 0;
531
- const coordsToStopCalculation = stepId !== stepsInfo.length - 1 ? stepsInfo[stepId + 1].coords : pathCoords[pathCoords.length - 1];
533
+ const isLastStep = stepId === stepsInfo.length - 1;
534
+ const coordsToStopCalculation = isLastStep ? pathCoords[pathCoords.length - 1] : stepsInfo[stepId + 1].coords;
532
535
  let currentCoordsId = coordsId;
533
536
  while (!pathCoords[currentCoordsId].equals(coordsToStopCalculation)) {
534
537
  distance += pathCoords[currentCoordsId].distanceTo(pathCoords[currentCoordsId + 1]);
535
538
  currentCoordsId++;
536
539
  }
537
- if (currentCoordsId === pathCoords.length - 1) {
538
- distance += pathCoords[currentCoordsId].distanceTo(end);
539
- }
540
540
  return {
541
541
  coords: stepInfo.coords,
542
542
  name: stepInfo.name || null,
@@ -545,7 +545,7 @@ class StepsBuilder {
545
545
  nextBearing,
546
546
  angle: maths.diffAngle(previousBearing, nextBearing + Math.PI),
547
547
  firstStep: stepId === 0,
548
- lastStep: stepId === stepsInfo.length - 1,
548
+ lastStep: isLastStep,
549
549
  distance,
550
550
  // stepInfo.distance is overwritten
551
551
  duration: stepInfo.duration || getDurationFromLength(distance),
@@ -4997,6 +4997,9 @@ const _InstructionManager = class _InstructionManager {
4997
4997
  if (step.levelChange.type === "moving walkway") {
4998
4998
  return "Go up the moving walkway";
4999
4999
  }
5000
+ if (step.levelChange.type === "incline plane") {
5001
+ return "Go up the incline plane";
5002
+ }
5000
5003
  return "Go up" + suffix;
5001
5004
  }
5002
5005
  if (step.levelChange.direction === "down") {
@@ -5012,6 +5015,9 @@ const _InstructionManager = class _InstructionManager {
5012
5015
  if (step.levelChange.type === "moving walkway") {
5013
5016
  return "Go down the moving walkway";
5014
5017
  }
5018
+ if (step.levelChange.type === "incline plane") {
5019
+ return "Go down the incline plane";
5020
+ }
5015
5021
  return "Go down" + suffix;
5016
5022
  }
5017
5023
  if ((_b = step.extras) == null ? void 0 : _b.subwayEntrance) {