Drag and Drop: tweaked BeginDragDropSource() to remove indent. Added debug log.
This commit is contained in:
parent
661c388515
commit
97a1111b94
13
imgui.cpp
13
imgui.cpp
@ -13096,6 +13096,8 @@ bool ImGui::IsDragDropActive()
|
|||||||
void ImGui::ClearDragDrop()
|
void ImGui::ClearDragDrop()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
|
if (g.DragDropActive)
|
||||||
|
IMGUI_DEBUG_LOG_ACTIVEID("[dragdrop] ClearDragDrop()\n");
|
||||||
g.DragDropActive = false;
|
g.DragDropActive = false;
|
||||||
g.DragDropPayload.Clear();
|
g.DragDropPayload.Clear();
|
||||||
g.DragDropAcceptFlags = ImGuiDragDropFlags_None;
|
g.DragDropAcceptFlags = ImGuiDragDropFlags_None;
|
||||||
@ -13134,7 +13136,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|||||||
bool source_drag_active = false;
|
bool source_drag_active = false;
|
||||||
ImGuiID source_id = 0;
|
ImGuiID source_id = 0;
|
||||||
ImGuiID source_parent_id = 0;
|
ImGuiID source_parent_id = 0;
|
||||||
if (!(flags & ImGuiDragDropFlags_SourceExtern))
|
if ((flags & ImGuiDragDropFlags_SourceExtern) == 0)
|
||||||
{
|
{
|
||||||
source_id = g.LastItemData.ID;
|
source_id = g.LastItemData.ID;
|
||||||
if (source_id != 0)
|
if (source_id != 0)
|
||||||
@ -13196,12 +13198,15 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
IM_ASSERT(g.DragDropWithinTarget == false); // Can't nest BeginDragDropSource() and BeginDragDropTarget()
|
IM_ASSERT(g.DragDropWithinTarget == false); // Can't nest BeginDragDropSource() and BeginDragDropTarget()
|
||||||
if (source_drag_active)
|
if (!source_drag_active)
|
||||||
{
|
return false;
|
||||||
|
|
||||||
|
// Activate drag and drop
|
||||||
if (!g.DragDropActive)
|
if (!g.DragDropActive)
|
||||||
{
|
{
|
||||||
IM_ASSERT(source_id != 0);
|
IM_ASSERT(source_id != 0);
|
||||||
ClearDragDrop();
|
ClearDragDrop();
|
||||||
|
IMGUI_DEBUG_LOG_ACTIVEID("[dragdrop] BeginDragDropSource() DragDropActive = true, source_id = %08X\n", source_id);
|
||||||
ImGuiPayload& payload = g.DragDropPayload;
|
ImGuiPayload& payload = g.DragDropPayload;
|
||||||
payload.SourceId = source_id;
|
payload.SourceId = source_id;
|
||||||
payload.SourceParentId = source_parent_id;
|
payload.SourceParentId = source_parent_id;
|
||||||
@ -13231,8 +13236,6 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|||||||
g.LastItemData.StatusFlags &= ~ImGuiItemStatusFlags_HoveredRect;
|
g.LastItemData.StatusFlags &= ~ImGuiItemStatusFlags_HoveredRect;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::EndDragDropSource()
|
void ImGui::EndDragDropSource()
|
||||||
|
Loading…
Reference in New Issue
Block a user