mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2025-04-23 17:51:06 +00:00
Fix layer ordering issues
This commit is contained in:
parent
8d6275bf0f
commit
b063265d03
6 changed files with 46 additions and 8 deletions
js
|
@ -16,6 +16,13 @@ function commaFormat(num, precision) {
|
|||
return num.toStringWithDecimalPlaces(precision).replace(/\B(?=(\d{3})+(?!\d))/g, ",")
|
||||
}
|
||||
|
||||
|
||||
function regularFormat(num, precision) {
|
||||
if (num === null || num === undefined) return "NaN"
|
||||
if (num.mag < 0.001) return (0).toFixed(precision)
|
||||
return num.toStringWithDecimalPlaces(precision)
|
||||
}
|
||||
|
||||
function fixValue(x, y = 0) {
|
||||
return x || new Decimal(y)
|
||||
}
|
||||
|
@ -41,7 +48,7 @@ function format(decimal, precision=2) {
|
|||
} else if (decimal.gte("1e1000")) return exponentialFormat(decimal, 0)
|
||||
else if (decimal.gte(1e9)) return exponentialFormat(decimal, precision)
|
||||
else if (decimal.gte(1e3)) return commaFormat(decimal, 0)
|
||||
else return commaFormat(decimal, precision)
|
||||
else return regularFormat(decimal, precision)
|
||||
}
|
||||
|
||||
function formatWhole(decimal) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue