script GUIs: fix auto-height window size with pure text windows

Otherwise, if a window was GUI_FitChildren and the text would NOT trigger a scrollbar, the window height was set to 0 (because the text height was only taken into account when rawTextHeight - 1 > rcBounds.Hgt).
objectmenu
David Dormagen 2016-01-20 10:33:11 +01:00
parent b698557163
commit 9292718ca5
1 changed files with 6 additions and 0 deletions

View File

@ -1710,6 +1710,12 @@ bool C4ScriptGuiWindow::UpdateLayout(C4TargetFacet &cgo, float parentWidth, floa
const int32_t actualTextHeight = ::GraphicsResource.FontRegular.BreakMessage(strBuf->getData(), rcBounds.Wdt - pScrollBar->rcBounds.Wdt, &sText, true);
minRequiredTextHeight = actualTextHeight;
}
else
{
// Otherwise, still set the minimum size to the text height (without scrollbar).
// This is necessary so that e.g. Style::FitChildren works properly with pure text windows.
minRequiredTextHeight = rawTextHeight;
}
}
UpdateChildLayout(cgo, width, height);