Skip to content

Commit

Permalink
#686 Fix mouse wheel scroll direction
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Sep 21, 2022
1 parent 1cdd6ae commit 59adad7
Show file tree
Hide file tree
Showing 3 changed files with 740 additions and 729 deletions.
4 changes: 4 additions & 0 deletions main/src/domain/mouse/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ pub trait Mouse {

fn adjust_cursor_position(&mut self, x_delta: i32, y_delta: i32) -> Result<(), &'static str>;

/// Invokes the scroll wheel.
///
/// - On the x axis, positive delta scrolls right and negative left.
/// - On the y axis, positive delta scrolls up and negative down.
fn scroll(&mut self, axis: Axis, delta: i32) -> Result<(), &'static str>;

fn press(&mut self, button: MouseButton) -> Result<(), &'static str>;
Expand Down
2 changes: 1 addition & 1 deletion main/src/domain/mouse/enigo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Mouse for EnigoMouse {
fn scroll(&mut self, axis: Axis, delta: i32) -> Result<(), &'static str> {
match axis {
Axis::X => self.0.mouse_scroll_x(delta),
Axis::Y => self.0.mouse_scroll_y(delta),
Axis::Y => self.0.mouse_scroll_y(-delta),
}
Ok(())
}
Expand Down
Loading

0 comments on commit 59adad7

Please sign in to comment.