mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-04-24 10:11:05 +00:00
Made text inputs never give NaNs
This commit is contained in:
parent
bb0926c17d
commit
23cbfc7a9e
4 changed files with 11 additions and 5 deletions
js
|
@ -334,10 +334,13 @@ document.title = modInfo.name
|
|||
|
||||
// Converts a string value to whatever it's supposed to be
|
||||
function toValue(value, oldValue) {
|
||||
if (oldValue instanceof Decimal)
|
||||
return new Decimal (value)
|
||||
if (oldValue instanceof Decimal) {
|
||||
value = new Decimal (value)
|
||||
if (value.eq(decimalNaN)) return decimalZero
|
||||
return value
|
||||
}
|
||||
if (!isNaN(oldValue))
|
||||
return parseFloat(value)
|
||||
return parseFloat(value) || 0
|
||||
return value
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue