@ -4452,34 +4452,24 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Calculate auto-fit size, handle automatic resize
// Calculate auto-fit size, handle automatic resize
const ImVec2 size_auto_fit = CalcSizeAutoFit ( window ) ;
const ImVec2 size_auto_fit = CalcSizeAutoFit ( window ) ;
ImVec2 size_for_scrollbars_visibility = window - > SizeFullAtLastBegin ;
ImVec2 size_for_scrollbars_visibility = window - > SizeFullAtLastBegin ;
if ( window- > Collapsed )
if ( flags & ImGuiWindowFlags_AlwaysAutoResize & & ! window- > Collapsed )
{
{
// We still process initial auto-fit on collapsed windows to get a window width,
// Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.
// But otherwise we don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.
if ( ! window_size_x_set_by_api )
if ( window - > AutoFitFramesX > 0 )
window - > SizeFull . x = size_for_scrollbars_visibility . x = size_auto_fit . x ;
window - > SizeFull . x = size_for_scrollbars_visibility . x = window - > AutoFitOnlyGrows ? ImMax ( window - > SizeFull . x , size_auto_fit . x ) : size_auto_fit . x ;
if ( ! window_size_y_set_by_api )
if ( window - > AutoFitFramesY > 0 )
window - > SizeFull . y = size_for_scrollbars_visibility . y = size_auto_fit . y ;
window - > SizeFull . y = size_for_scrollbars_visibility . y = window - > AutoFitOnlyGrows ? ImMax ( window - > SizeFull . y , size_auto_fit . y ) : size_auto_fit . y ;
}
}
else
else if ( window - > AutoFitFramesX > 0 | | window - > AutoFitFramesY > 0 )
{
{
// Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.
// Auto-fit only grows during the first few frames
if ( flags & ImGuiWindowFlags_AlwaysAutoResize )
// We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize ImGuiWindowFlags_AlwaysAutoResize.
{
if ( ! window_size_x_set_by_api & & window - > AutoFitFramesX > 0 )
if ( ! window_size_x_set_by_api )
window - > SizeFull . x = size_for_scrollbars_visibility . x = window - > AutoFitOnlyGrows ? ImMax ( window - > SizeFull . x , size_auto_fit . x ) : size_auto_fit . x ;
window - > SizeFull . x = size_for_scrollbars_visibility . x = size_auto_fit . x ;
if ( ! window_size_y_set_by_api & & window - > AutoFitFramesY > 0 )
if ( ! window_size_y_set_by_api )
window - > SizeFull . y = size_for_scrollbars_visibility . y = window - > AutoFitOnlyGrows ? ImMax ( window - > SizeFull . y , size_auto_fit . y ) : size_auto_fit . y ;
window - > SizeFull . y = size_for_scrollbars_visibility . y = size_auto_fit . y ;
if ( ! window - > Collapsed )
}
else if ( window - > AutoFitFramesX > 0 | | window - > AutoFitFramesY > 0 )
{
// Auto-fit only grows during the first few frames
if ( ! window_size_x_set_by_api & & window - > AutoFitFramesX > 0 )
window - > SizeFull . x = size_for_scrollbars_visibility . x = window - > AutoFitOnlyGrows ? ImMax ( window - > SizeFull . x , size_auto_fit . x ) : size_auto_fit . x ;
if ( ! window_size_y_set_by_api & & window - > AutoFitFramesY > 0 )
window - > SizeFull . y = size_for_scrollbars_visibility . y = window - > AutoFitOnlyGrows ? ImMax ( window - > SizeFull . y , size_auto_fit . y ) : size_auto_fit . y ;
MarkIniSettingsDirty ( window ) ;
MarkIniSettingsDirty ( window ) ;
}
}
}
// Apply minimum/maximum window size constraints and final size
// Apply minimum/maximum window size constraints and final size