diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-02-25 15:05:59 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2017-02-25 15:05:59 +0100 |
commit | dd0f06f9a15e991021c1e8cbd007e3b8b67ddcde (patch) | |
tree | 63ea4e4fca4087c46e3eaf0cc9647f781e4f0bcd /dist/svg.js | |
parent | e7c025d2a4f8f536432870ebac903e24392896f0 (diff) | |
download | svg.js-dd0f06f9a15e991021c1e8cbd007e3b8b67ddcde.tar.gz svg.js-dd0f06f9a15e991021c1e8cbd007e3b8b67ddcde.zip |
viewbox now also accepts arrays and strings
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/dist/svg.js b/dist/svg.js index 0a54aab..ff71f85 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -6,7 +6,7 @@ * @copyright Wout Fierens <wout@mick-wout.com> * @license MIT * -* BUILT: Fri Feb 24 2017 21:46:50 GMT+0100 (Mitteleuropäische Zeit) +* BUILT: Sat Feb 25 2017 15:05:15 GMT+0100 (Mitteleuropäische Zeit) */; (function(root, factory) { if (typeof define === 'function' && define.amd) { @@ -3268,28 +3268,21 @@ SVG.ViewBox = SVG.invent({ toString: function() { return this.x + ' ' + this.y + ' ' + this.width + ' ' + this.height } - , morph: function(v){ - - var v = arguments.length == 1 ? - [v.x, v.y, v.width, v.height] : - [].slice.call(arguments) - - this.destination = new SVG.ViewBox(v) - + , morph: function(x, y, width, height){ + this.destination = new SVG.ViewBox(x, y, width, height) return this - } , at: function(pos) { - if(!this.destination) return this + if(!this.destination) return this - return new SVG.ViewBox([ - this.x + (this.destination.x - this.x) * pos - , this.y + (this.destination.y - this.y) * pos - , this.width + (this.destination.width - this.width) * pos - , this.height + (this.destination.height - this.height) * pos - ]) + return new SVG.ViewBox([ + this.x + (this.destination.x - this.x) * pos + , this.y + (this.destination.y - this.y) * pos + , this.width + (this.destination.width - this.width) * pos + , this.height + (this.destination.height - this.height) * pos + ]) } @@ -3302,17 +3295,13 @@ SVG.ViewBox = SVG.invent({ , construct: { // get/set viewbox - viewbox: function(v) { + viewbox: function(x, y, width, height) { if (arguments.length == 0) // act as a getter if there are no arguments return new SVG.ViewBox(this) // otherwise act as a setter - v = arguments.length == 1 ? - [v.x, v.y, v.width, v.height] : - [].slice.call(arguments) - - return this.attr('viewBox', v) + return this.attr('viewBox', new SVG.ViewBox(x, y, width, height)) } } |