2
0
Эх сурвалжийг харах

Contents size is preserved while a window collapsed. Fix auto-resizing window losing their size for one frame when uncollapsed.

omar 6 жил өмнө
parent
commit
d9a84de9d9
2 өөрчлөгдсөн 6 нэмэгдсэн , 2 устгасан
  1. 3 2
      docs/CHANGELOG.txt
  2. 3 0
      imgui.cpp

+ 3 - 2
docs/CHANGELOG.txt

@@ -50,9 +50,10 @@ Other Changes:
   (It does not provide the docking/splitting/merging of windows available in the Docking branch)
 - Added ImGuiWindowFlags_UnsavedDocument window flag to append '*' to title without altering 
   the ID, as a convenience to avoid using the ### operator.
-- Resizing windows from edge is now enabled by default (io.ConfigWindowsResizeFromEdges=true). Note that 
+- Window: Contents size is preserved while a window collapsed. Fix auto-resizing window losing their size for one frame when uncollapsed.
+- Window: Resizing windows from edge is now enabled by default (io.ConfigWindowsResizeFromEdges=true). Note that 
   it only works _if_ the back-end sets ImGuiBackendFlags_HasMouseCursors, which the standard back-end do.
-- Added io.ConfigWindowsMoveFromTitleBarOnly option. Still is ignored by window with no title bars (often popups).
+- Window: Added io.ConfigWindowsMoveFromTitleBarOnly option. Still is ignored by window with no title bars (often popups).
   This affects clamping window within the visible area: with this option enabled title bars need to be visible. (#899)
 - Style: Tweaked default value of style.DisplayWindowPadding from (20,20) to (19,19) so the default style as a value
   which is the same as the title bar height.

+ 3 - 0
imgui.cpp

@@ -4332,6 +4332,9 @@ static ImVec2 CalcSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size)
 
 static ImVec2 CalcSizeContents(ImGuiWindow* window)
 {
+    if (window->Collapsed)
+        return window->SizeContents;
+
     ImVec2 sz;
     sz.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : (window->DC.CursorMaxPos.x - window->Pos.x + window->Scroll.x));
     sz.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : (window->DC.CursorMaxPos.y - window->Pos.y + window->Scroll.y));