aboutsummaryrefslogtreecommitdiffstats
path: root/dist/svg.min.js
diff options
context:
space:
mode:
Diffstat (limited to 'dist/svg.min.js')
-rw-r--r--dist/svg.min.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/dist/svg.min.js b/dist/svg.min.js
new file mode 100644
index 0000000..ee616ba
--- /dev/null
+++ b/dist/svg.min.js
@@ -0,0 +1,2 @@
+/* svg.js 0.1 - svg container object element document defs shape rect circle ellipse path image group clip_path - svgjs.com/license */
+(function(){var e={namespace:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",createElement:function(e){return document.createElementNS(this.namespace,e)}};this.SVG=e,e.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.svgElement.insertBefore(e.svgElement,this.svgElement.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.svgElement.removeChild(t.svgElement),t.parent=null}return this},defs:function(){return this._defs==null&&(this._defs=new e.Defs,this.add(this._defs)),this._defs},group:function(){var t=new e.Group;return this.add(t),t},rect:function(t){return this.place(new e.Rect,t)},circle:function(t){var n;return t!=null&&(n={x:t.x,y:t.y},t.r||t.radius?n.width=n.height=(t.r||t.radius)*2:n.width=n.height=t.width||t.height),this.place(new e.Circle,n)},ellipse:function(t){var n;return t!=null&&(n={x:t.x,y:t.y},t.width&&(n.width=t.width),t.height&&(n.height=t.height),t.rx&&(n.width=t.rx*2),t.ry&&(n.height=t.ry*2)),this.place(new e.Ellipse,n)},path:function(t){return this.place(new e.Path,t)},image:function(t){return this.place(new e.Image,t)},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}},Object.prototype.include=function(e){for(var t in e)this.prototype[t]=e[t];return e.included!=null&&e.included.apply(this),this},e.Element=function(t){this.svgElement=t,this.attributes={}},e.Element.prototype.move=function(e,t){return this.setAttribute("x",e),this.setAttribute("y",t),this},e.Element.prototype.opacity=function(e){return this.setAttribute("opacity",Math.max(0,Math.min(1,e)))},e.Element.prototype.size=function(e,t){return this.setAttribute("width",e),this.setAttribute("height",t),this},e.Element.prototype.clip=function(e){var t=this.parentSVG().defs().clipPath();return e(t),this.clipTo(t)},e.Element.prototype.clipTo=function(e){return this.setAttribute("clip-path","url(#"+e.id+")")},e.Element.prototype.destroy=function(){return this.parent!=null?this.parent.remove(this):void 0},e.Element.prototype.parentDoc=function(){return this._findParent(e.Document)},e.Element.prototype.parentSVG=function(){return this.parentDoc()},e.Element.prototype.setAttribute=function(e,t,n){return this.attributes[e]=t,n!=null?this.svgElement.setAttributeNS(n,e,t):this.svgElement.setAttribute(e,t),this},e.Element.prototype.attr=function(e){if(typeof e=="object")for(var t in e)this.setAttribute(t,e[t]);else arguments.length==2&&this.setAttribute(arguments[0],arguments[1]);return this},e.Element.prototype.getBBox=function(){return this.svgElement.getBBox()},e.Element.prototype._findParent=function(e){var t=this;while(t!=null&&!(t instanceof e))t=t.parent;return t},e.Document=function(n){this.constructor.call(this,e.createElement("svg")),this.setAttribute("xmlns",e.namespace),this.setAttribute("version","1.1"),this.setAttribute("xlink","http://www.w3.org/1999/xlink",e.namespace),document.getElementById(n).appendChild(this.svgElement)},e.Document.prototype=new e.Element,e.Document.include(e.Container),e.Defs=function(){this.constructor.call(this,e.createElement("defs"))},e.Defs.prototype=new e.Element,e.Defs.prototype.clipPath=function(){var t=new e.ClipPath;return this.add(t),t},e.Defs.include(e.Container),e.Shape=function(t){this.constructor.call(this,t)},e.Shape.prototype=new e.Element,e.Shape.prototype.fill=function(e){return e.color!=null&&this.setAttribute("fill",e.color),e.opacity!=null&&this.setAttribute("fill-opacity",e.opacity),this},e.Shape.prototype.stroke=function(e){return e.color!=null&&this.setAttribute("stroke",e.color),e.width!=null&&this.setAttribute("stroke-width",e.width),e.opacity!=null&&this.setAttribute("stroke-opacity",e.opacity),this.attributes["fill-opacity"]==null&&this.fill({opacity:0}),this},e.Rect=function(){this.constructor.call(this,e.createElement("rect"))},e.Rect.prototype=new e.Shape,e.Circle=function(){this.constructor.call(this,e.createElement("circle"))},e.Circle.prototype=new e.Shape,e.Circle.prototype.move=function(e,t){return this.attributes.x=e,this.attributes.y=t,this.center(),this},e.Circle.prototype.size=function(e,t){return this.setAttribute("r",e/2),this.center(),this},e.Circle.prototype.center=function(e,t){var n=this.attributes.r||0;this.setAttribute("cx",e||(this.attributes.x||0)+n),this.setAttribute("cy",t||(this.attributes.y||0)+n)},e.Ellipse=function(){this.constructor.call(this,e.createElement("ellipse"))},e.Ellipse.prototype=new e.Shape,e.Ellipse.prototype.move=function(e,t){return this.attributes.x=e,this.attributes.y=t,this.center(),this},e.Ellipse.prototype.size=function(e,t){return this.setAttribute("rx",e/2),this.setAttribute("ry",t/2),this.center(),this},e.Ellipse.prototype.center=function(e,t){this.setAttribute("cx",e||(this.attributes.x||0)+(this.attributes.rx||0)),this.setAttribute("cy",t||(this.attributes.y||0)+(this.attributes.ry||0))},e.Path=function(){this.constructor.call(this,e.createElement("path"))},e.Path.prototype=new e.Shape,e.Path.prototype.data=function(e){return this.setAttribute("d",e),this},e.Image=function(){this.constructor.call(this,e.createElement("image"))},e.Image.prototype=new e.Element,e.Image.prototype.load=function(t){return this.setAttribute("href",t,e.xlink),this},e.Image.include(e.Container),e.Group=function(){this.constructor.call(this,e.createElement("g"))},e.Group.prototype=new e.Element,e.Group.prototype.rotate=function(e){return this.setAttribute("transform","rotate("+e+")"),this},e.Group.include(e.Container);var t=0;e.ClipPath=function(){this.constructor.call(this,e.createElement("clipPath")),this.id="_"+t++,this.setAttribute("id",this.id)},e.ClipPath.prototype=new e.Element,e.ClipPath.include(e.Container)}).call(this); \ No newline at end of file