Window: Auto-fit size takes account of work rectangle (menu bars eating from viewport). (#5843)

This commit is contained in:
ocornut
2022-11-02 12:36:22 +01:00
parent 86f2af2bc7
commit 6e9dfe1de1
3 changed files with 3 additions and 3 deletions

View File

@ -5732,8 +5732,7 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont
if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
size_min = ImMin(size_min, ImVec2(4.0f, 4.0f));
// FIXME-VIEWPORT-WORKAREA: May want to use GetWorkSize() instead of Size depending on the type of windows?
ImVec2 avail_size = ImGui::GetMainViewport()->Size;
ImVec2 avail_size = ImGui::GetMainViewport()->WorkSize;
ImVec2 size_auto_fit = ImClamp(size_desired, size_min, ImMax(size_min, avail_size - style.DisplaySafeAreaPadding * 2.0f));
// When the window cannot fit all contents (either because of constraints, either because screen is too small),