mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Allow the use of Formater without additional processing of numbers.
precision >= 16 will output numbers as is.
This commit is contained in:
parent
36a98706b3
commit
d1e4807c6a
1 changed files with 5 additions and 2 deletions
|
@ -32,8 +32,11 @@ var Formatter = Base.extend(/** @lends Formatter# */{
|
|||
*/
|
||||
number: function(val) {
|
||||
// It would be nice to use Number#toFixed() instead, but it pads with 0,
|
||||
// unecessarily consuming space.
|
||||
return Math.round(val * this.multiplier) / this.multiplier;
|
||||
// unnecessarily consuming space.
|
||||
// If precision is >= 16, don't do anything at all, since that appears
|
||||
// to be the limit of the precision (it actually varies).
|
||||
return this.precision < 16
|
||||
? Math.round(val * this.multiplier) / this.multiplier : val;
|
||||
},
|
||||
|
||||
pair: function(val1, val2, separator) {
|
||||
|
|
Loading…
Reference in a new issue