stopping rotation in CompassArrow when starting a rotation in location::State.

This commit is contained in:
rachytski 2012-08-20 16:59:00 +03:00 committed by Alex Zolotarev
parent 9e16c89bf9
commit bfc62769b0
3 changed files with 14 additions and 2 deletions

View file

@ -121,6 +121,15 @@ void CompassArrow::purge()
m_displayList.reset();
}
void CompassArrow::StopAnimation()
{
if (m_rotateScreenTask
&& !m_rotateScreenTask->IsEnded()
&& !m_rotateScreenTask->IsCancelled())
m_rotateScreenTask->Cancel();
m_rotateScreenTask.reset();
}
bool CompassArrow::onTapEnded(m2::PointD const & pt)
{
shared_ptr<anim::Controller> animController = m_framework->GetRenderPolicy()->GetAnimController();
@ -149,7 +158,7 @@ bool CompassArrow::onTapEnded(m2::PointD const & pt)
m_rotateScreenTask.reset(new RotateScreenTask(m_framework,
startAngle,
endAngle,
1));
2));
animController->AddTask(m_rotateScreenTask);
animController->Unlock();

View file

@ -66,4 +66,6 @@ public:
bool onTapEnded(m2::PointD const & pt);
bool hitTest(m2::PointD const & pt) const;
void StopAnimation();
};

View file

@ -395,6 +395,7 @@ namespace location
m_framework->GetRenderPolicy()->GetAnimController()->Lock();
m_framework->GetInformationDisplay().locationState()->StopAnimation();
StopAnimation();
double startAngle = m_framework->GetNavigator().Screen().GetAngle();
@ -418,7 +419,7 @@ namespace location
m_rotateScreenTask.reset(new RotateScreenTask(m_framework,
startAngle,
endAngle,
1));
2));
m_framework->GetRenderPolicy()->GetAnimController()->AddTask(m_rotateScreenTask);
}