summaryrefslogtreecommitdiffstats
path: root/wgpu/src
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu/src')
-rw-r--r--wgpu/src/renderer/widget/container.rs37
1 files changed, 19 insertions, 18 deletions
diff --git a/wgpu/src/renderer/widget/container.rs b/wgpu/src/renderer/widget/container.rs
index 18908571..2d4d1db8 100644
--- a/wgpu/src/renderer/widget/container.rs
+++ b/wgpu/src/renderer/widget/container.rs
@@ -1,5 +1,5 @@
use crate::{container, defaults, Defaults, Primitive, Renderer};
-use iced_native::{Color, Element, Layout, Point, Rectangle};
+use iced_native::{Background, Color, Element, Layout, Point, Rectangle};
impl iced_native::container::Renderer for Renderer {
type Style = Box<dyn container::StyleSheet>;
@@ -25,24 +25,25 @@ impl iced_native::container::Renderer for Renderer {
let (content, mouse_cursor) =
content.draw(self, &defaults, content_layout, cursor_position);
- match style.background {
- Some(background) => {
- let quad = Primitive::Quad {
- bounds,
- background,
- border_radius: style.border_radius,
- border_width: 0,
- border_color: Color::TRANSPARENT,
- };
+ if style.background.is_some() || style.border_width > 0 {
+ let quad = 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,
+ };
- (
- Primitive::Group {
- primitives: vec![quad, content],
- },
- mouse_cursor,
- )
- }
- None => (content, mouse_cursor),
+ (
+ Primitive::Group {
+ primitives: vec![quad, content],
+ },
+ mouse_cursor,
+ )
+ } else {
+ (content, mouse_cursor)
}
}
}