#[cfg(feature = "serde")]
use serde::{
Deserialize,
Serialize,
};
#[derive(Copy, Clone, Debug, Default, Eq, Hash, PartialEq, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ButtonState {
#[default]
Down,
Up,
}
impl ButtonState {
pub const fn event_type(self) -> &'static str {
match self {
Self::Down => "mousedown",
Self::Up => "mouseup",
}
}
pub const fn is_down(self) -> bool {
matches!(self, Self::Down)
}
pub const fn is_up(self) -> bool {
matches!(self, Self::Up)
}
}