Scale scrollbar movement by content ratio

This commit is contained in:
Héctor Ramón Jiménez 2019-11-02 01:46:45 +01:00
parent 58d04cadef
commit 85dab04965

View file

@ -102,8 +102,11 @@ where
if let Some(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(
scrollbar_grabbed_at.y - cursor_position.y,
delta * ratio,
bounds,
content_bounds,
);