X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e409e83b4886ce918c64f5c4cd7fa30cbc1ba14f..4a62dac9c06bcdb7c2acac75e9168bf654c4c64d:/app/assets/javascripts/leaflet.key.js
diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js
index 6a3400d34..f89ae0c3d 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",
@@ -39,11 +39,11 @@ L.OSM.key = function (options) {
$(".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(
+ layer === data.layer &&
+ (!data.zoomMin || zoom >= data.zoomMin) &&
+ (!data.zoomMax || zoom <= data.zoomMax)
+ );
});
}
};