]> git.openstreetmap.org Git - rails.git/commitdiff
Force coordinates into range for "Where am I" queries
authorTom Hughes <tom@compton.nu>
Sun, 15 Jun 2014 10:08:25 +0000 (11:08 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 15 Jun 2014 10:08:25 +0000 (11:08 +0100)
Fixes #753

app/assets/javascripts/index.js

index 96e03539a08a4e245b3dafc51d5f094bc1bb75fb..cfee031fd47086d2c530da7a0e12bd6245a2e8cb 100644 (file)
@@ -334,9 +334,10 @@ $(document).ready(function () {
 
   $(".describe_location").on("click", function(e) {
     e.preventDefault();
 
   $(".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(
     OSM.router.route("/search?query=" + encodeURIComponent(
-      map.getCenter().lat.toFixed(precision) + "," +
-      map.getCenter().lng.toFixed(precision)));
+      center.lat.toFixed(precision) + "," + center.lng.toFixed(precision)
+    ));
   });
 });
   });
 });