From d6cd0516bb452ae191b13b16c77304d0604d65a2 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 2 Oct 2023 01:23:43 +0200 Subject: [PATCH] Fix merge --- assets/layers/last_click/last_click.json | 1 + assets/layers/usersettings/usersettings.json | 3 +- assets/layers/waste_basket/waste_basket.json | 5 +- src/Logic/State/UserSettingsMetaTagging.ts | 48 ++++--------------- .../ThemeConfig/Conversion/PrepareLayer.ts | 5 +- .../ThemeConfig/PointRenderingConfig.ts | 13 ++--- src/Models/ThemeConfig/TagRenderingConfig.ts | 7 ++- 7 files changed, 30 insertions(+), 52 deletions(-) diff --git a/assets/layers/last_click/last_click.json b/assets/layers/last_click/last_click.json index 7963f09dd..9013811d9 100644 --- a/assets/layers/last_click/last_click.json +++ b/assets/layers/last_click/last_click.json @@ -1,4 +1,5 @@ { + "id": "last_click", "description": "This layer defines how to render the 'last click'-location. By default, it will show a marker with the possibility to add a new point (if there are some presets) and/or to add a new note (if the 'note' layer attribute is set). If none are possible, this layer won't show up", "source": "special", "isShown": { diff --git a/assets/layers/usersettings/usersettings.json b/assets/layers/usersettings/usersettings.json index e4f8d8bcb..c0af1b2d5 100644 --- a/assets/layers/usersettings/usersettings.json +++ b/assets/layers/usersettings/usersettings.json @@ -648,5 +648,6 @@ "render": "{all_tags()}" } ], - "mapRendering": null + "lineRendering": null, + "pointRendering": null } diff --git a/assets/layers/waste_basket/waste_basket.json b/assets/layers/waste_basket/waste_basket.json index b2ac9e618..1d2687ab9 100644 --- a/assets/layers/waste_basket/waste_basket.json +++ b/assets/layers/waste_basket/waste_basket.json @@ -391,9 +391,8 @@ "pointRendering": [ { "icon": "./assets/themes/waste_basket/waste_basket.svg", - "iconSize": { - "render": "40,40,center" - }, + "iconSize": "40,40", + "anchor": "center", "location": [ "point" ] diff --git a/src/Logic/State/UserSettingsMetaTagging.ts b/src/Logic/State/UserSettingsMetaTagging.ts index 6e568c5c3..33a5ae85b 100644 --- a/src/Logic/State/UserSettingsMetaTagging.ts +++ b/src/Logic/State/UserSettingsMetaTagging.ts @@ -1,42 +1,14 @@ import { Utils } from "../../Utils" /** This code is autogenerated - do not edit. Edit ./assets/layers/usersettings/usersettings.json instead */ export class ThemeMetaTagging { - public static readonly themeName = "usersettings" + public static readonly themeName = "usersettings" - public metaTaggging_for_usersettings(feat: { properties: Record }) { - Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_md", () => - feat.properties._description - .match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/) - ?.at(1) - ) - Utils.AddLazyProperty( - feat.properties, - "_d", - () => feat.properties._description?.replace(/</g, "<")?.replace(/>/g, ">") ?? "" - ) - Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_a", () => - ((feat) => { - const e = document.createElement("div") - e.innerHTML = feat.properties._d - return Array.from(e.getElementsByTagName("a")).filter( - (a) => a.href.match(/mastodon|en.osm.town/) !== null - )[0]?.href - })(feat) - ) - Utils.AddLazyProperty(feat.properties, "_mastodon_link", () => - ((feat) => { - const e = document.createElement("div") - e.innerHTML = feat.properties._d - return Array.from(e.getElementsByTagName("a")).filter( - (a) => a.getAttribute("rel")?.indexOf("me") >= 0 - )[0]?.href - })(feat) - ) - Utils.AddLazyProperty( - feat.properties, - "_mastodon_candidate", - () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a - ) - feat.properties["__current_backgroun"] = "initial_value" - } -} + public metaTaggging_for_usersettings(feat: {properties: Record}) { + Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_md', () => feat.properties._description.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)?.at(1) ) + Utils.AddLazyProperty(feat.properties, '_d', () => feat.properties._description?.replace(/</g,'<')?.replace(/>/g,'>') ?? '' ) + Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) ) + Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) ) + Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a ) + feat.properties['__current_backgroun'] = 'initial_value' + } +} \ No newline at end of file diff --git a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts index 137e15bbc..8b17d0acd 100644 --- a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts +++ b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts @@ -368,8 +368,7 @@ class ExpandTagRendering extends Conversion< name + ": layer " + layerName + - " not found. Maybe you meant on of " + - candidates.slice(0, 3).join(", ") + " not found for now, but ignoring as this is a bootstrapping run. " ) } else { errors.push( @@ -378,7 +377,7 @@ class ExpandTagRendering extends Conversion< name + ": layer " + layerName + - " not found. Maybe you meant on of " + + " not found. Maybe you meant one of " + candidates.slice(0, 3).join(", ") ) } diff --git a/src/Models/ThemeConfig/PointRenderingConfig.ts b/src/Models/ThemeConfig/PointRenderingConfig.ts index 06bc02797..10e59a4b2 100644 --- a/src/Models/ThemeConfig/PointRenderingConfig.ts +++ b/src/Models/ThemeConfig/PointRenderingConfig.ts @@ -102,14 +102,15 @@ export default class PointRenderingConfig extends WithContextLoader { ) } } - this.iconSize = this.tr("iconSize", "40,40") - this.anchor = this.tr("anchor", "center") - this.label = this.tr("label", undefined) - this.rotation = this.tr("rotation", "0") - this.pitchAlignment = this.tr("pitchAlignment", "canvas") + this.iconSize = this.tr("iconSize", "40,40", context + ".iconsize") + this.anchor = this.tr("anchor", "center", context + ".anchor") + this.label = this.tr("label", undefined, context + ".label") + this.rotation = this.tr("rotation", "0", context + ".rotation") + this.pitchAlignment = this.tr("pitchAlignment", "canvas", context + ".pitchAlignment") this.rotationAlignment = this.tr( "rotationAlignment", - json.pitchAlignment === "map" ? "map" : "canvas" + json.pitchAlignment === "map" ? "map" : "canvas", + context + ".rotationAlignment" ) } diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index ec04f551e..597c5dc4f 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -18,6 +18,7 @@ import { FixedUiElement } from "../../UI/Base/FixedUiElement" import { Paragraph } from "../../UI/Base/Paragraph" import Svg from "../../Svg" import Validators, { ValidatorType } from "../../UI/InputElement/Validators" +import { TagRenderingConfigJson } from "./Json/TagRenderingConfigJson" export interface Icon {} @@ -76,7 +77,11 @@ export default class TagRenderingConfig { public readonly labels: string[] public readonly classes: string[] - constructor(json: string | QuestionableTagRenderingConfigJson, context?: string) { + constructor( + config: string | TagRenderingConfigJson | QuestionableTagRenderingConfigJson, + context?: string + ) { + let json = config if (json === undefined) { throw "Initing a TagRenderingConfig with undefined in " + context }