mirror of https://github.com/ppy/osu
Fix right click absolute scrolling interfering with context menus
This commit is contained in:
parent
e73a9c2748
commit
0f4bada21e
|
@ -115,7 +115,7 @@ public BeatmapCarousel()
|
||||||
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 @@ protected override void PerformSelection()
|
||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue