diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-10-19 17:34:22 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:45:55 +0300 |
commit | 5080d7ccfe10ffdd68575e4642be37b7838def2d (patch) | |
tree | a0e834d2346bacf350c64195b7f45e0cd03999b7 /map/animator.cpp | |
parent | 877f0234a4f6e5ef727b93e5ab8f11ec219740c5 (diff) |
fixed flickering during animation and two-fingers scaling.
Diffstat (limited to 'map/animator.cpp')
-rw-r--r-- | map/animator.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/map/animator.cpp b/map/animator.cpp index 2568fe0b8c..ad38102765 100644 --- a/map/animator.cpp +++ b/map/animator.cpp @@ -1,6 +1,7 @@ #include "animator.hpp" #include "rotate_screen_task.hpp" #include "change_viewport_task.hpp" +#include "move_screen_task.hpp" #include "framework.hpp" #include "../anim/controller.hpp" @@ -67,6 +68,43 @@ void Animator::StopRotation() m_rotateScreenTask.reset(); } +shared_ptr<MoveScreenTask> const & Animator::MoveScreen(m2::PointD const & startPt, + m2::PointD const & endPt, + double speed) +{ + StopMoveScreen(); + + m_moveScreenTask.reset(new MoveScreenTask(m_framework, + startPt, + endPt, + speed)); + + m_framework->GetAnimController()->AddTask(m_moveScreenTask); + + return m_moveScreenTask; +} + +void Animator::StopMoveScreen() +{ + if (m_moveScreenTask) + m_moveScreenTask->Lock(); + + if (m_moveScreenTask + && !m_moveScreenTask->IsEnded() + && !m_moveScreenTask->IsCancelled()) + { + m_moveScreenTask->Cancel(); + m_moveScreenTask->Unlock(); + m_moveScreenTask.reset(); + return; + } + + if (m_moveScreenTask) + m_moveScreenTask->Unlock(); + + m_moveScreenTask.reset(); +} + shared_ptr<ChangeViewportTask> const & Animator::ChangeViewport(m2::AnyRectD const & start, m2::AnyRectD const & end, double rotationSpeed) |