diff --git a/drape_frontend/animation/scale_animation.cpp b/drape_frontend/animation/scale_animation.cpp index 92f814df1d..e0257e953c 100644 --- a/drape_frontend/animation/scale_animation.cpp +++ b/drape_frontend/animation/scale_animation.cpp @@ -8,10 +8,10 @@ namespace df { MapScaleAnimation::MapScaleAnimation(double startScale, double endScale, m2::PointD const & globalScaleCenter, - m2::PointD const & pixelCenterOffset) + m2::PointD const & pxScaleCenter) : Animation(true /* couldBeInterrupted */, true /* couldBeBlended */) , m_scaleInterpolator(startScale, endScale) - , m_pixelCenterOffset(pixelCenterOffset) + , m_pxScaleCenter(pxScaleCenter) , m_globalScaleCenter(globalScaleCenter) { m_objects.insert(Animation::MapPlane); @@ -64,7 +64,8 @@ bool MapScaleAnimation::GetProperty(TObject object, TProperty property, bool tar { ScreenBase screen = AnimationSystem::Instance().GetLastScreen(); screen.SetScale(targetValue ? m_scaleInterpolator.GetTargetScale() : m_scaleInterpolator.GetScale()); - value = PropertyValue(screen.PtoG(screen.GtoP(m_globalScaleCenter) + m_pixelCenterOffset)); + m2::PointD const pixelOffset = screen.PixelRect().Center() - screen.P3dtoP(m_pxScaleCenter); + value = PropertyValue(screen.PtoG(screen.GtoP(m_globalScaleCenter) + pixelOffset)); return true; } if (property == Animation::Scale) diff --git a/drape_frontend/animation/scale_animation.hpp b/drape_frontend/animation/scale_animation.hpp index 07706c604a..44b53c54a8 100644 --- a/drape_frontend/animation/scale_animation.hpp +++ b/drape_frontend/animation/scale_animation.hpp @@ -10,7 +10,7 @@ class MapScaleAnimation : public Animation { public: MapScaleAnimation(double startScale, double endScale, - m2::PointD const & globalScaleCenter, m2::PointD const & pixelCenterOffset); + m2::PointD const & globalScaleCenter, m2::PointD const & pxScaleCenter); Animation::Type GetType() const override { return Animation::MapScale; } @@ -41,7 +41,7 @@ private: bool GetProperty(TObject object, TProperty property, bool targetValue, PropertyValue & value) const; ScaleInterpolator m_scaleInterpolator; - m2::PointD const m_pixelCenterOffset; + m2::PointD const m_pxScaleCenter; m2::PointD const m_globalScaleCenter; TObjectProperties m_properties; TAnimObjects m_objects; diff --git a/drape_frontend/screen_animations.cpp b/drape_frontend/screen_animations.cpp index 0364f765d8..e2076746ef 100644 --- a/drape_frontend/screen_animations.cpp +++ b/drape_frontend/screen_animations.cpp @@ -113,9 +113,8 @@ drape_ptr GetScaleAnimation(ScreenBase const & startScreen, m ScreenBase endScreen = startScreen; ApplyScale(pxScaleCenter, factor, endScreen); - m2::PointD const offset = startScreen.PixelRect().Center() - startScreen.P3dtoP(pxScaleCenter); auto anim = make_unique_dp(startScreen.GetScale(), endScreen.GetScale(), - glbScaleCenter, offset); + glbScaleCenter, pxScaleCenter); anim->SetMaxDuration(kMaxAnimationTimeSec); return anim;