mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-06 19:08:28 +00:00
Simplify
This commit is contained in:
parent
803c456d05
commit
202641052b
@ -1,16 +1,5 @@
|
||||
use crate::screen::NormalizedScreenPosition;
|
||||
|
||||
/// An input event
|
||||
pub enum InputEvent {
|
||||
/// Move the model up, down, left or right
|
||||
Translation {
|
||||
/// The normalized position of the cursor before input
|
||||
previous: NormalizedScreenPosition,
|
||||
|
||||
/// The normalized position of the cursor after input
|
||||
current: NormalizedScreenPosition,
|
||||
},
|
||||
|
||||
/// Rotate the model around the focus point
|
||||
Rotation {
|
||||
/// The angle around the screen x axis to rotate (in radians)
|
||||
|
@ -73,10 +73,6 @@ impl Viewer {
|
||||
};
|
||||
|
||||
match event {
|
||||
InputEvent::Translation { previous, current } => {
|
||||
self.camera
|
||||
.apply_translation(previous, current, focus_point);
|
||||
}
|
||||
InputEvent::Rotation { angle_x, angle_y } => {
|
||||
self.camera.apply_rotation(angle_x, angle_y, focus_point);
|
||||
}
|
||||
@ -110,10 +106,16 @@ impl Viewer {
|
||||
|
||||
Some(InputEvent::Rotation { angle_x, angle_y })
|
||||
}
|
||||
MouseButton::Right => Some(InputEvent::Translation {
|
||||
previous: cursor_old,
|
||||
current: cursor_new,
|
||||
}),
|
||||
MouseButton::Right => {
|
||||
if let Some(focus_point) = self.focus_point {
|
||||
self.camera.apply_translation(
|
||||
cursor_old,
|
||||
cursor_new,
|
||||
focus_point,
|
||||
);
|
||||
}
|
||||
None
|
||||
}
|
||||
},
|
||||
_ => None,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user