blob: 1f9ef41ba965580fe1e2ec4f6de56e781c07761a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
//
SVG.Ellipse = function() {
this.constructor.call(this, SVG.create('ellipse'))
}
// Inherit from SVG.Shape
SVG.Ellipse.prototype = new SVG.Shape
//
SVG.extend(SVG.Ellipse, {
// 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 / 2
})
}
})
// Usage:
// draw.ellipse(200, 100)
|