mirror of
https://github.com/ppy/osu.git
synced 2025-01-09 22:15:04 +08:00
Fix right click scroll at song select not quite matching scrollbar position
Closes https://github.com/ppy/osu/issues/30744.
This commit is contained in:
parent
28fb0bf909
commit
a2af4cbb50
@ -42,8 +42,6 @@ namespace osu.Game.Graphics.Containers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double DistanceDecayOnRightMouseScrollbar = 0.02;
|
public double DistanceDecayOnRightMouseScrollbar = 0.02;
|
||||||
|
|
||||||
private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
|
|
||||||
|
|
||||||
private bool rightMouseDragging;
|
private bool rightMouseDragging;
|
||||||
|
|
||||||
protected override bool IsDragging => base.IsDragging || rightMouseDragging;
|
protected override bool IsDragging => base.IsDragging || rightMouseDragging;
|
||||||
@ -126,8 +124,15 @@ namespace osu.Game.Graphics.Containers
|
|||||||
return base.OnScroll(e);
|
return base.OnScroll(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void ScrollFromMouseEvent(MouseEvent e) =>
|
protected virtual void ScrollFromMouseEvent(MouseEvent e)
|
||||||
ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim] * Content.DrawSize[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
protected override ScrollbarContainer CreateScrollbar(Direction direction) => new OsuScrollbar(direction);
|
protected override ScrollbarContainer CreateScrollbar(Direction direction) => new OsuScrollbar(direction);
|
||||||
|
|
||||||
|
@ -245,8 +245,7 @@ namespace osu.Game.Screens.Select
|
|||||||
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
|
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
|
||||||
config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled);
|
config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled);
|
||||||
|
|
||||||
RightClickScrollingEnabled.ValueChanged += enabled => Scroll.RightMouseScrollbar = enabled.NewValue;
|
RightClickScrollingEnabled.BindValueChanged(enabled => Scroll.RightMouseScrollbar = enabled.NewValue, true);
|
||||||
RightClickScrollingEnabled.TriggerChange();
|
|
||||||
|
|
||||||
if (detachedBeatmapStore != null && detachedBeatmapSets == null)
|
if (detachedBeatmapStore != null && detachedBeatmapSets == null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user