Improvements to GRB theme

This commit is contained in:
pietervdvn 2021-04-11 19:21:41 +02:00
parent 4525a4de2e
commit 666a3039fe
3 changed files with 49 additions and 9 deletions

View file

@ -193,7 +193,7 @@ export default class LayerConfig {
this.title = tr("title", undefined);
this.icon = tr("icon", Img.AsData(Svg.pin));
this.icon = tr("icon", "");
this.iconOverlays = (json.iconOverlays ?? []).map((overlay, i) => {
let tr = new TagRenderingConfig(overlay.then, self.source.osmTags, `iconoverlays.${i}`);
if (typeof overlay.then === "string" && SharedTagRenderings.SharedIcons[overlay.then] !== undefined) {
@ -415,7 +415,6 @@ export default class LayerConfig {
const label = self.label.GetRenderValue(tgs)?.Subs(tgs)
.SetClass("block w-min text-center")
.SetStyle("margin-top: "+(iconH + 2) +"px")
console.log("Generating label gave ", label, " source: ", self.label, "tags: ", tgs)
if (label !== undefined) {
htmlParts.push(new Combine([label]).SetClass("flex flex-col items-center"))
}

View file

@ -19,8 +19,8 @@ export class Translation extends UIElement {
let count = 0;
for (const translationsKey in translations) {
count++;
if(typeof(translations[translationsKey]) != "string"){
throw "Error in an object depicting a translation: a non-string object was found. ("+context+")\n You probably put some other section accidentally in the translation"
if (typeof (translations[translationsKey]) != "string") {
throw "Error in an object depicting a translation: a non-string object was found. (" + context + ")\n You probably put some other section accidentally in the translation"
}
}
this.translations = translations;
@ -73,9 +73,13 @@ export class Translation extends UIElement {
let rtext: string = "";
if (typeof (el) === "string") {
rtext = el;
} else {
} else if(typeof(el) === "number") {
// HUH? Where did that number come from?
rtext = "" + el;
}else {
Translation.forcedLanguage = lang; // This is a very dirty hack - it'll bite me one day
rtext = el.InnerRender();
}
for (let i = 0; i < parts.length - 1; i++) {
combined.push(parts[i]);
@ -145,7 +149,7 @@ export class Translation extends UIElement {
.map(match => match[1].trim().replace(/^['"]/, '').replace(/['"]$/, ''));
allIcons.push(...sources)
}
}catch(e){
} catch (e) {
console.error("Could not search for images: ", render, this.txt)
throw e
}

View file

@ -35,6 +35,9 @@
]
}
},
"calculatedTags": [
"_grbNumber=(feat.properties.fixme?.match(/GRB thinks that this has number ([^;]+)/ ) ?? ['','none']) [1]"
],
"title": {
"render": {
"nl": "{addr:street} {addr:housenumber}"
@ -77,12 +80,40 @@
"then": {
"nl": "Geen huisnummer"
}
},
{
"if": {
"and": [
"addr:housenumber:={_grbNumber}",
"fixme="
]
},
"then": "Het huisnummer is <b>{_grbNumber}</b>, wat overeenkomt met het GRB",
"hideInAnswer": {
"or": [
"_grbNumber=",
"_grbNumber=none",
"_grbNumber=no number"
]
}
},
{
"if": {
"and": [
"addr:housenumber:=",
"not:addr:housenumber=yes",
"fixme="
]
},
"then": "Dit gebouw heeft geen nummer, net zoals in het GRB",
"hideInAnswer": "_grbNumber!=no number"
}
]
},
{
"question": "Wat is de wooneenheid-aanduiding?",
"render": {
"nl": "De wooneeinheid-aanduiding is <b>{addr:unit}</b> "
"nl": "De wooneenheid-aanduiding is <b>{addr:unit}</b> "
},
"freeform": {
"key": "addr:unit"
@ -142,8 +173,13 @@
}
],
"hideUnderlayingFeaturesMinPercentage": 0,
"icon": {
"render": "./assets/svg/bug.svg"
"label": {
"mappings": [
{
"if": "addr:housenumber~*",
"then": "<div style='background-color: white; font: large; width: 1.5em; height: 1.5em; border-radius: 100%'>{addr:housenumber}</div>"
}
]
},
"width": {
"render": "2"
@ -155,6 +191,7 @@
"color": {
"render": "#00f"
},
"wayHandling": 2,
"presets": []
}
],