From b4606c34d356a9554112d0465925089905f94c40 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Thu, 28 Sep 2023 10:05:54 +0200 Subject: [PATCH] Fix drag drop logic --- Deliveroo/Windows/ConfigWindow.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Deliveroo/Windows/ConfigWindow.cs b/Deliveroo/Windows/ConfigWindow.cs index 53ceaec..c51de0c 100644 --- a/Deliveroo/Windows/ConfigWindow.cs +++ b/Deliveroo/Windows/ConfigWindow.cs @@ -94,15 +94,18 @@ internal sealed class ConfigWindow : Window ImGui.EndDragDropSource(); } - if (ImGui.BeginDragDropTarget() && - _dragDropSource > 0 && - ImGui.AcceptDragDropPayload("DeliverooDragDrop").NativePtr != null) + if (ImGui.BeginDragDropTarget()) { - itemToAdd = _dragDropSource; - indexToAdd = i; + if (_dragDropSource > 0 && + ImGui.AcceptDragDropPayload("DeliverooDragDrop").NativePtr != null) + { + itemToAdd = _dragDropSource; + indexToAdd = i; + + _dragDropSource = 0; + } ImGui.EndDragDropTarget(); - _dragDropSource = 0; } ImGui.OpenPopupOnItemClick($"###ctx{i}", ImGuiPopupFlags.MouseButtonRight);