From 7a860fb460895486499e8ed897f36d8d30e98c16 Mon Sep 17 00:00:00 2001 From: Samaoo Date: Sat, 12 Nov 2022 08:49:03 +0100 Subject: [PATCH] address reviews --- .../Sections/Input/TabletAreaSelection.cs | 16 ++++++++-------- .../Settings/Sections/Input/TabletSettings.cs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs b/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs index 3b5190d13b..708cd5900a 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TabletAreaSelection.cs @@ -212,17 +212,17 @@ namespace osu.Game.Overlays.Settings.Sections.Input { base.Update(); - if (tablet.Value?.Size is Vector2 size) - { - float maxDimension = size.LengthFast; + if (!(tablet.Value?.Size is Vector2 size)) + return; - float fitX = maxDimension / (DrawWidth - Padding.Left - Padding.Right); - float fitY = maxDimension / DrawHeight; + float maxDimension = size.LengthFast; - float adjust = MathF.Max(fitX, fitY); + float fitX = maxDimension / (DrawWidth - Padding.Left - Padding.Right); + float fitY = maxDimension / DrawHeight; - tabletContainer.Scale = new Vector2(1 / adjust); - } + float adjust = MathF.Max(fitX, fitY); + + tabletContainer.Scale = new Vector2(1 / adjust); } } } diff --git a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs index 0f96ef3ac7..4cafb5c377 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/TabletSettings.cs @@ -342,8 +342,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input private float currentAspectRatio => sizeX.Value / sizeY.Value; - private static float getHeight(float width, float aspectRatio) => MathF.Round(width / aspectRatio); + private static float getHeight(float width, float aspectRatio) => width / aspectRatio; - private static float getWidth(float height, float aspectRatio) => MathF.Round(height * aspectRatio); + private static float getWidth(float height, float aspectRatio) => height * aspectRatio; } }