From 5f864d0b96d1e8cff793dc90d6ce8d71f4c36a5b Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 21 Sep 2022 21:09:10 +0200 Subject: [PATCH] Fixed an issue where the itemAxisHorizontal carousel property did not work correctly. --- es-core/src/components/primary/CarouselComponent.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/es-core/src/components/primary/CarouselComponent.h b/es-core/src/components/primary/CarouselComponent.h index a21b292f4..30337734a 100644 --- a/es-core/src/components/primary/CarouselComponent.h +++ b/es-core/src/components/primary/CarouselComponent.h @@ -748,16 +748,13 @@ template void CarouselComponent::render(const glm::mat4& parentT if (mType == CarouselType::VERTICAL_WHEEL || mType == CarouselType::HORIZONTAL_WHEEL) { if (mItemAxisHorizontal) { glm::mat4 positionCalc {renderItem.trans}; - const glm::vec2 rotationSize {comp->getSize()}; - const float xOff {(GuiComponent::mOrigin.x - mItemRotationOrigin.x) * - rotationSize.x}; - const float yOff {(GuiComponent::mOrigin.y - mItemRotationOrigin.y) * - rotationSize.y}; + const float xOff {(GuiComponent::mOrigin.x - mItemRotationOrigin.x) * mItemSize.x}; + const float yOff {(GuiComponent::mOrigin.y - mItemRotationOrigin.y) * mItemSize.y}; // Transform to offset point. if (xOff != 0.0f || yOff != 0.0f) positionCalc = - glm::translate(positionCalc, glm::vec3 {xOff * -1.0f, yOff * -1.0f, 0.0f}); + glm::translate(positionCalc, glm::vec3 {xOff * -1.0f, 0.0f * -1.0f, 0.0f}); // Apply rotation transform. positionCalc = @@ -766,8 +763,7 @@ template void CarouselComponent::render(const glm::mat4& parentT // Transform back to original point. if (xOff != 0.0f || yOff != 0.0f) - positionCalc = glm::translate(positionCalc, glm::vec3 {xOff, yOff, 0.0f}); - + positionCalc = glm::translate(positionCalc, glm::vec3 {xOff, 0.0f, 0.0f}); // Only keep position and discard the rotation data. renderItem.trans[3].x = positionCalc[3].x; renderItem.trans[3].y = positionCalc[3].y;