Skip to content

Commit

Permalink
Fix right mouse not working at song select for some things
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jan 19, 2025
1 parent 0b9c41c commit fa452bc
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions osu.Game/Screens/Select/BeatmapCarousel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,33 +1176,37 @@ public CarouselScrollContainer()

protected override bool IsDragging => base.IsDragging || absoluteScrolling;

public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
protected override bool OnMouseDown(MouseDownEvent e)
{
switch (e.Action)
if (e.Button == MouseButton.Right)
{
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;
return true;
// 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;
return true;
}

return base.OnMouseDown(e);
}

protected override void OnMouseUp(MouseUpEvent e)
{
absoluteScrolling = false;
base.OnMouseUp(e);
}

public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
return false;
}

public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
switch (e.Action)
{
case GlobalAction.AbsoluteScrollSongList:
absoluteScrolling = false;
break;
}
}

protected override bool OnMouseMove(MouseMoveEvent e)
Expand Down

0 comments on commit fa452bc

Please sign in to comment.