Drag and Drop: Added ImGuiDragDropFlags_SourceAutoExpirePayload flag to force payload to expire if the source stops being submitted. (#1725, #143).

This commit is contained in:
omar
2018-07-31 13:44:19 +02:00
parent 79ae6d3bf6
commit faf2c34149
3 changed files with 7 additions and 4 deletions

View File

@ -4441,10 +4441,11 @@ void ImGui::EndFrame()
// Show CTRL+TAB list
if (g.NavWindowingTarget)
NavUpdateWindowingList();
// Drag and Drop: Elapse payload at the end of the frame if mouse has been released
if (g.DragDropActive && g.DragDropPayload.DataFrameCount + 1 < g.FrameCount && !IsMouseDown(g.DragDropMouseButton))
ClearDragDrop();
// Drag and Drop: Elapse payload (if source stops being submitted)
if (g.DragDropActive && g.DragDropPayload.DataFrameCount + 1 < g.FrameCount)
if ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton))
ClearDragDrop();
// Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing.
if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount)