summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer/scrollable.rs
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu/src/renderer/scrollable.rs')
-rw-r--r--wgpu/src/renderer/scrollable.rs51
1 files changed, 24 insertions, 27 deletions
diff --git a/wgpu/src/renderer/scrollable.rs b/wgpu/src/renderer/scrollable.rs
index 5b93a765..43dddeed 100644
--- a/wgpu/src/renderer/scrollable.rs
+++ b/wgpu/src/renderer/scrollable.rs
@@ -34,34 +34,31 @@ impl scrollable::Renderer for Renderer {
};
(
- Primitive::Group {
- primitives: if is_mouse_over
- && content_bounds.height > bounds.height
- {
- let ratio = bounds.height / content_bounds.height;
- let scrollbar_height = bounds.height * ratio;
- let y_offset = offset as f32 * ratio;
+ if is_mouse_over && content_bounds.height > bounds.height {
+ let ratio = bounds.height / content_bounds.height;
+ let scrollbar_height = bounds.height * ratio;
+ let y_offset = offset as f32 * ratio;
- let scrollbar = Primitive::Quad {
- bounds: Rectangle {
- x: bounds.x + bounds.width - 12.0,
- y: bounds.y + y_offset,
- width: 10.0,
- height: scrollbar_height,
- },
- background: Background::Color(Color {
- r: 0.0,
- g: 0.0,
- b: 0.0,
- a: 0.5,
- }),
- border_radius: 5,
- };
-
- vec![primitive, scrollbar]
- } else {
- vec![primitive]
- },
+ let scrollbar = Primitive::Quad {
+ bounds: Rectangle {
+ x: bounds.x + bounds.width - 12.0,
+ y: bounds.y + y_offset,
+ width: 10.0,
+ height: scrollbar_height,
+ },
+ background: Background::Color(Color {
+ r: 0.0,
+ g: 0.0,
+ b: 0.0,
+ a: 0.7,
+ }),
+ border_radius: 5,
+ };
+ Primitive::Group {
+ primitives: vec![primitive, scrollbar],
+ }
+ } else {
+ primitive
},
mouse_cursor,
)