1pub mod button;
2pub use button::*;
3use {
4 crate::{
5 ButtonState,
6 PointerType,
7 mouse::MouseEvent,
8 },
9 dpi::PhysicalPosition,
10 keyboard_types::Modifiers,
11};
12
13#[derive(Clone, Debug, PartialEq)]
14#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
15pub enum PointerEvent {
16 Button {
17 pointer: PointerType,
19 position: PhysicalPosition<f64>,
21 state: ButtonState,
23 button: PointerButton,
25 modifiers: Modifiers,
27 is_double: bool,
29 },
30 Move {
31 pointer: PointerType,
33 position: PhysicalPosition<f64>,
35 },
36 Enter {
37 pointer: PointerType,
39 position: PhysicalPosition<f64>,
41 },
42 Leave {
43 pointer: PointerType,
45 position: PhysicalPosition<f64>,
47 },
48}
49
50impl PointerEvent {
51 pub fn mouse_event(self) -> Option<MouseEvent> {
52 self.try_into().ok()
53 }
54}