Skip to content

Commit

Permalink
Ignore change of ScrollViewer.Extent during smoothing scrolling.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster620 committed Oct 27, 2024
1 parent a7ec45f commit 1b6b4b3
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Application.Avalonia/Controls/ScrollViewerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ void OnPointerPressed(object? sender, RoutedEventArgs e) =>
animator?.Cancel();
void OnPointerWheelChanged(object? sender, RoutedEventArgs e) =>
animator?.Cancel();
var extentChangedObserverToken = scrollViewer.GetObservable(ScrollViewer.ExtentProperty).Subscribe(_ => animator?.Cancel());
var viewportChangedObserverToken = scrollViewer.GetObservable(ScrollViewer.ViewportProperty).Subscribe(_ => animator?.Cancel());
animator = new DoubleAnimator(0, 1).Also(it =>
{
Expand All @@ -182,7 +181,6 @@ void OnPointerWheelChanged(object? sender, RoutedEventArgs e) =>
}
scrollViewer.RemoveHandler(ScrollViewer.PointerPressedEvent, OnPointerPressed);
scrollViewer.RemoveHandler(ScrollViewer.PointerWheelChangedEvent, OnPointerWheelChanged);
extentChangedObserverToken.Dispose();
viewportChangedObserverToken.Dispose();
};
it.Completed += (_, _) =>
Expand All @@ -195,7 +193,6 @@ void OnPointerWheelChanged(object? sender, RoutedEventArgs e) =>
}
scrollViewer.RemoveHandler(ScrollViewer.PointerPressedEvent, OnPointerPressed);
scrollViewer.RemoveHandler(ScrollViewer.PointerWheelChangedEvent, OnPointerWheelChanged);
extentChangedObserverToken.Dispose();
viewportChangedObserverToken.Dispose();
};
it.Duration = duration;
Expand Down

0 comments on commit 1b6b4b3

Please sign in to comment.