Skip to content

Commit 0b8c6b9

Browse files
committed
Internals: removed seemingly unused AutoFitChildAxises.
The clamp was done on BeginChild(). Amend 2545d75
1 parent 12a3c77 commit 0b8c6b9

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

imgui.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5445,7 +5445,6 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
54455445

54465446
ImGuiWindow* child_window = g.CurrentWindow;
54475447
child_window->ChildId = id;
5448-
child_window->AutoFitChildAxises = (ImS8)auto_fit_axises;
54495448

54505449
// Set the cursor to handle case where the user called SetNextWindowPos()+BeginChild() manually.
54515450
// While this is not really documented/defined, it seems that the expected thing to do.
@@ -5488,22 +5487,13 @@ void ImGui::EndChild()
54885487
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
54895488

54905489
g.WithinEndChild = true;
5491-
if (window->BeginCount > 1)
5492-
{
5493-
End();
5494-
}
5495-
else
5490+
ImVec2 child_size = window->Size;
5491+
End();
5492+
if (window->BeginCount == 1)
54965493
{
5497-
ImVec2 sz = window->Size;
5498-
if (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f
5499-
sz.x = ImMax(4.0f, sz.x);
5500-
if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y))
5501-
sz.y = ImMax(4.0f, sz.y);
5502-
End();
5503-
55045494
ImGuiWindow* parent_window = g.CurrentWindow;
5505-
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
5506-
ItemSize(sz);
5495+
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + child_size);
5496+
ItemSize(child_size);
55075497
if ((window->DC.NavLayersActiveMask != 0 || window->DC.NavWindowHasScrollY) && !(window->Flags & ImGuiWindowFlags_NavFlattened))
55085498
{
55095499
ItemAdd(bb, window->ChildId);

imgui_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2436,7 +2436,6 @@ struct IMGUI_API ImGuiWindow
24362436
short FocusOrder; // Order within WindowsFocusOrder[], altered when windows are focused.
24372437
ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)
24382438
ImS8 AutoFitFramesX, AutoFitFramesY;
2439-
ImS8 AutoFitChildAxises;
24402439
bool AutoFitOnlyGrows;
24412440
ImGuiDir AutoPosLastDirection;
24422441
ImS8 HiddenFramesCanSkipItems; // Hide the window for N frames

0 commit comments

Comments
 (0)