From 9917832e07bd784acc9924b83c8214d9a787e753 Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Thu, 28 Apr 2016 13:40:08 +0300 Subject: [PATCH] Fixed recovering of follow-and-rotate mode in routing --- drape_frontend/animation_system.cpp | 9 ++++++++- drape_frontend/animation_system.hpp | 9 +++++++++ drape_frontend/kinetic_scroller.cpp | 2 ++ drape_frontend/my_position_controller.cpp | 5 +---- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/drape_frontend/animation_system.cpp b/drape_frontend/animation_system.cpp index 3039d5314c..46d3b00dd6 100644 --- a/drape_frontend/animation_system.cpp +++ b/drape_frontend/animation_system.cpp @@ -991,7 +991,13 @@ void AnimationSystem::CombineAnimation(drape_ptr animation) for (auto it = lst.begin(); it != lst.end();) { auto & anim = *it; - if (!anim->CouldBeBlendedWith(*animation)) + if (anim->GetInterruptedOnCombine()) + { + anim->Interrupt(); + SaveAnimationResult(*anim); + it = lst.erase(it); + } + else if (!anim->CouldBeBlendedWith(*animation)) { if (!anim->CouldBeInterrupted()) { @@ -1014,6 +1020,7 @@ void AnimationSystem::CombineAnimation(drape_ptr animation) return; } } + PushAnimation(move(animation)); } diff --git a/drape_frontend/animation_system.hpp b/drape_frontend/animation_system.hpp index 8762c4cb94..32c9306258 100644 --- a/drape_frontend/animation_system.hpp +++ b/drape_frontend/animation_system.hpp @@ -107,6 +107,7 @@ public: Animation(bool couldBeInterrupted, bool couldBeBlended) : m_couldBeInterrupted(couldBeInterrupted) , m_couldBeBlended(couldBeBlended) + , m_interruptedOnCombine(false) {} virtual void OnStart() { if (m_onStartAction != nullptr) m_onStartAction(this); } @@ -136,12 +137,20 @@ public: bool CouldBeInterrupted() const { return m_couldBeInterrupted; } bool CouldBeBlendedWith(Animation const & animation) const; + void SetInterruptedOnCombine(bool enable) { m_interruptedOnCombine = enable; } + bool GetInterruptedOnCombine() const { return m_interruptedOnCombine; } + protected: TAction m_onStartAction; TAction m_onFinishAction; TAction m_onInterruptAction; + + // Animation could be interrupted in case of blending impossibility. bool m_couldBeInterrupted; + // Animation could be blended with other animations. bool m_couldBeBlended; + // Animation must be interrupted in case of combining another animation. + bool m_interruptedOnCombine; }; class Interpolator diff --git a/drape_frontend/kinetic_scroller.cpp b/drape_frontend/kinetic_scroller.cpp index a636166e26..f54f82510d 100644 --- a/drape_frontend/kinetic_scroller.cpp +++ b/drape_frontend/kinetic_scroller.cpp @@ -37,6 +37,8 @@ public: , m_duration(duration) , m_elapsedTime(0.0) { + SetInterruptedOnCombine(true); + m_objects.insert(Animation::MapPlane); m_properties.insert(Animation::Position); } diff --git a/drape_frontend/my_position_controller.cpp b/drape_frontend/my_position_controller.cpp index ab55c6e565..2db3232b71 100644 --- a/drape_frontend/my_position_controller.cpp +++ b/drape_frontend/my_position_controller.cpp @@ -644,10 +644,7 @@ void MyPositionController::DeactivateRouting() m_isInRouting = false; ChangeMode(location::Follow); - if (m_mode == location::FollowAndRotate) - ChangeModelView(m_position, 0.0, m_centerPixelPosition, kDoNotChangeZoom); - else - ChangeModelView(0.0); + ChangeModelView(m_position, 0.0, m_centerPixelPosition, kDoNotChangeZoom); } }