Browse Source

Window: Fixed initial width of collapsed windows not taking account of contents width (broken in 1.67). (#2336, #176)

omar 6 years ago
parent
commit
afc36cf802
2 changed files with 3 additions and 1 deletions
  1. 1 0
      docs/CHANGELOG.txt
  2. 2 1
      imgui.cpp

+ 1 - 0
docs/CHANGELOG.txt

@@ -55,6 +55,7 @@ Other Changes:
   from using style.ItemSpacing.x to style.ItemInnerSpacing.x, the later being expected to be smaller. (#1086)
   from using style.ItemSpacing.x to style.ItemInnerSpacing.x, the later being expected to be smaller. (#1086)
 - RadioButton: Fixed label horizontal alignment to precisely match Checkbox().
 - RadioButton: Fixed label horizontal alignment to precisely match Checkbox().
 - Window: When resizing from an edge, the border is more visible and better follow the rounded corners.
 - Window: When resizing from an edge, the border is more visible and better follow the rounded corners.
+- Window: Fixed initial width of collapsed windows not taking account of contents width (broken in 1.67). (#2336, #176)
 - ListBox: Better optimized when clipped / non-visible.
 - ListBox: Better optimized when clipped / non-visible.
 - InputTextMultiline: Better optimized when clipped / non-visible.
 - InputTextMultiline: Better optimized when clipped / non-visible.
 - ImDrawList: Fixed AddCircle(), AddCircleFilled() angle step being off, which was visible when drawing a "circle"
 - ImDrawList: Fixed AddCircle(), AddCircleFilled() angle step being off, which was visible when drawing a "circle"

+ 2 - 1
imgui.cpp

@@ -4558,7 +4558,8 @@ static ImVec2 CalcSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size)
 static ImVec2 CalcSizeContents(ImGuiWindow* window)
 static ImVec2 CalcSizeContents(ImGuiWindow* window)
 {
 {
     if (window->Collapsed)
     if (window->Collapsed)
-        return window->SizeContents;
+        if (window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)
+            return window->SizeContents;
     if (window->Hidden && window->HiddenFramesForResize == 0 && window->HiddenFramesRegular > 0)
     if (window->Hidden && window->HiddenFramesForResize == 0 && window->HiddenFramesRegular > 0)
         return window->SizeContents;
         return window->SizeContents;