diff options
author | Rémi Tétreault <tetreault.remi@gmail.com> | 2017-02-22 00:20:09 -0500 |
---|---|---|
committer | Rémi Tétreault <tetreault.remi@gmail.com> | 2017-02-22 00:20:09 -0500 |
commit | 669c10a76ebd164c147d7f896fa162784c0b49df (patch) | |
tree | 7e8a86edc4b6bdcfb478347ef25e2a854b852f20 /dist/svg.js | |
parent | 2d11717fe6ccd6b420f2faa5d56e3064e8574d18 (diff) | |
download | svg.js-669c10a76ebd164c147d7f896fa162784c0b49df.tar.gz svg.js-669c10a76ebd164c147d7f896fa162784c0b49df.zip |
Allow 0 to be passed without unit
This commit finish fixing issue #552. It makes it unnecessary to specify a
unit with 0 when interacting with another SVG.Number that has a unit.
This was accomplished by modifying the operation methods of SVG.Number to
allow them to use the unit of the passed number when this number as no unit.
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/dist/svg.js b/dist/svg.js index 6a9ae01..e540a33 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7 +6,7 @@ * @copyright Wout Fierens <wout@mick-wout.com> * @license MIT * -* BUILT: Mon Feb 20 2017 15:25:03 GMT+0100 (Mitteleuropäische Zeit) +* BUILT: Wed Feb 22 2017 00:19:11 GMT-0500 (EST) */; (function(root, factory) { if (typeof define === 'function' && define.amd) { @@ -974,19 +974,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) { |