1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 07:27:51 +08:00

Merge pull request #12513 from peppy/tablet-rotated-preview

Show tablet preview with physical tablet counter-rotated for supplied user area
This commit is contained in:
Dan Balasescu 2021-04-21 16:46:09 +09:00 committed by GitHub
commit 452f282e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,9 +129,10 @@ namespace osu.Game.Overlays.Settings.Sections.Input
rotation.BindTo(handler.Rotation); rotation.BindTo(handler.Rotation);
rotation.BindValueChanged(val => rotation.BindValueChanged(val =>
{ {
tabletContainer.RotateTo(-val.NewValue, 800, Easing.OutQuint);
usableAreaContainer.RotateTo(val.NewValue, 100, Easing.OutQuint) usableAreaContainer.RotateTo(val.NewValue, 100, Easing.OutQuint)
.OnComplete(_ => checkBounds()); // required as we are using SSDQ. .OnComplete(_ => checkBounds()); // required as we are using SSDQ.
}); }, true);
tablet.BindTo(handler.Tablet); tablet.BindTo(handler.Tablet);
tablet.BindValueChanged(_ => Scheduler.AddOnce(updateTabletDetails)); tablet.BindValueChanged(_ => Scheduler.AddOnce(updateTabletDetails));
@ -183,8 +184,10 @@ namespace osu.Game.Overlays.Settings.Sections.Input
if (!(tablet.Value?.Size is Vector2 size)) if (!(tablet.Value?.Size is Vector2 size))
return; return;
float fitX = size.X / (DrawWidth - Padding.Left - Padding.Right); float maxDimension = size.LengthFast;
float fitY = size.Y / DrawHeight;
float fitX = maxDimension / (DrawWidth - Padding.Left - Padding.Right);
float fitY = maxDimension / DrawHeight;
float adjust = MathF.Max(fitX, fitY); float adjust = MathF.Max(fitX, fitY);