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 @@ public class NotificationOverlay : OsuFocusedOverlayContainer, INamedOverlayComp
private FlowContainer<NotificationSection> sections;
/// <summary>
/// A horizontal offset to apply to the game-wide screen.
/// </summary>
public float HorizontalScreenOffset => -width + X;
/// <summary>
/// Provide a source for the toolbar height.
/// </summary>

View File

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

View File

@ -34,6 +34,11 @@ public abstract class SettingsPanel : OsuFocusedOverlayContainer
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;
private SidebarButton selectedSidebarButton;
@ -64,6 +69,7 @@ private void load()
{
InternalChild = ContentContainer = new NonMaskedContent
{
X = -WIDTH + ExpandedPosition,
Width = WIDTH,
RelativeSizeAxes = Axes.Y,
Children = new Drawable[]