diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index 08c141f816..ed3306c347 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -1054,7 +1054,7 @@ void BookmarkManager::UpdateElevationMyPosition(kml::TrackId const & trackId) kMyPositionTrackSnapInMeters); auto const selectionInfo = FindNearestTrack( snapRect, [trackId](Track const *track) { return track->GetId() == trackId; }); - if (selectionInfo.m_trackId != trackId) + if (selectionInfo.m_trackId == trackId) myPositionDistance = selectionInfo.m_distanceInMeters; } else @@ -1066,9 +1066,14 @@ void BookmarkManager::UpdateElevationMyPosition(kml::TrackId const & trackId) auto es = GetEditSession(); auto trackSelectionMark = es.GetMarkForEdit(markId); - trackSelectionMark->SetMyPositionDistance(myPositionDistance); - if (m_elevationMyPositionChanged) - m_elevationMyPositionChanged(); + double const kEpsMeters = 1e-2; + if (!base::AlmostEqualAbs(trackSelectionMark->GetMyPositionDistance(), + myPositionDistance, kEpsMeters)) + { + trackSelectionMark->SetMyPositionDistance(myPositionDistance); + if (m_elevationMyPositionChanged) + m_elevationMyPositionChanged(); + } } double BookmarkManager::GetElevationMyPosition(kml::TrackId const & trackId) const @@ -1100,7 +1105,7 @@ void BookmarkManager::SetElevationActivePoint(kml::TrackId const & trackId, doub m2::PointD pt; VERIFY(track->GetPoint(targetDistance, pt), (trackId, targetDistance)); - SelectTrack(TrackSelectionInfo(trackId, pt, targetDistance)); + SelectTrack(TrackSelectionInfo(trackId, pt, targetDistance), false /* notifyListeners */); } double BookmarkManager::GetElevationActivePoint(kml::TrackId const & trackId) const @@ -1198,7 +1203,8 @@ kml::MarkId BookmarkManager::GetTrackSelectionMarkId(kml::TrackId trackId) const return kml::kInvalidMarkId; } -void BookmarkManager::SelectTrack(TrackSelectionInfo const & trackSelectionInfo) +void BookmarkManager::SelectTrack(TrackSelectionInfo const & trackSelectionInfo, + bool notifyListeners) { CHECK_THREAD_CHECKER(m_threadChecker, ()); CHECK_NOT_EQUAL(trackSelectionInfo.m_trackId, kml::kInvalidTrackId, ()); @@ -1220,7 +1226,7 @@ void BookmarkManager::SelectTrack(TrackSelectionInfo const & trackSelectionInfo) trackSelectionMark->SetPosition(trackSelectionInfo.m_trackPoint); trackSelectionMark->SetDistance(trackSelectionInfo.m_distanceInMeters); - if (m_elevationActivePointChanged != nullptr) + if (notifyListeners && m_elevationActivePointChanged != nullptr) m_elevationActivePointChanged(); } @@ -1251,7 +1257,7 @@ void BookmarkManager::ShowDefaultTrackInfo(kml::TrackId trackId) trackInfoMark->SetIsVisible(true); trackInfoMark->SetTrackId(trackId); - SelectTrack(TrackSelectionInfo(trackId, pt, distance)); + SelectTrack(TrackSelectionInfo(trackId, pt, distance), true /* notifyListeners */); } void BookmarkManager::HideTrackInfo(kml::TrackId trackId) diff --git a/map/bookmark_manager.hpp b/map/bookmark_manager.hpp index 95736cc439..86a9e153fc 100644 --- a/map/bookmark_manager.hpp +++ b/map/bookmark_manager.hpp @@ -485,7 +485,7 @@ public: TracksFilter const & tracksFilter = nullptr) const; TrackSelectionInfo GetTrackSelectionInfo(kml::TrackId const & trackId) const; - void SelectTrack(TrackSelectionInfo const & trackSelectionInfo); + void SelectTrack(TrackSelectionInfo const & trackSelectionInfo, bool notifyListeners); void DeselectTrack(kml::TrackId trackId); void ShowDefaultTrackInfo(kml::TrackId trackId); diff --git a/map/framework.cpp b/map/framework.cpp index f8c560d95f..563180a177 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -2552,7 +2552,7 @@ void Framework::BuildTrackPlacePage(BookmarkManager::TrackSelectionInfo const & info.SetSelectedObject(df::SelectionShape::OBJECT_TRACK); auto const & track = *GetBookmarkManager().GetTrack(trackSelectionInfo.m_trackId); FillTrackInfo(track, trackSelectionInfo.m_trackPoint, info); - GetBookmarkManager().SelectTrack(trackSelectionInfo); + GetBookmarkManager().SelectTrack(trackSelectionInfo, true /* notifyListeners */); GetBookmarkManager().HideTrackInfo(trackSelectionInfo.m_trackId); }