From 7ebf89561303e4f86336e0a572372137b7db6476 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 22 Nov 2021 19:46:05 +0100 Subject: [PATCH] Fixed a ScrollableContainer sizing issue while running in the background when games are launched. --- es-core/src/components/ScrollableContainer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/es-core/src/components/ScrollableContainer.cpp b/es-core/src/components/ScrollableContainer.cpp index 5568d0f63..b0a67eb3d 100644 --- a/es-core/src/components/ScrollableContainer.cpp +++ b/es-core/src/components/ScrollableContainer.cpp @@ -64,6 +64,16 @@ void ScrollableContainer::reset() mAutoScrollResetAccumulator = 0; mAutoScrollAccumulator = -mAutoScrollDelay + mAutoScrollSpeed; mAtEnd = false; + // This is needed to resize to the font height boundary when we keep running in the background + // while launching games. + if (!mChildren.empty()) { + float combinedHeight{ + mChildren.front()->getFont()->getHeight(mChildren.front()->getLineSpacing())}; + if (mChildren.front()->getSize().y > mSize.y) { + float numLines{mSize.y / combinedHeight}; + mSize.y = floorf(numLines) * combinedHeight; + } + } } void ScrollableContainer::update(int deltaTime)