Add quickswitcher to length input

This commit is contained in:
Pieter Vander Vennet 2022-06-19 18:15:33 +02:00
parent 9bfbdf012a
commit e701dac274
2 changed files with 20 additions and 6 deletions

View file

@ -165,9 +165,13 @@ export default class BackgroundMapSwitch extends Combine {
backgroundLayer: UIEventSource<BaseLayer>
},
currentBackground: UIEventSource<BaseLayer>,
preferredCategory?: string
options?:{
preferredCategory?: string,
allowedCategories?: ("osmbasedmap" | "photo" | "map")[]
}
) {
const allowedCategories = ["osmbasedmap", "photo", "map"]
const allowedCategories = options?.allowedCategories ?? ["osmbasedmap", "photo", "map"]
const previousLayer = state.backgroundLayer.data
const buttons = []
@ -188,7 +192,7 @@ export default class BackgroundMapSwitch extends Combine {
})
// Fall back to the first option: OSM
activatePrevious = activatePrevious ?? button.activate
if (category === preferredCategory) {
if (category === options?.preferredCategory) {
button.activate()
}
buttons.push(button)