refactor: make corner radius f32 so that it's easier to use with BorderRadius
This commit is contained in:
parent
6c57e04e36
commit
3507e9f4cf
2 changed files with 20 additions and 20 deletions
|
|
@ -1,31 +1,31 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Corner radii variables for the Cosmic theme
|
/// Corner radii variables for the Cosmic theme
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)]
|
#[derive(Debug, Copy, Clone, PartialEq, Deserialize, Serialize)]
|
||||||
pub struct CornerRadii {
|
pub struct CornerRadii {
|
||||||
/// corner radii of 0
|
/// corner radii of 0
|
||||||
pub radius_0: [u16; 4],
|
pub radius_0: [f32; 4],
|
||||||
/// smallest size of corner radii that can be non-zero
|
/// smallest size of corner radii that can be non-zero
|
||||||
pub radius_xs: [u16; 4],
|
pub radius_xs: [f32; 4],
|
||||||
/// small corner radii
|
/// small corner radii
|
||||||
pub radius_s: [u16; 4],
|
pub radius_s: [f32; 4],
|
||||||
/// medium corner radii
|
/// medium corner radii
|
||||||
pub radius_m: [u16; 4],
|
pub radius_m: [f32; 4],
|
||||||
/// large corner radii
|
/// large corner radii
|
||||||
pub radius_l: [u16; 4],
|
pub radius_l: [f32; 4],
|
||||||
/// extra large corner radii
|
/// extra large corner radii
|
||||||
pub radius_xl: [u16; 4],
|
pub radius_xl: [f32; 4],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CornerRadii {
|
impl Default for CornerRadii {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
radius_0: [0; 4],
|
radius_0: [0.0; 4],
|
||||||
radius_xs: [4; 4],
|
radius_xs: [4.0; 4],
|
||||||
radius_s: [8; 4],
|
radius_s: [8.0; 4],
|
||||||
radius_m: [16; 4],
|
radius_m: [16.0; 4],
|
||||||
radius_l: [32; 4],
|
radius_l: [32.0; 4],
|
||||||
radius_xl: [160; 4],
|
radius_xl: [160.0; 4],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ pub enum Layer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cosmic Theme data structure with all colors and its name
|
/// Cosmic Theme data structure with all colors and its name
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
||||||
pub struct Theme<C> {
|
pub struct Theme<C> {
|
||||||
/// name of the theme
|
/// name of the theme
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
@ -346,27 +346,27 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get @radius_0
|
/// get @radius_0
|
||||||
pub fn radius_0(&self) -> [u16; 4] {
|
pub fn radius_0(&self) -> [f32; 4] {
|
||||||
self.corner_radii.radius_0
|
self.corner_radii.radius_0
|
||||||
}
|
}
|
||||||
/// get @radius_xs
|
/// get @radius_xs
|
||||||
pub fn radius_xs(&self) -> [u16; 4] {
|
pub fn radius_xs(&self) -> [f32; 4] {
|
||||||
self.corner_radii.radius_xs
|
self.corner_radii.radius_xs
|
||||||
}
|
}
|
||||||
/// get @radius_s
|
/// get @radius_s
|
||||||
pub fn radius_s(&self) -> [u16; 4] {
|
pub fn radius_s(&self) -> [f32; 4] {
|
||||||
self.corner_radii.radius_s
|
self.corner_radii.radius_s
|
||||||
}
|
}
|
||||||
/// get @radius_m
|
/// get @radius_m
|
||||||
pub fn radius_m(&self) -> [u16; 4] {
|
pub fn radius_m(&self) -> [f32; 4] {
|
||||||
self.corner_radii.radius_m
|
self.corner_radii.radius_m
|
||||||
}
|
}
|
||||||
/// get @radius_l
|
/// get @radius_l
|
||||||
pub fn radius_l(&self) -> [u16; 4] {
|
pub fn radius_l(&self) -> [f32; 4] {
|
||||||
self.corner_radii.radius_l
|
self.corner_radii.radius_l
|
||||||
}
|
}
|
||||||
/// get @radius_xl
|
/// get @radius_xl
|
||||||
pub fn radius_xl(&self) -> [u16; 4] {
|
pub fn radius_xl(&self) -> [f32; 4] {
|
||||||
self.corner_radii.radius_xl
|
self.corner_radii.radius_xl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue