svgext.js
1010 Bytes
//>>built
define(["dojo/dom","dojo/_base/array","dojo/_base/window","./_base","./svg"],function(m,f,g,h,d){function k(a,b){var c=b.ownerDocument.createElementNS(d.xmlns.svg,a.tag);b.appendChild(c);for(var e in a)e in l||c.setAttribute(e,a[e]);a.children&&f.forEach(a.children,function(a){k(a,c)});return c}g=h.svgext={};var l={primitives:null,tag:null,children:null};d.Shape.extend({addRenderingOption:function(a,b){this.rawNode.setAttribute(a,b);return this},setFilter:function(a){if(!a)return this.rawNode.removeAttribute("filter"),
this.filter=null,this;this.filter=a;a.id=a.id||h._base._getUniqueId();var b=m.byId(a.id);if(!b){b=this.rawNode.ownerDocument.createElementNS(d.xmlns.svg,"filter");b.setAttribute("filterUnits","userSpaceOnUse");for(var c in a)c in l||b.setAttribute(c,a[c]);f.forEach(a.primitives,function(a){k(a,b)});(c=this._getParentSurface())&&c.defNode.appendChild(b)}this.rawNode.setAttribute("filter","url(#"+a.id+")");return this},getFilter:function(){return this.filter}});return g});