1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Add placement-dependent horizontal screen offset properties

This commit is contained in:
Salman Ahmed 2021-08-06 18:36:43 +03:00
parent 067ff0e0ad
commit 8e8e0fb8d8
3 changed files with 13 additions and 0 deletions

View File

@ -30,6 +30,11 @@ namespace osu.Game.Overlays
private FlowContainer<NotificationSection> sections; private FlowContainer<NotificationSection> sections;
/// <summary>
/// A horizontal offset to apply to the game-wide screen.
/// </summary>
public float HorizontalScreenOffset => -width + X;
/// <summary> /// <summary>
/// Provide a source for the toolbar height. /// Provide a source for the toolbar height.
/// </summary> /// </summary>

View File

@ -21,6 +21,8 @@ namespace osu.Game.Overlays
public LocalisableString Title => SettingsStrings.HeaderTitle; public LocalisableString Title => SettingsStrings.HeaderTitle;
public LocalisableString Description => SettingsStrings.HeaderDescription; public LocalisableString Description => SettingsStrings.HeaderDescription;
public override float HorizontalScreenOffset => base.HorizontalScreenOffset + (lastOpenedSubPanel?.HorizontalScreenOffset ?? 0f);
protected override IEnumerable<SettingsSection> CreateSections() => new SettingsSection[] protected override IEnumerable<SettingsSection> CreateSections() => new SettingsSection[]
{ {
new GeneralSection(), new GeneralSection(),

View File

@ -34,6 +34,11 @@ namespace osu.Game.Overlays
protected override Container<Drawable> Content => ContentContainer; protected override Container<Drawable> Content => ContentContainer;
/// <summary>
/// A horizontal offset to apply to the game-wide screen.
/// </summary>
public virtual float HorizontalScreenOffset => (WIDTH + Content?.X) ?? 0f;
protected Sidebar Sidebar; protected Sidebar Sidebar;
private SidebarButton selectedSidebarButton; private SidebarButton selectedSidebarButton;
@ -64,6 +69,7 @@ namespace osu.Game.Overlays
{ {
InternalChild = ContentContainer = new NonMaskedContent InternalChild = ContentContainer = new NonMaskedContent
{ {
X = -WIDTH + ExpandedPosition,
Width = WIDTH, Width = WIDTH,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]