diff options
Diffstat (limited to 'src/number.js')
-rw-r--r-- | src/number.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/number.js b/src/number.js index d0ccf4e..8198e7c 100644 --- a/src/number.js +++ b/src/number.js @@ -57,19 +57,23 @@ SVG.Number = SVG.invent({ } // Add number , plus: function(number) { - return new SVG.Number(this + new SVG.Number(number), this.unit) + number = new SVG.Number(number) + return new SVG.Number(this + number, this.unit || number.unit) } // Subtract number , minus: function(number) { - return this.plus(-new SVG.Number(number)) + number = new SVG.Number(number) + return new SVG.Number(this - number, this.unit || number.unit) } // Multiply number , times: function(number) { - return new SVG.Number(this * new SVG.Number(number), this.unit) + number = new SVG.Number(number) + return new SVG.Number(this * number, this.unit || number.unit) } // Divide number , divide: function(number) { - return new SVG.Number(this / new SVG.Number(number), this.unit) + number = new SVG.Number(number) + return new SVG.Number(this / number, this.unit || number.unit) } // Convert to different unit , to: function(unit) { |