Fix scroll jitter by ignoring autoscroll events if following (#4216)

When following someone else we saw jitter because
`ScrollPositionChanged` events were battling `SelectionsChanged` events,
both of which were scrolling the viewport.

This ignores the ScrollPositionChanged if autoscrolling is on.

Release Notes:

- Fixed jittery scrolling when following someone else that had a bigger
viewport.
This commit is contained in:
Thorsten Ball 2024-01-23 16:45:47 +01:00 committed by GitHub
commit 003073d53c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -277,7 +277,7 @@ impl FollowableItem for Editor {
.extend(ids.iter().map(ExcerptId::to_proto));
true
}
EditorEvent::ScrollPositionChanged { .. } => {
EditorEvent::ScrollPositionChanged { autoscroll, .. } if !autoscroll => {
let scroll_anchor = self.scroll_manager.anchor();
update.scroll_top_anchor = Some(serialize_anchor(&scroll_anchor.anchor));
update.scroll_x = scroll_anchor.offset.x;