mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 13:22:55 +08:00
fix inaccurate tablet area dimensions when applying aspect ratio
This commit is contained in:
parent
30700ee68b
commit
533a2db5ea
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
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 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)
|
if (sizeChanged == sizeX)
|
||||||
sizeY.Value = (int)(areaSize.Value.X / aspectRatio.Value);
|
sizeY.Value = (int)Math.Round(areaSize.Value.X / aspectRatio.Value);
|
||||||
else
|
else
|
||||||
sizeX.Value = (int)(areaSize.Value.Y * aspectRatio.Value);
|
sizeX.Value = (int)Math.Round(areaSize.Value.Y * aspectRatio.Value);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -324,12 +325,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
aspectLock.Value = false;
|
aspectLock.Value = false;
|
||||||
|
|
||||||
int proposedHeight = (int)(sizeX.Value / aspectRatio);
|
int proposedHeight = (int)Math.Round(sizeX.Value / aspectRatio);
|
||||||
|
|
||||||
if (proposedHeight < sizeY.MaxValue)
|
if (proposedHeight < sizeY.MaxValue)
|
||||||
sizeY.Value = proposedHeight;
|
sizeY.Value = proposedHeight;
|
||||||
else
|
else
|
||||||
sizeX.Value = (int)(sizeY.Value * aspectRatio);
|
sizeX.Value = (int)Math.Round(sizeY.Value * aspectRatio);
|
||||||
|
|
||||||
updateAspectRatio();
|
updateAspectRatio();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user