Show layer selector only if more that one layer (#411)

Co-authored-by: Pierre-Yves Rollo <dev@pyrollo.com>
This commit is contained in:
Andrey Stepanov 2024-11-11 23:50:45 +05:00 committed by GitHub
parent a7b5226fd1
commit e1c9bdb8bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,9 +7,11 @@ function onchange(e){
m.route.set("/map/:layerId/:zoom/:lon/:lat", params);
}
export default {
view: function(){
// Display layer selector only if there is choice
if (LayerManager.layers.length <= 1)
return null;
const layers = LayerManager.layers.map(layer => m(
"option",