diff --git a/drape/overlay_handle.cpp b/drape/overlay_handle.cpp index d9c2124ded..9aae8c3a6b 100644 --- a/drape/overlay_handle.cpp +++ b/drape/overlay_handle.cpp @@ -5,7 +5,7 @@ namespace dp { -double const k3dAdditionalExtention = 3.0; +double const k3dAdditionalExtention = 2.0; struct OverlayHandle::OffsetNodeFinder { diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index 43272cb0a2..728396a3e5 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -876,10 +876,7 @@ void FrontendRenderer::CheckMinAllowableIn3dScale() m_userEventStream.IsInPerspectiveAnimation()) return; - int const minScale = scales::GetMinAllowableIn3dScale() - - (df::VisualParams::Instance().GetVisualScale() <= 1.0 ? 1 : 0); - bool const switchTo2d = m_currentZoomLevel < minScale; - + bool const switchTo2d = !UserEventStream::IsScaleAllowableIn3d(m_currentZoomLevel); if ((!switchTo2d && !m_perspectiveDiscarded) || (switchTo2d && !m_userEventStream.GetCurrentScreen().isPerspective())) return; diff --git a/drape_frontend/user_event_stream.cpp b/drape_frontend/user_event_stream.cpp index 833fe35539..e085237448 100644 --- a/drape_frontend/user_event_stream.cpp +++ b/drape_frontend/user_event_stream.cpp @@ -3,6 +3,8 @@ #include "indexer/scales.hpp" +#include "platform/platform.hpp" + #include "base/logging.hpp" #include "base/macros.hpp" @@ -321,6 +323,17 @@ bool UserEventStream::SetScale(m2::PointD const & pxScaleCenter, double factor, return true; } +// static +bool UserEventStream::IsScaleAllowableIn3d(int scale) +{ + int minScale = scales::GetMinAllowableIn3dScale(); + if (df::VisualParams::Instance().GetVisualScale() <= 1.0) + minScale -= 1; + if (GetPlatform().IsTablet()) + minScale += 1; + return scale >= minScale; +} + bool UserEventStream::SetCenter(m2::PointD const & center, int zoom, bool isAnim) { m2::PointD targetCenter = center; @@ -329,10 +342,9 @@ bool UserEventStream::SetCenter(m2::PointD const & center, int zoom, bool isAnim ScreenBase const & currentScreen = GetCurrentScreen(); - int const minScale = scales::GetMinAllowableIn3dScale() - - df::VisualParams::Instance().GetVisualScale() <= 1.0 ? 1 : 0; - bool const finishIn3d = m_discardedFOV > 0.0 && zoom >= minScale; - bool const finishIn2d = currentScreen.isPerspective() && zoom < minScale; + bool const isScaleAllowableIn3d = IsScaleAllowableIn3d(zoom); + bool const finishIn3d = m_discardedFOV > 0.0 && isScaleAllowableIn3d; + bool const finishIn2d = currentScreen.isPerspective() && !isScaleAllowableIn3d; ScreenBase screen = currentScreen; if (finishIn3d) diff --git a/drape_frontend/user_event_stream.hpp b/drape_frontend/user_event_stream.hpp index 62e0db2614..1327d1e5f2 100644 --- a/drape_frontend/user_event_stream.hpp +++ b/drape_frontend/user_event_stream.hpp @@ -268,6 +268,8 @@ public: bool IsInPerspectiveAnimation() const; bool IsWaitingForActionCompletion() const; + static bool IsScaleAllowableIn3d(int scale); + void SetListener(ref_ptr listener) { m_listener = listener; } #ifdef DEBUG diff --git a/indexer/scales.cpp b/indexer/scales.cpp index f3aaeafebf..1396bf285e 100644 --- a/indexer/scales.cpp +++ b/indexer/scales.cpp @@ -10,6 +10,11 @@ namespace scales { static const int INITIAL_LEVEL = 1; + int GetMinAllowableIn3dScale() + { + return min(16, min(GetNavigation3dScale(), GetPedestrianNavigation3dScale())); + } + double GetScaleLevelD(double ratio) { double const level = min(static_cast(GetUpperScale()), log(ratio) / log(2.0) + INITIAL_LEVEL); diff --git a/indexer/scales.hpp b/indexer/scales.hpp index 713b5e2f4a..8a93878779 100644 --- a/indexer/scales.hpp +++ b/indexer/scales.hpp @@ -24,8 +24,8 @@ namespace scales inline int GetNavigation3dScale() { return UPPER_STYLE_SCALE - 3; } /// Default pedestrian navigation 3d mode scale inline int GetPedestrianNavigation3dScale() { return UPPER_STYLE_SCALE - 2; } - /// Minimal allowable scale in 3d mode - inline int GetMinAllowableIn3dScale() { return 17; } + + int GetMinAllowableIn3dScale(); double GetScaleLevelD(double ratio); double GetScaleLevelD(m2::RectD const & r);