Skip to content

Commit

Permalink
Internals: removed seemingly unused AutoFitChildAxises.
Browse files Browse the repository at this point in the history
The clamp was done on BeginChild(). Amend 2545d75
  • Loading branch information
ocornut committed Oct 13, 2023
1 parent 12a3c77 commit 0b8c6b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
20 changes: 5 additions & 15 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -5488,22 +5487,13 @@ void ImGui::EndChild()
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls

g.WithinEndChild = true;
if (window->BeginCount > 1)
{
End();
}
else
ImVec2 child_size = window->Size;
End();
if (window->BeginCount == 1)
{
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);
Expand Down
1 change: 0 additions & 1 deletion imgui_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0b8c6b9

Please sign in to comment.