Skip to content

Commit

Permalink
Move more code into fj-viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Nov 18, 2024
1 parent 0ad2699 commit d1854de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
3 changes: 3 additions & 0 deletions crates/fj-viewer/src/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,16 @@ impl Viewer {
/// # Handle a mouse button being pressed
pub fn on_mouse_button_pressed(&mut self, button: MouseButton) {
self.most_recent_mouse_button = Some(button);
self.add_focus_point();
}

/// # Handle a mouse button being pressed
pub fn on_mouse_button_released(&mut self, button: MouseButton) {
if self.most_recent_mouse_button == Some(button) {
self.most_recent_mouse_button = None;
}

self.remove_focus_point();
}

/// Handle the screen being resized
Expand Down
9 changes: 0 additions & 9 deletions crates/fj-window/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,6 @@ impl ApplicationHandler for DisplayState {
viewer.on_cursor_movement([position.x, position.y]);
}
WindowEvent::MouseInput { state, button, .. } => {
match state {
ElementState::Pressed => {
viewer.add_focus_point();
}
ElementState::Released => {
viewer.remove_focus_point();
}
}

let button = match button {
MouseButton::Left => Some(fj_viewer::MouseButton::Left),
MouseButton::Right => Some(fj_viewer::MouseButton::Right),
Expand Down

0 comments on commit d1854de

Please sign in to comment.