Scale scrollbar movement by content ratio
This commit is contained in:
parent
58d04cadef
commit
85dab04965
1 changed files with 4 additions and 1 deletions
|
|
@ -102,8 +102,11 @@ where
|
||||||
if let Some(scrollbar_grabbed_at) =
|
if let Some(scrollbar_grabbed_at) =
|
||||||
self.state.scrollbar_grabbed_at
|
self.state.scrollbar_grabbed_at
|
||||||
{
|
{
|
||||||
|
let ratio = content_bounds.height / bounds.height;
|
||||||
|
let delta = scrollbar_grabbed_at.y - cursor_position.y;
|
||||||
|
|
||||||
self.state.scroll(
|
self.state.scroll(
|
||||||
scrollbar_grabbed_at.y - cursor_position.y,
|
delta * ratio,
|
||||||
bounds,
|
bounds,
|
||||||
content_bounds,
|
content_bounds,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue