walkermatt / ol-layerswitcher

Layer control for OpenLayers
MIT License
384 stars 176 forks source link

Hide layers from panel #499

Closed kuztom closed 9 months ago

kuztom commented 10 months ago

Recently stuck in a problem where a single layer (from 4) must not be in the panel list. It is a basemap layer that is shown always and there is no need to show it in the panel. Especially with a radio button next to it which does nothing if clicked.

My workaround was with css:

.panel ul:first-child li:first-of-type {
    display: none;
}

But what if its not the first element or layers get mixed another way?

Some kinda property to layer - hideInPanel: true would help to achieve this easely.

walkermatt commented 10 months ago

Could you try not setting a title property to the layer that shouldn't be shown in the panel.

kuztom commented 9 months ago

Thanks, this works and that was easier than I thought. Dont even know why I didnt try that before. Thanks again!