Skip to main content

PointerEvent

Struct PointerEvent 

Source
pub struct PointerEvent { /* private fields */ }
Expand description

One pointer event handed to a handler, with its consumption state shared with the Host boundary like KeyEvent’s.

Calling PointerEvent::consume keeps the event from reaching an ancestor’s handler and from doing what the Renderer would otherwise do with it: a consumed Wheel does not scroll, a consumed ContextMenu shows no menu.

Implementations§

Source§

impl PointerEvent

Source

pub fn new( kind: PointerKind, pointer_id: u32, pointer_type: PointerType, x: f32, y: f32, buttons: u32, button: u32, modifiers: u32, click_count: u32, delta_x: f32, delta_y: f32, delta_mode: WheelDeltaMode, timestamp_nanos: u64, ) -> Self

Source

pub fn kind(&self) -> PointerKind

Source

pub fn pointer_id(&self) -> u32

Names one finger, pen or mouse across its events. A mouse is 1.

Source

pub fn pointer_type(&self) -> PointerType

Source

pub fn x(&self) -> f32

Distance from the node’s left edge, in dp. Outside the node while it holds a capture.

Source

pub fn y(&self) -> f32

Distance from the node’s top edge, in dp.

Source

pub fn buttons(&self) -> u32

The buttons held now, as a mask of pointer_button bits.

Source

pub fn button(&self) -> u32

The button that caused this Down or Up, and 0 for any other kind.

Source

pub fn shift_key(&self) -> bool

Source

pub fn ctrl_key(&self) -> bool

Source

pub fn alt_key(&self) -> bool

Source

pub fn meta_key(&self) -> bool

Source

pub fn click_count(&self) -> u32

Consecutive presses in the same place on a Down or Up: 1, 2, and so on.

Source

pub fn delta_x(&self) -> f32

Wheel travel, positive to the right. Zero for any other kind.

Source

pub fn delta_y(&self) -> f32

Wheel travel, positive downward.

Source

pub fn delta_mode(&self) -> WheelDeltaMode

Source

pub fn timestamp_nanos(&self) -> u64

When the OS produced the input, on the monotonic clock render_frame also uses.

Source

pub fn consume(&self)

Source

pub fn consumed(&self) -> bool

Trait Implementations§

Source§

impl Clone for PointerEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PointerEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.