#[non_exhaustive]pub struct MouseEvent {
pub position: Point<Points>,
pub page_position: Point<Points>,
pub modifiers: Modifiers,
pub pressed_button: Option<MouseButton>,
pub button: Option<MouseButton>,
pub pointer_type: PointerType,
pub pressure: f32,
pub tilt_x: f32,
pub tilt_y: f32,
}Expand description
Where the mouse is over a view (EventKind::MouseEnter,
EventKind::MouseMove, EventKind::MouseLeave), and where a mouse
button was released (EventKind::MouseUp), in points, as GPUI’s
MouseMoveEvent.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.position: Point<Points>Position in the view, its transforms undone.
page_position: Point<Points>Position in the root view the view is in (the surface, or its
modal), as touches’ page.
modifiers: ModifiersThe modifier keys held.
The button held down, if any (a drag).
The button that changed at this event: the released one on
EventKind::MouseUp, none on a move.
pointer_type: PointerTypeWhat the pointer is: the mouse, or a pen over a tablet.
pressure: f32How hard the pointer presses, from 0 to 1, as the DOM’s
PointerEvent.pressure: 0.5 with a button down and 0 without on a
device that has no pressure.
tilt_x: f32The pen’s tilt in degrees, as TouchPoint::tilt_x.
tilt_y: f32The pen’s tilt in degrees, as TouchPoint::tilt_y.
Implementations§
Source§impl MouseEvent
impl MouseEvent
Sourcepub fn with_pointer(
self,
pointer_type: PointerType,
pressure: f32,
tilt_x: f32,
tilt_y: f32,
) -> Self
pub fn with_pointer( self, pointer_type: PointerType, pressure: f32, tilt_x: f32, tilt_y: f32, ) -> Self
The event as reported by a pen (or a pressure-sensing touchpad):
pointer_type, pressure from 0 to 1, and tilt in degrees.
Sourcepub fn new(
position: Point<Points>,
page_position: Point<Points>,
modifiers: Modifiers,
pressed_button: Option<MouseButton>,
) -> Self
pub fn new( position: Point<Points>, page_position: Point<Points>, modifiers: Modifiers, pressed_button: Option<MouseButton>, ) -> Self
The mouse at position in the view and page_position in its root
view, with modifiers held and pressed_button down.
Sourcepub fn released(
position: Point<Points>,
page_position: Point<Points>,
modifiers: Modifiers,
button: MouseButton,
) -> Self
pub fn released( position: Point<Points>, page_position: Point<Points>, modifiers: Modifiers, button: MouseButton, ) -> Self
A mouse button released at position in the view and
page_position in its root view, with modifiers held
(EventKind::MouseUp).