blob: 74a5700c90112e24bea4914e73be59f24a79e363 (
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
39
40
41
|
SVG.Polyline = function(unbiased) {
this.constructor.call(this, SVG.create('polyline'))
this.unbiased = unbiased
}
// Inherit from SVG.Shape
SVG.Polyline.prototype = new SVG.Shape
SVG.Polygon = function(unbiased) {
this.constructor.call(this, SVG.create('polygon'))
this.unbiased = unbiased
}
// Inherit from SVG.Shape
SVG.Polygon.prototype = new SVG.Shape
// Add polygon-specific functions
SVG.extend(SVG.Polyline, SVG.Polygon, {
// Private: Native plot
_plot: function(p) {
if (Array.isArray(p))
p = new SVG.Array(p, [[0,0]])
return this.attr('points', p)
}
})
//
SVG.extend(SVG.Container, {
// Create a wrapped polyline element
polyline: function(points, unbiased) {
return this.put(new SVG.Polyline(unbiased)).plot(points)
}
// Create a wrapped polygon element
, polygon: function(points, unbiased) {
return this.put(new SVG.Polygon(unbiased)).plot(points)
}
})
|