PrimaryPointerState

Struct PrimaryPointerState 

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

A stateful view of the primary pointer.

Implementations§

Source§

impl PrimaryPointerState

Source

pub fn is_just_pressed(&self, button: PointerButton) -> bool

Return true if the button was pressed within the last frame.

This corresponds to having received a PointerEvent::Down event for that button on the primary pointing device.

Source

pub fn is_just_released(&self, button: PointerButton) -> bool

Return true if the button was released within the last frame.

This corresponds to having received a PointerEvent::Up event for that button on the primary pointing device.

Source

pub fn is_auxiliary_just_pressed(&self) -> bool

Return true if the Auxiliary button (usually middle mouse) was pressed within the last frame.

Source

pub fn is_auxiliary_just_released(&self) -> bool

Return true if the Auxiliary button was released within the last frame.

Source

pub fn is_primary_just_pressed(&self) -> bool

Return true if the Primary button (usually left mouse) was pressed within the last frame.

Source

pub fn is_primary_just_released(&self) -> bool

Return true if the Primary button was released within the last frame.

Source

pub fn is_secondary_just_pressed(&self) -> bool

Return true if the Secondary button (usually right mouse) was pressed within the last frame.

Source

pub fn is_secondary_just_released(&self) -> bool

Return true if the Secondary button was released within the last frame.

Source

pub fn is_any_down(&self) -> bool

Return true if any button is currently held down.

Source

pub fn is_down(&self, button: PointerButton) -> bool

Return true if the specified button is currently held down.

Source

pub fn clear_frame(&mut self)

Clear the per-frame state to prepare for a new frame.

Source

pub fn current_position(&self) -> PhysicalPosition<f64>

Current position.

This will only give known positions.

Source

pub fn current_logical_position(&self) -> LogicalPosition<f64>

Current position (in logical units).

This will only give known positions.

Source

pub fn motion(&self) -> PhysicalPosition<f64>

Relative motion this frame.

Source

pub fn logical_motion(&self) -> LogicalPosition<f64>

Relative motion this frame.

Source

pub fn process_pointer_event(&mut self, event: PointerEvent)

Update the state based on the given pointer event.

Only events from the primary pointer are processed. Press and release events update the just_pressed, just_released, and down states.

Trait Implementations§

Source§

impl Clone for PrimaryPointerState

Source§

fn clone(&self) -> PrimaryPointerState

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PrimaryPointerState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PrimaryPointerState

Source§

fn default() -> PrimaryPointerState

Returns the “default value” for a type. 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.