]> git.openstreetmap.org Git - rails.git/commitdiff
Add zoom parameter to 'Show address' in context menu
authorAnton Khorev <tony29@yandex.ru>
Thu, 10 Apr 2025 15:49:42 +0000 (18:49 +0300)
committerAnton Khorev <tony29@yandex.ru>
Thu, 10 Apr 2025 15:49:42 +0000 (18:49 +0300)
app/assets/javascripts/index/contextmenu.js

index 4c157e6e046a800f47fdf2e675903f8404dc806f..dcdfc9e440681d158f88fbb33aae310c84dbbe89 100644 (file)
@@ -35,9 +35,10 @@ OSM.initializeContextMenu = function (map) {
   map.contextmenu.addItem({
     text: OSM.i18n.t("javascripts.context.show_address"),
     callback: function describeLocation(e) {
   map.contextmenu.addItem({
     text: OSM.i18n.t("javascripts.context.show_address"),
     callback: function describeLocation(e) {
-      const [lat, lon] = OSM.cropLocation(e.latlng, map.getZoom());
+      const zoom = map.getZoom();
+      const [lat, lon] = OSM.cropLocation(e.latlng, zoom);
 
 
-      OSM.router.route("/search?" + new URLSearchParams({ lat, lon }));
+      OSM.router.route("/search?" + new URLSearchParams({ lat, lon, zoom }));
     }
   });
 
     }
   });