X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/02257f7294c45a2cf0d6a94a9dafd8b2e9242e9c..4d4b79800ac2b4ea282a74a9660c11d2748ee5c2:/app/assets/javascripts/leaflet.map.js diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index f478f4351..6537b0b23 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -26,8 +26,6 @@ L.OSM.Map = L.Map.extend({ for (const [property, value] of Object.entries(layerDefinition)) { if (property === "credit") { layerOptions.attribution = makeAttribution(value); - } else if (property === "keyId") { - layerOptions.keyid = value; } else if (property === "nameId") { layerOptions.name = I18n.t(`javascripts.map.base.${value}`); } else if (property === "apiKeyId") { @@ -132,11 +130,14 @@ L.OSM.Map = L.Map.extend({ }, getMapBaseLayerId: function () { - var baseLayerId; - this.eachLayer(function (layer) { - if (layer.options && layer.options.keyid) baseLayerId = layer.options.keyid; - }); - 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) {