From 2a97aad27398ac49d95bf6ebe20a04af76ef9ab1 Mon Sep 17 00:00:00 2001 From: Stanislav Alekseev <43210583+WeetHet@users.noreply.github.com> Date: Tue, 9 Jul 2024 19:44:46 +0300 Subject: [PATCH] Fix scrolling sticking to top (#13874) The problem seemingly was that scrolling only started after autoscroll has finished. I have added a function to forcefully stop it, which I call when scroll event happens Release Notes: - Fixed delay when changing scrolling direction (#13720) --------- Co-authored-by: Piotr --- crates/editor/src/element.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 89ddf3cd01..c82d5a4b82 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -3660,6 +3660,11 @@ impl EditorElement { if scroll_position != current_scroll_position { editor.scroll(scroll_position, axis, cx); cx.stop_propagation(); + } else if y < 0. { + // Due to clamping, we may fail to detect cases of overscroll to the top; + // We want the scroll manager to get an update in such cases and detect the change of direction + // on the next frame. + cx.notify(); } }); }