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 // -- Numeric input (manipulation mode) --
72 /// Backspace: erase the last typed digit in the numeric buffer.
73 NumericBackspace,
74 /// Tab: advance focus to the next axis buffer in numeric input.
75 NumericNextAxis,
76
77 // -- Global --
78 /// Undo the last action.
79 Undo,
80 /// Redo the previously undone action.
81 Redo,
82
83 // -- Fly mode speed --
84 /// Increase fly-mode movement speed.
85 FlySpeedIncrease,
86 /// Decrease fly-mode movement speed.
87 FlySpeedDecrease,
88
89 // -- Gizmo --
90 /// Toggle gizmo between World and Local coordinate space.
91 ToggleGizmoSpace,
92 /// Cycle the pivot mode forward (Selection Centroid -> Individual Origins -> Median Point -> World Origin -> …).
93 CyclePivotModeForward,
94 /// Cycle the pivot mode backward (… -> World Origin -> Median Point -> Individual Origins -> Selection Centroid).
95 CyclePivotModeBackward,
96
97 // -- Scene object shortcuts --
98 /// Shift+A: open the radial "Add Object" menu.
99 OpenAddMenu,
100 /// X: prompt to delete the currently selected object.
101 DeleteSelected,
102}