Drag and Drop: made BeginDragDropSource() clear the IsItemHovered() by default, added a flag to keep it.
diff --git a/imgui.cpp b/imgui.cpp
index ad4a189..b11a28d 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -10631,6 +10631,10 @@
PushStyleColor(ImGuiCol_PopupBg, GetStyleColorVec4(ImGuiCol_PopupBg) * ImVec4(1.0f, 1.0f, 1.0f, 0.6f));
BeginTooltipEx(ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_ShowBorders);
}
+
+ if (!(flags & ImGuiDragDropFlags_SourceNoDisableHover))
+ window->DC.LastItemRectHoveredRect = false;
+
return true;
}
return false;
diff --git a/imgui_internal.h b/imgui_internal.h
index 5c82ea1..d8dfca1 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -220,9 +220,12 @@
// Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload()
enum ImGuiDragDropFlags_
{
+ // BeginDragDropSource() flags
ImGuiDragDropFlags_SourceNoAutoTooltip = 1 << 0,
- ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 1, // AcceptDragDropPayload() returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
- ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 2, // Do not draw the default highlight rectangle when hovering over target.
+ ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return true, to avoid subsequent user code submitting tooltips.
+ // BeginDragDropTarget() flags
+ ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, // AcceptDragDropPayload() returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
+ ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, // Do not draw the default highlight rectangle when hovering over target.
ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect // For peeking ahead and inspecting the payload before delivery.
};