Merge branch 'master' into develop

This commit is contained in:
Pieter Vander Vennet 2024-08-23 11:44:46 +02:00
commit fbf5ce6fec
26 changed files with 1225 additions and 847 deletions

View file

@ -19,13 +19,14 @@ export default class BackgroundLayerResetter {
return
}
currentBackgroundLayer.addCallbackAndRunD((l) => {
currentBackgroundLayer.addCallbackAndRunD(async (l) => {
if (
l.geometry !== undefined &&
AvailableRasterLayers.globalLayers.find(
(global) => global.properties.id !== l.properties.id
)
) {
await AvailableRasterLayers.editorLayerIndex()
BackgroundLayerResetter.installHandler(
currentBackgroundLayer,
availableLayers.store

View file

@ -61,9 +61,9 @@ export class PreferredRasterLayerSelector {
* Returns 'true' if the target layer is set or is the current layer
* @private
*/
private updateLayer() {
private async updateLayer() {
// What is the ID of the layer we have to (try to) load?
const targetLayerId = this._queryParameter.data ?? this._preferredBackgroundLayer.data
const targetLayerId = (this._queryParameter.data ?? this._preferredBackgroundLayer.data)?.toLowerCase()
if (targetLayerId === undefined || targetLayerId === "default") {
return
}
@ -74,12 +74,13 @@ export class PreferredRasterLayerSelector {
this._rasterLayerSetting.setData(global)
return
}
await AvailableRasterLayers.editorLayerIndex()
const isCategory =
targetLayerId === "photo" || targetLayerId === "osmbasedmap" || targetLayerId === "map"
const available = this._availableLayers.store.data
const foundLayer = isCategory
? available.find((l) => l.properties.category === targetLayerId)
: available.find((l) => l.properties.id === targetLayerId)
: available.find((l) => l.properties.id.toLowerCase() === targetLayerId)
console.debug("Updating background layer to", foundLayer?.id, {
targetLayerId,
queryParam: this._queryParameter?.data,

View file

@ -14,6 +14,10 @@ export class And extends TagsFilter {
constructor(and: ReadonlyArray<TagsFilter>) {
super()
this.and = and
if(and.some(p => typeof p === "string")){
console.error("Assertion failed: invalid subtags:", and)
throw "Assertion failed: invalid subtags found"
}
}
public static construct(and: ReadonlyArray<TagsFilter>): TagsFilter