Commit 0f8a4a75 authored by cutealien's avatar cutealien

Give ListBox better defaults for the ScrollBar stepsizes.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2869 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f1d7323d
...@@ -163,8 +163,9 @@ void CGUIListBox::recalculateItemHeight() ...@@ -163,8 +163,9 @@ void CGUIListBox::recalculateItemHeight()
TotalItemHeight = ItemHeight * Items.size(); TotalItemHeight = ItemHeight * Items.size();
ScrollBar->setMax(TotalItemHeight - AbsoluteRect.getHeight()); ScrollBar->setMax(TotalItemHeight - AbsoluteRect.getHeight());
ScrollBar->setSmallStep ( 1 ); s32 minItemHeight = ItemHeight > 0 ? ItemHeight : 1;
ScrollBar->setLargeStep ( ItemHeight ); ScrollBar->setSmallStep ( minItemHeight );
ScrollBar->setLargeStep ( 2*minItemHeight );
if ( TotalItemHeight <= AbsoluteRect.getHeight() ) if ( TotalItemHeight <= AbsoluteRect.getHeight() )
ScrollBar->setVisible(false); ScrollBar->setVisible(false);
...@@ -387,7 +388,7 @@ bool CGUIListBox::OnEvent(const SEvent& event) ...@@ -387,7 +388,7 @@ bool CGUIListBox::OnEvent(const SEvent& event)
switch(event.MouseInput.Event) switch(event.MouseInput.Event)
{ {
case EMIE_MOUSE_WHEEL: case EMIE_MOUSE_WHEEL:
ScrollBar->setPos(ScrollBar->getPos() + (s32)event.MouseInput.Wheel*-10); ScrollBar->setPos(ScrollBar->getPos() + (s32)event.MouseInput.Wheel*-ItemHeight/2);
return true; return true;
case EMIE_LMOUSE_PRESSED_DOWN: case EMIE_LMOUSE_PRESSED_DOWN:
......
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