diff --git a/crates/ui-egui/src/app/view.rs b/crates/ui-egui/src/app/view.rs index c975b2e1dc..3a951c9f96 100644 --- a/crates/ui-egui/src/app/view.rs +++ b/crates/ui-egui/src/app/view.rs @@ -11,7 +11,7 @@ pub(crate) fn navigation(p: &Prefs) -> NavigationOptions { let mut options = NavigationOptions::default(); options.wheel = if p.zoom_with_mouse_wheel { WheelScheme::Zoom } else { WheelScheme::Scroll }; options.zoom_at_pointer_off_document = true; - options.ctrl_wheel_sideways = p.ctrl_wheel_scrolls_sideways; + options.ctrl_wheel_sideways = p.ctrl_wheel_scrolls_sideways && !p.zoom_with_mouse_wheel; options.animated_zoom = crate::canvas::animated_zoom(p); options.scrubby_zoom = crate::canvas::animated_zoom(p); options.trackpad_rotate = p.trackpad_rotate_view; diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index dccf121e3c..6bde8217c9 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -6905,7 +6905,7 @@ fn a_wheel_pan_under_a_resting_pointer_keeps_the_tool_cursor() { } /// A physical wheel over the pasteboard uses the point under the cursor. Ctrl instead -/// scrolls sideways when the application's Ctrl-wheel preference is on. +/// scrolls sideways when Zoom with Mouse Wheel is off and the Ctrl-wheel preference is on. #[test] fn the_pasteboard_wheel_follows_the_pointer_and_the_horizontal_scroll_preference() { let (mut app, ctx, _) = rectangle_tool(); @@ -6934,9 +6934,14 @@ fn the_pasteboard_wheel_follows_the_pointer_and_the_horizontal_scroll_preference assert!(zoomed.to_doc(at).distance(anchor) < 0.01); let ctrl = egui::Modifiers::CTRL | egui::Modifiers::COMMAND; app_step(&mut app, &ctx, vec![wheel(ctrl)]); + let ctrl_zoomed = app.canvas_view().unwrap(); + assert!(ctrl_zoomed.zoom > zoomed.zoom, "Ctrl-wheel zooms when Zoom with Mouse Wheel is on"); + + app.session.prefs.zoom_with_mouse_wheel = false; + app_step(&mut app, &ctx, vec![wheel(ctrl)]); let panned = app.canvas_view().unwrap(); - assert_ne!(panned.center.x, zoomed.center.x); - assert_eq!((panned.center.y, panned.zoom), (zoomed.center.y, zoomed.zoom)); + assert_ne!(panned.center.x, ctrl_zoomed.center.x); + assert_eq!((panned.center.y, panned.zoom), (ctrl_zoomed.center.y, ctrl_zoomed.zoom)); app.session.prefs.ctrl_wheel_scrolls_sideways = false; assert!(!crate::app::view::navigation(&app.session.prefs).ctrl_wheel_sideways); }