From d27017daeb58085b8992589322949078fb381628 Mon Sep 17 00:00:00 2001 From: DanS Date: Wed, 10 Jun 2026 23:47:53 -0500 Subject: [PATCH] fix(ui): scale overlay-dialog card width with the font/DPI setting (fixes modal overflow) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every BeginOverlayDialog is passed a raw pixel card width (550, 620, …), but the fonts and spacing inside scale with Layout::dpiScale() — which includes the user's font-size setting. At any non-default scale the content outgrew the fixed card, so text overflowed the card edge and elements misaligned. Scale the card width by dpiScale() (no-op at the default 1.0 scale) and clamp it to the viewport so a large scale can't push it off-screen. Fixes all overlay dialogs at once. Co-Authored-By: Claude Opus 4.8 --- src/ui/material/draw_helpers.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ui/material/draw_helpers.h b/src/ui/material/draw_helpers.h index fd2d1db..94837ca 100644 --- a/src/ui/material/draw_helpers.h +++ b/src/ui/material/draw_helpers.h @@ -924,7 +924,15 @@ inline bool BeginOverlayDialog(const char* title, bool* p_open, float cardWidth ImGuiViewport* vp = ImGui::GetMainViewport(); ImVec2 vp_pos = vp->Pos; ImVec2 vp_size = vp->Size; - + + // Dialog widths are authored as raw pixels, but the fonts/spacing inside scale with + // Layout::dpiScale() (which includes the user's font-size setting). Scale the card by the same + // factor so the content doesn't outgrow a fixed card and overflow/misalign at non-default + // scales. No-op at the default scale (dpiScale() == 1). Clamped to the viewport so a large scale + // can't push the card off-screen. + cardWidth *= Layout::dpiScale(); + cardWidth = std::min(cardWidth, vp_size.x - 32.0f); + // Fullscreen scrim overlay ImGui::SetNextWindowPos(vp_pos); ImGui::SetNextWindowSize(vp_size);