Fix settings panel hide animation looking wrong when a sub-panel is visible when hidden

This commit is contained in:
Dean Herbert 2021-05-26 19:25:05 +09:00
parent 1e77a87fab
commit 7ed4cbf7bf
1 changed files with 10 additions and 5 deletions

View File

@ -10,6 +10,7 @@
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
@ -49,8 +50,6 @@ public abstract class SettingsPanel : OsuFocusedOverlayContainer
private readonly bool showSidebar;
protected Box Background;
protected SettingsPanel(bool showSidebar)
{
this.showSidebar = showSidebar;
@ -63,13 +62,13 @@ protected SettingsPanel(bool showSidebar)
[BackgroundDependencyLoader]
private void load()
{
InternalChild = ContentContainer = new Container
InternalChild = ContentContainer = new NonMaskedContent
{
Width = WIDTH,
RelativeSizeAxes = Axes.Y,
Children = new Drawable[]
{
Background = new Box
new Box
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
@ -165,7 +164,7 @@ protected override void PopOut()
{
base.PopOut();
ContentContainer.MoveToX(-WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
ContentContainer.MoveToX(-WIDTH + ExpandedPosition, TRANSITION_LENGTH, Easing.OutQuint);
Sidebar?.MoveToX(-sidebar_width, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
@ -191,6 +190,12 @@ protected override void UpdateAfterChildren()
Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
}
private class NonMaskedContent : Container<Drawable>
{
// masking breaks the pan-out transform with nested sub-settings panels.
protected override bool ComputeIsMaskedAway(RectangleF maskingBounds) => false;
}
public class SettingsSectionsContainer : SectionsContainer<SettingsSection>
{
public SearchContainer<SettingsSection> SearchContainer;