This commit is contained in:
Hanno Braun 2024-11-14 17:30:53 +01:00
parent fde836bc7d
commit c12e7dfd5e
2 changed files with 20 additions and 24 deletions

View File

@ -1,4 +1,4 @@
use super::{movement::Movement, rotation::Rotation, zoom::Zoom, InputEvent};
use super::{movement, rotation::Rotation, zoom::Zoom, InputEvent};
use crate::camera::{Camera, FocusPoint};
/// Input handling abstraction
@ -16,7 +16,7 @@ impl InputHandler {
) {
match event {
InputEvent::Translation { previous, current } => {
Movement::apply(previous, current, focus_point, camera);
movement::apply(previous, current, focus_point, camera);
}
InputEvent::Rotation { angle_x, angle_y } => {
Rotation::apply(angle_x, angle_y, focus_point, camera);

View File

@ -5,15 +5,12 @@ use crate::{
screen::NormalizedScreenPosition,
};
pub struct Movement;
impl Movement {
pub fn apply(
pub fn apply(
previous: NormalizedScreenPosition,
current: NormalizedScreenPosition,
focus_point: FocusPoint,
camera: &mut Camera,
) {
) {
let previous = camera.cursor_to_model_space(previous);
let cursor = camera.cursor_to_model_space(current);
@ -29,5 +26,4 @@ impl Movement {
offset.y,
Scalar::ZERO,
]));
}
}