Beispiel #1
0
drape_ptr<MapLinearAnimation> GetSetRectAnimation(ScreenBase const & screen,
                                                  m2::AnyRectD const & startRect, m2::AnyRectD const & endRect)
{
  auto anim = make_unique_dp<MapLinearAnimation>();

  double const startScale = CalculateScale(screen.PixelRect(), startRect.GetLocalRect());
  double const endScale = CalculateScale(screen.PixelRect(), endRect.GetLocalRect());

  anim->SetRotate(startRect.Angle().val(), endRect.Angle().val());
  anim->SetMove(startRect.GlobalCenter(), endRect.GlobalCenter(), screen);
  anim->SetScale(startScale, endScale);
  anim->SetMaxScaleDuration(kMaxAnimationTimeSec);

  return anim;
}
Beispiel #2
0
 // startRect - mercator visible on screen rect in moment when user release fingers.
 // direction - mercator space direction of moving. length(direction) - mercator distance on wich map will be offset.
 KineticScrollAnimation(m2::AnyRectD const & startRect, m2::PointD const & direction, double duration)
   : BaseModelViewAnimation(duration)
   , m_targetCenter(startRect.GlobalCenter() + direction)
   , m_angle(startRect.Angle())
   , m_localRect(startRect.GetLocalRect())
   , m_direction(direction)
 {
 }
Beispiel #3
0
void ScreenBase::SetFromRects(m2::AnyRectD const & glbRect, m2::RectD const & pxRect)
{
  double hScale = glbRect.GetLocalRect().SizeX() / pxRect.SizeX();
  double vScale = glbRect.GetLocalRect().SizeY() / pxRect.SizeY();

  m_Scale = max(hScale, vScale);
  m_Angle = glbRect.Angle();
  m_Org = glbRect.GlobalCenter();

  UpdateDependentParameters();
}