Added rounding back to LS and RS Deadzone controls

Related to issue #1150
This commit is contained in:
Travis Nickles 2020-04-12 06:15:13 -05:00
parent 2416a8e06a
commit 56dd7b9bf7
2 changed files with 8 additions and 8 deletions

View File

@ -368,9 +368,9 @@
<TextBlock Text="RS" Grid.Column="2" HorizontalAlignment="Center" FontWeight="Bold" Margin="0,0,0,8"/> <TextBlock Text="RS" Grid.Column="2" HorizontalAlignment="Center" FontWeight="Bold" Margin="0,0,0,8"/>
<Label Content="Dead Zone:" Grid.Row="1" Grid.Column="0" /> <Label Content="Dead Zone:" Grid.Row="1" Grid.Column="0" />
<xctk:DoubleUpDown d:IsHidden="True" Value="{Binding LSDeadZone}" FormatString="F2" MinWidth="50" Grid.Row="1" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1" <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding LSDeadZone,UpdateSourceTrigger=LostFocus}" FormatString="F2" MinWidth="50" Grid.Row="1" Grid.Column="1" Maximum="1.0" Minimum="0.0" Increment="0.1"
Margin="{StaticResource spaceMargin}" /> Margin="{StaticResource spaceMargin}" />
<xctk:DoubleUpDown d:IsHidden="True" Value="{Binding RSDeadZone}" FormatString="F2" MinWidth="50" Grid.Row="1" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1" <xctk:DoubleUpDown d:IsHidden="True" Value="{Binding RSDeadZone,UpdateSourceTrigger=LostFocus}" FormatString="F2" MinWidth="50" Grid.Row="1" Grid.Column="2" Maximum="1.0" Minimum="0.0" Increment="0.1"
Margin="{StaticResource spaceMargin}" /> Margin="{StaticResource spaceMargin}" />
<Label Content="Max Zone:" Grid.Row="2" Grid.Column="0" /> <Label Content="Max Zone:" Grid.Row="2" Grid.Column="0" />

View File

@ -718,12 +718,12 @@ namespace DS4WinWPF.DS4Forms.ViewModels
public double LSDeadZone public double LSDeadZone
{ {
get => Global.LSModInfo[device].deadZone / 127d; get => Math.Round(Global.LSModInfo[device].deadZone / 127d, 2);
set set
{ {
double temp = Global.LSModInfo[device].deadZone / 127d; double temp = Math.Round(Global.LSModInfo[device].deadZone / 127d, 2);
if (temp == value) return; if (temp == value) return;
Global.LSModInfo[device].deadZone = (int)(value * 127d); Global.LSModInfo[device].deadZone = (int)Math.Round(value * 127d);
LSDeadZoneChanged?.Invoke(this, EventArgs.Empty); LSDeadZoneChanged?.Invoke(this, EventArgs.Empty);
} }
} }
@ -731,12 +731,12 @@ namespace DS4WinWPF.DS4Forms.ViewModels
public double RSDeadZone public double RSDeadZone
{ {
get => Global.RSModInfo[device].deadZone / 127d; get => Math.Round(Global.RSModInfo[device].deadZone / 127d, 2);
set set
{ {
double temp = Global.RSModInfo[device].deadZone / 127d; double temp = Math.Round(Global.RSModInfo[device].deadZone / 127d, 2);
if (temp == value) return; if (temp == value) return;
Global.RSModInfo[device].deadZone = (int)(value * 127d); Global.RSModInfo[device].deadZone = (int)Math.Round(value * 127d);
RSDeadZoneChanged?.Invoke(this, EventArgs.Empty); RSDeadZoneChanged?.Invoke(this, EventArgs.Empty);
} }
} }