aboutsummaryrefslogtreecommitdiffstats
path: root/src/line.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-01-22 12:48:49 +0100
committerwout <wout@impinc.co.uk>2014-01-22 12:48:49 +0100
commitb27d01e9f91bff6145170ebd46857cd703480fec (patch)
treeaca9a0b30423ec4f7db769969ae5f3b25c7893df /src/line.js
parentdf8db4b03df6740e47851907a4b901362634c50b (diff)
downloadsvg.js-b27d01e9f91bff6145170ebd46857cd703480fec.tar.gz
svg.js-b27d01e9f91bff6145170ebd46857cd703480fec.zip
Bumped to v0.33
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) {