From 56d1b8f83db0e06be623f059e6bc3f6c7f69f956 Mon Sep 17 00:00:00 2001 From: Leon Styhre <leon@leonstyhre.com> Date: Thu, 17 Mar 2022 21:52:55 +0100 Subject: [PATCH] Fixed an issue where multiple carousel logos were rendered when there was only a single system. --- es-core/src/components/CarouselComponent.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/es-core/src/components/CarouselComponent.cpp b/es-core/src/components/CarouselComponent.cpp index 0fa932d44..7bdc1a659 100644 --- a/es-core/src/components/CarouselComponent.cpp +++ b/es-core/src/components/CarouselComponent.cpp @@ -242,10 +242,18 @@ void CarouselComponent::render(const glm::mat4& parentTrans) int center {static_cast<int>(mCamOffset)}; int logoInclusion {static_cast<int>(std::ceil(mMaxLogoCount / 2.0f))}; + bool singleEntry {mEntries.size() == 1}; for (int i = center - logoInclusion; i < center + logoInclusion + 2; ++i) { int index {i}; + // If there is only a single system, then only render the logo once (in the center). + if (singleEntry) { + mEntries.at(0).data.logo->render( + glm::translate(carouselTrans, glm::vec3 {0 + xOff, 0 + yOff, 0.0f})); + break; + } + while (index < 0) index += static_cast<int>(mEntries.size()); while (index >= static_cast<int>(mEntries.size()))