mirror of
https://github.com/osukey/osukey.git
synced 2025-05-04 05:07:23 +09:00
fix tablet aspect ratio values
This commit is contained in:
parent
daae560ff7
commit
173f557376
@ -125,11 +125,11 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
usableAreaContainer.ResizeTo(val.NewValue, 100, Easing.OutQuint);
|
usableAreaContainer.ResizeTo(val.NewValue, 100, Easing.OutQuint);
|
||||||
|
|
||||||
int x = (int)val.NewValue.X;
|
int x = (int)Math.Round(val.NewValue.X);
|
||||||
int y = (int)val.NewValue.Y;
|
int y = (int)Math.Round(val.NewValue.Y);
|
||||||
int commonDivider = greatestCommonDivider(x, y);
|
int commonDivider = greatestCommonDivider(x, y);
|
||||||
|
|
||||||
usableAreaText.Text = $"{(float)x / commonDivider}:{(float)y / commonDivider}";
|
usableAreaText.Text = $"{x / commonDivider}:{y / commonDivider}";
|
||||||
checkBounds();
|
checkBounds();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
@ -212,17 +212,17 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (!(tablet.Value?.Size is Vector2 size))
|
if (tablet.Value?.Size is Vector2 size)
|
||||||
return;
|
{
|
||||||
|
float maxDimension = size.LengthFast;
|
||||||
|
|
||||||
float maxDimension = size.LengthFast;
|
float fitX = maxDimension / (DrawWidth - Padding.Left - Padding.Right);
|
||||||
|
float fitY = maxDimension / DrawHeight;
|
||||||
|
|
||||||
float fitX = maxDimension / (DrawWidth - Padding.Left - Padding.Right);
|
float adjust = MathF.Max(fitX, fitY);
|
||||||
float fitY = maxDimension / DrawHeight;
|
|
||||||
|
|
||||||
float adjust = MathF.Max(fitX, fitY);
|
tabletContainer.Scale = new Vector2(1 / adjust);
|
||||||
|
}
|
||||||
tabletContainer.Scale = new Vector2(1 / adjust);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
aspectLock.Value = false;
|
aspectLock.Value = false;
|
||||||
|
|
||||||
int proposedHeight = getHeight(sizeX.Value, aspectRatio);
|
float proposedHeight = getHeight(sizeX.Value, aspectRatio);
|
||||||
|
|
||||||
if (proposedHeight < sizeY.MaxValue)
|
if (proposedHeight < sizeY.MaxValue)
|
||||||
sizeY.Value = proposedHeight;
|
sizeY.Value = proposedHeight;
|
||||||
@ -342,8 +342,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
|
|
||||||
private float currentAspectRatio => sizeX.Value / sizeY.Value;
|
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) => (float)Math.Round(width / aspectRatio);
|
||||||
|
|
||||||
private static int getWidth(float height, float aspectRatio) => (int)Math.Round(height * aspectRatio);
|
private static float getWidth(float height, float aspectRatio) => (float)Math.Round(height * aspectRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user