Fixed an issue where horizontally scrolling text containers sometimes had an incorrect vertical offset

This commit is contained in:
Leon Styhre 2023-11-04 21:32:35 +01:00
parent d7da0a768b
commit ac7729b9ac

View file

@ -472,7 +472,7 @@ void TextComponent::onTextChanged()
float offsetY {0.0f};
if (mHorizontalScrolling) {
if (lineHeight > mSize.y)
if (lineHeight > mSize.y && mSize.y != 0.0f)
offsetY = (mSize.y - lineHeight) / 2.0f;
mTextCache = std::shared_ptr<TextCache>(
font->buildTextCache(text, 0.0f, offsetY, mColor, mLineSpacing));