@ -8764,16 +8764,16 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
return false ;
return false ;
}
}
// Early out
if ( ( window - > DC . LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect ) = = 0 & & ( g . ActiveId = = 0 | | g . ActiveIdWindow ! = window ) )
return false ;
// Magic fallback (=somehow reprehensible) to handle items with no assigned ID, e.g. Text(), Image()
// Magic fallback (=somehow reprehensible) to handle items with no assigned ID, e.g. Text(), Image()
// We build a throwaway ID based on current ID stack + relative AABB of items in window.
// We build a throwaway ID based on current ID stack + relative AABB of items in window.
// THE IDENTIFIER WON'T SURVIVE ANY REPOSITIONING OF THE WIDGET, so if your widget moves your dragging operation will be canceled.
// THE IDENTIFIER WON'T SURVIVE ANY REPOSITIONING OF THE WIDGET, so if your widget moves your dragging operation will be canceled.
// We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.
// We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.
bool is_hovered = ( window - > DC . LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect ) ! = 0 ;
if ( ! is_hovered & & ( g . ActiveId = = 0 | | g . ActiveIdWindow ! = window ) )
return false ;
source_id = window - > DC . LastItemId = window - > GetIDFromRectangle ( window - > DC . LastItemRect ) ;
source_id = window - > DC . LastItemId = window - > GetIDFromRectangle ( window - > DC . LastItemRect ) ;
if ( is_hovered )
bool is_hovered = ItemHoverable ( window - > DC . LastItemRect , source_id ) ;
SetHoveredID ( source_id ) ;
if ( is_hovered & & g . IO . MouseClicked [ mouse_button ] )
if ( is_hovered & & g . IO . MouseClicked [ mouse_button ] )
{
{
SetActiveID ( source_id , window ) ;
SetActiveID ( source_id , window ) ;