mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 10:18:53 +01:00
Fixed width of replacement text for scrolling lists; it should not be wider than
the maximum width of the image it's replacing.
This commit is contained in:
parent
822ce8d462
commit
ad93b0a93d
@ -65,6 +65,15 @@ void Text::draw()
|
|||||||
|
|
||||||
float imageHeight = 0;
|
float imageHeight = 0;
|
||||||
float imageWidth = 0;
|
float imageWidth = 0;
|
||||||
|
float imageMaxWidth = 0;
|
||||||
|
if (baseViewInfo.Width < baseViewInfo.MaxWidth && baseViewInfo.Width > 0)
|
||||||
|
{
|
||||||
|
imageMaxWidth = baseViewInfo.Width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imageMaxWidth = baseViewInfo.MaxWidth;
|
||||||
|
}
|
||||||
|
|
||||||
imageHeight = (float)font->getHeight();
|
imageHeight = (float)font->getHeight();
|
||||||
float scale = (float)baseViewInfo.FontSize / (float)imageHeight;
|
float scale = (float)baseViewInfo.FontSize / (float)imageHeight;
|
||||||
@ -80,7 +89,7 @@ void Text::draw()
|
|||||||
imageWidth += glyph.minX;
|
imageWidth += glyph.minX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((imageWidth + glyph.advance)*scale > baseViewInfo.MaxWidth )
|
if ((imageWidth + glyph.advance)*scale > imageMaxWidth )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
imageWidth += glyph.advance;
|
imageWidth += glyph.advance;
|
||||||
@ -137,7 +146,7 @@ void Text::draw()
|
|||||||
|
|
||||||
rect.x += static_cast<int>(glyph.advance * scale);
|
rect.x += static_cast<int>(glyph.advance * scale);
|
||||||
|
|
||||||
if((static_cast<float>(rect.x) - xOrigin) > baseViewInfo.MaxWidth)
|
if((static_cast<float>(rect.x) - xOrigin) > imageMaxWidth)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user