pub struct OpenXrInputMapper { /* private fields */ }Expand description
Stateful mapper converting XR frame samples into ailloli_ui_core::Event.
State is keyed by source_id and records the last hit position and button
state so moves, presses, and releases are emitted only on transitions.
§Examples
use ailloli_ui_openxr::OpenXrInputMapper;
let mapper = OpenXrInputMapper::new();
assert!(format!("{mapper:?}").contains("source_state"));Implementations§
Source§impl OpenXrInputMapper
impl OpenXrInputMapper
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a mapper with no remembered sources.
§Examples
use ailloli_ui_openxr::OpenXrInputMapper;
let _: OpenXrInputMapper = OpenXrInputMapper::new();Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Forgets all hover and pressed state without emitting release events.
§Examples
use ailloli_ui_openxr::OpenXrInputMapper;
let mut mapper = OpenXrInputMapper::new();
mapper.clear();Sourcepub fn clear_source(&mut self, source_id: u64)
pub fn clear_source(&mut self, source_id: u64)
Forgets one stable source ID without emitting a release event.
Missing IDs are a no-op.
§Examples
use ailloli_ui_openxr::OpenXrInputMapper;
let mut mapper = OpenXrInputMapper::new();
mapper.clear_source(17);Sourcepub fn map_frame_to_events(
&mut self,
frame: &OpenXrPointerFrame,
modifiers: Modifiers,
) -> Vec<Event>
pub fn map_frame_to_events( &mut self, frame: &OpenXrPointerFrame, modifiers: Modifiers, ) -> Vec<Event>
Builds UI events from a complete pointer frame while tracking transitions.
Samples are mapped in vector order. A hit may emit move, button, then wheel events; a miss emits only a required release at the last hit point.
§Examples
use ailloli_ui_core::event::Modifiers;
use ailloli_ui_openxr::{OpenXrInputMapper, OpenXrPointerFrame};
let events = OpenXrInputMapper::new()
.map_frame_to_events(&OpenXrPointerFrame::new(Vec::new()), Modifiers::default());
assert!(events.is_empty());Trait Implementations§
Source§impl Debug for OpenXrInputMapper
impl Debug for OpenXrInputMapper
Source§impl Default for OpenXrInputMapper
impl Default for OpenXrInputMapper
Source§fn default() -> OpenXrInputMapper
fn default() -> OpenXrInputMapper
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OpenXrInputMapper
impl RefUnwindSafe for OpenXrInputMapper
impl Send for OpenXrInputMapper
impl Sync for OpenXrInputMapper
impl Unpin for OpenXrInputMapper
impl UnwindSafe for OpenXrInputMapper
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().