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 [];
private readonly configuration_warnings : string[] = []
private readonly configuration_warnings: string[] = []
constructor(json: LayerConfigJson,
context?: string) {
context = context + "." + json.id;
const self = this;
this.id = json.id;
this.name = Translations.T(json.name, context+".name");
this.description = Translations.T(json.description, context+".description");
this.name = Translations.T(json.name, context + ".name");
this.description = Translations.T(json.description, context + ".description");
this.overpassTags = FromJSON.Tag(json.overpassTags, context + ".overpasstags");
this.doNotDownload = json.doNotDownload ?? false,
this.passAllFeatures = json.passAllFeatures ?? false;
@ -176,10 +176,18 @@ export default class LayerConfig {
iconOverlays: { "if": TagsFilter, then: TagRenderingConfig, badge: boolean }[]
}): 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);
for (const icon of addAll.titleIcons) {
this.titleIcons.splice(0,0, icon);
this.titleIcons.splice(0, 0, icon);
}
return this;
}

View file

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

View file

@ -2,7 +2,7 @@ import { Utils } from "../Utils";
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
public static userJourney = {