]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/user.js
Make the timestamp for a diary comment into a permalink for it
[rails.git] / app / assets / javascripts / user.js
index 4e646771247c93dad7c67cbe4cd49fd76c85ae0d..d31f5bb82679f2ae6415631876820fab9401141c 100644 (file)
@@ -4,13 +4,9 @@ $(document).ready(function () {
     zoomControl: false
   }).addLayer(new L.OSM.Mapnik());
 
-  L.control.zoom({position: 'topright'})
+  L.OSM.zoom()
     .addTo(map);
 
-  $("#map").on("resized", function () {
-    map.invalidateSize();
-  });
-
   if (OSM.home) {
     map.setView([OSM.home.lat, OSM.home.lon], 12);
   } else {
@@ -27,9 +23,13 @@ $(document).ready(function () {
 
     map.on("click", function (e) {
       if ($('#updatehome').is(':checked')) {
+        var zoom = map.getZoom(),
+            precision = zoomPrecision(zoom),
+            location = e.latlng.wrap();
+
         $('#homerow').removeClass();
-        $('#home_lat').val(e.latlng.lat);
-        $('#home_lon').val(e.latlng.lng);
+        $('#home_lat').val(location.lat.toFixed(precision));
+        $('#home_lon').val(location.lng.toFixed(precision));
 
         marker.setLatLng(e.latlng);
         marker.addTo(map);