diff options
Diffstat (limited to 'drape')
-rw-r--r-- | drape/overlay_tree.cpp | 24 | ||||
-rw-r--r-- | drape/overlay_tree.hpp | 4 |
2 files changed, 23 insertions, 5 deletions
diff --git a/drape/overlay_tree.cpp b/drape/overlay_tree.cpp index b50317e67e..394ce7e0a6 100644 --- a/drape/overlay_tree.cpp +++ b/drape/overlay_tree.cpp @@ -8,6 +8,7 @@ namespace dp int const kFrameUpdatePeriod = 10; int const kAverageHandlesCount[dp::OverlayRanksCount] = { 300, 200, 50 }; +int const kInvalidFrame = -1; namespace { @@ -59,8 +60,9 @@ private: } // namespace OverlayTree::OverlayTree() - : m_frameCounter(-1) + : m_frameCounter(kInvalidFrame) , m_followingMode(false) + , m_isDisplacementEnabled(true) { for (size_t i = 0; i < m_handles.size(); i++) m_handles[i].reserve(kAverageHandlesCount[i]); @@ -73,14 +75,14 @@ bool OverlayTree::Frame() m_frameCounter++; if (m_frameCounter >= kFrameUpdatePeriod) - m_frameCounter = -1; + m_frameCounter = kInvalidFrame; return IsNeedUpdate(); } bool OverlayTree::IsNeedUpdate() const { - return m_frameCounter == -1; + return m_frameCounter == kInvalidFrame; } void OverlayTree::StartOverlayPlacing(ScreenBase const & screen) @@ -97,11 +99,11 @@ void OverlayTree::StartOverlayPlacing(ScreenBase const & screen) void OverlayTree::Remove(ref_ptr<OverlayHandle> handle) { - if (m_frameCounter == -1) + if (m_frameCounter == kInvalidFrame) return; if (m_handlesCache.find(handle) != m_handlesCache.end()) - m_frameCounter = -1; + m_frameCounter = kInvalidFrame; } void OverlayTree::Add(ref_ptr<OverlayHandle> handle) @@ -161,6 +163,12 @@ void OverlayTree::InsertHandle(ref_ptr<OverlayHandle> handle, ScreenBase const & modelView = GetModelView(); m2::RectD const pixelRect = handle->GetExtendedPixelRect(modelView); + if (!m_isDisplacementEnabled) + { + m_handlesCache.insert(handle); + TBase::Add(handle, pixelRect); + return; + } TOverlayContainer rivals; HandleComparator comparator(true /* enableMask */, m_followingMode); @@ -383,6 +391,12 @@ void OverlayTree::SetFollowingMode(bool mode) m_followingMode = mode; } +void OverlayTree::SetDisplacementEnabled(bool enabled) +{ + m_isDisplacementEnabled = enabled; + m_frameCounter = kInvalidFrame; +} + #ifdef COLLECT_DISPLACEMENT_INFO OverlayTree::TDisplacementInfo const & OverlayTree::GetDisplacementInfo() const diff --git a/drape/overlay_tree.hpp b/drape/overlay_tree.hpp index 817680ff45..3b11413352 100644 --- a/drape/overlay_tree.hpp +++ b/drape/overlay_tree.hpp @@ -63,6 +63,8 @@ public: void SetFollowingMode(bool mode); + void SetDisplacementEnabled(bool enabled); + #ifdef COLLECT_DISPLACEMENT_INFO struct DisplacementData { @@ -90,6 +92,8 @@ private: unordered_set<ref_ptr<OverlayHandle>, detail::OverlayHasher> m_handlesCache; bool m_followingMode; + bool m_isDisplacementEnabled; + #ifdef COLLECT_DISPLACEMENT_INFO TDisplacementInfo m_displacementInfo; #endif |