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