1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Windows: programmatic auto-sizing on a single axis also apply proper logic. (#9060)

This commit is contained in:
ocornut 2025-11-11 21:37:21 +01:00
parent b51f6e073c
commit a2544f9496
2 changed files with 9 additions and 3 deletions

View file

@ -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

View file

@ -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)