From a0076d75bbac8f2c128f9b34e976bcb1ea3caa09 Mon Sep 17 00:00:00 2001 From: wout Date: Sun, 24 Mar 2013 20:25:27 +0100 Subject: Added plot() method to SVG.Line --- src/container.js | 2 +- src/line.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/container.js b/src/container.js index 3983366..63822e4 100644 --- a/src/container.js +++ b/src/container.js @@ -87,7 +87,7 @@ SVG.extend(SVG.Container, { } // Create a line element , line: function(x1, y1, x2, y2) { - return this.put(new SVG.Line().attr({ x1: x1, y1: y1, x2: x2, y2: y2 })) + return this.put(new SVG.Line().plot(x1, y1, x2, y2)) } // Create a wrapped polyline element , polyline: function(points) { diff --git a/src/line.js b/src/line.js index 893fe62..b32141c 100644 --- a/src/line.js +++ b/src/line.js @@ -43,5 +43,14 @@ SVG.extend(SVG.Line, { .attr(this.attr('x1') < this.attr('x2') ? 'x2' : 'x1', b.x + width) .attr(this.attr('y1') < this.attr('y2') ? 'y2' : 'y1', b.y + height) } + // Set path data +, plot: function(x1, y1, x2, y2) { + return this.attr({ + x1: x1 + , y1: y1 + , x2: x2 + , y2: y2 + }) + } }) -- cgit v1.2.3