forked from MapComplete/MapComplete
UX: level selector now has an "All"-level
This commit is contained in:
parent
981b412180
commit
8c478f5e4e
1 changed files with 10 additions and 1 deletions
|
@ -11,6 +11,13 @@
|
|||
export let zoom: Store<number>
|
||||
const maxZoom = 16
|
||||
|
||||
let floorWithAll = floors.mapD(floors => {
|
||||
if (floors.length > 1) {
|
||||
return [...floors, "All"]
|
||||
}
|
||||
return floors
|
||||
})
|
||||
|
||||
let selectedFloor: UIEventSource<string> = new UIEventSource<string>(undefined)
|
||||
|
||||
selectedFloor.stabilized(5).map(
|
||||
|
@ -19,6 +26,8 @@
|
|||
// Only a single floor is visible -> disable the 'level' global filter
|
||||
// OR we might have zoomed out to much ant want to show all
|
||||
layerState.setLevelFilter(undefined)
|
||||
} else if (floor === "All") {
|
||||
layerState.setLevelFilter(undefined)
|
||||
} else {
|
||||
layerState.setLevelFilter(floor)
|
||||
}
|
||||
|
@ -28,5 +37,5 @@
|
|||
</script>
|
||||
|
||||
{#if $zoom >= maxZoom}
|
||||
<FloorSelector {floors} value={selectedFloor} />
|
||||
<FloorSelector floors={floorWithAll} value={selectedFloor} />
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue