diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 452625d2e1..056273ac92 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -407,12 +407,6 @@ namespace android { m_doLoadState = false; - shared_ptr ls = m_work.GetInformationDisplay().locationState(); - - ls->StopCompassFollowing(); - ls->SetLocationProcessMode(location::ELocationDoNothing); - ls->SetIsCentered(false); - m_work.ShowSearchResult(r); } diff --git a/map/framework.cpp b/map/framework.cpp index 8853f4255c..f83904ef46 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -116,6 +116,15 @@ void Framework::OnCompassUpdate(location::CompassInfo const & info) m_informationDisplay.locationState()->OnCompassUpdate(rInfo); } +void Framework::StopLocationFollow() +{ + shared_ptr ls = m_informationDisplay.locationState(); + + ls->StopCompassFollowing(); + ls->SetLocationProcessMode(location::ELocationDoNothing); + ls->SetIsCentered(false); +} + InformationDisplay & Framework::GetInformationDisplay() { return m_informationDisplay; @@ -477,6 +486,8 @@ BookmarkAndCategory Framework::GetBookmark(m2::PointD const & pxPoint, double vi void Framework::ShowBookmark(Bookmark const & bm) { + StopLocationFollow(); + double scale = bm.GetScale(); if (scale == -1.0) scale = 16.0; @@ -1169,6 +1180,8 @@ bool Framework::GetCurrentPosition(double & lat, double & lon) const void Framework::ShowSearchResult(search::Result const & res) { + StopLocationFollow(); + m2::RectD const rect = res.GetFeatureRect(); ShowRectExVisibleScale(rect); diff --git a/map/framework.hpp b/map/framework.hpp index 1c9bbfda62..8b2d3ecdd3 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -110,6 +110,8 @@ protected: location::ECompassProcessMode m_dragCompassProcessMode; location::ELocationProcessMode m_dragLocationProcessMode; + void StopLocationFollow(); + //mutable threads::Mutex m_modelSyn; storage::Storage m_storage;