pub struct Viewport {
pub extents: Option<[[f32; 2]; 2]>,
pub viewport_to_context_transform: Option<[f32; 9]>,
}Expand description
A rectangular region that directs injected events into a target.
The viewport relates a pointer’s position across multiple independent coordinate systems: the context, the viewport, and the dispatch clients. Intuitively, the viewport is how a pointer’s position is mapped to an interactive part of the scene.
A matrix is used to relate the viewport coordinate system to the context coordinate system. A pair of extents defines the viewport’s size in the viewport coordinate system. Together, they define the viewport’s placement in the context coordinate system.
The viewport coordinate system is used to convey a pointer’s coordinates in a scale-invariant way to dispatch clients, so that pointer movement can be interpreted correctly under effects like magnification. The context defines the viewport’s minimal and maximal extents in the viewport coordinate system.
- The boundary of the viewport, a rectangle, is axis aligned with the viewport coordinate system; however it may otherwise be freely positioned (“float”) within it: there is translation and scaling, but no rotation.
- Floating gives the injector some choice in how to convey coordinates, such as in Vulkan NDC, or in display pixel coordinates.
- The viewport rectangle defines a latch region used in dispatch (described below).
A dispatch client receives a pointer’s coordinates in the viewport coordinate system, along with a matrix to convert coordinates from the viewport coordinate system to the dispatch client’s coordinate system.
All fields required.
TODO(https://fxbug.dev/42162296): Rename Viewport, it is used in Flatland.
Fields§
§extents: Option<[[f32; 2]; 2]>§viewport_to_context_transform: Option<[f32; 9]>Trait Implementations§
Source§impl<'a, ___E> Encode<Viewport<'static>, ___E> for &'a Viewportwhere
___E: Encoder + ?Sized,
impl<'a, ___E> Encode<Viewport<'static>, ___E> for &'a Viewportwhere
___E: Encoder + ?Sized,
Source§impl<___E> Encode<Viewport<'static>, ___E> for Viewportwhere
___E: Encoder + ?Sized,
impl<___E> Encode<Viewport<'static>, ___E> for Viewportwhere
___E: Encoder + ?Sized,
Source§impl<'de> FromWireRef<Viewport<'de>> for Viewport
impl<'de> FromWireRef<Viewport<'de>> for Viewport
Source§fn from_wire_ref(wire: &Viewport<'de>) -> Self
fn from_wire_ref(wire: &Viewport<'de>) -> Self
Source§impl PartialOrd for Viewport
impl PartialOrd for Viewport
impl Copy for Viewport
impl StructuralPartialEq for Viewport
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnsafeUnpin for Viewport
impl UnwindSafe for Viewport
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, W> FromWireOption<Box<'_, W>> for Twhere
T: FromWire<W>,
impl<T, W> FromWireOption<Box<'_, W>> for Twhere
T: FromWire<W>,
§fn from_wire_option(wire: Box<'_, W>) -> Option<T>
fn from_wire_option(wire: Box<'_, W>) -> Option<T>
§impl<T, W> FromWireOptionRef<Box<'_, W>> for Twhere
T: FromWireRef<W>,
impl<T, W> FromWireOptionRef<Box<'_, W>> for Twhere
T: FromWireRef<W>,
§fn from_wire_option_ref(wire: &Box<'_, W>) -> Option<T>
fn from_wire_option_ref(wire: &Box<'_, W>) -> Option<T>
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]