summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-10 06:49:25 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-10 06:49:25 +0100
commitf11397c31a4139fedb90671a5d154c17749f2a7f (patch)
treec35452304a4089e92e617a0ba66aaf8b5b32c263
parenteb070b965294707100b16472980f4794162cbc36 (diff)
downloadiced-f11397c31a4139fedb90671a5d154c17749f2a7f.tar.gz
iced-f11397c31a4139fedb90671a5d154c17749f2a7f.tar.bz2
iced-f11397c31a4139fedb90671a5d154c17749f2a7f.zip
Clip `scrollable` primitives only when necessary
-rw-r--r--wgpu/src/renderer/widget/scrollable.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/wgpu/src/renderer/widget/scrollable.rs b/wgpu/src/renderer/widget/scrollable.rs
index bfee7411..732523e3 100644
--- a/wgpu/src/renderer/widget/scrollable.rs
+++ b/wgpu/src/renderer/widget/scrollable.rs
@@ -58,14 +58,14 @@ impl scrollable::Renderer for Renderer {
style_sheet: &Self::Style,
(content, mouse_cursor): Self::Output,
) -> Self::Output {
- let clip = Primitive::Clip {
- bounds,
- offset: Vector::new(0, offset),
- content: Box::new(content),
- };
-
(
if let Some(scrollbar) = scrollbar {
+ let clip = Primitive::Clip {
+ bounds,
+ offset: Vector::new(0, offset),
+ content: Box::new(content),
+ };
+
let style = if state.is_scroller_grabbed() {
style_sheet.dragging()
} else if is_mouse_over_scrollbar {
@@ -115,7 +115,7 @@ impl scrollable::Renderer for Renderer {
primitives: vec![clip, scrollbar, scroller],
}
} else {
- clip
+ content
},
if is_mouse_over_scrollbar || state.is_scroller_grabbed() {
MouseCursor::Idle