mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Change mod scrolling behaviour to not scroll horizontally on columns/settings
This commit is contained in:
parent
e8518a3a1a
commit
8ee3fdd0aa
@ -186,7 +186,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
},
|
},
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new NestedVerticalScrollContainer
|
new OsuScrollContainer(Direction.Vertical)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ClampExtension = 100,
|
ClampExtension = 100,
|
||||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
new[] { Empty() },
|
new[] { Empty() },
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new NestedVerticalScrollContainer
|
new OsuScrollContainer(Direction.Vertical)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ClampExtension = 100,
|
ClampExtension = 100,
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Input.Events;
|
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A scroll container that handles the case of vertically scrolling content inside a larger horizontally scrolling parent container.
|
|
||||||
/// </summary>
|
|
||||||
public class NestedVerticalScrollContainer : OsuScrollContainer
|
|
||||||
{
|
|
||||||
private ModSelectScreen.ColumnScrollContainer? parentScrollContainer;
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
parentScrollContainer = this.FindClosestParent<ModSelectScreen.ColumnScrollContainer>();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnScroll(ScrollEvent e)
|
|
||||||
{
|
|
||||||
if (parentScrollContainer == null)
|
|
||||||
return base.OnScroll(e);
|
|
||||||
|
|
||||||
bool topRightInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.TopRight);
|
|
||||||
bool bottomLeftInView = parentScrollContainer.ScreenSpaceDrawQuad.Contains(ScreenSpaceDrawQuad.BottomLeft);
|
|
||||||
|
|
||||||
// If not completely on-screen, handle scroll but also allow parent to scroll at the same time (to hopefully bring our content into full view).
|
|
||||||
if (!topRightInView || !bottomLeftInView)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool scrollingPastEnd = e.ScrollDelta.Y < 0 && IsScrolledToEnd();
|
|
||||||
bool scrollingPastStart = e.ScrollDelta.Y > 0 && Target <= 0;
|
|
||||||
|
|
||||||
// If at either of our extents, delegate scroll to the horizontal parent container.
|
|
||||||
if (scrollingPastStart || scrollingPastEnd)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return base.OnScroll(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user