mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Drag and Drop: Amend ItemHoverable() logic for item with no identifier.
Amend d5d4d70
This commit is contained in:
parent
d5d4d709c7
commit
836aff3467
10
imgui.cpp
10
imgui.cpp
@ -4050,20 +4050,22 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We exceptionally allow this function to be called with id==0 to allow using it for easy high-level
|
||||||
|
// hover test in widgets code. We could also decide to split this function is two.
|
||||||
|
if (id != 0)
|
||||||
|
{
|
||||||
// Drag source doesn't report as hovered
|
// Drag source doesn't report as hovered
|
||||||
if (g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover))
|
if (g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// We exceptionally allow this function to be called with id==0 to allow using it for easy high-level
|
|
||||||
// hover test in widgets code. We could also decide to split this function is two.
|
|
||||||
if (id != 0)
|
|
||||||
SetHoveredID(id);
|
SetHoveredID(id);
|
||||||
|
}
|
||||||
|
|
||||||
// When disabled we'll return false but still set HoveredId
|
// When disabled we'll return false but still set HoveredId
|
||||||
if (item_flags & ImGuiItemFlags_Disabled)
|
if (item_flags & ImGuiItemFlags_Disabled)
|
||||||
{
|
{
|
||||||
// Release active id if turning disabled
|
// Release active id if turning disabled
|
||||||
if (g.ActiveId == id)
|
if (g.ActiveId == id && id != 0)
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
g.HoveredIdDisabled = true;
|
g.HoveredIdDisabled = true;
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user