mirror of
https://github.com/hannobraun/Fornjot
synced 2025-07-21 17:36:07 +00:00
Simplify
This commit is contained in:
parent
202641052b
commit
96204d4174
@ -1,14 +1,5 @@
|
|||||||
/// An input event
|
/// An input event
|
||||||
pub enum InputEvent {
|
pub enum InputEvent {
|
||||||
/// Rotate the model around the focus point
|
|
||||||
Rotation {
|
|
||||||
/// The angle around the screen x axis to rotate (in radians)
|
|
||||||
angle_x: f64,
|
|
||||||
|
|
||||||
/// The angle around the screen y axis to rotate (in radians)
|
|
||||||
angle_y: f64,
|
|
||||||
},
|
|
||||||
|
|
||||||
/// Move the view forwards and backwards
|
/// Move the view forwards and backwards
|
||||||
Zoom(f64),
|
Zoom(f64),
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,6 @@ impl Viewer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
InputEvent::Rotation { angle_x, angle_y } => {
|
|
||||||
self.camera.apply_rotation(angle_x, angle_y, focus_point);
|
|
||||||
}
|
|
||||||
InputEvent::Zoom(zoom_delta) => {
|
InputEvent::Zoom(zoom_delta) => {
|
||||||
self.camera.apply_zoom(zoom_delta, focus_point);
|
self.camera.apply_zoom(zoom_delta, focus_point);
|
||||||
}
|
}
|
||||||
@ -104,7 +101,15 @@ impl Viewer {
|
|||||||
let angle_y =
|
let angle_y =
|
||||||
diff_x * self.camera_tuning_config.rotation_sensitivity;
|
diff_x * self.camera_tuning_config.rotation_sensitivity;
|
||||||
|
|
||||||
Some(InputEvent::Rotation { angle_x, angle_y })
|
if let Some(focus_point) = self.focus_point {
|
||||||
|
self.camera.apply_rotation(
|
||||||
|
angle_x,
|
||||||
|
angle_y,
|
||||||
|
focus_point,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
}
|
}
|
||||||
MouseButton::Right => {
|
MouseButton::Right => {
|
||||||
if let Some(focus_point) = self.focus_point {
|
if let Some(focus_point) = self.focus_point {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user