aboutsummaryrefslogtreecommitdiffstats
path: root/src/line.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-02-20 19:10:03 +0100
committerwout <wout@impinc.co.uk>2013-02-20 19:10:03 +0100
commitae878fd63077d4c95f2de9053a6f0951b55239eb (patch)
tree5dba7bd42a8b5702faeb6cc12d2b4d4099841e51 /src/line.js
parent5020240e4029a61a9620f21d7be4d9764e7723d1 (diff)
downloadsvg.js-ae878fd63077d4c95f2de9053a6f0951b55239eb.tar.gz
svg.js-ae878fd63077d4c95f2de9053a6f0951b55239eb.zip
Created separate classes for SVG.ViewBox anSVG.BBox0.6
Diffstat (limited to 'src/line.js')
-rw-r--r--src/line.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/line.js b/src/line.js
index b5dd2ef..1e783e4 100644
--- a/src/line.js
+++ b/src/line.js
@@ -1,37 +1,37 @@
-SVG.Line = function Line() {
- this.constructor.call(this, SVG.create('line'));
-};
+SVG.Line = function() {
+ this.constructor.call(this, SVG.create('line'))
+}
// Inherit from SVG.Shape
-SVG.Line.prototype = new SVG.Shape();
+SVG.Line.prototype = new SVG.Shape()
// Add required methods
SVG.extend(SVG.Line, {
// Move line
move: function(x, y) {
- var bbox = this.bbox();
+ 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
- });
+ })
},
// Move element by its center
center: function(x, y) {
- var bbox = this.bbox();
+ var bbox = this.bbox()
- return this.move(x - bbox.width / 2, y - bbox.height / 2);
+ return this.move(x - bbox.width / 2, y - bbox.height / 2)
},
// Set line size by width and height
size: function(width, height) {
- var bbox = this.bbox();
+ 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);
+ 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)
}
-});
+})
// Extend all container modules
SVG.extend(SVG.Container, {
@@ -41,6 +41,6 @@ SVG.extend(SVG.Container, {
y1: y1,
x2: x2,
y2: y2
- }));
+ }))
}
-}); \ No newline at end of file
+}) \ No newline at end of file