mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 18:42:56 +08:00
Merge pull request #21205 from Samaoo/fix-tablet-aspect-ratio-values
Fix incorrect rounding of tablet aspect ratio values
This commit is contained in:
commit
9724c6bb53
@ -125,11 +125,11 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
{
|
||||
usableAreaContainer.ResizeTo(val.NewValue, 100, Easing.OutQuint);
|
||||
|
||||
int x = (int)val.NewValue.X;
|
||||
int y = (int)val.NewValue.Y;
|
||||
int x = (int)Math.Round(val.NewValue.X);
|
||||
int y = (int)Math.Round(val.NewValue.Y);
|
||||
int commonDivider = greatestCommonDivider(x, y);
|
||||
|
||||
usableAreaText.Text = $"{(float)x / commonDivider}:{(float)y / commonDivider}";
|
||||
usableAreaText.Text = $"{x / commonDivider}:{y / commonDivider}";
|
||||
checkBounds();
|
||||
}, true);
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -327,7 +326,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
{
|
||||
aspectLock.Value = false;
|
||||
|
||||
int proposedHeight = getHeight(sizeX.Value, aspectRatio);
|
||||
float proposedHeight = getHeight(sizeX.Value, aspectRatio);
|
||||
|
||||
if (proposedHeight < sizeY.MaxValue)
|
||||
sizeY.Value = proposedHeight;
|
||||
@ -344,8 +343,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
|
||||
private float currentAspectRatio => sizeX.Value / sizeY.Value;
|
||||
|
||||
private static int getHeight(float width, float aspectRatio) => (int)Math.Round(width / aspectRatio);
|
||||
private static float getHeight(float width, float aspectRatio) => width / aspectRatio;
|
||||
|
||||
private static int getWidth(float height, float aspectRatio) => (int)Math.Round(height * aspectRatio);
|
||||
private static float getWidth(float height, float aspectRatio) => height * aspectRatio;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user