From a0d724b45079389073e9ae7e42b87ae90aafae7c Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 5 Oct 2017 11:02:23 -0700 Subject: [PATCH] Made AlignFirstTextHeightToWidgets() saner and faster (still disliking its name very much!) --- imgui.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index ad973591..6423c5a6 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5653,10 +5653,9 @@ void ImGui::AlignFirstTextHeightToWidgets() if (window->SkipItems) return; - // Declare a dummy item size to that upcoming items that are smaller will center-align on the newly expanded line height. ImGuiContext& g = *GImGui; - ItemSize(ImVec2(0, g.FontSize + g.Style.FramePadding.y*2), g.Style.FramePadding.y); - SameLine(0, 0); + window->DC.CurrentLineHeight = ImMax(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y * 2); + window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y); } // Add a label+text combo aligned to other label+value widgets