mirror of
https://github.com/ppy/osu.git
synced 2025-03-16 00:37:19 +08:00
Merge pull request #22765 from Joehuu/fix-overlay-sidebar-scroll
Fix overlay sidebars not scrolling to end due to parent scroll view
This commit is contained in:
commit
de2ab05e78
@ -8,6 +8,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
@ -39,7 +40,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Right = -3 }, // Compensate for scrollbar margin
|
Padding = new MarginPadding { Right = -3 }, // Compensate for scrollbar margin
|
||||||
Child = new OsuScrollContainer
|
Child = new SidebarScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = new Container
|
Child = new Container
|
||||||
@ -74,5 +75,30 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
protected virtual Drawable CreateContent() => Empty();
|
protected virtual Drawable CreateContent() => Empty();
|
||||||
|
|
||||||
|
private partial class SidebarScrollContainer : OsuScrollContainer
|
||||||
|
{
|
||||||
|
protected override bool OnScroll(ScrollEvent e)
|
||||||
|
{
|
||||||
|
if (e.ScrollDelta.Y > 0 && IsScrolledToStart())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (e.ScrollDelta.Y < 0 && IsScrolledToEnd())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return base.OnScroll(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
|
{
|
||||||
|
if (e.Delta.Y > 0 && IsScrolledToStart())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (e.Delta.Y < 0 && IsScrolledToEnd())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return base.OnDragStart(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user