diff options
author | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2016-06-06 11:54:32 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2016-07-07 15:31:06 +0300 |
commit | c949c0c407bbd1742a03b7189ee42c59f03dcbae (patch) | |
tree | 3fb6de09056f7639ebe7d6eced4ec78f5a52bcbf /drape_frontend | |
parent | 6cb5375879befdfd8cc7cf2f9c93e5c187149bb2 (diff) |
Set perspective angle automatically when the scale is changing.
Diffstat (limited to 'drape_frontend')
-rw-r--r-- | drape_frontend/navigator.cpp | 7 | ||||
-rw-r--r-- | drape_frontend/navigator.hpp | 1 | ||||
-rw-r--r-- | drape_frontend/user_event_stream.cpp | 3 |
3 files changed, 11 insertions, 0 deletions
diff --git a/drape_frontend/navigator.cpp b/drape_frontend/navigator.cpp index f695b9917e..b68c595e37 100644 --- a/drape_frontend/navigator.cpp +++ b/drape_frontend/navigator.cpp @@ -307,6 +307,13 @@ void Navigator::Disable3dMode() m_Screen.ResetPerspective(); } +bool Navigator::UpdatePerspective() +{ + bool const isPerspective = m_Screen.isPerspective(); + m_Screen.UpdatePerspectiveParameters(); + return isPerspective != m_Screen.isPerspective(); +} + m2::AnyRectD ToRotated(Navigator const & navigator, m2::RectD const & rect) { double const dx = rect.SizeX(); diff --git a/drape_frontend/navigator.hpp b/drape_frontend/navigator.hpp index ba6773e442..6e05419e81 100644 --- a/drape_frontend/navigator.hpp +++ b/drape_frontend/navigator.hpp @@ -46,6 +46,7 @@ public: void Enable3dMode(double currentRotationAngle, double maxRotationAngle, double angleFOV); void SetRotationIn3dMode(double rotationAngle); void Disable3dMode(); + bool UpdatePerspective(); private: // Internal screen corresponding to the state when navigation began with StartDrag or StartScale. diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp index 622c4b6a10..4fe138b586 100644 --- a/drape_frontend/user_event_stream.cpp +++ b/drape_frontend/user_event_stream.cpp @@ -267,6 +267,9 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChanged, bool DetectLongTap(m_touches[0]); } + if (m_modelViewChanged) + m_viewportChanged |= m_navigator.UpdatePerspective(); + modelViewChanged = m_modelViewChanged; viewportChanged = m_viewportChanged; m_modelViewChanged = false; |