diff --git a/Logic/SimpleMetaTagger.ts b/Logic/SimpleMetaTagger.ts index f39963ead..eb8479e7f 100644 --- a/Logic/SimpleMetaTagger.ts +++ b/Logic/SimpleMetaTagger.ts @@ -58,6 +58,49 @@ export class SimpleMetaTagger { } } +export class ReferencingWaysMetaTagger extends SimpleMetaTagger { + /** + * Disable this metatagger, e.g. for caching or tests + * This is a bit a work-around + */ + public static enabled = true + constructor() { + super( + { + keys: ["_referencing_ways"], + isLazy: true, + doc: "_referencing_ways contains - for a node - which ways use this this node as point in their geometry. ", + }, + (feature, _, __, state) => { + if (!ReferencingWaysMetaTagger.enabled) { + return false + } + //this function has some extra code to make it work in SimpleAddUI.ts to also work for newly added points + const id = feature.properties.id + if (!id.startsWith("node/")) { + return false + } + console.trace("Downloading referencing ways for", feature.properties.id) + OsmObject.DownloadReferencingWays(id).then((referencingWays) => { + const currentTagsSource = state.allElements?.getEventSourceById(id) ?? [] + const wayIds = referencingWays.map((w) => "way/" + w.id) + wayIds.sort() + const wayIdsStr = wayIds.join(";") + if ( + wayIdsStr !== "" && + currentTagsSource.data["_referencing_ways"] !== wayIdsStr + ) { + currentTagsSource.data["_referencing_ways"] = wayIdsStr + currentTagsSource.ping() + } + }) + + return true + } + ) + } +} + export class CountryTagger extends SimpleMetaTagger { private static readonly coder = new CountryCoder( Constants.countryCoderEndpoint, @@ -492,33 +535,7 @@ export default class SimpleMetaTaggers { } ) - public static referencingWays = new SimpleMetaTagger( - { - keys: ["_referencing_ways"], - isLazy: true, - includesDates: true, - doc: "_referencing_ways contains - for a node - which ways use this this node as point in their geometry. ", - }, - (feature, _, __, state) => { - //this function has some extra code to make it work in SimpleAddUI.ts to also work for newly added points - const id = feature.properties.id - if (!id.startsWith("node/")) { - return false - } - OsmObject.DownloadReferencingWays(id).then((referencingWays) => { - const currentTagsSource = state.allElements?.getEventSourceById(id) ?? [] - const wayIds = referencingWays.map((w) => "way/" + w.id) - wayIds.sort() - const wayIdsStr = wayIds.join(";") - if (wayIdsStr !== "" && currentTagsSource.data["_referencing_ways"] !== wayIdsStr) { - currentTagsSource.data["_referencing_ways"] = wayIdsStr - currentTagsSource.ping() - } - }) - - return true - } - ) + public static referencingWays = new ReferencingWaysMetaTagger() public static metatags: SimpleMetaTagger[] = [ SimpleMetaTaggers.latlon, diff --git a/Models/ThemeConfig/Conversion/FixImages.ts b/Models/ThemeConfig/Conversion/FixImages.ts index 2b5122007..90f609c79 100644 --- a/Models/ThemeConfig/Conversion/FixImages.ts +++ b/Models/ThemeConfig/Conversion/FixImages.ts @@ -15,7 +15,11 @@ export class ExtractImages extends Conversion< private static readonly layoutMetaPaths = metapaths.filter( (mp) => ExtractImages.mightBeTagRendering(mp) || - (mp.typeHint !== undefined && (mp.typeHint === "image" || mp.typeHint === "icon")) + (mp.typeHint !== undefined && + (mp.typeHint === "image" || + mp.typeHint === "icon" || + mp.typeHint === "image[]" || + mp.typeHint === "icon[]")) ) private static readonly tagRenderingMetaPaths = tagrenderingmetapaths @@ -172,7 +176,13 @@ export class ExtractImages extends Conversion< ) continue } - allFoundImages.push(foundElement.leaf) + if (typeof foundElement.leaf !== "string") { + continue + } + allFoundImages.push({ + context: context + "." + foundElement.path.join("."), + path: foundElement.leaf, + }) } } } diff --git a/UI/Base/SubtleButton.svelte b/UI/Base/SubtleButton.svelte index 261c556a6..aebc8f0ba 100644 --- a/UI/Base/SubtleButton.svelte +++ b/UI/Base/SubtleButton.svelte @@ -52,12 +52,14 @@ -