summaryrefslogtreecommitdiffstats
path: root/widget/src/container.rs
diff options
context:
space:
mode:
Diffstat (limited to 'widget/src/container.rs')
-rw-r--r--widget/src/container.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/widget/src/container.rs b/widget/src/container.rs
index ee7a4965..5dd7705b 100644
--- a/widget/src/container.rs
+++ b/widget/src/container.rs
@@ -252,21 +252,23 @@ where
) {
let style = theme.appearance(&self.style);
- draw_background(renderer, &style, layout.bounds());
-
- self.content.as_widget().draw(
- tree,
- renderer,
- theme,
- &renderer::Style {
- text_color: style
- .text_color
- .unwrap_or(renderer_style.text_color),
- },
- layout.children().next().unwrap(),
- cursor,
- viewport,
- );
+ if let Some(viewport) = layout.bounds().intersection(viewport) {
+ draw_background(renderer, &style, layout.bounds());
+
+ self.content.as_widget().draw(
+ tree,
+ renderer,
+ theme,
+ &renderer::Style {
+ text_color: style
+ .text_color
+ .unwrap_or(renderer_style.text_color),
+ },
+ layout.children().next().unwrap(),
+ cursor,
+ &viewport,
+ );
+ }
}
fn overlay<'b>(