diff --git a/src/window/settings.rs b/src/window/settings.rs index 36ae4eb..e822991 100644 --- a/src/window/settings.rs +++ b/src/window/settings.rs @@ -9,6 +9,7 @@ pub struct WindowSettings { pub transparency: f32, pub fullscreen: bool, pub iso_layout: bool, + pub scroll_dead_zone: f32, } impl Default for WindowSettings { @@ -22,6 +23,7 @@ impl Default for WindowSettings { .get::() .neovim_args .contains(&String::from("--noIdle")), + scroll_dead_zone: 0.0, } } } diff --git a/src/window/window_wrapper/mod.rs b/src/window/window_wrapper/mod.rs index 9246afb..0569c74 100644 --- a/src/window/window_wrapper/mod.rs +++ b/src/window/window_wrapper/mod.rs @@ -231,13 +231,14 @@ impl GlutinWindowWrapper { } pub fn handle_mouse_wheel(&mut self, x: f32, y: f32) { + let scroll_dead_zone = SETTINGS.get::().scroll_dead_zone; if !self.mouse_enabled { return; } let vertical_input_type = match y { - _ if y > 1.8 => Some("up"), - _ if y < -1.8 => Some("down"), + _ if y > scroll_dead_zone => Some("up"), + _ if y < -scroll_dead_zone => Some("down"), _ => None, }; @@ -252,8 +253,8 @@ impl GlutinWindowWrapper { } let horizontal_input_type = match x { - _ if x > 1.8 => Some("right"), - _ if x < -1.8 => Some("left"), + _ if x > scroll_dead_zone => Some("right"), + _ if x < -scroll_dead_zone => Some("left"), _ => None, };