Fix song select context menus displaying off-screen

This commit is contained in:
Dean Herbert 2019-08-15 14:00:12 +09:00
parent 58258188ce
commit e73a9c2748
2 changed files with 16 additions and 11 deletions

View File

@ -24,7 +24,7 @@
namespace osu.Game.Screens.Select
{
public class BeatmapCarousel : OsuScrollContainer
public class BeatmapCarousel : CompositeDrawable
{
private const float bleed_top = FilterControl.HEIGHT;
private const float bleed_bottom = Footer.HEIGHT;
@ -61,6 +61,8 @@ public class BeatmapCarousel : OsuScrollContainer
/// </summary>
public bool BeatmapSetsLoaded { get; private set; }
private readonly OsuScrollContainer scroll;
private IEnumerable<CarouselBeatmapSet> beatmapSets => root.Children.OfType<CarouselBeatmapSet>();
public IEnumerable<BeatmapSetInfo> BeatmapSets
@ -110,14 +112,18 @@ private void loadBeatmapSets(IEnumerable<BeatmapSetInfo> beatmapSets)
public BeatmapCarousel()
{
root = new CarouselRoot(this);
Child = new OsuContextMenuContainer
InternalChild = new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.Both,
Child = scroll = new OsuScrollContainer
{
Masking = false,
RelativeSizeAxes = Axes.Both,
Child = scrollableContent = new Container<DrawableCarouselItem>
{
RelativeSizeAxes = Axes.X,
}
}
};
}
@ -127,7 +133,7 @@ private void load(OsuConfigManager config, BeatmapManager beatmaps)
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled);
RightClickScrollingEnabled.ValueChanged += enabled => RightMouseScrollbar = enabled.NewValue;
RightClickScrollingEnabled.ValueChanged += enabled => scroll.RightMouseScrollbar = enabled.NewValue;
RightClickScrollingEnabled.TriggerChange();
loadBeatmapSets(beatmaps.GetAllUsableBeatmapSetsEnumerable());
@ -351,12 +357,12 @@ private void select(CarouselItem item)
/// <summary>
/// The position of the lower visible bound with respect to the current scroll position.
/// </summary>
private float visibleBottomBound => Current + DrawHeight + bleed_bottom;
private float visibleBottomBound => scroll.Current + DrawHeight + bleed_bottom;
/// <summary>
/// The position of the upper visible bound with respect to the current scroll position.
/// </summary>
private float visibleUpperBound => Current - bleed_top;
private float visibleUpperBound => scroll.Current - bleed_top;
public void FlushPendingFilterOperations()
{
@ -628,7 +634,7 @@ void performMove(float y, float? startY = null)
private void updateScrollPosition()
{
if (scrollTarget != null) ScrollTo(scrollTarget.Value);
if (scrollTarget != null) scroll.ScrollTo(scrollTarget.Value);
scrollPositionCache.Validate();
}

View File

@ -157,7 +157,6 @@ protected SongSelect()
},
Child = Carousel = new BeatmapCarousel
{
Masking = false,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1 - wedged_container_size.X, 1),
Anchor = Anchor.CentreRight,