mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 01:25:38 +00:00
Fixed multiple issues where horizontally scrolling TextListComponent rows would not stop and reset correctly.
This commit is contained in:
parent
0d6c4e02a6
commit
4f88909eff
|
@ -484,6 +484,8 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
||||||
stopListScrolling();
|
stopListScrolling();
|
||||||
pauseViewVideos();
|
pauseViewVideos();
|
||||||
stopGamelistFadeAnimations();
|
stopGamelistFadeAnimations();
|
||||||
|
mWindow->setAllowTextScrolling(false);
|
||||||
|
mWindow->setAllowFileAnimation(false);
|
||||||
mWindow->pushGui(new GuiGamelistOptions(this->mRoot->getSystem()));
|
mWindow->pushGui(new GuiGamelistOptions(this->mRoot->getSystem()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -857,6 +857,9 @@ bool ViewController::input(InputConfig* config, Input input)
|
||||||
mCurrentView->pauseViewVideos();
|
mCurrentView->pauseViewVideos();
|
||||||
mCurrentView->stopGamelistFadeAnimations();
|
mCurrentView->stopGamelistFadeAnimations();
|
||||||
|
|
||||||
|
mWindow->setAllowTextScrolling(false);
|
||||||
|
mWindow->setAllowFileAnimation(false);
|
||||||
|
|
||||||
// Finally, if the camera is currently moving, reset its position.
|
// Finally, if the camera is currently moving, reset its position.
|
||||||
cancelViewTransitions();
|
cancelViewTransitions();
|
||||||
|
|
||||||
|
@ -864,6 +867,9 @@ bool ViewController::input(InputConfig* config, Input input)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mWindow->setAllowTextScrolling(true);
|
||||||
|
mWindow->setAllowFileAnimation(true);
|
||||||
|
|
||||||
// Check if UI mode has changed due to passphrase completion.
|
// Check if UI mode has changed due to passphrase completion.
|
||||||
if (UIModeController::getInstance()->listen(config, input))
|
if (UIModeController::getInstance()->listen(config, input))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -122,6 +122,7 @@ public:
|
||||||
const std::string& getCollectionIndicators() const { return mCollectionIndicators; }
|
const std::string& getCollectionIndicators() const { return mCollectionIndicators; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void onShow() override { mLoopTime = 0; }
|
||||||
void onScroll() override
|
void onScroll() override
|
||||||
{
|
{
|
||||||
if (!NavigationSounds::getInstance().isPlayingThemeNavigationSound(SCROLLSOUND))
|
if (!NavigationSounds::getInstance().isPlayingThemeNavigationSound(SCROLLSOUND))
|
||||||
|
@ -151,7 +152,7 @@ private:
|
||||||
float mCamOffset;
|
float mCamOffset;
|
||||||
int mPreviousScrollVelocity;
|
int mPreviousScrollVelocity;
|
||||||
|
|
||||||
int mLoopOffset;
|
int mLoopOffset1;
|
||||||
int mLoopOffset2;
|
int mLoopOffset2;
|
||||||
int mLoopTime;
|
int mLoopTime;
|
||||||
bool mLoopScroll;
|
bool mLoopScroll;
|
||||||
|
@ -188,7 +189,7 @@ TextListComponent<T>::TextListComponent()
|
||||||
, mRenderer {Renderer::getInstance()}
|
, mRenderer {Renderer::getInstance()}
|
||||||
, mCamOffset {0.0f}
|
, mCamOffset {0.0f}
|
||||||
, mPreviousScrollVelocity {0}
|
, mPreviousScrollVelocity {0}
|
||||||
, mLoopOffset {0}
|
, mLoopOffset1 {0}
|
||||||
, mLoopOffset2 {0}
|
, mLoopOffset2 {0}
|
||||||
, mLoopTime {0}
|
, mLoopTime {0}
|
||||||
, mLoopScroll {false}
|
, mLoopScroll {false}
|
||||||
|
@ -282,12 +283,13 @@ template <typename T> void TextListComponent<T>::update(int deltaTime)
|
||||||
{
|
{
|
||||||
List::listUpdate(deltaTime);
|
List::listUpdate(deltaTime);
|
||||||
|
|
||||||
if (isScrolling() && (mWindow->isScreensaverActive() || !mWindow->getAllowTextScrolling()))
|
if ((mWindow->isMediaViewerActive() || mWindow->isScreensaverActive() ||
|
||||||
List::stopScrolling();
|
!mWindow->getAllowTextScrolling())) {
|
||||||
|
mLoopTime = 0;
|
||||||
if (!isScrolling() && size() > 0) {
|
}
|
||||||
|
else {
|
||||||
// Always reset the loop offsets.
|
// Always reset the loop offsets.
|
||||||
mLoopOffset = 0;
|
mLoopOffset1 = 0;
|
||||||
mLoopOffset2 = 0;
|
mLoopOffset2 = 0;
|
||||||
|
|
||||||
// If we're not scrolling and this object's text exceeds our size, then loop it.
|
// If we're not scrolling and this object's text exceeds our size, then loop it.
|
||||||
|
@ -311,12 +313,12 @@ template <typename T> void TextListComponent<T>::update(int deltaTime)
|
||||||
while (mLoopTime > maxTime)
|
while (mLoopTime > maxTime)
|
||||||
mLoopTime -= maxTime;
|
mLoopTime -= maxTime;
|
||||||
|
|
||||||
mLoopOffset = static_cast<int>(Utils::Math::loop(delay, scrollTime + returnTime,
|
mLoopOffset1 = static_cast<int>(Utils::Math::loop(delay, scrollTime + returnTime,
|
||||||
static_cast<float>(mLoopTime),
|
static_cast<float>(mLoopTime),
|
||||||
scrollLength + returnLength));
|
scrollLength + returnLength));
|
||||||
|
|
||||||
if (mLoopOffset > (scrollLength - (limit - returnLength)))
|
if (mLoopOffset1 > (scrollLength - (limit - returnLength)))
|
||||||
mLoopOffset2 = static_cast<int>(mLoopOffset - (scrollLength + returnLength));
|
mLoopOffset2 = static_cast<int>(mLoopOffset1 - (scrollLength + returnLength));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,6 +327,12 @@ template <typename T> void TextListComponent<T>::update(int deltaTime)
|
||||||
|
|
||||||
template <typename T> void TextListComponent<T>::render(const glm::mat4& parentTrans)
|
template <typename T> void TextListComponent<T>::render(const glm::mat4& parentTrans)
|
||||||
{
|
{
|
||||||
|
if ((mWindow->isMediaViewerActive() || mWindow->isScreensaverActive() ||
|
||||||
|
!mWindow->getAllowTextScrolling())) {
|
||||||
|
mLoopOffset1 = 0;
|
||||||
|
mLoopOffset2 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (size() == 0)
|
if (size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -460,17 +468,17 @@ template <typename T> void TextListComponent<T>::render(const glm::mat4& parentT
|
||||||
glm::mat4 drawTrans {trans};
|
glm::mat4 drawTrans {trans};
|
||||||
|
|
||||||
// Currently selected item text might be looping.
|
// Currently selected item text might be looping.
|
||||||
if (mCursor == i && mLoopOffset > 0) {
|
if (mCursor == i && mLoopOffset1 > 0) {
|
||||||
drawTrans = glm::translate(
|
drawTrans = glm::translate(
|
||||||
drawTrans,
|
drawTrans,
|
||||||
glm::round(offset - glm::vec3 {static_cast<float>(mLoopOffset), 0.0f, 0.0f}));
|
glm::round(offset - glm::vec3 {static_cast<float>(mLoopOffset1), 0.0f, 0.0f}));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawTrans = glm::translate(drawTrans, glm::round(offset));
|
drawTrans = glm::translate(drawTrans, glm::round(offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed to avoid flickering when returning to the start position.
|
// Needed to avoid flickering when returning to the start position.
|
||||||
if (mLoopOffset == 0 && mLoopOffset2 == 0)
|
if (mLoopOffset1 == 0 && mLoopOffset2 == 0)
|
||||||
mLoopScroll = false;
|
mLoopScroll = false;
|
||||||
|
|
||||||
mRenderer->setMatrix(drawTrans);
|
mRenderer->setMatrix(drawTrans);
|
||||||
|
@ -658,8 +666,6 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
|
|
||||||
template <typename T> void TextListComponent<T>::onCursorChanged(const CursorState& state)
|
template <typename T> void TextListComponent<T>::onCursorChanged(const CursorState& state)
|
||||||
{
|
{
|
||||||
mLoopOffset = 0;
|
|
||||||
mLoopOffset2 = 0;
|
|
||||||
mLoopTime = 0;
|
mLoopTime = 0;
|
||||||
|
|
||||||
if constexpr (std::is_same_v<T, SystemData*>) {
|
if constexpr (std::is_same_v<T, SystemData*>) {
|
||||||
|
|
Loading…
Reference in a new issue