Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2016-05-30 19:34:31 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2016-07-07 15:31:06 +0300
commit6cb5375879befdfd8cc7cf2f9c93e5c187149bb2 (patch)
tree674f9c78ae77fd4fbfc1f824252a74e7ae24ef75 /drape_frontend
parentfb39e154fe53384ddbb857681065248abb6792f4 (diff)
Scale animation operates with pixel positions on viewport.
Diffstat (limited to 'drape_frontend')
-rw-r--r--drape_frontend/animation/scale_animation.cpp7
-rw-r--r--drape_frontend/animation/scale_animation.hpp4
-rw-r--r--drape_frontend/screen_animations.cpp3
3 files changed, 7 insertions, 7 deletions
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<MapScaleAnimation> 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<MapScaleAnimation>(startScreen.GetScale(), endScreen.GetScale(),
- glbScaleCenter, offset);
+ glbScaleCenter, pxScaleCenter);
anim->SetMaxDuration(kMaxAnimationTimeSec);
return anim;