mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-11-04 09:44:29 +00:00 
			
		
		
		
	Drag and Drop: made BeginDragDropSource() clear the IsItemHovered() by default, added a flag to keep it.
This commit is contained in:
		@@ -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.
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user