diff options
author | vng <viktor.govako@gmail.com> | 2013-11-01 18:40:26 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:04:38 +0300 |
commit | 2e3a0e4b1c8281f778f2eed3342924d4cf439c25 (patch) | |
tree | ecaaf83f34d9b83d8a6c3f26d7389242c81fffe5 /map/animator.cpp | |
parent | 683b66531cc8e587dbaab3662fd98ec453dee738 (diff) |
Skip map rotation with 3 degrees in auto-follow mode.
Diffstat (limited to 'map/animator.cpp')
-rw-r--r-- | map/animator.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/map/animator.cpp b/map/animator.cpp index 94fb02660c..5d04e83ec2 100644 --- a/map/animator.cpp +++ b/map/animator.cpp @@ -31,18 +31,26 @@ void Animator::RotateScreen(double startAngle, double endAngle) if (m_rotateScreenTask) m_rotateScreenTask->Lock(); - if (m_rotateScreenTask - && !m_rotateScreenTask->IsCancelled() - && !m_rotateScreenTask->IsEnded()) + bool const inProgress = + m_rotateScreenTask && + !m_rotateScreenTask->IsCancelled() && + !m_rotateScreenTask->IsEnded(); + + if (inProgress) + { m_rotateScreenTask->SetEndAngle(endAngle); + } else { - if (fabs(ang::GetShortestDistance(startAngle, endAngle)) > math::pi / 180.0) + double const eps = my::DegToRad(3.0); + + if (fabs(ang::GetShortestDistance(startAngle, endAngle)) > eps) { if (m_rotateScreenTask) { - if (!m_rotateScreenTask->IsCancelled() && !m_rotateScreenTask->IsEnded()) + if (inProgress) m_rotateScreenTask->Cancel(); + m_rotateScreenTask->Unlock(); m_rotateScreenTask.reset(); } |