From 05e0986a512d2eb52fbe2e51d8cc808ae21ba3ae Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 11 Jan 2022 00:20:55 +0100 Subject: [PATCH] Fix metatagging --- Logic/ExtraFunctions.ts | 1 + Logic/MetaTagging.ts | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Logic/ExtraFunctions.ts b/Logic/ExtraFunctions.ts index ce571546a..55f948c57 100644 --- a/Logic/ExtraFunctions.ts +++ b/Logic/ExtraFunctions.ts @@ -45,6 +45,7 @@ class OverlapFunc implements ExtraFunction { return (...layerIds: string[]) => { const result: { feat: any, overlap: number }[] = [] + console.log("Calculating overlap") const bbox = BBox.get(feat) for (const layerId of layerIds) { diff --git a/Logic/MetaTagging.ts b/Logic/MetaTagging.ts index 302762110..3c28f7d25 100644 --- a/Logic/MetaTagging.ts +++ b/Logic/MetaTagging.ts @@ -117,7 +117,6 @@ export default class MetaTagging { const calculateAndAssign: ((feat: any) => boolean) = (feat) => { try { - let oldValue = isStrict ? feat.properties[key] : undefined let result = new Function("feat", "return " + code + ";")(feat); if (result === "") { result === undefined @@ -128,7 +127,7 @@ export default class MetaTagging { } delete feat.properties[key] feat.properties[key] = result; - return result === oldValue; + return result; }catch(e){ if (MetaTagging.errorPrintCount < MetaTagging.stopErrorOutputAt) { console.warn("Could not calculate a " + (isStrict ? "strict " : "") + " calculated tag for key " + key + " defined by " + code + " (in layer" + layerId + ") due to \n" + e + "\n. Are you the theme creator? Doublecheck your code. Note that the metatags might not be stable on new features", e, e.stack) @@ -137,7 +136,7 @@ export default class MetaTagging { console.error("Got ", MetaTagging.stopErrorOutputAt, " errors calculating this metatagging - stopping output now") } } - return false; + return undefined; } } @@ -154,11 +153,10 @@ export default class MetaTagging { configurable: true, enumerable: false, // By setting this as not enumerable, the localTileSaver will _not_ calculate this get: function () { - calculateAndAssign(feature) - return feature.properties[key] + return calculateAndAssign(feature) } }) - return true + return undefined }