Skip to content

Commit

Permalink
Fix right click scroll at song select not quite matching scrollbar po…
Browse files Browse the repository at this point in the history
…sition
  • Loading branch information
peppy committed Nov 18, 2024
1 parent c82fefc commit fc914dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions osu.Game/Graphics/Containers/OsuScrollContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,13 @@ protected override bool OnScroll(ScrollEvent e)
return base.OnScroll(e);
}

protected virtual void ScrollFromMouseEvent(MouseEvent e) =>
ScrollTo(Clamp(FromScrollbarPosition(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim]) + Scrollbar.DrawHeight), true, DistanceDecayOnRightMouseScrollbar);
protected virtual void ScrollFromMouseEvent(MouseEvent e)
{
float fromScrollbarPosition = FromScrollbarPosition(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim]);
float scrollbarCentreOffset = FromScrollbarPosition(Scrollbar.DrawHeight) * 0.5f;

ScrollTo(Clamp(fromScrollbarPosition - scrollbarCentreOffset), true, DistanceDecayOnRightMouseScrollbar);
}

private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;

Expand Down

0 comments on commit fc914dc

Please sign in to comment.