1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-23 19:00:09 +08:00

Add back explicit right click handling of carousel absolute scrolling

This commit is contained in:
Dean Herbert
2025-01-21 17:12:45 +09:00
Unverified
parent 66be9f2d1b
commit 6c27e87714
2 changed files with 62 additions and 19 deletions
+31 -9
View File
@@ -1181,14 +1181,7 @@ namespace osu.Game.Screens.Select
switch (e.Action)
{
case GlobalAction.AbsoluteScrollSongList:
// The default binding for absolute scroll is right mouse button.
// To avoid conflicts with context menus, disallow absolute scroll completely if it looks like things will fall over.
if (e.CurrentState.Mouse.Buttons.Contains(MouseButton.Right)
&& GetContainingInputManager()!.HoveredDrawables.OfType<IHasContextMenu>().Any())
return false;
ScrollToAbsolutePosition(e.CurrentState.Mouse.Position);
absoluteScrolling = true;
beginAbsoluteScrolling(e);
return true;
}
@@ -1200,11 +1193,32 @@ namespace osu.Game.Screens.Select
switch (e.Action)
{
case GlobalAction.AbsoluteScrollSongList:
absoluteScrolling = false;
endAbsoluteScrolling();
break;
}
}
protected override bool OnMouseDown(MouseDownEvent e)
{
if (e.Button == MouseButton.Right)
{
// To avoid conflicts with context menus, disallow absolute scroll if it looks like things will fall over.
if (GetContainingInputManager()!.HoveredDrawables.OfType<IHasContextMenu>().Any())
return false;
beginAbsoluteScrolling(e);
}
return base.OnMouseDown(e);
}
protected override void OnMouseUp(MouseUpEvent e)
{
if (e.Button == MouseButton.Right)
endAbsoluteScrolling();
base.OnMouseUp(e);
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
if (absoluteScrolling)
@@ -1216,6 +1230,14 @@ namespace osu.Game.Screens.Select
return base.OnMouseMove(e);
}
private void beginAbsoluteScrolling(UIEvent e)
{
ScrollToAbsolutePosition(e.CurrentState.Mouse.Position);
absoluteScrolling = true;
}
private void endAbsoluteScrolling() => absoluteScrolling = false;
#endregion
protected override ScrollbarContainer CreateScrollbar(Direction direction)
+31 -10
View File
@@ -493,15 +493,7 @@ namespace osu.Game.Screens.SelectV2
switch (e.Action)
{
case GlobalAction.AbsoluteScrollSongList:
// The default binding for absolute scroll is right mouse button.
// To avoid conflicts with context menus, disallow absolute scroll completely if it looks like things will fall over.
if (e.CurrentState.Mouse.Buttons.Contains(MouseButton.Right)
&& GetContainingInputManager()!.HoveredDrawables.OfType<IHasContextMenu>().Any())
return false;
ScrollToAbsolutePosition(e.CurrentState.Mouse.Position);
absoluteScrolling = true;
beginAbsoluteScrolling(e);
return true;
}
@@ -513,11 +505,32 @@ namespace osu.Game.Screens.SelectV2
switch (e.Action)
{
case GlobalAction.AbsoluteScrollSongList:
absoluteScrolling = false;
endAbsoluteScrolling();
break;
}
}
protected override bool OnMouseDown(MouseDownEvent e)
{
if (e.Button == MouseButton.Right)
{
// To avoid conflicts with context menus, disallow absolute scroll if it looks like things will fall over.
if (GetContainingInputManager()!.HoveredDrawables.OfType<IHasContextMenu>().Any())
return false;
beginAbsoluteScrolling(e);
}
return base.OnMouseDown(e);
}
protected override void OnMouseUp(MouseUpEvent e)
{
if (e.Button == MouseButton.Right)
endAbsoluteScrolling();
base.OnMouseUp(e);
}
protected override bool OnMouseMove(MouseMoveEvent e)
{
if (absoluteScrolling)
@@ -529,6 +542,14 @@ namespace osu.Game.Screens.SelectV2
return base.OnMouseMove(e);
}
private void beginAbsoluteScrolling(UIEvent e)
{
ScrollToAbsolutePosition(e.CurrentState.Mouse.Position);
absoluteScrolling = true;
}
private void endAbsoluteScrolling() => absoluteScrolling = false;
#endregion
}