General cleanup, improve sidewalk rendering

This commit is contained in:
Pieter Vander Vennet 2021-10-22 02:16:07 +02:00
parent 20fa5028d9
commit 72edc9bdcc
6 changed files with 53 additions and 35 deletions

View file

@ -25,10 +25,7 @@ export default class LineRenderingConfig extends WithContextLoader {
this.offset = this.tr("offset", "0");
}
public GenerateLeafletStyle(
tags: UIEventSource<any>
):
public GenerateLeafletStyle( tags: {} ):
{
color: string,
weight: number,
@ -48,8 +45,8 @@ export default class LineRenderingConfig extends WithContextLoader {
if (tags === undefined) {
return deflt
}
const str = tr?.GetRenderValue(tags.data)?.txt ?? deflt;
return Utils.SubstituteKeys(str, tags.data)?.replace(/{.*}/g, "");
const str = tr?.GetRenderValue(tags)?.txt ?? deflt;
return Utils.SubstituteKeys(str, tags)?.replace(/{.*}/g, "");
}
const dashArray = render(this.dashArray)?.split(" ")?.map(Number);
@ -62,7 +59,6 @@ export default class LineRenderingConfig extends WithContextLoader {
const weight = rendernum(this.width, 5);
const offset = rendernum(this.offset, 0)
console.log("Calculated offset:", offset, "for", this.offset)
return {
color,
weight,

View file

@ -141,7 +141,7 @@ export default class TagRenderingConfig {
const mp = {
if: TagUtils.Tag(mapping.if, `${mappingContext}.if`),
ifnot: (mapping.ifnot !== undefined ? TagUtils.Tag(mapping.ifnot, `${mappingContext}.ifnot`) : undefined),
then: Translations.T(mapping.then, `{mappingContext}.then`),
then: Translations.T(mapping.then, `${mappingContext}.then`),
hideInAnswer: hideInAnswer
};
if (this.question) {