pub struct MouseEvent {
pub location: MouseLocation,
pub wheel_delta_v: Option<WheelDelta>,
pub wheel_delta_h: Option<WheelDelta>,
pub is_precision_scroll: Option<PrecisionScroll>,
pub phase: MousePhase,
pub affected_buttons: HashSet<MouseButton>,
pub pressed_buttons: HashSet<MouseButton>,
}Expand description
A MouseEvent represents a pointer event with a specified phase, and the buttons
involved in said phase. The supported phases for mice include Up, Down, and Move.
§Example
The following MouseEvent represents a relative movement of 40 units in the x axis and 20 units in the y axis while holding the primary button (1) down.
let mouse_device_event = input_device::InputDeviceEvent::Mouse(MouseEvent::new(
MouseLocation::Relative(RelativePosition {
millimeters: Position { x: 4.0, y: 2.0 },
}),
Some(1),
Some(1),
MousePhase::Move,
HashSet::from_iter(vec![1]).into_iter()),
HashSet::from_iter(vec![1]).into_iter()),,
));Fields§
§location: MouseLocationThe mouse location.
wheel_delta_v: Option<WheelDelta>The mouse wheel rotated delta in vertical.
wheel_delta_h: Option<WheelDelta>The mouse wheel rotated delta in horizontal.
is_precision_scroll: Option<PrecisionScroll>The mouse device reports precision scroll delta.
phase: MousePhaseThe phase of the [buttons] associated with this input event.
The buttons relevant to this event.
The complete button state including this event.
Implementations§
Source§impl MouseEvent
impl MouseEvent
Sourcepub fn new(
location: MouseLocation,
wheel_delta_v: Option<WheelDelta>,
wheel_delta_h: Option<WheelDelta>,
phase: MousePhase,
affected_buttons: HashSet<MouseButton>,
pressed_buttons: HashSet<MouseButton>,
is_precision_scroll: Option<PrecisionScroll>,
) -> MouseEvent
pub fn new( location: MouseLocation, wheel_delta_v: Option<WheelDelta>, wheel_delta_h: Option<WheelDelta>, phase: MousePhase, affected_buttons: HashSet<MouseButton>, pressed_buttons: HashSet<MouseButton>, is_precision_scroll: Option<PrecisionScroll>, ) -> MouseEvent
Creates a new MouseEvent.
§Parameters
location: The mouse location.phase: The phase of the [buttons] associated with this input event.buttons: The buttons relevant to this event.
pub fn record_inspect(&self, node: &Node)
Trait Implementations§
Source§impl Clone for MouseEvent
impl Clone for MouseEvent
Source§fn clone(&self) -> MouseEvent
fn clone(&self) -> MouseEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MouseEvent
impl Debug for MouseEvent
Source§impl PartialEq for MouseEvent
impl PartialEq for MouseEvent
impl StructuralPartialEq for MouseEvent
Auto Trait Implementations§
impl Freeze for MouseEvent
impl RefUnwindSafe for MouseEvent
impl Send for MouseEvent
impl Sync for MouseEvent
impl Unpin for MouseEvent
impl UnwindSafe for MouseEvent
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more