pub struct Pointer {
pub x: f32,
pub y: f32,
pub button: PointerButton,
pub kind: PointerKind,
pub id: PointerId,
pub pressure: Option<f32>,
}Expand description
One pointer sample, in logical pixels. The argument shape for
[crate::runtime::RunnerCore::pointer_moved],
[crate::runtime::RunnerCore::pointer_down], and
[crate::runtime::RunnerCore::pointer_up].
Modeled on the DOM PointerEvent interface so backends that
already speak browser pointer events can map fields directly.
button is meaningful on pointer_down / pointer_up and is
ignored on pointer_moved; constructors default it to
PointerButton::Primary for that case.
Fields§
§x: f32X coordinate in logical pixels relative to the window origin.
y: f32Y coordinate in logical pixels relative to the window origin.
Which button this event refers to. Ignored by pointer_moved.
kind: PointerKindPhysical kind of pointer (mouse / touch / pen).
id: PointerIdStable per-pointer ID. Use PointerId::PRIMARY for
single-pointer backends.
pressure: Option<f32>Normalized pressure in 0.0..=1.0 when the device reports it
(pen, force-touch). None when unavailable; mouse backends
always pass None.
Implementations§
Source§impl Pointer
impl Pointer
Sourcepub fn mouse(x: f32, y: f32, button: PointerButton) -> Self
pub fn mouse(x: f32, y: f32, button: PointerButton) -> Self
A mouse-driven pointer at (x, y) for the given button. Use
from mouse-only hosts and synthetic tests.
Sourcepub fn moving(x: f32, y: f32) -> Self
pub fn moving(x: f32, y: f32) -> Self
A mouse pointer for pointer_moved, where button is
irrelevant. Equivalent to
Pointer::mouse(x, y, PointerButton::Primary).
Trait Implementations§
impl Copy for Pointer
impl StructuralPartialEq for Pointer
Auto Trait Implementations§
impl Freeze for Pointer
impl RefUnwindSafe for Pointer
impl Send for Pointer
impl Sync for Pointer
impl Unpin for Pointer
impl UnsafeUnpin for Pointer
impl UnwindSafe for Pointer
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,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.