#[repr(C)]pub enum MouseEvent {
Pressed {
position: LogicalPoint,
button: PointerEventButton,
click_count: u8,
touch_finger_id: i32,
},
Released {
position: LogicalPoint,
button: PointerEventButton,
click_count: u8,
touch_finger_id: i32,
},
Moved {
position: LogicalPoint,
touch_finger_id: i32,
},
Wheel {
position: LogicalPoint,
delta_x: Coord,
delta_y: Coord,
phase: TouchPhase,
},
DragMove {
event: DropEvent,
allowed: AllowedDragActions,
},
Drop {
event: DropEvent,
allowed: AllowedDragActions,
},
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: LogicalPointThe position of the pointer when the event happened.
The button that was pressed.
Released
The mouse or finger was released
Fields
position: LogicalPointThe position of the pointer when the event happened.
The button that was released.
Moved
The position of the pointer has changed
Fields
position: LogicalPointThe new position of the pointer.
Wheel
Wheel was operated.
Fields
position: LogicalPointThe position of the pointer when the event happened.
phase: TouchPhaseThe gesture phase reported for the wheel event.
DragMove
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.
Fields
allowed: AllowedDragActionsThe actions the drag source permits.
Drop
The mouse is released while dragging over this item.
Fields
allowed: AllowedDragActionsThe actions the drag source permits.
PinchGesture
A platform-recognized pinch gesture (macOS/iOS trackpad, Qt).
Fields
position: LogicalPointThe focal position of the gesture.
phase: TouchPhaseThe gesture phase reported by the platform.
RotationGesture
A platform-recognized rotation gesture (macOS/iOS trackpad, Qt).
Fields
position: LogicalPointThe focal position of the gesture.
phase: TouchPhaseThe gesture phase reported by the platform.
Exit
The mouse exited the item or component
Implementations§
Source§impl MouseEvent
impl MouseEvent
Sourcepub fn touch_finger_id(&self) -> i32
pub fn touch_finger_id(&self) -> i32
The touch ID if the event originated from touch input.
Sourcepub fn is_from_touch(&self) -> bool
pub fn is_from_touch(&self) -> bool
Whether the event originates from a touch screen rather than a mouse.
Sourcepub fn position(&self) -> Option<LogicalPoint>
pub fn position(&self) -> Option<LogicalPoint>
The position of the cursor for this event, if any
Sourcepub fn translate(&mut self, vec: LogicalVector)
pub fn translate(&mut self, vec: LogicalVector)
Translate the position by the given value
Sourcepub fn transform(&mut self, transform: ItemTransform)
pub fn transform(&mut self, transform: ItemTransform)
Transform the position by the given item transform.