mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Fixed an issue where the scrollable container would not get properly sized after using the single-game scraper.
This commit is contained in:
parent
7d3a3e6b30
commit
87d1c19e68
|
@ -62,10 +62,24 @@ void ScrollableContainer::setScrollParameters(float autoScrollDelayConstant,
|
||||||
|
|
||||||
void ScrollableContainer::reset()
|
void ScrollableContainer::reset()
|
||||||
{
|
{
|
||||||
mScrollPos = glm::vec2 {};
|
mScrollPos = glm::vec2 {0.0f, 0.0f};
|
||||||
mAutoScrollResetAccumulator = 0;
|
mAutoScrollResetAccumulator = 0;
|
||||||
mAutoScrollAccumulator = -mAutoScrollDelay + mAutoScrollSpeed;
|
mAutoScrollAccumulator = -mAutoScrollDelay + mAutoScrollSpeed;
|
||||||
mAtEnd = false;
|
mAtEnd = false;
|
||||||
|
// This is needed to resize to the designated area when the backgrund image gets invalidated.
|
||||||
|
if (!mChildren.empty()) {
|
||||||
|
float combinedHeight {
|
||||||
|
mChildren.front()->getFont()->getHeight(mChildren.front()->getLineSpacing())};
|
||||||
|
if (mChildren.front()->getSize().y > mSize.y) {
|
||||||
|
if (mVerticalSnap) {
|
||||||
|
float numLines {std::floor(mSize.y / combinedHeight)};
|
||||||
|
mAdjustedHeight = std::round(numLines * combinedHeight);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mAdjustedHeight = mSize.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollableContainer::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
void ScrollableContainer::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
|
@ -112,8 +126,8 @@ void ScrollableContainer::update(int deltaTime)
|
||||||
|
|
||||||
// Calculate the spacing which will be used to clip the container.
|
// Calculate the spacing which will be used to clip the container.
|
||||||
if (lineSpacing > 1.2f && mClipSpacing == 0.0f) {
|
if (lineSpacing > 1.2f && mClipSpacing == 0.0f) {
|
||||||
const float minimumSpacing = mChildren.front()->getFont()->getHeight(1.2f);
|
const float minimumSpacing {mChildren.front()->getFont()->getHeight(1.2f)};
|
||||||
const float currentSpacing = mChildren.front()->getFont()->getHeight(lineSpacing);
|
const float currentSpacing {mChildren.front()->getFont()->getHeight(lineSpacing)};
|
||||||
mClipSpacing = std::round((currentSpacing - minimumSpacing) / 2.0f);
|
mClipSpacing = std::round((currentSpacing - minimumSpacing) / 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +233,7 @@ void ScrollableContainer::render(const glm::mat4& parentTrans)
|
||||||
|
|
||||||
glm::ivec2 clipPos {static_cast<int>(trans[3].x), static_cast<int>(trans[3].y)};
|
glm::ivec2 clipPos {static_cast<int>(trans[3].x), static_cast<int>(trans[3].y)};
|
||||||
|
|
||||||
glm::vec3 dimScaled {};
|
glm::vec3 dimScaled {0.0f, 0.0f, 0.0f};
|
||||||
dimScaled.x = std::fabs(trans[3].x + mSize.x);
|
dimScaled.x = std::fabs(trans[3].x + mSize.x);
|
||||||
dimScaled.y = std::fabs(trans[3].y + mAdjustedHeight);
|
dimScaled.y = std::fabs(trans[3].y + mAdjustedHeight);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue