mirror of
https://github.com/ppy/osu
synced 2025-02-20 12:26:59 +00:00
Add padding to the bottom of the beatmap listing overlay to avoid hovered panels exceeding visible bounds
Closes https://github.com/ppy/osu/issues/16120.
This commit is contained in:
parent
cf864e58f7
commit
b9851b278d
@ -3,16 +3,13 @@
|
|||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -157,53 +154,5 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
|||||||
}, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
}, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ExpandedContentScrollContainer : OsuScrollContainer
|
|
||||||
{
|
|
||||||
public ExpandedContentScrollContainer()
|
|
||||||
{
|
|
||||||
ScrollbarVisible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
Height = Math.Min(Content.DrawHeight, 400);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool allowScroll => !Precision.AlmostEquals(DrawSize, Content.DrawSize);
|
|
||||||
|
|
||||||
protected override bool OnDragStart(DragStartEvent e)
|
|
||||||
{
|
|
||||||
if (!allowScroll)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return base.OnDragStart(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDrag(DragEvent e)
|
|
||||||
{
|
|
||||||
if (!allowScroll)
|
|
||||||
return;
|
|
||||||
|
|
||||||
base.OnDrag(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDragEnd(DragEndEvent e)
|
|
||||||
{
|
|
||||||
if (!allowScroll)
|
|
||||||
return;
|
|
||||||
|
|
||||||
base.OnDragEnd(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnScroll(ScrollEvent e)
|
|
||||||
{
|
|
||||||
if (!allowScroll)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return base.OnScroll(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Drawables.Cards
|
||||||
|
{
|
||||||
|
public class ExpandedContentScrollContainer : OsuScrollContainer
|
||||||
|
{
|
||||||
|
public const float HEIGHT = 400;
|
||||||
|
|
||||||
|
public ExpandedContentScrollContainer()
|
||||||
|
{
|
||||||
|
ScrollbarVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
Height = Math.Min(Content.DrawHeight, HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool allowScroll => !Precision.AlmostEquals(DrawSize, Content.DrawSize);
|
||||||
|
|
||||||
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
|
{
|
||||||
|
if (!allowScroll)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return base.OnDragStart(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDrag(DragEvent e)
|
||||||
|
{
|
||||||
|
if (!allowScroll)
|
||||||
|
return;
|
||||||
|
|
||||||
|
base.OnDrag(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
|
{
|
||||||
|
if (!allowScroll)
|
||||||
|
return;
|
||||||
|
|
||||||
|
base.OnDragEnd(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnScroll(ScrollEvent e)
|
||||||
|
{
|
||||||
|
if (!allowScroll)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return base.OnScroll(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -186,7 +186,11 @@ namespace osu.Game.Overlays
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(10),
|
Spacing = new Vector2(10),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Margin = new MarginPadding { Vertical = 15 },
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 15,
|
||||||
|
Bottom = ExpandedContentScrollContainer.HEIGHT
|
||||||
|
},
|
||||||
ChildrenEnumerable = newCards
|
ChildrenEnumerable = newCards
|
||||||
};
|
};
|
||||||
return content;
|
return content;
|
||||||
|
Loading…
Reference in New Issue
Block a user