Let roaming tagrenderings appear together with the questions

This commit is contained in:
pietervdvn 2021-03-15 16:23:04 +01:00
parent 2177f7ac3b
commit bad2248658
3 changed files with 19 additions and 7 deletions

View file

@ -48,16 +48,16 @@ export default class LayerConfig {
}[]; }[];
tagRenderings: TagRenderingConfig []; tagRenderings: TagRenderingConfig [];
private readonly configuration_warnings : string[] = [] private readonly configuration_warnings: string[] = []
constructor(json: LayerConfigJson, constructor(json: LayerConfigJson,
context?: string) { context?: string) {
context = context + "." + json.id; context = context + "." + json.id;
const self = this; const self = this;
this.id = json.id; this.id = json.id;
this.name = Translations.T(json.name, context+".name"); this.name = Translations.T(json.name, context + ".name");
this.description = Translations.T(json.description, context+".description"); this.description = Translations.T(json.description, context + ".description");
this.overpassTags = FromJSON.Tag(json.overpassTags, context + ".overpasstags"); this.overpassTags = FromJSON.Tag(json.overpassTags, context + ".overpasstags");
this.doNotDownload = json.doNotDownload ?? false, this.doNotDownload = json.doNotDownload ?? false,
this.passAllFeatures = json.passAllFeatures ?? false; this.passAllFeatures = json.passAllFeatures ?? false;
@ -176,10 +176,18 @@ export default class LayerConfig {
iconOverlays: { "if": TagsFilter, then: TagRenderingConfig, badge: boolean }[] iconOverlays: { "if": TagsFilter, then: TagRenderingConfig, badge: boolean }[]
}): LayerConfig { }): LayerConfig {
this.tagRenderings.push(...addAll.tagRenderings);
let insertionPoint = this.tagRenderings.map(tr => tr.IsQuestionBoxElement()).indexOf(true)
if (insertionPoint < 0) {
// No 'questions' defined - we just add them all to the end
insertionPoint = this.tagRenderings.length;
}
this.tagRenderings.splice(insertionPoint, 0, ...addAll.tagRenderings);
this.iconOverlays.push(...addAll.iconOverlays); this.iconOverlays.push(...addAll.iconOverlays);
for (const icon of addAll.titleIcons) { for (const icon of addAll.titleIcons) {
this.titleIcons.splice(0,0, icon); this.titleIcons.splice(0, 0, icon);
} }
return this; return this;
} }

View file

@ -218,6 +218,10 @@ export default class TagRenderingConfig {
return false; return false;
} }
public IsQuestionBoxElement(): boolean{
return this.question === null && this.condition === null;
}
/** /**
* Gets the correct rendering value (or undefined if not known) * Gets the correct rendering value (or undefined if not known)
* @constructor * @constructor

View file

@ -2,7 +2,7 @@ import { Utils } from "../Utils";
export default class Constants { export default class Constants {
public static vNumber = "0.5.11"; public static vNumber = "0.5.12";
// The user journey states thresholds when a new feature gets unlocked // The user journey states thresholds when a new feature gets unlocked
public static userJourney = { public static userJourney = {