From 4a4645582601ed8ab09d4a5fd5682452eb3f36ea Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 18 Nov 2024 20:34:57 +0100 Subject: [PATCH] Prepare for follow-on change --- crates/fj-viewer/src/viewer.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index 44d6744e6..441d30eb2 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -91,8 +91,10 @@ impl Viewer { y: -(y / height * 2. - 1.) / aspect_ratio, }; - let event = match (self.cursor, self.most_recent_mouse_button) { - (Some(cursor_old), Some(button)) => match button { + let event = if let (Some(cursor_old), Some(button)) = + (self.cursor, self.most_recent_mouse_button) + { + match button { MouseButton::Left => { let diff_x = cursor_new.x - cursor_old.x; let diff_y = cursor_new.y - cursor_old.y; @@ -121,8 +123,9 @@ impl Viewer { } None } - }, - _ => None, + } + } else { + None }; if let Some(event) = event { self.handle_input_event(event);