Add snap field to rule::Style

This commit is contained in:
Héctor Ramón Jiménez 2025-05-30 18:11:38 +02:00
parent 54a9f1b770
commit 7afbb89ebf
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -167,7 +167,7 @@ where
renderer::Quad { renderer::Quad {
bounds, bounds,
border: border::rounded(style.radius), border: border::rounded(style.radius),
snap: true, snap: style.snap,
..renderer::Quad::default() ..renderer::Quad::default()
}, },
style.color, style.color,
@ -198,6 +198,8 @@ pub struct Style {
pub radius: border::Radius, pub radius: border::Radius,
/// The [`FillMode`] of the rule. /// The [`FillMode`] of the rule.
pub fill_mode: FillMode, pub fill_mode: FillMode,
/// Whether the rule should be snapped to the pixel grid.
pub snap: bool,
} }
/// The fill mode of a rule. /// The fill mode of a rule.
@ -302,5 +304,6 @@ pub fn default(theme: &Theme) -> Style {
width: 1, width: 1,
radius: 0.0.into(), radius: 0.0.into(),
fill_mode: FillMode::Full, fill_mode: FillMode::Full,
snap: true,
} }
} }