pub struct CameraController;Expand description
Stateless helper that maps InputEvents to camera mutations.
All methods are associated functions (no self) because the
controller carries no state – it is a pure function namespace.
The actual state lives in Camera and CameraConstraints.
Implementations§
Source§impl CameraController
impl CameraController
Sourcepub fn zoom(
camera: &mut Camera,
factor: f64,
cursor_x: Option<f64>,
cursor_y: Option<f64>,
constraints: &CameraConstraints,
)
pub fn zoom( camera: &mut Camera, factor: f64, cursor_x: Option<f64>, cursor_y: Option<f64>, constraints: &CameraConstraints, )
Zoom by a multiplicative factor (>1 zooms in, <1 zooms out).
Non-finite, zero, and negative factors are silently ignored.
Sourcepub fn rotate(
camera: &mut Camera,
delta_yaw: f64,
delta_pitch: f64,
constraints: &CameraConstraints,
)
pub fn rotate( camera: &mut Camera, delta_yaw: f64, delta_pitch: f64, constraints: &CameraConstraints, )
Rotate the camera by delta yaw and delta pitch (radians).
Pitch is clamped to CameraConstraints; yaw wraps freely
(normalized to [-?, ?] by the setter).
Sourcepub fn pan(
camera: &mut Camera,
dx: f64,
dy: f64,
cursor_x: Option<f64>,
cursor_y: Option<f64>,
)
pub fn pan( camera: &mut Camera, dx: f64, dy: f64, cursor_x: Option<f64>, cursor_y: Option<f64>, )
Pan the camera by a screen-space pixel delta.
Sourcepub fn handle_event(
camera: &mut Camera,
event: InputEvent,
constraints: &CameraConstraints,
)
pub fn handle_event( camera: &mut Camera, event: InputEvent, constraints: &CameraConstraints, )
Dispatch an InputEvent to the appropriate handler.
Touch events are ignored here — they
should be routed through the
GestureRecognizer first,
which produces derived Pan/Zoom/Rotate events.
Auto Trait Implementations§
impl Freeze for CameraController
impl RefUnwindSafe for CameraController
impl Send for CameraController
impl Sync for CameraController
impl Unpin for CameraController
impl UnsafeUnpin for CameraController
impl UnwindSafe for CameraController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more