// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; namespace osu.Game.Graphics.Containers { public class UserTrackingScrollContainer : UserTrackingScrollContainer { public UserTrackingScrollContainer() { } public UserTrackingScrollContainer(Direction direction) : base(direction) { } } public class UserTrackingScrollContainer : OsuScrollContainer where T : Drawable { /// /// Whether the last scroll event was user triggered, directly on the scroll container. /// public bool UserScrolling { get; private set; } public UserTrackingScrollContainer() { } public UserTrackingScrollContainer(Direction direction) : base(direction) { } protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default) { base.OnUserScroll(value, animated, distanceDecay); OnScrollChange(true); } public new void ScrollIntoView(Drawable target, bool animated = true) { base.ScrollIntoView(target, animated); OnScrollChange(false); } public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null) { 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) { base.ScrollToEnd(animated, allowDuringDrag); OnScrollChange(false); } /// /// Invoked when any scroll has been performed either automatically or by user. /// protected virtual void OnScrollChange(bool byUser) => UserScrolling = byUser; } }