Refactoring: small tweaks to PointRenderingConfig.ts

This commit is contained in:
Pieter Vander Vennet 2025-09-01 00:06:37 +02:00
parent 5f408b5183
commit 34cc65b240

View file

@ -129,7 +129,8 @@ export default class PointRenderingConfig extends WithContextLoader {
context + ".rotationAlignment"
)
}
private static FromHtmlMulti(
private static fromHtmlMulti(
multiSpec: string,
tags: Store<Record<string, string>>
): BaseUIElement {
@ -207,7 +208,7 @@ export default class PointRenderingConfig extends WithContextLoader {
: undefined
let badges = undefined
if (options?.includeBadges ?? true) {
badges = this.GetBadges(tags, options?.metatags)
badges = this.getBadges(tags, options?.metatags)
}
const iconAndBadges = new Combine([icon, badges]).SetClass("block relative")
@ -235,7 +236,7 @@ export default class PointRenderingConfig extends WithContextLoader {
} else if (label === undefined) {
htmlEl = new Combine([iconAndBadges])
} else {
htmlEl = new Combine([iconAndBadges, label]).SetStyle("flex flex-col")
htmlEl = new Combine([iconAndBadges, label])
}
if (css !== undefined) {
@ -251,7 +252,7 @@ export default class PointRenderingConfig extends WithContextLoader {
}
}
private GetBadges(
private getBadges(
tags: Store<Record<string, string>>,
metaTags?: Store<Record<string, string>>
): BaseUIElement {
@ -283,15 +284,14 @@ export default class PointRenderingConfig extends WithContextLoader {
if (htmlDefs.startsWith("<") && htmlDefs.endsWith(">")) {
// This is probably an HTML-element
return new FixedUiElement(Utils.SubstituteKeys(htmlDefs, tagsData))
.SetStyle("width: 1.5rem")
.SetClass("block")
.SetClass("block w-6")
}
if (!htmlDefs) {
return undefined
}
const badgeElement = PointRenderingConfig.FromHtmlMulti(
const badgeElement = PointRenderingConfig.fromHtmlMulti(
htmlDefs,
tags
)?.SetClass("block relative")
@ -299,8 +299,7 @@ export default class PointRenderingConfig extends WithContextLoader {
return undefined
}
return new Combine([badgeElement])
.SetStyle("width: 1.5rem")
.SetClass("block")
.SetClass("block w-6")
})
return new Combine(badgeElements).SetClass("inline-flex h-full")