Fix FListBox prevListItem() + nextListItem()
This commit is contained in:
parent
7a2abc9421
commit
ce9d05ec7b
|
@ -1532,17 +1532,17 @@ void FListBox::prevListItem (int distance)
|
||||||
if ( current == 1 )
|
if ( current == 1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( current < std::size_t(distance) )
|
if ( current <= std::size_t(distance) )
|
||||||
current = 1;
|
current = 1;
|
||||||
else
|
else
|
||||||
current -= std::size_t(distance);
|
current -= std::size_t(distance);
|
||||||
|
|
||||||
if ( current <= std::size_t(yoffset) )
|
if ( current <= std::size_t(yoffset) )
|
||||||
{
|
{
|
||||||
yoffset -= distance;
|
if ( yoffset < distance )
|
||||||
|
|
||||||
if ( yoffset < 0 )
|
|
||||||
yoffset = 0;
|
yoffset = 0;
|
||||||
|
else
|
||||||
|
yoffset -= distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1555,17 +1555,17 @@ void FListBox::nextListItem (int distance)
|
||||||
if ( current == element_count )
|
if ( current == element_count )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current += std::size_t(distance);
|
if ( current + std::size_t(distance) > element_count )
|
||||||
|
|
||||||
if ( current > element_count )
|
|
||||||
current = element_count;
|
current = element_count;
|
||||||
|
else
|
||||||
|
current += std::size_t(distance);
|
||||||
|
|
||||||
if ( current - std::size_t(yoffset) > getClientHeight() )
|
if ( current - std::size_t(yoffset) > getClientHeight() )
|
||||||
{
|
{
|
||||||
yoffset += distance;
|
if ( yoffset > yoffset_end - distance )
|
||||||
|
|
||||||
if ( yoffset > yoffset_end )
|
|
||||||
yoffset = yoffset_end;
|
yoffset = yoffset_end;
|
||||||
|
else
|
||||||
|
yoffset += distance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue