1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-16 00:51:02 +02:00

feat: Add orientation support for custom label and button

This commit is contained in:
Claire Neveu 2024-04-04 16:12:45 -04:00
parent 702b0a63bf
commit 70b2c592b2
11 changed files with 145 additions and 39 deletions

View file

@ -43,10 +43,30 @@ pub enum TransitionType {
#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum ModuleOrientation {
#[serde(alias = "h")]
Horizontal,
#[serde(alias = "v")]
Vertical,
}
impl ModuleOrientation {
pub const fn to_angle(&self) -> f64 {
match self {
Self::Horizontal => 0.0,
Self::Vertical => 90.0
}
}
}
impl From<ModuleOrientation> for Orientation {
fn from(o: ModuleOrientation) -> Self {
match o {
ModuleOrientation::Horizontal => Orientation::Horizontal,
ModuleOrientation::Vertical => Orientation::Vertical
}
}
}
impl Default for ModuleOrientation {
fn default() -> Self {
ModuleOrientation::Horizontal