summaryrefslogtreecommitdiffstats
path: root/wgpu/src/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'wgpu/src/renderer')
-rw-r--r--wgpu/src/renderer/scrollable.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/wgpu/src/renderer/scrollable.rs b/wgpu/src/renderer/scrollable.rs
index 14ff9ff4..5b93a765 100644
--- a/wgpu/src/renderer/scrollable.rs
+++ b/wgpu/src/renderer/scrollable.rs
@@ -16,11 +16,10 @@ impl scrollable::Renderer for Renderer {
let content = layout.children().next().unwrap();
let content_bounds = content.bounds();
+ let offset = scrollable.state.offset(bounds, content_bounds);
+
let cursor_position = if bounds.contains(cursor_position) {
- Point::new(
- cursor_position.x,
- cursor_position.y + scrollable.state.offset as f32,
- )
+ Point::new(cursor_position.x, cursor_position.y + offset as f32)
} else {
Point::new(cursor_position.x, -1.0)
};
@@ -30,7 +29,7 @@ impl scrollable::Renderer for Renderer {
let primitive = Primitive::Scrollable {
bounds,
- offset: scrollable.state.offset,
+ offset,
content: Box::new(content),
};
@@ -41,7 +40,7 @@ impl scrollable::Renderer for Renderer {
{
let ratio = bounds.height / content_bounds.height;
let scrollbar_height = bounds.height * ratio;
- let y_offset = scrollable.state.offset as f32 * ratio;
+ let y_offset = offset as f32 * ratio;
let scrollbar = Primitive::Quad {
bounds: Rectangle {