diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2019-09-18 18:40:47 +0300 |
---|---|---|
committer | Aleksandr Zatsepin <alexzatsepin@users.noreply.github.com> | 2019-09-19 13:53:16 +0300 |
commit | 1b91b166d7a5c5f70c07e21690d32601ede5c305 (patch) | |
tree | a06d96857d70fe46e1d60b3945e2cd2e7aee6713 | |
parent | bea03813cf46048ca35b8ab12e14983d2b13e4bd (diff) |
Fixed line selection rendering
-rw-r--r-- | map/framework.cpp | 18 | ||||
-rw-r--r-- | map/framework.hpp | 41 |
2 files changed, 28 insertions, 31 deletions
diff --git a/map/framework.cpp b/map/framework.cpp index 53f18ed142..ad7e70486d 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1154,7 +1154,7 @@ void Framework::ShowBookmark(Bookmark const * mark) place_page::Info info; FillBookmarkInfo(*mark, info); - ActivateMapSelection(true, df::SelectionShape::OBJECT_USER_MARK, info); + ActivateMapSelection(true, df::SelectionShape::OBJECT_USER_MARK, TapEvent::Source::Other, info); // TODO // We need to preserve bookmark id in the m_lastTapEvent, because one feature can have several bookmarks. m_lastTapEvent = MakeTapEvent(info.GetMercator(), info.GetID(), TapEvent::Source::Other); @@ -1199,7 +1199,7 @@ void Framework::ShowFeatureByMercator(m2::PointD const & pt) std::string name; GetBookmarkManager().SelectionMark().SetPtOrg(pt); FillPointInfo(info, pt, name); - ActivateMapSelection(false, df::SelectionShape::OBJECT_POI, info); + ActivateMapSelection(false, df::SelectionShape::OBJECT_POI, TapEvent::Source::Other, info); m_lastTapEvent = MakeTapEvent(info.GetMercator(), info.GetID(), TapEvent::Source::Other); } @@ -1728,7 +1728,7 @@ void Framework::SelectSearchResult(search::Result const & result, bool animation m_drapeEngine->SetModelViewCenter(center, scale, animation, true /* trackVisibleViewport */); GetBookmarkManager().SelectionMark().SetPtOrg(center); - ActivateMapSelection(false, df::SelectionShape::OBJECT_POI, info); + ActivateMapSelection(false, df::SelectionShape::OBJECT_POI, TapEvent::Source::Search, info); m_lastTapEvent = MakeTapEvent(center, info.GetID(), TapEvent::Source::Search); } @@ -2281,13 +2281,13 @@ bool Framework::ShowMapForURL(string const & url) if (apiMark) { FillApiMarkInfo(*apiMark, info); - ActivateMapSelection(false, df::SelectionShape::OBJECT_USER_MARK, info); + ActivateMapSelection(false, df::SelectionShape::OBJECT_USER_MARK, TapEvent::Source::Other, info); } else { GetBookmarkManager().SelectionMark().SetPtOrg(point); FillPointInfo(info, point, name); - ActivateMapSelection(false, df::SelectionShape::OBJECT_POI, info); + ActivateMapSelection(false, df::SelectionShape::OBJECT_POI, TapEvent::Source::Other, info); } m_lastTapEvent = MakeTapEvent(info.GetMercator(), info.GetID(), TapEvent::Source::Other); } @@ -2407,15 +2407,13 @@ void Framework::SetPlacePageListenners(PlacePageEvent::OnOpen const & onOpen, } void Framework::ActivateMapSelection(bool needAnimation, df::SelectionShape::ESelectedObject selectionType, - place_page::Info const & info) + TapEvent::Source tapSource, place_page::Info const & info) { ASSERT_NOT_EQUAL(selectionType, df::SelectionShape::OBJECT_EMPTY, ("Empty selections are impossible.")); m_selectedFeature = info.GetID(); if (m_drapeEngine != nullptr) { - bool isGeometrySelectionAllowed = false; - if (!m_lastTapEvent || !m_lastTapEvent->m_info.m_isLong) - isGeometrySelectionAllowed = true; + bool isGeometrySelectionAllowed = (tapSource == TapEvent::Source::Search); m_drapeEngine->SelectObject(selectionType, info.GetMercator(), info.GetID(), needAnimation, isGeometrySelectionAllowed); } @@ -2545,7 +2543,7 @@ void Framework::OnTapEvent(TapEvent const & tapEvent) SetPlacePageLocation(info); - ActivateMapSelection(true, selection, info); + ActivateMapSelection(true, selection, tapEvent.m_source, info); } else { diff --git a/map/framework.hpp b/map/framework.hpp index b1a7ae155a..6ff66932f1 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -399,9 +399,26 @@ public: double GetMinDistanceBetweenResults() const override; private: - void ActivateMapSelection(bool needAnimation, - df::SelectionShape::ESelectedObject selectionType, - place_page::Info const & info); + struct TapEvent + { + enum class Source + { + User, + Search, + Other + }; + + TapEvent(df::TapInfo const & info, Source source) + : m_info(info) + , m_source(source) + {} + + df::TapInfo const m_info; + Source const m_source; + }; + + void ActivateMapSelection(bool needAnimation, df::SelectionShape::ESelectedObject selectionType, + TapEvent::Source tapSource, place_page::Info const & info); void InvalidateUserMarks(); public: @@ -448,24 +465,6 @@ public: vector<FeatureID> const & features); private: - struct TapEvent - { - enum class Source - { - User, - Search, - Other - }; - - TapEvent(df::TapInfo const & info, Source source) - : m_info(info) - , m_source(source) - {} - - df::TapInfo const m_info; - Source const m_source; - }; - unique_ptr<TapEvent> m_lastTapEvent; bool m_isViewportInitialized = false; |