mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Refactor code into UserTrackingScrollContainer
This commit is contained in:
49
osu.Game/Graphics/Containers/UserTrackingScrollContainer.cs
Normal file
49
osu.Game/Graphics/Containers/UserTrackingScrollContainer.cs
Normal file
@ -0,0 +1,49 @@
|
||||
// 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)
|
||||
{
|
||||
UserScrolling = true;
|
||||
base.OnUserScroll(value, animated, distanceDecay);
|
||||
}
|
||||
|
||||
public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null)
|
||||
{
|
||||
UserScrolling = false;
|
||||
base.ScrollTo(value, animated, distanceDecay);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user