mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-24 16:46:36 +00:00
IsItemHovered(), IsHovered(): Shallow tweaks to make them more symetrical. Removed one set of braces.
This commit is contained in:
parent
7bcb1d3816
commit
c5a79deb38
32
imgui.cpp
32
imgui.cpp
@ -1954,12 +1954,14 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id)
|
|||||||
bool ImGui::IsItemHovered()
|
bool ImGui::IsItemHovered()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (g.HoveredWindow == window)
|
if (g.HoveredWindow != window)
|
||||||
if (g.ActiveId == 0 || g.ActiveId == window->DC.LastItemId || g.ActiveIdAllowOverlap || g.ActiveId == window->MoveId)
|
return false;
|
||||||
if (IsMouseHoveringRect(window->DC.LastItemRect.Min, window->DC.LastItemRect.Max))
|
if (g.ActiveId == 0 || g.ActiveId == window->DC.LastItemId || g.ActiveIdAllowOverlap || g.ActiveId == window->MoveId)
|
||||||
if (IsWindowContentHoverable(window))
|
if (IsMouseHoveringRect(window->DC.LastItemRect.Min, window->DC.LastItemRect.Max))
|
||||||
return true;
|
if (IsWindowContentHoverable(window))
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1974,15 +1976,17 @@ bool ImGui::IsItemRectHovered()
|
|||||||
bool ImGui::IsHovered(const ImRect& bb, ImGuiID id)
|
bool ImGui::IsHovered(const ImRect& bb, ImGuiID id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.HoveredId == 0 || g.HoveredId == id || g.HoveredIdAllowOverlap)
|
if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap)
|
||||||
{
|
return false;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
|
||||||
if (g.HoveredWindow == window)
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (g.ActiveId == 0 || g.ActiveId == id || g.ActiveIdAllowOverlap)
|
if (g.HoveredWindow != window)
|
||||||
if (IsMouseHoveringRect(bb.Min, bb.Max))
|
return false;
|
||||||
if (IsWindowContentHoverable(g.HoveredRootWindow))
|
if (g.ActiveId == 0 || g.ActiveId == id || g.ActiveIdAllowOverlap)
|
||||||
return true;
|
if (IsMouseHoveringRect(bb.Min, bb.Max))
|
||||||
}
|
if (IsWindowContentHoverable(g.HoveredRootWindow))
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user