Commit 7875c227 authored by Aloshi's avatar Aloshi

Fixed camera scrolling for ComponentLists to always be by row heights.

parent 2203e9ff
......@@ -111,7 +111,16 @@ void ComponentList::onCursorChanged(const CursorState& state)
const float totalHeight = getTotalRowHeight();
if(totalHeight > mSize.y())
{
mCameraOffset = mSelectorBarOffset - (mSize.y() / 2);
float target = mSelectorBarOffset + getRowHeight(mEntries.at(mCursor).data)/2 - (mSize.y() / 2);
// clamp it
mCameraOffset = 0;
unsigned int i = 0;
while(mCameraOffset < target && i < mEntries.size())
{
mCameraOffset += getRowHeight(mEntries.at(i).data);
i++;
}
if(mCameraOffset < 0)
mCameraOffset = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment