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

This commit is contained in:
omar
2018-12-11 19:08:06 +01:00
parent ccce47c6a2
commit d9a84de9d9
2 changed files with 6 additions and 2 deletions

View File

@ -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));