From 9b778006ce7a56b129cc779b5bad31931d5faf12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Sat, 18 Jul 2020 03:05:14 +0200 Subject: [PATCH] Fix border rendering of transparent `Container` Fixes #452 --- graphics/src/widget/container.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/graphics/src/widget/container.rs b/graphics/src/widget/container.rs index 576062d4..5b3a01d2 100644 --- a/graphics/src/widget/container.rs +++ b/graphics/src/widget/container.rs @@ -56,17 +56,17 @@ pub(crate) fn background( bounds: Rectangle, style: &container::Style, ) -> Option { - if style.background.is_none() && style.border_width > 0 { - return None; + if style.background.is_some() || style.border_width > 0 { + Some(Primitive::Quad { + bounds, + background: style + .background + .unwrap_or(Background::Color(Color::TRANSPARENT)), + border_radius: style.border_radius, + border_width: style.border_width, + border_color: style.border_color, + }) + } else { + None } - - Some(Primitive::Quad { - bounds, - background: style - .background - .unwrap_or(Background::Color(Color::TRANSPARENT)), - border_radius: style.border_radius, - border_width: style.border_width, - border_color: style.border_color, - }) }