#[repr(C)]pub struct WebEventMouse {
pub x: js_number,
pub y: js_number,
pub button: u8,
pub buttons: u8,
pub mods: KeyMods,
pub etype: WebEventKind,
pub timestamp: JsInstant,
}event and web only.Expand description
๐ซ ๐ A web API Mouse Event.
๐ sys/os/browser/web
๐ฆ size_of::<WebEventMouse>() == 32 bytes / 256 bits
โ๏ธOption<T>
Represents a JavaScript mouse event containing relevant properties.
ยงCompatibility
Browser Back/Forward mouse buttons are backend-dependent.
Chromium exposes them as DOM mouse events (button 3/4, buttons 8/16).
Firefox currently may consume them for history navigation before the page
receives mousedown/mouseup.
Fieldsยง
ยงx: js_numberThe X-coordinate of the mouse event relative to the viewport.
y: js_numberThe Y-coordinate of the mouse event relative to the viewport.
Raw DOM-compatible button value.
Uses 255 to represent DOM button = -1, meaning no button changed.
Raw DOM buttons bitmask for buttons currently held down.
mods: KeyModsA bitmask of active keyboard modifiers during the mouse event.
etype: WebEventKindThe type of mouse event (Click, MouseDown, MouseMove, etc.).
timestamp: JsInstantThe JavaScript event timestamp.
Implementationsยง
Sourceยงimpl WebEventMouse
impl WebEventMouse
Sourcepub const fn new(
x: js_number,
y: js_number,
button: u8,
buttons: u8,
mods: KeyMods,
etype: WebEventKind,
timestamp: JsInstant,
) -> Self
pub const fn new( x: js_number, y: js_number, button: u8, buttons: u8, mods: KeyMods, etype: WebEventKind, timestamp: JsInstant, ) -> Self
Returns a new WebEventMouse.
Sourceยงimpl WebEventMouse
impl WebEventMouse
Returns the normalized triggering button, or None when no button changed.
Returns the raw DOM-compatible button value.
Returns 255 for DOM button = -1, meaning no button changed.
Returns the normalized held-button set.
Returns the raw DOM buttons bitmask.
Sourcepub const fn to_kind_timed(self) -> EventKindTimed
pub const fn to_kind_timed(self) -> EventKindTimed
Converts WebEventMouse to EventKindTimed.
Sourcepub const fn from_event_mouse_timed(
from: Timed<EventMouse, Option<EventTimestamp>>,
) -> WebEventMouse
pub const fn from_event_mouse_timed( from: Timed<EventMouse, Option<EventTimestamp>>, ) -> WebEventMouse
Converts a timed normalized EventMouse back to WebEventMouse.
Trait Implementationsยง
Sourceยงimpl Clone for WebEventMouse
impl Clone for WebEventMouse
Sourceยงfn clone(&self) -> WebEventMouse
fn clone(&self) -> WebEventMouse
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for WebEventMouse
Sourceยงimpl Debug for WebEventMouse
impl Debug for WebEventMouse
Sourceยงimpl From<Timed<EventMouse, Option<EventTimestamp>>> for WebEventMouse
impl From<Timed<EventMouse, Option<EventTimestamp>>> for WebEventMouse
Sourceยงfn from(from: Timed<EventMouse, Option<EventTimestamp>>) -> Self
fn from(from: Timed<EventMouse, Option<EventTimestamp>>) -> Self
Sourceยงimpl From<WebEventMouse> for EventKindTimed
impl From<WebEventMouse> for EventKindTimed
Sourceยงfn from(from: WebEventMouse) -> Self
fn from(from: WebEventMouse) -> Self
Sourceยงimpl PartialEq for WebEventMouse
impl PartialEq for WebEventMouse
Sourceยงfn eq(&self, other: &WebEventMouse) -> bool
fn eq(&self, other: &WebEventMouse) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for WebEventMouse
Auto Trait Implementationsยง
impl Freeze for WebEventMouse
impl RefUnwindSafe for WebEventMouse
impl Send for WebEventMouse
impl Sync for WebEventMouse
impl Unpin for WebEventMouse
impl UnsafeUnpin for WebEventMouse
impl UnwindSafe for WebEventMouse
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Sourceยงimpl<T> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.