Improve event formatting

This commit is contained in:
Reinis Mazeiks committed 2022-06-28 23:46:24 +03:00
1 parent 6a6a028afc
commit c090741c60
3 files changed
+17 -4

No files matched your search

+13 -1
View File
@@ -17,6 +17,7 @@ pub mod on {
use keyboard_types::{Code, Key, Location, Modifiers};
use std::collections::HashMap;
use std::convert::TryInto;
use std::fmt::{Debug, Formatter};
use std::str::FromStr;
use super::*;
@@ -568,7 +569,7 @@ pub mod on {
pub type MouseEvent = UiEvent<MouseData>;
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone)]
#[derive(Clone)]
/// Data associated with a mouse event
///
/// Do not use the deprecated fields; they may change or become private in the future.
@@ -753,6 +754,17 @@ pub mod on {
}
}
impl Debug for MouseData {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("MouseData")
.field("coordinates", &self.coordinates())
.field("modifiers", &self.modifiers())
.field("held_buttons", &self.held_buttons())
.field("trigger_button", &self.trigger_button())
.finish()
}
}
pub type PointerEvent = UiEvent<PointerData>;
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone)]
+1
View File
@@ -96,6 +96,7 @@ impl WheelDelta {
}
/// Coordinates of a point in the app's interface
#[derive(Debug)]
pub struct Coordinates {
screen: ScreenPoint,
client: ClientPoint,