mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
wip: only show layer selector if there are at least two layers
This commit is contained in:
parent
f2cde6af4e
commit
9eaf33c118
1 changed files with 12 additions and 7 deletions
|
@ -210,14 +210,19 @@ export class BottomBar extends WithTemplate {
|
|||
this.elements.browse.hidden = !showMenus
|
||||
this.elements.filter.hidden = !showMenus || !this._umap.properties.facetKey
|
||||
this.elements.layers.innerHTML = ''
|
||||
this._umap.eachDataLayer((datalayer) => {
|
||||
if (!datalayer.options.inCaption) return
|
||||
const datalayers = this._umap.datalayersIndex.filter((d) => d.options.inCaption)
|
||||
if (datalayers.length < 2) {
|
||||
this.elements.layers.hidden = true
|
||||
} else {
|
||||
this.elements.layers.hidden = false
|
||||
for (const datalayer of datalayers) {
|
||||
this.elements.layers.appendChild(
|
||||
Utils.loadTemplate(
|
||||
`<option value="${datalayer.id}">${datalayer.getName()}</option>`
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue