forked from MapComplete/MapComplete
Refactoring: small tweaks to PointRenderingConfig.ts
This commit is contained in:
parent
5f408b5183
commit
34cc65b240
1 changed files with 8 additions and 9 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue