From 824089d703e126f65a4b4b749b08dd8342f9bfe7 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 3 Jun 2022 18:27:46 +0200 Subject: [PATCH] Fixed an issue where the scroll indicators sometimes overlapped the menu titles. --- es-core/src/components/MenuComponent.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/es-core/src/components/MenuComponent.cpp b/es-core/src/components/MenuComponent.cpp index d720ce961..62884ba43 100644 --- a/es-core/src/components/MenuComponent.cpp +++ b/es-core/src/components/MenuComponent.cpp @@ -124,6 +124,15 @@ void MenuComponent::onSizeChanged() mGrid.setColWidthPerc(1, 0.055f); mGrid.setSize(mSize); + + // Limit the title size to reserve space for the scroll indicators. + float indicatorsSize {mSize.x * 0.09f}; + + glm::vec2 titleSize {mTitle->getSize()}; + mTitle->setSize(titleSize.x - indicatorsSize, titleSize.y); + + glm::vec3 titlePos {mTitle->getPosition()}; + mTitle->setPosition(titlePos.x + std::round(indicatorsSize / 2.0f), titlePos.y, titlePos.z); } void MenuComponent::addButton(const std::string& name,