mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Fix right click absolute scrolling interfering with context menus
This commit is contained in:
@ -115,7 +115,7 @@ namespace osu.Game.Screens.Select
|
|||||||
InternalChild = new OsuContextMenuContainer
|
InternalChild = new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = scroll = new OsuScrollContainer
|
Child = scroll = new CarouselScrollContainer
|
||||||
{
|
{
|
||||||
Masking = false,
|
Masking = false,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -694,5 +694,36 @@ namespace osu.Game.Screens.Select
|
|||||||
base.PerformSelection();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user