@ -5131,8 +5131,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
if ( display_frame )
{
// Framed header expand a little outside the default padding
frame_bb . Min . x - = ( float ) ( int ) ( window - > WindowPadding . x * 0.5f ) - 1 ;
frame_bb . Max . x + = ( float ) ( int ) ( window - > WindowPadding . x * 0.5f ) - 1 ;
frame_bb . Min . x - = ( float ) ( int ) ( window - > WindowPadding . x * 0.5f ) - 1 ;
frame_bb . Max . x + = ( float ) ( int ) ( window - > WindowPadding . x * 0.5f ) - 1 ;
}
const float text_offset_x = ( g . FontSize + ( display_frame ? padding . x * 3 : padding . x * 2 ) ) ; // Collapser arrow width + Spacing
@ -5229,6 +5229,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
RenderFrame ( frame_bb . Min , frame_bb . Max , col , true , style . FrameRounding ) ;
RenderNavHighlight ( frame_bb , id , nav_highlight_flags ) ;
RenderArrow ( frame_bb . Min + ImVec2 ( padding . x , text_base_offset_y ) , is_open ? ImGuiDir_Down : ImGuiDir_Right , 1.0f ) ;
if ( flags & ImGuiTreeNodeFlags_ClipLabelForTrailingButton )
frame_bb . Max . x - = g . FontSize + style . FramePadding . x ;
if ( g . LogEnabled )
{
// NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.
@ -5355,7 +5357,8 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags
return false ;
ImGuiID id = window - > GetID ( label ) ;
bool is_open = TreeNodeBehavior ( id , flags | ImGuiTreeNodeFlags_CollapsingHeader | ( p_open ? ImGuiTreeNodeFlags_AllowItemOverlap : 0 ) , label ) ;
flags | = ImGuiTreeNodeFlags_CollapsingHeader | ( p_open ? ImGuiTreeNodeFlags_AllowItemOverlap | ImGuiTreeNodeFlags_ClipLabelForTrailingButton : 0 ) ;
bool is_open = TreeNodeBehavior ( id , flags , label ) ;
if ( p_open )
{
// Create a small overlapping close button
@ -5364,8 +5367,9 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags
ImGuiContext & g = * GImGui ;
ImGuiItemHoveredDataBackup last_item_backup ;
float button_size = g . FontSize ;
ImVec2 button_pos = ImVec2 ( ImMin ( window - > DC . LastItemRect . Max . x , window - > ClipRect . Max . x ) - g . Style . FramePadding . x * 2.0f - button_size , window - > DC . LastItemRect . Min . y ) ;
if ( CloseButton ( window - > GetID ( ( void * ) ( ( intptr_t ) id + 1 ) ) , button_pos ) )
float button_x = ImMax ( window - > DC . LastItemRect . Min . x , window - > DC . LastItemRect . Max . x - g . Style . FramePadding . x * 2.0f - button_size ) ;
float button_y = window - > DC . LastItemRect . Min . y ;
if ( CloseButton ( window - > GetID ( ( void * ) ( ( intptr_t ) id + 1 ) ) , ImVec2 ( button_x , button_y ) ) )
* p_open = false ;
last_item_backup . Restore ( ) ;
}