Skip to content

Commit

Permalink
fixed:xbmc#11128 - using mouse wheel to scroll in fixed lists wasn't …
Browse files Browse the repository at this point in the history
…functioning correctly

(cherry picked from commit 42df464)
  • Loading branch information
Jonathan Marshall authored and theuni committed Jan 31, 2011
1 parent 3790680 commit 376dab4
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions guilib/GUIFixedListContainer.cpp
Expand Up @@ -128,17 +128,23 @@ bool CGUIFixedListContainer::MoveDown(bool wrapAround)
return true;
}

// scrolls the said amount
void CGUIFixedListContainer::Scroll(int amount)
{
// increase or decrease the offset
int item = m_offset + m_cursor + amount;
// check for our end points
if (item >= (int)m_items.size() - 1)
item = (int)m_items.size() - 1;
if (item < 0)
item = 0;
SelectItem(item);
// increase or decrease the offset within [-minCursor, m_items.size() - maxCursor]
int minCursor, maxCursor;
GetCursorRange(minCursor, maxCursor);
int offset = m_offset + amount;
if (offset < -minCursor)
{
offset = -minCursor;
m_cursor = minCursor;
}
if (offset > (int)m_items.size() - maxCursor)
{
offset = m_items.size() - maxCursor;
m_cursor = maxCursor;
}
ScrollToOffset(offset);
}

void CGUIFixedListContainer::ValidateOffset()
Expand Down

0 comments on commit 376dab4

Please sign in to comment.