|
@@ -5136,7 +5136,7 @@ void ImGui::EndFrame()
|
|
|
if (g.DragDropActive)
|
|
|
{
|
|
|
bool is_delivered = g.DragDropPayload.Delivery;
|
|
|
- bool is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton));
|
|
|
+ bool is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || g.DragDropMouseButton == -1 || !IsMouseDown(g.DragDropMouseButton));
|
|
|
if (is_delivered || is_elapsed)
|
|
|
ClearDragDrop();
|
|
|
}
|
|
@@ -13239,6 +13239,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|
|
window = NULL;
|
|
|
source_id = ImHashStr("#SourceExtern");
|
|
|
source_drag_active = true;
|
|
|
+ mouse_button = g.IO.MouseDown[0] ? 0 : -1;
|
|
|
KeepAliveID(source_id);
|
|
|
SetActiveID(source_id, NULL);
|
|
|
}
|
|
@@ -13439,7 +13440,10 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop
|
|
|
RenderDragDropTargetRect(r, g.DragDropTargetClipRect);
|
|
|
|
|
|
g.DragDropAcceptFrameCount = g.FrameCount;
|
|
|
- payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting OS window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()
|
|
|
+ if ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) && g.DragDropMouseButton == -1)
|
|
|
+ payload.Delivery = was_accepted_previously && (g.DragDropSourceFrameCount < g.FrameCount);
|
|
|
+ else
|
|
|
+ payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting OS window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()
|
|
|
if (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery))
|
|
|
return NULL;
|
|
|
|