From a9e145076da85b2ff697c63612921d7705a021b4 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 16 Jan 2024 04:04:17 +0100 Subject: [PATCH 1/3] Chore: make method private, add tests --- src/Logic/Osm/Overpass.ts | 2 +- src/Utils.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Logic/Osm/Overpass.ts b/src/Logic/Osm/Overpass.ts index 9a4b53edbf..f3e9ce15a7 100644 --- a/src/Logic/Osm/Overpass.ts +++ b/src/Logic/Osm/Overpass.ts @@ -52,7 +52,7 @@ export class Overpass { return `${this._interpreterUrl}?data=${encodeURIComponent(query)}` } - public async ExecuteQuery(query: string): Promise<[FeatureCollection, Date]> { + private async ExecuteQuery(query: string): Promise<[FeatureCollection, Date]> { const json = await Utils.downloadJson(this.buildUrl(query)) if (json.elements.length === 0 && json.remark !== undefined) { diff --git a/src/Utils.ts b/src/Utils.ts index 7185b2ddc5..0ca204a346 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -610,6 +610,11 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be * const target = {"id":"test"} * const result = Utils.Merge(source, target) * result // => {"id":"test","condition":{"and":["xyz"]}} + * + * const source = {"=name": {"en": "XYZ"}} + * const target = {"name":null, "x":"y"} + * const result = Utils.Merge(source, target) + * result // => {"name": {"en": "XYZ"}, "x": "y"} */ static Merge(source: Readonly, target: T): T & S { if (target === null) { @@ -1451,7 +1456,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be public static scrollIntoView(element: HTMLBaseElement | HTMLDivElement) { // Is the element completely in the view? const parentRect = Utils.findParentWithScrolling(element)?.getBoundingClientRect() - if(!parentRect){ + if (!parentRect) { return } const elementRect = element.getBoundingClientRect() From 04ee3dc32c7b1e8c6690a91624530309df65e813 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 16 Jan 2024 04:05:45 +0100 Subject: [PATCH 2/3] Themes: pin more markers to new icon --- assets/themes/onwheels/onwheels.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/themes/onwheels/onwheels.json b/assets/themes/onwheels/onwheels.json index ea77a8823d..07cab6fccc 100644 --- a/assets/themes/onwheels/onwheels.json +++ b/assets/themes/onwheels/onwheels.json @@ -130,7 +130,7 @@ "minzoom": 15, "pointRendering": [ { - "marker": [ + "=marker": [ { "icon": "./assets/themes/onwheels/restaurant.svg" } @@ -231,7 +231,7 @@ ], "pointRendering": [ { - "marker": [ + "=marker": [ { "icon": "./assets/themes/onwheels/parking.svg" } @@ -465,7 +465,7 @@ "point", "centroid" ], - "marker": [ + "=marker": [ { "icon": "./assets/svg/statistics.svg" } From cd8f6788e7e2e443592dc35d56dee5ac5fc2acb0 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 16 Jan 2024 04:52:05 +0100 Subject: [PATCH 3/3] Fix tests --- src/Models/ThemeConfig/Conversion/PrepareLayer.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts index 16611e0d74..3906f9d7a3 100644 --- a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts +++ b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts @@ -699,7 +699,7 @@ export class RewriteSpecial extends DesugaringStep { ) } - private static escapeStr(v: string): string{ + private static escapeStr(v: string): string { return v .replace(/,/g, "&COMMA") .replace(/\{/g, "&LBRACE") @@ -770,9 +770,7 @@ export class RewriteSpecial extends DesugaringStep { * "special":{ * "type": "multi", * "key": "_nearby_bicycle_parkings:props", - * "tagrendering": { - * "*": "{id} ({distance}m) {tagApply(a,b,c)}" - * } + * "tagrendering": "{id} ({distance}m) {tagApply(a,b,c)}" * }} * const context = ConversionContext.test() * RewriteSpecial.convertIfNeeded(special, context) // => {"*": "{multi(_nearby_bicycle_parkings:props,&LBRACEid&RBRACE &LPARENS&LBRACEdistance&RBRACEm&RPARENS &LBRACEtagApply&LPARENSa&COMMAb&COMMAc&RPARENS&RBRACE)}"} @@ -877,7 +875,9 @@ export class RewriteSpecial extends DesugaringStep { } if (foundLanguages.size === 0) { - const args = argNamesList.map((nm) => RewriteSpecial.escapeStr(special[nm] ?? "")).join(",") + const args = argNamesList + .map((nm) => RewriteSpecial.escapeStr(special[nm] ?? "")) + .join(",") return { "*": `{${type}(${args})}`, }