1
0
mirror of synced 2024-11-28 00:20:53 +01:00

Limit displayed negative result values to 0

This commit is contained in:
shiibe 2022-10-15 17:57:33 -04:00
parent 30df91771e
commit 91b6a6262d

View File

@ -34,6 +34,7 @@
var danClearStateString = GetDanClearStateString(danResultState); var danClearStateString = GetDanClearStateString(danResultState);
} }
<img src=@($"/images/dani_{danResultState.ToString()}.png") style="max-width:150px; width:100%;" alt="danResultState.ToString()"/> <img src=@($"/images/dani_{danResultState.ToString()}.png") style="max-width:150px; width:100%;" alt="danResultState.ToString()"/>
<MudText Typo="Typo.body1">@danClearStateString</MudText>
</MudStack> </MudStack>
</MudCardContent> </MudCardContent>
</MudCard> </MudCard>
@ -296,8 +297,11 @@
resultText = "Gold"; resultText = "Gold";
} }
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@(redRequirement - bestData)"> var resultValue = redRequirement - bestData;
<MudText Typo="Typo.caption">@(redRequirement - bestData)</MudText> if (resultValue < 0) resultValue = 0;
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@resultValue">
<MudText Typo="Typo.caption">@resultValue</MudText>
</MudProgressLinear> </MudProgressLinear>
<MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText> <MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText>
} }
@ -385,9 +389,11 @@
barClass = "bar-pass-gold"; barClass = "bar-pass-gold";
resultText = "Gold"; resultText = "Gold";
} }
var resultValue = redRequirement - bestData;
if (resultValue < 0) resultValue = 0;
<MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@(redRequirement - bestData)"> <MudProgressLinear Class="@barClass" Rounded="true" Size="Size.Large" Max="@redRequirement" Value="@resultValue">
<MudText Typo="Typo.caption">@(redRequirement - bestData)</MudText> <MudText Typo="Typo.caption">@resultValue</MudText>
</MudProgressLinear> </MudProgressLinear>
<MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText> <MudText Typo="Typo.caption" Style="text-align: right">@resultText</MudText>
} }