diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-03-29 19:17:54 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:37:08 +0300 |
commit | 3f6e9d5d5b8475d76c1e09d7739cbcfe2101e465 (patch) | |
tree | c59d61919df98e35ad937420e8b877f82ff51152 /geometry/screenbase.cpp | |
parent | 98507afbd62448a669db67f1bdbd94e67ec38186 (diff) |
correct function for zooming to specified scale level.
Diffstat (limited to 'geometry/screenbase.cpp')
-rw-r--r-- | geometry/screenbase.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/geometry/screenbase.cpp b/geometry/screenbase.cpp index d1a6f00fe9..a5ae3bad74 100644 --- a/geometry/screenbase.cpp +++ b/geometry/screenbase.cpp @@ -56,6 +56,18 @@ void ScreenBase::UpdateDependentParameters() m_ClipRect = m_GlobalRect.GetGlobalRect(); } +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(); +} + void ScreenBase::SetFromRect(m2::AnyRectD const & GlobalRect) { double hScale = GlobalRect.GetLocalRect().SizeX() / m_PixelRect.SizeX(); |