Skip to content

Commit

Permalink
better mouse navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
griffi-gh committed Oct 2, 2023
1 parent 2c5c5f1 commit 13f800e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions yarge-frontend-sdl/src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,20 @@ impl Menu {
Event::KeyDown { keycode: Some(Keycode::Up), .. } if self.active => {
self.cursor -= 1;
},
Event::MouseButtonUp { mouse_btn: MouseButton::Left, .. } |
Event::KeyDown { keycode: Some(Keycode::Return | Keycode::Return2), repeat: false, .. } if self.active => {
self.clicked = true;
Event::MouseWheel { y, .. } => {
//self.scroll -= *y * MENU_ITEM_HEIGHT as i32 / 2;
self.cursor -= *y as isize;
},
Event::MouseMotion { y, .. } |
Event::MouseButtonDown { mouse_btn: MouseButton::Left, y, .. } if self.active => {
self.mouse_navigation = Some(*y);
},
Event::MouseMotion { y, .. } => {
Event::MouseButtonUp { mouse_btn: MouseButton::Left, y, .. } if self.active => {
self.mouse_navigation = Some(*y);
self.clicked = true;
}
Event::KeyDown { keycode: Some(Keycode::Return | Keycode::Return2), repeat: false, .. } if self.active => {
self.clicked = true;
},
_ => ()
}
Expand Down

0 comments on commit 13f800e

Please sign in to comment.