Skip to content
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
23 changes: 11 additions & 12 deletions es-app/src/views/SystemView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,21 @@ void SystemView::onCursorChanged(const CursorState& state)
updateHelpPrompts();

float startPos = mCamOffset;
float endPos = (float)mCursor;

float posMax = (float)mEntries.size();
float target = (float)mCursor;

// what's the shortest way to get to our target?
// it's one of these...

float endPos = target; // directly
float dist = abs(endPos - startPos);

if(abs(target + posMax - startPos) < dist)
endPos = target + posMax; // loop around the end (0 -> max)
if(abs(target - posMax - startPos) < dist)
endPos = target - posMax; // loop around the start (max - 1 -> -1)
if ((mScrollVelocity < 0) && (endPos > startPos)) {
// We are scrolling left, but the destination is to our right.
// => Loop around the start.
endPos -= posMax;
}
else if ((mScrollVelocity > 0) && (endPos < startPos)) {
// We are scrolling right, but the destination is to our left.
// => Loop around the end.
endPos += posMax;
}


// animate mSystemInfo's opacity (fade out, wait, fade back in)

cancelAnimation(1);
Expand Down