From 6e45410103f1669270d720fe5299f9b683bf779d Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 15 Jun 2014 11:08:25 +0100 Subject: [PATCH] Force coordinates into range for "Where am I" queries Fixes #753 --- app/assets/javascripts/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) + )); }); }); -- 2.39.5