diff --git a/es-core/src/components/primary/CarouselComponent.h b/es-core/src/components/primary/CarouselComponent.h index dcfe8d1bf..baf78aa48 100644 --- a/es-core/src/components/primary/CarouselComponent.h +++ b/es-core/src/components/primary/CarouselComponent.h @@ -1123,30 +1123,28 @@ template void CarouselComponent::onCursorChanged(const CursorSta if (mScrollVelocity != 0) mPreviousScrollVelocity = mScrollVelocity; - // No need to animate transition, we're not going anywhere. - if (endPos == mEntryCamOffset) - return; + if (endPos != mEntryCamOffset) { + // Needed to make sure that overlapping items are renderered correctly. + if (startPos > endPos) + mPositiveDirection = true; + else + mPositiveDirection = false; - // Needed to make sure that overlapping items are renderered correctly. - if (startPos > endPos) - mPositiveDirection = true; - else - mPositiveDirection = false; + Animation* anim {new LambdaAnimation( + [this, startPos, endPos, posMax](float t) { + t -= 1; + float f {glm::mix(startPos, endPos, t * t * t + 1)}; + if (f < 0) + f += posMax; + if (f >= posMax) + f -= posMax; - Animation* anim {new LambdaAnimation( - [this, startPos, endPos, posMax](float t) { - t -= 1; - float f {glm::mix(startPos, endPos, t * t * t + 1)}; - if (f < 0) - f += posMax; - if (f >= posMax) - f -= posMax; + mEntryCamOffset = f; + }, + mTransitionsAnimTime)}; - mEntryCamOffset = f; - }, - mTransitionsAnimTime)}; - - GuiComponent::setAnimation(anim, 0, nullptr, false, 0); + GuiComponent::setAnimation(anim, 0, nullptr, false, 0); + } if (mCursorChangedCallback && !mEntries.empty()) mCursorChangedCallback(state);