X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/64da05f8ffa5e17de11e94335f418cd73498a76d..cbf53088a2c2668077b68c62e605beb1f530d095:/app/assets/javascripts/index/directions.js diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 44b64a525..18f5b0b94 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -287,16 +287,14 @@ OSM.Directions = function (map) { var ll = map.containerPointToLatLng(pt); var precision = OSM.zoomPrecision(map.getZoom()); var value = ll.lat.toFixed(precision) + ", " + ll.lng.toFixed(precision); - endpoints[type === "from" ? 0 : 1].setValue(value, ll); + endpoints[type === "from" ? 0 : 1].setValue(value); }); endpoints[0].enable(); endpoints[1].enable(); var params = Qs.parse(location.search.substring(1)), - route = (params.route || "").split(";"), - from = route[0] && L.latLng(route[0].split(",")), - to = route[1] && L.latLng(route[1].split(",")); + route = (params.route || "").split(";"); if (params.engine) { var engineIndex = findEngine(params.engine); @@ -306,10 +304,10 @@ OSM.Directions = function (map) { } } - endpoints[0].setValue(params.from || "", from); - endpoints[1].setValue(params.to || "", to); + endpoints[0].setValue(params.from || route[0] || ""); + endpoints[1].setValue(params.to || route[1] || ""); - map.setSidebarOverlaid(!from || !to); + map.setSidebarOverlaid(!endpoints[0].latlng || !endpoints[1].latlng); }; page.load = function () { @@ -326,9 +324,7 @@ OSM.Directions = function (map) { map .removeLayer(popup) - .removeLayer(polyline) - .removeLayer(endpoints[0].marker) - .removeLayer(endpoints[1].marker); + .removeLayer(polyline); }; return page;