diff --git a/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs index fa5432d7e..5b97f1f83 100644 --- a/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs @@ -3,7 +3,6 @@ using Ryujinx.Ava.Input; using Ryujinx.Ava.UI.Models.Input; using Ryujinx.Ava.UI.Views.Input; using Ryujinx.Input; -using System; using System.Threading; using System.Threading.Tasks; @@ -12,7 +11,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public class ControllerInputViewModel : BaseModel { private const int StickUiPollMs = 50; // Milliseconds per poll. - private const float CanvasCenterOffset = 47.5f; + private const int StickCircumference = 5; + + private const int CanvasSize = 100; + private const int StickBorderSize = CanvasSize + 5; + private const float CanvasCenterOffset = (CanvasSize - StickCircumference) / 2; private const int StickScaleFactor = 45; private IGamepad _selectedGamepad; @@ -100,15 +103,17 @@ namespace Ryujinx.Ava.UI.ViewModels.Input } } - public float canvasCenter => CanvasCenterOffset; + public int UiStickCircumference => StickCircumference; + public int UiCanvasSize => CanvasSize; + public int UiStickBorderSize => StickBorderSize; public float UiStickLeftX => UiStickLeft.Item1 + CanvasCenterOffset; public float UiStickLeftY => UiStickLeft.Item2 + CanvasCenterOffset; public float UiStickRightX => UiStickRight.Item1 + CanvasCenterOffset; public float UiStickRightY => UiStickRight.Item2 + CanvasCenterOffset; - public float UiDeadzoneLeft => Config.DeadzoneLeft * 95; - public float UiDeadzoneRight => Config.DeadzoneRight * 95; + public float UiDeadzoneLeft => Config.DeadzoneLeft * (CanvasSize - StickCircumference); + public float UiDeadzoneRight => Config.DeadzoneRight * (CanvasSize - StickCircumference); public readonly InputViewModel ParentModel; diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml index 1d8a3add0..8c905c591 100644 --- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml +++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml @@ -333,15 +333,15 @@ BorderBrush="{DynamicResource ThemeControlBorderColor}" BorderThickness="1" CornerRadius="5" - Height="105" - Width="105"> + Height="{Binding UiStickBorderSize}" + Width="{Binding UiStickBorderSize}"> + Height="{Binding UiCanvasSize}" + Width="{Binding UiCanvasSize}"> @@ -351,8 +351,8 @@ HorizontalAlignment="Center" Stroke="Black" StrokeThickness="1" - Width="100" - Height="100" + Width="{Binding UiCanvasSize}" + Height="{Binding UiCanvasSize}" Canvas.Bottom="2" Canvas.Left="2" /> @@ -375,15 +375,15 @@ BorderBrush="{DynamicResource ThemeControlBorderColor}" BorderThickness="1" CornerRadius="5" - Height="105" - Width="105"> + Height="{Binding UiStickBorderSize}" + Width="{Binding UiStickBorderSize}"> + Height="{Binding UiCanvasSize}" + Width="{Binding UiCanvasSize}"> @@ -393,8 +393,8 @@ HorizontalAlignment="Center" Stroke="Black" StrokeThickness="1" - Width="100" - Height="100" + Width="{Binding UiCanvasSize}" + Height="{Binding UiCanvasSize}" Canvas.Bottom="2" Canvas.Left="2" />