diff options
author | wout <wout@impinc.co.uk> | 2013-03-12 13:31:09 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-03-12 13:31:09 +0100 |
commit | 4bd21ec64a0e3c1d4d0acf5685b2230285c7c16b (patch) | |
tree | 0300a47ca1b263ae0cd0fdb5fe76218ceb9aa745 /src/ellipse.js | |
parent | 6c6c82ed59533f44f8754b69d47e3b11cd6dd129 (diff) | |
download | svg.js-4bd21ec64a0e3c1d4d0acf5685b2230285c7c16b.tar.gz svg.js-4bd21ec64a0e3c1d4d0acf5685b2230285c7c16b.zip |
Added x(), y(), cx(), cy() and matrix
Diffstat (limited to 'src/ellipse.js')
-rw-r--r-- | src/ellipse.js | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/ellipse.js b/src/ellipse.js index 6ff5608..1f9ef41 100644 --- a/src/ellipse.js +++ b/src/ellipse.js @@ -4,28 +4,31 @@ SVG.Ellipse = function() { } // Inherit from SVG.Shape -SVG.Ellipse.prototype = new SVG.Shape() +SVG.Ellipse.prototype = new SVG.Shape // SVG.extend(SVG.Ellipse, { - // Custom move function - move: function(x, y) { - this.attrs.x = x - this.attrs.y = y - - return this.center() - }, + // Move over x-axis + x: function(x) { + return this.cx(x + this.attrs.rx) + } + // Move over y-axis +, y: function(y) { + return this.cy(y + this.attrs.ry) + } + // Move by center over x-axis +, cx: function(x) { + return this.attr('cx', x) + } + // Move by center over y-axis +, cy: function(y) { + return this.attr('cy', y) + } // Custom size function - size: function(width, height) { - return this - .attr({ rx: width / 2, ry: (height != null ? height : width) / 2 }) - .center() - }, - // Custom center function - center: function(x, y) { +, size: function(width, height) { return this.attr({ - cx: x != null ? x : (this.attrs.x || 0) + (this.attrs.rx || 0) - , cy: y != null ? y : (this.attrs.y || 0) + (this.attrs.ry || 0) + rx: width / 2, + ry: height / 2 }) } |