From ad00d88923072413b7cb2be8f123e224995aae02 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 25 Aug 2015 15:01:33 +0100 Subject: [PATCH] Window clipping rect fixes (for child windows with borders among others) --- imgui.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index ae51ada1d..af56f5ef1 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3906,9 +3906,11 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ // We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame // Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior. const ImRect title_bar_rect = window->TitleBarRect(); - ImVec4 clip_rect(title_bar_rect.Min.x+0.5f+window->WindowPadding.x*0.5f, title_bar_rect.Max.y+window->MenuBarHeight()+0.5f, window->Rect().Max.x+0.5f-window->WindowPadding.x*0.5f, window->Rect().Max.y-1.5f); + ImRect clip_rect(title_bar_rect.Min.x+0.5f+window->WindowPadding.x*0.5f, title_bar_rect.Max.y+window->MenuBarHeight()+0.5f, window->Pos.x+window->Size.x+0.5f-window->WindowPadding.x*0.5f, window->Pos.y+window->Size.y+0.5f); + if ((flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_ShowBorders)) + clip_rect.Min += ImVec2(1.0f,1.0f); if (window->ScrollbarY) - clip_rect.z -= style.ScrollbarWidth; + clip_rect.Max.x -= style.ScrollbarWidth; PushClipRect(clip_rect); // Clear 'accessed' flag last thing