Move some backing fields to match others.

formatting pt.2
This commit is contained in:
MutantAura 2024-05-30 19:44:56 +01:00 committed by Evan Husted
parent e1f5c501b0
commit 43ece083b2

View File

@ -24,15 +24,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
private const int DrawStickCanvasSize = 100; private const int DrawStickCanvasSize = 100;
private const int DrawStickBorderSize = DrawStickCanvasSize + 5; private const int DrawStickBorderSize = DrawStickCanvasSize + 5;
private const float DrawStickCanvasCenter = (DrawStickCanvasSize - DrawStickCircumference) / 2; private const float DrawStickCanvasCenter = (DrawStickCanvasSize - DrawStickCircumference) / 2;
private const float MaxVectorLength = DrawStickCanvasSize / 2; private const float MaxVectorLength = DrawStickCanvasSize / 2;
private IGamepad _selectedGamepad; private IGamepad _selectedGamepad;
// Offset from origin for UI stick visualization.
private (float, float) _uiStickLeft;
private (float, float) _uiStickRight;
private float _vectorLength; private float _vectorLength;
private float _vectorMultiplier; private float _vectorMultiplier;
@ -64,10 +60,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
} }
public bool HasSides => IsLeft ^ IsRight; public bool HasSides => IsLeft ^ IsRight;
[ObservableProperty] private SvgImage _image; [ObservableProperty] private SvgImage _image;
public InputViewModel ParentModel { get; } public InputViewModel ParentModel { get; }
private (float, float) _uiStickLeft;
public (float, float) UiStickLeft public (float, float) UiStickLeft
{ {
@ -83,6 +81,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
} }
} }
private (float, float) _uiStickRight;
public (float, float) UiStickRight public (float, float) UiStickRight
{ {
get => (_uiStickRight.Item1 * DrawStickScaleFactor, _uiStickRight.Item2 * DrawStickScaleFactor); get => (_uiStickRight.Item1 * DrawStickScaleFactor, _uiStickRight.Item2 * DrawStickScaleFactor);
@ -121,15 +120,15 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{ {
get get
{ {
_vectorMultiplier = 1; _vectorMultiplier = 1;
_vectorLength = GetVectorLength(UiStickLeft); _vectorLength = GetVectorLength(UiStickLeft);
if (_vectorLength > MaxVectorLength) if (_vectorLength > MaxVectorLength)
{ {
_vectorMultiplier = MaxVectorLength / _vectorLength; _vectorMultiplier = MaxVectorLength / _vectorLength;
} }
return (UiStickLeft.Item2 * _vectorMultiplier) + DrawStickCanvasCenter; return (UiStickLeft.Item2 * _vectorMultiplier) + DrawStickCanvasCenter;
} }
} }
@ -137,15 +136,15 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{ {
get get
{ {
_vectorMultiplier = 1; _vectorMultiplier = 1;
_vectorLength = GetVectorLength(UiStickRight); _vectorLength = GetVectorLength(UiStickRight);
if (_vectorLength > MaxVectorLength) if (_vectorLength > MaxVectorLength)
{ {
_vectorMultiplier = MaxVectorLength / _vectorLength; _vectorMultiplier = MaxVectorLength / _vectorLength;
} }
return (UiStickRight.Item1 * _vectorMultiplier) + DrawStickCanvasCenter; return (UiStickRight.Item1 * _vectorMultiplier) + DrawStickCanvasCenter;
} }
} }
@ -153,15 +152,15 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{ {
get get
{ {
_vectorMultiplier = 1; _vectorMultiplier = 1;
_vectorLength = GetVectorLength(UiStickRight); _vectorLength = GetVectorLength(UiStickRight);
if (_vectorLength > MaxVectorLength) if (_vectorLength > MaxVectorLength)
{ {
_vectorMultiplier = MaxVectorLength / _vectorLength; _vectorMultiplier = MaxVectorLength / _vectorLength;
} }
return (UiStickRight.Item2 * _vectorMultiplier) + DrawStickCanvasCenter; return (UiStickRight.Item2 * _vectorMultiplier) + DrawStickCanvasCenter;
} }
} }