Ensure scroll-to-top button is displayed above all overlay content

This commit is contained in:
Dean Herbert 2023-05-17 15:42:38 +09:00
parent dc421bd2af
commit 79e1d978e7
3 changed files with 20 additions and 2 deletions

View File

@ -77,6 +77,14 @@ namespace osu.Game.Overlays
base.Content.Add(mainContent); base.Content.Add(mainContent);
} }
protected override void LoadComplete()
{
base.LoadComplete();
// Ensure the scroll-to-top button is displayed above the fixed header.
AddInternal(ScrollFlow.Button.CreateProxy());
}
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()
{ {
base.UpdateAfterChildren(); base.UpdateAfterChildren();

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays
/// </summary> /// </summary>
private const int button_scroll_position = 200; private const int button_scroll_position = 200;
protected ScrollBackButton Button; public ScrollBackButton Button { get; private set; }
private readonly Bindable<float?> lastScrollTarget = new Bindable<float?>(); private readonly Bindable<float?> lastScrollTarget = new Bindable<float?>();

View File

@ -249,12 +249,14 @@ namespace osu.Game.Overlays
private partial class ProfileSectionsContainer : SectionsContainer<ProfileSection> private partial class ProfileSectionsContainer : SectionsContainer<ProfileSection>
{ {
private OverlayScrollContainer scroll = null!;
public ProfileSectionsContainer() public ProfileSectionsContainer()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
protected override UserTrackingScrollContainer CreateScrollContainer() => new OverlayScrollContainer(); protected override UserTrackingScrollContainer CreateScrollContainer() => scroll = new OverlayScrollContainer();
// Reverse child ID is required so expanding beatmap panels can appear above sections below them. // Reverse child ID is required so expanding beatmap panels can appear above sections below them.
// This can also be done by setting Depth when adding new sections above if using ReverseChildID turns out to have any issues. // This can also be done by setting Depth when adding new sections above if using ReverseChildID turns out to have any issues.
@ -267,6 +269,14 @@ namespace osu.Game.Overlays
Padding = new MarginPadding { Horizontal = 10 }, Padding = new MarginPadding { Horizontal = 10 },
Margin = new MarginPadding { Bottom = 10 }, Margin = new MarginPadding { Bottom = 10 },
}; };
protected override void LoadComplete()
{
base.LoadComplete();
// Ensure the scroll-to-top button is displayed above the fixed header.
AddInternal(scroll.Button.CreateProxy());
}
} }
} }
} }