mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
Fixed some GridComponent animation glitches when marking games as favorites.
This commit is contained in:
parent
fe1f408355
commit
b9e6cdd9da
|
@ -435,11 +435,18 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
|||
}
|
||||
else if (CollectionSystemsManager::getInstance()->toggleGameInCollection(
|
||||
entryToUpdate)) {
|
||||
// Needed to avoid some minor transition animation glitches.
|
||||
auto grid =
|
||||
ViewController::getInstance()->getGamelistView(system).get()->mGrid.get();
|
||||
if (grid != nullptr)
|
||||
grid->setSuppressTransitions(true);
|
||||
|
||||
// As the toggling of the game destroyed this object, we need to get the view
|
||||
// from ViewController instead of using the reference that existed before the
|
||||
// destruction. Otherwise we get random crashes.
|
||||
GamelistView* view {
|
||||
ViewController::getInstance()->getGamelistView(system).get()};
|
||||
|
||||
// Jump to the first entry in the gamelist if the last favorite was unmarked.
|
||||
if (foldersOnTop && removedLastFavorite &&
|
||||
!entryToUpdate->getSystem()->isCustomCollection()) {
|
||||
|
@ -457,6 +464,10 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
|||
else if (selectLastEntry && view->getPrimary()->size() > 0) {
|
||||
view->setCursor(view->getLastEntry());
|
||||
}
|
||||
|
||||
if (grid != nullptr)
|
||||
grid->setSuppressTransitions(false);
|
||||
|
||||
// Display the indication icons which show what games are part of the
|
||||
// custom collection currently being edited. This is done cheaply using
|
||||
// onFileChanged() which will trigger populateList().
|
||||
|
|
|
@ -49,7 +49,12 @@ void GamelistView::onFileChanged(FileData* file, bool reloadGamelist)
|
|||
FileData* cursor {getCursor()};
|
||||
if (!cursor->isPlaceHolder()) {
|
||||
populateList(cursor->getParent()->getChildrenListToDisplay(), cursor->getParent());
|
||||
// Needed to avoid some minor transition animation glitches.
|
||||
if (mGrid != nullptr)
|
||||
mGrid->setSuppressTransitions(true);
|
||||
setCursor(cursor);
|
||||
if (mGrid != nullptr)
|
||||
mGrid->setSuppressTransitions(false);
|
||||
}
|
||||
else {
|
||||
populateList(mRoot->getChildrenListToDisplay(), mRoot);
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
const int getColumnCount() const { return mColumns; }
|
||||
const int getRowCount() const { return mRows; }
|
||||
void setScrollVelocity(int velocity) { mScrollVelocity = velocity; }
|
||||
void setSuppressTransitions(bool state) { mSuppressTransitions = state; }
|
||||
|
||||
void setCancelTransitionsCallback(const std::function<void()>& func) override
|
||||
{
|
||||
|
@ -138,6 +139,7 @@ private:
|
|||
bool mLayoutValid;
|
||||
bool mWasScrolling;
|
||||
bool mJustCalculatedLayout;
|
||||
bool mSuppressTransitions;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -172,6 +174,7 @@ GridComponent<T>::GridComponent()
|
|||
, mLayoutValid {false}
|
||||
, mWasScrolling {false}
|
||||
, mJustCalculatedLayout {false}
|
||||
, mSuppressTransitions {false}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -725,6 +728,9 @@ template <typename T> void GridComponent<T>::onCursorChanged(const CursorState&
|
|||
// glm::clamp(std::fabs(glm::mix(0.0f, animTime, timeDiff * 1.5f)), 180.0f,
|
||||
// animTime);
|
||||
|
||||
if (mSuppressTransitions)
|
||||
animTime = 0.0f;
|
||||
|
||||
const float visibleRows {mVisibleRows - 1.0f};
|
||||
const float startRow {static_cast<float>(mScrollPos)};
|
||||
float endRow {static_cast<float>(mCursor / mColumns)};
|
||||
|
|
Loading…
Reference in a new issue