From 406a53fd3aa9711f4318a784da3e92a451b3e647 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 22 May 2026 23:25:23 -0500 Subject: [PATCH] [studio] Fix DPI scaling for New and New Project popups --- .../studio/applib/src/popups/newmenu.cpp | 21 +++++++++++-------- .../studio/applib/src/popups/newproject.cpp | 5 +++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/olympic/studio/applib/src/popups/newmenu.cpp b/src/olympic/studio/applib/src/popups/newmenu.cpp index 9e6d68da..f0189e65 100644 --- a/src/olympic/studio/applib/src/popups/newmenu.cpp +++ b/src/olympic/studio/applib/src/popups/newmenu.cpp @@ -134,9 +134,10 @@ void NewMenu::drawNewItemPath(Context &sctx) noexcept { } void NewMenu::drawButtons(Stage const next) noexcept { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20); - constexpr ImVec2 btnSz{60, 20}; + auto const scale = ig::dpiScale(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198 * scale); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22 * scale); + ImVec2 const btnSz{60 * scale, ig::BtnSz.y * scale}; if (ImGui::Button("Back", btnSz)) { if (auto const p = m_prev.back(); p.ok()) { m_stage = *p.value; @@ -156,9 +157,10 @@ void NewMenu::drawButtons(Stage const next) noexcept { } void NewMenu::drawFirstPageButtons(Stage const next) noexcept { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 130); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20); - constexpr ImVec2 btnSz{60, 20}; + auto const scale = ig::dpiScale(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 130 * scale); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22 * scale); + ImVec2 const btnSz{60 * scale, ig::BtnSz.y * scale}; if (ImGui::Button("Next", btnSz)) { m_prev.emplace_back(m_stage); m_stage = next; @@ -171,9 +173,10 @@ void NewMenu::drawFirstPageButtons(Stage const next) noexcept { } void NewMenu::drawLastPageButtons(Context &sctx) noexcept { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 20); - constexpr ImVec2 btnSz{60, 20}; + auto const scale = ig::dpiScale(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 198 * scale); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22 * scale); + ImVec2 const btnSz{60 * scale, ig::BtnSz.y * scale}; if (ImGui::Button("Back", btnSz)) { if (auto const p = m_prev.back(); p.ok()) { m_stage = *p.value; diff --git a/src/olympic/studio/applib/src/popups/newproject.cpp b/src/olympic/studio/applib/src/popups/newproject.cpp index 2e2038a6..1853e121 100644 --- a/src/olympic/studio/applib/src/popups/newproject.cpp +++ b/src/olympic/studio/applib/src/popups/newproject.cpp @@ -65,8 +65,9 @@ void NewProject::drawNewProjectName(Context &sctx) noexcept { } void NewProject::drawLastPageButtons(Context&) noexcept { - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 110); - ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22); + auto const scale = ig::dpiScale(); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 110 * scale); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + ImGui::GetContentRegionAvail().y - 22 * scale); if (ig::PushButton("Finish")) { finish(); }