From 05b89aab3d0aa36054de94ec0077a8a415babd64 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 20 Jun 2024 18:02:08 +0200 Subject: [PATCH 1/2] removed unwrap in update_input for mouse cursor position --- src/systems.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/systems.rs b/src/systems.rs index 4a285b3..5f1e76d 100644 --- a/src/systems.rs +++ b/src/systems.rs @@ -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(); From 8d40d5dff4af307980947b8d953d2e775636fd34 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 21 Jun 2024 08:08:15 +0200 Subject: [PATCH 2/2] run formatting --- src/systems.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems.rs b/src/systems.rs index 5f1e76d..51121c1 100644 --- a/src/systems.rs +++ b/src/systems.rs @@ -95,7 +95,7 @@ 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 { - if let Some(new_current) = q_windows.single().cursor_position(){ + if let Some(new_current) = q_windows.single().cursor_position() { if new_current != touch_state.current { touch_state.current = new_current; }