mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-14 06:49:56 -05:00
Tooltips: Only show 2 digits max after decimal point (#1232)
This commit is contained in:
@@ -116,13 +116,15 @@ class ModifiableValue {
|
||||
}
|
||||
toString() {
|
||||
let valueString;
|
||||
const roundedValue = this.value ? Number(this.value.toFixed(2)) : 0;
|
||||
const roundedMaxValue = this.maxValue ? Number(this.maxValue.toFixed(2)) : 0;
|
||||
if (this.isAccuracy) {
|
||||
valueString = this.value ? `${this.value}%` : `can't miss`;
|
||||
valueString = this.value ? `${roundedValue}%` : `can't miss`;
|
||||
} else {
|
||||
valueString = this.value ? `${this.value}` : ``;
|
||||
valueString = this.value ? `${roundedValue}` : ``;
|
||||
}
|
||||
if (this.maxValue) {
|
||||
valueString += ` to ${this.maxValue}` + (this.isAccuracy ? '%' : '');
|
||||
valueString += ` to ${roundedMaxValue}` + (this.isAccuracy ? '%' : '');
|
||||
}
|
||||
return valueString + this.comment.join('');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user