Skip to main content

InputEvent

Enum InputEvent 

Source
#[non_exhaustive]
pub enum InputEvent { PointerDown { id: u64, pos: PointCss, button: Button, mods: Modifiers, time_ms: f64, }, PointerMove { id: u64, pos: PointCss, mods: Modifiers, time_ms: f64, }, PointerUp { id: u64, pos: PointCss, button: Button, mods: Modifiers, time_ms: f64, }, PointerLeave, Wheel { pos: PointCss, delta: WheelDelta, mods: Modifiers, }, Pinch { phase: GesturePhase, center: PointCss, scale: f32, }, Key { key: Key, pressed: bool, mods: Modifiers, }, DoubleClick { pos: PointCss, button: Button, }, }
Expand description

A platform-independent input event. Positions are in CSS pixels relative to the chart’s top-left corner.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

PointerDown

A button was pressed or a touch began.

Fields

§id: u64

Pointer id (mouse = 0).

§pos: PointCss

Position.

§button: Button

Button.

§mods: Modifiers

Modifiers.

§time_ms: f64

Event time, same clock as build_frame’s now_ms.

§

PointerMove

The pointer moved.

Fields

§id: u64

Pointer id.

§pos: PointCss

Position.

§mods: Modifiers

Modifiers.

§time_ms: f64

Event time.

§

PointerUp

A button was released or a touch ended.

Fields

§id: u64

Pointer id.

§pos: PointCss

Position.

§button: Button

Button.

§mods: Modifiers

Modifiers.

§time_ms: f64

Event time.

§

PointerLeave

The pointer left the chart.

§

Wheel

Wheel or touchpad scroll.

Fields

§pos: PointCss

Pointer position.

§delta: WheelDelta

Scroll amount.

§mods: Modifiers

Modifiers.

§

Pinch

Touchpad or touch-screen pinch. scale is relative to the previous event.

Fields

§phase: GesturePhase

Phase.

§center: PointCss

Center of the gesture.

§scale: f32

Scale factor since the previous event (> 1 zooms in).

§

Key

A key was pressed or released.

Fields

§key: Key

The key.

§pressed: bool

Pressed (true) or released.

§mods: Modifiers

Modifiers.

§

DoubleClick

Double click / double tap.

Fields

§pos: PointCss

Position.

§button: Button

Button.

Trait Implementations§

Source§

impl Clone for InputEvent

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 Copy for InputEvent

Source§

impl Debug for InputEvent

Source§

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

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

impl PartialEq for InputEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InputEvent

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.