forked from MapComplete/MapComplete
Refactoring: fix background layer switch and hotkeys
This commit is contained in:
parent
c2b9a81c51
commit
23b26c4197
5 changed files with 44 additions and 64 deletions
|
@ -23,20 +23,24 @@ export default class BackgroundLayerResetter {
|
|||
availableLayers.addCallbackAndRunD((availableLayers) => {
|
||||
// We only check on move/on change of the availableLayers
|
||||
const currentBgPolygon: RasterLayerPolygon | undefined = currentBackgroundLayer.data
|
||||
if (currentBackgroundLayer === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
if (availableLayers.findIndex((available) => currentBgPolygon == available) >= 0) {
|
||||
// Still available!
|
||||
return
|
||||
}
|
||||
|
||||
console.log("Current layer properties:", currentBgPolygon)
|
||||
// Oops, we panned out of range for this layer!
|
||||
// What is the 'best' map of the same category which is available?
|
||||
const availableInSameCat = RasterLayerUtils.SelectBestLayerAccordingTo(
|
||||
availableLayers,
|
||||
currentBgPolygon?.properties?.category ?? "osmbasedmap"
|
||||
currentBgPolygon?.properties?.category
|
||||
)
|
||||
console.log("Selecting a different layer:", availableInSameCat.properties.id)
|
||||
currentBackgroundLayer.setData(availableInSameCat ?? AvailableRasterLayers.osmCarto)
|
||||
currentBackgroundLayer.setData(availableInSameCat)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ export default class MetaTagging {
|
|||
return
|
||||
}
|
||||
|
||||
console.trace("Recalculating metatags...")
|
||||
console.debug("Recalculating metatags...")
|
||||
const metatagsToApply: SimpleMetaTagger[] = []
|
||||
for (const metatag of SimpleMetaTaggers.metatags) {
|
||||
if (metatag.includesDates) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue