mirror of
https://github.com/ocornut/imgui.git
synced 2026-02-02 01:54:30 +00:00
Drag and Drop: prev/curr storage for DragDropAcceptFlags. ImGuiDragDropFlags_AcceptNoPreviewTooltip test uses DragDropAcceptFlagsPrev for consistency. (#143)
I don't think this would have materialized as a visible bug.
This commit is contained in:
10
imgui.cpp
10
imgui.cpp
@@ -4190,7 +4190,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
||||
DragDropMouseButton = -1;
|
||||
DragDropTargetId = 0;
|
||||
DragDropTargetFullViewport = 0;
|
||||
DragDropAcceptFlags = ImGuiDragDropFlags_None;
|
||||
DragDropAcceptFlagsCurr = DragDropAcceptFlagsPrev = ImGuiDragDropFlags_None;
|
||||
DragDropAcceptIdCurrRectSurface = 0.0f;
|
||||
DragDropAcceptIdPrev = DragDropAcceptIdCurr = 0;
|
||||
DragDropAcceptFrameCount = -1;
|
||||
@@ -5528,6 +5528,8 @@ void ImGui::NewFrame()
|
||||
// Drag and drop
|
||||
g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;
|
||||
g.DragDropAcceptIdCurr = 0;
|
||||
g.DragDropAcceptFlagsPrev = g.DragDropAcceptFlagsCurr;
|
||||
g.DragDropAcceptFlagsCurr = ImGuiDragDropFlags_None;
|
||||
g.DragDropAcceptIdCurrRectSurface = FLT_MAX;
|
||||
g.DragDropWithinSource = false;
|
||||
g.DragDropWithinTarget = false;
|
||||
@@ -14552,7 +14554,7 @@ void ImGui::ClearDragDrop()
|
||||
IMGUI_DEBUG_LOG_ACTIVEID("[dragdrop] ClearDragDrop()\n");
|
||||
g.DragDropActive = false;
|
||||
g.DragDropPayload.Clear();
|
||||
g.DragDropAcceptFlags = ImGuiDragDropFlags_None;
|
||||
g.DragDropAcceptFlagsCurr = ImGuiDragDropFlags_None;
|
||||
g.DragDropAcceptIdCurr = g.DragDropAcceptIdPrev = 0;
|
||||
g.DragDropAcceptIdCurrRectSurface = FLT_MAX;
|
||||
g.DragDropAcceptFrameCount = -1;
|
||||
@@ -14681,7 +14683,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
||||
// Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)
|
||||
// We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.
|
||||
bool ret;
|
||||
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
||||
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlagsPrev & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
||||
ret = BeginTooltipHidden();
|
||||
else
|
||||
ret = BeginTooltip();
|
||||
@@ -14862,7 +14864,7 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop
|
||||
if (r_surface > g.DragDropAcceptIdCurrRectSurface)
|
||||
return NULL;
|
||||
|
||||
g.DragDropAcceptFlags = flags;
|
||||
g.DragDropAcceptFlagsCurr = flags;
|
||||
g.DragDropAcceptIdCurr = g.DragDropTargetId;
|
||||
g.DragDropAcceptIdCurrRectSurface = r_surface;
|
||||
//IMGUI_DEBUG_LOG("AcceptDragDropPayload(): %08X: accept\n", g.DragDropTargetId);
|
||||
|
||||
Reference in New Issue
Block a user