Drag and Drop: made BeginDragDropSource() clear the IsItemHovered() by default, added a flag to keep it.

docking
omar 7 years ago
parent c5536e49ef
commit b5f714e9f9

@ -10631,6 +10631,10 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags, int mouse_button)
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;

@ -220,9 +220,12 @@ enum ImGuiSeparatorFlags_
// 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.
};

Loading…
Cancel
Save