diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-04-19 13:45:42 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-04-22 14:52:11 +0300 |
commit | fe27fac70eeade00550bc383cd32eab500079bee (patch) | |
tree | 145dbc2ecc09686e3836c0b3dfab4bbf8eaa23e0 /drape_frontend/frontend_renderer.cpp | |
parent | 0947ace7f8497cfcdaf65a2ce9de38ce61e6443a (diff) |
Turned off 3d buildings and displacement for add-new-place mode
Diffstat (limited to 'drape_frontend/frontend_renderer.cpp')
-rwxr-xr-x | drape_frontend/frontend_renderer.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index 5e2cacad1c..8e77bfc85e 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -119,6 +119,7 @@ FrontendRenderer::FrontendRenderer(Params const & params) , m_enable3dBuildings(params.m_allow3dBuildings) , m_isIsometry(false) , m_blockTapEvents(params.m_blockTapEvents) + , m_choosePositionMode(false) , m_viewport(params.m_viewport) , m_modelViewChangedFn(params.m_modelViewChangedFn) , m_tapEventInfoFn(params.m_tapEventFn) @@ -347,6 +348,26 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message) m_guiRenderer = move(renderer); else m_guiRenderer->Merge(make_ref(renderer)); + + bool oldMode = m_choosePositionMode; + m_choosePositionMode = m_guiRenderer->HasWidget(gui::WIDGET_CHOOSE_POSITION_MARK); + if (oldMode != m_choosePositionMode) + { + ScreenBase const & screen = m_userEventStream.GetCurrentScreen(); + CheckIsometryMinScale(screen); + UpdateDisplacementEnabled(); + if (!m_choosePositionMode || m_currentZoomLevel >= scales::GetAddNewPlaceScale()) + { + InvalidateRect(screen.ClipRect()); + } + else + { + m2::PointD pt = screen.GlobalRect().Center(); + if (!m_myPositionController->IsWaitingForLocation()) + pt = m_myPositionController->GetDrawablePosition(); + AddUserEvent(SetCenterEvent(pt, scales::GetAddNewPlaceScale(), true)); + } + } break; } @@ -1189,10 +1210,10 @@ void FrontendRenderer::DisablePerspective() AddUserEvent(DisablePerspectiveEvent()); } -void FrontendRenderer::CheckIsometryMinScale(const ScreenBase &screen) +void FrontendRenderer::CheckIsometryMinScale(ScreenBase const & screen) { bool const isScaleAllowableIn3d = UserEventStream::IsScaleAllowableIn3d(m_currentZoomLevel); - bool const isIsometry = m_enable3dBuildings && isScaleAllowableIn3d; + bool const isIsometry = m_enable3dBuildings && !m_choosePositionMode && isScaleAllowableIn3d; if (m_isIsometry != isIsometry) { m_isIsometry = isIsometry; @@ -1224,6 +1245,15 @@ void FrontendRenderer::ResolveZoomLevel(ScreenBase const & screen) CheckIsometryMinScale(screen); CheckPerspectiveMinScale(); + UpdateDisplacementEnabled(); +} + +void FrontendRenderer::UpdateDisplacementEnabled() +{ + if (m_choosePositionMode) + m_overlayTree->SetDisplacementEnabled(m_currentZoomLevel < scales::GetAddNewPlaceScale()); + else + m_overlayTree->SetDisplacementEnabled(true); } void FrontendRenderer::OnTap(m2::PointD const & pt, bool isLongTap) |