summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--View.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/View.cpp b/View.cpp
index fd2e83a..cf6ea9a 100644
--- a/View.cpp
+++ b/View.cpp
@@ -66,19 +66,14 @@ View::update(const float dt)
}
std::sort(m_labels.begin(), m_labels.end(), [](auto& a, auto& b){ return a.depth > b.depth; });
m_active = nullptr;
- for (auto& label : m_labels) {
+ std::for_each(m_labels.rbegin(), m_labels.rend(), [this](auto& label) {
if (label.hover) {
- if (m_active) {
- if (label.depth < m_active->depth)
- m_active = &label;
- }
+ if (m_active)
+ label.hover = false;
else
m_active = &label;
- label.hover = false;
}
- }
- if (m_active)
- m_active->hover = true;
+ });
}