From 132b40c19e3ce8c35def79f77b9c29688d5699da Mon Sep 17 00:00:00 2001 From: ice_iix Date: Mon, 29 Jun 2020 18:06:51 -0700 Subject: [PATCH] Fix collapsible_if in main game loop --- src/main.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 208c75c..c999dd2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -507,18 +507,16 @@ fn handle_window_event( game.focused = true; window.window().set_cursor_grab(true).unwrap(); window.window().set_cursor_visible(false); - } else { - if !game.focused { - window.window().set_cursor_grab(false).unwrap(); - window.window().set_cursor_visible(true); - ui_container.click_at( - game, - game.last_mouse_x, - game.last_mouse_y, - width, - height, - ); - } + } else if !game.focused { + window.window().set_cursor_grab(false).unwrap(); + window.window().set_cursor_visible(true); + ui_container.click_at( + game, + game.last_mouse_x, + game.last_mouse_y, + width, + height, + ); } } (ElementState::Pressed, MouseButton::Right) => {