Fixed an issue where ScrollableContainer would not scroll at the correct speed.

This commit is contained in:
Leon Styhre 2022-09-24 22:53:52 +02:00
parent 9d0b3b911f
commit 664a39df2c

View file

@ -132,7 +132,7 @@ void ScrollableContainer::update(int deltaTime)
// Don't scroll if the media viewer or screensaver is active or if text scrolling is disabled;
if (mWindow->isMediaViewerActive() || mWindow->isScreensaverActive() ||
!mWindow->getAllowTextScrolling()) {
if (mScrollPos != glm::vec2 {} && !mWindow->isLaunchScreenDisplayed())
if (mScrollPos != glm::vec2 {0.0f, 0.0f} && !mWindow->isLaunchScreenDisplayed())
reset();
return;
}
@ -149,6 +149,11 @@ void ScrollableContainer::update(int deltaTime)
mAdjustedAutoScrollSpeed = static_cast<int>(speedModifier);
}
// If there are less than 8 lines of text, accelerate the scrolling further.
const float lines {mAdjustedHeight / combinedHeight};
if (lines < 8.0f)
rowModifier = lines / 8.0f;
if (mAdjustedAutoScrollSpeed < 0)
mAdjustedAutoScrollSpeed = 1;