mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 05:27:01 +00:00
Fixed user-facing version of IsItemHovered() ignoring overlapping windows
This commit is contained in:
parent
d692286862
commit
6e99688fa7
@ -4347,12 +4347,10 @@ static bool IsHovered(const ImRect& bb, ImGuiID id)
|
|||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (g.HoveredRootWindow == window->RootWindow)
|
if (g.HoveredRootWindow == window->RootWindow)
|
||||||
{
|
|
||||||
if ((g.ActiveId == 0 || g.ActiveId == id || g.ActiveIdIsFocusedOnly) && IsMouseHoveringRect(bb))
|
if ((g.ActiveId == 0 || g.ActiveId == id || g.ActiveIdIsFocusedOnly) && IsMouseHoveringRect(bb))
|
||||||
if (IsWindowContentHoverable(g.HoveredRootWindow))
|
if (IsWindowContentHoverable(g.HoveredRootWindow))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7215,6 +7213,7 @@ static bool ItemAdd(const ImRect& bb, const ImGuiID* id)
|
|||||||
// So that clicking on items with no active id such as Text() still returns true with IsItemHovered()
|
// So that clicking on items with no active id such as Text() still returns true with IsItemHovered()
|
||||||
window->DC.LastItemHoveredRect = true;
|
window->DC.LastItemHoveredRect = true;
|
||||||
window->DC.LastItemHoveredAndUsable = false;
|
window->DC.LastItemHoveredAndUsable = false;
|
||||||
|
if (g.HoveredRootWindow == window->RootWindow)
|
||||||
if (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdIsFocusedOnly || (g.ActiveId == window->MoveID))
|
if (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdIsFocusedOnly || (g.ActiveId == window->MoveID))
|
||||||
if (IsWindowContentHoverable(window))
|
if (IsWindowContentHoverable(window))
|
||||||
window->DC.LastItemHoveredAndUsable = true;
|
window->DC.LastItemHoveredAndUsable = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user