diff options
author | 2019-11-30 17:30:42 +0100 | |
---|---|---|
committer | 2019-12-02 19:10:07 +0100 | |
commit | f8fac432c665e57267243a9ee3920208b2724e6e (patch) | |
tree | e680ec54395a0d9082b948ce653580a7e41858fa /wgpu | |
parent | 5eec3a8867f4fbd54e2e28e5d984c2ca7ec0fea4 (diff) | |
download | iced-f8fac432c665e57267243a9ee3920208b2724e6e.tar.gz iced-f8fac432c665e57267243a9ee3920208b2724e6e.tar.bz2 iced-f8fac432c665e57267243a9ee3920208b2724e6e.zip |
Finalize work
Diffstat (limited to 'wgpu')
-rw-r--r-- | wgpu/src/renderer/widget/scrollable.rs | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/wgpu/src/renderer/widget/scrollable.rs b/wgpu/src/renderer/widget/scrollable.rs index d069b799..175fac11 100644 --- a/wgpu/src/renderer/widget/scrollable.rs +++ b/wgpu/src/renderer/widget/scrollable.rs @@ -36,31 +36,35 @@ fn scroller_bounds( } impl scrollable::Renderer for Renderer { - fn scrollbar_grab( + fn scrollbar_bounds( &self, bounds: Rectangle, content_bounds: Rectangle, offset: u32, - cursor_position: Point, - ) -> Option<(ScrollbarGrab, Rectangle)> { + ) -> (Rectangle, Rectangle) { let background_bounds = background_bounds(bounds); + let scroller_bounds = + scroller_bounds(bounds, content_bounds, background_bounds, offset); + + (background_bounds, scroller_bounds) + } + + fn scrollbar_grab( + &self, + bounds: Rectangle, + content_bounds: Rectangle, + background_bounds: Rectangle, + scroller_bounds: Rectangle, + cursor_position: Point, + ) -> Option<ScrollbarGrab> { if content_bounds.height > bounds.height && background_bounds.contains(cursor_position) { - let scroller_bounds = scroller_bounds( - bounds, - content_bounds, - background_bounds, - offset, - ); - - let scrollbar_grab = if scroller_bounds.contains(cursor_position) { + Some(if scroller_bounds.contains(cursor_position) { ScrollbarGrab::Scroller } else { ScrollbarGrab::Background - }; - - Some((scrollbar_grab, scroller_bounds)) + }) } else { None } |