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

docking
omar 6 years ago
parent ccce47c6a2
commit d9a84de9d9

@ -50,9 +50,10 @@ Other Changes:
(It does not provide the docking/splitting/merging of windows available in the Docking branch) (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 - Added ImGuiWindowFlags_UnsavedDocument window flag to append '*' to title without altering
the ID, as a convenience to avoid using the ### operator. 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. 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) 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 - 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. which is the same as the title bar height.

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

Loading…
Cancel
Save