1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 03:42:57 +08:00

Fix blank space under tournament screen test scenes on very wide screens

This commit is contained in:
Bartłomiej Dach 2023-07-24 22:07:11 +02:00
parent 09ee500f62
commit e7c1664adb
No known key found for this signature in database

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -10,17 +11,28 @@ namespace osu.Game.Tournament.Tests
{
public abstract partial class TournamentScreenTestScene : TournamentTestScene
{
protected override Container<Drawable> Content { get; } = new DrawSizePreservingFillContainer
{
TargetDrawSize = new Vector2(1920, 1080),
Scale = new Vector2(1920 / (float)(1920 + TournamentSceneManager.CONTROL_AREA_WIDTH)),
RelativeSizeAxes = Axes.Both
};
protected override Container<Drawable> Content { get; } = new TournamentScalingContainer();
[BackgroundDependencyLoader]
private void load()
{
base.Content.Add(Content);
}
private partial class TournamentScalingContainer : DrawSizePreservingFillContainer
{
public TournamentScalingContainer()
{
TargetDrawSize = new Vector2(1920, 1080);
RelativeSizeAxes = Axes.Both;
}
protected override void Update()
{
base.Update();
Scale = new Vector2(Math.Min(1, Content.DrawWidth / (1920 + TournamentSceneManager.CONTROL_AREA_WIDTH)));
}
}
}
}