Fix vert align for text buttons using fallback font

This commit is contained in:
1hitsong 2025-05-03 11:05:11 -04:00
parent ad7b1f3c14
commit ed521fccfc
2 changed files with 4 additions and 3 deletions

View file

@ -82,6 +82,7 @@ sub setIconSize()
if height > 0 and width > 0
' TODO: Use smallest number between them
m.buttonIcon.height = m.top.height
m.buttonText.height = m.top.height
if m.top.padding > 0
m.buttonIcon.height = m.buttonIcon.height - m.top.padding
@ -92,10 +93,10 @@ sub setIconSize()
' Set Icon translation
if LCase(m.top.iconSide) = "right"
m.buttonIcon.translation = [m.buttonBackground.width - m.top.padding - m.buttonIcon.width, ((height - m.buttonIcon.height) / 2)]
m.buttonText.translation = [m.top.padding, ((height - m.buttonText.font.size) / 2)]
m.buttonText.translation = [m.top.padding, 0]
else
m.buttonIcon.translation = [m.top.padding, ((height - m.buttonIcon.height) / 2)]
m.buttonText.translation = [m.top.padding + m.buttonIcon.width + 20, ((height - m.buttonText.font.size) / 2)]
m.buttonText.translation = [m.top.padding + m.buttonIcon.width + 20, 0]
end if
' Set text max width

View file

@ -3,7 +3,7 @@
<children>
<Poster id="buttonBackground" uri="pkg:/images/white.9.png" />
<Poster id="buttonIcon" />
<ScrollingText id="buttonText" font="font:MediumSystemFont" horizAlign="left" />
<ScrollingText id="buttonText" vertAlign="center" font="font:MediumSystemFont" horizAlign="left" />
</children>
<interface>
<field id="background" type="color" value="" />