]> git.openstreetmap.org Git - rails.git/commitdiff
Derive popup location from lineseg
authorMarwin Hochfelsner <50826859+hlfan@users.noreply.github.com>
Sun, 6 Apr 2025 16:50:58 +0000 (18:50 +0200)
committerMarwin Hochfelsner <50826859+hlfan@users.noreply.github.com>
Sun, 6 Apr 2025 17:45:20 +0000 (19:45 +0200)
app/assets/javascripts/index/directions.js
app/assets/javascripts/index/directions/fossgis_osrm.js
app/assets/javascripts/index/directions/fossgis_valhalla.js
app/assets/javascripts/index/directions/graphhopper.js
test/system/directions_test.rb

index 588c09afd53b1a65b859021ceb77b4af58f68b0f..45ff960e231acd6b488dc0611f13b41c926ffa8b 100644 (file)
@@ -184,7 +184,7 @@ OSM.Directions = function (map) {
         );
 
       // Add each row
-      turnByTurnTable.append(route.steps.map(([ll, direction, instruction, dist, lineseg], i) => {
+      turnByTurnTable.append(route.steps.map(([direction, instruction, dist, lineseg], i) => {
         const row = $("<tr class='turn'/>");
         if (direction) {
           row.append("<td class='border-0'><svg width='20' height='20' class='d-block'><use href='#routing-sprite-" + direction + "' /></svg></td>");
@@ -196,7 +196,7 @@ OSM.Directions = function (map) {
 
         row.on("click", function () {
           popup
-            .setLatLng(ll)
+            .setLatLng(lineseg[0])
             .setContent(`<p><b>${i + 1}.</b> ${instruction}</p>`)
             .openOn(map);
         });
index 5b562e7ca1a722f6b0c490fe3859988f8e8efef4..cacf0100ca23f62c3221e811b0b815f422ef2abe 100644 (file)
         const step_geometry = L.PolylineUtil.decode(step.geometry, { precision: 5 });
         const instText = getInstructionText(step, maneuver_id);
         return [
-          [step.maneuver.location[1], step.maneuver.location[0]],
           ICON_MAP[maneuver_id],
           instText,
           step.distance,
       });
 
       return {
-        line: steps.flatMap(step => step[4]),
+        line: steps.flatMap(step => step[3]),
         steps,
         distance: leg.distance,
         time: leg.duration
index c160e69b1959d80e6a245a8efe21db4b3483ba85..7228f488dbb3d02b4a81466117ebe532683bbc1e 100644 (file)
@@ -49,7 +49,6 @@
         const lineseg = line
           .slice(manoeuvre.begin_shape_index, manoeuvre.end_shape_index + 1);
         return [
-          lineseg[0],
           INSTR_MAP[manoeuvre.type],
           manoeuvre.instruction,
           manoeuvre.length * 1000,
index 325dcabcd621e42ed26bd57e1af2197513870d28..acbd776a0c86783be40a0ed553136f73a47415e9 100644 (file)
         const lineseg = line
           .slice(instr.interval[0], instr.interval[1] + 1);
         return [
-          lineseg[0],
           GH_INSTR_MAP[instr.sign],
           instr.text,
           instr.distance,
           lineseg
         ];
       });
-      steps.at(-1)[1] = "destination";
+      steps.at(-1)[0] = "destination";
 
       return {
         line: line,
index 1c4edb60c023875ed1e3495fb16a860730a8c2c6..8ff78736b731b3a1e137a1215ec1046bf479b683 100644 (file)
@@ -38,8 +38,8 @@ class DirectionsSystemTest < ApplicationSystemTestCase
       return Promise.resolve({
         line: points,
         steps: [
-          [points[0], "start", "<b>1.</b> #{start_instruction}", distance, points],
-          [points[1], "destination", "<b>2.</b> #{finish_instruction}", 0, [points[1]]]
+          ["start", "<b>1.</b> #{start_instruction}", distance, points],
+          ["destination", "<b>2.</b> #{finish_instruction}", 0, [points[1]]]
         ],
         distance,
         time