From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Sun, 6 Apr 2025 16:50:58 +0000 (+0200) Subject: Derive popup location from lineseg X-Git-Tag: live~67^2~2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/dd8a0f0dff457f27d6c6125a4f724f699d489588?ds=sidebyside;hp=-c Derive popup location from lineseg --- dd8a0f0dff457f27d6c6125a4f724f699d489588 diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 588c09afd..45ff960e2 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -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 = $(""); if (direction) { row.append(""); @@ -196,7 +196,7 @@ OSM.Directions = function (map) { row.on("click", function () { popup - .setLatLng(ll) + .setLatLng(lineseg[0]) .setContent(`

${i + 1}. ${instruction}

`) .openOn(map); }); diff --git a/app/assets/javascripts/index/directions/fossgis_osrm.js b/app/assets/javascripts/index/directions/fossgis_osrm.js index 5b562e7ca..cacf0100c 100644 --- a/app/assets/javascripts/index/directions/fossgis_osrm.js +++ b/app/assets/javascripts/index/directions/fossgis_osrm.js @@ -138,7 +138,6 @@ 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, @@ -147,7 +146,7 @@ }); return { - line: steps.flatMap(step => step[4]), + line: steps.flatMap(step => step[3]), steps, distance: leg.distance, time: leg.duration diff --git a/app/assets/javascripts/index/directions/fossgis_valhalla.js b/app/assets/javascripts/index/directions/fossgis_valhalla.js index c160e69b1..7228f488d 100644 --- a/app/assets/javascripts/index/directions/fossgis_valhalla.js +++ b/app/assets/javascripts/index/directions/fossgis_valhalla.js @@ -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, diff --git a/app/assets/javascripts/index/directions/graphhopper.js b/app/assets/javascripts/index/directions/graphhopper.js index 325dcabcd..acbd776a0 100644 --- a/app/assets/javascripts/index/directions/graphhopper.js +++ b/app/assets/javascripts/index/directions/graphhopper.js @@ -25,14 +25,13 @@ 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, diff --git a/test/system/directions_test.rb b/test/system/directions_test.rb index 1c4edb60c..8ff78736b 100644 --- a/test/system/directions_test.rb +++ b/test/system/directions_test.rb @@ -38,8 +38,8 @@ class DirectionsSystemTest < ApplicationSystemTestCase return Promise.resolve({ line: points, steps: [ - [points[0], "start", "1. #{start_instruction}", distance, points], - [points[1], "destination", "2. #{finish_instruction}", 0, [points[1]]] + ["start", "1. #{start_instruction}", distance, points], + ["destination", "2. #{finish_instruction}", 0, [points[1]]] ], distance, time