use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum Flip {
#[default]
None,
Horizontal,
Vertical,
Both,
}
impl Flip {
pub fn is_flipped_horizontal(&self) -> bool {
matches!(self, Self::Horizontal | Self::Both)
}
pub fn is_flipped_vertical(&self) -> bool {
matches!(self, Self::Vertical | Self::Both)
}
#[must_use]
pub fn toggle_horizontal(&self) -> Flip {
match self {
Self::None => Self::Horizontal,
Self::Horizontal => Self::None,
Self::Vertical => Self::Both,
Self::Both => Self::Vertical,
}
}
#[must_use]
pub fn toggle_vertical(&self) -> Flip {
match self {
Self::None => Self::Vertical,
Self::Horizontal => Self::Both,
Self::Vertical => Self::None,
Self::Both => Self::Horizontal,
}
}
}