Overlap: moved ImGuiItemflags_AllowOverlap handling from ButtoBehavior() to ItemHoverable() now that it is possible. (#6512, #3909, #517)

This allows DragXXX, SliderXXX, PlotXXX etc to honor SetNextItemAllowOverlap().
This commit is contained in:
ocornut
2023-06-28 13:51:50 +02:00
parent 4dee919bc0
commit 6137443d24
3 changed files with 13 additions and 13 deletions

View File

@ -531,15 +531,6 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
if (flatten_hovered_children)
g.HoveredWindow = backup_hovered_window;
// AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.
if (item_flags & ImGuiItemflags_AllowOverlap)
{
if (hovered && g.HoveredIdPreviousFrame != id)
hovered = false;
if (g.HoveredId == id) // FIXME: Added this to match legacy SetItemAllowOverlap(). Investigate precise side-effects of using (hovered==true) instead?
g.HoveredIdAllowOverlap = true;
}
// Mouse handling
const ImGuiID test_owner_id = (flags & ImGuiButtonFlags_NoTestKeyOwner) ? ImGuiKeyOwner_Any : id;
if (hovered)