mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 00:43:25 +08:00
using autosize instead of constant height
This commit is contained in:
parent
165d6ef1bb
commit
564abc1a5b
@ -16,8 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
|
|
||||||
private Bindable<bool> letterboxing;
|
private Bindable<bool> letterboxing;
|
||||||
|
|
||||||
private const int letterbox_container_height = 75;
|
private const int transition_duration = 400;
|
||||||
private const int duration = 300;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(FrameworkConfigManager config)
|
private void load(FrameworkConfigManager config)
|
||||||
@ -40,6 +39,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
{
|
{
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
AutoSizeDuration = transition_duration,
|
||||||
|
AutoSizeEasing = EasingTypes.OutQuint,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -58,7 +60,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
letterboxing.ValueChanged += isVisible => letterboxSettings.ResizeHeightTo(isVisible ? letterbox_container_height : 0, duration, EasingTypes.OutQuint);
|
letterboxing.ValueChanged += isVisible =>
|
||||||
|
{
|
||||||
|
letterboxSettings.ClearTransforms();
|
||||||
|
letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None;
|
||||||
|
|
||||||
|
if(!isVisible)
|
||||||
|
letterboxSettings.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint);
|
||||||
|
};
|
||||||
letterboxing.TriggerChange();
|
letterboxing.TriggerChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user