From 19e22baa065dab7c99694d14fc46d713e5c4f449 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 27 Sep 2017 17:06:07 +0200 Subject: [PATCH] ItemAdd(): more re-ordering of tests to match IsHovered() + comments --- imgui.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 2bce31de..25dd1ce5 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -1950,10 +1950,11 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id) // Set up for public-facing IsItemHovered(). We store the result in DC.LastItemHoveredAndUsable. // This is roughly matching the behavior of internal-facing IsHovered() // - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered()) + // - we don't expose the flatten_child feature that IsHovered() has, which is only used by the window resizing widget (may rework this) // FIXME-OPT: Consider moving this code to IsItemHovered() so it's only evaluated if users needs it. if (g.HoveredWindow == window) - if (IsMouseHoveringRect(bb.Min, bb.Max)) - if (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdAllowOverlap || (g.ActiveId == window->MoveId)) + if (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdAllowOverlap || (g.ActiveId == window->MoveId)) + if (IsMouseHoveringRect(bb.Min, bb.Max)) if (IsWindowContentHoverable(window)) window->DC.LastItemHoveredAndUsable = true;