Skip to content

Commit

Permalink
made screen rotation speed consistent across different animation tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
rachytski authored and biodranik committed Sep 22, 2015
1 parent 0e4f41b commit f81ed7b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
10 changes: 8 additions & 2 deletions map/animator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Animator::Animator(Framework * framework)
: m_framework(framework)
{}

void Animator::RotateScreen(double startAngle, double endAngle, double duration)
void Animator::RotateScreen(double startAngle, double endAngle)
{
if (m_rotateScreenTask)
m_rotateScreenTask->Lock();
Expand All @@ -35,7 +35,7 @@ void Animator::RotateScreen(double startAngle, double endAngle, double duration)
m_rotateScreenTask.reset(new RotateScreenTask(m_framework,
startAngle,
endAngle,
duration));
GetRotationSpeed()));

m_framework->GetAnimController()->AddTask(m_rotateScreenTask);
return;
Expand Down Expand Up @@ -103,3 +103,9 @@ void Animator::StopChangeViewport()

m_changeViewportTask.reset();
}

double Animator::GetRotationSpeed() const
{
/// making full circle in 3 seconds.
return 3;
}
5 changes: 3 additions & 2 deletions map/animator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class Animator
Animator(Framework * framework);
/// rotate screen by shortest path.
void RotateScreen(double startAngle,
double endAngle,
double duration);
double endAngle);
/// stopping screen rotation
void StopRotation();
/// move screen from one point to another
Expand All @@ -35,4 +34,6 @@ class Animator
double rotationSpeed);
/// stop screen moving
void StopChangeViewport();
/// get screen rotation speed
double GetRotationSpeed() const;
};
2 changes: 1 addition & 1 deletion map/compass_arrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ bool CompassArrow::onTapEnded(m2::PointD const & pt)
double startAngle = m_framework->GetNavigator().Screen().GetAngle();
double endAngle = 0;

m_framework->GetAnimator().RotateScreen(startAngle, endAngle, 2);
m_framework->GetAnimator().RotateScreen(startAngle, endAngle);

animController->Unlock();

Expand Down
4 changes: 2 additions & 2 deletions map/location_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ namespace location

m_headingInterpolation.reset(new anim::AngleInterpolation(m_drawHeading,
m_compassFilter.GetHeadingRad(),
1,
m_framework->GetAnimator().GetRotationSpeed(),
m_drawHeading));

m_framework->GetAnimController()->AddTask(m_headingInterpolation);
Expand Down Expand Up @@ -516,7 +516,7 @@ namespace location
double startAngle = m_framework->GetNavigator().Screen().GetAngle();
double endAngle = -m_compassFilter.GetHeadingRad();

m_framework->GetAnimator().RotateScreen(startAngle, endAngle, 2);
m_framework->GetAnimator().RotateScreen(startAngle, endAngle);

controller->Unlock();
}
Expand Down

0 comments on commit f81ed7b

Please sign in to comment.