Fixed a rounding issue in TextComponent.

This commit is contained in:
Leon Styhre 2022-10-11 19:37:35 +02:00
parent 7e923cb9b6
commit 8bbaec229f

View file

@ -184,7 +184,7 @@ void TextComponent::render(const glm::mat4& parentTrans)
break;
}
case ALIGN_CENTER: {
yOff = (getSize().y - textSize.y) / 2.0f;
yOff = std::round(getSize().y - textSize.y) / 2.0f;
break;
}
default: {
@ -194,7 +194,7 @@ void TextComponent::render(const glm::mat4& parentTrans)
}
else {
// If height is smaller than the font height, then always center vertically.
yOff = (getSize().y - textSize.y) / 2.0f;
yOff = std::round(getSize().y - textSize.y) / 2.0f;
}
// Draw the overall textbox area. If we're inside a scrollable container then this