Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix grid hang when scrolling at max scroll speed #665

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions es-core/src/components/ImageGridComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class ImageGridComponent : public IList<ImageGridData, T>
bool mLastRowPartial;
Vector2f mAutoLayout;
float mAutoLayoutZoom;
int mLastScrollTier;

Vector4f mPadding;
Vector2f mMargin;
Expand Down Expand Up @@ -119,6 +120,7 @@ ImageGridComponent<T>::ImageGridComponent(Window* window) : IList<ImageGridData,
mAutoLayout = Vector2f::Zero();
mAutoLayoutZoom = 1.0;

mLastScrollTier = 0;
mStartPosition = 0;

mEntriesDirty = true;
Expand Down Expand Up @@ -576,19 +578,24 @@ void ImageGridComponent<T>::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<GridTileComponent> tile = mTiles.at(ti);
for (int ti = 0; ti < (int) mTiles.size(); ti++)
{
std::shared_ptr<GridTileComponent> 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<std::shared_ptr<TextureResource>> previousTextures;
Expand Down