aboutsummaryrefslogtreecommitdiffstats
path: root/src/line.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/line.js')
-rwxr-xr-x[-rw-r--r--]src/line.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/line.js b/src/line.js
index 2c9034e..a5a9b09 100644..100755
--- a/src/line.js
+++ b/src/line.js
@@ -35,13 +35,21 @@ SVG.extend(SVG.Line, {
var half = this.bbox().height / 2
return y == null ? this.y() + half : this.y(y - half)
}
+ // Set width of element
+, width: function(width) {
+ var b = this.bbox()
+
+ return width == null ? b.width : this.attr(this.attr('x1') < this.attr('x2') ? 'x2' : 'x1', b.x + width)
+ }
+ // Set height of element
+, height: function(height) {
+ var b = this.bbox()
+
+ return height == null ? b.height : this.attr(this.attr('y1') < this.attr('y2') ? 'y2' : 'y1', b.y + height)
+ }
// Set line size by width and height
, size: function(width, height) {
- var b = this.bbox()
-
- return this
- .attr(this.attr('x1') < this.attr('x2') ? 'x2' : 'x1', b.x + width)
- .attr(this.attr('y1') < this.attr('y2') ? 'y2' : 'y1', b.y + height)
+ return this.width(width).height(height)
}
// Set path data
, plot: function(x1, y1, x2, y2) {