mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
chore: use toggle to switch visibility in datalayer switcher
This commit is contained in:
parent
3df52e002d
commit
254a2018f5
2 changed files with 4 additions and 8 deletions
|
@ -966,11 +966,11 @@ export class DataLayer extends ServerStored {
|
||||||
this.propagateHide()
|
this.propagateHide()
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle() {
|
toggle(status) {
|
||||||
// From now on, do not try to how/hidedataChanged
|
// From now on, do not try to how/hidedataChanged
|
||||||
// automatically this layer.
|
// automatically this layer.
|
||||||
this._forcedVisibility = true
|
this._forcedVisibility = true
|
||||||
if (!this.isVisible()) this.show()
|
if (!this.isVisible() || status) this.show()
|
||||||
else this.hide()
|
else this.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1258,7 +1258,7 @@ export class DataLayer extends ServerStored {
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DomEvent.on(toggle, 'click', this.toggle, this)
|
DomEvent.on(toggle, 'click', () => this.toggle())
|
||||||
DomEvent.on(zoomTo, 'click', this.zoomTo, this)
|
DomEvent.on(zoomTo, 'click', this.zoomTo, this)
|
||||||
container.classList.add(this.getHidableClass())
|
container.classList.add(this.getHidableClass())
|
||||||
container.classList.toggle('off', !this.isVisible())
|
container.classList.toggle('off', !this.isVisible())
|
||||||
|
|
|
@ -194,11 +194,7 @@ export class BottomBar extends WithTemplate {
|
||||||
const select = this.elements.layers
|
const select = this.elements.layers
|
||||||
const selected = select.options[select.selectedIndex].value
|
const selected = select.options[select.selectedIndex].value
|
||||||
this._umap.eachDataLayer((datalayer) => {
|
this._umap.eachDataLayer((datalayer) => {
|
||||||
if (datalayer.id === selected) {
|
datalayer.toggle(datalayer.id === selected)
|
||||||
datalayer.show()
|
|
||||||
} else {
|
|
||||||
datalayer.hide()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.redraw()
|
this.redraw()
|
||||||
|
|
Loading…
Reference in a new issue