diff --git a/es-core/src/components/TextComponent.cpp b/es-core/src/components/TextComponent.cpp index 3d7f13b41..6225bd520 100644 --- a/es-core/src/components/TextComponent.cpp +++ b/es-core/src/components/TextComponent.cpp @@ -36,10 +36,11 @@ TextComponent::TextComponent() TextComponent::TextComponent(const std::string& text, const std::shared_ptr& font, unsigned int color, - Alignment align, + Alignment horizontalAlignment, glm::vec3 pos, glm::vec2 size, - unsigned int bgcolor) + unsigned int bgcolor, + Alignment verticalAlignment) : mFont {nullptr} , mRenderer {Renderer::getInstance()} , mColor {0x000000FF} @@ -51,8 +52,8 @@ TextComponent::TextComponent(const std::string& text, , mLowercase {false} , mCapitalize {false} , mAutoCalcExtent {1, 1} - , mHorizontalAlignment {align} - , mVerticalAlignment {ALIGN_CENTER} + , mHorizontalAlignment {horizontalAlignment} + , mVerticalAlignment {verticalAlignment} , mLineSpacing {1.5f} , mNoTopMargin {false} , mSelectable {false} diff --git a/es-core/src/components/TextComponent.h b/es-core/src/components/TextComponent.h index 3aef17af1..3db57216e 100644 --- a/es-core/src/components/TextComponent.h +++ b/es-core/src/components/TextComponent.h @@ -28,10 +28,11 @@ public: TextComponent(const std::string& text, const std::shared_ptr& font, unsigned int color = 0x000000FF, - Alignment align = ALIGN_LEFT, + Alignment horizontalAlignment = ALIGN_LEFT, glm::vec3 pos = {0.0f, 0.0f, 0.0f}, glm::vec2 size = {0.0f, 0.0f}, - unsigned int bgcolor = 0x00000000); + unsigned int bgcolor = 0x00000000, + Alignment verticalAlignment = ALIGN_CENTER); void setFont(const std::shared_ptr& font); void setUppercase(bool uppercase); diff --git a/es-core/src/components/primary/CarouselComponent.h b/es-core/src/components/primary/CarouselComponent.h index 916ea6a25..f3866b064 100644 --- a/es-core/src/components/primary/CarouselComponent.h +++ b/es-core/src/components/primary/CarouselComponent.h @@ -270,8 +270,9 @@ void CarouselComponent::addEntry(Entry& entry, const std::shared_ptr(nameEntry, mFont, 0x000000FF, ALIGN_CENTER); - text->setSize(mItemSize * mItemScale); + auto text = std::make_shared( + nameEntry, mFont, 0x000000FF, mItemHorizontalAlignment, glm::vec3 {0.0f, 0.0f, 0.0f}, + mItemSize * mItemScale, 0x00000000, mItemVerticalAlignment); if (legacyMode) { text->applyTheme(theme, "system", "text_logoText", ThemeFlags::FONT_PATH | ThemeFlags::FONT_SIZE | ThemeFlags::COLOR | @@ -289,9 +290,6 @@ void CarouselComponent::addEntry(Entry& entry, const std::shared_ptrsetRenderBackground(true); } entry.data.item = text; - - text->setHorizontalAlignment(mItemHorizontalAlignment); - text->setVerticalAlignment(mItemVerticalAlignment); } // Set origin for the items based on their alignment so they line up properly.