Honor the wheel zoom preference before sideways Ctrl-wheel

This commit is contained in:
FredApps
2026-12-04 05:15:27 +01:00
committed by GitHub
parent 64761d5b32
commit a87cfce5e0
2 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -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;
+8 -3
View File
@@ -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);
}