From 7afbb89ebfd49aa86453d45f7d9c13a7c48b58f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 30 May 2025 18:11:38 +0200 Subject: [PATCH] Add `snap` field to `rule::Style` --- widget/src/rule.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/widget/src/rule.rs b/widget/src/rule.rs index b109b103..03c57c94 100644 --- a/widget/src/rule.rs +++ b/widget/src/rule.rs @@ -167,7 +167,7 @@ where renderer::Quad { bounds, border: border::rounded(style.radius), - snap: true, + snap: style.snap, ..renderer::Quad::default() }, style.color, @@ -198,6 +198,8 @@ pub struct Style { pub radius: border::Radius, /// The [`FillMode`] of the rule. pub fill_mode: FillMode, + /// Whether the rule should be snapped to the pixel grid. + pub snap: bool, } /// The fill mode of a rule. @@ -302,5 +304,6 @@ pub fn default(theme: &Theme) -> Style { width: 1, radius: 0.0.into(), fill_mode: FillMode::Full, + snap: true, } }