X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/edda4af515cfb0bd4de1ed0650b47e124bfad6ed..4d4b79800ac2b4ea282a74a9660c11d2748ee5c2:/app/assets/javascripts/leaflet.map.js diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index 02ed318ac..6537b0b23 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -130,11 +130,14 @@ L.OSM.Map = L.Map.extend({ }, getMapBaseLayerId: function () { - var baseLayerId; - this.eachLayer(function (layer) { - if (layer.options && layer.options.layerId) baseLayerId = layer.options.layerId; - }); - return baseLayerId; + const layer = this.getMapBaseLayer(); + if (layer) return layer.options.layerId; + }, + + getMapBaseLayer: function () { + for (const layer of this.baseLayers) { + if (this.hasLayer(layer)) return layer; + } }, getUrl: function (marker) {