mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 16:15:31 +00:00
Use space in ItemView more efficiently
This commit is contained in:
parent
84b0dcf2e3
commit
e4127aa491
1 changed files with 9 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue