mirror of https://github.com/ppy/osu
Fix song select's carousel scroll position getting reset on background processing
This only happened for users using absolute right-click scroll.
This commit is contained in:
parent
27ae7d77f4
commit
62444c3d04
|
@ -44,9 +44,6 @@ public partial class OsuScrollContainer<T> : ScrollContainer<T> where T : Drawab
|
|||
|
||||
private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
|
||||
|
||||
private void scrollFromMouseEvent(MouseEvent e) =>
|
||||
ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim]) * Content.DrawSize[ScrollDim], true, DistanceDecayOnRightMouseScrollbar);
|
||||
|
||||
private bool rightMouseDragging;
|
||||
|
||||
protected override bool IsDragging => base.IsDragging || rightMouseDragging;
|
||||
|
@ -80,7 +77,7 @@ protected override bool OnMouseDown(MouseDownEvent e)
|
|||
{
|
||||
if (shouldPerformRightMouseScroll(e))
|
||||
{
|
||||
scrollFromMouseEvent(e);
|
||||
ScrollFromMouseEvent(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -91,7 +88,7 @@ protected override void OnDrag(DragEvent e)
|
|||
{
|
||||
if (rightMouseDragging)
|
||||
{
|
||||
scrollFromMouseEvent(e);
|
||||
ScrollFromMouseEvent(e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -129,6 +126,9 @@ protected override bool OnScroll(ScrollEvent e)
|
|||
return base.OnScroll(e);
|
||||
}
|
||||
|
||||
protected virtual void ScrollFromMouseEvent(MouseEvent e) =>
|
||||
ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim]) * Content.DrawSize[ScrollDim], true, DistanceDecayOnRightMouseScrollbar);
|
||||
|
||||
protected override ScrollbarContainer CreateScrollbar(Direction direction) => new OsuScrollbar(direction);
|
||||
|
||||
protected partial class OsuScrollbar : ScrollbarContainer
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
|
@ -46,6 +47,12 @@ protected override void OnUserScroll(float value, bool animated = true, double?
|
|||
base.ScrollIntoView(target, animated);
|
||||
}
|
||||
|
||||
protected override void ScrollFromMouseEvent(MouseEvent e)
|
||||
{
|
||||
UserScrolling = true;
|
||||
base.ScrollFromMouseEvent(e);
|
||||
}
|
||||
|
||||
public new void ScrollTo(float value, bool animated = true, double? distanceDecay = null)
|
||||
{
|
||||
UserScrolling = false;
|
||||
|
|
Loading…
Reference in New Issue