]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/user.js
Merge remote-tracking branch 'upstream/pull/5586'
[rails.git] / app / assets / javascripts / user.js
index 681ec3ace82470b0caa52b7fd87562dbefa17f6a..1d167d977fb70e85481179b0671e963c9bc1c08a 100644 (file)
@@ -1,4 +1,4 @@
-//= require leaflet.locatecontrol/src/L.Control.Locate
+//= require leaflet.locatecontrol/dist/L.Control.Locate.umd
 
 (function () {
   $(document).on("change", "#user_all", function () {
@@ -64,12 +64,10 @@ $(document).ready(function () {
       map.on("click", function (e) {
         if (!$("#updatehome").is(":checked")) return;
 
-        var zoom = map.getZoom(),
-            precision = OSM.zoomPrecision(zoom),
-            location = e.latlng.wrap();
+        const [lat, lon] = OSM.cropLocation(e.latlng);
 
-        $("#home_lat").val(location.lat.toFixed(precision));
-        $("#home_lon").val(location.lng.toFixed(precision));
+        $("#home_lat").val(lat);
+        $("#home_lon").val(lon);
 
         deleted_lat = null;
         deleted_lon = null;