diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 5fdb5e869e..fb88f842bd 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -15,9 +15,9 @@ namespace osu.Game.Graphics.Containers /// public class SectionsContainer : Container { - private Drawable expandableHeader, fixedHeader, footer; + private Drawable expandableHeader, fixedHeader, footer, headerBackground; public readonly ScrollContainer ScrollContainer; - private readonly Container sectionsContainer; + private readonly Container sectionsContainer, headerBackgroundContainer; public Drawable ExpandableHeader { @@ -72,6 +72,22 @@ namespace osu.Game.Graphics.Containers } } + public Drawable HeaderBackground + { + get { return headerBackground; } + set + { + if (value == headerBackground) return; + + headerBackgroundContainer.Clear(); + headerBackground = value; + if (value == null) return; + + headerBackgroundContainer.Add(headerBackground); + lastKnownScroll = float.NaN; + } + } + public Bindable SelectedSection { get; } = new Bindable(); protected virtual Container CreateScrollContentContainer() @@ -120,6 +136,7 @@ namespace osu.Game.Graphics.Containers Masking = false, Children = new Drawable[] { sectionsContainer = CreateScrollContentContainer() } }); + Add(headerBackgroundContainer = new Container { RelativeSizeAxes = Axes.X }); originalSectionsMargin = sectionsContainer.Margin; } @@ -150,6 +167,9 @@ namespace osu.Game.Graphics.Containers fixedHeader.Y = -offset + expandableHeader.LayoutSize.Y; } + headerBackgroundContainer.Height = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0); + headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0; + Drawable bestMatch = null; float minDiff = float.MaxValue; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 87f6d836af..88a0e26dde 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -151,7 +151,6 @@ namespace osu.Game.Overlays private class SettingsSectionsContainer : SectionsContainer { public SearchContainer SearchContainer; - private readonly Box headerBackground; protected override Container CreateScrollContentContainer() => SearchContainer = new SearchContainer @@ -164,11 +163,11 @@ namespace osu.Game.Overlays public SettingsSectionsContainer() { ScrollContainer.ScrollbarVisible = false; - Add(headerBackground = new Box + HeaderBackground = new Box { Colour = Color4.Black, - RelativeSizeAxes = Axes.X - }); + RelativeSizeAxes = Axes.Both + }; } protected override void UpdateAfterChildren() @@ -176,9 +175,7 @@ namespace osu.Game.Overlays base.UpdateAfterChildren(); // no null check because the usage of this class is strict - headerBackground.Height = ExpandableHeader.LayoutSize.Y + FixedHeader.LayoutSize.Y; - headerBackground.Y = ExpandableHeader.Y; - headerBackground.Alpha = -ExpandableHeader.Y / ExpandableHeader.LayoutSize.Y * 0.5f; + HeaderBackground.Alpha = -ExpandableHeader.Y / ExpandableHeader.LayoutSize.Y * 0.5f; } } } diff --git a/osu.Game/Users/Profile/ProfileHeader.cs b/osu.Game/Users/Profile/ProfileHeader.cs index 03c0d0f656..e7a8f45689 100644 --- a/osu.Game/Users/Profile/ProfileHeader.cs +++ b/osu.Game/Users/Profile/ProfileHeader.cs @@ -35,7 +35,11 @@ namespace osu.Game.Users.Profile Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(200) - }) { RelativeSizeAxes = Axes.Both }, + }) + { + Masking = true, + RelativeSizeAxes = Axes.Both + }, new UpdateableAvatar { User = user, diff --git a/osu.Game/Users/UserProfile.cs b/osu.Game/Users/UserProfile.cs index 95447bfe26..55877f248a 100644 --- a/osu.Game/Users/UserProfile.cs +++ b/osu.Game/Users/UserProfile.cs @@ -35,6 +35,11 @@ namespace osu.Game.Users RelativeSizeAxes = Axes.Both, ExpandableHeader = new UserPageHeader(user), FixedHeader = tab, + HeaderBackground = new Box + { + Colour = OsuColour.Gray(34), + RelativeSizeAxes = Axes.Both + }, Sections = sections }; Add(sectionsContainer);