improv(toggle): Make handle and border radius concentric
This commit is contained in:
parent
5de9b21e0b
commit
4c5ae65eb2
1 changed files with 6 additions and 2 deletions
|
|
@ -823,6 +823,7 @@ impl toggler::StyleSheet for Theme {
|
||||||
|
|
||||||
fn active(&self, _style: &Self::Style, is_active: bool) -> toggler::Appearance {
|
fn active(&self, _style: &Self::Style, is_active: bool) -> toggler::Appearance {
|
||||||
let theme = self.cosmic();
|
let theme = self.cosmic();
|
||||||
|
const HANDLE_MARGIN: f32 = 2.0;
|
||||||
toggler::Appearance {
|
toggler::Appearance {
|
||||||
background: if is_active {
|
background: if is_active {
|
||||||
theme.accent.base.into()
|
theme.accent.base.into()
|
||||||
|
|
@ -833,8 +834,11 @@ impl toggler::StyleSheet for Theme {
|
||||||
foreground: theme.palette.neutral_2.into(),
|
foreground: theme.palette.neutral_2.into(),
|
||||||
foreground_border: None,
|
foreground_border: None,
|
||||||
border_radius: theme.radius_xl().into(),
|
border_radius: theme.radius_xl().into(),
|
||||||
handle_radius: theme.radius_xl().into(),
|
handle_radius: theme
|
||||||
handle_margin: 2.0,
|
.radius_xl()
|
||||||
|
.map(|x| (x - HANDLE_MARGIN).max(0.0))
|
||||||
|
.into(),
|
||||||
|
handle_margin: HANDLE_MARGIN,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue