diff options
author | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2017-05-15 11:32:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-15 11:32:42 +0300 |
commit | cd8e9376cbdd5b6f31b5b104411998eed4515c1e (patch) | |
tree | 5c85fca8a2fd176c51db1e7e01b03efb1a217319 | |
parent | 10cbf337d86512080dac5390da8651a9bb8a0753 (diff) | |
parent | 30a4109c168a5bdeaa76485f108106be6449ff20 (diff) |
Merge pull request #6045 from darina/kinetic-scroll-interruptionbeta-806
Do not interrupt kinetic scroll by single arrow animation.
-rw-r--r-- | drape_frontend/animation/animation.cpp | 53 | ||||
-rw-r--r-- | drape_frontend/animation/animation.hpp | 5 | ||||
-rw-r--r-- | drape_frontend/animation_system.cpp | 2 |
3 files changed, 51 insertions, 9 deletions
diff --git a/drape_frontend/animation/animation.cpp b/drape_frontend/animation/animation.cpp index a750cc2645..4f6efb29f5 100644 --- a/drape_frontend/animation/animation.cpp +++ b/drape_frontend/animation/animation.cpp @@ -40,21 +40,21 @@ void Animation::GetCurrentScreen(TPropertyCache const & properties, ScreenBase c } } -bool Animation::CouldBeBlendedWith(Animation const & animation) const +bool Animation::HasSameObjects(Animation const & animation) const { - bool hasSameObject = false; TAnimObjects const & objects = animation.GetObjects(); for (auto const & object : objects) { if (HasObject(object)) - { - hasSameObject = true; - break; - } + return true; } + return false; +} - return !hasSameObject || ((GetType() != animation.GetType()) && - m_couldBeBlended && animation.m_couldBeBlended); +bool Animation::CouldBeBlendedWith(Animation const & animation) const +{ + return !HasSameObjects(animation) || + ((GetType() != animation.GetType()) && m_couldBeBlended && animation.m_couldBeBlended); } bool Animation::HasTargetProperty(Object object, ObjectProperty property) const @@ -90,4 +90,41 @@ bool Animation::GetMaxDuration(Interpolator const & interpolator, double & maxDu return true; } +std::string DebugPrint(Animation::Type const & type) +{ + switch (type) + { + case Animation::Type::Sequence: return "Sequence"; + case Animation::Type::Parallel: return "Parallel"; + case Animation::Type::MapLinear: return "MapLinear"; + case Animation::Type::MapScale: return "MapScale"; + case Animation::Type::MapFollow: return "MapFollow"; + case Animation::Type::Arrow: return "Arrow"; + case Animation::Type::KineticScroll: return "KineticScroll"; + } + return "Unknown type"; +} + +std::string DebugPrint(Animation::Object const & object) +{ + switch (object) + { + case Animation::Object::MyPositionArrow: return "MyPositionArrow"; + case Animation::Object::MapPlane: return "MapPlane"; + case Animation::Object::Selection: return "Selection"; + } + return "Unknown object"; +} + +std::string DebugPrint(Animation::ObjectProperty const & property) +{ + switch (property) + { + case Animation::ObjectProperty::Position: return "Position"; + case Animation::ObjectProperty::Scale: return "Scale"; + case Animation::ObjectProperty::Angle: return "Angle"; + } + return "Unknown property"; +} + } // namespace df diff --git a/drape_frontend/animation/animation.hpp b/drape_frontend/animation/animation.hpp index 24abec543a..209e746568 100644 --- a/drape_frontend/animation/animation.hpp +++ b/drape_frontend/animation/animation.hpp @@ -119,6 +119,7 @@ public: bool CouldBeBlended() const { return m_couldBeBlended; } bool CouldBeInterrupted() const { return m_couldBeInterrupted; } bool CouldBeBlendedWith(Animation const & animation) const; + bool HasSameObjects(Animation const & animation) const; void SetInterruptedOnCombine(bool enable) { m_interruptedOnCombine = enable; } bool GetInterruptedOnCombine() const { return m_interruptedOnCombine; } @@ -150,5 +151,9 @@ protected: bool m_couldBeRewinded; }; +std::string DebugPrint(Animation::Type const & type); +std::string DebugPrint(Animation::Object const & object); +std::string DebugPrint(Animation::ObjectProperty const & property); + } // namespace df diff --git a/drape_frontend/animation_system.cpp b/drape_frontend/animation_system.cpp index 1888db16c8..24f380caae 100644 --- a/drape_frontend/animation_system.cpp +++ b/drape_frontend/animation_system.cpp @@ -175,7 +175,7 @@ void AnimationSystem::CombineAnimation(drape_ptr<Animation> && animation) for (auto it = lst.begin(); it != lst.end();) { auto & anim = *it; - if (anim->GetInterruptedOnCombine()) + if (anim->GetInterruptedOnCombine() && anim->HasSameObjects(*animation)) { #ifdef DEBUG_ANIMATIONS LOG(LINFO, ("Interrupted on combine", anim->GetType())); |