Skip to content

Commit 6e99688

Browse files
committed
Fixed user-facing version of IsItemHovered() ignoring overlapping windows
1 parent d692286 commit 6e99688

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

imgui.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4347,11 +4347,9 @@ static bool IsHovered(const ImRect& bb, ImGuiID id)
43474347
{
43484348
ImGuiWindow* window = GetCurrentWindow();
43494349
if (g.HoveredRootWindow == window->RootWindow)
4350-
{
43514350
if ((g.ActiveId == 0 || g.ActiveId == id || g.ActiveIdIsFocusedOnly) && IsMouseHoveringRect(bb))
43524351
if (IsWindowContentHoverable(g.HoveredRootWindow))
43534352
return true;
4354-
}
43554353
}
43564354
return false;
43574355
}
@@ -7215,9 +7213,10 @@ static bool ItemAdd(const ImRect& bb, const ImGuiID* id)
72157213
// So that clicking on items with no active id such as Text() still returns true with IsItemHovered()
72167214
window->DC.LastItemHoveredRect = true;
72177215
window->DC.LastItemHoveredAndUsable = false;
7218-
if (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdIsFocusedOnly || (g.ActiveId == window->MoveID))
7219-
if (IsWindowContentHoverable(window))
7220-
window->DC.LastItemHoveredAndUsable = true;
7216+
if (g.HoveredRootWindow == window->RootWindow)
7217+
if (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdIsFocusedOnly || (g.ActiveId == window->MoveID))
7218+
if (IsWindowContentHoverable(window))
7219+
window->DC.LastItemHoveredAndUsable = true;
72217220
}
72227221
else
72237222
{

0 commit comments

Comments
 (0)