diff options
-rw-r--r-- | Rakefile | 2 | ||||
-rw-r--r-- | dist/svg.js | 70 | ||||
-rw-r--r-- | dist/svg.min.js | 4 | ||||
-rw-r--r-- | src/clip.js (renamed from src/clip_path.js) | 6 | ||||
-rw-r--r-- | src/container.js | 2 | ||||
-rw-r--r-- | src/defs.js | 2 | ||||
-rw-r--r-- | src/doc.js (renamed from src/document.js) | 6 | ||||
-rw-r--r-- | src/element.js | 18 | ||||
-rw-r--r-- | src/g.js (renamed from src/group.js) | 8 | ||||
-rw-r--r-- | src/object.js | 31 | ||||
-rw-r--r-- | src/shape.js | 24 | ||||
-rw-r--r-- | src/svg.js | 2 |
12 files changed, 60 insertions, 115 deletions
@@ -1,6 +1,6 @@ SVGJS_VERSION = '0.1' -DEFAULT_MODULES = %w[ svg utils container element document defs shape rect circle ellipse path image group clip_path ] +DEFAULT_MODULES = %w[ svg utils container element doc defs shape rect circle ellipse path image g clip ] KILO = 1024 # how many bytes in a "kilobyte" diff --git a/dist/svg.js b/dist/svg.js index feea266..f0b8cc8 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js 0.1 - svg utils container element document defs shape rect circle ellipse path image group clip_path - svgjs.com/license */ +/* svg.js 0.1 - svg utils container element doc defs shape rect circle ellipse path image g clip - svgjs.com/license */ (function() { this.SVG = { @@ -11,7 +11,7 @@ }; this.svg = function(e) { - return new SVG.Document(e); + return new SVG.Doc(e); }; SVG.Utils = { @@ -99,7 +99,7 @@ }, group: function() { - var e = new SVG.Group(); + var e = new SVG.G(); this.add(e); return e; @@ -212,32 +212,20 @@ }, // remove element - destroy: function() { + remove: function() { return this.parent != null ? this.parent.remove(this) : void 0; }, // get parent document parentDoc: function() { - return this._parent(SVG.Document); + return this._parent(SVG.Doc); }, // get parent svg wrapper parentSVG: function() { return this.parentDoc(); }, - - //_D // set svg element attribute - //_D setAttribute: function(a, v, ns) { - //_D this.attrs[a] = v; - //_D - //_D if (ns != null) - //_D this.node.setAttributeNS(ns, a, v); - //_D else - //_D this.node.setAttribute(a, v); - //_D - //_D return this; - //_D }, - + // set svg element attribute attr: function(v) { var a = arguments; @@ -275,7 +263,7 @@ }); - SVG.Document = function Document(e) { + SVG.Doc = function Doc(e) { this.constructor.call(this, SVG.create('svg')); this.attr('xmlns', SVG.ns); @@ -289,10 +277,10 @@ }; // inherit from SVG.Element - SVG.Document.prototype = new SVG.Element(); + SVG.Doc.prototype = new SVG.Element(); // include the container object - SVG.Utils.merge(SVG.Document, SVG.Container); + SVG.Utils.merge(SVG.Doc, SVG.Container); SVG.Defs = function Defs() { this.constructor.call(this, SVG.create('defs')); @@ -309,7 +297,7 @@ // define clippath clipPath: function() { - var e = new SVG.ClipPath(); + var e = new SVG.Clip(); this.add(e); return e; @@ -328,26 +316,26 @@ SVG.Utils.merge(SVG.Shape, { // set fill color and opacity - fill: function(fill) { - if (fill.color != null) - this.attr('fill', fill.color); + fill: function(f) { + if (f.color != null) + this.attr('fill', f.color); - if (fill.opacity != null) - this.attr('fill-opacity', fill.opacity); + if (f.opacity != null) + this.attr('fill-opacity', f.opacity); return this; }, // set stroke color and opacity - stroke: function(stroke) { - if (stroke.color != null) - this.attr('stroke', stroke.color); + stroke: function(s) { + if (s.color) + this.attr('stroke', s.color); - if (stroke.width != null) - this.attr('stroke-width', stroke.width); + if (s.width != null) + this.attr('stroke-width', s.width); - if (stroke.opacity != null) - this.attr('stroke-opacity', stroke.opacity); + if (s.opacity != null) + this.attr('stroke-opacity', s.opacity); if (this.attrs['fill-opacity'] == null) this.fill({ opacity: 0 }); @@ -476,18 +464,18 @@ }); - SVG.Group = function Group() { + SVG.G = function G() { this.constructor.call(this, SVG.create('g')); }; // inherit from SVG.Element - SVG.Group.prototype = new SVG.Element(); + SVG.G.prototype = new SVG.Element(); // include the container object - SVG.Utils.merge(SVG.Group, SVG.Container); + SVG.Utils.merge(SVG.G, SVG.Container); // Add group-specific functions - SVG.Utils.merge(SVG.Group, { + SVG.Utils.merge(SVG.G, { // group rotation rotate: function(d) { @@ -499,16 +487,16 @@ var clipID = 0; - SVG.ClipPath = function ClipPath() { + SVG.Clip = function Clip() { this.constructor.call(this, SVG.create('clipPath')); this.id = '_' + (clipID++); this.attr('id', this.id); }; // inherit from SVG.Element - SVG.ClipPath.prototype = new SVG.Element(); + SVG.Clip.prototype = new SVG.Element(); // include the container object - SVG.Utils.merge(SVG.ClipPath, SVG.Container); + SVG.Utils.merge(SVG.Clip, SVG.Container); }).call(this); diff --git a/dist/svg.min.js b/dist/svg.min.js index cc7eb88..c8f59e5 100644 --- a/dist/svg.min.js +++ b/dist/svg.min.js @@ -1,2 +1,2 @@ -/* svg.js 0.1 - svg utils container element document defs shape rect circle ellipse path image group clip_path - svgjs.com/license */ -(function(){this.SVG={ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",create:function(e){return document.createElementNS(this.ns,e)}},this.svg=function(e){return new SVG.Document(e)},SVG.Utils={merge:function(e,t){for(var n in t)e.prototype[n]=t[n]}},SVG.Container={add:function(e){return this.addAt(e)},addAt:function(e,t){return this.contains(e)||(t=t==null?this.children().length:t,this.children().splice(t,0,e),this.node.insertBefore(e.node,this.node.childNodes[t+1]),e.parent=this),this},contains:function(e){return Array.prototype.indexOf.call(this.children(),e)>=0},children:function(){return this._children||[]},sendBack:function(e){var t=this.children().indexOf(e);if(t!==-1)return this.remove(e).addAt(e,t-1)},bringForward:function(e){var t=this.children().indexOf(e);if(t!==-1)return this.remove(e).addAt(e,t+1)},bringToFront:function(e){return this.contains(e)&&this.remove(e).add(e),this},sendToBottom:function(e){return this.contains(e)&&this.remove(e).addAt(e,0),this},remove:function(e){return this.removeAt(this.children().indexOf(e))},removeAt:function(e){if(0<=e&&e<this.children().length){var t=this.children()[e];this.children().splice(e,1),this.node.removeChild(t.node),t.parent=null}return this},defs:function(){return this._defs==null&&(this._defs=new SVG.Defs,this.add(this._defs)),this._defs},group:function(){var e=new SVG.Group;return this.add(e),e},rect:function(e){return this.place(new SVG.Rect,e)},circle:function(e){var t;return e!=null&&(t={x:e.x,y:e.y},e.r||e.radius?t.width=t.height=(e.r||e.radius)*2:t.width=t.height=e.width||e.height),this.place(new SVG.Circle,t)},ellipse:function(e){var t;return e!=null&&(t={x:e.x,y:e.y},e.width&&(t.width=e.width),e.height&&(t.height=e.height),e.rx&&(t.width=e.rx*2),e.ry&&(t.height=e.ry*2)),this.place(new SVG.Ellipse,t)},path:function(e){return this.place(new SVG.Path,e)},image:function(e){return this.place(new SVG.Image,e)},place:function(e,t){return t!=null&&(t.x!=null&&t.y!=null&&e.move(t.x,t.y),t.width!=null&&t.height!=null&&e.size(t.width,t.height),t.data!=null&&e.data(t.data),t.src!=null&&e.load(t.src)),this.add(e),e}},SVG.Element=function(t){this.node=t,this.attrs={}},SVG.Utils.merge(SVG.Element,{move:function(e,t){return this.attr("x",e),this.attr("y",t),this},opacity:function(e){return this.attr("opacity",Math.max(0,Math.min(1,e)))},size:function(e,t){return this.attr("width",e),this.attr("height",t),this},clip:function(e){var t=this.parentSVG().defs().clipPath();return e(t),this.clipTo(t)},clipTo:function(e){return this.attr("clip-path","url(#"+e.id+")")},destroy:function(){return this.parent!=null?this.parent.remove(this):void 0},parentDoc:function(){return this._parent(SVG.Document)},parentSVG:function(){return this.parentDoc()},attr:function(e){var t=arguments;this.attrs[t[0]]=t[1];if(typeof e=="object")for(var n in e)this.attr(n,e[n]);else t.length==2?this.node.setAttribute(t[0],t[1]):t.length==3&&this.node.setAttributeNS(t[2],t[0],t[1]);return this},bbox:function(){return this.node.getBBox()},_parent:function(e){var t=this;while(t!=null&&!(t instanceof e))t=t.parent;return t}}),SVG.Document=function(t){this.constructor.call(this,SVG.create("svg")),this.attr("xmlns",SVG.ns),this.attr("version","1.1"),this.attr("xlink",SVG.xlink,SVG.ns),typeof t=="string"&&(t=document.getElementById(t)),t.appendChild(this.node)},SVG.Document.prototype=new SVG.Element,SVG.Utils.merge(SVG.Document,SVG.Container),SVG.Defs=function(){this.constructor.call(this,SVG.create("defs"))},SVG.Defs.prototype=new SVG.Element,SVG.Utils.merge(SVG.Defs,SVG.Container),SVG.Utils.merge(SVG.Defs,{clipPath:function(){var e=new SVG.ClipPath;return this.add(e),e}}),SVG.Shape=function(t){this.constructor.call(this,t)},SVG.Shape.prototype=new SVG.Element,SVG.Utils.merge(SVG.Shape,{fill:function(e){return e.color!=null&&this.attr("fill",e.color),e.opacity!=null&&this.attr("fill-opacity",e.opacity),this},stroke:function(e){return e.color!=null&&this.attr("stroke",e.color),e.width!=null&&this.attr("stroke-width",e.width),e.opacity!=null&&this.attr("stroke-opacity",e.opacity),this.attrs["fill-opacity"]==null&&this.fill({opacity:0}),this}}),SVG.Rect=function(){this.constructor.call(this,SVG.create("rect"))},SVG.Rect.prototype=new SVG.Shape,SVG.Circle=function(){this.constructor.call(this,SVG.create("circle"))},SVG.Circle.prototype=new SVG.Shape,SVG.Utils.merge(SVG.Circle,{move:function(e,t){return this.attrs.x=e,this.attrs.y=t,this.center(),this},size:function(e,t){return this.attr("r",e/2),this.center(),this},center:function(e,t){var n=this.attrs.r||0;this.attr("cx",e||(this.attrs.x||0)+n),this.attr("cy",t||(this.attrs.y||0)+n)}}),SVG.Ellipse=function(){this.constructor.call(this,SVG.create("ellipse"))},SVG.Ellipse.prototype=new SVG.Shape,SVG.Utils.merge(SVG.Ellipse,{move:function(e,t){return this.attrs.x=e,this.attrs.y=t,this.center(),this},size:function(e,t){return this.attr("rx",e/2),this.attr("ry",t/2),this.center(),this},center:function(e,t){this.attr("cx",e||(this.attrs.x||0)+(this.attrs.rx||0)),this.attr("cy",t||(this.attrs.y||0)+(this.attrs.ry||0))}}),SVG.Path=function(){this.constructor.call(this,SVG.create("path"))},SVG.Path.prototype=new SVG.Shape,SVG.Utils.merge(SVG.Path,{data:function(e){return this.attr("d",e),this}}),SVG.Image=function(){this.constructor.call(this,SVG.create("image"))},SVG.Image.prototype=new SVG.Element,SVG.Utils.merge(SVG.Image,SVG.Container),SVG.Utils.merge(SVG.Image,{load:function(e){return this.attr("href",e,SVG.xlink),this}}),SVG.Group=function(){this.constructor.call(this,SVG.create("g"))},SVG.Group.prototype=new SVG.Element,SVG.Utils.merge(SVG.Group,SVG.Container),SVG.Utils.merge(SVG.Group,{rotate:function(e){return this.attr("transform","rotate("+e+")"),this}});var e=0;SVG.ClipPath=function(){this.constructor.call(this,SVG.create("clipPath")),this.id="_"+e++,this.attr("id",this.id)},SVG.ClipPath.prototype=new SVG.Element,SVG.Utils.merge(SVG.ClipPath,SVG.Container)}).call(this);
\ No newline at end of file +/* svg.js 0.1 - svg utils container element doc defs shape rect circle ellipse path image g clip - svgjs.com/license */ +(function(){this.SVG={ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",create:function(e){return document.createElementNS(this.ns,e)}},this.svg=function(e){return new SVG.Doc(e)},SVG.Utils={merge:function(e,t){for(var n in t)e.prototype[n]=t[n]}},SVG.Container={add:function(e){return this.addAt(e)},addAt:function(e,t){return this.contains(e)||(t=t==null?this.children().length:t,this.children().splice(t,0,e),this.node.insertBefore(e.node,this.node.childNodes[t+1]),e.parent=this),this},contains:function(e){return Array.prototype.indexOf.call(this.children(),e)>=0},children:function(){return this._children||[]},sendBack:function(e){var t=this.children().indexOf(e);if(t!==-1)return this.remove(e).addAt(e,t-1)},bringForward:function(e){var t=this.children().indexOf(e);if(t!==-1)return this.remove(e).addAt(e,t+1)},bringToFront:function(e){return this.contains(e)&&this.remove(e).add(e),this},sendToBottom:function(e){return this.contains(e)&&this.remove(e).addAt(e,0),this},remove:function(e){return this.removeAt(this.children().indexOf(e))},removeAt:function(e){if(0<=e&&e<this.children().length){var t=this.children()[e];this.children().splice(e,1),this.node.removeChild(t.node),t.parent=null}return this},defs:function(){return this._defs==null&&(this._defs=new SVG.Defs,this.add(this._defs)),this._defs},group:function(){var e=new SVG.G;return this.add(e),e},rect:function(e){return this.place(new SVG.Rect,e)},circle:function(e){var t;return e!=null&&(t={x:e.x,y:e.y},e.r||e.radius?t.width=t.height=(e.r||e.radius)*2:t.width=t.height=e.width||e.height),this.place(new SVG.Circle,t)},ellipse:function(e){var t;return e!=null&&(t={x:e.x,y:e.y},e.width&&(t.width=e.width),e.height&&(t.height=e.height),e.rx&&(t.width=e.rx*2),e.ry&&(t.height=e.ry*2)),this.place(new SVG.Ellipse,t)},path:function(e){return this.place(new SVG.Path,e)},image:function(e){return this.place(new SVG.Image,e)},place:function(e,t){return t!=null&&(t.x!=null&&t.y!=null&&e.move(t.x,t.y),t.width!=null&&t.height!=null&&e.size(t.width,t.height),t.data!=null&&e.data(t.data),t.src!=null&&e.load(t.src)),this.add(e),e}},SVG.Element=function(t){this.node=t,this.attrs={}},SVG.Utils.merge(SVG.Element,{move:function(e,t){return this.attr("x",e),this.attr("y",t),this},opacity:function(e){return this.attr("opacity",Math.max(0,Math.min(1,e)))},size:function(e,t){return this.attr("width",e),this.attr("height",t),this},clip:function(e){var t=this.parentSVG().defs().clipPath();return e(t),this.clipTo(t)},clipTo:function(e){return this.attr("clip-path","url(#"+e.id+")")},remove:function(){return this.parent!=null?this.parent.remove(this):void 0},parentDoc:function(){return this._parent(SVG.Doc)},parentSVG:function(){return this.parentDoc()},attr:function(e){var t=arguments;this.attrs[t[0]]=t[1];if(typeof e=="object")for(var n in e)this.attr(n,e[n]);else t.length==2?this.node.setAttribute(t[0],t[1]):t.length==3&&this.node.setAttributeNS(t[2],t[0],t[1]);return this},bbox:function(){return this.node.getBBox()},_parent:function(e){var t=this;while(t!=null&&!(t instanceof e))t=t.parent;return t}}),SVG.Doc=function(t){this.constructor.call(this,SVG.create("svg")),this.attr("xmlns",SVG.ns),this.attr("version","1.1"),this.attr("xlink",SVG.xlink,SVG.ns),typeof t=="string"&&(t=document.getElementById(t)),t.appendChild(this.node)},SVG.Doc.prototype=new SVG.Element,SVG.Utils.merge(SVG.Doc,SVG.Container),SVG.Defs=function(){this.constructor.call(this,SVG.create("defs"))},SVG.Defs.prototype=new SVG.Element,SVG.Utils.merge(SVG.Defs,SVG.Container),SVG.Utils.merge(SVG.Defs,{clipPath:function(){var e=new SVG.Clip;return this.add(e),e}}),SVG.Shape=function(t){this.constructor.call(this,t)},SVG.Shape.prototype=new SVG.Element,SVG.Utils.merge(SVG.Shape,{fill:function(e){return e.color!=null&&this.attr("fill",e.color),e.opacity!=null&&this.attr("fill-opacity",e.opacity),this},stroke:function(e){return e.color&&this.attr("stroke",e.color),e.width!=null&&this.attr("stroke-width",e.width),e.opacity!=null&&this.attr("stroke-opacity",e.opacity),this.attrs["fill-opacity"]==null&&this.fill({opacity:0}),this}}),SVG.Rect=function(){this.constructor.call(this,SVG.create("rect"))},SVG.Rect.prototype=new SVG.Shape,SVG.Circle=function(){this.constructor.call(this,SVG.create("circle"))},SVG.Circle.prototype=new SVG.Shape,SVG.Utils.merge(SVG.Circle,{move:function(e,t){return this.attrs.x=e,this.attrs.y=t,this.center(),this},size:function(e,t){return this.attr("r",e/2),this.center(),this},center:function(e,t){var n=this.attrs.r||0;this.attr("cx",e||(this.attrs.x||0)+n),this.attr("cy",t||(this.attrs.y||0)+n)}}),SVG.Ellipse=function(){this.constructor.call(this,SVG.create("ellipse"))},SVG.Ellipse.prototype=new SVG.Shape,SVG.Utils.merge(SVG.Ellipse,{move:function(e,t){return this.attrs.x=e,this.attrs.y=t,this.center(),this},size:function(e,t){return this.attr("rx",e/2),this.attr("ry",t/2),this.center(),this},center:function(e,t){this.attr("cx",e||(this.attrs.x||0)+(this.attrs.rx||0)),this.attr("cy",t||(this.attrs.y||0)+(this.attrs.ry||0))}}),SVG.Path=function(){this.constructor.call(this,SVG.create("path"))},SVG.Path.prototype=new SVG.Shape,SVG.Utils.merge(SVG.Path,{data:function(e){return this.attr("d",e),this}}),SVG.Image=function(){this.constructor.call(this,SVG.create("image"))},SVG.Image.prototype=new SVG.Element,SVG.Utils.merge(SVG.Image,SVG.Container),SVG.Utils.merge(SVG.Image,{load:function(e){return this.attr("href",e,SVG.xlink),this}}),SVG.G=function(){this.constructor.call(this,SVG.create("g"))},SVG.G.prototype=new SVG.Element,SVG.Utils.merge(SVG.G,SVG.Container),SVG.Utils.merge(SVG.G,{rotate:function(e){return this.attr("transform","rotate("+e+")"),this}});var e=0;SVG.Clip=function(){this.constructor.call(this,SVG.create("clipPath")),this.id="_"+e++,this.attr("id",this.id)},SVG.Clip.prototype=new SVG.Element,SVG.Utils.merge(SVG.Clip,SVG.Container)}).call(this);
\ No newline at end of file diff --git a/src/clip_path.js b/src/clip.js index 57bff82..80d78d0 100644 --- a/src/clip_path.js +++ b/src/clip.js @@ -1,14 +1,14 @@ // initialize id sequence var clipID = 0; -SVG.ClipPath = function ClipPath() { +SVG.Clip = function Clip() { this.constructor.call(this, SVG.create('clipPath')); this.id = '_' + (clipID++); this.attr('id', this.id); }; // inherit from SVG.Element -SVG.ClipPath.prototype = new SVG.Element(); +SVG.Clip.prototype = new SVG.Element(); // include the container object -SVG.Utils.merge(SVG.ClipPath, SVG.Container);
\ No newline at end of file +SVG.Utils.merge(SVG.Clip, SVG.Container);
\ No newline at end of file diff --git a/src/container.js b/src/container.js index cc2fd4f..9d8b5af 100644 --- a/src/container.js +++ b/src/container.js @@ -75,7 +75,7 @@ SVG.Container = { }, group: function() { - var e = new SVG.Group(); + var e = new SVG.G(); this.add(e); return e; diff --git a/src/defs.js b/src/defs.js index 4c252a5..4ba7c8c 100644 --- a/src/defs.js +++ b/src/defs.js @@ -14,7 +14,7 @@ SVG.Utils.merge(SVG.Defs, { // define clippath clipPath: function() { - var e = new SVG.ClipPath(); + var e = new SVG.Clip(); this.add(e); return e; diff --git a/src/document.js b/src/doc.js index 32780c1..41b157f 100644 --- a/src/document.js +++ b/src/doc.js @@ -1,5 +1,5 @@ -SVG.Document = function Document(e) { +SVG.Doc = function Doc(e) { this.constructor.call(this, SVG.create('svg')); this.attr('xmlns', SVG.ns); @@ -13,7 +13,7 @@ SVG.Document = function Document(e) { }; // inherit from SVG.Element -SVG.Document.prototype = new SVG.Element(); +SVG.Doc.prototype = new SVG.Element(); // include the container object -SVG.Utils.merge(SVG.Document, SVG.Container);
\ No newline at end of file +SVG.Utils.merge(SVG.Doc, SVG.Container);
\ No newline at end of file diff --git a/src/element.js b/src/element.js index 7926e1f..9536a79 100644 --- a/src/element.js +++ b/src/element.js @@ -42,32 +42,20 @@ SVG.Utils.merge(SVG.Element, { }, // remove element - destroy: function() { + remove: function() { return this.parent != null ? this.parent.remove(this) : void 0; }, // get parent document parentDoc: function() { - return this._parent(SVG.Document); + return this._parent(SVG.Doc); }, // get parent svg wrapper parentSVG: function() { return this.parentDoc(); }, - - //_D // set svg element attribute - //_D setAttribute: function(a, v, ns) { - //_D this.attrs[a] = v; - //_D - //_D if (ns != null) - //_D this.node.setAttributeNS(ns, a, v); - //_D else - //_D this.node.setAttribute(a, v); - //_D - //_D return this; - //_D }, - + // set svg element attribute attr: function(v) { var a = arguments; @@ -1,16 +1,16 @@ -SVG.Group = function Group() { +SVG.G = function G() { this.constructor.call(this, SVG.create('g')); }; // inherit from SVG.Element -SVG.Group.prototype = new SVG.Element(); +SVG.G.prototype = new SVG.Element(); // include the container object -SVG.Utils.merge(SVG.Group, SVG.Container); +SVG.Utils.merge(SVG.G, SVG.Container); // Add group-specific functions -SVG.Utils.merge(SVG.Group, { +SVG.Utils.merge(SVG.G, { // group rotation rotate: function(d) { diff --git a/src/object.js b/src/object.js deleted file mode 100644 index 1ec7ecc..0000000 --- a/src/object.js +++ /dev/null @@ -1,31 +0,0 @@ - -//SVG.Object = function Object() {}; -// -//Object.prototype.include = function(module) { -// -// for (var key in module) -// this.prototype[key] = module[key]; -// -// if (module.included != null) -// module.included.apply(this); -// -// return this; -//}; - -//SVG.Object = function Object() {}; -// -//SVG.Object.moduleKeywords = ['included', 'extended']; -// -//SVG.Object.include = function(module) { -// var key, value, _ref; -// for (key in module) { -// value = module[key]; -// if (Array.prototype.indexOf.call(this.moduleKeywords, key) < 0) { -// this.prototype[key] = value; -// } -// } -// if ((_ref = module.included) != null) { -// _ref.apply(this); -// } -// return this; -//};
\ No newline at end of file diff --git a/src/shape.js b/src/shape.js index a57b9f2..1a32a00 100644 --- a/src/shape.js +++ b/src/shape.js @@ -10,26 +10,26 @@ SVG.Shape.prototype = new SVG.Element(); SVG.Utils.merge(SVG.Shape, { // set fill color and opacity - fill: function(fill) { - if (fill.color != null) - this.attr('fill', fill.color); + fill: function(f) { + if (f.color != null) + this.attr('fill', f.color); - if (fill.opacity != null) - this.attr('fill-opacity', fill.opacity); + if (f.opacity != null) + this.attr('fill-opacity', f.opacity); return this; }, // set stroke color and opacity - stroke: function(stroke) { - if (stroke.color != null) - this.attr('stroke', stroke.color); + stroke: function(s) { + if (s.color) + this.attr('stroke', s.color); - if (stroke.width != null) - this.attr('stroke-width', stroke.width); + if (s.width != null) + this.attr('stroke-width', s.width); - if (stroke.opacity != null) - this.attr('stroke-opacity', stroke.opacity); + if (s.opacity != null) + this.attr('stroke-opacity', s.opacity); if (this.attrs['fill-opacity'] == null) this.fill({ opacity: 0 }); @@ -9,5 +9,5 @@ this.SVG = { }; this.svg = function(e) { - return new SVG.Document(e); + return new SVG.Doc(e); };
\ No newline at end of file |