mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Approximate size for MenuComponents that exceed max height so that scrolling still fits within row height multiples.
This commit is contained in:
parent
5d0df7acf8
commit
7e5f161271
|
@ -46,9 +46,21 @@ float MenuComponent::getButtonGridHeight() const
|
||||||
|
|
||||||
void MenuComponent::updateSize()
|
void MenuComponent::updateSize()
|
||||||
{
|
{
|
||||||
|
const float maxHeight = Renderer::getScreenHeight() * 0.7f;
|
||||||
float height = TITLE_HEIGHT + mList->getTotalRowHeight() + getButtonGridHeight() + 2;
|
float height = TITLE_HEIGHT + mList->getTotalRowHeight() + getButtonGridHeight() + 2;
|
||||||
if(height > Renderer::getScreenHeight() * 0.7f)
|
if(height > maxHeight)
|
||||||
height = Renderer::getScreenHeight() * 0.7f;
|
{
|
||||||
|
height = TITLE_HEIGHT + getButtonGridHeight() + 2;
|
||||||
|
int i = 0;
|
||||||
|
while(height < maxHeight && i < mList->size())
|
||||||
|
{
|
||||||
|
float rowHeight = mList->getRowHeight(i);
|
||||||
|
if(height + rowHeight < maxHeight)
|
||||||
|
height += rowHeight;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
height += 2;
|
||||||
|
}
|
||||||
|
|
||||||
setSize(Renderer::getScreenWidth() * 0.5f, height);
|
setSize(Renderer::getScreenWidth() * 0.5f, height);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue