yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dock_tree_hit_test.cc
Go to the documentation of this file.
2
3namespace yaze {
4namespace editor {
5namespace layout_designer {
6
7const DockNode* HitTestNode(const DockTreeLayout& layout, ImVec2 mouse) {
8 const DockNode* best = nullptr;
9 float best_area = 0.0f;
10 for (const auto& entry : layout.node_rects) {
11 const ImRect& rect = entry.second;
12 if (!rect.Contains(mouse))
13 continue;
14 const float area = rect.GetWidth() * rect.GetHeight();
15 if (best == nullptr || area < best_area) {
16 best = entry.first;
17 best_area = area;
18 }
19 }
20 return best;
21}
22
23} // namespace layout_designer
24} // namespace editor
25} // namespace yaze
const DockNode * HitTestNode(const DockTreeLayout &layout, ImVec2 mouse)
Represents a dock node in the layout tree.
Definition dock_tree.h:61
absl::flat_hash_map< const DockNode *, ImRect > node_rects