1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

Hearts: Fix animations that get stuck "mid-flight"

When an animation is stopped the cards should be moved to their final
position anyway. Otherwise they might end up getting stuck in the
middle of the animation.
This commit is contained in:
Gunnar Beutner 2021-05-25 08:32:01 +02:00 committed by Andreas Kling
parent 87ace131bc
commit fc99aa92bd

View file

@ -251,7 +251,11 @@ void Game::start_animation(NonnullRefPtrVector<Card> cards, Gfx::IntPoint const&
void Game::stop_animation()
{
m_animation_playing = false;
if (m_animation_playing) {
for (auto& animation : m_animation_cards)
animation.card->set_position(m_animation_end);
m_animation_playing = false;
}
if (m_animation_delay_timer)
m_animation_delay_timer->stop();
stop_timer();