1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:33:21 +08:00

fix inaccurate tablet area dimensions when applying aspect ratio

This commit is contained in:
Samaoo 2022-11-09 18:48:47 +01:00
parent 30700ee68b
commit 533a2db5ea

View File

@ -3,6 +3,7 @@
#nullable disable
using System;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -308,9 +309,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input
// if lock is applied (or the specified values were out of range) aim to adjust the axis the user was not adjusting to conform.
if (sizeChanged == sizeX)
sizeY.Value = (int)(areaSize.Value.X / aspectRatio.Value);
sizeY.Value = (int)Math.Round(areaSize.Value.X / aspectRatio.Value);
else
sizeX.Value = (int)(areaSize.Value.Y * aspectRatio.Value);
sizeX.Value = (int)Math.Round(areaSize.Value.Y * aspectRatio.Value);
}
finally
{
@ -324,12 +325,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{
aspectLock.Value = false;
int proposedHeight = (int)(sizeX.Value / aspectRatio);
int proposedHeight = (int)Math.Round(sizeX.Value / aspectRatio);
if (proposedHeight < sizeY.MaxValue)
sizeY.Value = proposedHeight;
else
sizeX.Value = (int)(sizeY.Value * aspectRatio);
sizeX.Value = (int)Math.Round(sizeY.Value * aspectRatio);
updateAspectRatio();