mirror of
				https://github.com/Zedfrigg/ironbar.git
				synced 2025-11-04 07:21:54 +01:00 
			
		
		
		
	feat: Add orientation support for custom label and button
This commit is contained in:
		
					parent
					
						
							
								702b0a63bf
							
						
					
				
			
			
				commit
				
					
						70b2c592b2
					
				
			
		
					 11 changed files with 145 additions and 39 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue