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);