@wemap/routers 11.3.2 → 11.3.3

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.mjs CHANGED
@@ -710,7 +710,7 @@ const buildStepsRules = (graphItinerary) => (currentCoords, nextCoords, previous
710
710
  if (edge.data.isElevator) {
711
711
  levelChangeType = "elevator";
712
712
  } else if (edge.data instanceof OsmWay && edge.data.isConveying && edge.data.areStairs) {
713
- levelChangeType = "conveyor";
713
+ levelChangeType = "escalator";
714
714
  } else if (edge.data instanceof OsmWay && edge.data.areStairs) {
715
715
  levelChangeType = "stairs";
716
716
  } else if (edge.data instanceof OsmWay && edge.data.isConveying) {
@@ -718,20 +718,22 @@ const buildStepsRules = (graphItinerary) => (currentCoords, nextCoords, previous
718
718
  }
719
719
  let forceLevelChange;
720
720
  const edgeTags = edge.data.tags || {};
721
- if (edge.data instanceof OsmWay && edge.data.areStairs && ["up", "down"].includes(edgeTags.incline) && !(previousStep == null ? void 0 : previousStep.levelChange)) {
721
+ if ((edge.data instanceof OsmWay && edge.data.areStairs || edge.data.isElevator) && ["up", "down"].includes(edgeTags.incline) && !(previousStep == null ? void 0 : previousStep.levelChange)) {
722
722
  forceLevelChange = edgeTags.incline;
723
- for (const n of edge.data.nodes) {
724
- if (n !== vertex.data)
725
- continue;
726
- }
727
- const isReversed = edge.data.nodes.reduce((acc, n, idx, arr) => {
728
- if (n !== vertex.data)
723
+ if (edge.data instanceof OsmWay) {
724
+ for (const n of edge.data.nodes) {
725
+ if (n !== vertex.data)
726
+ continue;
727
+ }
728
+ const isReversed = edge.data.nodes.reduce((acc, n, idx, arr) => {
729
+ if (n !== vertex.data)
730
+ return acc;
731
+ acc = !(idx + 1 < arr.length && arr[idx + 1] === nextVertex.data);
729
732
  return acc;
730
- acc = !(idx + 1 < arr.length && arr[idx + 1] === nextVertex.data);
731
- return acc;
732
- }, null);
733
- if (isReversed) {
734
- forceLevelChange = forceLevelChange === "up" ? "down" : "up";
733
+ }, null);
734
+ if (isReversed) {
735
+ forceLevelChange = forceLevelChange === "up" ? "down" : "up";
736
+ }
735
737
  }
736
738
  }
737
739
  const previousEdge = edgeId > 0 && edges.length ? edges[edgeId - 1] : null;