diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-02-28 18:55:27 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-02-28 18:55:27 +0100 |
commit | 49bdb2864c133c2c42fa0c5a42b30409ae044137 (patch) | |
tree | 370928a0b6e038e57b6b94353ecd8da72d220c5c /src | |
parent | b2a855e196e09821e0b8463bd5fbd404d5740ed4 (diff) | |
download | svg.js-49bdb2864c133c2c42fa0c5a42b30409ae044137.tar.gz svg.js-49bdb2864c133c2c42fa0c5a42b30409ae044137.zip |
fixed bug in SVG.Transformations when creating with array/argument list.
added tests to increase code coverage
Diffstat (limited to 'src')
-rw-r--r-- | src/transform.js | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/transform.js b/src/transform.js index 33f5019..37b5e3b 100644 --- a/src/transform.js +++ b/src/transform.js @@ -221,19 +221,17 @@ SVG.Transformation = SVG.invent({ create: function(source, inversed){ if(arguments.length > 1 && typeof inversed != 'boolean'){ - return this.create([].slice.call(arguments)) - } - - if(typeof source == 'object'){ - for(var i = 0, len = this.arguments.length; i < len; ++i){ - this[this.arguments[i]] = source[this.arguments[i]] - } + return this.constructor.call(this, [].slice.call(arguments)) } if(Array.isArray(source)){ for(var i = 0, len = this.arguments.length; i < len; ++i){ this[this.arguments[i]] = source[i] } + } else if(typeof source == 'object'){ + for(var i = 0, len = this.arguments.length; i < len; ++i){ + this[this.arguments[i]] = source[this.arguments[i]] + } } this.inversed = false @@ -246,7 +244,10 @@ SVG.Transformation = SVG.invent({ , extend: { - at: function(pos){ + arguments: [] + , method: '' + + , at: function(pos){ var params = [] @@ -288,8 +289,7 @@ SVG.Translate = SVG.invent({ , inherit: SVG.Transformation , create: function(source, inversed){ - if(typeof source == 'object') this.constructor.call(this, source, inversed) - else this.constructor.call(this, [].slice.call(arguments)) + this.constructor.apply(this, [].slice.call(arguments)) } , extend: { @@ -305,8 +305,7 @@ SVG.Rotate = SVG.invent({ , inherit: SVG.Transformation , create: function(source, inversed){ - if(typeof source == 'object') this.constructor.call(this, source, inversed) - else this.constructor.call(this, [].slice.call(arguments)) + this.constructor.apply(this, [].slice.call(arguments)) } , extend: { @@ -329,8 +328,7 @@ SVG.Scale = SVG.invent({ , inherit: SVG.Transformation , create: function(source, inversed){ - if(typeof source == 'object') this.constructor.call(this, source, inversed) - else this.constructor.call(this, [].slice.call(arguments)) + this.constructor.apply(this, [].slice.call(arguments)) } , extend: { @@ -346,8 +344,7 @@ SVG.Skew = SVG.invent({ , inherit: SVG.Transformation , create: function(source, inversed){ - if(typeof source == 'object') this.constructor.call(this, source, inversed) - else this.constructor.call(this, [].slice.call(arguments)) + this.constructor.apply(this, [].slice.call(arguments)) } , extend: { |