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