From e7c1664adbeedcc4f2721482a0fe484b26c01f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 24 Jul 2023 22:07:11 +0200 Subject: [PATCH] Fix blank space under tournament screen test scenes on very wide screens --- .../TournamentScreenTestScene.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs b/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs index 123fb5c2f9..8adffe1468 100644 --- a/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentScreenTestScene.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . 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 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 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))); + } + } } }