From fc20cde0f3ec6ac57754e13edd63a8ee9cd35c7a Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 13 Feb 2023 22:13:09 +0100 Subject: [PATCH] Made the imageSelectedColor carousel property work correctly with reflections. --- .../components/primary/CarouselComponent.h | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/es-core/src/components/primary/CarouselComponent.h b/es-core/src/components/primary/CarouselComponent.h index 50e59bf15..168b2baa7 100644 --- a/es-core/src/components/primary/CarouselComponent.h +++ b/es-core/src/components/primary/CarouselComponent.h @@ -1155,7 +1155,36 @@ template void CarouselComponent::render(const glm::mat4& parentT if (mReflectionsFalloff > 0.0f) comp->setReflectionsFalloff(comp->getSize().y / mReflectionsFalloff); comp->setFlipY(true); - comp->render(reflectionTrans); + if (renderItem.index == mCursor && mHasImageSelectedColor) { + comp->setColorShift(mImageSelectedColorGradientHorizontal ? mImageSelectedColor : + mImageSelectedColorEnd); + if (mImageSelectedColorEnd != mImageSelectedColor) + comp->setColorShiftEnd(mImageSelectedColorGradientHorizontal ? + mImageSelectedColorEnd : + mImageSelectedColor); + if (mImageSelectedColorGradientHorizontal != mImageColorGradientHorizontal) + comp->setColorGradientHorizontal(mImageSelectedColorGradientHorizontal); + comp->render(reflectionTrans); + if (mImageSelectedColorGradientHorizontal != mImageColorGradientHorizontal) + comp->setColorGradientHorizontal(mImageColorGradientHorizontal); + comp->setColorShift(mImageColorShift); + if (mImageColorShiftEnd != mImageColorShift) + comp->setColorShiftEnd(mImageColorShiftEnd); + } + else { + if ((mImageColorShift != 0xFFFFFFFF || mImageColorShiftEnd != 0xFFFFFFFF) && + !mImageColorGradientHorizontal) { + // We need to reverse the color shift if a vertical gradient is applied. + comp->setColorShift(mImageColorShiftEnd); + comp->setColorShiftEnd(mImageColorShift); + comp->render(reflectionTrans); + comp->setColorShift(mImageColorShift); + comp->setColorShiftEnd(mImageColorShiftEnd); + } + else { + comp->render(reflectionTrans); + } + } comp->setFlipY(false); comp->setReflectionsFalloff(0.0f); }