viewport_lib/interaction/input/mode.rs
1/// The current input mode determines which bindings are active.
2#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
3#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4#[non_exhaustive]
5pub enum InputMode {
6 /// Default mode: orbit/pan/zoom, object selection, shortcuts.
7 Normal,
8 /// WASD fly-through camera mode.
9 FlyMode,
10 /// Keyboard-driven object manipulation (G/R/S + axis constraint).
11 Manipulating,
12}
13
14/// How the camera responds to orbit drag input.
15///
16/// Set on [`super::controller::OrbitCameraController`] to switch between the
17/// four navigation styles.
18#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
19#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
20#[non_exhaustive]
21pub enum NavigationMode {
22 /// Unconstrained arcball rotation (default).
23 ///
24 /// Drag rotates the camera freely around the orbit center in any direction.
25 /// Equivalent to the behavior before navigation modes were introduced.
26 #[default]
27 Arcball,
28 /// Yaw around the world Z axis; pitch clamped to ±89°.
29 ///
30 /// The up vector always stays vertical — the camera cannot roll or go
31 /// upside-down. Preferred by users who expect a fixed-up-axis orbit
32 /// (common in scientific / CAD applications).
33 Turntable,
34 /// Pan only — no rotation, no center-aimed zoom.
35 ///
36 /// Drag translates the orbit center in the camera plane. Scroll still
37 /// adjusts the zoom level. Intended for 2D data inspection where orbit
38 /// would be disorienting.
39 Planar,
40 /// First-person fly-through.
41 ///
42 /// Mouse drag acts as mouselook (yaw + pitch with the eye held fixed).
43 /// WASD / Q / E translate the camera position at [`super::controller::OrbitCameraController::fly_speed`]
44 /// units per frame. The `ViewportAll` binding preset must be active for
45 /// the movement keys to be resolved.
46 FirstPerson,
47}