mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-28 02:50:06 +00:00
Internals: reorder tests in ItemHoverable() so most likely early out are taken first.
This commit is contained in:
parent
836aff3467
commit
b03a4993b3
2 changed files with 5 additions and 7 deletions
10
imgui.cpp
10
imgui.cpp
|
|
@ -4031,17 +4031,17 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
|||
bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap)
|
||||
return false;
|
||||
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
if (g.HoveredWindow != window)
|
||||
return false;
|
||||
if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap)
|
||||
return false;
|
||||
if (!IsMouseHoveringRect(bb.Min, bb.Max))
|
||||
return false;
|
||||
|
||||
if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap)
|
||||
return false;
|
||||
if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap)
|
||||
return false;
|
||||
|
||||
// Done with rectangle culling so we can perform heavier checks now.
|
||||
ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags);
|
||||
if (!(item_flags & ImGuiItemFlags_NoWindowHoverableCheck) && !IsWindowContentHoverable(window, ImGuiHoveredFlags_None))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue