blob: 194ff843391d5ca1f7f2ce49e279a00eb358c7b2 (
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
|
SVG.Shape = function Shape(element) {
this.constructor.call(this, element);
};
// inherit from SVG.Element
SVG.Shape.prototype = new SVG.Element();
// set fill color and opacity
SVG.Shape.prototype.fill = function(fill) {
if (fill.color != null)
this.setAttribute('fill', fill.color);
if (fill.opacity != null)
this.setAttribute('fill-opacity', fill.opacity);
return this;
};
// set stroke color and opacity
SVG.Shape.prototype.stroke = function(stroke) {
if (stroke.color != null)
this.setAttribute('stroke', stroke.color);
if (stroke.width != null)
this.setAttribute('stroke-width', stroke.width);
if (stroke.opacity != null)
this.setAttribute('stroke-opacity', stroke.opacity);
if (this.attributes['fill-opacity'] == null)
this.fill({ opacity: 0 });
return this;
};
|