From 6dae51622f158c2d3720f4c41c71bf3daeaa3f46 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Mon, 12 Oct 2026 04:21:37 -0400 Subject: [PATCH] Dialogs: vertical-only modals (#937) on the modal_fit layout Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/dialogs.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rs index 6f86bc78..e95a667e 100644 --- a/crates/ui-egui/src/panels/dialogs.rs +++ b/crates/ui-egui/src/panels/dialogs.rs @@ -168,7 +168,8 @@ pub(crate) fn modal_vertical(ctx: &egui::Context, title: &str, size: egui::Vec2, fn modal_with_scroll(ctx: &egui::Context, title: &str, size: egui::Vec2, t: &Tokens, vertical_only: bool, body: impl FnOnce(&mut egui::Ui)) { let max_height = (modal_space(ctx).y - 84.0).max(40.0); modal_fit(ctx, title, size, t, |ui, _| { - egui::ScrollArea::both().max_height(max_height).auto_shrink([false, true]).show(ui, body); + let scroll = if vertical_only { egui::ScrollArea::vertical() } else { egui::ScrollArea::both() }; + scroll.max_height(max_height).auto_shrink([false, true]).show(ui, body); }); } @@ -186,8 +187,7 @@ pub(crate) fn modal_fit(ctx: &egui::Context, title: &str, size: egui::Vec2, t: & // The id stays keyed on the untranslated source, so switching language cannot move it. ui.label(egui::RichText::new(tr(title)).font(Tokens::semibold(15.0)).color(t.tab_text_active)); ui.add_space(10.0); - let scroll = if vertical_only { egui::ScrollArea::vertical() } else { let title_h = ui.cursor() }; - scroll.top() - ui.min_rect().top(); + let title_h = ui.cursor().top() - ui.min_rect().top(); body(ui, (size.y - 36.0 - title_h).max(40.0)); }); }