pub struct PointerSample { /* private fields */ }Expand description
A finite pointer position and its event-time logical viewport.
Both use logical pixels with a top-left origin and downward-positive y. Positions outside the viewport are allowed and are never clamped. Values are immutable, so an action edge can preserve a click’s position even when later motion, resizing, or a DPI change updates the current pointer.
Implementations§
Source§impl PointerSample
impl PointerSample
Sourcepub fn new(
position: LogicalScreenPosition,
viewport: LogicalViewport,
) -> Result<Self, PointerSampleError>
pub fn new( position: LogicalScreenPosition, viewport: LogicalViewport, ) -> Result<Self, PointerSampleError>
Captures coordinates without requiring a window or renderer.
Rejects non-finite positions. The supplied viewport already guarantees finite, strictly positive dimensions through its own constructor.
Sourcepub const fn position(self) -> LogicalScreenPosition
pub const fn position(self) -> LogicalScreenPosition
Returns the captured top-left-relative logical position.
Sourcepub const fn viewport(self) -> LogicalViewport
pub const fn viewport(self) -> LogicalViewport
Returns the viewport captured alongside this position.
Sourcepub fn world_position(self, camera: Camera2d) -> Result<Vec2, Camera2dError>
pub fn world_position(self, camera: Camera2d) -> Result<Vec2, Camera2dError>
Converts this sample to the supplied camera’s depth-zero world plane.
This delegates exactly to Camera2d::screen_to_world, preserving its
projection errors. No active or interpolated camera is chosen implicitly;
callers decide which camera snapshot their interaction should use.
Trait Implementations§
Source§impl Clone for PointerSample
impl Clone for PointerSample
impl Copy for PointerSample
Source§impl Debug for PointerSample
impl Debug for PointerSample
impl Eq for PointerSample
Source§impl Hash for PointerSample
impl Hash for PointerSample
Source§impl PartialEq for PointerSample
impl PartialEq for PointerSample
impl StructuralPartialEq for PointerSample
Auto Trait Implementations§
impl Freeze for PointerSample
impl RefUnwindSafe for PointerSample
impl Send for PointerSample
impl Sync for PointerSample
impl Unpin for PointerSample
impl UnsafeUnpin for PointerSample
impl UnwindSafe for PointerSample
Blanket Implementations§
impl<T> Action for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.