diff options
author | wout <wout@impinc.co.uk> | 2012-12-29 15:20:50 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-29 15:20:50 +0100 |
commit | 331068a979be8b735e92f074ce0d2438f5f2127b (patch) | |
tree | 25983c08fc3c28ab7bdf5c394a4800b3b095d092 /src/poly.js | |
parent | a20c0b1430fb97ff203a9afd6ba6945cf18e58d1 (diff) | |
download | svg.js-331068a979be8b735e92f074ce0d2438f5f2127b.tar.gz svg.js-331068a979be8b735e92f074ce0d2438f5f2127b.zip |
Added polyline and polygon, removed cicle
Diffstat (limited to 'src/poly.js')
-rw-r--r-- | src/poly.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/poly.js b/src/poly.js new file mode 100644 index 0000000..e504b4c --- /dev/null +++ b/src/poly.js @@ -0,0 +1,38 @@ + +SVG.Poly = { + + // set polygon data with default zero point if no data is passed + plot: function(p) { + return this.attr('points', p || '0,0'); + }, + + // move path using translate + move: function(x, y) { + return this.transform({ x: x, y: y }); + } + +}; + + + +SVG.Polyline = function Polyline() { + this.constructor.call(this, SVG.create('polyline')); +}; + +// inherit from SVG.Shape +SVG.Polyline.prototype = new SVG.Shape(); + +// Add polygon-specific functions +SVG.extend(SVG.Polyline, SVG.Poly); + + + +SVG.Polygon = function Polygon() { + this.constructor.call(this, SVG.create('polygon')); +}; + +// inherit from SVG.Shape +SVG.Polygon.prototype = new SVG.Shape(); + +// Add polygon-specific functions +SVG.extend(SVG.Polygon, SVG.Poly);
\ No newline at end of file |