]> git.openstreetmap.org Git - rails.git/commitdiff
Round user home location to a sensible precision
authorTom Hughes <tom@compton.nu>
Tue, 30 Jul 2013 17:05:57 +0000 (18:05 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 30 Jul 2013 17:05:57 +0000 (18:05 +0100)
app/assets/javascripts/user.js

index 86a30958b97d258b22ab81ebae1e60bb74c82ff4..b4dbb7de2e178b19a6505c15a61c7bb9cf30232b 100644 (file)
@@ -23,9 +23,12 @@ $(document).ready(function () {
 
     map.on("click", function (e) {
       if ($('#updatehome').is(':checked')) {
+        var zoom = map.getZoom(),
+            toZoom = zoomPrecision(zoom);
+
         $('#homerow').removeClass();
-        $('#home_lat').val(e.latlng.lat);
-        $('#home_lon').val(e.latlng.lng);
+        $('#home_lat').val(toZoom(e.latlng.lat));
+        $('#home_lon').val(toZoom(e.latlng.lng));
 
         marker.setLatLng(e.latlng);
         marker.addTo(map);