From: Anton Khorev Date: Wed, 9 Aug 2023 23:52:36 +0000 (+0300) Subject: Set default home location zoom when centering the map X-Git-Tag: live~1176^2~5 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/2dbe4e6f88c4e5d93e5d2b00f310778c07062131 Set default home location zoom when centering the map --- diff --git a/app/assets/javascripts/user.js b/app/assets/javascripts/user.js index 68b399867..8f588cbfd 100644 --- a/app/assets/javascripts/user.js +++ b/app/assets/javascripts/user.js @@ -1,6 +1,7 @@ //= require leaflet.locatecontrol/src/L.Control.Locate $(document).ready(function () { + var defaultHomeZoom = 12; var map, marker, deleted_lat, deleted_lon; if ($("#map").length) { @@ -37,7 +38,7 @@ $(document).ready(function () { .addClass("control-button"); if (OSM.home) { - map.setView([OSM.home.lat, OSM.home.lon], 12); + map.setView([OSM.home.lat, OSM.home.lon], defaultHomeZoom); } else { map.setView([0, 0], 0); } @@ -75,7 +76,7 @@ $(document).ready(function () { var lat = $("#home_lat").val(), lon = $("#home_lon").val(); - map.panTo([lat, lon]); + map.setView([lat, lon], defaultHomeZoom); }); $("#home_delete").click(function () {