X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/04ff7d4ee81040f152c38ee39ba84491c91a66f3..de0bf2549978f0b517c06c3eadaa477b37433ea6:/app/assets/javascripts/leaflet.key.js?ds=sidebyside
diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js
index 6a3400d34..090583ced 100644
--- a/app/assets/javascripts/leaflet.key.js
+++ b/app/assets/javascripts/leaflet.key.js
@@ -3,7 +3,7 @@ L.OSM.key = function (options) {
control.onAddPane = function (map, button, $ui) {
var $section = $("
")
- .attr("class", "section")
+ .attr("class", "p-3")
.appendTo($ui);
$ui
@@ -24,7 +24,7 @@ L.OSM.key = function (options) {
}
function updateButton() {
- var disabled = ["mapnik", "cyclemap"].indexOf(map.getMapBaseLayerId()) === -1;
+ var disabled = OSM.LAYERS_WITH_MAP_KEY.indexOf(map.getMapBaseLayerId()) === -1;
button
.toggleClass("disabled", disabled)
.attr("data-bs-original-title",
@@ -34,16 +34,16 @@ L.OSM.key = function (options) {
}
function update() {
- var layer = map.getMapBaseLayerId(),
+ var layerId = map.getMapBaseLayerId(),
zoom = map.getZoom();
$(".mapkey-table-entry").each(function () {
var data = $(this).data();
- if (layer === data.layer && zoom >= data.zoomMin && zoom <= data.zoomMax) {
- $(this).show();
- } else {
- $(this).hide();
- }
+ $(this).toggle(
+ layerId === data.layer &&
+ (!data.zoomMin || zoom >= data.zoomMin) &&
+ (!data.zoomMax || zoom <= data.zoomMax)
+ );
});
}
};