Fix maxspeed theme

This commit is contained in:
Pieter Vander Vennet 2022-06-04 18:10:09 +02:00
parent bcd51b4ee2
commit b62e54ccf6
5 changed files with 216 additions and 209 deletions

View file

@ -13,6 +13,7 @@ import Img from "../../UI/Base/Img";
import Combine from "../../UI/Base/Combine";
import {VariableUiElement} from "../../UI/Base/VariableUIElement";
export default class PointRenderingConfig extends WithContextLoader {
private static readonly allowed_location_codes = new Set<string>(["point", "centroid", "start", "end","projected_centerpoint"])
@ -126,13 +127,20 @@ export default class PointRenderingConfig extends WithContextLoader {
public GetBaseIcon(tags?: any): BaseUIElement {
tags = tags ?? {id: "node/-1"}
const rotation = Utils.SubstituteKeys(this.rotation?.GetRenderValue(tags)?.txt ?? "0deg", tags)
const htmlDefs = Utils.SubstituteKeys(this.icon?.GetRenderValue(tags)?.txt, tags)
let defaultPin: BaseUIElement = undefined
if (this.label === undefined) {
defaultPin = Svg.teardrop_with_hole_green_svg()
}
return PointRenderingConfig.FromHtmlMulti(htmlDefs, rotation, false, defaultPin)
if(this.icon === undefined){
return defaultPin;
}
const rotation = Utils.SubstituteKeys(this.rotation?.GetRenderValue(tags)?.txt ?? "0deg", tags)
const htmlDefs = Utils.SubstituteKeys(this.icon?.GetRenderValue(tags)?.txt, tags)
if(htmlDefs === undefined){
// This layer doesn't want to show an icon right now
return undefined
}
return PointRenderingConfig.FromHtmlMulti(htmlDefs, rotation, false, defaultPin)
}
public GetSimpleIcon(tags: UIEventSource<any>): BaseUIElement {