ItemAdd(), not performing computation for IsItemRectHovered() which does them itself, allowing us in the next commit to optimize ItemAdd() and make its logic more consistent with IsHovered().
// Setting LastItemHoveredAndUsable for public facing IsItemHovered(). This is a sensible default, but widgets are free to override it.
// Setting LastItemHoveredAndUsable for public facing IsItemHovered(). This is a sensible default, but widgets are free to override it.
// FIXME: Consider moving this code to IsItemHovered() so it's only evaluated if users needs it.
// FIXME-OPT: Consider moving this code to IsItemHovered() so it's only evaluated if users needs it.
if(IsMouseHoveringRect(bb.Min,bb.Max))
if(IsMouseHoveringRect(bb.Min,bb.Max))
{
{
// Matching the behavior of internal IsHovered() but:
// Matching the behavior of internal IsHovered() but:
// - we are always setting LastItemHoveredRect, which is returned by IsItemRectHovered(), so the order of tests is tweaked to be different.
// - 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())
// - 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())
// [Internal] The user-facing IsItemHovered() is using data emitted from ItemAdd(), with a slightly different logic.
// [Internal] The user-facing IsItemHovered() is using data emitted from ItemAdd(), with a slightly different logic.
@ -10020,13 +10018,16 @@ void ImGui::EndGroup()
ItemAdd(group_bb,NULL);
ItemAdd(group_bb,NULL);
}
}
// If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive() will function on the entire group.
// If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive() will be functional on the entire group.
// It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but if you search for LastItemId you'll notice it is only used in that context.
// It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but if you search for LastItemId you'll notice it is only used in that context.
boolLastItemHoveredAndUsable;// Item rectangle is hovered, and its window is currently interactable with (not blocked by a popup preventing access to the window)
boolLastItemHoveredAndUsable;// Item rectangle is hovered, and its window is currently interactable with (not blocked by a popup preventing access to the window)
boolLastItemHoveredRect;// Item rectangle is hovered, but its window may or not be currently interactable with (might be blocked by a popup preventing access to the window)