mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-28 07:47:02 -05:00
Fixed an inconsistency between IsItemHovered() and internal hovering check, where IsItemHovered() would return true if mouse was first clicked on the background of a non-moveable window. (#8877)
This commit is contained in:
@@ -4656,7 +4656,6 @@ static ImGuiHoveredFlags ApplyHoverFlagsForTooltip(ImGuiHoveredFlags user_flags,
|
||||
}
|
||||
|
||||
// This is roughly matching the behavior of internal-facing ItemHoverable()
|
||||
// - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered()
|
||||
// - this should work even for non-interactive items that have no ID, so we cannot use LastItemId
|
||||
bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
||||
{
|
||||
@@ -4698,8 +4697,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
|
||||
const ImGuiID id = g.LastItemData.ID;
|
||||
if ((flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) == 0)
|
||||
if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap)
|
||||
if (g.ActiveId != window->MoveId)
|
||||
return false;
|
||||
return false;
|
||||
|
||||
// Test if interactions on this window are blocked by an active popup or modal.
|
||||
// The ImGuiHoveredFlags_AllowWhenBlockedByPopup flag will be tested here.
|
||||
|
||||
Reference in New Issue
Block a user