From f11397c31a4139fedb90671a5d154c17749f2a7f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 10 Mar 2020 06:49:25 +0100 Subject: Clip `scrollable` primitives only when necessary --- wgpu/src/renderer/widget/scrollable.rs | 14 +++++++------- 1 file 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 -- cgit