From 5ddad6d55ef4057ac12159d3a62ab1404c1e1c0d Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 21 Aug 2023 17:00:15 +0200 Subject: [PATCH] Fixed an issue where the rows in TextListComponent were not always sized correctly vertically --- es-core/src/components/primary/TextListComponent.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/es-core/src/components/primary/TextListComponent.h b/es-core/src/components/primary/TextListComponent.h index b0f167137..e5b6b82ea 100644 --- a/es-core/src/components/primary/TextListComponent.h +++ b/es-core/src/components/primary/TextListComponent.h @@ -198,7 +198,8 @@ void TextListComponent::addEntry(Entry& entry, const std::shared_ptr( mHorizontalScrolling ? entry.name : mFont->wrapText(entry.name, mSize.x - mHorizontalMargin * 2.0f), - mFont, 0x000000FF); + mFont, 0x000000FF, ALIGN_LEFT, ALIGN_CENTER, glm::vec3 {0.0f, 0.0f, 0.0f}, + glm::vec2 {mFont->sizeText(entry.name).x, mFont->getSize() * 1.5f}); if (mHorizontalScrolling) { glm::vec2 textSize {entry.data.entryName->getSize()}; @@ -504,9 +505,6 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, mFont = Font::getFromTheme(elem, properties, mFont, 0.0f, false); - const float selectorHeight {mFont->getHeight(mLineSpacing)}; - mSelectorHeight = selectorHeight; - if (properties & ALIGNMENT) { if (elem->has("horizontalAlignment")) { const std::string& horizontalAlignment {elem->get("horizontalAlignment")}; @@ -602,6 +600,8 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, if (elem->has("selectorHeight")) mSelectorHeight = glm::clamp(elem->get("selectorHeight"), 0.0f, 1.0f) * Renderer::getScreenHeight(); + else + mSelectorHeight = mFont->getSize() * 1.5f; if (elem->has("selectorHorizontalOffset")) { const float scale {this->mParent ? this->mParent->getSize().x : Renderer::getScreenWidth()};