Skip to main content

MouseEvent

Enum MouseEvent 

Source
#[repr(C)]
pub enum MouseEvent { Pressed { position: LogicalPoint, button: PointerEventButton, click_count: u8, is_touch: bool, }, Released { position: LogicalPoint, button: PointerEventButton, click_count: u8, is_touch: bool, }, Moved { position: LogicalPoint, is_touch: bool, }, Wheel { position: LogicalPoint, delta_x: Coord, delta_y: Coord, phase: TouchPhase, }, DragMove(DropEvent), Drop(DropEvent), PinchGesture { position: LogicalPoint, delta: f32, phase: TouchPhase, }, RotationGesture { position: LogicalPoint, delta: f32, phase: TouchPhase, }, Exit, }
Expand description

A mouse or touch event

The only difference with crate::platform::WindowEvent is that it uses untyped Point TODO: merge with platform::WindowEvent

Variants§

§

Pressed

The mouse or finger was pressed

Fields

§position: LogicalPoint

The position of the pointer when the event happened.

§button: PointerEventButton

The button that was pressed.

§click_count: u8

The current click count reported for this press.

§is_touch: bool

Whether the event originated from touch input.

§

Released

The mouse or finger was released

Fields

§position: LogicalPoint

The position of the pointer when the event happened.

§button: PointerEventButton

The button that was released.

§click_count: u8

The current click count reported for this release.

§is_touch: bool

Whether the event originated from touch input.

§

Moved

The position of the pointer has changed

Fields

§position: LogicalPoint

The new position of the pointer.

§is_touch: bool

Whether the event originated from touch input.

§

Wheel

Wheel was operated.

Fields

§position: LogicalPoint

The position of the pointer when the event happened.

§delta_x: Coord

The horizontal scroll delta in logical pixels.

§delta_y: Coord

The vertical scroll delta in logical pixels.

§phase: TouchPhase

The gesture phase reported for the wheel event.

§

DragMove(DropEvent)

The mouse is being dragged over this item. InputEventResult::EventIgnored means that the item does not handle the drag operation and InputEventResult::EventAccepted means that the item can accept it.

§

Drop(DropEvent)

The mouse is released while dragging over this item.

§

PinchGesture

A platform-recognized pinch gesture (macOS/iOS trackpad, Qt).

Fields

§position: LogicalPoint

The focal position of the gesture.

§delta: f32

The incremental scale delta for this gesture update.

§phase: TouchPhase

The gesture phase reported by the platform.

§

RotationGesture

A platform-recognized rotation gesture (macOS/iOS trackpad, Qt).

Fields

§position: LogicalPoint

The focal position of the gesture.

§delta: f32

The incremental rotation in degrees, where positive means clockwise.

§phase: TouchPhase

The gesture phase reported by the platform.

§

Exit

The mouse exited the item or component

Implementations§

Source§

impl MouseEvent

Source

pub fn is_touch(&self) -> Option<bool>

The flag for when event generated from touch

Source

pub fn position(&self) -> Option<LogicalPoint>

The position of the cursor for this event, if any

Source

pub fn translate(&mut self, vec: LogicalVector)

Translate the position by the given value

Source

pub fn transform(&mut self, transform: ItemTransform)

Transform the position by the given item transform.

Trait Implementations§

Source§

impl Clone for MouseEvent

Source§

fn clone(&self) -> MouseEvent

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 MouseEvent

Source§

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

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

impl PartialEq for MouseEvent

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MouseEvent

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,