From 742e53434f4389536b1c723f5d232b7f15415a11 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 27 Mar 2024 11:36:57 +0900 Subject: [PATCH] Child Windows: adjust resizing limits to match window padding rather than inner clipping rectangle. (#7440) --- docs/CHANGELOG.txt | 9 +++++---- imgui.cpp | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e6f53f105..74a201a6a 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -55,10 +55,11 @@ Other changes: - Windows: Scrollbar visibility decision uses current size when both size and contents size are submitted by API. (#7252) - Windows: Double-click to collapse may be disabled via key-ownership mechanism. (#7369) -- Windows: Extend outer resize borders to the edges when there are no corner grips. - Essentially affects resizable child windows. (#7440, #1710) [@cfillion] -- Windows: Resizing logic for child windows evaluates whether per-axis clamping should be - applied based on parent scrollbars, not child scrollbars. (#7440, #1710) [@cfillion] +- Windows: BeginChild(): Extend outer resize borders to the edges when there are no corner + grips. Essentially affects resizable child windows. (#7440, #1710) [@cfillion] +- Windows: BeginChild(): Resizing logic for child windows evaluates whether per-axis clamping + should be applied based on parent scrollbars, not child scrollbars. (#7440, #1710) [@cfillion] + Adjust those resizing limits to match window padding rather than inner clipping rectangle. - Tables: Angled headers: fixed border hit box extending beyond when used within non-scrollable tables. (#7416) [@cfillion] - Tables: Angled headers: fixed borders not moving back up after TableAngleHeadersRow() diff --git a/imgui.cpp b/imgui.cpp index bf5765b47..5832b502f 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6030,11 +6030,12 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si if (flags & ImGuiWindowFlags_ChildWindow) // Clamp resizing of childs within parent { ImGuiWindowFlags parent_flags = window->ParentWindow->Flags; - const ImRect parent_rect = window->ParentWindow->InnerClipRect; + ImRect border_limit_rect = window->ParentWindow->InnerRect; + border_limit_rect.Expand(ImVec2(-ImMax(window->WindowPadding.x, window->WindowBorderSize), -ImMax(window->WindowPadding.y, window->WindowBorderSize))); if ((parent_flags & (ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar)) == 0 || (parent_flags & ImGuiWindowFlags_NoScrollbar)) - border_target.x = ImClamp(border_target.x, parent_rect.Min.x, parent_rect.Max.x); + border_target.x = ImClamp(border_target.x, border_limit_rect.Min.x, border_limit_rect.Max.x); if (parent_flags & ImGuiWindowFlags_NoScrollbar) - border_target.y = ImClamp(border_target.y, parent_rect.Min.y, parent_rect.Max.y); + border_target.y = ImClamp(border_target.y, border_limit_rect.Min.y, border_limit_rect.Max.y); } if (!ignore_resize) CalcResizePosSizeFromAnyCorner(window, border_target, ImMin(def.SegmentN1, def.SegmentN2), &pos_target, &size_target);