diff options
-rw-r--r-- | drape_frontend/user_mark_shapes.cpp | 6 | ||||
-rw-r--r-- | drape_frontend/user_mark_shapes.hpp | 1 | ||||
-rw-r--r-- | map/framework.cpp | 20 | ||||
-rw-r--r-- | map/framework.hpp | 9 | ||||
-rw-r--r-- | map/user_mark_container.cpp | 11 |
5 files changed, 42 insertions, 5 deletions
diff --git a/drape_frontend/user_mark_shapes.cpp b/drape_frontend/user_mark_shapes.cpp index 91e5680152..fba8085779 100644 --- a/drape_frontend/user_mark_shapes.cpp +++ b/drape_frontend/user_mark_shapes.cpp @@ -17,6 +17,7 @@ namespace int const YSearchMarksLayer = 1; int const YApiMarksLayer = 2; int const YBookmarksLayer = 3; + int const YDebugLayer = 4; } TileKey GetSearchTileKey() @@ -29,6 +30,11 @@ TileKey GetApiTileKey() return TileKey(0, YApiMarksLayer, ZUserMarksLayer); } +TileKey GetDebugTileKey() +{ + return TileKey(0, YDebugLayer, ZUserMarksLayer); +} + TileKey GetBookmarkTileKey(size_t categoryIndex) { return TileKey(categoryIndex, YBookmarksLayer, ZUserMarksLayer); diff --git a/drape_frontend/user_mark_shapes.hpp b/drape_frontend/user_mark_shapes.hpp index e696c6cfdc..361d6c86b3 100644 --- a/drape_frontend/user_mark_shapes.hpp +++ b/drape_frontend/user_mark_shapes.hpp @@ -14,6 +14,7 @@ namespace df { TileKey GetSearchTileKey(); TileKey GetApiTileKey(); + TileKey GetDebugTileKey(); TileKey GetBookmarkTileKey(size_t categoryIndex); bool IsUserMarkLayer(TileKey const & tileKey); diff --git a/map/framework.cpp b/map/framework.cpp index 619c5c6fd8..93dd82e3d3 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -167,8 +167,8 @@ void Framework::SetMyPositionModeListener(location::TMyPositionModeChanged const void Framework::OnUserPositionChanged(m2::PointD const & position) { - MyPositionMarkPoint * myPostition = UserMarkContainer::UserMarkForMyPostion(); - myPostition->SetUserPosition(position); + MyPositionMarkPoint * myPosition = UserMarkContainer::UserMarkForMyPostion(); + myPosition->SetUserPosition(position); if (IsRoutingActive()) m_routingSession.SetUserCurrentPosition(position); @@ -1250,6 +1250,14 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory, InvalidateMyPosition(); m_bmManager.InitBookmarks(); + + // In case of the engine reinitialization simulate the last tap to show selection mark. + if (m_lastTapEvent != nullptr) + { + UserMark const * mark = OnTapEventImpl(m_lastTapEvent->m_pxPoint, m_lastTapEvent->m_isLong, + m_lastTapEvent->m_isMyPosition, m_lastTapEvent->m_feature); + ActivateUserMark(mark, true); + } } ref_ptr<df::DrapeEngine> Framework::GetDrapeEngine() @@ -1564,6 +1572,14 @@ bool Framework::HasActiveUserMark() void Framework::OnTapEvent(m2::PointD pxPoint, bool isLong, bool isMyPosition, FeatureID feature) { + // Back up last tap event to recover selection in case of Drape reinitialization. + if (!m_lastTapEvent) + m_lastTapEvent = make_unique<TapEventData>(); + m_lastTapEvent->m_pxPoint = pxPoint; + m_lastTapEvent->m_isLong = isLong; + m_lastTapEvent->m_isMyPosition = isMyPosition; + m_lastTapEvent->m_feature = feature; + UserMark const * mark = OnTapEventImpl(pxPoint, isLong, isMyPosition, feature); { diff --git a/map/framework.hpp b/map/framework.hpp index 031d91dee1..0b05b47a81 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -261,6 +261,15 @@ public: void SetUserMarkActivationListener(TActivateCallbackFn const & fn) { m_activateUserMarkFn = fn; } private: + struct TapEventData + { + m2::PointD m_pxPoint; + bool m_isLong; + bool m_isMyPosition; + FeatureID m_feature; + }; + unique_ptr<TapEventData> m_lastTapEvent; + void OnTapEvent(m2::PointD pxPoint, bool isLong, bool isMyPosition, FeatureID feature); UserMark const * OnTapEventImpl(m2::PointD pxPoint, bool isLong, bool isMyPosition, FeatureID feature); //@} diff --git a/map/user_mark_container.cpp b/map/user_mark_container.cpp index 5485123021..24f9c5fa6b 100644 --- a/map/user_mark_container.cpp +++ b/map/user_mark_container.cpp @@ -50,9 +50,14 @@ namespace { switch (cont->GetType()) { - case UserMarkType::API_MARK: return df::GetApiTileKey(); - case UserMarkType::SEARCH_MARK: return df::GetSearchTileKey(); - case UserMarkType::BOOKMARK_MARK: return df::GetBookmarkTileKey(reinterpret_cast<size_t>(cont)); + case UserMarkType::API_MARK: + return df::GetApiTileKey(); + case UserMarkType::SEARCH_MARK: + return df::GetSearchTileKey(); + case UserMarkType::BOOKMARK_MARK: + return df::GetBookmarkTileKey(reinterpret_cast<size_t>(cont)); + case UserMarkType::DEBUG_MARK: + return df::GetDebugTileKey(); default: ASSERT(false, ()); break; |