2020-12-22 15:36:44 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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<Drawable>
|
|
|
|
{
|
|
|
|
public UserTrackingScrollContainer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserTrackingScrollContainer(Direction direction)
|
|
|
|
: base(direction)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class UserTrackingScrollContainer<T> : OsuScrollContainer<T>
|
|
|
|
where T : Drawable
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Whether the last scroll event was user triggered, directly on the scroll container.
|
|
|
|
/// </summary>
|
|
|
|
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)
|
|
|
|
{
|
2022-03-06 20:57:51 +00:00
|
|
|
UserScrolling = true;
|
2020-12-22 15:36:44 +00:00
|
|
|
base.OnUserScroll(value, animated, distanceDecay);
|
|
|
|
}
|
|
|
|
|
2021-08-20 08:40:41 +00:00
|
|
|
public new void ScrollIntoView(Drawable target, bool animated = true)
|
|
|
|
{
|
2022-03-06 20:57:51 +00:00
|
|
|
UserScrolling = false;
|
2021-08-20 08:40:41 +00:00
|
|
|
base.ScrollIntoView(target, animated);
|
|
|
|
}
|
|
|
|
|
2020-12-22 15:36:44 +00:00
|
|
|
public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null)
|
|
|
|
{
|
2022-03-06 20:57:51 +00:00
|
|
|
UserScrolling = false;
|
2020-12-22 15:36:44 +00:00
|
|
|
base.ScrollTo(value, animated, distanceDecay);
|
|
|
|
}
|
2021-02-02 06:16:26 +00:00
|
|
|
|
|
|
|
public new void ScrollToEnd(bool animated = true, bool allowDuringDrag = false)
|
|
|
|
{
|
2022-03-06 20:57:51 +00:00
|
|
|
UserScrolling = false;
|
2021-02-02 06:16:26 +00:00
|
|
|
base.ScrollToEnd(animated, allowDuringDrag);
|
|
|
|
}
|
2020-12-22 15:36:44 +00:00
|
|
|
}
|
|
|
|
}
|