mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Use OverlayScrollContainer for overlays
This commit is contained in:
parent
9dfca4a374
commit
b741e359cd
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
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;
|
||||||
@ -19,7 +20,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
private Drawable expandableHeader, fixedHeader, footer, headerBackground;
|
private Drawable expandableHeader, fixedHeader, footer, headerBackground;
|
||||||
private readonly OsuScrollContainer scrollContainer;
|
private readonly OsuScrollContainer scrollContainer;
|
||||||
private readonly Container headerBackgroundContainer;
|
private readonly Container headerBackgroundContainer;
|
||||||
private readonly FlowContainer<T> scrollContentContainer;
|
private FlowContainer<T> scrollContentContainer;
|
||||||
|
|
||||||
protected override Container<T> Content => scrollContentContainer;
|
protected override Container<T> Content => scrollContentContainer;
|
||||||
|
|
||||||
@ -125,20 +126,26 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
public SectionsContainer()
|
public SectionsContainer()
|
||||||
{
|
{
|
||||||
AddInternal(scrollContainer = new OsuScrollContainer
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
scrollContainer = CreateScrollContainer().With(s =>
|
||||||
Masking = true,
|
{
|
||||||
ScrollbarVisible = false,
|
s.RelativeSizeAxes = Axes.Both;
|
||||||
Children = new Drawable[] { scrollContentContainer = CreateScrollContentContainer() }
|
s.Masking = true;
|
||||||
});
|
s.ScrollbarVisible = false;
|
||||||
AddInternal(headerBackgroundContainer = new Container
|
s.Children = new Drawable[] { scrollContentContainer = CreateScrollContentContainer() };
|
||||||
{
|
}),
|
||||||
RelativeSizeAxes = Axes.X
|
headerBackgroundContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X
|
||||||
|
}
|
||||||
});
|
});
|
||||||
originalSectionsMargin = scrollContentContainer.Margin;
|
originalSectionsMargin = scrollContentContainer.Margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NotNull]
|
||||||
|
protected virtual OsuScrollContainer CreateScrollContainer() => new OsuScrollContainer();
|
||||||
|
|
||||||
public void ScrollTo(Drawable section) => scrollContainer.ScrollTo(scrollContainer.GetChildPosInContent(section) - (FixedHeader?.BoundingBox.Height ?? 0));
|
public void ScrollTo(Drawable section) => scrollContainer.ScrollTo(scrollContainer.GetChildPosInContent(section) - (FixedHeader?.BoundingBox.Height ?? 0));
|
||||||
|
|
||||||
public void ScrollToTop() => scrollContainer.ScrollTo(0);
|
public void ScrollToTop() => scrollContainer.ScrollTo(0);
|
||||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = ColourProvider.Background6
|
Colour = ColourProvider.Background6
|
||||||
},
|
},
|
||||||
new BasicScrollContainer
|
new OverlayScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Overlays
|
|||||||
public BeatmapSetOverlay()
|
public BeatmapSetOverlay()
|
||||||
: base(OverlayColourScheme.Blue)
|
: base(OverlayColourScheme.Blue)
|
||||||
{
|
{
|
||||||
OsuScrollContainer scroll;
|
OverlayScrollContainer scroll;
|
||||||
Info info;
|
Info info;
|
||||||
CommentsSection comments;
|
CommentsSection comments;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
scroll = new OsuScrollContainer
|
scroll = new OverlayScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = ColourProvider.Background4,
|
Colour = ColourProvider.Background4,
|
||||||
},
|
},
|
||||||
new OsuScrollContainer
|
new OverlayScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colours.PurpleDarkAlternative
|
Colour = colours.PurpleDarkAlternative
|
||||||
},
|
},
|
||||||
new OsuScrollContainer
|
new OverlayScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = new FillFlowContainer
|
Child = new FillFlowContainer
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected Bindable<RankingsScope> Scope => header.Current;
|
protected Bindable<RankingsScope> Scope => header.Current;
|
||||||
|
|
||||||
private readonly BasicScrollContainer scrollFlow;
|
private readonly OverlayScrollContainer scrollFlow;
|
||||||
private readonly Container contentContainer;
|
private readonly Container contentContainer;
|
||||||
private readonly LoadingLayer loading;
|
private readonly LoadingLayer loading;
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
@ -44,7 +44,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
scrollFlow = new BasicScrollContainer
|
scrollFlow = new OverlayScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Overlays.SearchableList
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Child = new OsuScrollContainer
|
Child = new OverlayScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
|
@ -195,6 +195,8 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override OsuScrollContainer CreateScrollContainer() => new OverlayScrollContainer();
|
||||||
|
|
||||||
protected override FlowContainer<ProfileSection> CreateScrollContentContainer() => new FillFlowContainer<ProfileSection>
|
protected override FlowContainer<ProfileSection> CreateScrollContentContainer() => new FillFlowContainer<ProfileSection>
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
|
Loading…
Reference in New Issue
Block a user