viewport_lib/interaction/input/context.rs
1//! Per-frame viewport context for the new input pipeline.
2
3/// Per-frame viewport context passed to [`super::controller::OrbitCameraController::begin_frame`]
4/// (and [`super::viewport_input::ViewportInput::begin_frame`]).
5///
6/// Carries the hover, focus, and size state needed to interpret viewport input.
7#[derive(Debug, Clone, Copy)]
8pub struct ViewportContext {
9 /// Whether the pointer is currently hovering over the viewport.
10 pub hovered: bool,
11 /// Whether the viewport currently has keyboard focus.
12 pub focused: bool,
13 /// Viewport size in logical pixels `[width, height]`.
14 pub viewport_size: [f32; 2],
15}
16
17impl Default for ViewportContext {
18 fn default() -> Self {
19 Self {
20 hovered: false,
21 focused: false,
22 viewport_size: [1.0, 1.0],
23 }
24 }
25}