From 664a39df2c5b04a4c2938dd6a1501839857ddffd Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 24 Sep 2022 22:53:52 +0200 Subject: [PATCH] Fixed an issue where ScrollableContainer would not scroll at the correct speed. --- es-core/src/components/ScrollableContainer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/es-core/src/components/ScrollableContainer.cpp b/es-core/src/components/ScrollableContainer.cpp index 109ca3fee..ddf923ed4 100644 --- a/es-core/src/components/ScrollableContainer.cpp +++ b/es-core/src/components/ScrollableContainer.cpp @@ -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(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;