aboutsummaryrefslogtreecommitdiffstats
path: root/src/poly.js
blob: e504b4c8b2f68a87ab3d96a52c89541f197fabc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);