1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

better approach for scrollbar

This commit is contained in:
Laserlicht
2024-11-02 15:16:38 +01:00
parent 9009dffebd
commit 0ab4b66026
5 changed files with 8 additions and 11 deletions

View File

@ -116,12 +116,12 @@ void CListBox::updatePositions()
(elem)->moveTo(itemPos);
itemPos += itemOffset;
}
if (isActive())
if(slider)
{
redraw();
if (slider)
slider->scrollTo((int)first);
slider->scrollTo((int)first);
moveChildForeground(slider.get());
}
redraw();
}
void CListBox::reset()
@ -185,9 +185,6 @@ void CListBox::scrollTo(size_t which)
//scroll down
else if (first + items.size() <= which && which < totalSize)
moveToPos(which - items.size() + 1);
if(slider)
slider->scrollTo(which);
}
void CListBox::moveToPos(size_t which)