From fc99aa92bdcf9d0709a50a010828b922a860eed6 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 25 May 2021 08:32:01 +0200 Subject: [PATCH] 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. --- Userland/Games/Hearts/Game.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index 328361679b..b9c05bbc31 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -251,7 +251,11 @@ void Game::start_animation(NonnullRefPtrVector 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();