pub struct OpenXrPointerSample {
pub source_id: u64,
pub hit: OpenXrPointerHit,
pub trigger_pressed: bool,
pub scroll_dx: f32,
pub scroll_dy: f32,
}Expand description
Per-source raw pointer sample for one frame.
Scroll values are logical pixel deltas and are zero unless explicitly set.
§Examples
use ailloli_ui_openxr::{OpenXrPointerHit, OpenXrPointerSample};
let sample = OpenXrPointerSample::new(7, OpenXrPointerHit::Miss, false);
assert_eq!(sample.source_id, 7);
assert_eq!((sample.scroll_dx, sample.scroll_dy), (0.0, 0.0));Fields§
§source_id: u64Stable source id (right controller, left controller, head gaze, etc.).
hit: OpenXrPointerHitPointer hit location in logical UI space, or OpenXrPointerHit::Miss.
trigger_pressed: boolPrimary button (trigger/click/trigger-like action).
scroll_dx: f32Horizontal wheel-like delta in logical pixels.
scroll_dy: f32Vertical wheel-like delta in logical pixels.
Implementations§
Source§impl OpenXrPointerSample
impl OpenXrPointerSample
Sourcepub fn new(source_id: u64, hit: OpenXrPointerHit, trigger_pressed: bool) -> Self
pub fn new(source_id: u64, hit: OpenXrPointerHit, trigger_pressed: bool) -> Self
Creates a sample with zero scroll delta.
§Examples
use ailloli_ui_openxr::{OpenXrPointerHit, OpenXrPointerSample};
let sample = OpenXrPointerSample::new(1, OpenXrPointerHit::Miss, true);
assert!(sample.trigger_pressed);
assert_eq!(sample.scroll_dy, 0.0);Sourcepub fn with_scroll(self, scroll_dx: f32, scroll_dy: f32) -> Self
pub fn with_scroll(self, scroll_dx: f32, scroll_dy: f32) -> Self
Replaces both scroll deltas, in logical pixels.
Values are preserved verbatim, including zero and negative deltas.
§Examples
use ailloli_ui_openxr::{OpenXrPointerHit, OpenXrPointerSample};
let sample = OpenXrPointerSample::new(1, OpenXrPointerHit::Miss, false)
.with_scroll(-2.0, 4.0);
assert_eq!((sample.scroll_dx, sample.scroll_dy), (-2.0, 4.0));Trait Implementations§
Source§impl Clone for OpenXrPointerSample
impl Clone for OpenXrPointerSample
Source§fn clone(&self) -> OpenXrPointerSample
fn clone(&self) -> OpenXrPointerSample
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenXrPointerSample
impl Debug for OpenXrPointerSample
Source§impl OpenXrPointerSource for OpenXrPointerSample
impl OpenXrPointerSource for OpenXrPointerSample
Source§fn sample(&self) -> OpenXrPointerSample
fn sample(&self) -> OpenXrPointerSample
Captures the source’s current state for one host polling iteration. Read more
Source§impl PartialEq for OpenXrPointerSample
impl PartialEq for OpenXrPointerSample
impl Copy for OpenXrPointerSample
impl StructuralPartialEq for OpenXrPointerSample
Auto Trait Implementations§
impl Freeze for OpenXrPointerSample
impl RefUnwindSafe for OpenXrPointerSample
impl Send for OpenXrPointerSample
impl Sync for OpenXrPointerSample
impl Unpin for OpenXrPointerSample
impl UnwindSafe for OpenXrPointerSample
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.
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