diff --git a/crates/fj-viewer/src/input/handler.rs b/crates/fj-viewer/src/input/handler.rs index 7b7987ac8..a7918dbeb 100644 --- a/crates/fj-viewer/src/input/handler.rs +++ b/crates/fj-viewer/src/input/handler.rs @@ -4,7 +4,7 @@ use fj_interop::mesh::Mesh; use fj_math::{Point, Transform, Vector}; use crate::{ - camera::{Camera, FocusPoint}, + camera::Camera, screen::{Position, Size}, }; @@ -53,8 +53,8 @@ impl Handler { &mut self, event: Event, screen_size: Size, - focus_point: FocusPoint, now: Instant, + mesh: &Mesh>, camera: &mut Camera, actions: &mut Actions, ) { @@ -83,12 +83,18 @@ impl Handler { } Event::Key(Key::MouseLeft, KeyState::Pressed) => { + let focus_point = + camera.focus_point(screen_size, self.cursor(), mesh); + self.rotation.start(focus_point); } Event::Key(Key::MouseLeft, KeyState::Released) => { self.rotation.stop(); } Event::Key(Key::MouseRight, KeyState::Pressed) => { + let focus_point = + camera.focus_point(screen_size, self.cursor(), mesh); + self.movement.start(focus_point, self.cursor); } Event::Key(Key::MouseRight, KeyState::Released) => { diff --git a/crates/fj-window/src/run.rs b/crates/fj-window/src/run.rs index 9e801c274..9764523df 100644 --- a/crates/fj-window/src/run.rs +++ b/crates/fj-window/src/run.rs @@ -210,17 +210,11 @@ pub fn run( if let (Some(event), Some(shape), Some(camera)) = (event, &shape, &mut camera) { - let focus_point = camera.focus_point( - window.size(), - input_handler.cursor(), - &shape.mesh, - ); - input_handler.handle_event( event, window.size(), - focus_point, now, + &shape.mesh, camera, &mut actions, );