Skip to main content

MouseEvent

Struct MouseEvent 

Source
pub struct MouseEvent {
    pub event: Event,
    pub client_x: f64,
    pub client_y: f64,
    pub button: i32,
    pub detail: i32,
    pub alt_key: bool,
    pub ctrl_key: bool,
    pub meta_key: bool,
    pub shift_key: bool,
    pub target_key: Option<NodeKey>,
}
Expand description

A DOM MouseEvent (and the PointerEvent fields Lexical reads), with the node the app hit in place of the DOM target.

Fields§

§event: Event§client_x: f64§client_y: f64§button: i32§detail: i32§alt_key: bool§ctrl_key: bool§meta_key: bool§shift_key: bool§target_key: Option<NodeKey>

The key of the node under the pointer, as the app resolves it (Swift’s targetKey).

Implementations§

Source§

impl MouseEvent

Source

pub fn new(type_: &str) -> Self

A mouse event of type_ at (0, 0), with the main button, one click and no modifiers.

Methods from Deref<Target = Event>§

Source

pub fn prevent_default(&self)

preventDefault(): a cancelable event’s default action is not to happen.

Source

pub fn default_prevented(&self) -> bool

defaultPrevented.

Source

pub fn stop_propagation(&self)

stopPropagation().

Source

pub fn propagation_stopped(&self) -> bool

Whether stopPropagation() was called.

Trait Implementations§

Source§

impl Debug for MouseEvent

Source§

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

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

impl Default for MouseEvent

Source§

fn default() -> Self

A click.

Source§

impl Deref for MouseEvent

Source§

type Target = Event

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Event

Dereferences the value.
Source§

impl KeyboardEventModifiers for MouseEvent

Source§

fn key(&self) -> &str

Source§

fn code(&self) -> &str

Source§

fn alt_key(&self) -> bool

Source§

fn ctrl_key(&self) -> bool

Source§

fn meta_key(&self) -> bool

Source§

fn shift_key(&self) -> bool

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.