]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions/fossgis_valhalla.js
Simplify step mapping function
[rails.git] / app / assets / javascripts / index / directions / fossgis_valhalla.js
index 7228f488dbb3d02b4a81466117ebe532683bbc1e..7e20d02d687ed5a9694700511469ecddb1c38b2d 100644 (file)
     function _processDirections(leg) {
       const line = L.PolylineUtil.decode(leg.shape, { precision: 6 });
 
     function _processDirections(leg) {
       const line = L.PolylineUtil.decode(leg.shape, { precision: 6 });
 
-      const steps = leg.maneuvers.map(manoeuvre => {
-        const lineseg = line
-          .slice(manoeuvre.begin_shape_index, manoeuvre.end_shape_index + 1);
-        return [
-          INSTR_MAP[manoeuvre.type],
-          manoeuvre.instruction,
-          manoeuvre.length * 1000,
-          lineseg
-        ];
-      });
+      const steps = leg.maneuvers.map(manoeuvre => [
+        INSTR_MAP[manoeuvre.type],
+        manoeuvre.instruction,
+        manoeuvre.length * 1000,
+        line.slice(manoeuvre.begin_shape_index, manoeuvre.end_shape_index + 1)
+      ]);
 
       return {
         line: line,
 
       return {
         line: line,