From 8e4d9988af1c0ecdb48c3cebc2369186914bda34 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 9 Oct 2026 18:27:56 +0700 Subject: [PATCH] Settings: the dialog no longer scrolls sideways (#284) The page column had a fixed 590 pt width, a few points more than the dialog had beside the page list, so the whole Settings dialog scrolled sideways a little. It takes the rest of the dialog's width now. Test: ui_scrolling settings_dialog_does_not_scroll_sideways. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/panels/settings.rs | 4 +++- crates/ui-egui/tests/ui_scrolling.rs | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/settings.rs b/crates/ui-egui/src/panels/settings.rs index 86cbd8fd..d69e1435 100644 --- a/crates/ui-egui/src/panels/settings.rs +++ b/crates/ui-egui/src/panels/settings.rs @@ -459,7 +459,9 @@ pub fn show(app: &mut EffectcraftApp, ctx: &egui::Context, t: &Tokens) { }); ui.separator(); ui.vertical(|ui| { - ui.set_width(590.0); + // The rest of the dialog's width: a fixed width ran past it, so the whole + // dialog scrolled sideways a little (#284). + ui.set_width(ui.available_width()); let p = &all[idx]; ui.label(RichText::new(p.title).font(Tokens::semibold(14.0)).color(t.tab_text_active)); ui.add_space(6.0); diff --git a/crates/ui-egui/tests/ui_scrolling.rs b/crates/ui-egui/tests/ui_scrolling.rs index 8368f083..5f681623 100644 --- a/crates/ui-egui/tests/ui_scrolling.rs +++ b/crates/ui-egui/tests/ui_scrolling.rs @@ -143,3 +143,23 @@ fn effect_values_stay_clear_of_the_keyframe_navigator() { assert!(value.max.x <= nav.min.x, "the value ({value:?}) ends before the navigator ({nav:?})"); assert!(value.min.x > rect(&h, &format!("effectControls.prop.{uid}.stopwatch")).max.x, "and after the stopwatch"); } + +/// The Settings dialog fits its width: its page column was wider than the dialog, so the whole +/// dialog scrolled sideways a little (#284). +#[test] +fn settings_dialog_does_not_scroll_sideways() { + let mut h = harness(1400.0, 900.0); + let ctx = h.ctx.clone(); + effectcraft_ui_egui::menus::invoke(h.state_mut(), &ctx, "app.settings", json!({"page": "general"})).unwrap(); + h.run_steps(3); + let (ok, page) = (rect(&h, "settings.ok"), rect(&h, "settings.page.general")); + h.input_mut().events.push(Event::PointerMoved(page.center())); + h.input_mut().events.push(Event::MouseWheel { + unit: egui::MouseWheelUnit::Point, + delta: vec2(-400.0, 0.0), + modifiers: Default::default(), + phase: egui::TouchPhase::Move, + }); + h.run_steps(20); + assert_eq!((rect(&h, "settings.ok"), rect(&h, "settings.page.general")), (ok, page), "nothing moved sideways"); +}