From 6d16ec08b542719e4749b664516a1caaafe3d2b3 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 29 Sep 2025 05:12:37 -0500 Subject: [PATCH] window centering improvements --- src/gui/newFilePicker.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gui/newFilePicker.cpp b/src/gui/newFilePicker.cpp index 3c61104b6..8e49f9e5b 100644 --- a/src/gui/newFilePicker.cpp +++ b/src/gui/newFilePicker.cpp @@ -862,6 +862,11 @@ bool FurnaceFilePicker::draw(ImGuiWindowFlags winFlags) { bool began=false; + // center the window if it is unmovable and not an embed + if ((winFlags&ImGuiWindowFlags_NoMove) && !isEmbed) { + ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(),ImGuiCond_Always,ImVec2(0.5f,0.5f)); + } + if (isEmbed) { began=true; } else if (isModal) { @@ -874,13 +879,6 @@ bool FurnaceFilePicker::draw(ImGuiWindowFlags winFlags) { } if (began) { - // center the window if it is unmovable - if (winFlags&ImGuiWindowFlags_NoMove) { - ImGui::SetWindowPos(ImVec2( - (ImGui::GetMainViewport()->Size.x-ImGui::GetWindowWidth())*0.5f, - (ImGui::GetMainViewport()->Size.y-ImGui::GetWindowHeight())*0.5f) - ); - } // enforce window constraints if necessary if (hasSizeConstraints) { if (ImGui::GetWindowSize().x