X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a7092491b069de43bb8d8c30d3526e7095c5cc98..5fdada204cf92d8ca99300927713724aaaf1b2bd:/app/assets/javascripts/index/directions.js diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 4c39d6781..1c095a36b 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -142,12 +142,20 @@ OSM.Directions = function (map) { $(".directions_form .reverse_directions").on("click", function () { var from = endpoints[0].latlng, - to = endpoints[1].latlng; + to = endpoints[1].latlng, + routeFrom = "", + routeTo = ""; + if (from) { + routeFrom = from.lat + "," + from.lng; + } + if (to) { + routeTo = to.lat + "," + to.lng; + } OSM.router.route("/directions?" + querystring.stringify({ from: $("#route_to").val(), to: $("#route_from").val(), - route: to.lat + "," + to.lng + ";" + from.lat + "," + from.lng + route: routeTo + ";" + routeFrom })); });