Drag and Drop: moved "drag souce doesn't report as hovered" from ButtonBehavior() to ItemHoverable().

Ensure DragXXX, SliderXXXX, InputText, PlotXXX follow same logic. Amend 251f178a6, a33f0d1f7
This commit is contained in:
ocornut
2023-06-27 14:41:51 +02:00
parent a2f6581171
commit d5d4d709c7
3 changed files with 7 additions and 4 deletions

View File

@ -506,10 +506,6 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
bool pressed = false;
bool hovered = ItemHoverable(bb, id);
// Drag source doesn't report as hovered
if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover))
hovered = false;
// Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button
if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers))
if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))