mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-10 18:27:18 +00:00
Move more code into fj-viewer
This commit is contained in:
parent
0ad2699f6d
commit
d1854de28b
@ -121,6 +121,7 @@ impl Viewer {
|
|||||||
/// # Handle a mouse button being pressed
|
/// # Handle a mouse button being pressed
|
||||||
pub fn on_mouse_button_pressed(&mut self, button: MouseButton) {
|
pub fn on_mouse_button_pressed(&mut self, button: MouseButton) {
|
||||||
self.most_recent_mouse_button = Some(button);
|
self.most_recent_mouse_button = Some(button);
|
||||||
|
self.add_focus_point();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Handle a mouse button being pressed
|
/// # Handle a mouse button being pressed
|
||||||
@ -128,6 +129,8 @@ impl Viewer {
|
|||||||
if self.most_recent_mouse_button == Some(button) {
|
if self.most_recent_mouse_button == Some(button) {
|
||||||
self.most_recent_mouse_button = None;
|
self.most_recent_mouse_button = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.remove_focus_point();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle the screen being resized
|
/// Handle the screen being resized
|
||||||
|
@ -121,15 +121,6 @@ impl ApplicationHandler for DisplayState {
|
|||||||
viewer.on_cursor_movement([position.x, position.y]);
|
viewer.on_cursor_movement([position.x, position.y]);
|
||||||
}
|
}
|
||||||
WindowEvent::MouseInput { state, button, .. } => {
|
WindowEvent::MouseInput { state, button, .. } => {
|
||||||
match state {
|
|
||||||
ElementState::Pressed => {
|
|
||||||
viewer.add_focus_point();
|
|
||||||
}
|
|
||||||
ElementState::Released => {
|
|
||||||
viewer.remove_focus_point();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let button = match button {
|
let button = match button {
|
||||||
MouseButton::Left => Some(fj_viewer::MouseButton::Left),
|
MouseButton::Left => Some(fj_viewer::MouseButton::Left),
|
||||||
MouseButton::Right => Some(fj_viewer::MouseButton::Right),
|
MouseButton::Right => Some(fj_viewer::MouseButton::Right),
|
||||||
|
Loading…
Reference in New Issue
Block a user