mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Drag and Drop: added ImGuiDragDropFlags_AcceptDrawAsHovered. (#8632)
Not calling SetHoveredId() in that path, does not seem necessary.
This commit is contained in:
parent
b0d3c3a674
commit
bd0e2036e0
3 changed files with 13 additions and 5 deletions
|
|
@ -574,8 +574,9 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
|
||||
// Special mode for Drag and Drop used by openables (tree nodes, tabs etc.)
|
||||
// where holding the button pressed for a long time while drag a payload item triggers the button.
|
||||
if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers))
|
||||
if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
|
||||
if (g.DragDropActive)
|
||||
{
|
||||
if ((flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
|
||||
{
|
||||
hovered = true;
|
||||
SetHoveredID(id);
|
||||
|
|
@ -586,6 +587,9 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||
FocusWindow(window);
|
||||
}
|
||||
}
|
||||
if (g.DragDropAcceptIdPrev == id && (g.DragDropAcceptFlagsPrev & ImGuiDragDropFlags_AcceptDrawAsHovered))
|
||||
hovered = true;
|
||||
}
|
||||
|
||||
if (flatten_hovered_children)
|
||||
g.HoveredWindow = backup_hovered_window;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue