From: Tom Hughes Date: Sun, 15 Jun 2014 10:08:25 +0000 (+0100) Subject: Force coordinates into range for "Where am I" queries X-Git-Tag: live~4934 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/6e45410103f1669270d720fe5299f9b683bf779d Force coordinates into range for "Where am I" queries Fixes #753 --- diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 96e03539a..cfee031fd 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -334,9 +334,10 @@ $(document).ready(function () { $(".describe_location").on("click", function(e) { e.preventDefault(); - var precision = OSM.zoomPrecision(map.getZoom()); + var center = map.getCenter().wrap(), + precision = OSM.zoomPrecision(map.getZoom()); OSM.router.route("/search?query=" + encodeURIComponent( - map.getCenter().lat.toFixed(precision) + "," + - map.getCenter().lng.toFixed(precision))); + center.lat.toFixed(precision) + "," + center.lng.toFixed(precision) + )); }); });