Fixed an issue where horizontally scrolling text was not always rendered correctly when scrolling was reset

This commit is contained in:
Leon Styhre 2023-09-10 15:15:04 +02:00
parent 68ba299e0e
commit 847874a149

View file

@ -378,9 +378,14 @@ void TextComponent::setHorizontalScrolling(bool state)
resetComponent();
mHorizontalScrolling = state;
if (mHorizontalScrolling)
if (mHorizontalScrolling) {
mScrollSpeed =
mFont->sizeText("ABCDEFGHIJKLMNOPQRSTUVWXYZ").x * 0.247f * mScrollSpeedMultiplier;
}
else if (mTextCache != nullptr) {
mTextCache->setClipRegion(
glm::vec4 {0.0f, 0.0f, mSize.x * mRelativeScale, mTextCache->metrics.size.y});
}
}
void TextComponent::update(int deltaTime)