Skip to content

Commit

Permalink
Merge pull request #29 from PatrickChodowski/rm-unwrap
Browse files Browse the repository at this point in the history
removed unwrap in update_input for mouse cursor position
  • Loading branch information
SergioRibera authored Jun 21, 2024
2 parents 86be179 + 8d40d5d commit 23ab888
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ pub fn update_input(
joystick_state.just_released = true;
} else if let Some(touch_state) = &mut joystick_state.touch_state {
if touch_state.is_mouse {
let new_current = q_windows.single().cursor_position().unwrap();
if new_current != touch_state.current {
touch_state.current = new_current;
if let Some(new_current) = q_windows.single().cursor_position() {
if new_current != touch_state.current {
touch_state.current = new_current;
}
}
} else if let Some(touch) = touches.get_pressed(touch_state.id) {
let touch_position = touch.position();
Expand Down

0 comments on commit 23ab888

Please sign in to comment.