Revert UserTrackingScrollContainer changes

This commit is contained in:
Salman Ahmed
2022-03-06 23:57:51 +03:00
parent a13a087f5d
commit 60334046e4

View File

@ -25,6 +25,8 @@ namespace osu.Game.Graphics.Containers
/// </summary> /// </summary>
public bool UserScrolling { get; private set; } public bool UserScrolling { get; private set; }
public void CancelUserScroll() => UserScrolling = false;
public UserTrackingScrollContainer() public UserTrackingScrollContainer()
{ {
} }
@ -36,37 +38,26 @@ namespace osu.Game.Graphics.Containers
protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default) protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default)
{ {
UserScrolling = true;
base.OnUserScroll(value, animated, distanceDecay); base.OnUserScroll(value, animated, distanceDecay);
OnScrollChange(true);
} }
public new void ScrollIntoView(Drawable target, bool animated = true) public new void ScrollIntoView(Drawable target, bool animated = true)
{ {
UserScrolling = false;
base.ScrollIntoView(target, animated); base.ScrollIntoView(target, animated);
OnScrollChange(false);
} }
public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null) public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null)
{ {
UserScrolling = false;
base.ScrollTo(value, animated, distanceDecay); base.ScrollTo(value, animated, distanceDecay);
OnScrollChange(false);
}
public new void ScrollToStart(bool animated = true, bool allowDuringDrag = false)
{
base.ScrollToStart(animated, allowDuringDrag);
OnScrollChange(false);
} }
public new void ScrollToEnd(bool animated = true, bool allowDuringDrag = false) public new void ScrollToEnd(bool animated = true, bool allowDuringDrag = false)
{ {
UserScrolling = false;
base.ScrollToEnd(animated, allowDuringDrag); base.ScrollToEnd(animated, allowDuringDrag);
OnScrollChange(false);
} }
/// <summary>
/// Invoked when any scroll has been performed either programmatically or by user.
/// </summary>
protected virtual void OnScrollChange(bool byUser) => UserScrolling = byUser;
} }
} }