You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IsItemHovered(): fixed return value false positive when used after EndChild(), EndGroup() or widgets using either... (ocornut#3851, ocornut#1370)
...when the hovered location is located within a child window, e.g. InputTextMultiline().
This is intended to have no side effects, but brace yourself for the possible comeback..
This essentially makes IsItemHovered() not accept hover from child windows, but EndChild/EndGroup are forwarded.
More or less should fix/revert c76f014 which was a revert of 344d48b
if (!(status_flags & ImGuiItemStatusFlags_HoveredRect))
3126
3127
return false;
3127
3128
IM_ASSERT((flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows)) == 0); // Flags not supported by this function
3128
3129
3129
3130
// Test if we are hovering the right window (our window could be behind another window)
3130
-
// [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable to use IsItemHovered() after EndChild() itself.
3131
-
// Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was the test that has been running for a long while.
3132
-
//if (g.HoveredWindow != window)
3133
-
// return false;
3134
-
if (g.HoveredRootWindow != window->RootWindow && !(flags & ImGuiHoveredFlags_AllowWhenOverlapped))
3135
-
return false;
3131
+
// [2021/03/02] Reworked / reverted the revert, finally. Note we want e.g. BeginGroup/ItemAdd/EndGroup to work as well. (#3851)
3132
+
// [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable
3133
+
// to use IsItemHovered() after EndChild() itself. Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was
3134
+
// the test that has been running for a long while.
3135
+
if (g.HoveredWindow != window && (status_flags & ImGuiItemStatusFlags_HoveredWindow) == 0)
3136
+
if ((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0)
3137
+
return false;
3136
3138
3137
3139
// Test if another item is active (e.g. being dragged)
3138
-
if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
3140
+
if ((flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) == 0)
Copy file name to clipboardExpand all lines: imgui_internal.h
+5-3
Original file line number
Diff line number
Diff line change
@@ -697,12 +697,13 @@ enum ImGuiItemStatusFlags_
697
697
{
698
698
ImGuiItemStatusFlags_None = 0,
699
699
ImGuiItemStatusFlags_HoveredRect = 1 << 0,
700
-
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1,
700
+
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1,// LastItemDisplayRect is valid
701
701
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
702
702
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected" because reporting the change allows us to handle clipping with less issues.
703
703
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
704
704
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
705
-
ImGuiItemStatusFlags_Deactivated = 1 << 6// Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
705
+
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
706
+
ImGuiItemStatusFlags_HoveredWindow = 1 << 7// Override the HoveredWindow test to allow cross-window hover testing.
706
707
707
708
#ifdef IMGUI_ENABLE_TEST_ENGINE
708
709
, // [imgui_tests only]
@@ -924,7 +925,7 @@ struct ImGuiStyleMod
924
925
};
925
926
926
927
// Stacked storage data for BeginGroup()/EndGroup()
0 commit comments