dioxus_use_cursor/hooks/use_cursor/
display.rs1use super::*;
2
3impl Default for UseCursor {
4 fn default() -> Self {
5 Self { data: Rc::new(RefCell::new(Default::default())), listen_mouse_move: None }
6 }
7}
8
9impl Default for UseCursorData {
10 fn default() -> Self {
11 Self {
12 pointer: PointerData {
13 alt_key: false,
14 button: 0,
15 buttons: 0,
16 client_x: 0,
17 client_y: 0,
18 ctrl_key: false,
19 meta_key: false,
20 page_x: 0,
21 page_y: 0,
22 screen_x: 0,
23 screen_y: 0,
24 shift_key: false,
25 pointer_id: 0,
26 width: 0,
27 height: 0,
28 pressure: 0.0,
29 tangential_pressure: 0.0,
30 tilt_x: 0,
31 tilt_y: 0,
32 twist: 0,
33 pointer_type: "".to_string(),
34 is_primary: false,
35 },
36 }
37 }
38}
39
40impl Debug for UseCursor {
41 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
42 f.debug_struct("UseCursor")
43 .field("mouse_data", &self.data.borrow().pointer)
44 .field("listen_mouse_move", &self.listen_mouse_move.is_some())
45 .finish()
46 }
47}
48
49impl Display for UseCursor {
50 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
51 f.debug_tuple("").field(&self.screen_x()).field(&self.screen_y()).finish()
52 }
53}