First working version with multi-rendering

This commit is contained in:
Pieter Vander Vennet 2021-10-22 01:42:44 +02:00
parent 0c0ef48a96
commit 20fa5028d9
5 changed files with 129 additions and 21 deletions

View file

@ -29,7 +29,10 @@ export default interface LineRenderingConfigJson {
/**
* The number of pixels this line should be moved.
* Use a positive numbe to move to the right, a negative to move to the left (left/right as defined by the drawing direction of the line)
* Use a positive numbe to move to the right, a negative to move to the left (left/right as defined by the drawing direction of the line).
*
* IMPORTANT: MapComplete will already normalize 'key:both:property' and 'key:both' into the corresponding 'key:left' and 'key:right' tagging (same for 'sidewalk=left/right/both' which is rewritten to 'sidewalk:left' and 'sidewalk:right')
* This simplifies programming. Refer to the CalculatedTags.md-documentation for more details
*/
offset?: number | TagRenderingConfigJson
}

View file

@ -12,12 +12,16 @@ export default class LineRenderingConfig extends WithContextLoader {
public readonly width: TagRenderingConfig;
public readonly dashArray: TagRenderingConfig;
public readonly offset: TagRenderingConfig;
public readonly leftRightSensitive: boolean
constructor(json: LineRenderingConfigJson, context: string) {
super(json, context)
this.color = this.tr("color", "#0000ff");
this.width = this.tr("width", "7");
this.dashArray = this.tr("dashArray", "");
this.leftRightSensitive = json.offset !== undefined && json.offset !== 0 && json.offset !== "0"
this.offset = this.tr("offset", "0");
}

View file

@ -48,7 +48,7 @@ export default class TagRenderingConfig {
}
if(typeof json === "number"){
this.render =Translations.WT( ""+json)
this.render = Translations.WT( ""+json)
return;
}