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