Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Settings: the dialog no longer scrolls sideways (#284)

bflatastic8e4d9988af1c
diff --git a/crates/ui-egui/src/panels/settings.rs b/crates/ui-egui/src/panels/settings.rs
index 86cbd8fdc..d69e14350 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 8368f0832..5f6816230 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");
+}