Add crisp feature for enabling default quad snapping
This commit is contained in:
parent
12ac265694
commit
567b7d9e9f
14 changed files with 184 additions and 138 deletions
|
|
@ -384,6 +384,7 @@ where
|
|||
bounds,
|
||||
border: style.border,
|
||||
shadow: style.shadow,
|
||||
snap: style.snap,
|
||||
},
|
||||
style
|
||||
.background
|
||||
|
|
@ -492,6 +493,8 @@ pub struct Style {
|
|||
pub border: Border,
|
||||
/// The [`Shadow`] of the button.
|
||||
pub shadow: Shadow,
|
||||
/// Whether the button should be snapped to the pixel grid.
|
||||
pub snap: bool,
|
||||
}
|
||||
|
||||
impl Style {
|
||||
|
|
@ -511,6 +514,7 @@ impl Default for Style {
|
|||
text_color: Color::BLACK,
|
||||
border: Border::default(),
|
||||
shadow: Shadow::default(),
|
||||
snap: cfg!(feature = "crisp"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -451,6 +451,7 @@ pub fn draw_background<Renderer>(
|
|||
bounds,
|
||||
border: style.border,
|
||||
shadow: style.shadow,
|
||||
snap: style.snap,
|
||||
},
|
||||
style
|
||||
.background
|
||||
|
|
@ -592,6 +593,8 @@ pub struct Style {
|
|||
pub border: Border,
|
||||
/// The [`Shadow`] of the container.
|
||||
pub shadow: Shadow,
|
||||
/// Whether the container should be snapped to the pixel grid.
|
||||
pub snap: bool,
|
||||
}
|
||||
|
||||
impl Style {
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ where
|
|||
bounds: layout.bounds().shrink(1.0),
|
||||
shadow: style.shadow,
|
||||
border: border::rounded(style.shadow_border_radius),
|
||||
snap: false,
|
||||
},
|
||||
style.shadow.color,
|
||||
);
|
||||
|
|
@ -332,6 +333,7 @@ where
|
|||
border: border::rounded(
|
||||
style.shadow_border_radius,
|
||||
),
|
||||
snap: false,
|
||||
},
|
||||
style.shadow.color,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue