diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-10-20 16:34:39 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:31:08 +0300 |
commit | 918270158f7bb8d80a9d1d8b45d9e2d3fef06b68 (patch) | |
tree | 4a559a6205d72402bc5a181e9c48fe405758b0f7 /map/location_state.cpp | |
parent | 11502e9968a8f19ce8569235b1c7bd4491496089 (diff) |
[core] some magic with animation
Diffstat (limited to 'map/location_state.cpp')
-rw-r--r-- | map/location_state.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/map/location_state.cpp b/map/location_state.cpp index c389477da4..593c1eea22 100644 --- a/map/location_state.cpp +++ b/map/location_state.cpp @@ -83,7 +83,7 @@ public: ASSERT(m_angleAnim != nullptr, ()); ASSERT(m_posAnim != nullptr, ()); - if (IsVisual()) + if (IsVisual() && m_idleFrames > 0) { //Store new params even if animation is active but don't interrupt the current one. //New animation to the pending params will be made after all. @@ -97,11 +97,13 @@ public: void Update() { - if (m_hasPendingAnimation) + if (m_hasPendingAnimation && m_idleFrames == 0) { m_hasPendingAnimation = false; SetParams(m_pendingDstPos, m_pendingAngle); } + else if (m_idleFrames > 0) + --m_idleFrames; } m2::PointD const & GetPositionForDraw() @@ -111,6 +113,9 @@ public: virtual void OnStep(double ts) { + if (m_idleFrames > 0) + return; + ASSERT(m_angleAnim != nullptr, ()); ASSERT(m_posAnim != nullptr, ()); ASSERT(m_pxBindingAnim != nullptr, ()); @@ -122,6 +127,8 @@ public: if (updateViewPort) UpdateViewport(); + else + m_idleFrames = 5; } virtual bool IsVisual() const @@ -221,6 +228,7 @@ private: bool m_hasPendingAnimation; m2::PointD m_pendingDstPos; double m_pendingAngle; + int m_idleFrames = 0; }; } |