mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 10:42:54 +08:00
Fix right click absolute scrolling interfering with context menus
This commit is contained in:
parent
e73a9c2748
commit
0f4bada21e
@ -115,7 +115,7 @@ namespace osu.Game.Screens.Select
|
||||
InternalChild = new OsuContextMenuContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = scroll = new OsuScrollContainer
|
||||
Child = scroll = new CarouselScrollContainer
|
||||
{
|
||||
Masking = false,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -694,5 +694,36 @@ namespace osu.Game.Screens.Select
|
||||
base.PerformSelection();
|
||||
}
|
||||
}
|
||||
|
||||
private class CarouselScrollContainer : OsuScrollContainer
|
||||
{
|
||||
private bool rightMouseScrollBlocked;
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
if (e.Button == MouseButton.Right)
|
||||
{
|
||||
// we need to block right click absolute scrolling when hovering a carousel item so context menus can display.
|
||||
// this can be reconsidered when we have an alternative to right click scrolling.
|
||||
if (GetContainingInputManager().HoveredDrawables.OfType<DrawableCarouselItem>().Any())
|
||||
{
|
||||
rightMouseScrollBlocked = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
rightMouseScrollBlocked = false;
|
||||
}
|
||||
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(DragStartEvent e)
|
||||
{
|
||||
if (rightMouseScrollBlocked)
|
||||
return false;
|
||||
|
||||
return base.OnDragStart(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user