1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 09:23:06 +08:00

Adjust settings panel to autosize to zero when hiding it

Previously, when hiding the settings overlay, it remains to have a width
of `56` (sidebar width), this is due to the panel content being placed
next to the sidebar, so therefore the content has to move 400
(PANEL_WIDTH) + 56 (sidebar_width) backwards, for the overlay to have a
width of 0 on hide.
This commit is contained in:
Salman Ahmed 2021-08-07 19:56:51 +03:00
parent 9f3013e2c8
commit 19a19f915c
3 changed files with 13 additions and 5 deletions

View File

@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual.Settings
new TabletSettings(tabletHandler) new TabletSettings(tabletHandler)
{ {
RelativeSizeAxes = Axes.None, RelativeSizeAxes = Axes.None,
Width = SettingsPanel.WIDTH, Width = SettingsPanel.PANEL_WIDTH,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
} }

View File

@ -69,7 +69,7 @@ namespace osu.Game.Overlays
Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint); Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);
SectionsContainer.FadeOut(300, Easing.OutQuint); SectionsContainer.FadeOut(300, Easing.OutQuint);
ContentContainer.MoveToX(-WIDTH, 500, Easing.OutQuint); ContentContainer.MoveToX(-PANEL_WIDTH, 500, Easing.OutQuint);
lastOpenedSubPanel = panel; lastOpenedSubPanel = panel;
break; break;
@ -83,7 +83,7 @@ namespace osu.Game.Overlays
} }
} }
protected override float ExpandedPosition => lastOpenedSubPanel?.State.Value == Visibility.Visible ? -WIDTH : base.ExpandedPosition; protected override float ExpandedPosition => lastOpenedSubPanel?.State.Value == Visibility.Visible ? -PANEL_WIDTH : base.ExpandedPosition;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -28,7 +28,15 @@ namespace osu.Game.Overlays
private const float sidebar_width = Sidebar.DEFAULT_WIDTH; private const float sidebar_width = Sidebar.DEFAULT_WIDTH;
public const float WIDTH = 400; /// <summary>
/// The width of the settings panel content, excluding the sidebar.
/// </summary>
public const float PANEL_WIDTH = 400;
/// <summary>
/// The full width of the settings panel, including the sidebar.
/// </summary>
public const float WIDTH = sidebar_width + PANEL_WIDTH;
protected Container<Drawable> ContentContainer; protected Container<Drawable> ContentContainer;
@ -71,7 +79,7 @@ namespace osu.Game.Overlays
InternalChild = ContentContainer = new NonMaskedContent InternalChild = ContentContainer = new NonMaskedContent
{ {
X = -WIDTH + ExpandedPosition, X = -WIDTH + ExpandedPosition,
Width = WIDTH, Width = PANEL_WIDTH,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]
{ {