From 0b8c6b9bcefd420ec0e59f0596f0190f6551fc10 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 13 Oct 2023 14:52:08 +0200 Subject: [PATCH] Internals: removed seemingly unused AutoFitChildAxises. The clamp was done on BeginChild(). Amend 2545d75c --- imgui.cpp | 20 +++++--------------- imgui_internal.h | 1 - 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 63d7d141..a07faf05 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5445,7 +5445,6 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b ImGuiWindow* child_window = g.CurrentWindow; child_window->ChildId = id; - child_window->AutoFitChildAxises = (ImS8)auto_fit_axises; // Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually. // While this is not really documented/defined, it seems that the expected thing to do. @@ -5488,22 +5487,13 @@ void ImGui::EndChild() IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls g.WithinEndChild = true; - if (window->BeginCount > 1) + ImVec2 child_size = window->Size; + End(); + if (window->BeginCount == 1) { - End(); - } - else - { - ImVec2 sz = window->Size; - if (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f - sz.x = ImMax(4.0f, sz.x); - if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y)) - sz.y = ImMax(4.0f, sz.y); - End(); - ImGuiWindow* parent_window = g.CurrentWindow; - ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz); - ItemSize(sz); + ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + child_size); + ItemSize(child_size); if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavWindowHasScrollY) && !(window->Flags & ImGuiWindowFlags_NavFlattened)) { ItemAdd(bb, window->ChildId); diff --git a/imgui_internal.h b/imgui_internal.h index f090670b..520d89f0 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -2436,7 +2436,6 @@ struct IMGUI_API ImGuiWindow short FocusOrder; // Order within WindowsFocusOrder[], altered when windows are focused. ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling) ImS8 AutoFitFramesX, AutoFitFramesY; - ImS8 AutoFitChildAxises; bool AutoFitOnlyGrows; ImGuiDir AutoPosLastDirection; ImS8 HiddenFramesCanSkipItems; // Hide the window for N frames