From bcd85e7cd6247b59e25b4439fabc8e0856ad2046 Mon Sep 17 00:00:00 2001 From: ocornut Date: Thu, 26 Mar 2015 20:14:15 +0000 Subject: [PATCH] Auto contents size aware of enforced vertical scrollbar if window is large than display height. --- imgui.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index df7fae6a..611c330a 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3155,6 +3155,8 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ else { size_auto_fit = ImClamp(window->SizeContents + style.AutoFitPadding, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - style.AutoFitPadding)); + if (size_auto_fit.y < window->SizeContents.y + style.AutoFitPadding.y) + size_auto_fit.x += style.ScrollbarWidth; } const float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding; @@ -9436,7 +9438,7 @@ void ImGui::ShowTestWindow(bool* opened) static bool selected[3] = { false, true, false }; ImGui::Selectable("1. I am selectable", &selected[0]); ImGui::Selectable("2. I am selectable", &selected[1]); - ImGui::Text("3. I am normal text"); + ImGui::Text("3. I am not selectable"); ImGui::Selectable("4. I am selectable", &selected[2]); ImGui::TreePop(); }