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 stuttering when starting to scroll a Game List #755

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 11 additions & 2 deletions es-app/src/views/gamelist/DetailedGameListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,19 @@ void DetailedGameListView::updateInfoPanel()
FileData* file = (mList.size() == 0 || mList.isScrolling()) ? NULL : mList.getSelected();

bool fadingOut;
if(file == NULL)
if(mFile == file)
{
// Info is already on the panel, don't waste time reloading
return;
}
else if(file == NULL)
{
//mImage.setImage("");
//mDescription.setText("");
fadingOut = true;
}else{
}
else
{
mThumbnail.setImage(file->getThumbnailPath());
mMarquee.setImage(file->getMarqueePath());
mImage.setImage(file->getImagePath());
Expand All @@ -244,6 +251,8 @@ void DetailedGameListView::updateInfoPanel()
fadingOut = false;
}

mFile = file;

std::vector<GuiComponent*> comps = getMDValues();
comps.push_back(&mThumbnail);
comps.push_back(&mMarquee);
Expand Down
2 changes: 2 additions & 0 deletions es-app/src/views/gamelist/DetailedGameListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class DetailedGameListView : public BasicGameListView
void initMDLabels();
void initMDValues();

FileData* mFile;

ImageComponent mThumbnail;
ImageComponent mMarquee;
ImageComponent mImage;
Expand Down
14 changes: 11 additions & 3 deletions es-app/src/views/gamelist/VideoGameListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,22 @@ void VideoGameListView::updateInfoPanel()
FileData* file = (mList.size() == 0 || mList.isScrolling()) ? NULL : mList.getSelected();

bool fadingOut;
if(file == NULL)
if(mFile == file)
{
// Info is already on the panel, don't waste time reloading
return;
}
else if(file == NULL)
{
mVideo->setVideo("");
mVideo->setImage("");
mVideoPlaying = false;
//mMarquee.setImage("");
//mDescription.setText("");
fadingOut = true;

}else{
}
else
{
if (!mVideo->setVideo(file->getVideoPath()))
{
mVideo->setDefaultVideo();
Expand Down Expand Up @@ -290,6 +296,8 @@ void VideoGameListView::updateInfoPanel()
fadingOut = false;
}

mFile = file;

std::vector<GuiComponent*> comps = getMDValues();
comps.push_back(&mThumbnail);
comps.push_back(&mMarquee);
Expand Down
2 changes: 2 additions & 0 deletions es-app/src/views/gamelist/VideoGameListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class VideoGameListView : public BasicGameListView
void initMDLabels();
void initMDValues();

FileData* mFile;

ImageComponent mThumbnail;
ImageComponent mMarquee;
VideoComponent* mVideo;
Expand Down
6 changes: 1 addition & 5 deletions es-core/src/components/IList.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ class IList : public GuiComponent
{
PowerSaver::setState(velocity == 0);

// generate an onCursorChanged event in the stopped state when the user lets go of the key
if(velocity == 0 && mScrollVelocity != 0)
onCursorChanged(CURSOR_STOPPED);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to make sure that removing this didn't break anything else.

The call to stopScrolling() would also call onCursorChanged() so that is where it would be called once, but believe there are other places that only call listInput(0);


mScrollVelocity = velocity;
mScrollTier = 0;
mScrollTierAccumulator = 0;
Expand Down Expand Up @@ -302,7 +298,7 @@ class IList : public GuiComponent
onScroll(absAmt);

mCursor = cursor;
onCursorChanged((mScrollTier > 0) ? CURSOR_SCROLLING : CURSOR_STOPPED);
onCursorChanged((amt != 0) ? CURSOR_SCROLLING : CURSOR_STOPPED);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell us more about this change.

Copy link
Author

@XenuIsWatching XenuIsWatching May 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the intent of mScrollTier was to control and watch the speed of how much the user has scrolled. However mScrollTier is still 0 when the user has just scrolled by 1, and only increments to 1 after the user has scrolled by 2. It is a better indicator that check that amt is not 0 to indicate that the user is scrolling. As this function is also called when the user has stopped scrolling with amt == 0

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

}

virtual void onCursorChanged(const CursorState& /*state*/) {}
Expand Down