2020-12-22 23:36:44 +08: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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2020-12-22 23:36:44 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Containers
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
public partial class UserTrackingScrollContainer : UserTrackingScrollContainer<Drawable>
|
2020-12-22 23:36:44 +08:00
|
|
|
{
|
|
|
|
public UserTrackingScrollContainer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public UserTrackingScrollContainer(Direction direction)
|
|
|
|
: base(direction)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-24 13:32:20 +08:00
|
|
|
public partial class UserTrackingScrollContainer<T> : OsuScrollContainer<T>
|
2020-12-22 23:36:44 +08:00
|
|
|
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-07 04:57:51 +08:00
|
|
|
UserScrolling = true;
|
2020-12-22 23:36:44 +08:00
|
|
|
base.OnUserScroll(value, animated, distanceDecay);
|
|
|
|
}
|
|
|
|
|
2021-08-20 16:40:41 +08:00
|
|
|
public new void ScrollIntoView(Drawable target, bool animated = true)
|
|
|
|
{
|
2022-03-07 04:57:51 +08:00
|
|
|
UserScrolling = false;
|
2021-08-20 16:40:41 +08:00
|
|
|
base.ScrollIntoView(target, animated);
|
|
|
|
}
|
|
|
|
|
2020-12-22 23:36:44 +08:00
|
|
|
public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null)
|
|
|
|
{
|
2022-03-07 04:57:51 +08:00
|
|
|
UserScrolling = false;
|
2020-12-22 23:36:44 +08:00
|
|
|
base.ScrollTo(value, animated, distanceDecay);
|
|
|
|
}
|
2021-02-02 14:16:26 +08:00
|
|
|
|
|
|
|
public new void ScrollToEnd(bool animated = true, bool allowDuringDrag = false)
|
|
|
|
{
|
2022-03-07 04:57:51 +08:00
|
|
|
UserScrolling = false;
|
2021-02-02 14:16:26 +08:00
|
|
|
base.ScrollToEnd(animated, allowDuringDrag);
|
|
|
|
}
|
2020-12-22 23:36:44 +08:00
|
|
|
}
|
|
|
|
}
|