1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-11 00:39:59 +00:00

Use space in ItemView more efficiently

This commit is contained in:
scrawl 2014-12-15 19:04:53 +01:00
parent 84b0dcf2e3
commit e4127aa491

View File

@ -53,9 +53,14 @@ void ItemView::layoutWidgets()
int x = 0;
int y = 0;
int maxHeight = mScrollView->getSize().height - 58;
MyGUI::Widget* dragArea = mScrollView->getChildAt(0);
int maxHeight = dragArea->getHeight();
int rows = maxHeight/42;
rows = std::max(rows, 1);
bool showScrollbar = std::ceil(dragArea->getChildCount()/float(rows)) > mScrollView->getWidth()/42;
if (showScrollbar)
maxHeight -= 18;
for (unsigned int i=0; i<dragArea->getChildCount(); ++i)
{
@ -64,7 +69,8 @@ void ItemView::layoutWidgets()
w->setPosition(x, y);
y += 42;
if (y > maxHeight)
if (y > maxHeight-42 && i < dragArea->getChildCount()-1)
{
x += 42;
y = 0;