X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2d1f756f754ac67ae129032ef626a969c1f4ba27..2c84465cc2c131044cb290d596513723d4ce445a:/app/assets/javascripts/leaflet.key.js diff --git a/app/assets/javascripts/leaflet.key.js b/app/assets/javascripts/leaflet.key.js index bcd5839cd..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 @@ -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) + ); }); } };