Skip to main content

TouchRouter

Struct TouchRouter 

Source
pub struct TouchRouter<F> { /* private fields */ }
Expand description

Routes the fingers on one surface to the shell’s primary and secondary pointers. F is the platform’s identity of a finger. None stands for a mouse, which always drives the primary pointer.

Each method returns whether the shell changed and needs a frame.

Implementations§

Source§

impl<F: Copy + Eq> TouchRouter<F>

Source

pub fn press<R>( &mut self, shell: &mut AppShell<R>, finger: Option<F>, x: f32, y: f32, ) -> bool
where R: Renderer, R::Error: Debug,

A finger, or the mouse, went down at (x, y) in logical pixels.

Source

pub fn moved<R>( &self, shell: &mut AppShell<R>, finger: Option<F>, x: f32, y: f32, ) -> bool
where R: Renderer, R::Error: Debug,

A finger, or the mouse, moved to (x, y). A finger that is not down moves nothing.

Source

pub fn release<R>( &mut self, shell: &mut AppShell<R>, finger: Option<F>, x: f32, y: f32, ) -> bool
where R: Renderer, R::Error: Debug,

A finger, or the mouse, lifted at (x, y). The primary finger’s lift ends the gesture: the secondary fingers are released first, there, and the next finger down drives the primary pointer.

Source

pub fn cancel<R>( &mut self, shell: &mut AppShell<R>, finger: Option<F>, position: Option<(f32, f32)>, ) -> bool
where R: Renderer, R::Error: Debug,

A finger, or the mouse, left without lifting: the system took the touch, or it left the surface. The primary finger’s leaving cancels the gesture. A secondary finger is released at position, or at the origin when the platform gives none.

Trait Implementations§

Source§

impl<F: Debug> Debug for TouchRouter<F>

Source§

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

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

impl<F> Default for TouchRouter<F>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<F> Forget for TouchRouter<F>

§

impl<F> Freeze for TouchRouter<F>
where Option<F>: Freeze, Vec<(F, PointerId)>: Freeze,

§

impl<F> RefUnwindSafe for TouchRouter<F>

§

impl<F> Send for TouchRouter<F>
where Option<F>: Send, Vec<(F, PointerId)>: Send,

§

impl<F> Sync for TouchRouter<F>
where Option<F>: Sync, Vec<(F, PointerId)>: Sync,

§

impl<F> Unpin for TouchRouter<F>
where Option<F>: Unpin, Vec<(F, PointerId)>: Unpin,

§

impl<F> UnsafeUnpin for TouchRouter<F>

§

impl<F> UnwindSafe for TouchRouter<F>

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> ErasedDestructor for T
where T: 'static,

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, 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.