diff --git a/es-app/src/views/GamelistBase.cpp b/es-app/src/views/GamelistBase.cpp index 9c30f14a0..2e419f61d 100644 --- a/es-app/src/views/GamelistBase.cpp +++ b/es-app/src/views/GamelistBase.cpp @@ -484,6 +484,8 @@ bool GamelistBase::input(InputConfig* config, Input input) stopListScrolling(); pauseViewVideos(); stopGamelistFadeAnimations(); + mWindow->setAllowTextScrolling(false); + mWindow->setAllowFileAnimation(false); mWindow->pushGui(new GuiGamelistOptions(this->mRoot->getSystem())); return true; } diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index a80dd5e9b..882159fe6 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -857,6 +857,9 @@ bool ViewController::input(InputConfig* config, Input input) mCurrentView->pauseViewVideos(); mCurrentView->stopGamelistFadeAnimations(); + mWindow->setAllowTextScrolling(false); + mWindow->setAllowFileAnimation(false); + // Finally, if the camera is currently moving, reset its position. cancelViewTransitions(); @@ -864,6 +867,9 @@ bool ViewController::input(InputConfig* config, Input input) return true; } + mWindow->setAllowTextScrolling(true); + mWindow->setAllowFileAnimation(true); + // Check if UI mode has changed due to passphrase completion. if (UIModeController::getInstance()->listen(config, input)) return true; diff --git a/es-core/src/components/primary/TextListComponent.h b/es-core/src/components/primary/TextListComponent.h index a96e9c677..354598612 100644 --- a/es-core/src/components/primary/TextListComponent.h +++ b/es-core/src/components/primary/TextListComponent.h @@ -122,6 +122,7 @@ public: const std::string& getCollectionIndicators() const { return mCollectionIndicators; } protected: + void onShow() override { mLoopTime = 0; } void onScroll() override { if (!NavigationSounds::getInstance().isPlayingThemeNavigationSound(SCROLLSOUND)) @@ -151,7 +152,7 @@ private: float mCamOffset; int mPreviousScrollVelocity; - int mLoopOffset; + int mLoopOffset1; int mLoopOffset2; int mLoopTime; bool mLoopScroll; @@ -188,7 +189,7 @@ TextListComponent::TextListComponent() , mRenderer {Renderer::getInstance()} , mCamOffset {0.0f} , mPreviousScrollVelocity {0} - , mLoopOffset {0} + , mLoopOffset1 {0} , mLoopOffset2 {0} , mLoopTime {0} , mLoopScroll {false} @@ -282,12 +283,13 @@ template void TextListComponent::update(int deltaTime) { List::listUpdate(deltaTime); - if (isScrolling() && (mWindow->isScreensaverActive() || !mWindow->getAllowTextScrolling())) - List::stopScrolling(); - - if (!isScrolling() && size() > 0) { + if ((mWindow->isMediaViewerActive() || mWindow->isScreensaverActive() || + !mWindow->getAllowTextScrolling())) { + mLoopTime = 0; + } + else { // Always reset the loop offsets. - mLoopOffset = 0; + mLoopOffset1 = 0; mLoopOffset2 = 0; // If we're not scrolling and this object's text exceeds our size, then loop it. @@ -311,12 +313,12 @@ template void TextListComponent::update(int deltaTime) while (mLoopTime > maxTime) mLoopTime -= maxTime; - mLoopOffset = static_cast(Utils::Math::loop(delay, scrollTime + returnTime, - static_cast(mLoopTime), - scrollLength + returnLength)); + mLoopOffset1 = static_cast(Utils::Math::loop(delay, scrollTime + returnTime, + static_cast(mLoopTime), + scrollLength + returnLength)); - if (mLoopOffset > (scrollLength - (limit - returnLength))) - mLoopOffset2 = static_cast(mLoopOffset - (scrollLength + returnLength)); + if (mLoopOffset1 > (scrollLength - (limit - returnLength))) + mLoopOffset2 = static_cast(mLoopOffset1 - (scrollLength + returnLength)); } } @@ -325,6 +327,12 @@ template void TextListComponent::update(int deltaTime) template void TextListComponent::render(const glm::mat4& parentTrans) { + if ((mWindow->isMediaViewerActive() || mWindow->isScreensaverActive() || + !mWindow->getAllowTextScrolling())) { + mLoopOffset1 = 0; + mLoopOffset2 = 0; + } + if (size() == 0) return; @@ -460,17 +468,17 @@ template void TextListComponent::render(const glm::mat4& parentT glm::mat4 drawTrans {trans}; // Currently selected item text might be looping. - if (mCursor == i && mLoopOffset > 0) { + if (mCursor == i && mLoopOffset1 > 0) { drawTrans = glm::translate( drawTrans, - glm::round(offset - glm::vec3 {static_cast(mLoopOffset), 0.0f, 0.0f})); + glm::round(offset - glm::vec3 {static_cast(mLoopOffset1), 0.0f, 0.0f})); } else { drawTrans = glm::translate(drawTrans, glm::round(offset)); } // Needed to avoid flickering when returning to the start position. - if (mLoopOffset == 0 && mLoopOffset2 == 0) + if (mLoopOffset1 == 0 && mLoopOffset2 == 0) mLoopScroll = false; mRenderer->setMatrix(drawTrans); @@ -658,8 +666,6 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, template void TextListComponent::onCursorChanged(const CursorState& state) { - mLoopOffset = 0; - mLoopOffset2 = 0; mLoopTime = 0; if constexpr (std::is_same_v) {