mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 21:47:00 +00:00
Begin: Remove unnecessary usage of window_is_new flag, as both fields are zero on window creation.
This commit is contained in:
parent
45466a8cf9
commit
f658edc72a
@ -4270,13 +4270,11 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;
|
||||
|
||||
// Find or create
|
||||
bool window_is_new = false;
|
||||
ImGuiWindow* window = FindWindowByName(name);
|
||||
if (!window)
|
||||
{
|
||||
ImVec2 size_on_first_use = (g.SetNextWindowSizeCond != 0) ? g.SetNextWindowSizeVal : ImVec2(0.0f, 0.0f); // Any condition flag will do since we are creating a new window here.
|
||||
window = CreateNewWindow(name, size_on_first_use, flags);
|
||||
window_is_new = true;
|
||||
}
|
||||
|
||||
const int current_frame = g.FrameCount;
|
||||
@ -4420,8 +4418,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// SIZE
|
||||
|
||||
// Update contents size from last frame for auto-fitting (unless explicitly specified)
|
||||
window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x));
|
||||
window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y));
|
||||
window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : (window->DC.CursorMaxPos.x - window->Pos.x + window->Scroll.x));
|
||||
window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : (window->DC.CursorMaxPos.y - window->Pos.y + window->Scroll.y));
|
||||
window->SizeContents += window->WindowPadding;
|
||||
|
||||
// Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows)
|
||||
|
Loading…
Reference in New Issue
Block a user