viewport_lib/interaction/input/action.rs
1//! Semantic action identifiers for the viewport input system.
2
3/// Semantic actions that can be triggered by user input.
4///
5/// Actions are decoupled from their physical triggers (keys/mouse buttons),
6/// enabling future key reconfiguration and context-sensitive bindings.
7#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9#[non_exhaustive]
10pub enum Action {
11 // -- Viewport navigation --
12 /// Rotate the camera around the orbit center (arcball).
13 Orbit,
14 /// Translate the orbit center in the camera plane.
15 Pan,
16 /// Zoom in/out by adjusting camera distance.
17 Zoom,
18 /// Frame the selected object (zoom-to-fit).
19 FocusObject,
20 /// Reset camera to the default view.
21 ResetView,
22 /// Toggle between solid and wireframe render modes.
23 ToggleWireframe,
24 /// Cycle the gizmo mode (Translate -> Rotate -> Scale).
25 CycleGizmoMode,
26
27 // -- Fly mode --
28 /// Enter first-person fly-through mode.
29 EnterFlyMode,
30 /// Move forward in fly mode.
31 FlyForward,
32 /// Move backward in fly mode.
33 FlyBackward,
34 /// Strafe left in fly mode.
35 FlyLeft,
36 /// Strafe right in fly mode.
37 FlyRight,
38 /// Move up in fly mode.
39 FlyUp,
40 /// Move down in fly mode.
41 FlyDown,
42 /// Hold to increase fly-mode movement speed.
43 FlySpeedBoost,
44
45 // -- Object manipulation (keyboard G/R/S) --
46 /// Begin keyboard-driven move (G key).
47 BeginMove,
48 /// Begin keyboard-driven rotate (R key).
49 BeginRotate,
50 /// Begin keyboard-driven scale (S key).
51 BeginScale,
52 /// Constrain transform to the X axis.
53 ConstrainX,
54 /// Constrain transform to the Y axis.
55 ConstrainY,
56 /// Constrain transform to the Z axis.
57 ConstrainZ,
58 /// Shift+X/Y/Z — exclude that axis, operate in the perpendicular plane.
59 ExcludeX,
60 /// Exclude the Y axis; operate in the XZ plane.
61 ExcludeY,
62 /// Exclude the Z axis; operate in the XY plane.
63 ExcludeZ,
64
65 // -- Shared modal --
66 /// Confirm the current operation (Enter / left-click).
67 Confirm,
68 /// Cancel the current operation (Escape / right-click).
69 Cancel,
70
71 // -- Global --
72 /// Undo the last action.
73 Undo,
74 /// Redo the previously undone action.
75 Redo,
76
77 // -- Fly mode speed --
78 /// Increase fly-mode movement speed.
79 FlySpeedIncrease,
80 /// Decrease fly-mode movement speed.
81 FlySpeedDecrease,
82
83 // -- Gizmo --
84 /// Toggle gizmo between World and Local coordinate space.
85 ToggleGizmoSpace,
86
87 // -- Scene object shortcuts --
88 /// Shift+A: open the radial "Add Object" menu.
89 OpenAddMenu,
90 /// X: prompt to delete the currently selected object.
91 DeleteSelected,
92}