add scroll deadzone setting

macos-click-through
Keith Simmons 4 years ago
parent f517cf0a68
commit 8168023152

@ -9,6 +9,7 @@ pub struct WindowSettings {
pub transparency: f32, pub transparency: f32,
pub fullscreen: bool, pub fullscreen: bool,
pub iso_layout: bool, pub iso_layout: bool,
pub scroll_dead_zone: f32,
} }
impl Default for WindowSettings { impl Default for WindowSettings {
@ -22,6 +23,7 @@ impl Default for WindowSettings {
.get::<CmdLineSettings>() .get::<CmdLineSettings>()
.neovim_args .neovim_args
.contains(&String::from("--noIdle")), .contains(&String::from("--noIdle")),
scroll_dead_zone: 0.0,
} }
} }
} }

@ -231,13 +231,14 @@ impl GlutinWindowWrapper {
} }
pub fn handle_mouse_wheel(&mut self, x: f32, y: f32) { pub fn handle_mouse_wheel(&mut self, x: f32, y: f32) {
let scroll_dead_zone = SETTINGS.get::<WindowSettings>().scroll_dead_zone;
if !self.mouse_enabled { if !self.mouse_enabled {
return; return;
} }
let vertical_input_type = match y { let vertical_input_type = match y {
_ if y > 1.8 => Some("up"), _ if y > scroll_dead_zone => Some("up"),
_ if y < -1.8 => Some("down"), _ if y < -scroll_dead_zone => Some("down"),
_ => None, _ => None,
}; };
@ -252,8 +253,8 @@ impl GlutinWindowWrapper {
} }
let horizontal_input_type = match x { let horizontal_input_type = match x {
_ if x > 1.8 => Some("right"), _ if x > scroll_dead_zone => Some("right"),
_ if x < -1.8 => Some("left"), _ if x < -scroll_dead_zone => Some("left"),
_ => None, _ => None,
}; };

Loading…
Cancel
Save