diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-08-06 01:09:59 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-08-18 17:06:28 +0300 |
commit | b9d212427c51e2e0c36829eb79edeee32b5ca985 (patch) | |
tree | 6da1ea96acefb569f993dba46e2c71ee34256239 /drape_frontend | |
parent | ae0185f13e1d558bf12f27d5171a626421cc9ee2 (diff) |
Fixed follow-and-rotate animation jittering
Diffstat (limited to 'drape_frontend')
-rw-r--r-- | drape_frontend/animation/animation.hpp | 6 | ||||
-rw-r--r-- | drape_frontend/animation/follow_animation.cpp | 4 | ||||
-rw-r--r-- | drape_frontend/animation_system.cpp | 8 | ||||
-rw-r--r-- | drape_frontend/user_event_stream.cpp | 2 |
4 files changed, 17 insertions, 3 deletions
diff --git a/drape_frontend/animation/animation.hpp b/drape_frontend/animation/animation.hpp index 3153dcf37b..8d788e55f6 100644 --- a/drape_frontend/animation/animation.hpp +++ b/drape_frontend/animation/animation.hpp @@ -76,6 +76,7 @@ public: : m_couldBeInterrupted(couldBeInterrupted) , m_couldBeBlended(couldBeBlended) , m_interruptedOnCombine(false) + , m_couldBeRewinded(true) {} virtual void OnStart() { if (m_onStartAction != nullptr) m_onStartAction(this); } @@ -114,6 +115,9 @@ public: void SetCouldBeInterrupted(bool enable) { m_couldBeInterrupted = enable; } void SetCouldBeBlended(bool enable) { m_couldBeBlended = enable; } + + void SetCouldBeRewinded(bool enable) { m_couldBeRewinded = enable; } + bool CouldBeRewinded() const { return m_couldBeRewinded; } protected: TAction m_onStartAction; @@ -126,6 +130,8 @@ protected: bool m_couldBeBlended; // Animation must be interrupted in case of combining another animation. bool m_interruptedOnCombine; + // Animation could be rewinded in case of finishing. + bool m_couldBeRewinded; }; } // namespace df diff --git a/drape_frontend/animation/follow_animation.cpp b/drape_frontend/animation/follow_animation.cpp index 9054257fd0..d8da05fe65 100644 --- a/drape_frontend/animation/follow_animation.cpp +++ b/drape_frontend/animation/follow_animation.cpp @@ -41,6 +41,10 @@ MapFollowAnimation::MapFollowAnimation(ScreenBase const & screen, m_properties.insert(Animation::Angle); if (m_offsetInterpolator.IsActive() || m_scaleInterpolator.IsActive() || m_angleInterpolator.IsActive()) m_properties.insert(Animation::Position); + + // If MapFollowAnimation affects only angles, disable rewinding. + SetCouldBeRewinded(!m_angleInterpolator.IsActive() || m_scaleInterpolator.IsActive() || + m_offsetInterpolator.IsActive()); } Animation::TObjectProperties const & MapFollowAnimation::GetProperties(TObject object) const diff --git a/drape_frontend/animation_system.cpp b/drape_frontend/animation_system.cpp index fd8e6b039b..b1acd5c1ff 100644 --- a/drape_frontend/animation_system.cpp +++ b/drape_frontend/animation_system.cpp @@ -270,7 +270,8 @@ void AnimationSystem::FinishAnimations(function<bool(shared_ptr<Animation> const if (predicate(anim)) { #ifdef DEBUG_ANIMATIONS - LOG(LINFO, ("Finish animation", anim->GetType(), ", rewind:", rewind)); + LOG(LINFO, ("Finish animation", anim->GetType(), ", rewind:", rewind, + ", couldBeRewinded:", anim->CouldBeRewinded())); changed = true; #endif finishAnimations.splice(finishAnimations.end(), frontList, it++); @@ -291,7 +292,8 @@ void AnimationSystem::FinishAnimations(function<bool(shared_ptr<Animation> const if (predicate(*it)) { #ifdef DEBUG_ANIMATIONS - LOG(LINFO, ("Finish animation", (*it)->GetType(), ", rewind:", rewind)); + LOG(LINFO, ("Finish animation", (*it)->GetType(), ", rewind:", rewind, + ", couldBeRewinded:", anim->CouldBeRewinded())); changed = true; #endif it = lst.erase(it); @@ -306,7 +308,7 @@ void AnimationSystem::FinishAnimations(function<bool(shared_ptr<Animation> const for (auto & anim : finishAnimations) { - if (rewind) + if (rewind && anim->CouldBeRewinded()) anim->Finish(); SaveAnimationResult(*anim); } diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp index 63572d3a52..cd13b1ba52 100644 --- a/drape_frontend/user_event_stream.cpp +++ b/drape_frontend/user_event_stream.cpp @@ -390,7 +390,9 @@ bool UserEventStream::InterruptFollowAnimations(bool force) ResetAnimations(Animation::Arrow); } else + { return false; + } } return true; } |