summaryrefslogtreecommitdiffstats
path: root/src/line.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-03-09 22:28:47 +0100
committerwout <wout@impinc.co.uk>2013-03-09 22:28:47 +0100
commit6c6c82ed59533f44f8754b69d47e3b11cd6dd129 (patch)
treeadaef53d8970acb228fe14d490c532f1baabbb13 /src/line.js
parent16c4a146ee97fa43e0c456fe801490351e551e96 (diff)
downloadsvg.js-6c6c82ed59533f44f8754b69d47e3b11cd6dd129.tar.gz
svg.js-6c6c82ed59533f44f8754b69d47e3b11cd6dd129.zip
Bumped to v0.9, added better style management, text support and extended animation functionality0.10
Diffstat (limited to 'src/line.js')
-rw-r--r--src/line.js29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/line.js b/src/line.js
index 1e783e4..0712f1e 100644
--- a/src/line.js
+++ b/src/line.js
@@ -12,24 +12,25 @@ SVG.extend(SVG.Line, {
var bbox = this.bbox()
return this.attr({
- x1: this.attr('x1') - bbox.x + x,
- y1: this.attr('y1') - bbox.y + y,
- x2: this.attr('x2') - bbox.x + x,
- y2: this.attr('y2') - bbox.y + y
+ x1: this.attr('x1') - bbox.x + x
+ , y1: this.attr('y1') - bbox.y + y
+ , x2: this.attr('x2') - bbox.x + x
+ , y2: this.attr('y2') - bbox.y + y
})
- },
+ }
// Move element by its center
- center: function(x, y) {
+, center: function(x, y) {
var bbox = this.bbox()
return this.move(x - bbox.width / 2, y - bbox.height / 2)
- },
+ }
// Set line size by width and height
- size: function(width, height) {
+, size: function(width, height) {
var bbox = this.bbox()
- this.attr(this.attr('x1') < this.attr('x2') ? 'x2' : 'x1', bbox.x + width)
- return this.attr(this.attr('y1') < this.attr('y2') ? 'y2' : 'y1', bbox.y + height)
+ return this
+ .attr(this.attr('x1') < this.attr('x2') ? 'x2' : 'x1', bbox.x + width)
+ .attr(this.attr('y1') < this.attr('y2') ? 'y2' : 'y1', bbox.y + height)
}
})
@@ -37,10 +38,10 @@ SVG.extend(SVG.Line, {
SVG.extend(SVG.Container, {
line: function(x1, y1, x2, y2) {
return this.put(new SVG.Line().attr({
- x1: x1,
- y1: y1,
- x2: x2,
- y2: y2
+ x1: x1
+ , y1: y1
+ , x2: x2
+ , y2: y2
}))
}
}) \ No newline at end of file