From 4d59cdc86076f7794b055a1f8aabb2e2ca5a58a1 Mon Sep 17 00:00:00 2001 From: Benjamin Deroche Date: Tue, 30 Jun 2020 22:10:34 +0200 Subject: [PATCH] Fix grid hang when scrolling at max scroll speed Reset all tiles only when we hit max scroll speed --- es-core/src/components/ImageGridComponent.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/es-core/src/components/ImageGridComponent.h b/es-core/src/components/ImageGridComponent.h index bc863c3789..0746086b85 100644 --- a/es-core/src/components/ImageGridComponent.h +++ b/es-core/src/components/ImageGridComponent.h @@ -86,6 +86,7 @@ class ImageGridComponent : public IList bool mLastRowPartial; Vector2f mAutoLayout; float mAutoLayoutZoom; + int mLastScrollTier; Vector4f mPadding; Vector2f mMargin; @@ -119,6 +120,7 @@ ImageGridComponent::ImageGridComponent(Window* window) : IList::updateTiles(bool ascending, bool allowAnimation, boo if (!mTiles.size()) return; - // Stop updating the tiles at highest scroll speed if (mScrollTier == 3) { - for (int ti = 0; ti < (int)mTiles.size(); ti++) + // Stop updating the tiles at highest scroll speed + if (mLastScrollTier != 3) { - std::shared_ptr tile = mTiles.at(ti); + for (int ti = 0; ti < (int) mTiles.size(); ti++) + { + std::shared_ptr tile = mTiles.at(ti); - tile->setSelected(false); - tile->setImage(mDefaultGameTexture); - tile->setVisible(false); + tile->setSelected(false); + tile->setImage(mDefaultGameTexture); + tile->setVisible(false); + } } + mLastScrollTier = mScrollTier; return; } + mLastScrollTier = mScrollTier; // Temporary store previous texture so they can't be unloaded std::vector> previousTextures;