forked from MapComplete/MapComplete
Add quickswitcher to length input
This commit is contained in:
parent
9bfbdf012a
commit
e701dac274
2 changed files with 20 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue