@ -5287,13 +5287,15 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
{
{
if ( pressed )
if ( pressed )
{
{
const float arrow_x1 = text_pos . x - text_offset_ x;
const float hit_padding_x = style . TouchExtraPadding . x;
const float arrow_ x2 = arrow_x1 + g . FontSize + padding . x * 2.0f ;
const float arrow_ hit_x1 = ( text_pos . x - text_offset_x ) - hit_padding_x ;
toggled = ! ( flags & ( ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick ) ) | | ( g . NavActivateId = = id ) ;
const float arrow_hit_x2 = ( text_pos . x - text_offset_x ) + ( g . FontSize + padding . x * 2.0f ) + hit_padding_x ;
if ( flags & ImGuiTreeNodeFlags_OpenOnArrow )
if ( flags & ImGuiTreeNodeFlags_OpenOnArrow )
toggled | = IsMouseHoveringRect ( ImVec2 ( arrow_x1 , interact_bb . Min . y ) , ImVec2 ( arrow_x2 , interact_bb . Max . y ) ) & & ( ! g . NavDisableMouseHover ) ;
toggled | = ( g . IO . MousePos . x > = arrow_hit_x1 & & g . IO . MousePos . x < arrow_hit_x2 ) & & ( ! g . NavDisableMouseHover ) ; // Lightweight equivalent of IsMouseHoveringRect() since ButtonBehavior() already did the job
if ( flags & ImGuiTreeNodeFlags_OpenOnDoubleClick )
if ( ( flags & ( ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick ) ) = = 0 | | ( g . NavActivateId = = id ) )
toggled | = g . IO . MouseDoubleClicked [ 0 ] ;
toggled = true ;
if ( ( flags & ImGuiTreeNodeFlags_OpenOnDoubleClick ) & & g . IO . MouseDoubleClicked [ 0 ] )
toggled = true ;
if ( g . DragDropActive & & is_open ) // When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again.
if ( g . DragDropActive & & is_open ) // When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again.
toggled = false ;
toggled = false ;
}
}