|
|
@ -2170,9 +2170,10 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id, const ImRect* nav_bb_ar |
|
|
|
{ |
|
|
|
ImGuiContext& g = *GImGui; |
|
|
|
ImGuiWindow* window = g.CurrentWindow; |
|
|
|
const bool is_clipped = IsClippedEx(bb, id, false); |
|
|
|
window->DC.LastItemId = id ? *id : 0; |
|
|
|
window->DC.LastItemRect = bb; |
|
|
|
const bool is_clipped = IsClippedEx(bb, id, false); |
|
|
|
window->DC.LastItemRectHoveredRect = false; |
|
|
|
if (id != NULL) |
|
|
|
window->DC.NavLayerActiveFlagsNext |= (1 << window->DC.NavLayerCurrent); |
|
|
|
|
|
|
@ -2223,6 +2224,8 @@ bool ImGui::ItemAdd(const ImRect& bb, const ImGuiID* id, const ImRect* nav_bb_ar |
|
|
|
return false; |
|
|
|
//if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG]
|
|
|
|
|
|
|
|
// We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them)
|
|
|
|
window->DC.LastItemRectHoveredRect = IsMouseHoveringRect(bb.Min, bb.Max); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -2235,12 +2238,13 @@ bool ImGui::IsItemHovered() |
|
|
|
ImGuiWindow* window = g.CurrentWindow; |
|
|
|
if (g.NavDisableMouseHover) |
|
|
|
return IsItemFocused(); |
|
|
|
|
|
|
|
if (!window->DC.LastItemRectHoveredRect) |
|
|
|
return false; |
|
|
|
if (g.HoveredWindow != window) |
|
|
|
return false; |
|
|
|
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)) |
|
|
|
return false; |
|
|
|
if (g.NavDisableMouseHover || !IsWindowContentHoverable(window)) |
|
|
|
return false; |
|
|
|
return true; |
|
|
@ -2249,7 +2253,7 @@ bool ImGui::IsItemHovered() |
|
|
|
bool ImGui::IsItemRectHovered() |
|
|
|
{ |
|
|
|
ImGuiWindow* window = GetCurrentWindowRead(); |
|
|
|
return IsMouseHoveringRect(window->DC.LastItemRect.Min, window->DC.LastItemRect.Max); |
|
|
|
return window->DC.LastItemRectHoveredRect; |
|
|
|
} |
|
|
|
|
|
|
|
// Internal facing ItemHoverable() used when submitting widgets. Differs slightly from IsItemHovered().
|
|
|
|