diff --git a/code/boot.js b/code/boot.js index 6a54870f..c82afd4d 100644 --- a/code/boot.js +++ b/code/boot.js @@ -78,6 +78,21 @@ window.setupLayerChooserStatusRecorder = function() { }); } +window.layerChooserSetDisabledStates = function() { +// layer selector - enable/disable layers that aren't visible due to zoom level + var minlvl = getMinPortalLevel(); + var portalSelection = $('.leaflet-control-layers-overlays label'); + //it's an array - 0=unclaimed, 1=lvl 1, 2=lvl 2, ..., 8=lvl 8 - 9 relevant entries + //mark all levels below (but not at) minlvl as disabled + portalSelection.slice(0, minlvl).addClass('disabled').attr('title', 'Zoom in to show those.'); + //and all from minlvl to 8 as enabled + portalSelection.slice(minlvl, 8+1).removeClass('disabled').attr('title', ''); + +//TODO? some generic mechanism where other layers can have their disabled state marked on/off? a few +//plugins have code to do it by hand already +} + + window.setupStyles = function() { $('head').append('