make Ox.formatUnit return 3 decimals

This commit is contained in:
rlx 2011-10-19 13:23:09 +00:00
parent b3ed2db267
commit 6cf769b740

View file

@ -11,7 +11,7 @@ Ox.formatArea = function(num, dec) {
return Ox.formatNumber( return Ox.formatNumber(
(km ? num / 1000000 : num).toPrecision(8) (km ? num / 1000000 : num).toPrecision(8)
) + ' ' + (km ? 'k' : '') + 'm\u00B2'; ) + ' ' + (km ? 'k' : '') + 'm\u00B2';
} };
/*@ /*@
Ox.formatColor <f> (strange one) Ox.formatColor <f> (strange one)
@ -572,7 +572,7 @@ Ox.formatString = function (str, obj) {
return str.replace(/\{([^}]+)\}/g, function(str, match) { return str.replace(/\{([^}]+)\}/g, function(str, match) {
return obj[match]; return obj[match];
}); });
} };
/*@ /*@
Ox.formatValue <f> Formats a numerical value Ox.formatValue <f> Formats a numerical value
@ -602,5 +602,5 @@ Ox.formatValue = function(num, str, bin) {
Ox.formatUnit <f> Formats a number with a unit Ox.formatUnit <f> Formats a number with a unit
@*/ @*/
Ox.formatUnit = function(num, str) { Ox.formatUnit = function(num, str) {
return num + ' ' + str; return Ox.formatNumber(num, 3) + ' ' + str;
} };