diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 7a3ff9019..e14d32a1a 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -72,8 +72,9 @@ Other Changes: - Config flag io.ConfigWindowsMoveFromTitleBarOnly is now latched during Begin(), effectively allowing to change the value on a per-window basis. (although there is a better internal mechanism for it). - - Fixed single-axis auto-sizing (via double-clicking a border) to - take account of remaining scrollbar on the other axis. (#9060) + - Fixed single-axis auto-sizing (via double-clicking a border or passing + 0.0f on one axis of SetNextWindowSize() call) to take account of remaining + scrollbar on the other axis. (#9060) - Fixed an issue where repeated calls to SetNextWindowSize() using 0.0f to auto-size on a given axis would keep marking ini settings as dirty. - Disabled: fixed a bug when a previously enabled item that got nav focus diff --git a/imgui.cpp b/imgui.cpp index 2c5c73885..949f140ba 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -7585,7 +7585,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) const bool size_auto_fit_y_always = !window_size_y_set_by_api && (flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed; const bool size_auto_fit_x_current = !window_size_x_set_by_api && (window->AutoFitFramesX > 0); const bool size_auto_fit_y_current = !window_size_y_set_by_api && (window->AutoFitFramesY > 0); - const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal, ~0); + int size_auto_fit_mask = 0; + if (size_auto_fit_x_always || size_auto_fit_x_current) + size_auto_fit_mask |= (1 << ImGuiAxis_X); + if (size_auto_fit_y_always || size_auto_fit_y_current) + size_auto_fit_mask |= (1 << ImGuiAxis_Y); + const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal, size_auto_fit_mask); const ImVec2 old_size = window->SizeFull; if (size_auto_fit_x_always || size_auto_fit_x_current)