Fixed an issue where text elements that had an opacity set to lower than FF via the color tag were faded in during gamelist scrolling.

This commit is contained in:
Leon Styhre 2022-08-17 17:04:19 +02:00
parent 92d1cf2fd3
commit 93e0bfab5b
4 changed files with 7 additions and 6 deletions

View file

@ -626,10 +626,9 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state)
for (auto it = comps.cbegin(); it != comps.cend(); ++it) {
GuiComponent* comp {*it};
// An animation is playing, then animate if reverse != fadingOut.
// An animation is not playing, then animate if opacity != our target opacity.
if ((comp->isAnimationPlaying(0) && comp->isAnimationReversed(0) != fadingOut) ||
(!comp->isAnimationPlaying(0) && comp->getOpacity() != (fadingOut ? 0.0f : 1.0f))) {
(!comp->isAnimationPlaying(0) &&
comp->getOpacity() != (fadingOut ? 0.0f : comp->getColorOpacity()))) {
auto func = [comp](float t) { comp->setOpacity(glm::mix(0.0f, 1.0f, t)); };
comp->setAnimation(new LambdaAnimation(func, 150), 0, nullptr, fadingOut);
}

View file

@ -781,10 +781,9 @@ void GamelistView::updateInfoPanel(const CursorState& state)
for (auto it = comps.cbegin(); it != comps.cend(); ++it) {
GuiComponent* comp {*it};
// An animation is playing, then animate if reverse != fadingOut.
// An animation is not playing, then animate if opacity != our target opacity.
if ((comp->isAnimationPlaying(0) && comp->isAnimationReversed(0) != fadingOut) ||
(!comp->isAnimationPlaying(0) && comp->getOpacity() != (fadingOut ? 0.0f : 1.0f))) {
(!comp->isAnimationPlaying(0) &&
comp->getOpacity() != (fadingOut ? 0.0f : comp->getColorOpacity()))) {
auto func = [comp](float t) { comp->setOpacity(glm::mix(0.0f, 1.0f, t)); };
comp->setAnimation(new LambdaAnimation(func, 150), 0, nullptr, fadingOut);
}

View file

@ -193,6 +193,7 @@ public:
virtual bool isListScrolling() { return false; }
virtual void stopListScrolling() {}
virtual const float getOpacity() const { return mOpacity; }
virtual const float getColorOpacity() const { return 1.0f; }
virtual void setOpacity(float opacity);
virtual float getSaturation() const { return static_cast<float>(mColor); }
virtual void setSaturation(float saturation) { mSaturation = saturation; }

View file

@ -61,6 +61,8 @@ public:
{
return static_cast<float>((mColor & 0x000000FF) / 255.0f);
}
float const getColorOpacity() const override { return mColorOpacity; }
void setOpacity(float opacity) override;
void setDimming(float dimming) override;