685 lines
347 KiB
JavaScript
685 lines
347 KiB
JavaScript
function touchHandler(a){var q=a.changedTouches,h=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var n=document.createEvent("MouseEvent");n.initMouseEvent(b,true,true,window,1,h.screenX,h.screenY,h.clientX,h.clientY,false,false,false,false,0,null);if(q.length<2){h.target.dispatchEvent(n);a.preventDefault()}};(function(a){function q(h){if(typeof h.data==="string"){var b=h.handler,n=h.data.toLowerCase().split(" ");h.handler=function(u){if(!(this!==u.target&&(/textarea|select/i.test(u.target.nodeName)||u.target.type==="text"))){var c=u.type!=="keypress"&&a.hotkeys.specialKeys[u.which],f=String.fromCharCode(u.which).toLowerCase(),d="",l={};if(u.altKey&&c!=="alt")d+="alt+";if(u.ctrlKey&&c!=="ctrl")d+="ctrl+";if(u.metaKey&&!u.ctrlKey&&c!=="meta")d+="meta+";if(u.shiftKey&&c!=="shift")d+="shift+";if(c)l[d+c]=
|
|
true;else{l[d+f]=true;l[d+a.hotkeys.shiftNums[f]]=true;if(d==="shift+")l[a.hotkeys.shiftNums[f]]=true}c=0;for(f=n.length;c<f;c++)if(l[n[c]])return b.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",
|
|
106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:q}})})(jQuery);(function(a,q){function h(da){return typeof da==="string"}function b(da){var U=d.call(arguments,1);return function(){return da.apply(this,U.concat(d.call(arguments)))}}function n(da,U,Y,oa,pa){var la;if(oa!==f){U=Y.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Y=U[3]||"";if(pa===2&&h(oa))oa=oa.replace(da?V:aa,"");else{la=p(U[2]);oa=h(oa)?p[da?ha:M](oa):oa;oa=pa===2?oa:pa===1?a.extend({},oa,la):a.extend({},la,oa);oa=s(oa);if(da)oa=oa.replace(ra,l)}da=U[1]+(da?"#":oa||!U[1]?"?":"")+oa+Y}else da=
|
|
U(Y!==f?Y:q[na][fa]);return da}function u(da,U,Y){if(U===f||typeof U==="boolean"){Y=U;U=s[da?ha:M]()}else U=h(U)?U.replace(da?V:aa,""):U;return p(U,Y)}function c(da,U,Y,oa){if(!h(Y)&&typeof Y!=="object"){oa=Y;Y=U;U=f}return this.each(function(){var pa=a(this),la=U||P()[(this.nodeName||"").toLowerCase()]||"",ma=la&&pa.attr(la)||"";pa.attr(la,s[da](ma,Y,oa))})}var f,d=Array.prototype.slice,l=decodeURIComponent,s=a.param,C,p,L,R=a.bbq=a.bbq||{},O,K,P,T=a.event.special,M="querystring",ha="fragment",na=
|
|
"location",fa="href",aa=/^.*\?|#.*$/g,V=/^.*\#/,ra,ia={};s[M]=b(n,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});s[ha]=C=b(n,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);ra=RegExp(da.join("|"),"g")};C.noEscape(",/");a.deparam=p=function(da,U){var Y={},oa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(pa,la){var ma=la.split("="),Ba=l(ma[0]),Ea=Y,Ia=
|
|
0,za=Ba.split("]["),Ka=za.length-1;if(/\[/.test(za[0])&&/\]$/.test(za[Ka])){za[Ka]=za[Ka].replace(/\]$/,"");za=za.shift().split("[").concat(za);Ka=za.length-1}else Ka=0;if(ma.length===2){ma=l(ma[1]);if(U)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:oa[ma]!==f?oa[ma]:ma;if(Ka)for(;Ia<=Ka;Ia++){Ba=za[Ia]===""?Ea.length:za[Ia];Ea=Ea[Ba]=Ia<Ka?Ea[Ba]||(za[Ia+1]&&isNaN(za[Ia+1])?{}:[]):ma}else if(a.isArray(Y[Ba]))Y[Ba].push(ma);else Y[Ba]=Y[Ba]!==f?[Y[Ba],ma]:ma}else if(Ba)Y[Ba]=U?f:""});return Y};p[M]=b(u,
|
|
0);p[ha]=L=b(u,1);a.elemUrlAttr||(a.elemUrlAttr=function(da){return a.extend(ia,da)})({a:fa,base:fa,iframe:"src",img:"src",input:"src",form:"action",link:fa,script:"src"});P=a.elemUrlAttr;a.fn[M]=b(c,M);a.fn[ha]=b(c,ha);R.pushState=O=function(da,U){if(h(da)&&/^#/.test(da)&&U===f)U=2;var Y=da!==f;Y=C(q[na][fa],Y?da:{},Y?U:2);q[na][fa]=Y+(/#/.test(Y)?"":"#")};R.getState=K=function(da,U){return da===f||typeof da==="boolean"?L(da):L(U)[da]};R.removeState=function(da){var U={};if(da!==f){U=K();a.each(a.isArray(da)?
|
|
da:arguments,function(Y,oa){delete U[oa]})}O(U,2)};T.hashchange=a.extend(T.hashchange,{add:function(da){function U(oa){var pa=oa[ha]=C();oa.getState=function(la,ma){return la===f||typeof la==="boolean"?p(pa,la):p(pa,ma)[la]};Y.apply(this,arguments)}var Y;if(a.isFunction(da)){Y=da;return U}else{Y=da.handler;da.handler=U}}})})(jQuery,this);
|
|
(function(a,q,h){function b(C){C=C||q[c][f];return C.replace(/^[^#]*#?(.*)$/,"$1")}var n,u=a.event.special,c="location",f="href",d=document.documentMode,l=a.browser.msie&&(d===h||d<8),s="onhashchange"in q&&!l;a.hashchangeDelay=100;u.hashchange=a.extend(u.hashchange,{setup:function(){if(s)return false;a(n.start)},teardown:function(){if(s)return false;a(n.stop)}});n=function(){function C(){O=K=function(P){return P};if(l){R=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
|
|
K=function(){return b(R.document[c][f])};O=function(P,T){if(P!==T){var M=R.document;M.open().close();M[c].hash="#"+P}};O(b())}}var p={},L,R,O,K;p.start=function(){if(!L){var P=b();O||C();(function T(){var M=b(),ha=K(P);if(M!==P){O(P=M,ha);a(q).trigger("hashchange")}else if(ha!==P)q[c][f]=q[c][f].replace(/#.*/,"")+"#"+ha;L=setTimeout(T,a.hashchangeDelay)})()}};p.stop=function(){if(!R){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var q={},h;a.svgIcons=function(b,n){function u(da,U){if(da!=="ajax"){if(P)return;var Y=(R=fa[0].contentDocument)&&R.getElementById("svg_eof");if(!Y&&!(U&&Y)){T++;if(T<50)setTimeout(u,20);else{f();P=true}return}P=true}L=a(R.firstChild).children();if(n.no_img)setTimeout(function(){K||c()},500);else{Y=na+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";O=a(new Image).attr({src:Y,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}}
|
|
function c(da,U){if(!K){if(n.no_img)da=false;if(da){var Y=a(document.createElement("div"));Y.hide().appendTo("body")}if(U){var oa=n.fallback_path?n.fallback_path:"";a.each(U,function(Ka,Na){a("#"+Ka);var Aa=a(new Image).attr({"class":"svg_icon",src:oa+Na,width:C,height:p,alt:"icon"});ia(Aa,Ka)})}else for(var pa=L.length,la=0;la<pa;la++){var ma=L[la],Ba=ma.id;if(Ba==="svg_eof")break;a("#"+Ba);ma=ma.getElementsByTagNameNS(l,"svg")[0];var Ea=document.createElementNS(l,"svg");Ea.setAttributeNS(l,"viewBox",
|
|
[0,0,C,p].join(" "));var Ia=ma.getAttribute("width"),za=ma.getAttribute("height");ma.removeAttribute("width");ma.removeAttribute("height");ma.getAttribute("viewBox")||ma.setAttribute("viewBox",[0,0,Ia,za].join(" "));Ea.setAttribute("xmlns",l);Ea.setAttribute("width",C);Ea.setAttribute("height",p);Ea.setAttribute("xmlns:xlink",s);Ea.setAttribute("class","svg_icon");ha||(ma=ma.cloneNode(true));Ea.appendChild(ma);if(da){ha||Ea.cloneNode(true);Y.empty().append(Ea);ma=na+d(Y.html());ma=a(new Image).attr({"class":"svg_icon",
|
|
src:ma})}else ma=h(a(Ea),la);ia(ma,Ba)}n.placement&&a.each(n.placement,function(Ka,Na){q[Na]&&a(Ka).each(function(Aa){var ya=q[Na].clone();if(Aa>0&&!da)ya=h(ya,Aa,true);ra(a(this),ya,Na)})});if(!U){da&&Y.remove();fa&&fa.remove();O&&O.remove()}n.resize&&a.resizeSvgIcons(n.resize);K=true;n.callback&&n.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var da=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,n)}else n.fallback&&c(false,n.fallback)}
|
|
function d(da){if(window.btoa)return window.btoa(da);var U=Array(Math.floor((da.length+2)/3)*4),Y,oa,pa,la,ma,Ba,Ea=0,Ia=0;do{Y=da.charCodeAt(Ea++);oa=da.charCodeAt(Ea++);pa=da.charCodeAt(Ea++);la=Y>>2;Y=(Y&3)<<4|oa>>4;ma=(oa&15)<<2|pa>>6;Ba=pa&63;if(isNaN(oa))ma=Ba=64;else if(isNaN(pa))Ba=64;U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);
|
|
U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ba)}while(Ea<da.length);return U.join("")}var l="http://www.w3.org/2000/svg",s="http://www.w3.org/1999/xlink",C=n.w?n.w:24,p=n.h?n.h:24,L,R,O,K=false,P=false,T=0,M=navigator.userAgent,ha=!!window.opera;M.indexOf("Safari/")>-1&&M.indexOf("Chrome/");var na="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var fa=a('<object data="'+b+'" type=image/svg+xml>').appendTo("body").hide();try{R=fa[0].contentDocument;fa.load(u);
|
|
u(0,true)}catch(aa){f()}}else{var V=new DOMParser;a.ajax({url:b,dataType:"string",success:function(da){if(da){R=V.parseFromString(da,"text/xml");a(function(){u("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){R=V.parseFromString(da.responseText,"text/xml");R.childNodes.length||a(f);a(function(){u("ajax")})}else a(f)}})}var ra=function(da,U,Y,oa){ha&&U.css("visibility","hidden");if(n.replace){oa&&U.attr("id",Y);(Y=da.attr("class"))&&U.attr("class",
|
|
"svg_icon "+Y);da.replaceWith(U)}else da.append(U);ha&&setTimeout(function(){U.removeAttr("style")},1)},ia=function(da,U){if(n.id_match===undefined||n.id_match!==false)ra(holder,da,U,true);q[U]=da};h=function(da,U){var Y=da.find("defs");if(!Y.length)return da;Y=ha?Y.find("*").filter(function(){return!!this.id}):Y.find("[id]");var oa=da[0].getElementsByTagName("*"),pa=oa.length;Y.each(function(la){var ma=this.id;a(R).find("#"+ma);this.id=la="x"+ma+U+la;ma="url(#"+ma+")";var Ba="url(#"+la+")";for(la=
|
|
0;la<pa;la++){var Ea=oa[la];Ea.getAttribute("fill")===ma&&Ea.setAttribute("fill",Ba);Ea.getAttribute("stroke")===ma&&Ea.setAttribute("stroke",Ba);Ea.getAttribute("filter")===ma&&Ea.setAttribute("filter",Ba)}});return da}};a.getSvgIcon=function(b,n){var u=q[b];if(n&&u)u=h(u,0,true).clone(true);return u};a.resizeSvgIcons=function(b){var n=!a(".svg_icon:first").length;a.each(b,function(u,c){var f=a.isArray(c),d=f?c[0]:c,l=f?c[1]:c;if(n)u=u.replace(/\.svg_icon/g,"svg");a(u).each(function(){this.setAttribute("width",
|
|
d);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=d+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(b,n,u){b=document.createElementNS(q.svg,b);if(h)for(var c in n)b.setAttribute(c,n[c]);else for(c in n){var f=n[c],d=b[c];if(d&&d.constructor==="SVGLength")d.baseVal.value=f;else b.setAttribute(c,f)}u&&u.appendChild(b);return b}var q={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console)window.console=new function(){this.log=function(){};this.dir=function(){}};$.jGraduate={Paint:function(b){b=b||{};this.alpha=isNaN(b.alpha)?100:b.alpha;if(b.copy){this.type=
|
|
b.copy.type;this.alpha=b.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=b.copy.solidColor;break;case "linearGradient":this.linearGradient=b.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=b.copy.radialGradient.cloneNode(true)}}else if(b.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=b.linearGradient.cloneNode(true)}else if(b.radialGradient){this.type=
|
|
"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=b.radialGradient.cloneNode(true)}else if(b.solidColor){this.type="solidColor";this.solidColor=b.solidColor}else{this.type="none";this.radialGradient=this.linearGradient=this.solidColor=null}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var h=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(b){var n=
|
|
arguments;return this.each(function(){function u(ja,ba,ka,N,Q){var ea=Q||a("stop",{"stop-color":ba,"stop-opacity":ka,offset:ja},V);if(Q){ba=Q.getAttribute("stop-color");ka=Q.getAttribute("stop-opacity");ja=Q.getAttribute("offset")}else V.appendChild(ea);if(ka===null)ka=1;Q=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ja*ha)+", 26)"},nb);var Fa=
|
|
a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ba,"fill-opacity":ka,transform:"translate("+(10+ja*ha)+", 26)",stroke:"#000","stroke-width":1.5},nb);$(Fa).mousedown(function(Oa){c(this);Wa=fb;P.mousemove(l).mouseup(f);wa=Ya.offset();Oa.preventDefault();return false}).data("stop",ea).data("bg",Q).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Va=+ea.getAttribute("stop-opacity")||
|
|
1,$a=ea.getAttribute("stop-color")||1,qb=(parseFloat(Va)*255).toString(16);qb.length<2;)qb="0"+qb;ba=$a.substr(1)+qb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:C.images.clientPath},color:{active:ba,alphaSupport:true}},function(Qa){$a=Qa.val("hex")?"#"+Qa.val("hex"):"none";Va=Qa.val("a")!==null?Qa.val("a")/256:1;Oa.setAttribute("fill",$a);Oa.setAttribute("fill-opacity",Va);ea.setAttribute("stop-color",
|
|
$a);ea.setAttribute("stop-opacity",Va);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(V).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ja){if(!ba){var Va=this.getAttribute("stop-color"),$a=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Va);Fa.setAttribute("fill",Va);ea.setAttribute("stop-opacity",$a===null?1:$a);Fa.setAttribute("fill-opacity",
|
|
$a===null?1:$a)}Oa.before(ea);return false}});N&&c(Fa);return ea}function c(ja){fb&&fb.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");fb=ja;fb.parentNode.appendChild(fb)}function f(){P.unbind("mousemove",l);if(Ca.getAttribute("display")!=="none"){Ca.setAttribute("display","none");var ja=$(fb),ba=ja.data("stop");ja=ja.data("bg");$([fb,ba,ja]).remove()}Wa=null}function d(){var ja=Ra?"rotate("+Ra+","+Da+","+gb+") ":"";db===1&&La===1?V.removeAttribute("gradientTransform"):V.setAttribute("gradientTransform",
|
|
ja+"translate("+-Da*(db-1)+","+-gb*(La-1)+") scale("+db+","+La+")")}function l(ja){var ba=ja.pageX-wa.left;ja=ja.pageY-wa.top;ba=ba<10?10:ba>ha+10?ha+10:ba;var ka="translate("+ba+", 26)";if(ja<-60||ja>130){Ca.setAttribute("display","block");Ca.setAttribute("transform",ka)}else Ca.setAttribute("display","none");Wa.setAttribute("transform",ka);$.data(Wa,"bg").setAttribute("transform",ka);$.data(Wa,"stop").setAttribute("offset",(ba-10)/ha);var N=0;$(V).find("stop").each(function(){var Q=this.getAttribute("offset"),
|
|
ea=$(this);if(Q<N){ea.prev().before(ea);xa=$(V).find("stop")}N=Q})}var s=$(this),C=$.extend(true,{},jQuery.fn.jGraduateDefaults,b),p=s.attr("id"),L="#"+s.attr("id")+" ";if(L){var R=function(){switch(s.paint.type){case "radialGradient":s.paint.linearGradient=null;break;case "linearGradient":s.paint.radialGradient=null;break;case "solidColor":s.paint.radialGradient=s.paint.linearGradient=null}$.isFunction(s.okCallback)&&s.okCallback(s.paint);s.hide()},O=function(){$.isFunction(s.cancelCallback)&&s.cancelCallback();
|
|
s.hide()};$.extend(true,s,{paint:new $.jGraduate.Paint({copy:C.paint}),okCallback:$.isFunction(n[1])&&n[1]||null,cancelCallback:$.isFunction(n[2])&&n[2]||null});s.position();var K=null,P=$(window);if(s.paint.type=="none")s.paint=$.jGraduate.Paint({solidColor:"ffffff"});s.addClass("jGraduate_Picker");s.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+
|
|
p+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var T=$(L+"> .jGraduate_colPick"),M=$(L+"> .jGraduate_gradPick");M.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+C.window.pickerTitle+'</h2><div id="'+p+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+p+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+
|
|
p+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+
|
|
p+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+
|
|
p+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+p+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="'+
|
|
p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+p+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+
|
|
p+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+p+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+p+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+C.images.clientPath+
|
|
'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+p+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+p+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+C.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+
|
|
p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var ha=256,na=ha-0,fa=ha-0,aa,V,ra,ia={};$(".jGraduate_SliderBar").width(145);var da=$("#"+p+"_jGraduate_GradContainer")[0],U=a("svg",{id:p+"_jgraduate_svg",width:ha,height:ha,xmlns:q.svg},da);aa=aa||s.paint.type;var Y=V=s.paint[aa],oa=s.paint.alpha,pa=aa==="solidColor";switch(aa){case "solidColor":case "linearGradient":if(!pa){V.id=p+"_lg_jgraduate_grad";
|
|
Y=V=U.appendChild(V)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},U);if(aa==="linearGradient")break;case "radialGradient":if(!pa){V.id=p+"_rg_jgraduate_grad";Y=V=U.appendChild(V)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},U)}if(pa){Y=V=$("#"+p+"_lg_jgraduate_grad")[0];K=s.paint[aa];u(0,"#"+K,1);var la=typeof C.newstop;if(la==="string")switch(C.newstop){case "same":u(1,"#"+K,1);break;case "inverse":la="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ba=(255-parseInt(K.substr(ma,2),16)).toString(16);
|
|
if(Ba.length<2)Ba=0+Ba;la+=Ba}u(1,"#"+la,1);break;case "white":u(1,"#ffffff",1);break;case "black":u(1,"#000000",1)}else if(la==="object")u(1,C.newstop.color||"#"+K,"opac"in C.newstop?C.newstop.opac:1)}K=parseFloat(Y.getAttribute("x1")||0);la=parseFloat(Y.getAttribute("y1")||0);ma=parseFloat(Y.getAttribute("x2")||1);Ba=parseFloat(Y.getAttribute("y2")||0);var Ea=parseFloat(Y.getAttribute("cx")||0.5),Ia=parseFloat(Y.getAttribute("cy")||0.5),za=parseFloat(Y.getAttribute("fx")||Ea),Ka=parseFloat(Y.getAttribute("fy")||
|
|
Ia);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:na,height:fa,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":oa/100},U);var Na=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:la*ha,left:K*ha}).data("coord","start").appendTo(da),Aa=Na.clone().text(2).css({top:Ba*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(da),ya=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ia*ha,left:Ea*
|
|
ha}).data("coord","center").appendTo(da),Ga=ya.clone().text("F").css({top:Ka*ha,left:za*ha,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ga[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ba){var ka=V.getAttribute(ba),N=isNaN(ba[1]);ka||(ka=N?"0.5":ba==="x2"?"1.0":"0.0");ia[ba]=$("#"+p+"_jGraduate_"+ba).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
|
|
1)this.value=1;if(!(ba[0]==="f"&&!hb))if(N&&aa==="radialGradient"||!N&&aa==="linearGradient")V.setAttribute(ba,this.value);var Q=N?ba[0]==="c"?ya:Ga:ba[1]==="1"?Na:Aa,ea=ba.indexOf("x")>=0?"left":"top";Q.css(ea,this.value*ha)}).change()});var xa,nb,Ya=$("#"+p+"_jGraduate_StopSlider"),fb,Sa,Wa,Ca=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Sa),wa,db=1,La=1,Ra=0,Da=Ea,gb=Ia;Sa=a("svg",{width:"100%",height:45},Ya[0]);da=a("pattern",{width:16,
|
|
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Sa);a("image",{width:16,height:16},da).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Sa).on("click touchstart",function(ja){wa=Ya.offset();if(ja.target.tagName!=="path"){var ba=ja.pageX-wa.left-8;ba=ba<10?10:ba>ha+10?ha+10:ba;u(ba/ha,0,0,true);ja.stopPropagation()}});$(Sa).mouseover(function(){Sa.appendChild(Ca)});nb=a("g",{},Sa);a("line",{x1:10,y1:15,x2:ha+10,y2:15,"stroke-width":2,stroke:"#000"},Sa);var rb=
|
|
M.find(".jGraduate_spreadMethod").change(function(){V.setAttribute("spreadMethod",$(this).val())}),Xa=null,ab=function(ja){var ba=ja.pageX-jb.left,ka=ja.pageY-jb.top;ba=ba<0?0:ba>ha?ha:ba;ka=ka<0?0:ka>ha?ha:ka;Xa.css("left",ba).css("top",ka);ba=ba/na;ka=ka/fa;var N=Xa.data("coord"),Q=V;switch(N){case "start":ia.x1.val(ba);ia.y1.val(ka);Q.setAttribute("x1",ba);Q.setAttribute("y1",ka);break;case "end":ia.x2.val(ba);ia.y2.val(ka);Q.setAttribute("x2",ba);Q.setAttribute("y2",ka);break;case "center":ia.cx.val(ba);
|
|
ia.cy.val(ka);Q.setAttribute("cx",ba);Q.setAttribute("cy",ka);Da=ba;gb=ka;d();break;case "focus":ia.fx.val(ba);ia.fy.val(ka);Q.setAttribute("fx",ba);Q.setAttribute("fy",ka);d()}ja.preventDefault()},xb=function(){Xa=null;P.unbind("mousemove",ab).unbind("mouseup",xb)};xa=V.getElementsByTagNameNS(q.svg,"stop");if(ua<2){for(;ua<2;){V.appendChild(document.createElementNS(q.svg,"stop"));++ua}xa=V.getElementsByTagNameNS(q.svg,"stop")}var ua=xa.length;for(ma=0;ma<ua;ma++)u(0,0,0,0,xa[ma]);rb.val(V.getAttribute("spreadMethod")||
|
|
"pad");var jb,hb=false;ra.setAttribute("fill-opacity",oa/100);$("#"+p+" div.grad_coord").mousedown(function(ja){ja.preventDefault();Xa=$(this);Xa.offset();jb=Xa.parent().offset();P.mousemove(ab).mouseup(xb)});$("#"+p+"_jGraduate_Ok").bind("click touchstart",function(){s.paint.type=aa;s.paint[aa]=V.cloneNode(true);s.paint.solidColor=null;R()});$("#"+p+"_jGraduate_Cancel").bind("click touchstart",function(){O()});if(aa==="radialGradient")if(hb)Ga.show();else{Ga.hide();ia.fx.val("");ia.fy.val("")}$("#"+
|
|
p+"_jGraduate_match_ctr")[0].checked=!hb;var ub,lb;$("#"+p+"_jGraduate_match_ctr").change(function(){hb=!this.checked;Ga.toggle(hb);ia.fx.val("");ia.fy.val("");var ja=V;if(hb){var ba=ub||0.5,ka=lb||0.5;ja.setAttribute("fx",ba);ja.setAttribute("fy",ka);ia.fx.val(ba);ia.fy.val(ka)}else{ub=ja.getAttribute("fx");lb=ja.getAttribute("fy");ja.removeAttribute("fx");ja.removeAttribute("fy")}});xa=V.getElementsByTagNameNS(q.svg,"stop");ua=xa.length;if(ua<2){for(;ua<2;){V.appendChild(document.createElementNS(q.svg,
|
|
"stop"));++ua}xa=V.getElementsByTagNameNS(q.svg,"stop")}var eb;oa=M=0;if(aa==="radialGradient"){U=V.gradientTransform.baseVal;if(U.numberOfItems===2){ua=U.getItem(0);U=U.getItem(1);if(ua.type===2&&U.type===3){ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!==1)M=Math.round((1-ua.d)*100)}}else if(U.numberOfItems===3){da=U.getItem(0);ua=U.getItem(1);U=U.getItem(2);if(da.type===4&&ua.type===2&&U.type===3){oa=Math.round(da.angle);ua=U.matrix;if(ua.a!==1)M=Math.round(-(1-ua.a)*100);else if(ua.d!==
|
|
1)M=Math.round((1-ua.d)*100)}}}M={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+p+"_jGraduate_RadiusInput",val:(V.getAttribute("r")||0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:s.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:M},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:oa}};$.each(M,function(ja,ba){var ka=$(ba.handle);ka.mousedown(function(N){var Q=
|
|
ka.parent();eb={type:ja,elem:ka,input:$(ba.input),parent:Q,offset:Q.offset()};P.mousemove(sb).mouseup(ob);N.preventDefault()});$(ba.input).val(ba.val).change(function(){var N=+this.value,Q=0,ea=aa==="radialGradient";switch(ja){case "radius":ea&&V.setAttribute("r",N/100);Q=Math.pow(N/100,0.4)/2*145;break;case "opacity":s.paint.alpha=N;ra.setAttribute("fill-opacity",N/100);Q=N*1.45;break;case "ellip":db=La=1;if(N===0){Q=72.5;break}if(N>99.5)N=99.5;if(N>0)La=1-N/100;else db=-(N/100)-1;Q=145*((N+100)/
|
|
2)/100;ea&&d();break;case "angle":Ra=N;Q=Ra/180;Q+=0.5;Q*=145;ea&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ka.css({"margin-left":Q-5})}).change()});var sb=function(ja){var ba=ja.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var ka=ba-5;ba/=145;switch(eb.type){case "radius":ba=Math.pow(ba*2,2.5);if(ba>0.98&&ba<1.02)ba=1;if(ba<=0.01)ba=0.01;V.setAttribute("r",ba);break;case "opacity":s.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break;
|
|
case "ellip":La=db=1;if(ba<0.5){ba/=0.5;db=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5;ba=2-ba;La=ba<=0?0.01:ba}d();ba-=1;if(La===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Ra=ba*=180;d();ba/=100}eb.elem.css({"margin-left":ka});ba=Math.round(ba*100);eb.input.val(ba);ja.preventDefault()},ob=function(){P.unbind("mousemove",sb).unbind("mouseup",ob);eb=null};for(M=(s.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];K=s.paint.solidColor=="none"?"":s.paint.solidColor+M;pa||(K=xa[0].getAttribute("stop-color"));
|
|
$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});T.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:K,alphaSupport:true}},function(ja){s.paint.type="solidColor";s.paint.alpha=ja.val("ahex")?Math.round(ja.val("a")/255*100):100;s.paint.solidColor=ja.val("hex")?ja.val("hex"):"none";s.paint.radialGradient=null;R()},null,function(){O()});var yb=$(L+" .jGraduate_tabs li");yb.on("click touchstart",function(){yb.removeClass("jGraduate_tab_current");
|
|
$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ja=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ja+"_jgraduate_grad)");aa=ja==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(s.paint.alpha).change();var ba=$("#"+p+"_"+ja+"_jgraduate_grad")[0];if(V!==ba){var ka=
|
|
$(V).find("stop");$(ba).empty().append(ka);V=ba;ba=rb.val();V.setAttribute("spreadMethod",ba)}hb=ja==="rg"&&V.getAttribute("fx")!=null&&!(Ea==za&&Ia==Ka);$("#"+p+"_jGraduate_focusCoord").toggle(hb);if(hb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();yb.removeClass("jGraduate_tab_current");var zb;switch(s.paint.type){case "linearGradient":zb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":zb=
|
|
$(L+" .jGraduate_tab_radgrad");break;default:zb=$(L+" .jGraduate_tab_color")}s.show();setTimeout(function(){zb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),q=$(document);$.extend($.fn,{contextMenu:function(h,b){if(h.menu==undefined)return false;if(h.inSpeed==undefined)h.inSpeed=150;if(h.outSpeed==undefined)h.outSpeed=75;if(h.inSpeed==0)h.inSpeed=-1;if(h.outSpeed==0)h.outSpeed=-1;$(this).each(function(){var n=$(this),u=$(n).offset(),c=$("#"+h.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(l){var s=$(this);s.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||
|
|
h.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(l,d,s)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var l=$(this);l.unbind("mouseup");f(d,d,l)});var f=function(d,l,s){if(typeof l=="undefined")l=d;d.stopPropagation();if(n.hasClass("disabled")||l.altKey)return false;var C=d.pageX,p=d.pageY;if(svgedit.browser.isTouch()){C=d.originalEvent.touches[0].pageX;p=d.originalEvent.touches[0].pageY}d=a.width()-c.width();l=a.height()-c.height();if(C>d-15)C=d-15;
|
|
if(p>l-30)p=l-30;if(svgedit.browser.isTouch())p-=c.height()/2;q.unbind("click");c.css({top:p,left:C}).fadeIn(h.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});q.keypress(function(L){switch(L.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover");
|
|
break;case 40:if(c.find("LI.hover").length==0)c.find("LI:first").addClass("hover");else{c.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:first").addClass("hover")}break;case 13:c.find("LI.hover A").trigger("click");break;case 27:q.trigger("click")}});c.find("A").unbind("mouseup");c.find("LI:not(.disabled) A").mouseup(function(){q.unbind("click").unbind("keypress");$(".contextMenu").hide();b&&b($(this).attr("href").substr(1),
|
|
$(s),{x:C-u.left,y:p-u.top,docX:C,docY:p});return false});setTimeout(function(){q.click(function(){q.unbind("click").unbind("keypress");c.fadeOut(h.outSpeed);return false})},0)};if($.browser.mozilla)$("#"+h.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+h.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+h.menu).each(function(){$(this).bind("mousedown.disableTextSelect",function(){return false})});$(n).add($("UL.contextMenu")).bind("contextmenu",
|
|
function(){return false})});return $(this)},disableContextMenuItems:function(h){if(h==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(h){if(h==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=
|
|
0;n<b.length;n++)$(this).find('A[href="'+b[n]+'"]').parent().removeClass("disabled")});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})}(jQuery);var svgedit=svgedit||{};
|
|
(function(){if(!svgedit.browser)svgedit.browser={};var a=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;svgedit.browser.supportsSvg=function(){return a};if(svgedit.browser.supportsSvg()){var q=navigator.userAgent,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),b=!!window.opera,n=q.indexOf("AppleWebKit")>=0,u=q.indexOf("Gecko/")>=0,c=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,d=q.indexOf("Windows")>=0,l=q.indexOf("Macintosh")>=
|
|
0,s="ontouchstart"in window,C=!!h.querySelector,p=!!document.evaluate,L=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var fa=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{fa.replaceItem(na,0);return true}catch(aa){}return false}(),R=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var fa=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{fa.insertItemBefore(na,
|
|
0);return true}catch(aa){}return false}(),O=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg"),fa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);fa.setAttribute("x",5);na.appendChild(fa);var aa=document.createElementNS("http://www.w3.org/2000/svg","text");aa.textContent="a";fa.appendChild(aa);fa=aa.getStartPositionOfChar(0).x;document.documentElement.removeChild(na);return fa===0}(),K=function(){var na=document.createElementNS("http://www.w3.org/2000/svg",
|
|
"svg");document.documentElement.appendChild(na);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 C0,0 10,10 10,0");na.appendChild(fa);fa=fa.getBBox();document.documentElement.removeChild(na);return fa.height>4&&fa.height<5}(),P=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 10,0");var aa=
|
|
document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M5,0 15,0");var V=document.createElementNS("http://www.w3.org/2000/svg","g");V.appendChild(fa);V.appendChild(aa);na.appendChild(V);fa=V.getBBox();document.documentElement.removeChild(na);return fa.width==15}(),T=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect");na.setAttribute("x",0.1);(na=na.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the <a href='http://opera.com'>latest version</a> in which the problems have been fixed.");
|
|
return na}(),M=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect");na.setAttribute("style","vector-effect:non-scaling-stroke");return na.style.vectorEffect==="non-scaling-stroke"}(),ha=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,fa=h.createSVGTransform();na.appendItem(fa);return na.getItem(0)==fa}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return u};
|
|
svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return s};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return K};
|
|
svgedit.browser.supportsHVLineContainerBBox=function(){return P};svgedit.browser.supportsGoodTextCharPos=function(){return O};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return T};svgedit.browser.supportsNonScalingStroke=function(){return M};svgedit.browser.supportsNativeTransformLists=function(){return ha}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),q={};svgedit.transformlist.SVGTransformList=function(h){this._elem=h||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var n=0;n<this.numberOfItems;++n){var u=this._list.getItem(n);b=b;u=u;var c=u.matrix,f="";switch(u.type){case 1:f="matrix("+[c.a,c.b,c.c,c.d,c.e,c.f].join(",")+")";break;case 2:f="translate("+c.e+","+c.f+")";break;case 3:f=
|
|
c.a==c.d?"scale("+c.a+")":"scale("+c.a+","+c.d+")";break;case 4:var d=0;f=0;if(u.angle!=0){d=1-c.a;f=(d*c.f+c.b*c.e)/(d*d+c.b*c.b);d=(c.e-c.b*f)/d}f="rotate("+u.angle+" "+d+","+f+")"}b=b+(f+" ")}this._elem.setAttribute("transform",b)};this._list=this;this._init=function(){var b=this._elem.getAttribute("transform");if(b)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,u=true;u;){u=b.match(n);b=b.replace(n,"");if(u&&u[1]){var c=u[1].split(/\s*\(/),f=c[0];c=c[1].match(/\s*(.*?)\s*\)/);
|
|
c[1]=c[1].replace(/(\d)-/g,"$1 -");var d=c[1].split(/[, ]+/),l="abcdef".split(""),s=a.createSVGMatrix();$.each(d,function(L,R){d[L]=parseFloat(R);if(f=="matrix")s[l[L]]=d[L]});c=a.createSVGTransform();var C="set"+f.charAt(0).toUpperCase()+f.slice(1),p=f=="matrix"?[s]:d;if(f=="scale"&&p.length==1)p.push(p[0]);else if(f=="translate"&&p.length==1)p.push(0);else if(f=="rotate"&&p.length==1){p.push(0);p.push(0)}c[C].apply(c,p);this._list.appendItem(c)}}};this._removeFromOtherLists=function(b){if(b){var n=
|
|
false,u;for(u in q){for(var c=q[u],f=0,d=c._xforms.length;f<d;++f)if(c._xforms[f]==b){n=true;c.removeItem(f);break}if(n)break}}};this.numberOfItems=0;this.clear=function(){this.numberOfItems=0;this._xforms=[]};this.initialize=function(b){this.numberOfItems=1;this._removeFromOtherLists(b);this._xforms=[b]};this.getItem=function(b){if(b<this.numberOfItems&&b>=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,n){var u=null;if(n>=0)if(n<this.numberOfItems){this._removeFromOtherLists(b);
|
|
u=Array(this.numberOfItems+1);for(var c=0;c<n;++c)u[c]=this._xforms[c];u[c]=b;for(var f=c+1;c<this.numberOfItems;++f,++c)u[f]=this._xforms[c];this.numberOfItems++;this._xforms=u;u=b;this._list._update()}else u=this._list.appendItem(b);return u};this.replaceItem=function(b,n){var u=null;if(n<this.numberOfItems&&n>=0){this._removeFromOtherLists(b);u=this._xforms[n]=b;this._list._update()}return u};this.removeItem=function(b){if(b<this.numberOfItems&&b>=0){for(var n=this._xforms[b],u=Array(this.numberOfItems-
|
|
1),c=0;c<b;++c)u[c]=this._xforms[c];for(b=c;b<this.numberOfItems-1;++b,++c)u[b]=this._xforms[c+1];this.numberOfItems--;this._xforms=u;this._list._update();return n}else throw{code:1};};this.appendItem=function(b){this._removeFromOtherLists(b);this._xforms.push(b);this.numberOfItems++;this._list._update();return b}};svgedit.transformlist.resetListMap=function(){q={}};svgedit.transformlist.removeElementFromListMap=function(h){h.id&&q[h.id]&&delete q[h.id]};svgedit.transformlist.getTransformList=function(h){if(svgedit.browser.supportsNativeTransformLists())if(h.transform)return h.transform.baseVal;
|
|
else if(h.gradientTransform)return h.gradientTransform.baseVal;else{if(h.patternTransform)return h.patternTransform.baseVal}else{var b=h.id;b||(b="temp");var n=q[b];if(!n||b=="temp"){q[b]=new svgedit.transformlist.SVGTransformList(h);q[b]._init();n=q[b]}return n}return null}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.math)svgedit.math={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg");svgedit.math.transformPoint=function(q,h,b){return{x:b.a*q+b.c*h+b.e,y:b.b*q+b.d*h+b.f}};svgedit.math.isIdentity=function(q){return q.a===1&&q.b===0&&q.c===0&&q.d===1&&q.e===0&&q.f===0};svgedit.math.matrixMultiply=function(){for(var q=arguments,h=q.length,b=q[h-1];h-- >1;)b=q[h-1].multiply(b);if(Math.abs(b.a)<1.0E-14)b.a=0;if(Math.abs(b.b)<1.0E-14)b.b=0;if(Math.abs(b.c)<1.0E-14)b.c=0;if(Math.abs(b.d)<
|
|
1.0E-14)b.d=0;if(Math.abs(b.e)<1.0E-14)b.e=0;if(Math.abs(b.f)<1.0E-14)b.f=0;return b};svgedit.math.hasMatrixTransform=function(q){if(!q)return false;for(var h=q.numberOfItems;h--;){var b=q.getItem(h);if(b.type==1&&!svgedit.math.isIdentity(b.matrix))return true}return false};svgedit.math.transformBox=function(q,h,b,n,u){var c={x:q,y:h},f={x:q+b,y:h};b={x:q+b,y:h+n};q={x:q,y:h+n};h=svgedit.math.transformPoint;c=h(c.x,c.y,u);var d=n=c.x,l=c.y,s=c.y;f=h(f.x,f.y,u);n=Math.min(n,f.x);d=Math.max(d,f.x);
|
|
l=Math.min(l,f.y);s=Math.max(s,f.y);q=h(q.x,q.y,u);n=Math.min(n,q.x);d=Math.max(d,q.x);l=Math.min(l,q.y);s=Math.max(s,q.y);b=h(b.x,b.y,u);n=Math.min(n,b.x);d=Math.max(d,b.x);l=Math.min(l,b.y);s=Math.max(s,b.y);return{tl:c,tr:f,bl:q,br:b,aabox:{x:n,y:l,width:d-n,height:s-l}}};svgedit.math.transformListToTransform=function(q,h,b){if(q==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());h=h==undefined?0:h;b=b==undefined?q.numberOfItems-1:b;h=parseInt(h);b=parseInt(b);if(h>b){var n=b;b=h;
|
|
h=n}n=a.createSVGMatrix();for(h=h;h<=b;++h){var u=h>=0&&h<q.numberOfItems?q.getItem(h).matrix:a.createSVGMatrix();n=svgedit.math.matrixMultiply(n,u)}return a.createSVGTransformFromMatrix(n)};svgedit.math.getMatrix=function(q){q=svgedit.transformlist.getTransformList(q);return svgedit.math.transformListToTransform(q).matrix};svgedit.math.snapToAngle=function(q,h,b,n){var u=Math.PI/4;b=b-q;var c=n-h;n=Math.sqrt(b*b+c*c);u=Math.round(Math.atan2(c,b)/u)*u;return{x:q+n*Math.cos(u),y:h+n*Math.sin(u),a:u}};
|
|
svgedit.math.rectsIntersect=function(q,h){return h.x<q.x+q.width&&h.x+h.width>q.x&&h.y<q.y+q.height&&h.y+h.height>q.y}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],q=["y","y1","cy","ry","height"],h=$.merge(["r","radius"],a);$.merge(h,q);var b,n={px:1};svgedit.units.init=function(c){b=c;c=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(c);var f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("width","1em");f.setAttribute("height","1ex");f.setAttribute("x","1in");c.appendChild(f);f=f.getBBox();document.body.removeChild(c);
|
|
c=f.x;n.em=f.width;n.ex=f.height;n["in"]=c;n.cm=c/2.54;n.mm=c/25.4;n.pt=c/72;n.pc=c/6;n["%"]=0};svgedit.units.getTypeMap=function(){return n};svgedit.units.shortFloat=function(c){var f=b.getRoundDigits();if(isNaN(c)){if($.isArray(c))return svgedit.units.shortFloat(c[0])+","+svgedit.units.shortFloat(c[1])}else return+(+c).toFixed(f);return parseFloat(c).toFixed(f)-0};svgedit.units.convertUnit=function(c,f){f=f||b.getBaseUnit();return svgedit.unit.shortFloat(c/n[f])};svgedit.units.setUnitAttr=function(c,
|
|
f,d){isNaN(d)||c.getAttribute(f);c.setAttribute(f,d)};var u={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(c){var f=c.tagName,d=b.getBaseUnit();if(f=u[f])for(var l=f.length,s=0;s<l;s++){var C=f[s],p=c.getAttribute(C);if(p)isNaN(p)||c.setAttribute(C,p/n[d]+d)}};svgedit.units.convertToNum=
|
|
function(c,f){if(!isNaN(f))return f-0;if(f.substr(-1)==="%"){var d=f.substr(0,f.length-1)/100,l=b.getWidth(),s=b.getHeight();return a.indexOf(c)>=0?d*l:q.indexOf(c)>=0?d*s:d*Math.sqrt(l*l+s*s)/Math.sqrt(2)}else{l=f.substr(-2);d=f.substr(0,f.length-2);return d*n[l]}};svgedit.units.isValidUnit=function(c,f,d){var l=false;if(h.indexOf(c)>=0)if(isNaN(f)){f=f.toLowerCase();$.each(n,function(p){if(!l)if(RegExp("^-?[\\d\\.]+"+p+"$").test(f))l=true})}else l=true;else if(c=="id"){c=false;try{var s=b.getElement(f);
|
|
c=s==null||s===d}catch(C){}return c}else l=true;return l}})();svgedit=svgedit||{};
|
|
(function(){function a(c){if(svgedit.browser.supportsHVLineContainerBBox())try{return c.getBBox()}catch(f){}var d=$.data(c,"ref"),l=null;if(d){var s=$(d).children().clone().attr("visibility","hidden");$(u).append(s);l=s.filter("line, path")}else l=$(c).find("line, path");var C=false;if(l.length){l.each(function(){var p=this.getBBox();if(!p.width||!p.height)C=true});if(C){c=d?s:$(c).children();ret=getStrokedBBox(c)}else ret=c.getBBox()}else ret=c.getBBox();d&&s.remove();return ret}if(!svgedit.utilities)svgedit.utilities=
|
|
{};var q="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),h=null,b=null,n=null,u=null;svgedit.utilities.init=function(c){h=c;b=c.getDOMDocument();n=c.getDOMContainer();u=c.getSVGRoot()};svgedit.utilities.toXml=function(c){return $("<p/>").text(c).html()};svgedit.utilities.fromXml=function(c){return $("<p/>").html(c).text()};svgedit.utilities.encode64=function(c){c=svgedit.utilities.convertToXMLReferences(c);if(window.btoa)return window.btoa(c);
|
|
var f=Array(Math.floor((c.length+2)/3)*4),d,l,s,C,p,L,R=0,O=0;do{d=c.charCodeAt(R++);l=c.charCodeAt(R++);s=c.charCodeAt(R++);C=d>>2;d=(d&3)<<4|l>>4;p=(l&15)<<2|s>>6;L=s&63;if(isNaN(l))p=L=64;else if(isNaN(s))L=64;f[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);f[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);f[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p);f[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(R<
|
|
c.length);return f.join("")};svgedit.utilities.decode64=function(c){if(window.atob)return window.atob(c);var f="",d,l,s="",C,p="",L=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));
|
|
d=d<<2|l>>4;l=(l&15)<<4|C>>2;s=(C&3)<<6|p;f+=String.fromCharCode(d);if(C!=64)f+=String.fromCharCode(l);if(p!=64)f+=String.fromCharCode(s)}while(L<c.length);return unescape(f)};svgedit.utilities.convertToXMLReferences=function(c){for(var f="",d=0;d<c.length;d++){var l=c.charCodeAt(d);if(l<128)f+=c[d];else if(l>127)f+="&#"+l+";"}return f};svgedit.utilities.text2xml=function(c){if(c.indexOf("<svg:svg")>=0)c=c.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var d=window.DOMParser?
|
|
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(s){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,f){if(c&&c.nodeType==1){f(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f)}};
|
|
svgedit.utilities.walkTreePost=function(c,f){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f);f(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){return c.getAttributeNS("http://www.w3.org/1999/xlink",
|
|
"href")};svgedit.utilities.setHref=function(c,f){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(c){c=h.getSVGContent().documentElement;var f=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var f=c.pathSegList,d=f.numberOfItems;c=[[],[]];var l=f.getItem(0),
|
|
s=[l.x,l.y];for(l=0;l<d;l++){var C=f.getItem(l);if(typeof C.x!="undefined"){c[0].push(s[0]);c[1].push(s[1]);if(C.x1){for(var p=[C.x1,C.y1],L=[C.x2,C.y2],R=[C.x,C.y],O=0;O<2;O++){C=function(ha){return Math.pow(1-ha,3)*s[O]+3*Math.pow(1-ha,2)*ha*p[O]+3*(1-ha)*Math.pow(ha,2)*L[O]+Math.pow(ha,3)*R[O]};var K=6*s[O]-12*p[O]+6*L[O],P=-3*s[O]+9*p[O]-9*L[O]+3*R[O],T=3*p[O]-3*s[O];if(P==0){if(K!=0){K=-T/K;0<K&&K<1&&c[O].push(C(K))}}else{T=Math.pow(K,2)-4*T*P;if(!(T<0)){var M=(-K+Math.sqrt(T))/(2*P);0<M&&M<
|
|
1&&c[O].push(C(M));K=(-K-Math.sqrt(T))/(2*P);0<K&&K<1&&c[O].push(C(K))}}}s=R}else{c[0].push(C.x);c[1].push(C.y)}}}f=Math.min.apply(null,c[0]);d=Math.max.apply(null,c[0])-f;l=Math.min.apply(null,c[1]);c=Math.max.apply(null,c[1])-l;return{x:f,y:l,width:d,height:c}};svgedit.utilities.getBBox=function(c){var f=c||h.geSelectedElements()[0];if(c.nodeType!=1)return null;c=null;var d=f.nodeName;switch(d){case "text":if(f.textContent===""){f.textContent="a";c=f.getBBox();f.textContent=""}else try{c=f.getBBox()}catch(l){}break;
|
|
case "path":if(svgedit.browser.supportsPathBBox())try{c=f.getBBox()}catch(s){}else c=svgedit.utilities.getPathBBox(f);break;case "g":case "a":c=a(f);break;default:if(d==="use")c=a(f,true);if(d==="use"){c||(c=f.getBBox());if(!svgedit.browser.isWebkit()){d={};d.width=c.width;d.height=c.height;d.x=c.x+parseFloat(f.getAttribute("x")||0);d.y=c.y+parseFloat(f.getAttribute("y")||0);c=d}}else if(~q.indexOf(d))try{c=f.getBBox()}catch(C){f=$(f).closest("foreignObject");if(f.length)try{c=f[0].getBBox()}catch(p){c=
|
|
null}else c=null}}if(c)c=svgedit.utilities.bboxToObj(c);return c};svgedit.utilities.getRotationAngle=function(c,f){var d=c||h.getSelectedElements()[0];d=svgedit.transformlist.getTransformList(d);if(!d)return 0;for(var l=d.numberOfItems,s=0;s<l;++s){var C=d.getItem(s);if(C.type==4)return f?C.angle*Math.PI/180:C.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(c){return u.querySelector("#"+c)}:svgedit.browser.supportsXpath()?function(c){return b.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
|
|
c+'"]',n,function(){return"http://www.w3.org/2000/svg"},9,null).singleNodeValue}:function(c){return $(u).find("[id="+c+"]")[0]};svgedit.utilities.assignAttributes=function(c,f,d,l){d||(d=0);svgedit.browser.isOpera()||u.suspendRedraw(d);for(var s in f)if(d=s.substr(0,4)==="xml:"?"http://www.w3.org/XML/1998/namespace":s.substr(0,6)==="xlink:"?"http://www.w3.org/1999/xlink":null)c.setAttributeNS(d,s,f[s]);else l?svgedit.units.setUnitAttr(c,s,f[s]):c.setAttribute(s,f[s]);svgedit.browser.isOpera()||u.unsuspendRedraw(null)};
|
|
svgedit.utilities.cleanupElement=function(c){var f=u.suspendRedraw(60),d={"fill-opacity":1,"stop-opacity":1,opacity:1,stroke:"none","stroke-dasharray":"none","stroke-linejoin":"miter","stroke-linecap":"butt","stroke-opacity":1,"stroke-width":1,rx:0,ry:0},l;for(l in d){var s=d[l];c.getAttribute(l)==s&&c.removeAttribute(l)}u.unsuspendRedraw(f)}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.sanitize)svgedit.sanitize={};var a={};a["http://www.w3.org/1999/xlink"]="xlink";a["http://www.w3.org/XML/1998/namespace"]="xml";a["http://www.w3.org/2000/xmlns/"]="xmlns";a["http://svg-edit.googlecode.com"]="se";a["http://www.w3.org/1999/xhtml"]="xhtml";a["http://www.w3.org/1998/Math/MathML"]="mathml";var q={};$.each(a,function(n,u){q[u]=n});var h={a:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","id","mask","opacity","stroke","stroke-dasharray",
|
|
"stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","xlink:href","xlink:title"],circle:["class","clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","id","mask","opacity","r","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],clipPath:["class",
|
|
"clipPathUnits","id"],defs:[],style:["type"],desc:[],ellipse:["class","clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","id","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],feGaussianBlur:["class","color-interpolation-filters","id","requiredFeatures","stdDeviation"],filter:["class","color-interpolation-filters",
|
|
"filterRes","filterUnits","height","id","primitiveUnits","requiredFeatures","width","x","xlink:href","y"],foreignObject:["class","font-size","height","id","opacity","requiredFeatures","style","transform","width","x","y"],g:["class","clip-path","clip-rule","id","display","fill","fill-opacity","fill-rule","filter","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage",
|
|
"transform","font-family","font-size","font-style","font-weight","text-anchor"],image:["class","clip-path","clip-rule","filter","height","id","mask","opacity","requiredFeatures","style","systemLanguage","transform","width","x","xlink:href","xlink:title","y"],line:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","id","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin",
|
|
"stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","x1","x2","y1","y2"],linearGradient:["class","id","gradientTransform","gradientUnits","requiredFeatures","spreadMethod","systemLanguage","x1","x2","xlink:href","y1","y2"],marker:["id","class","markerHeight","markerUnits","markerWidth","orient","preserveAspectRatio","refX","refY","systemLanguage","viewBox"],mask:["class","height","id","maskContentUnits","maskUnits","width","x","y"],metadata:["class","id"],path:["class",
|
|
"clip-path","clip-rule","d","fill","fill-opacity","fill-rule","filter","id","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],pattern:["class","height","id","patternContentUnits","patternTransform","patternUnits","requiredFeatures","style","systemLanguage","viewBox","width","x","xlink:href","y"],polygon:["class",
|
|
"clip-path","clip-rule","id","fill","fill-opacity","fill-rule","filter","id","class","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],polyline:["class","clip-path","clip-rule","id","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","points",
|
|
"requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],radialGradient:["class","cx","cy","fx","fy","gradientTransform","gradientUnits","id","r","requiredFeatures","spreadMethod","systemLanguage","xlink:href"],rect:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","id","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray",
|
|
"stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","width","x","y"],stop:["class","id","offset","requiredFeatures","stop-color","stop-opacity","style","systemLanguage"],svg:["class","clip-path","clip-rule","filter","id","height","mask","preserveAspectRatio","requiredFeatures","style","systemLanguage","viewBox","width","x","xmlns","xmlns:se","xmlns:xlink","y"],"switch":["class","id","requiredFeatures","systemLanguage"],
|
|
symbol:["class","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","opacity","preserveAspectRatio","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","viewBox"],text:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","mask","opacity",
|
|
"requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","text-anchor","transform","x","xml:space","y"],textPath:["class","id","method","requiredFeatures","spacing","startOffset","style","systemLanguage","transform","xlink:href"],title:[],tspan:["class","clip-path","clip-rule","dx","dy","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight",
|
|
"id","mask","opacity","requiredFeatures","rotate","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","text-anchor","textLength","transform","x","xml:space","y"],use:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","id","mask","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width",
|
|
"style","transform","width","x","xlink:href","y"],annotation:["encoding"],"annotation-xml":["encoding"],maction:["actiontype","other","selection"],math:["class","id","display","xmlns"],menclose:["notation"],merror:[],mfrac:["linethickness"],mi:["mathvariant"],mmultiscripts:[],mn:[],mo:["fence","lspace","maxsize","minsize","rspace","stretchy"],mover:[],mpadded:["lspace","width","height","depth","voffset"],mphantom:[],mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth",
|
|
"height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],semantics:[]},b={};$.each(h,function(n,u){var c={};$.each(u,function(f,d){if(d.indexOf(":")>=
|
|
0){var l=d.split(":");c[l[1]]=q[l[0]]}else c[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[n]=c});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(n){if(n.nodeType==3){n.nodeValue=n.nodeValue.replace(/^\s+|\s+$/g,"");n.nodeValue.length||n.parentNode.removeChild(n)}if(n.nodeType==1){var u=n.parentNode;if(n.ownerDocument&&u){var c=h[n.nodeName],f=b[n.nodeName];if(c!=undefined){for(var d=[],l=n.attributes.length;l--;){var s=n.attributes.item(l),C=s.nodeName,
|
|
p=s.localName,L=s.namespaceURI;if(!(f.hasOwnProperty(p)&&L==f[p]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[s.nodeValue])){C.indexOf("se:")==0&&d.push([C,s.nodeValue]);n.removeAttributeNS(L,p)}if(svgedit.browser.isGecko())switch(C){case "transform":case "gradientTransform":case "patternTransform":p=s.nodeValue.replace(/(\d)-/g,"$1 -");n.setAttribute(C,p)}if(C=="style"){s=s.nodeValue.split(";");for(C=s.length;C--;){p=s[C].split(":");c.indexOf(p[0])>=0&&n.setAttribute(p[0],
|
|
p[1])}n.removeAttribute("style")}}$.each(d,function(R,O){n.setAttributeNS("http://svg-edit.googlecode.com",O[0],O[1])});if((l=svgedit.utilities.getHref(n))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(n.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(n,"");n.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(n.nodeName=="use"&&!svgedit.utilities.getHref(n))u.removeChild(n);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start",
|
|
"mask","stroke"],function(R,O){var K=n.getAttribute(O);if(K)if((K=svgedit.utilities.getUrlFromAttr(K))&&K[0]!=="#"){n.setAttribute(O,"");n.removeAttribute(O)}});for(l=n.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(n.childNodes.item(l))}}else{for(c=[];n.hasChildNodes();)c.push(u.insertBefore(n.firstChild,n));u.removeChild(n);for(l=c.length;l--;)svgedit.sanitize.sanitizeSvg(c[l])}}}}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,q,h,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=q;this.oldParent=h;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type=
|
|
svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,
|
|
this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,q){this.elem=a;this.text=q||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type=
|
|
svgedit.history.InsertElementCommand.type;svgedit.history.InsertElementCommand.prototype.getText=function(){return this.text};svgedit.history.InsertElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.InsertElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,
|
|
this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,q,h,b){this.elem=a;this.text=b||"Delete "+a.tagName;this.nextSibling=q;this.parent=h;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"};
|
|
svgedit.history.RemoveElementCommand.prototype.type=svgedit.history.RemoveElementCommand.type;svgedit.history.RemoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.RemoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.parent=this.elem.parentNode;this.elem=this.parent.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,
|
|
this)};svgedit.history.RemoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.nextSibling==null&&window.console&&console.log("Error: reference element was lost");this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.RemoveElementCommand.prototype.elements=function(){return[this.elem]};
|
|
svgedit.history.ChangeElementCommand=function(a,q,h){this.elem=a;this.text=h?"Change "+a.tagName+" "+h:"Change "+a.tagName;this.newValues={};this.oldValues=q;for(var b in q)this.newValues[b]=b=="#text"?a.textContent:b=="#href"?svgedit.utilities.getHref(a):a.getAttribute(b)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText=
|
|
function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var q=false,h;for(h in this.newValues){if(this.newValues[h])if(h=="#text")this.elem.textContent=this.newValues[h];else h=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[h]):this.elem.setAttribute(h,this.newValues[h]);else if(h=="#text")this.elem.textContent="";else{this.elem.setAttribute(h,"");this.elem.removeAttribute(h)}if(h==
|
|
"transform")q=true}if(!q)if(q=svgedit.utilities.getRotationAngle(this.elem)){h=elem.getBBox();q=["rotate(",q," ",h.x+h.width/2,",",h.y+h.height/2,")"].join("");q!=elem.getAttribute("transform")&&elem.setAttribute("transform",q)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var q=false,h;for(h in this.oldValues){if(this.oldValues[h])if(h==
|
|
"#text")this.elem.textContent=this.oldValues[h];else h=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[h]):this.elem.setAttribute(h,this.oldValues[h]);else if(h=="#text")this.elem.textContent="";else this.elem.removeAttribute(h);if(h=="transform")q=true}if(!q)if(q=svgedit.utilities.getRotationAngle(this.elem)){h=this.elem.getBBox();q=["rotate(",q," ",h.x+h.width/2,",",h.y+h.height/2,")"].join("");q!=this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",q)}svgedit.transformlist.removeElementFromListMap(this.elem);
|
|
a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.BatchCommand=function(a){this.text=a||"Batch Command";this.stack=[]};svgedit.history.BatchCommand.type=function(){return"svgedit.history.BatchCommand"};svgedit.history.BatchCommand.prototype.type=svgedit.history.BatchCommand.type;svgedit.history.BatchCommand.prototype.getText=function(){return this.text};svgedit.history.BatchCommand.prototype.apply=
|
|
function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var q=this.stack.length,h=0;h<q;++h)this.stack[h].apply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.BatchCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);for(var q=this.stack.length-1;q>=0;q--)this.stack[q].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,
|
|
this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],q=this.stack.length;q--;)for(var h=this.stack[q].elements(),b=h.length;b--;)a.indexOf(h[b])==-1&&a.push(h[b]);return a};svgedit.history.BatchCommand.prototype.addSubCommand=function(a){this.stack.push(a)};svgedit.history.BatchCommand.prototype.isEmpty=function(){return this.stack.length==0};svgedit.history.UndoManager=function(a){this.handler_=a||null;this.undoStackPointer=0;this.undoStack=[];this.undoChangeStackPointer=
|
|
-1;this.undoableChangeStack=[]};svgedit.history.UndoManager.prototype.resetUndoStack=function(){this.undoStack=[];this.undoStackPointer=0};svgedit.history.UndoManager.prototype.getUndoStackSize=function(){return this.undoStackPointer};svgedit.history.UndoManager.prototype.getRedoStackSize=function(){return this.undoStack.length-this.undoStackPointer};svgedit.history.UndoManager.prototype.getNextUndoCommandText=function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():
|
|
""};svgedit.history.UndoManager.prototype.getNextRedoCommandText=function(){return this.undoStackPointer<this.undoStack.length?this.undoStack[this.undoStackPointer].getText():""};svgedit.history.UndoManager.prototype.undo=function(){this.undoStackPointer>0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)};
|
|
svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,q){for(var h=++this.undoChangeStackPointer,b=q.length,n=Array(b),u=Array(b);b--;){var c=q[b];if(c!=null){u[b]=c;n[b]=c.getAttribute(a)}}this.undoableChangeStack[h]=
|
|
{attrName:a,oldValues:n,elements:u}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,q=this.undoableChangeStack[a],h=q.elements.length,b=q.attrName,n=new svgedit.history.BatchCommand("Change "+b);h--;){var u=q.elements[h];if(u!=null){var c={};c[b]=q.oldValues[h];c[b]!=u.getAttribute(b)&&n.addSubCommand(new svgedit.history.ChangeElementCommand(u,c,b))}}this.undoableChangeStack[a]=null;return n}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.select)svgedit.select={};var a,q,h;svgedit.select.Selector=function(b,n){this.id=b;this.selectedElement=n;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity",
|
|
0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(b){this.locked=true;this.selectedElement=b;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(b){var n=[];b=Math.round(b/45);if(b<0)b+=8;for(var u in h.selectorGrips)n.push(u);for(;b>0;){n.push(n.shift());b--}b=0;for(u in h.selectorGrips){h.selectorGrips[u].setAttribute("style",
|
|
"cursor:"+n[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){h.selectorGripsGroup.setAttribute("display",b?"inline":"none");var n=this.selectedElement;this.hasGrips=b;if(n&&b){this.selectorGroup.appendChild(h.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(n))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,n=h,u=n.selectorGrips,c=this.selectedElement,f=c.getAttribute("stroke-width"),d=a.currentZoom(),l=1/d;if(c.getAttribute("stroke")!==
|
|
"none"&&!isNaN(f))l+=f/2;var s=c.tagName;if(s==="text")l+=2/d;f=svgedit.transformlist.getTransformList(c);f=svgedit.math.transformListToTransform(f).matrix;f.e*=d;f.f*=d;var C=svgedit.utilities.getBBox(c);if(s==="g"&&!$.data(c,"gsvg"))if(s=a.getStrokedBBox(c.childNodes))C=s;s=C.x;var p=C.y,L=C.width;C=C.height;l*=d;d=svgedit.math.transformBox(s*d,p*d,L*d,C*d,f);f=d.aabox;s=f.x-l;p=f.y-l;L=f.width+l*2;var R=f.height+l*2;f=s+L/2;C=p+R/2;if(c=svgedit.utilities.getRotationAngle(c)){s=a.svgRoot().createSVGTransform();
|
|
s.setRotate(-c,f,C);s=s.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,s);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,s);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,s);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,s);s=d.tl;L=s.x;R=s.y;var O=s.x,K=s.y;s=Math.min;p=Math.max;L=s(L,s(d.tr.x,s(d.bl.x,d.br.x)))-l;R=s(R,s(d.tr.y,s(d.bl.y,d.br.y)))-l;O=p(O,p(d.tr.x,p(d.bl.x,d.br.x)))+l;K=p(K,p(d.tr.y,p(d.bl.y,d.br.y)))+l;s=L;p=R;L=O-L;R=K-R}l=a.svgRoot().suspendRedraw(100);b.setAttribute("d",
|
|
"M"+s+","+p+" L"+(s+L)+","+p+" "+(s+L)+","+(p+R)+" "+s+","+(p+R)+"z");this.selectorGroup.setAttribute("transform",c?"rotate("+[c,f,C].join(",")+")":"");if(svgedit.browser.isTouch()){s-=15.75;p-=15.75}else{s-=4;p-=4}this.gripCoords={nw:[s,p].map(Math.round),ne:[s+L,p].map(Math.round),sw:[s,p+R].map(Math.round),se:[s+L,p+R].map(Math.round),n:[s+L/2,p].map(Math.round),w:[s,p+R/2].map(Math.round),e:[s+L,p+R/2].map(Math.round),s:[s+L/2,p+R].map(Math.round)};for(var P in this.gripCoords){b=this.gripCoords[P];
|
|
u[P].setAttribute("x",b[0]);u[P].setAttribute("y",b[1])}this.rotateCoords={nw:[s,p],ne:[s+L+8,p],sw:[s,p+R+8],se:[s+L+8,p+R+8]};for(P in this.rotateCoords){b=this.rotateCoords[P];n.rotateGrips[P].setAttribute("cx",b[0]);n.rotateGrips[P].setAttribute("cy",b[1])}a.svgRoot().unsuspendRedraw(l)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};
|
|
this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);
|
|
a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var b in this.rotateGrips){var n=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+b,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+q.imgPath+"rotate.png) 12 12, auto;"}});$.data(n,"dir",b);$.data(n,"type","rotate");this.rotateGrips[b]=this.selectorGripsGroup.appendChild(n)}for(b in this.selectorGrips){n=a.createSVGElement({element:"rect",
|
|
attr:{id:"selectorGrip_resize_"+b,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+b+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){n.setAttribute("width",30.5);n.setAttribute("height",30.5);n.setAttribute("fill-opacity",0.3)}$.data(n,"dir",b);$.data(n,"type","resize");this.selectorGrips[b]=this.selectorGripsGroup.appendChild(n)}if(!$("#canvasBackground").length){b=q.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",
|
|
width:b[0],height:b[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});n=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var u=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),c=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),f=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}),
|
|
d=a.createSVGElement({element:"rect",attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),l=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});b.appendChild(n);n.appendChild(u);u.appendChild(c);u.appendChild(f);u.appendChild(d);b.appendChild(l);a.svgRoot().insertBefore(b,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(b){if(b==null)return null;var n=this.selectors.length;
|
|
if(typeof this.selectorMap[b.id]=="object"){this.selectorMap[b.id].locked=true;return this.selectorMap[b.id]}for(var u=0;u<n;++u)if(this.selectors[u]&&!this.selectors[u].locked){this.selectors[u].locked=true;this.selectors[u].reset(b);this.selectorMap[b.id]=this.selectors[u];return this.selectors[u]}this.selectors[n]=new svgedit.select.Selector(n,b);this.selectorParentGroup.appendChild(this.selectors[n].selectorGroup);this.selectorMap[b.id]=this.selectors[n];return this.selectors[n]};svgedit.select.SelectorManager.prototype.releaseSelector=
|
|
function(b){if(b!=null)for(var n=this.selectors.length,u=this.selectorMap[b.id],c=0;c<n;++c)if(this.selectors[c]&&this.selectors[c]==u){u.locked==false&&console.log("WARNING! selector was released but was already unlocked");delete this.selectorMap[b.id];u.locked=false;u.selectedElement=null;u.showGrips(false);try{u.selectorGroup.setAttribute("display","none")}catch(f){}break}};svgedit.select.SelectorManager.prototype.getRubberBandBox=function(){if(!this.rubberBandBox)this.rubberBandBox=this.selectorParentGroup.appendChild(a.createSVGElement({element:"rect",
|
|
attr:{id:"selectorRubberBand",fill:"none",stroke:"#666","stroke-width":1,"stroke-dasharray":"3,2",display:"none",style:"pointer-events:none"}}));return this.rubberBandBox};svgedit.select.init=function(b,n){q=b;a=n;h=new svgedit.select.SelectorManager;a.createSVGElement({element:"g",attr:{id:"hover_group"}})};svgedit.select.getSelectorManager=function(){return h}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.draw)svgedit.draw={};var a="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),q={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},h=q.LET_DOCUMENT_DECIDE;svgedit.draw.Layer=function(b,n){this.name_=b;this.group_=n};svgedit.draw.Layer.prototype.getName=function(){return this.name_};svgedit.draw.Layer.prototype.getGroup=function(){return this.group_};svgedit.draw.randomizeIds=function(b,n){h=b==false?q.NEVER_RANDOMIZE:
|
|
q.ALWAYS_RANDOMIZE;if(h==q.ALWAYS_RANDOMIZE&&!n.getNonce())n.setNonce(Math.floor(Math.random()*100001));else h==q.NEVER_RANDOMIZE&&n.getNonce()&&n.clearNonce()};svgedit.draw.Drawing=function(b,n){if(!b||!b.tagName||!b.namespaceURI||b.tagName!="svg"||b.namespaceURI!="http://www.w3.org/2000/svg")throw"Error: svgedit.draw.Drawing instance initialized without a <svg> element";this.svgElem_=b;this.obj_num=0;this.idPrefix=n||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_=
|
|
"";var u=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(u&&h!=q.NEVER_RANDOMIZE)this.nonce_=u;else h==q.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(b){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+b):$(this.svgElem_).find("[id="+b+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_};
|
|
svgedit.draw.Drawing.prototype.setNonce=function(b){this.svgElem_.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:se","http://svg-edit.googlecode.com");this.svgElem_.setAttributeNS("http://svg-edit.googlecode.com","se:nonce",b);this.nonce_=b};svgedit.draw.Drawing.prototype.clearNonce=function(){this.nonce_=""};svgedit.draw.Drawing.prototype.getId=function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num};svgedit.draw.Drawing.prototype.getNextId=function(){var b=
|
|
this.obj_num,n=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();n=true}else this.obj_num++;for(var u=this.getId();this.getElem_(u);){if(n){this.obj_num=b;n=false}this.obj_num++;u=this.getId()}if(n)this.obj_num=b;return u};svgedit.draw.Drawing.prototype.releaseId=function(b){var n=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof b!="string"||b.indexOf(n)!=0)return false;b=parseInt(b.substr(n.length));if(typeof b!="number"||b<=0||this.releasedNums.indexOf(b)!=-1)return false;
|
|
this.releasedNums.push(b);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(b){for(var n=0;n<this.getNumLayers();n++)if(this.all_layers[n][0]==b)return true;return false};svgedit.draw.Drawing.prototype.getLayerName=function(b){if(b>=0&&b<this.getNumLayers())return this.all_layers[b][0];return""};svgedit.draw.Drawing.prototype.getCurrentLayer=function(){return this.current_layer};svgedit.draw.Drawing.prototype.getCurrentLayerName=
|
|
function(){for(var b=0;b<this.getNumLayers();++b)if(this.all_layers[b][1]==this.current_layer)return this.getLayerName(b);return""};svgedit.draw.Drawing.prototype.setCurrentLayer=function(b){for(var n=0;n<this.getNumLayers();++n)if(b==this.getLayerName(n)){if(this.current_layer!=this.all_layers[n][1]){this.current_layer.setAttribute("style","pointer-events:none");this.current_layer=this.all_layers[n][1];this.current_layer.setAttribute("style","pointer-events:all")}return true}return false};svgedit.draw.Drawing.prototype.deleteCurrentLayer=
|
|
function(){if(this.current_layer&&this.getNumLayers()>1){var b=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return b}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var b=this.svgElem_.childNodes.length,n=[],u=[],c=null,f=false,d=0;d<b;++d){var l=this.svgElem_.childNodes.item(d);if(l&&l.nodeType==1)if(l.tagName=="g"){f=true;var s=$("title",l).text();if(!s&&svgedit.browser.isOpera()&&l.querySelectorAll)s=$(l.querySelectorAll("title")).text();
|
|
if(s){u.push(s);this.all_layers.push([s,l]);c=l;svgedit.utilities.walkTree(l,function(C){C.setAttribute("style","pointer-events:inherit")});c.setAttribute("style","pointer-events:none")}else n.push(l)}else if(~a.indexOf(l.nodeName)){svgedit.utilities.getBBox(l);n.push(l)}}b=this.svgElem_.ownerDocument;if(n.length>0||!f){for(d=1;u.indexOf("Layer "+d)>=0;)d++;u="Layer "+d;c=b.createElementNS("http://www.w3.org/2000/svg","g");f=b.createElementNS("http://www.w3.org/2000/svg","title");f.textContent=u;
|
|
c.appendChild(f);for(f=0;f<n.length;++f)c.appendChild(n[f]);this.svgElem_.appendChild(c);this.all_layers.push([u,c])}svgedit.utilities.walkTree(c,function(C){C.setAttribute("style","pointer-events:inherit")});this.current_layer=c;this.current_layer.setAttribute("style","pointer-events:all")};svgedit.draw.Drawing.prototype.createLayer=function(b){var n=this.svgElem_.ownerDocument,u=n.createElementNS("http://www.w3.org/2000/svg","g");n=n.createElementNS("http://www.w3.org/2000/svg","title");n.textContent=
|
|
b;u.appendChild(n);this.svgElem_.appendChild(u);this.identifyLayers();return u};svgedit.draw.Drawing.prototype.getLayerVisibility=function(b){for(var n=null,u=0;u<this.getNumLayers();++u)if(this.getLayerName(u)==b){n=this.all_layers[u][1];break}if(!n)return false;return n.getAttribute("display")!="none"};svgedit.draw.Drawing.prototype.setLayerVisibility=function(b,n){if(typeof n!="boolean")return null;for(var u=null,c=0;c<this.getNumLayers();++c)if(this.getLayerName(c)==b){u=this.all_layers[c][1];
|
|
break}if(!u)return null;u.getAttribute("display");u.setAttribute("display",n?"inline":"none");return u};svgedit.draw.Drawing.prototype.getLayerOpacity=function(b){for(var n=0;n<this.getNumLayers();++n)if(this.getLayerName(n)==b){(b=this.all_layers[n][1].getAttribute("opacity"))||(b="1.0");return parseFloat(b)}return null};svgedit.draw.Drawing.prototype.setLayerOpacity=function(b,n){if(!(typeof n!="number"||n<0||n>1))for(var u=0;u<this.getNumLayers();++u)if(this.getLayerName(u)==b){this.all_layers[u][1].setAttribute("opacity",
|
|
n);break}}})();svgedit=svgedit||{};
|
|
(function(){if(!svgedit.path)svgedit.path={};var a={pathNodeTooltip:"Drag node to move it. Double-click node to change segment type",pathCtrlPtTooltip:"Drag control point to adjust curve properties"},q={2:["x","y"],4:["x","y"],6:["x","y","x1","y1","x2","y2"],8:["x","y","x1","y1"],10:["x","y","r1","r2","angle","largeArcFlag","sweepFlag"],12:["x"],14:["y"],16:["x","y","x2","y2"],18:["x","y"]},h=[],b=true,n={};svgedit.path.setLinkControlPoints=function(f){b=f};var u=svgedit.path.path=null;svgedit.path.init=
|
|
function(f){u=f;h=[0,"ClosePath"];$.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(d,l){h.push(l+"Abs");h.push(l+"Rel")})};svgedit.path.insertItemBefore=function(f,d,l){f=f.pathSegList;if(svgedit.browser.supportsPathInsertItemBefore())f.insertItemBefore(d,l);else{for(var s=f.numberOfItems,C=[],p=0;p<s;p++){var L=f.getItem(p);C.push(L)}f.clear();for(p=0;p<s;p++){p==l&&f.appendItem(d);f.appendItem(C[p])}}};
|
|
svgedit.path.ptObjToArr=function(f,d){for(var l=q[f],s=l.length,C=Array(s),p=0;p<s;p++)C[p]=d[l[p]];return C};svgedit.path.getGripPt=function(f,d){var l={x:d?d.x:f.item.x,y:d?d.y:f.item.y},s=f.path;if(s.matrix)l=svgedit.math.transformPoint(l.x,l.y,s.matrix);l.x*=u.getCurrentZoom();l.y*=u.getCurrentZoom();return l};svgedit.path.getPointFromGrip=function(f,d){var l={x:f.x,y:f.y};if(d.matrix){f=svgedit.math.transformPoint(l.x,l.y,d.imatrix);l.x=f.x;l.y=f.y}l.x/=u.getCurrentZoom();l.y/=u.getCurrentZoom();
|
|
return l};svgedit.path.addPointGrip=function(f,d,l){var s=svgedit.path.getGripContainer(),C=svgedit.utilities.getElem("pathpointgrip_"+f);if(!C){C=document.createElementNS("http://www.w3.org/2000/svg","rect");svgedit.utilities.assignAttributes(C,{id:"pathpointgrip_"+f,display:"none",width:svgedit.browser.isTouch()?30:5,height:svgedit.browser.isTouch()?30:5,fill:"#fff",stroke:"#4F80FF","shape-rendering":"crispEdges","stroke-width":1,cursor:"move",style:"pointer-events:all","xlink:title":a.pathNodeTooltip});
|
|
C=s.appendChild(C);$("#pathpointgrip_"+f).dblclick(function(){svgedit.path.path&&svgedit.path.path.setSegType()})}if(d&&l)svgedit.utilities.assignAttributes(C,{x:d-(svgedit.browser.isTouch()?15:2.5),y:l-(svgedit.browser.isTouch()?15:2.5),display:"inline"});return C};svgedit.path.getGripContainer=function(){var f=svgedit.utilities.getElem("pathpointgrip_container");if(!f){f=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));f.id=
|
|
"pathpointgrip_container"}return f};svgedit.path.addCtrlGrip=function(f){var d=svgedit.utilities.getElem("ctrlpointgrip_"+f);if(d)return d;d=document.createElementNS("http://www.w3.org/2000/svg","circle");svgedit.utilities.assignAttributes(d,{id:"ctrlpointgrip_"+f,display:"none",r:svgedit.browser.isTouch()?15:3,fill:"#4F80FF",cursor:"move",style:"pointer-events:all","xlink:title":a.pathCtrlPtTooltip});svgedit.path.getGripContainer().appendChild(d);return d};svgedit.path.getCtrlLine=function(f){var d=
|
|
svgedit.utilities.getElem("ctrlLine_"+f);if(d)return d;d=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(d,{id:"ctrlLine_"+f,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});svgedit.path.getGripContainer().appendChild(d);return d};svgedit.path.getPointGrip=function(f,d){var l=svgedit.path.addPointGrip(f.index);if(d){var s=svgedit.path.getGripPt(f);svgedit.utilities.assignAttributes(l,{x:s.x-(svgedit.browser.isTouch()?15:2.5),y:s.y-(svgedit.browser.isTouch()?
|
|
15:2.5),display:"inline"})}return l};svgedit.path.getControlPoints=function(f){var d=f.item,l=f.index;if(!("x1"in d)||!("x2"in d))return null;var s={};svgedit.path.getGripContainer();for(var C=[svgedit.path.path.segs[l-1].item,d],p=1;p<3;p++){var L=l+"c"+p,R=s["c"+p+"_line"]=svgedit.path.getCtrlLine(L),O=svgedit.path.getGripPt(f,{x:d["x"+p],y:d["y"+p]}),K=svgedit.path.getGripPt(f,{x:C[p-1].x,y:C[p-1].y});svgedit.utilities.assignAttributes(R,{x1:O.x,y1:O.y,x2:K.x,y2:K.y,display:"inline"});s["c"+p+
|
|
"_line"]=R;pointGrip=s["c"+p]=svgedit.path.addCtrlGrip(L);svgedit.utilities.assignAttributes(pointGrip,{cx:O.x,cy:O.y,display:"inline"});s["c"+p]=pointGrip}return s};svgedit.path.replacePathSeg=function(f,d,l,s){s=s||svgedit.path.path.elem;f=s["createSVGPathSeg"+h[f]].apply(s,l);if(svgedit.browser.supportsPathReplaceItem())s.pathSegList.replaceItem(f,d);else{l=s.pathSegList;s=l.numberOfItems;for(var C=[],p=0;p<s;p++){var L=l.getItem(p);C.push(L)}l.clear();for(p=0;p<s;p++)p==d?l.appendItem(f):l.appendItem(C[p])}};
|
|
svgedit.path.getSegSelector=function(f,d){var l=f.index,s=svgedit.utilities.getElem("segline_"+l);if(!s){var C=svgedit.path.getGripContainer();s=document.createElementNS("http://www.w3.org/2000/svg","path");svgedit.utilities.assignAttributes(s,{id:"segline_"+l,display:"none",fill:"none",stroke:"#0ff","shape-rendering":"crispEdges","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"});C.appendChild(s)}if(d){l=f.prev;if(!l){s.setAttribute("display","none");return s}l=svgedit.path.getGripPt(l);
|
|
svgedit.path.replacePathSeg(2,0,[l.x,l.y],s);C=svgedit.path.ptObjToArr(f.type,f.item,true);for(var p=0;p<C.length;p+=2){l=svgedit.path.getGripPt(f,{x:C[p],y:C[p+1]});C[p]=l.x;C[p+1]=l.y}svgedit.path.replacePathSeg(f.type,1,C,s)}return s};svgedit.path.smoothControlPoints=this.smoothControlPoints=function(f,d,l){var s=f.x-l.x,C=f.y-l.y,p=d.x-l.x,L=d.y-l.y;if((s!=0||C!=0)&&(p!=0||L!=0)){f=Math.atan2(C,s);d=Math.atan2(L,p);s=Math.sqrt(s*s+C*C);p=Math.sqrt(p*p+L*L);C=u.getSVGRoot().createSVGPoint();L=
|
|
u.getSVGRoot().createSVGPoint();if(f<0)f+=2*Math.PI;if(d<0)d+=2*Math.PI;var R=Math.abs(f-d),O=Math.abs(Math.PI-R)/2;if(f-d>0){f=R<Math.PI?f+O:f-O;d=R<Math.PI?d-O:d+O}else{f=R<Math.PI?f-O:f+O;d=R<Math.PI?d+O:d-O}C.x=s*Math.cos(f)+l.x;C.y=s*Math.sin(f)+l.y;L.x=p*Math.cos(d)+l.x;L.y=p*Math.sin(d)+l.y;return[C,L]}};svgedit.path.Segment=function(f,d){this.selected=false;this.index=f;this.item=d;this.type=d.pathSegType;this.ctrlpts=[];this.segsel=this.ptgrip=null};svgedit.path.Segment.prototype.showCtrlPts=
|
|
function(f){for(var d in this.ctrlpts)this.ctrlpts[d].setAttribute("display",f?"inline":"none")};svgedit.path.Segment.prototype.selectCtrls=function(){$("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill","#4F80FF")};svgedit.path.Segment.prototype.show=function(f){if(this.ptgrip){this.ptgrip.setAttribute("display",f?"inline":"none");this.segsel.setAttribute("display",f?"inline":"none");this.showCtrlPts(f)}};svgedit.path.Segment.prototype.select=function(f){if(this.ptgrip){this.ptgrip.setAttribute("stroke",
|
|
f?"#0FF":"#00F");this.segsel.setAttribute("display",f?"inline":"none");this.ctrlpts&&this.selectCtrls(f);this.selected=f}};svgedit.path.Segment.prototype.addGrip=function(){this.ptgrip=svgedit.path.getPointGrip(this,true);this.ctrlpts=svgedit.path.getControlPoints(this,true);this.segsel=svgedit.path.getSegSelector(this,true)};svgedit.path.Segment.prototype.update=function(f){if(this.ptgrip){var d=svgedit.path.getGripPt(this),l=svgedit.browser.isTouch()?15:2.5;svgedit.utilities.assignAttributes(this.ptgrip,
|
|
this.ptgrip.nodeName=="rect"?{x:d.x-l,y:d.y-l}:{cx:d.x,cy:d.y});svgedit.path.getSegSelector(this,true);if(this.ctrlpts){if(f){this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.type=this.item.pathSegType}svgedit.path.getControlPoints(this)}}};svgedit.path.Segment.prototype.move=function(f,d){var l=this.item;l=this.ctrlpts?[l.x+=f,l.y+=d,l.x1,l.y1,l.x2+=f,l.y2+=d]:[l.x+=f,l.y+=d];svgedit.path.replacePathSeg(this.type,this.index,l);if(this.next&&this.next.ctrlpts){l=this.next.item;
|
|
l=[l.x,l.y,l.x1+=f,l.y1+=d,l.x2,l.y2];svgedit.path.replacePathSeg(this.next.type,this.next.index,l)}if(this.mate){l=this.mate.item;l=[l.x+=f,l.y+=d];svgedit.path.replacePathSeg(this.mate.type,this.mate.index,l)}this.update(true);this.next&&this.next.update(true)};svgedit.path.Segment.prototype.setLinked=function(f){var d,l,s;if(f==2){l=1;d=this.next;if(!d)return;s=this.item}else{l=2;d=this.prev;if(!d)return;s=d.item}var C=d.item;C["x"+l]=s.x+(s.x-this.item["x"+f]);C["y"+l]=s.y+(s.y-this.item["y"+
|
|
f]);svgedit.path.replacePathSeg(d.type,d.index,[C.x,C.y,C.x1,C.y1,C.x2,C.y2]);d.update(true)};svgedit.path.Segment.prototype.moveCtrl=function(f,d,l){var s=this.item;s["x"+f]+=d;s["y"+f]+=l;svgedit.path.replacePathSeg(this.type,this.index,[s.x,s.y,s.x1,s.y1,s.x2,s.y2]);this.update(true)};svgedit.path.Segment.prototype.setType=function(f,d){svgedit.path.replacePathSeg(f,this.index,d);this.type=f;this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.showCtrlPts(f===6);this.ctrlpts=svgedit.path.getControlPoints(this);
|
|
this.update(true)};svgedit.path.Path=function(f){if(!f||f.tagName!=="path")throw"svgedit.path.Path constructed without a <path> element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f=this.elem.pathSegList,d=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var l=0;l<d;l++){var s=f.getItem(l);s=new svgedit.path.Segment(l,s);
|
|
s.path=this;this.segs.push(s)}f=this.segs;s=null;for(l=0;l<d;l++){var C=f[l],p=l+1>=d?null:f[l+1],L=l-1<0?null:f[l-1];if(C.type===2){if(L&&L.type!==1){p=f[s];p.next=f[s+1];p.next.prev=p;p.addGrip()}s=l}else if(p&&p.type===1){C.next=f[s+1];C.next.prev=C;C.mate=f[s];C.addGrip();if(this.first_seg==null)this.first_seg=C}else if(p){if(C.type!==1){C.addGrip();if(p&&p.type!==2){C.next=p;C.next.prev=C}}}else if(C.type!==1){p=f[s];p.next=f[s+1];p.next.prev=p;p.addGrip();C.addGrip();if(!this.first_seg)this.first_seg=
|
|
f[s]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var d=this.segs.length,l=0;l<d;l++)if(f.call(this.segs[l],l)===false)break};svgedit.path.Path.prototype.addSeg=function(f){var d=this.segs[f];if(d.prev){var l=d.prev,s;switch(d.item.pathSegType){case 4:var C=(d.item.x+l.item.x)/2,p=(d.item.y+l.item.y)/2;s=this.elem.createSVGPathSegLinetoAbs(C,p);break;case 6:s=(l.item.x+d.item.x1)/2;var L=(d.item.x1+d.item.x2)/2,R=(d.item.x2+d.item.x)/2,O=(s+L)/2;L=(L+R)/2;C=(O+L)/2;var K=(l.item.y+
|
|
d.item.y1)/2,P=(d.item.y1+d.item.y2)/2;l=(d.item.y2+d.item.y)/2;var T=(K+P)/2;P=(P+l)/2;p=(T+P)/2;s=this.elem.createSVGPathSegCurvetoCubicAbs(C,p,s,K,O,T);svgedit.path.replacePathSeg(d.type,f,[d.item.x,d.item.y,L,P,R,l])}svgedit.path.insertItemBefore(this.elem,s,f)}};svgedit.path.Path.prototype.deleteSeg=function(f){var d=this.segs[f],l=this.elem.pathSegList;d.show(false);var s=d.next;if(d.mate){var C=[s.item.x,s.item.y];svgedit.path.replacePathSeg(2,s.index,C);svgedit.path.replacePathSeg(4,d.index,
|
|
C);l.removeItem(d.mate.index)}else{if(!d.prev){C=[s.item.x,s.item.y];svgedit.path.replacePathSeg(2,d.next.index,C)}l.removeItem(f)}};svgedit.path.Path.prototype.subpathIsClosed=function(f){var d=false;svgedit.path.path.eachSeg(function(l){if(l<=f)return true;if(this.type===2)return false;else if(this.type===1){d=true;return false}});return d};svgedit.path.Path.prototype.removePtFromSelection=function(f){var d=this.selected_pts.indexOf(f);if(d!=-1){this.segs[f].select(false);this.selected_pts.splice(d,
|
|
1)}};svgedit.path.Path.prototype.clearSelection=function(){this.eachSeg(function(){this.select(false)});this.selected_pts=[]};svgedit.path.Path.prototype.storeD=function(){this.last_d=this.elem.getAttribute("d")};svgedit.path.Path.prototype.show=function(f){this.eachSeg(function(){this.show(f)});f&&this.selectPt(this.first_seg.index);return this};svgedit.path.Path.prototype.movePts=function(f,d){for(var l=this.selected_pts.length;l--;)this.segs[this.selected_pts[l]].move(f,d)};svgedit.path.Path.prototype.moveCtrl=
|
|
function(f,d){var l=this.segs[this.selected_pts[0]];l.moveCtrl(this.dragctrl,f,d);b&&l.setLinked(this.dragctrl)};svgedit.path.Path.prototype.setSegType=function(f){this.storeD();for(var d=this.selected_pts.length,l;d--;){var s=this.segs[this.selected_pts[d]],C=s.prev;if(C){if(!f){l="Toggle Path Segment Type";f=s.type==6?4:6}f-=0;var p=s.item.x,L=s.item.y,R=C.item.x;C=C.item.y;var O;switch(f){case 6:if(s.olditem){R=s.olditem;O=[p,L,R.x1,R.y1,R.x2,R.y2]}else{O=p-R;var K=L-C;O=[p,L,R+O/3,C+K/3,p-O/3,
|
|
L-K/3]}break;case 4:O=[p,L];s.olditem=s.item}s.setType(f,O)}}svgedit.path.path.endChanges(l)};svgedit.path.Path.prototype.selectPt=function(f,d){this.clearSelection();f==null&&this.eachSeg(function(l){if(this.prev)f=l});this.addPtsToSelection(f);if(d){this.dragctrl=d;b&&this.segs[f].setLinked(d)}};svgedit.path.Path.prototype.update=function(){var f=this.elem;if(svgedit.utilities.getRotationAngle(f)){this.matrix=svgedit.math.getMatrix(f);this.imatrix=this.matrix.inverse()}else this.imatrix=this.matrix=
|
|
null;this.eachSeg(function(d){this.item=f.pathSegList.getItem(d);this.update()});return this};svgedit.path.getPath_=function(f){var d=n[f.id];d||(d=n[f.id]=new svgedit.path.Path(f));return d};svgedit.path.removePath_=function(f){f in n&&delete n[f]};var c=function(f,d){dx=f-oldcx;dy=d-oldcy;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)+angle;dx=r*Math.cos(theta)+oldcx;dy=r*Math.sin(theta)+oldcy;dx-=newcx;dy-=newcy;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-angle;return{x:(r*Math.cos(theta)+
|
|
newcx)/1,y:(r*Math.sin(theta)+newcy)/1}};svgedit.path.recalcRotatedPath=function(){var f=svgedit.path.path.elem,d=svgedit.utilities.getRotationAngle(f,true);if(d){var l=svgedit.utilities.getBBox(f),s=svgedit.path.path.oldbbox,C=s.x+s.width/2,p=s.y+s.height/2;s=l.x+l.width/2;l=l.y+l.height/2;s=s-C;var L=l-p;l=Math.sqrt(s*s+L*L);L=Math.atan2(L,s)+d;s=l*Math.cos(L)+C;l=l*Math.sin(L)+p;C=f.pathSegList;for(p=C.numberOfItems;p;){p-=1;L=C.getItem(p);var R=L.pathSegType;if(R!=1){var O=c(L.x,L.y);O=[O.x,O.y];
|
|
if(L.x1!=null&&L.x2!=null){c_vals1=c(L.x1,L.y1);c_vals2=c(L.x2,L.y2);O.splice(O.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(R,p,O)}}svgedit.utilities.getBBox(f);C=svgroot.createSVGTransform();f=svgedit.transformlist.getTransformList(f);C.setRotate(d*180/Math.PI,s,l);f.replaceItem(C,0)}};svgedit.path.clearData=function(){n={}}})();if(!window.console){window.console={};window.console.log=function(){};window.console.dir=function(){}}if(window.opera){window.console.log=function(a){opera.postError(a)};window.console.dir=function(){}}
|
|
(function(){var a=jQuery.fn.attr;jQuery.fn.attr=function(q,h){var b=this.length;if(!b)return a.apply(this,arguments);for(var n=0;n<b;n++){var u=this[n];if(u.namespaceURI==="http://www.w3.org/2000/svg")if(h!==undefined)u.setAttribute(q,h);else if($.isArray(q)){b=q.length;for(n={};b--;){var c=q[b],f=u.getAttribute(c);if(f||f==="0")f=isNaN(f)?f:f-0;n[c]=f}return n}else if(typeof q==="object")for(c in q)u.setAttribute(c,q[c]);else{if((f=u.getAttribute(q))||f==="0")f=isNaN(f)?f:f-0;return f}else return a.apply(this,
|
|
arguments)}return this}})();
|
|
$.SvgCanvas=function(a,q){function h(e,k){for(var m=svgedit.utilities.getBBox(e),A=0;A<2;A++){var z=A===0?"fill":"stroke",G=e.getAttribute(z);if(G&&G.indexOf("url(")===0){G=Q(G);if(G.tagName==="linearGradient"){var B=G.getAttribute("x1")||0,w=G.getAttribute("y1")||0,E=G.getAttribute("x2")||1,I=G.getAttribute("y2")||0;B=m.width*B+m.x;w=m.height*w+m.y;E=m.width*E+m.x;I=m.height*I+m.y;B=M(B,w,k);I=M(E,I,k);E={};E.x1=(B.x-m.x)/m.width;E.y1=(B.y-m.y)/m.height;E.x2=(I.x-m.x)/m.width;E.y2=(I.y-m.y)/m.height;
|
|
G=G.cloneNode(true);$(G).attr(E);G.id=ka();kb().appendChild(G);e.setAttribute(z,"url(#"+G.id+")")}}}}var b="http://www.w3.org/2000/svg",n={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};q&&$.extend(n,q);var u=n.dimensions,c=this,f=a.ownerDocument,d=f.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+b+'" xlinkns="http://www.w3.org/1999/xlink" width="'+u[0]+'" height="'+u[1]+'" x="'+u[0]+'" y="'+u[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,
|
|
true);a.appendChild(d);var l=f.createElementNS(b,"svg");(c.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:u[0],height:u[1],x:u[0],y:u[1],overflow:n.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(e)})();var s="svg_";c.setIdPrefix=
|
|
function(e){s=e};c.current_drawing_=new svgedit.draw.Drawing(l,s);var C=c.getCurrentDrawing=function(){return c.current_drawing_},p=1,L=null,R={shape:{fill:(n.initFill.color=="none"?"":"#")+n.initFill.color,fill_paint:null,fill_opacity:n.initFill.opacity,stroke:"#"+n.initStroke.color,stroke_paint:null,stroke_opacity:n.initStroke.opacity,stroke_width:n.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:n.initOpacity}};R.text=$.extend(true,{},R.shape);$.extend(R.text,
|
|
{fill:"#000000",stroke_width:0,font_size:24,font_family:"Helvetica, Arial, sans-serif"});var O=R.shape,K=Array(1),P=this.addSvgElementFromJson=function(e){var k=svgedit.utilities.getElem(e.attr.id),m=C().getCurrentLayer();if(k&&e.element!=k.tagName){m.removeChild(k);k=null}if(!k){k=f.createElementNS(b,e.element);if(m)(L||m).appendChild(k)}e.curStyles&&svgedit.utilities.assignAttributes(k,{fill:O.fill,stroke:O.stroke,"stroke-width":O.stroke_width,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin,
|
|
"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,"fill-opacity":O.fill_opacity,opacity:O.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(k,e.attr,100);svgedit.utilities.cleanupElement(k);return k},T=c.getTransformList=svgedit.transformlist.getTransformList,M=svgedit.math.transformPoint,ha=c.matrixMultiply=svgedit.math.matrixMultiply,na=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,fa=c.transformListToTransform=svgedit.math.transformListToTransform,
|
|
aa=svgedit.math.snapToAngle,V=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return n.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return db.round_digits}});var ra=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return K},
|
|
getSVGContent:function(){return l}});var ia=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,da=c.getHref=svgedit.utilities.getHref,U=c.setHref=svgedit.utilities.setHref,Y=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var oa=c.getRotationAngle=svgedit.utilities.getRotationAngle,pa=c.getElem=svgedit.utilities.getElem,la=c.assignAttributes=svgedit.utilities.assignAttributes,ma=this.cleanupElement=svgedit.utilities.cleanupElement,Ba=svgedit.sanitize.getNSMap(),Ea=c.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
|
|
Ia=svgedit.history.MoveElementCommand,za=svgedit.history.InsertElementCommand,Ka=svgedit.history.RemoveElementCommand,Na=svgedit.history.ChangeElementCommand,Aa=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,k){var m=svgedit.history.HistoryEventTypes;if(e==m.BEFORE_UNAPPLY||e==m.BEFORE_APPLY)c.clearSelection();else if(e==m.AFTER_APPLY||e==m.AFTER_UNAPPLY){var A=k.elements();c.pathActions.clear();N("changed",A);A=k.type();m=e==m.AFTER_APPLY;if(A==
|
|
Ia.type()){m=m?k.newParent:k.oldParent;m==l&&c.identifyLayers()}else if(A==za.type()||A==Ka.type()){k.parent==l&&c.identifyLayers();if(A==za.type())m&&Sa(k.elem);else m||Sa(k.elem);k.elem.tagName==="use"&&Jb(k.elem)}else if(A==Na.type()){k.elem.tagName=="title"&&k.elem.parentNode.parentNode==l&&c.identifyLayers();m=m?k.newValues:k.oldValues;m.stdDeviation&&c.setBlurOffsets(k.elem.parentNode,m.stdDeviation);if(k.elem.tagName==="use"&&svgedit.browser.isWebkit()){A=k.elem;if(!A.getAttribute("x")&&!A.getAttribute("y")){m=
|
|
A.parentNode;var z=A.nextSibling;m.removeChild(A);m.insertBefore(A,z)}}}}}});var ya=function(e){c.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return c.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(e){return c.getStrokedBBox([e])}});var Ga=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return d}});
|
|
svgedit.utilities.snapToGrid=function(e){var k=n.snappingStep,m=n.baseUnit;if(m!=="px")k*=svgedit.units.getTypeMap()[m];return e=Math.round(e/k)*k};var xa=svgedit.utilities.snapToGrid,nb={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear",exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},Ya=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],fb=$.data,
|
|
Sa=function(e){var k=$(e).attr(Ya),m;for(m in k){var A=k[m];if(A&&A.indexOf("url(")===0){A=ia(A).substr(1);if(!pa(A)){kb().appendChild(ub[A]);delete ub[A]}}}e=e.getElementsByTagName("*");if(e.length){k=0;for(m=e.length;k<m;k++)Sa(e[k])}},Wa={},Ca=n.imgPath+"logo.png",wa=[],db={round_digits:5},La=false,Ra=null,Da="select",gb="none",rb={},Xa=R.text,ab=O,xb=null,ua=null,jb=[],hb={},ub={};c.clipBoard=[];var lb=this.runExtensions=function(e,k,m){var A=false;if(m)A=[];$.each(hb,function(z,G){if(e in G)if(m)A.push(G[e](k));
|
|
else A=G[e](k)});return A};this.addExtension=function(e,k){if(e in hb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(k)?k($.extend(c.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:C().getNonce(),selectorManager:Ga})):k;hb[e]=m;N("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*p)/p},sb=this.getIntersectionList=function(e){if(ua==null)return null;var k=L||C().getCurrentLayer();jb.length||(jb=yb(k));var m=null;
|
|
try{m=k.getIntersectionList(e,null)}catch(A){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ua.getBBox();k={};for(var z in e)k[z]=e[z]/p;e=k}for(z=jb.length;z--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,jb[z].bbox)&&m.push(jb[z].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ob());if(!e.length)return false;var k=function(I){try{var F=svgedit.utilities.getBBox(I),g=svgedit.utilities.getRotationAngle(I);if(g&&g%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){g=
|
|
false;if(["ellipse","path","line","polyline","polygon"].indexOf(I.tagName)>=0)F=g=c.convertToPath(I,true);else if(I.tagName=="rect"){var o=I.getAttribute("rx"),v=I.getAttribute("ry");if(o||v)F=g=c.convertToPath(I,true)}if(!g){var D=I.cloneNode(true),H=document.createElementNS(b,"g"),J=I.parentNode;J.appendChild(H);H.appendChild(D);F=svgedit.utilities.bboxToObj(H.getBBox());J.removeChild(H)}}return F}catch(X){console.log(I,X);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=k(this)});
|
|
if(m==null)return null;var A=m.x+m.width,z=m.y+m.height,G=m.x,B=m.y,w=function(I){var F=I.getAttribute("stroke-width"),g=0;if(I.getAttribute("stroke")!="none"&&!isNaN(F))g+=F/2;return g},E=[];$.each(e,function(I,F){var g=k(F);if(g){var o=w(F);G=Math.min(G,g.x-o);B=Math.min(B,g.y-o);E.push(g)}});m.x=G;m.y=B;$.each(e,function(I,F){var g=E[I];if(g&&F.nodeType==1){var o=w(F);A=Math.max(A,g.x+g.width+o);z=Math.max(z,g.y+g.height+o)}});m.width=A-G;m.height=z-B;return m};var ob=this.getVisibleElements=function(e){e||
|
|
(e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push(A)}catch(z){}});return k.reverse()},yb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push({elem:A,bbox:getStrokedBBox([A])})}catch(z){}});return k.reverse()},zb=this.groupSvgElem=function(e){var k=document.createElementNS(b,"g");e.parentNode.replaceChild(k,e);$(k).append(e).data("gsvg",
|
|
e)[0].id=ka()},ja=function(e){var k=document.createElementNS(e.namespaceURI,e.nodeName);k.removeAttribute("id");$.each(e.attributes,function(A,z){z.localName!="-moz-math-font-style"&&k.setAttributeNS(z.namespaceURI,z.nodeName,z.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var m=Ja.convertPath(e);k.setAttribute("d",m)}$.each(e.childNodes,function(A,z){switch(z.nodeType){case 1:k.appendChild(ja(z));break;case 3:k.textContent=z.nodeValue}});if($(e).data("gsvg"))$(k).data("gsvg",k.firstChild);
|
|
else if($(e).data("symbol")){e=$(e).data("symbol");$(k).data("ref",e).data("symbol",e)}else k.tagName=="image"&&Gb(k);k.id=ka();return k},ba,ka,N;(function(e){var k={};ba=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};N=e.call=function(m,A){if(k[m])return k[m](this,A)};e.bind=function(m,A){var z=k[m];k[m]=A;return z}})(c);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var k=0,m=e.length;k<m;++k){var A=
|
|
e[k];A.setAttribute("d",Ja.convertPath(A));Ja.fixEnd(A)}};var Q=this.getRefElem=function(e){return pa(ia(e).substr(1))},ea=function(e){if(!svgedit.browser.isGecko())return e;var k=e.cloneNode(true);e.parentNode.insertBefore(k,e);e.parentNode.removeChild(e);Ga.releaseSelector(e);K[0]=k;Ga.requestSelector(k).showGrips(true);return k};this.setRotationAngle=function(e,k){e=parseFloat(e);var m=K[0],A=m.getAttribute("transform"),z=svgedit.utilities.getBBox(m),G=z.x+z.width/2,B=z.y+z.height/2;z=T(m);z.numberOfItems>
|
|
0&&z.getItem(0).type==4&&z.removeItem(0);if(e!=0){G=M(G,B,fa(z).matrix);B=d.createSVGTransform();B.setRotate(e,G.x,G.y);z.numberOfItems?z.insertItemBefore(B,0):z.appendItem(B)}else z.numberOfItems==0&&m.removeAttribute("transform");if(!k){z=m.getAttribute("transform");m.setAttribute("transform",A);ib("transform",z,K);N("changed",K)}pa("pathpointgrip_container");m=Ga.requestSelector(K[0]);m.resize();m.updateGripCursors(e)};var Fa=this.recalculateAllSelectedDimensions=function(){for(var e=new Aa(gb==
|
|
"none"?"position":"size"),k=K.length;k--;){var m=Qa(K[k]);m&&e.addSubCommand(m)}if(!e.isEmpty()){ya(e);N("changed",K)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Va=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},$a=this.remapElement=function(e,k,m){var A=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",z=function(){if(A)for(var g in k)k[g]=xa(k[g]);la(e,k,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var B=G===0?"fill":"stroke",
|
|
w=e.getAttribute(B);if(w&&w.indexOf("url(")===0)if(m.a<0||m.d<0){w=Q(w).cloneNode(true);if(m.a<0){var E=w.getAttribute("x1"),I=w.getAttribute("x2");w.setAttribute("x1",-(E-1));w.setAttribute("x2",-(I-1))}if(m.d<0){E=w.getAttribute("y1");I=w.getAttribute("y2");w.setAttribute("y1",-(E-1));w.setAttribute("y2",-(I-1))}w.id=ka();kb().appendChild(w);e.setAttribute(B,"url(#"+w.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){B=fa(e).matrix;B=ha(B.inverse(),
|
|
m,B);k.x=parseFloat(k.x)+B.e;k.y=parseFloat(k.y)+B.f}else{B=T(e);w=d.createSVGTransform();w.setMatrix(ha(fa(B).matrix,m));B.clear();B.appendItem(w)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){B=T(e);w=d.createSVGTransform();w.setMatrix(ha(fa(B).matrix,m));B.clear();B.appendItem(w)}else{B=M(k.x,k.y,m);k.width=m.a*k.width;k.height=m.d*k.height;k.x=B.x+Math.min(0,k.width);k.y=B.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}z();
|
|
break;case "ellipse":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;k.rx=m.a*k.rx;k.ry=m.d*k.ry;k.rx=Math.abs(k.rx);k.ry=Math.abs(k.ry);z();break;case "circle":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);k.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(k.r)k.r=Math.abs(k.r);z();break;case "line":B=M(k.x1,k.y1,m);E=M(k.x2,k.y2,m);k.x1=B.x;k.y1=B.y;k.x2=E.x;k.y2=E.y;case "text":m=e.querySelectorAll("tspan");for(G=m.length;G--;){B=ra("x",e.getAttribute("x"));
|
|
w=ra("x",m[G].getAttribute("x"));E=ra("y",e.getAttribute("y"));I=ra("y",m[G].getAttribute("y"));var F={};if(!isNaN(B)&&!isNaN(w)&&B!=0&&w!=0&&k.x)F.x=k.x-(B-w);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&k.y)F.y=k.y-(E-I);if(F.x||F.y)la(m[G],F,1E3,true)}z();break;case "use":z();break;case "g":(z=$(e).data("gsvg"))&&la(z,k,1E3,true);break;case "polyline":case "polygon":z=k.points.length;for(G=0;G<z;++G){I=k.points[G];I=M(I.x,I.y,m);k.points[G].x=I.x;k.points[G].y=I.y}z=k.points.length;m="";for(G=0;G<z;++G){I=
|
|
k.points[G];m+=I.x+","+I.y+" "}e.setAttribute("points",m);break;case "path":B=e.pathSegList;z=B.numberOfItems;k.d=Array(z);for(G=0;G<z;++G){w=B.getItem(G);k.d[G]={type:w.pathSegType,x:w.x,y:w.y,x1:w.x1,y1:w.y1,x2:w.x2,y2:w.y2,r1:w.r1,r2:w.r2,angle:w.angle,largeArcFlag:w.largeArcFlag,sweepFlag:w.sweepFlag}}z=k.d.length;G=k.d[0];F=M(G.x,G.y,m);k.d[0].x=F.x;k.d[0].y=F.y;for(G=1;G<z;++G){w=k.d[G];B=w.type;if(B%2==0){I=M(w.x!=undefined?w.x:F.x,w.y!=undefined?w.y:F.y,m);B=M(w.x1,w.y1,m);E=M(w.x2,w.y2,m);
|
|
w.x=I.x;w.y=I.y;w.x1=B.x;w.y1=B.y;w.x2=E.x;w.y2=E.y}else{w.x=m.a*w.x;w.y=m.d*w.y;w.x1=m.a*w.x1;w.y1=m.d*w.y1;w.x2=m.a*w.x2;w.y2=m.d*w.y2}w.r1=m.a*w.r1;w.r2=m.d*w.r2}m="";z=k.d.length;for(G=0;G<z;++G){w=k.d[G];B=w.type;m+=Oa[B];switch(B){case 13:case 12:m+=w.x+" ";break;case 15:case 14:m+=w.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:m+=w.x+","+w.y+" ";break;case 7:case 6:m+=w.x1+","+w.y1+" "+w.x2+","+w.y2+" "+w.x+","+w.y+" ";break;case 9:case 8:m+=w.x1+","+w.y1+" "+w.x+","+w.y+" ";break;
|
|
case 11:case 10:m+=w.r1+","+w.r2+" "+w.angle+" "+ +w.largeArcFlag+" "+ +w.sweepFlag+" "+w.x+","+w.y+" ";break;case 17:case 16:m+=w.x2+","+w.y2+" "+w.x+","+w.y+" "}}e.setAttribute("d",m)}},qb=function(e,k,m){e=Q(e).firstChild;var A=T(e),z=d.createSVGTransform();z.setTranslate(k,m);A.appendItem(z);Qa(e)},Qa=this.recalculateDimensions=function(e){if(e==null)return null;var k=T(e);if(k&&k.numberOfItems>0){for(var m=k.numberOfItems;m--;){var A=k.getItem(m);if(A.type===0)k.removeItem(m);else if(A.type===
|
|
1)svgedit.math.isIdentity(A.matrix)&&k.removeItem(m);else A.type===4&&A.angle===0&&k.removeItem(m)}if(k.numberOfItems===1&&oa(e))return null}if(!k||k.numberOfItems==0){e.removeAttribute("transform");return null}if(k){m=k.numberOfItems;for(var z=[];m--;){A=k.getItem(m);if(A.type===1)z.push([A.matrix,m]);else if(z.length)z=[]}if(z.length===2){m=d.createSVGTransformFromMatrix(ha(z[1][0],z[0][0]));k.removeItem(z[0][1]);k.removeItem(z[1][1]);k.insertItemBefore(m,z[1][1])}m=k.numberOfItems;if(m>=2&&k.getItem(m-
|
|
2).type===1&&k.getItem(m-1).type===2){z=d.createSVGTransform();A=ha(k.getItem(m-2).matrix,k.getItem(m-1).matrix);z.setMatrix(A);k.removeItem(m-2);k.removeItem(m-2);k.appendItem(z)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type===4)return null}var G=$(e).data("gsvg");m=new Aa("Transform");var B={},w=null;A=[];switch(e.tagName){case "line":A=["x1","y1",
|
|
"x2","y2"];break;case "circle":A=["cx","cy","r"];break;case "ellipse":A=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":A=["width","height","x","y"];break;case "use":case "text":case "tspan":A=["x","y"];break;case "polygon":case "polyline":w={};w.points=e.getAttribute("points");z=e.points;var E=z.numberOfItems;B.points=Array(E);for(var I=0;I<E;++I){var F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}break;case "path":w={};w.d=e.getAttribute("d");B.d=e.getAttribute("d")}if(A.length){B=
|
|
$(e).attr(A);$.each(B,function(Ha,sa){B[Ha]=ra(Ha,sa)})}else if(G)B={x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(w==null){w=$.extend(true,{},B);$.each(w,function(Ha,sa){w[Ha]=ra(Ha,sa)})}w.transform=Ra?Ra:"";if(e.tagName=="g"&&!G||e.tagName=="a"){z=svgedit.utilities.getBBox(e);var g={x:z.x+z.width/2,y:z.y+z.height/2},o=M(z.x+z.width/2,z.y+z.height/2,fa(k).matrix);A=d.createSVGMatrix();if(z=oa(e)){I=z*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A=
|
|
k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I=A=G=0;var v=k.numberOfItems;if(v)var D=k.getItem(0).matrix;if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;var H=k.getItem(v-3).matrix,J=k.getItem(v-2).matrix,X=k.getItem(v-1).matrix;E=e.childNodes;for(F=E.length;F--;){var ca=E.item(F);A=G=0;if(ca.nodeType==1){var S=T(ca);if(S){A=fa(S).matrix;G=oa(ca);var W=Ra,Z=[];Ra=ca.getAttribute("transform");if(G||na(S)){var qa=
|
|
d.createSVGTransform();qa.setMatrix(ha(H,J,X,A));S.clear();S.appendItem(qa);Z.push(qa)}else{G=ha(A.inverse(),X,A);qa=d.createSVGMatrix();qa.e=-G.e;qa.f=-G.f;A=ha(qa.inverse(),A.inverse(),H,J,X,A,G.inverse());var ta=d.createSVGTransform(),ga=d.createSVGTransform(),Ta=d.createSVGTransform();ta.setTranslate(G.e,G.f);ga.setScale(A.a,A.d);Ta.setTranslate(qa.e,qa.f);S.appendItem(Ta);S.appendItem(ga);S.appendItem(ta);Z.push(Ta);Z.push(ga);Z.push(ta)}m.addSubCommand(Qa(ca));Ra=W}}}k.removeItem(v-1);k.removeItem(v-
|
|
2);k.removeItem(v-3)}else if(v>=3&&k.getItem(v-1).type==1){I=3;A=fa(k).matrix;qa=d.createSVGTransform();qa.setMatrix(A);k.clear();k.appendItem(qa)}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;G=fa(k).matrix;k.removeItem(0);A=fa(k).matrix.inverse();A=ha(A,G);G=A.e;A=A.f;if(G!=0||A!=0){E=e.childNodes;F=E.length;for(v=[];F--;){ca=E.item(F);if(ca.nodeType==1){if(ca.getAttribute("clip-path")){W=ca.getAttribute("clip-path");if(v.indexOf(W)===-1){qb(W,G,A);v.push(W)}}W=Ra;Ra=ca.getAttribute("transform");
|
|
if(S=T(ca)){H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,0):S.appendItem(H);m.addSubCommand(Qa(ca));S=e.getElementsByTagNameNS(b,"use");ca="#"+ca.id;for(H=S.length;H--;){J=S.item(H);if(ca==da(J)){X=d.createSVGTransform();X.setTranslate(-G,-A);T(J).insertItemBefore(X,0);m.addSubCommand(Qa(J))}}Ra=W}}}v=[];Ra=W}}else if(v==1&&k.getItem(0).type==1&&!z){I=1;A=k.getItem(0).matrix;E=e.childNodes;for(F=E.length;F--;){ca=E.item(F);if(ca.nodeType==1){W=Ra;Ra=ca.getAttribute("transform");
|
|
if(S=T(ca)){G=ha(A,fa(S).matrix);v=d.createSVGTransform();v.setMatrix(G);S.clear();S.appendItem(v,0);m.addSubCommand(Qa(ca));Ra=W;W=ca.getAttribute("stroke-width");ca.getAttribute("stroke")!=="none"&&!isNaN(W)&&ca.setAttribute("stroke-width",W*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(z){g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(z){o={x:g.x+D.e,y:g.y+
|
|
D.f};g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==3){A=fa(k).matrix;D=d.createSVGTransform();D.setRotate(z,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(z,o.x,o.y);o=g.matrix.inverse();W=A.inverse();o=ha(W,o,D,A);G=o.e;A=o.f;if(G!=0||A!=0){E=e.childNodes;for(F=E.length;F--;){ca=E.item(F);if(ca.nodeType==1){W=Ra;Ra=ca.getAttribute("transform");S=T(ca);H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,
|
|
0):S.appendItem(H);m.addSubCommand(Qa(ca));Ra=W}}}if(z)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else{z=svgedit.utilities.getBBox(e);if(!z&&e.tagName!="path")return null;A=d.createSVGMatrix();if(G=oa(e)){g={x:z.x+z.width/2,y:z.y+z.height/2};o=M(z.x+z.width/2,z.y+z.height/2,fa(k).matrix);I=G*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I<k.numberOfItems;++I){A=k.getItem(I);if(A.type==4){A=A.matrix;g.y=(E*A.e+A.f)/2;g.x=(A.e-E*A.f)/2;k.removeItem(I);break}}}I=
|
|
0;v=k.numberOfItems;if(!svgedit.browser.isWebkit())if((D=e.getAttribute("fill"))&&D.indexOf("url(")===0){D=Q(D);W="pattern";if(D.tagName!==W)W="gradient";if(D.getAttribute(W+"Units")==="userSpaceOnUse"){A=fa(k).matrix;z=T(D);z=fa(z).matrix;A=ha(A,z);z="matrix("+[A.a,A.b,A.c,A.d,A.e,A.f].join(",")+")";D.setAttribute(W+"Transform",z)}}if(v>=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;A=fa(k,v-3,v-1).matrix;k.removeItem(v-1);k.removeItem(v-2);k.removeItem(v-3)}else if(v==
|
|
4&&k.getItem(v-1).type==1){I=3;A=fa(k).matrix;qa=d.createSVGTransform();qa.setMatrix(A);k.clear();k.appendItem(qa);A=d.createSVGMatrix()}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;D=k.getItem(0).matrix;W=fa(k,1).matrix;z=W.inverse();A=ha(z,D,W);k.removeItem(0)}else if(v==1&&k.getItem(0).type==1&&!G){A=fa(k).matrix;switch(e.tagName){case "line":B=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":B.points=e.getAttribute("points");if(B.points){z=e.points;E=z.numberOfItems;
|
|
B.points=Array(E);for(I=0;I<E;++I){F=z.getItem(I);B.points[I]={x:F.x,y:F.y}}}case "path":B.d=e.getAttribute("d");I=1;k.clear()}}else{I=4;if(G){g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==1||I==2||I==3)$a(e,B,A);if(I==2){if(G){na(k)||(o={x:g.x+A.e,y:g.y+A.f});g=d.createSVGTransform();g.setRotate(G,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==
|
|
3&&G){A=fa(k).matrix;D=d.createSVGTransform();D.setRotate(G,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(G,o.x,o.y);o=g.matrix.inverse();W=A.inverse();o=ha(W,o,D,A);$a(e,B,o);if(G)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}k.numberOfItems==0&&e.removeAttribute("transform");m.addSubCommand(new Na(e,w));return m},pb=null,Pa=this.clearSelection=function(e){if(K[0]!=null)for(var k=K.length,m=0;m<k;++m){var A=K[m];if(A==null)break;Ga.releaseSelector(A);K[m]=null}e||N("selected",
|
|
K)},tb=this.addToSelection=function(e,k){if(e.length!=0){for(var m=0;m<K.length;){if(K[m]==null)break;++m}for(var A=e.length;A--;){var z=e[A];if(z&&svgedit.utilities.getBBox(z)){if(z.tagName==="a"&&z.childNodes.length===1)z=z.firstChild;if(K.indexOf(z)==-1){K[m]=z;m++;z=Ga.requestSelector(z);K.length>1&&z.showGrips(false)}}}N("selected",K);k||K.length==1?Ga.requestSelector(K[0]).showGrips(true):Ga.requestSelector(K[0]).showGrips(false);for(K.sort(function(G,B){if(G&&B&&G.compareDocumentPosition)return 3-
|
|
(B.compareDocumentPosition(G)&6);else if(G==null)return 1});K[0]==null;)K.shift(0)}},vb=this.selectOnly=function(e,k){Pa(true);tb(e,k)};this.removeFromSelection=function(e){if(K[0]!=null)if(e.length!=0){var k=Array(K.length);j=0;len=K.length;for(var m=0;m<len;++m){var A=K[m];if(A)if(e.indexOf(A)==-1){k[j]=A;j++}else Ga.releaseSelector(A)}K=k}};this.selectAllInCurrentLayer=function(){var e=C().getCurrentLayer();if(e){Da="select";vb($(L||e).children())}};var mb=this.getMouseTarget=function(e){if(e==
|
|
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var k=C().getCurrentLayer();if([d,a,l,k].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ga.selectorParentGroup;for(;e.parentNode!==(L||k);)e=e.parentNode;return e};(function(){var e=null,k=null,m=null,A=
|
|
null,z=null,G={},B={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches>1)){var E=w.button===2;pb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);w.preventDefault();if(E)Da="select";F=F/p;I=I/p;var g=mb(w);if(g.tagName==="a"&&g.childNodes.length===1)g=g.firstChild;var o=A=k=F,v=z=m=I;if(n.gridSnapping){F=xa(F);I=xa(I);k=xa(k);m=xa(m)}if(g==
|
|
Ga.selectorParentGroup&&K[0]!=null){g=w.target;var D=fb(g,"type");if(D=="rotate"){Da="rotate";current_rotate_mode=fb(g,"dir")}else if(D=="resize"){Da="resize";gb=fb(g,"dir")}g=K[0]}Ra=g.getAttribute("transform");D=T(g);switch(Da){case "select":La=true;gb="none";if(E)La=false;if(g!=d){if(K.indexOf(g)==-1){w.shiftKey||Pa(true);tb([g]);xb=g;Ja.clear()}if(!E)for(E=0;E<K.length;++E)if(K[E]!=null){var H=T(K[E]);H.numberOfItems?H.insertItemBefore(d.createSVGTransform(),0):H.appendItem(d.createSVGTransform())}}else if(!E){Pa();
|
|
Da="multiselect";if(ua==null)ua=Ga.getRubberBandBox();A*=p;z*=p;la(ua,{x:A,y:z,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:o*p,y:o*p,width:0,height:0,display:"inline"},100);break;case "resize":La=true;k=F;m=I;G=svgedit.utilities.getBBox($("#selectedBox0")[0]);var J={};$.each(G,function(X,ca){J[X]=ca/p});G=J;E=oa(g)?1:0;if(na(D)){D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(),E);D.insertItemBefore(d.createSVGTransform(),
|
|
E)}else{D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());D.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(F=svgedit.browser.isChrome())H=function(X){var ca=X.getAttributeNS(null,"stroke");X.removeAttributeNS(null,"stroke");setTimeout(function(){X.setAttributeNS(null,"stroke",ca)},1)};g.style.vectorEffect="non-scaling-stroke";F&&H(g);I=g.getElementsByTagName("*");o=I.length;for(E=0;E<o;E++){I[E].style.vectorEffect="non-scaling-stroke";
|
|
F&&H(I[E])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=o+","+v+" ";H=O.stroke_width==0?1:O.stroke_width;P({element:"polyline",curStyles:true,attr:{points:e,id:ka(),fill:"none",opacity:O.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});B.minx=o;B.maxx=o;B.miny=v;B.maxy=v;break;case "image":La=true;H=P({element:"image",attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2,style:"pointer-events:inherit"}});U(H,Ca);Gb(H);break;case "square":case "rect":La=true;
|
|
k=F;m=I;P({element:"rect",curStyles:true,attr:{x:F,y:I,width:0,height:0,id:ka(),opacity:O.opacity/2}});break;case "line":La=true;H=O.stroke_width==0?1:O.stroke_width;P({element:"line",curStyles:true,attr:{x1:F,y1:I,x2:F,y2:I,id:ka(),stroke:O.stroke,"stroke-width":H,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin,"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,fill:"none",opacity:O.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;P({element:"circle",
|
|
curStyles:true,attr:{cx:F,cy:I,r:0,id:ka(),opacity:O.opacity/2}});break;case "ellipse":La=true;P({element:"ellipse",curStyles:true,attr:{cx:F,cy:I,rx:0,ry:0,id:ka(),opacity:O.opacity/2}});break;case "text":La=true;P({element:"text",curStyles:true,attr:{x:F,y:I,id:ka(),fill:Xa.fill,"stroke-width":Xa.stroke_width,"font-size":Xa.font_size,"font-family":Xa.font_family,"text-anchor":"left","xml:space":"preserve",opacity:O.opacity}});break;case "path":case "pathedit":k*=p;m*=p;Ja.mouseDown(w,g,k,m);La=
|
|
true;break;case "textedit":k*=p;m*=p;cb.mouseDown(w,g,k,m);La=true;break;case "rotate":La=true;c.undoMgr.beginUndoableChange("transform",K);document.getElementById("workarea").className="rotate"}H=lb("mouseDown",{event:w,start_x:k,start_y:m,selectedElements:K},true);$.each(H,function(X,ca){if(ca&&ca.started)La=true});if(Da)document.getElementById("workarea").className=Da=="resize"?w.target.style.cursor:Da}}).mousemove(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches.length>1))if(La)if(!(w.button===
|
|
1||c.spaceKey)){var E=K[0],I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);var g=pa(ba()),o=x=F/p,v=y=I/p;if(n.gridSnapping){x=xa(x);y=xa(y)}w.preventDefault();switch(Da){case "select":if(K[0]!==null){o=x-k;var D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D)}if(w.shiftKey){var H=aa(k,m,x,y);x=H.x;y=H.y}if(o!=0||D!=0){H=K.length;for(v=0;v<H;++v){E=K[v];if(E==null)break;var J=d.createSVGTransform();g=T(E);J.setTranslate(o,D);g.numberOfItems?g.replaceItem(J,0):g.appendItem(J);Ga.requestSelector(E).resize()}if(w.altKey)if(!c.addClones){c.addClones=
|
|
c.cloneSelectedElements(0,0,J);c.removeClones=function(){c.addClones&&c.addClones.forEach(function(ga){ga.parentNode&&ga.parentNode.removeChild(ga);c.addClones=false})};window.addEventListener("keyup",c.removeClones)}N("transition",K)}}break;case "multiselect":o*=p;v*=p;la(ua,{x:Math.min(A,o),y:Math.min(z,v),width:Math.abs(o-A),height:Math.abs(v-z)},100);g=[];o=[];J=sb();H=K.length;for(v=0;v<H;++v){D=J.indexOf(K[v]);if(D==-1)g.push(K[v]);else J[D]=null}H=J.length;for(v=0;v<H;++v)J[v]&&o.push(J[v]);
|
|
g.length>0&&c.removeFromSelection(g);o.length>0&&tb(o);break;case "resize":g=T(E);o=(J=na(g))?G:svgedit.utilities.getBBox(E);H=o.x;v=o.y;var X=o.width,ca=o.height;o=x-k;D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D);ca=xa(ca);X=xa(X)}var S=oa(E);if(S){var W=Math.sqrt(o*o+D*D);D=Math.atan2(D,o)-S*Math.PI/180;o=W*Math.cos(D);D=W*Math.sin(D)}if(gb.indexOf("n")==-1&&gb.indexOf("s")==-1)D=0;if(gb.indexOf("e")==-1&&gb.indexOf("w")==-1)o=0;var Z=W=0,qa=ca?(ca+D)/ca:1,ta=X?(X+o)/X:1;if(gb.indexOf("n")>=0){qa=ca?
|
|
(ca-D)/ca:1;Z=ca}if(gb.indexOf("w")>=0){ta=X?(X-o)/X:1;W=X}o=d.createSVGTransform();D=d.createSVGTransform();X=d.createSVGTransform();if(n.gridSnapping){H=xa(H);W=xa(W);v=xa(v);Z=xa(Z)}o.setTranslate(-(H+W),-(v+Z));if(w.shiftKey)if(ta==1)ta=qa;else qa=ta;D.setScale(ta,qa);X.setTranslate(H+W,v+Z);if(J){J=S?1:0;g.replaceItem(o,2+J);g.replaceItem(D,1+J);g.replaceItem(X,0+J)}else{J=g.numberOfItems;g.replaceItem(X,J-3);g.replaceItem(D,J-2);g.replaceItem(o,J-1)}Ga.requestSelector(E).resize();N("transition",
|
|
K);break;case "zoom":o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100);break;case "text":la(g,{x:x,y:y},1E3);break;case "line":o=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=xa(x);y=xa(y)}J=x;H=y;if(w.shiftKey){H=aa(k,m,J,H);J=H.x;H=H.y}g.setAttributeNS(null,"x2",J);g.setAttributeNS(null,"y2",H);window.opera||d.unsuspendRedraw(o);break;case "foreignObject":case "square":case "rect":case "image":o=Math.abs(x-k);J=Math.abs(y-m);if(Da==
|
|
"square"||w.shiftKey){o=J=Math.max(o,J);H=k<x?k:k-o;v=m<y?m:m-J}else{H=Math.min(k,x);v=Math.min(m,y)}if(w.altKey){o*=2;J*=2;H=k-o/2;v=m-J/2}if(n.gridSnapping){o=xa(o);J=xa(J);H=xa(H);v=xa(v)}la(g,{width:o,height:J,x:H,y:v},1E3);break;case "circle":o=$(g).attr(["cx","cy"]);J=o.cx;H=o.cy;o=Math.sqrt((x-J)*(x-J)+(y-H)*(y-H));if(n.gridSnapping)o=xa(o);g.setAttributeNS(null,"r",o);break;case "ellipse":o=$(g).attr(["cx","cy"]);J=Math.abs(k+(x-k)/2);H=Math.abs(m+(y-m)/2);o=null;window.opera||d.suspendRedraw(1E3);
|
|
if(n.gridSnapping){x=xa(x);J=xa(J);y=xa(y);H=xa(H)}v=Math.abs(k-J);D=Math.abs(m-H);if(w.shiftKey){D=v;H=y>m?m+v:m-v}if(w.altKey){J=k;H=m;v=Math.abs(x-J);D=w.shiftKey?v:Math.abs(y-H)}g.setAttributeNS(null,"rx",v);g.setAttributeNS(null,"ry",D);g.setAttributeNS(null,"cx",J);g.setAttributeNS(null,"cy",H);window.opera||d.unsuspendRedraw(o);break;case "fhellipse":case "fhrect":B.minx=Math.min(o,B.minx);B.maxx=Math.max(o,B.maxx);B.miny=Math.min(v,B.miny);B.maxy=Math.max(v,B.maxy);case "fhpath":e+=+o+","+
|
|
v+" ";g.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=p;y*=p;if(n.gridSnapping){x=xa(x);y=xa(y);k=xa(k);m=xa(m)}if(w.shiftKey){if(J=svgedit.path.path){g=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:m}else{g=k;J=m}H=aa(g,J,x,y);x=H.x;y=H.y}if(ua&&ua.getAttribute("display")!=="none"){o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100)}Ja.mouseMove(w,x,y);break;case "textedit":x*=p;y*=p;cb.mouseMove(F,I);break;case "rotate":o=
|
|
svgedit.utilities.getBBox(E);J=o.x+o.width/2;H=o.y+o.height/2;g=V(E);g=M(J,H,g);J=g.x;H=g.y;g=o.x;v=o.y;if(current_rotate_mode=="nw")g=o.x+o.width;if(current_rotate_mode=="se")v=o.y+o.height;if(current_rotate_mode=="sw"){g=o.x+o.width;v=o.y+o.height}compensation_angle=(Math.atan2(H-v,J-g)*(180/Math.PI)-90)%360;S=(Math.atan2(H-y,J-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=xa(S);if(w.shiftKey)S=Math.round(S/45)*45;c.setRotationAngle(S<-180?360+S:S,true);N("transition",K)}lb("mouseMove",
|
|
{event:w,mouse_x:F,mouse_y:I,selected:E})}}).click(function(w){w.preventDefault();return false}).dblclick(function(w){var E=w.target.parentNode;if(E!==L){var I=mb(w),F=I.tagName;if(F==="text"&&Da!=="textedit"){w=M(w.pageX,w.pageY,pb);cb.select(I,w.x,w.y)}if((F==="g"||F==="a")&&oa(I)){Kb(I);I=K[0];Pa(true)}L&&Hb();E.tagName!=="g"&&E.tagName!=="a"||E===C().getCurrentLayer()||I===Ga.selectorParentGroup||Pb(I)}}).mouseup(function(w){c.addClones=false;window.removeEventListener("keyup",c.removeClones);
|
|
K=K.filter(Boolean);if(w.button!==2){var E=xb;xb=null;if(La){var I=M(w.pageX,w.pageY,pb),F=I.x*p;I=I.y*p;var g=F/p,o=I/p,v=pa(ba()),D=false;La=false;switch(Da){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");jb=[]}Da="select";case "select":if(K[0]!=null){if(K.length==1){F=K[0];switch(F.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ab.fill=F.getAttribute("fill");ab.fill_opacity=F.getAttribute("fill-opacity");ab.stroke=F.getAttribute("stroke");
|
|
ab.stroke_opacity=F.getAttribute("stroke-opacity");ab.stroke_width=F.getAttribute("stroke-width");ab.stroke_dasharray=F.getAttribute("stroke-dasharray");ab.stroke_linejoin=F.getAttribute("stroke-linejoin");ab.stroke_linecap=F.getAttribute("stroke-linecap")}if(F.tagName=="text"){Xa.font_size=F.getAttribute("font-size");Xa.font_family=F.getAttribute("font-family")}Ga.requestSelector(F).showGrips(true)}Fa();if(g!=A||o!=z){w=K.length;for(F=0;F<w;++F){if(K[F]==null)break;K[F].firstChild||Ga.requestSelector(K[F]).resize()}}else{F=
|
|
w.target;if(K[0].nodeName==="path"&&K[1]==null)Ja.select(K[0]);else w.shiftKey&&E!=F&&c.removeFromSelection([F])}if(svgedit.browser.supportsNonScalingStroke())if(w=K[0]){w.removeAttribute("style");svgedit.utilities.walkTree(w,function(X){X.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");N("zoomed",{x:Math.min(A,g),y:Math.min(z,o),width:Math.abs(g-A),height:Math.abs(o-z),factor:w.altKey?0.5:2});return;case "fhpath":E=v.getAttribute("points");g=E.indexOf(",");
|
|
if(D=g>=0?E.indexOf(",",g+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)v=Ja.smoothPolylineIntoPath(v);break;case "line":E=$(v).attr(["x1","x2","y1","y2"]);D=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(v).attr(["width","height"]);D=E.width!=0||E.height!=0||Da==="image";break;case "circle":D=v.getAttribute("r")!=0;break;case "ellipse":E=$(v).attr(["rx","ry"]);D=E.rx!=null||E.ry!=null;break;case "fhellipse":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"ellipse",
|
|
curStyles:true,attr:{cx:(B.minx+B.maxx)/2,cy:(B.miny+B.maxy)/2,rx:(B.maxx-B.minx)/2,ry:(B.maxy-B.miny)/2,id:ba()}});N("changed",[v]);D=true}break;case "fhrect":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"rect",curStyles:true,attr:{x:B.minx,y:B.miny,width:B.maxx-B.minx,height:B.maxy-B.miny,id:ba()}});N("changed",[v]);D=true}break;case "text":D=true;vb([v]);cb.start(v);break;case "path":v=null;La=true;E=Ja.mouseUp(w,v,F,I);v=E.element;D=E.keep;break;case "pathedit":D=true;v=null;Ja.mouseUp(w);
|
|
break;case "textedit":D=false;v=null;cb.mouseUp(w,F,I);break;case "rotate":D=true;v=null;Da="select";E=c.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Fa();N("changed",K)}F=lb("mouseUp",{event:w,mouse_x:F,mouse_y:I},true);$.each(F,function(X,ca){if(ca){D=ca.keep||D;v=ca.element;La=ca.started||La}});if(!D&&v!=null){C().releaseId(ba());v.parentNode.removeChild(v);v=null;for(F=w.target;F.parentNode.parentNode.tagName=="g";)F=F.parentNode;if((Da!="path"||!drawn_path)&&F.parentNode.id!="selectorParentGroup"&&
|
|
F.id!="svgcanvas"&&F.id!="svgroot"){c.setMode("select");vb([F],true)}}else if(v!=null){c.addedNew=true;w=0.2;var H;if(false.beginElement&&v.getAttribute("opacity")!=O.opacity){H=$(false).clone().attr({to:O.opacity,dur:w}).appendTo(v);try{H[0].beginElement()}catch(J){}}else w=0;setTimeout(function(){H&&H.remove();v.setAttribute("opacity",O.opacity);v.setAttribute("style","pointer-events:inherit");ma(v);if(Da==="path")Ja.toEditMode(v);else n.selectNew&&vb([v],true);ya(new za(v));N("changed",[v])},w*
|
|
1E3)}Ra=null}}});$(a).bind("mousewheel DOMMouseScroll",function(w){if(w.shiftKey){w.preventDefault();pb=l.getScreenCTM().inverse();var E=M(w.pageX,w.pageY,pb);E={x:E.x,y:E.y,width:0,height:0};if(w.wheelDelta)if(w.wheelDelta>=120)E.factor=2;else{if(w.wheelDelta<=-120)E.factor=0.5}else if(w.detail)if(w.detail>0)E.factor=0.5;else if(w.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Gb=function(e){$(e).click(function(k){k.preventDefault()})},cb=c.textActions=function(){function e(S){var W=I.value===
|
|
"";$(I).focus();if(!arguments.length)if(W)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var Z;Z=v[S];W||I.setSelectionRange(S,S);F=pa("text_cursor");if(!F){F=document.createElementNS(b,"line");la(F,{id:"text_cursor",stroke:"#333","stroke-width":1});F=pa("selectorParentGroup").appendChild(F)}o||(o=setInterval(function(){var qa=F.getAttribute("display")==="none";F.setAttribute("display",qa?"inline":"none")},600));W=G(Z.x,D.y);Z=G(Z.x,D.y+D.height);la(F,{x1:W.x,y1:W.y,x2:Z.x,
|
|
y2:Z.y,visibility:"visible",display:"inline"});g&&g.setAttribute("d","")}function k(S,W,Z){if(S===W)e(W);else{Z||I.setSelectionRange(S,W);g=pa("text_selectblock");if(!g){g=document.createElementNS(b,"path");la(g,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(g)}S=v[S];var qa=v[W];F.setAttribute("visibility","hidden");W=G(S.x,D.y);Z=G(S.x+(qa.x-S.x),D.y);var ta=G(S.x,D.y+D.height);S=G(S.x+(qa.x-S.x),D.y+D.height);la(g,{d:"M"+W.x+
|
|
","+W.y+" L"+Z.x+","+Z.y+" "+S.x+","+S.y+" "+ta.x+","+ta.y+"z",display:"inline"})}}function m(S,W){var Z=d.createSVGPoint();Z.x=S;Z.y=W;if(v.length==1)return 0;Z=E.getCharNumAtPosition(Z);if(Z<0){Z=v.length-2;if(S<=v[0].x)Z=0}else if(Z>=v.length-2)Z=v.length-2;var qa=v[Z];S>qa.x+qa.width/2&&Z++;return Z}function A(S,W,Z){var qa=I.selectionStart;S=m(S,W);k(Math.min(qa,S),Math.max(qa,S),!Z)}function z(S,W){var Z={x:S,y:W};Z.x/=p;Z.y/=p;if(H){var qa=M(Z.x,Z.y,H.inverse());Z.x=qa.x;Z.y=qa.y}return Z}
|
|
function G(S,W){var Z={x:S,y:W};if(H){var qa=M(Z.x,Z.y,H);Z.x=qa.x;Z.y=qa.y}Z.x*=p;Z.y*=p;return Z}function B(S){k(0,E.textContent.length);$(this).unbind(S)}function w(S){if(ca&&E){var W=M(S.pageX,S.pageY,pb);W=z(W.x*p,W.y*p);W=m(W.x,W.y);var Z=E.textContent,qa=Z.substr(0,W).replace(/[a-z0-9]+$/i,"").length;Z=Z.substr(W).match(/^[a-z0-9]+/i);k(qa,(Z?Z[0].length:0)+W);$(S.target).click(B);setTimeout(function(){$(S.target).unbind("click",B)},300)}}var E,I,F,g,o,v=[],D,H,J,X,ca;return{select:function(S,
|
|
W,Z){E=S;cb.toEditMode(W,Z)},start:function(S){E=S;cb.toEditMode()},mouseDown:function(S,W,Z,qa){S=z(Z,qa);I.focus();e(m(S.x,S.y));J=Z;X=qa},mouseMove:function(S,W){var Z=z(S,W);A(Z.x,Z.y)},mouseUp:function(S,W,Z){var qa=z(W,Z);A(qa.x,qa.y,true);S.target!==E&&W<J+2&&W>J-2&&Z<X+2&&Z>X-2&&cb.toSelectMode(true)},setCursor:e,toEditMode:function(S,W){vb([E],false);ca=false;Da="textedit";Ga.requestSelector(E).showGrips(false);Ga.requestSelector(E);cb.init();$(E).css("cursor","text");if(arguments.length){var Z=
|
|
z(S,W);e(m(Z.x,Z.y))}else e();setTimeout(function(){ca=true},300)},toSelectMode:function(S){Da="select";clearInterval(o);o=null;g&&$(g).attr("display","none");F&&$(F).attr("visibility","hidden");$(E).css("cursor","move");if(S){Pa();$(E).css("cursor","move");N("selected",[E]);tb([E],true)}E&&!E.textContent.length&&c.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(S){I=S},clear:function(){Da=="textedit"&&cb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=K[0];Ga.requestSelector(E).showGrips(false)}var S=
|
|
E.textContent.length,W=E.getAttribute("transform");D=svgedit.utilities.getBBox(E);H=W?V(E):null;v=Array(S);I.focus();$(E).unbind("dblclick",w).dblclick(w);if(!S)var Z={x:D.x+D.width/2,width:0};for(W=0;W<S;W++){var qa=E.getStartPositionOfChar(W);Z=E.getEndPositionOfChar(W);if(!svgedit.browser.supportsGoodTextCharPos()){var ta=c.contentW*p;qa.x-=ta;Z.x-=ta;qa.x/=p;Z.x/=p}v[W]={x:qa.x,y:D.y,width:Z.x-qa.x,height:D.height}}v.push({x:Z.x,width:0});k(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=c.pathActions=
|
|
function(){var e=false,k,m,A;svgedit.path.Path.prototype.endChanges=function(B){if(svgedit.browser.isWebkit()){var w=this.elem;w.setAttribute("d",Ja.convertPath(w))}B=new Na(this.elem,{d:this.last_d},B);ya(B);N("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(B){$.isArray(B)||(B=[B]);for(var w=0;w<B.length;w++){var E=B[w],I=this.segs[E];I.ptgrip&&this.selected_pts.indexOf(E)==-1&&E>=0&&this.selected_pts.push(E)}this.selected_pts.sort();w=this.selected_pts.length;for(B=
|
|
Array(w);w--;){I=this.segs[this.selected_pts[w]];I.select(true);B[w]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",B)};var z=k=null,G=false;return{mouseDown:function(B,w,E,I){if(Da==="path"){mouse_x=E;mouse_y=I;I=mouse_x/p;w=mouse_y/p;E=pa("path_stretch_line");m=[I,w];if(n.gridSnapping){I=xa(I);w=xa(w);mouse_x=xa(mouse_x);mouse_y=xa(mouse_y)}if(!E){E=document.createElementNS(b,"path");la(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",
|
|
fill:"none"});E=pa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var F=null;if(z){F=z.pathSegList;for(var g=F.numberOfItems,o=6/p,v=false;g;){g--;var D=F.getItem(g),H=D.x;D=D.y;if(I>=H-o&&I<=H+o&&w>=D-o&&w<=D+o){v=true;break}}o=ba();svgedit.path.removePath_(o);o=pa(o);H=F.numberOfItems;if(v){if(g<=1&&H>=2){I=F.getItem(0).x;w=F.getItem(0).y;B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(I,w):z.createSVGPathSegCurvetoCubicAbs(I,w,B.x1/p,B.y1/p,
|
|
I,w);I=z.createSVGPathSegClosePath();F.appendItem(B);F.appendItem(I)}else if(H<3)return F=false;$(E).remove();element=o;z=null;La=false;if(e){svgedit.path.path.matrix&&$a(o,{},svgedit.path.path.matrix.inverse());E=o.getAttribute("d");B=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",B+E);$(o).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,
|
|
mb(B))){console.log("Clicked outside canvas");return false}F=z.pathSegList.numberOfItems;g=z.pathSegList.getItem(F-1);o=g.x;g=g.y;if(B.shiftKey){B=aa(o,g,I,w);I=B.x;w=B.y}B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(eb(I),eb(w)):z.createSVGPathSegCurvetoCubicAbs(eb(I),eb(w),B.x1/p,B.y1/p,B.x2/p,B.y2/p);z.pathSegList.appendItem(B);I*=p;w*=p;E.setAttribute("d",["M",I,w,I,w].join(" "));E=F;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,w)}}else{d_attr=
|
|
"M"+I+","+w+" ";z=P({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:O.opacity/2}});E.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));E=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(E,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();o=B.target.id;if(o.substr(0,14)=="pathpointgrip_"){w=svgedit.path.path.cur_pt=parseInt(o.substr(14));svgedit.path.path.dragging=[E,I];F=svgedit.path.path.segs[w];if(B.shiftKey)F.selected?svgedit.path.path.removePtFromSelection(w):
|
|
svgedit.path.path.addPtsToSelection(w);else{if(svgedit.path.path.selected_pts.length<=1||!F.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(w)}}else if(o.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,I];B=o.split("_")[1].split("c");w=B[0]-0;svgedit.path.path.selectPt(w,B[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:E*p,y:I*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(B,w,E){G=true;if(Da==="path"){if(z){var I=
|
|
z.pathSegList;B=I.numberOfItems-1;if(m){var F=svgedit.path.addCtrlGrip("1c1"),g=svgedit.path.addCtrlGrip("0c2");g.getAttribute("cx");g.getAttribute("cy");F.setAttribute("cx",w);F.setAttribute("cy",E);F.setAttribute("display","inline");F=m[0];var o=m[1];I.getItem(B);var v=F+(F-w/p),D=o+(o-E/p);g.setAttribute("cx",v*p);g.setAttribute("cy",D*p);g.setAttribute("display","inline");g=svgedit.path.getCtrlLine(1);var H=svgedit.path.getCtrlLine(2);la(g,{x1:w,y1:E,x2:F*p,y2:o*p,display:"inline"});la(H,{x1:v*
|
|
p,y1:D*p,x2:F*p,y2:o*p,display:"inline"});if(B===0)A=[w,E];else{I=I.getItem(B-1);w=I.x;E=I.y;if(I.pathSegType===6){w+=w-I.x2;E+=E-I.y2}else if(A){w=A[0]/p;E=A[1]/p}svgedit.path.replacePathSeg(6,B,[F,o,w,E,v,D],z)}}else if(F=pa("path_stretch_line")){B=I.getItem(B);if(B.pathSegType===6)svgedit.path.replacePathSeg(6,1,[w,E,(B.x+(B.x-B.x2))*p,(B.y+(B.y-B.y2))*p,w,E],F);else A?svgedit.path.replacePathSeg(6,1,[w,E,A[0],A[1],w,E],F):svgedit.path.replacePathSeg(4,1,[w,E],F)}}}else if(svgedit.path.path.dragging){F=
|
|
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);o=svgedit.path.getPointFromGrip({x:w,y:E},svgedit.path.path);B=o.x-F.x;F=o.y-F.y;svgedit.path.path.dragging=[w,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(B,F):svgedit.path.path.movePts(B,F)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var J=ua.getBBox(),X=svgedit.path.getGripPt(this);J=svgedit.math.rectsIntersect(J,
|
|
{x:X.x,y:X.y,width:0,height:0});this.select(J);J&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(B,w){if(Da==="path"){m=null;if(!z){w=pa(ba());La=false;A=null}return{keep:true,element:w}}if(svgedit.path.path.dragging){var E=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");!B.shiftKey&&!G&&svgedit.path.path.selectPt(E)}else if(ua&&ua.getAttribute("display")!=
|
|
"none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(B.target)}else Ja.toSelectMode(B.target);G=false},toEditMode:function(B){svgedit.path.path=svgedit.path.getPath_(B);Da="pathedit";Pa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(B){var w=B==svgedit.path.path.elem;Da="select";svgedit.path.path.show(false);k=false;Pa();svgedit.path.path.matrix&&
|
|
svgedit.path.recalcRotatedPath();if(w){N("selected",[B]);tb([B],true)}},addSubPath:function(B){if(B){Da="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(B){if(k===B){Ja.toEditMode(B);Da="pathedit"}else k=B},reorient:function(){var B=K[0];if(B)if(oa(B)!=0){var w=new Aa("Reorient path"),E={d:B.getAttribute("d"),transform:B.getAttribute("transform")};w.addSubCommand(new Na(B,E));Pa();this.resetOrientation(B);ya(w);svgedit.path.getPath_(B).show(false).matrix=null;
|
|
this.clear();tb([B],true);N("changed",K)}},clear:function(){k=null;if(z){var B=pa(ba());$(pa("path_stretch_line")).remove();$(B).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");z=A=null;La=false}else Da=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(B){if(B==null||B.nodeName!="path")return false;var w=T(B),E=fa(w).matrix;w.clear();B.removeAttribute("transform");w=B.pathSegList;for(var I=w.numberOfItems,
|
|
F=0;F<I;++F){var g=w.getItem(F),o=g.pathSegType;if(o!=1){var v=[];$.each(["",1,2],function(D,H){var J=g["x"+H],X=g["y"+H];if(J!==undefined&&X!==undefined){J=M(J,X,E);v.splice(v.length,0,J.x,J.y)}});svgedit.path.replacePathSeg(o,F,v,B)}}h(B,E)},zoomChange:function(){Da=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var B=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:B.item.x,y:B.item.y,type:B.type}},linkControlPoints:function(B){svgedit.path.setLinkControlPoints(B)},
|
|
clonePathNode:function(){svgedit.path.path.storeD();for(var B=svgedit.path.path.selected_pts,w=B.length,E=[];w--;){var I=B[w];svgedit.path.path.addSeg(I);E.push(I+w);E.push(I+w+1)}svgedit.path.path.init().addPtsToSelection(E);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var B=svgedit.path.path.selected_pts;if(B.length===1){var w=svgedit.path.path.elem,E=w.pathSegList,I=B[0],F=null,g=null;svgedit.path.path.eachSeg(function(H){if(this.type===2&&H<=I)g=this.item;if(H<=
|
|
I)return true;if(this.type===2){F=H;return false}else if(this.type===1)return F=false});if(F==null)F=svgedit.path.path.segs.length-1;if(F!==false){var o=w.createSVGPathSegLinetoAbs(g.x,g.y),v=w.createSVGPathSegClosePath();if(F==svgedit.path.path.segs.length-1){E.appendItem(o);E.appendItem(v)}else{svgedit.path.insertItemBefore(w,v,F);svgedit.path.insertItemBefore(w,o,F)}svgedit.path.path.init().selectPt(F+1)}else if(svgedit.path.path.segs[I].mate){E.removeItem(I);E.removeItem(I);svgedit.path.path.init().selectPt(I-
|
|
1)}else{for(B=0;B<E.numberOfItems;B++){var D=E.getItem(B);if(D.pathSegType===2)o=B;else if(B===I)E.removeItem(o);else if(D.pathSegType===1&&I<B){v=B-1;E.removeItem(B);break}}for(B=I-o-1;B--;)svgedit.path.insertItemBefore(w,E.getItem(o),v);w=E.getItem(o);svgedit.path.replacePathSeg(2,o,[w.x,w.y]);B=I;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ja.canDeleteNodes){svgedit.path.path.storeD();for(var B=svgedit.path.path.selected_pts,w=B.length;w--;)svgedit.path.path.deleteSeg(B[w]);
|
|
var E=function(){var I=svgedit.path.path.elem.pathSegList,F=I.numberOfItems,g=function(D,H){for(;H--;)I.removeItem(D)};if(F<=1)return true;for(;F--;){var o=I.getItem(F);if(o.pathSegType===1){o=I.getItem(F-1);var v=I.getItem(F-2);if(o.pathSegType===2){g(F-1,2);E();break}else if(v.pathSegType===2){g(F-2,3);E();break}}else if(o.pathSegType===2)if(F>0){o=I.getItem(F-1).pathSegType;if(o===2){g(F-1,1);E();break}else if(o===1&&I.numberOfItems-1===F){g(F,1);E();break}}}return false};E();if(svgedit.path.path.elem.pathSegList.numberOfItems<=
|
|
1){Ja.toSelectMode(svgedit.path.path.elem);c.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){B=$(svgedit.path.path.elem);B.attr("d",B.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(B){var w=B.points,E=w.numberOfItems;if(E>=4){var I=w.getItem(0),F=null;B=[];B.push(["M",I.x,",",I.y," C"].join(""));for(var g=1;g<=E-4;g+=3){var o=w.getItem(g),v=w.getItem(g+1),D=w.getItem(g+2);if(F)if((I=svgedit.path.smoothControlPoints(F,
|
|
o,I))&&I.length==2){o=B[B.length-1].split(",");o[2]=I[0].x;o[3]=I[0].y;B[B.length-1]=o.join(",");o=I[1]}B.push([o.x,o.y,v.x,v.y,D.x,D.y].join(","));I=D;F=v}for(B.push("L");g<E;++g){v=w.getItem(g);B.push([v.x,v.y].join(","))}B=B.join(" ");B=P({element:"path",curStyles:true,attr:{id:ba(),d:B,fill:"none"}})}return B},setSegType:function(B){svgedit.path.path.setSegType(B)},moveNode:function(B,w){var E=svgedit.path.path.selected_pts;if(E.length){svgedit.path.path.storeD();E=svgedit.path.path.segs[E[0]];
|
|
var I={x:0,y:0};I[B]=w-E.item[B];E.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(B){for(var w=B.pathSegList,E=w.numberOfItems,I,F=0;F<E;++F){var g=w.getItem(F);if(g.pathSegType===2)I=g;if(g.pathSegType===1){g=w.getItem(F-1);if(g.x!=I.x||g.y!=I.y){w=B.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(B,w,F);Ja.fixEnd(B);break}}}svgedit.browser.isWebkit()&&B.setAttribute("d",Ja.convertPath(B))},convertPath:function(B,w){for(var E=B.pathSegList,I=E.numberOfItems,
|
|
F=0,g=0,o="",v=null,D=0;D<I;++D){var H=E.getItem(D),J=H.x||0,X=H.y||0,ca=H.x1||0,S=H.y1||0,W=H.x2||0,Z=H.y2||0,qa=H.pathSegType,ta=Oa[qa]["to"+(w?"Lower":"Upper")+"Case"](),ga=function(Ta,Ha,sa){Ha=Ha?" "+Ha.join(" "):"";sa=sa?" "+svgedit.units.shortFloat(sa):"";$.each(Ta,function(Ma,va){Ta[Ma]=svgedit.units.shortFloat(va)});o+=ta+Ta.join(" ")+Ha+sa};switch(qa){case 1:o+="z";break;case 12:J-=F;case 13:if(w){F+=J;ta="l"}else{J+=F;F=J;ta="L"}ga([[J,g]]);break;case 14:X-=g;case 15:if(w){g+=X;ta="l"}else{X+=
|
|
g;g=X;ta="L"}ga([[F,X]]);break;case 2:case 4:case 18:J-=F;X-=g;case 5:case 3:if(v&&E.getItem(D-1).pathSegType===1&&!w){F=v[0];g=v[1]}case 19:if(w){F+=J;g+=X}else{J+=F;X+=g;F=J;g=X}if(qa===3)v=[F,g];ga([[J,X]]);break;case 6:J-=F;ca-=F;W-=F;X-=g;S-=g;Z-=g;case 7:if(w){F+=J;g+=X}else{J+=F;ca+=F;W+=F;X+=g;S+=g;Z+=g;F=J;g=X}ga([[ca,S],[W,Z],[J,X]]);break;case 8:J-=F;ca-=F;X-=g;S-=g;case 9:if(w){F+=J;g+=X}else{J+=F;ca+=F;X+=g;S+=g;F=J;g=X}ga([[ca,S],[J,X]]);break;case 10:J-=F;X-=g;case 11:if(w){F+=J;g+=
|
|
X}else{J+=F;X+=g;F=J;g=X}ga([[H.r1,H.r2]],[H.angle,H.largeArcFlag?1:0,H.sweepFlag?1:0],[J,X]);break;case 16:J-=F;W-=F;X-=g;Z-=g;case 17:if(w){F+=J;g+=X}else{J+=F;W+=F;X+=g;Z+=g;F=J;g=X}ga([[W,Z],[J,X]])}}return o}}}(),Nb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(b,"defs");if(!e||!e.length)return 0;for(var k=[],m=0,A=["fill","stroke","filter","marker-start","marker-mid","marker-end"],z=A.length,G=l.getElementsByTagNameNS(b,"*"),B=G.length,w=0;w<B;w++){for(var E=G[w],I=0;I<
|
|
z;I++){var F=ia(E.getAttribute(A[I]));F&&k.push(F.substr(1))}(E=da(E))&&E.indexOf("#")===0&&k.push(E.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(w=e.length;w--;){A=e[w];z=A.id;if(k.indexOf(z)<0){ub[z]=A;A.parentNode.removeChild(A);m++}}return m};this.svgCanvasToString=function(){for(;Nb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,A){m&&A.nodeType===8&&A.data.indexOf("Created with")>=0&&l.insertBefore(A,l.firstChild)});if(L){Hb();
|
|
vb([L])}var e=[];$(l).find("g:data(gsvg)").each(function(){for(var m=this.attributes,A=m.length,z=0;z<A;z++)if(m[z].nodeName=="id"||m[z].nodeName=="style")A--;if(A<=0){m=this.firstChild;e.push(m);$(this).replaceWith(m)}});var k=this.svgToString(l,0);e.length&&$(e).each(function(){zb(this)});return k};this.svgToString=function(e,k){var m=[],A=svgedit.utilities.toXml,z=n.baseUnit,G=RegExp("^-?[\\d\\.]+"+z+"$");if(e){ma(e);var B=e.attributes,w,E,I=e.childNodes;for(E=0;E<k;E++)m.push(" ");m.push("<");
|
|
m.push(e.nodeName);if(e.id==="svgcontent"){E=Ab();if(z!=="px"){E.w=svgedit.units.convertUnit(E.w,z)+z;E.h=svgedit.units.convertUnit(E.h,z)+z}m.push(' width="'+E.w+'" height="'+E.h+'" xmlns="'+b+'"');var F={};$(e).find("*").andSelf().each(function(){$.each(this.attributes,function(D,H){var J=H.namespaceURI;if(J&&!F[J]&&Ba[J]!=="xmlns"&&Ba[J]!=="xml"){F[J]=true;m.push(" xmlns:"+Ba[J]+'="'+J+'"')}})});E=B.length;for(z=["width","height","xmlns","x","y","viewBox","id","overflow"];E--;){w=B.item(E);var g=
|
|
A(w.nodeValue);if(w.nodeName.indexOf("xmlns:")!==0)if(g!=""&&z.indexOf(w.localName)==-1)if(!w.namespaceURI||Ba[w.namespaceURI]){m.push(" ");m.push(w.nodeName);m.push('="');m.push(g);m.push('"')}}}else{if(e.nodeName==="defs"&&!e.firstChild)return;var o=["-moz-math-font-style","_moz-math-font-style"];for(E=B.length-1;E>=0;E--){w=B.item(E);g=A(w.nodeValue);if(!(o.indexOf(w.localName)>=0))if(g!="")if(g.indexOf("pointer-events")!==0)if(!(w.localName==="class"&&g.indexOf("se_")===0)){m.push(" ");if(w.localName===
|
|
"d")g=Ja.convertPath(e,true);if(isNaN(g)){if(G.test(g))g=svgedit.units.shortFloat(g)+z}else g=svgedit.units.shortFloat(g);if(db.apply&&e.nodeName==="image"&&w.localName==="href"&&db.images&&db.images==="embed"){var v=Wa[g];if(v)g=v}if(!w.namespaceURI||w.namespaceURI==b||Ba[w.namespaceURI]){m.push(w.nodeName);m.push('="');m.push(g);m.push('"')}}}}if(e.hasChildNodes()){m.push(">");k++;B=false;for(E=0;E<I.length;E++){z=I.item(E);switch(z.nodeType){case 1:m.push("\n");m.push(this.svgToString(I.item(E),
|
|
k));break;case 3:z=z.nodeValue.replace(/^\s+|\s+$/g,"");if(z!=""){B=true;m.push(A(z)+"")}break;case 4:m.push("\n");m.push(Array(k+1).join(" "));m.push("<![CDATA[");m.push(z.nodeValue);m.push("]]\>");break;case 8:m.push("\n");m.push(Array(k+1).join(" "));m.push("<!--");m.push(z.data);m.push("--\>")}}k--;if(!B){m.push("\n");for(E=0;E<k;E++)m.push(" ")}m.push("</");m.push(e.nodeName);m.push(">")}else m.push("/>")}return m.join("")};this.embedImage=function(e,k){$(new Image).load(function(){var m=document.createElement("canvas");
|
|
m.width=this.width;m.height=this.height;m.getContext("2d").drawImage(this,0,0);try{var A=";svgedit_url="+encodeURIComponent(e);A=m.toDataURL().replace(";base64",A+";base64");Wa[e]=A}catch(z){Wa[e]=false}Ca=e;k&&k(Wa[e])}).attr("src",e)};this.setGoodImage=function(e){Ca=e};this.open=function(){};this.save=function(e){Pa();e&&$.extend(db,e);db.apply=true;e=this.svgCanvasToString();N("saved",e)};this.rasterExport=function(){Pa();var e=[],k={feGaussianBlur:nb.exportNoBlur,foreignObject:nb.exportNoforeignObject,
|
|
"[stroke-dasharray]":nb.exportNoDashArray},m=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))k.text=nb.exportNoText;$.each(k,function(A,z){m.find(A).length&&e.push(z)});k=this.svgCanvasToString();N("exported",{svg:k,issues:e})};this.getSvgString=function(){db.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,C()):svgedit.draw.randomizeIds(true,C())};var Lb=this.uniquifyElems=function(e){var k={},
|
|
m=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(e,function(w){if(w.nodeType==1){if(w.id){w.id in k||(k[w.id]={elem:null,attrs:[],hrefs:[]});k[w.id].elem=w}$.each(Ya,function(I,F){var g=w.getAttributeNode(F);if(g){var o=svgedit.utilities.getUrlFromAttr(g.value);if(o=o?o.substr(1):null){o in k||(k[o]={elem:null,attrs:[],hrefs:[]});k[o].attrs.push(g)}}});var E=svgedit.utilities.getHref(w);if(E&&m.indexOf(w.nodeName)>=0)if(E=E.substr(1)){E in
|
|
k||(k[E]={elem:null,attrs:[],hrefs:[]});k[E].hrefs.push(w)}}});for(var A in k)if(A){var z=k[A].elem;if(z){e=ka();z.id=e;z=k[A].attrs;for(var G=z.length;G--;){var B=z[G];B.ownerElement.setAttribute(B.name,"url(#"+e+")")}z=k[A].hrefs;for(G=z.length;G--;)svgedit.utilities.setHref(z[G],"#"+e)}}},Jb=this.setUseData=function(e){var k=$(e);if(e.tagName!=="use")k=k.find("use");k.each(function(){var m=da(this).substr(1);if(m=pa(m)){$(this).data("ref",m);if(m.tagName=="symbol"||m.tagName=="svg")$(this).data("symbol",
|
|
m).data("ref",m)}})},Bb=this.convertGradients=function(e){var k=$(e).find("linearGradient, radialGradient");if(!k.length&&svgedit.browser.isWebkit())k=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});k.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var m=$(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(m.length)if(m=svgedit.utilities.getBBox(m[0]))if(this.tagName==="linearGradient"){var A=$(this).attr(["x1","y1","x2","y2"]),
|
|
z=this.gradientTransform.baseVal;if(z&&z.numberOfItems>0){var G=fa(z).matrix;z=M(A.x1,A.y1,G);G=M(A.x2,A.y2,G);A.x1=z.x;A.y1=z.y;A.x2=G.x;A.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(A.x1-m.x)/m.width,y1:(A.y1-m.y)/m.height,x2:(A.x2-m.x)/m.width,y2:(A.y2-m.y)/m.height});this.removeAttribute("gradientUnits")}}})},Ob=this.convertToGroup=function(e){e||(e=K[0]);var k=$(e),m=new Aa,A;if(k.data("gsvg")){m=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg");
|
|
A=T(e);var z=d.createSVGTransform();z.setTranslate(m.x,m.y);A.appendItem(z);Qa(e);N("selected",[e])}else if(k.data("symbol")){e=k.data("symbol");A=k.attr("transform");z=k.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");z.x-=+G[0];z.y-=+G[1]}A+=" translate("+(z.x||0)+","+(z.y||0)+")";z=k.prev();m.addSubCommand(new Ka(k[0],k[0].nextSibling,k[0].parentNode));k.remove();G=$(l).find("use:data(symbol)").length;k=f.createElementNS(b,"g");for(var B=e.childNodes,w=0;w<B.length;w++)k.appendChild(B[w].cloneNode(true));
|
|
if(svgedit.browser.isGecko()){B=$(kb()).children("linearGradient,radialGradient,pattern").clone();$(k).append(B)}A&&k.setAttribute("transform",A);A=e.parentNode;Lb(k);svgedit.browser.isGecko()&&$(kb()).append($(k).find("linearGradient,radialGradient,pattern"));k.id=ka();z.after(k);if(A){if(!G){z=e.nextSibling;A.removeChild(e);m.addSubCommand(new Ka(e,z,A))}m.addSubCommand(new za(k))}Jb(k);svgedit.browser.isGecko()?Bb(kb()):Bb(k);svgedit.utilities.walkTreePost(k,function(E){try{Qa(E)}catch(I){console.log(I)}});
|
|
$(k).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});vb([k]);(e=Kb(k,true))&&m.addSubCommand(e);ya(m)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e){try{var k=svgedit.utilities.text2xml(e);this.prepareSvg(k);var m=new Aa("Change Source"),A=l.nextSibling,z=d.removeChild(l);m.addSubCommand(new Ka(z,A,d));l=f.adoptNode?f.adoptNode(k.documentElement):f.importNode(k.documentElement,
|
|
true);d.appendChild(l);var G=$(l);c.current_drawing_=new svgedit.draw.Drawing(l,s);var B=C().getNonce();B?N("setnonce",B):N("unsetnonce");G.find("image").each(function(){var v=this;Gb(v);var D=da(this);if(D.indexOf("data:")===0){var H=D.match(/svgedit_url=(.*?);/);if(H){var J=decodeURIComponent(H[1]);$(new Image).load(function(){v.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",J)}).attr("src",J)}}c.embedImage(D)});G.find("svg").each(function(){if(!$(this).closest("defs").length){Lb(this);
|
|
var v=this.parentNode;if(v.childNodes.length===1&&v.nodeName==="g"){$(v).data("gsvg",this);v.id=v.id||ka()}else zb(this)}});svgedit.browser.isGecko()&&G.find("linearGradient, radialGradient, pattern").appendTo(kb());Jb(G);Bb(G[0]);svgedit.utilities.walkTreePost(l,function(v){try{Qa(v)}catch(D){console.log(D)}});var w={id:"svgcontent",overflow:n.show_outside_canvas?"visible":"hidden"},E=false;if(G.attr("viewBox")){var I=G.attr("viewBox").split(" ");w.width=I[2];w.height=I[3]}else $.each(["width","height"],
|
|
function(v,D){var H=G.attr(D);H||(H="100%");if((H+"").substr(-1)==="%")E=true;else w[D]=ra(D,H)});Db();G.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=ka()});if(E){var F=getStrokedBBox();w.width=F.width+F.x;w.height=F.height+F.y}if(w.width<=0)w.width=100;if(w.height<=0)w.height=100;G.attr(w);this.contentW=w.width;this.contentH=w.height;m.addSubCommand(new za(l));var g=G.attr(["width","height"]);m.addSubCommand(new Na(d,
|
|
g));p=1;svgedit.transformlist.resetListMap();Pa();svgedit.path.clearData();d.appendChild(Ga.selectorParentGroup);ya(m);N("changed",[l])}catch(o){console.log(o);return false}return true};this.importSvgString=function(e){try{var k=svgedit.utilities.encode64(e.length+e).substr(0,32),m=false;if(rb[k])if($(rb[k].symbol).parents("#svgroot").length)m=true;var A=new Aa("Import SVG");if(m)var z=rb[k].symbol,G=rb[k].xform;else{var B=svgedit.utilities.text2xml(e);this.prepareSvg(B);var w;w=f.adoptNode?f.adoptNode(B.documentElement):
|
|
f.importNode(B.documentElement,true);Lb(w);var E=ra("width",w.getAttribute("width")),I=ra("height",w.getAttribute("height")),F=w.getAttribute("viewBox"),g=F?F.split(" "):[0,0,E,I];for(e=0;e<4;++e)g[e]=+g[e];l.getAttribute("width");var o=+l.getAttribute("height");G=I>E?"scale("+o/3/g[3]+")":"scale("+o/3/g[2]+")";G="translate(0) "+G+" translate(0)";z=f.createElementNS(b,"symbol");var v=kb();for(svgedit.browser.isGecko()&&$(w).find("linearGradient, radialGradient, pattern").appendTo(v);w.firstChild;)z.appendChild(w.firstChild);
|
|
var D=w.attributes;for(w=0;w<D.length;w++){var H=D[w];z.setAttribute(H.nodeName,H.nodeValue)}z.id=ka();rb[k]={symbol:z,xform:G};kb().appendChild(z);A.addSubCommand(new za(z))}var J=f.createElementNS(b,"use");J.id=ka();U(J,"#"+z.id);(L||C().getCurrentLayer()).appendChild(J);A.addSubCommand(new za(J));Pa();J.setAttribute("transform",G);Qa(J);$(J).data("symbol",z).data("ref",z);tb([J]);ya(A);N("changed",[l])}catch(X){console.log(X);return false}return true};var Db=c.identifyLayers=function(){Hb();C().identifyLayers()};
|
|
this.createLayer=function(e){var k=new Aa("Create Layer");e=C().createLayer(e);k.addSubCommand(new za(e));ya(k);Pa();N("changed",[e])};this.cloneLayer=function(e){var k=new Aa("Duplicate Layer"),m=f.createElementNS(b,"g"),A=f.createElementNS(b,"title");A.textContent=e;m.appendChild(A);A=C().getCurrentLayer();$(A).after(m);A=A.childNodes;for(var z=0;z<A.length;z++){var G=A[z];G.localName!="title"&&m.appendChild(ja(G))}Pa();Db();k.addSubCommand(new za(m));ya(k);c.setCurrentLayer(e);N("changed",[m])};
|
|
this.deleteCurrentLayer=function(){var e=C().getCurrentLayer(),k=e.nextSibling,m=e.parentNode;if(e=C().deleteCurrentLayer()){var A=new Aa("Delete Layer");A.addSubCommand(new Ka(e,k,m));ya(A);Pa();N("changed",[m]);return true}return false};this.setCurrentLayer=function(e){(e=C().setCurrentLayer(svgedit.utilities.toXml(e)))&&Pa();return e};this.renameCurrentLayer=function(e){var k=C();if(k.current_layer){var m=k.current_layer;if(!c.setCurrentLayer(e)){for(var A=new Aa("Rename Layer"),z=0;z<k.getNumLayers();++z)if(k.all_layers[z][1]==
|
|
m)break;var G=k.getLayerName(z);k.all_layers[z][0]=svgedit.utilities.toXml(e);var B=m.childNodes.length;for(z=0;z<B;++z){var w=m.childNodes.item(z);if(w&&w.tagName=="title"){for(;w.firstChild;)w.removeChild(w.firstChild);w.textContent=e;A.addSubCommand(new Na(w,{"#text":G}));ya(A);N("changed",[m]);return true}}}k.current_layer=m}return false};this.setCurrentLayerPosition=function(e){var k=C();if(k.current_layer&&e>=0&&e<k.getNumLayers()){for(var m=0;m<k.getNumLayers();++m)if(k.all_layers[m][1]==k.current_layer)break;
|
|
if(m==k.getNumLayers())return false;if(m!=e){var A=null,z=k.current_layer.nextSibling;if(e>m){if(e<k.getNumLayers()-1)A=k.all_layers[e+1][1]}else A=k.all_layers[e][1];l.insertBefore(k.current_layer,A);ya(new Ia(k.current_layer,z,l));Db();c.setCurrentLayer(k.getLayerName(e));return true}}return false};this.setLayerVisibility=function(e,k){var m=C(),A=m.getLayerVisibility(e),z=m.setLayerVisibility(e,k);if(z)ya(new Na(z,{display:A?"inline":"none"},"Layer Visibility"));else return false;if(z==m.getCurrentLayer()){Pa();
|
|
Ja.clear()}return true};this.moveSelectedToLayer=function(e){for(var k=null,m=C(),A=0;A<m.getNumLayers();++A)if(m.getLayerName(A)==e){k=m.all_layers[A][1];break}if(!k)return false;e=new Aa("Move Elements to Layer");m=K;for(A=m.length;A--;){var z=m[A];if(z){var G=z.nextSibling,B=z.parentNode;k.appendChild(z);e.addSubCommand(new Ia(z,G,B))}}ya(e);return true};this.mergeLayer=function(e){var k=new Aa("Merge Layer"),m=C(),A=$(m.current_layer).prev()[0];if(A){for(k.addSubCommand(new Ka(m.current_layer,
|
|
m.current_layer.nextSibling,l));m.current_layer.firstChild;){var z=m.current_layer.firstChild;if(z.localName=="title"){k.addSubCommand(new Ka(z,z.nextSibling,m.current_layer));m.current_layer.removeChild(z)}else{var G=z.nextSibling;A.appendChild(z);k.addSubCommand(new Ia(z,G,m.current_layer))}}l.removeChild(m.current_layer);if(!e){Pa();Db();N("changed",[l]);ya(k)}m.current_layer=A;return k}};this.mergeAllLayers=function(){var e=new Aa("Merge all Layers"),k=C();for(k.current_layer=k.all_layers[k.getNumLayers()-
|
|
1][1];$(l).children("g").length>1;)e.addSubCommand(c.mergeLayer(true));Pa();Db();N("changed",[l]);ya(e)};var Hb=this.leaveContext=function(){var e=wa.length;if(e){for(var k=0;k<e;k++){var m=wa[k],A=fb(m,"orig_opac");A!==1?m.setAttribute("opacity",A):m.removeAttribute("opacity");m.setAttribute("style","pointer-events: inherit")}wa=[];Pa(true);N("contextset",null)}L=null},Pb=this.setContext=function(e){Hb();if(typeof e==="string")e=pa(e);L=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var k=
|
|
this.getAttribute("opacity")||1;fb(this,"orig_opac",k);this.setAttribute("opacity",k*0.33);this.setAttribute("style","pointer-events: none");wa.push(this)});Pa();N("contextset",L)};this.clear=function(){Ja.clear();Pa();c.clearSvgContentElement();c.current_drawing_=new svgedit.draw.Drawing(l);c.createLayer("Layer 1");c.undoMgr.resetUndoStack();Ga.initGroup();ua=Ga.getRubberBandBox();N("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=
|
|
function(){return d};this.getSelectedElems=function(){return K};var Ab=this.getResolution=function(){var e=l.getAttribute("width")/p,k=l.getAttribute("height")/p;return{w:e,h:k,zoom:p}};this.getZoom=function(){return p};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(e){$.extend(nb,e.notification)};this.setConfig=function(e){$.extend(n,e)};this.getTitle=function(e){if(e=e||K[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var k=0;k<e.length;k++)if(e[k].nodeName==
|
|
"title")return e[k].textContent;return""}};this.setGroupTitle=function(e){var k=K[0];k=$(k).data("gsvg")||k;var m=$(k).children("title"),A=new Aa("Set Label");if(e.length)if(m.length){m=m[0];A.addSubCommand(new Na(m,{"#text":m.textContent}));m.textContent=e}else{m=f.createElementNS(b,"title");m.textContent=e;$(k).prepend(m);A.addSubCommand(new za(m))}else{A.addSubCommand(new Ka(m[0],m.nextSibling,k));m.remove()}ya(A)};this.getDocumentTitle=function(){return c.getTitle(l)};this.setDocumentTitle=function(e){for(var k=
|
|
l.childNodes,m=false,A="",z=new Aa("Change Image Title"),G=0;G<k.length;G++)if(k[G].nodeName=="title"){m=k[G];A=m.textContent;break}if(!m){m=f.createElementNS(b,"title");l.insertBefore(m,l.firstChild)}if(e.length)m.textContent=e;else m.parentNode.removeChild(m);z.addSubCommand(new Na(m,{"#text":A}));ya(z)};this.getEditorNS=function(e){e&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,k){var m=Ab(),A=m.w;m=m.h;var z;
|
|
if(e=="fit"){var G=getStrokedBBox();if(G){z=new Aa("Fit Canvas to Content");var B=ob();tb(B);var w=[],E=[];$.each(B,function(){w.push(G.x*-1);E.push(G.y*-1)});B=c.moveSelectedElements(w,E,true);z.addSubCommand(B);Pa();e=Math.round(G.width);k=Math.round(G.height)}else return false}if(e!=A||k!=m){B=d.suspendRedraw(1E3);z||(z=new Aa("Change Image Dimensions"));e=ra("width",e);k=ra("height",k);l.setAttribute("width",e);l.setAttribute("height",k);this.contentW=e;this.contentH=k;z.addSubCommand(new Na(l,
|
|
{width:A,height:m}));l.setAttribute("viewBox",[0,0,e/p,k/p].join(" "));z.addSubCommand(new Na(l,{viewBox:["0 0",A,m].join(" ")}));ya(z);d.unsuspendRedraw(B);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width",e+2);background.setAttribute("height",k+2)}N("changed",[l])}return[e,k]};this.getOffset=function(){return $(l).attr(["x","y"])};this.setBBoxZoom=function(e,k,m){var A=0.85,z=function(G){if(!G)return false;
|
|
var B=Math.min(Math.round(k/G.width*100*A)/100,Math.round(m/G.height*100*A)/100);c.setZoom(B);return{zoom:B,bbox:G}};if(typeof e=="object"){e=e;if(e.width==0||e.height==0){c.setZoom(e.zoom?e.zoom:p*e.factor);return{zoom:p,bbox:e}}return z(e)}switch(e){case "selection":if(!K[0])return;e=$.map(K,function(G){if(G)return G});e=getStrokedBBox(e);break;case "canvas":e=Ab();A=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(ob(C().getCurrentLayer()));
|
|
break;default:return}return z(e)};this.setZoom=function(e){var k=Ab();l.setAttribute("viewBox","0 0 "+k.w/e+" "+k.h/e);p=e;$.each(K,function(m,A){A&&Ga.requestSelector(A).resize()});Ja.zoomChange();lb("zoomChanged",e)};this.getMode=function(){return Da};this.setMode=function(e){Ja.clear(true);cb.clear();$("#workarea").attr("class",e);ab=K[0]&&K[0].nodeName=="text"?Xa:O;Da=e};this.getColor=function(e){return ab[e]};this.setColor=function(e,k,m){O[e]=k;ab[e+"_paint"]={type:"solidColor"};for(var A=[],
|
|
z=K.length;z--;){var G=K[z];if(G)if(G.tagName=="g")svgedit.utilities.walkTree(G,function(B){B.nodeName!="g"&&A.push(B)});else if(e=="fill")G.tagName!="polyline"&&G.tagName!="line"&&A.push(G);else A.push(G)}if(A.length>0)if(m)Cb(e,k,A);else{ib(e,k,A);N("changed",A)}};var kb=function(){var e=l.getElementsByTagNameNS(b,"defs");if(e.length>0)e=e[0];else{e=f.createElementNS(b,"defs");l.firstChild?l.insertBefore(e,l.firstChild.nextSibling):l.appendChild(e)}return e},Mb=this.setGradient=function(e){if(!(!ab[e+
|
|
"_paint"]||ab[e+"_paint"].type=="solidColor")){var k=c[e+"Grad"],m=Ib(k),A=kb();if(m)k=m;else{k=A.appendChild(f.importNode(k,true));k.id=ka()}c.setColor(e,"url(#"+k.id+")");if(e=="canvas")(e=document.getElementById("canvas_background"))&&e.setAttribute("fill","url(#"+k.id+")")}},Ib=function(e){var k=kb();k=$(k).find("linearGradient, radialGradient");for(var m=k.length,A=["r","cx","cy","fx","fy"];m--;){var z=k[m];if(e.tagName=="linearGradient"){if(e.getAttribute("x1")!=z.getAttribute("x1")||e.getAttribute("y1")!=
|
|
z.getAttribute("y1")||e.getAttribute("x2")!=z.getAttribute("x2")||e.getAttribute("y2")!=z.getAttribute("y2"))continue}else{var G=$(e).attr(A),B=$(z).attr(A),w=false;$.each(A,function(v,D){if(G[D]!=B[D])w=true});if(w)continue}var E=e.getElementsByTagNameNS(b,"stop"),I=z.getElementsByTagNameNS(b,"stop");if(E.length==I.length){for(var F=E.length;F--;){var g=E[F],o=I[F];if(g.getAttribute("offset")!=o.getAttribute("offset")||g.getAttribute("stop-opacity")!=o.getAttribute("stop-opacity")||g.getAttribute("stop-color")!=
|
|
o.getAttribute("stop-color"))break}if(F==-1)return z}}return null};this.setPaint=function(e,k){var m=new $.jGraduate.Paint(k);this.setPaintOpacity(e,m.alpha/100,true);ab[e+"_paint"]=m;switch(m.type){case "solidColor":if(m.solidColor!="none"&&m.solidColor!="#none")this.setColor(e,"#"+m.solidColor);else{this.setColor(e,"none");document.querySelector(e=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","none")}break;case "linearGradient":case "radialGradient":c[e+"Grad"]=m[m.type];
|
|
Mb(e)}};this.getStrokeWidth=function(){return ab.stroke_width};this.setStrokeWidth=function(e){if(e==0&&["line","path"].indexOf(Da)>=0)c.setStrokeWidth(1);else{ab.stroke_width=e;for(var k=[],m=K.length;m--;){var A=K[m];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(z){z.nodeName!="g"&&k.push(z)}):k.push(A)}if(k.length>0){ib("stroke-width",e,k);N("changed",K)}}};this.setStrokeAttr=function(e,k){O[e.replace("-","_")]=k;for(var m=[],A=K.length;A--;){var z=K[A];if(z)z.tagName=="g"?svgedit.utilities.walkTree(z,
|
|
function(G){G.nodeName!="g"&&m.push(G)}):m.push(z)}if(m.length>0){ib(e,k,m);N("changed",K)}};this.getStyle=function(){return O};this.getOpacity=function(){return O.opacity};this.setOpacity=function(e){O.opacity=e;ib("opacity",e)};this.getFillOpacity=function(){return O.fill_opacity};this.getStrokeOpacity=function(){return O.stroke_opacity};this.setPaintOpacity=function(e,k,m){O[e+"_opacity"]=k;m?Cb(e+"-opacity",k):ib(e+"-opacity",k)};this.getBlur=function(e){var k=0;if(e)if(e.getAttribute("filter"))if(e=
|
|
pa(e.id+"_blur"))k=e.firstChild.getAttribute("stdDeviation");return k};(function(){function e(){var z=c.undoMgr.finishUndoableChange();k.addSubCommand(z);ya(k);m=k=null}var k=null,m=null,A=false;c.setBlurNoUndo=function(z){if(m)if(z===0){Cb("filter","");A=true}else{var G=K[0];A&&Cb("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");G.setAttribute("filter","url(#"+G.id+"_blur)")}Cb("stdDeviation",z,[m.firstChild]);c.setBlurOffsets(m,z)}else c.setBlur(z)};c.setBlurOffsets=
|
|
function(z,G){if(G>3)la(z,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){z.removeAttribute("x");z.removeAttribute("y");z.removeAttribute("width");z.removeAttribute("height")}};c.setBlur=function(z,G){if(k)e();else{var B=K[0],w=B.id;m=pa(w+"_blur");z-=0;var E=new Aa;if(m){if(z===0)m=null}else{var I=P({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:z}});m=P({element:"filter",attr:{id:w+"_blur"}});m.appendChild(I);kb().appendChild(m);E.addSubCommand(new za(m))}I=
|
|
{filter:B.getAttribute("filter")};if(z===0){B.removeAttribute("filter");E.addSubCommand(new Na(B,I))}else{ib("filter","url(#"+w+"_blur)");E.addSubCommand(new Na(B,I));c.setBlurOffsets(m,z);k=E;c.undoMgr.beginUndoableChange("stdDeviation",[m?m.firstChild:null]);if(G){c.setBlurNoUndo(z);e()}}}}})();this.getBold=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&
|
|
K[1]==null)ib("font-weight",e?"bold":"normal");K[0].textContent||cb.setCursor()};this.getItalic=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&K[1]==null)ib("font-style",e?"italic":"normal");K[0].textContent||cb.setCursor()};this.getFontFamily=function(){return Xa.font_family};this.setFontFamily=function(e){Xa.font_family=e;ib("font-family",e);K[0]&&!K[0].textContent&&
|
|
cb.setCursor()};this.setFontColor=function(e){Xa.fill=e;ib("fill",e)};this.getFontSize=function(){return Xa.fill};this.getFontSize=function(){return Xa.font_size};this.setFontSize=function(e){Xa.font_size=e;ib("font-size",e);K[0].textContent||cb.setCursor()};this.getText=function(){var e=K[0];if(e==null)return"";return e.textContent};this.setTextContent=function(e){ib("#text",e);cb.init(e);cb.setCursor()};this.setImageURL=function(e){var k=K[0];if(k){var m=$(k).attr(["width","height"]);m=!m.width||
|
|
!m.height;var A=da(k);if(A!==e)m=true;else if(!m)return;var z=new Aa("Change Image URL");U(k,e);z.addSubCommand(new Na(k,{"#href":A}));m?$(new Image).load(function(){var G=$(k).attr(["width","height"]);$(k).attr({width:this.width,height:this.height});Ga.requestSelector(k).resize();z.addSubCommand(new Na(k,G));ya(z);N("changed",[k])}).attr("src",e):ya(z)}};this.setLinkURL=function(e){var k=K[0];if(k){if(k.tagName!=="a"){k=$(k).parents("a");if(k.length)k=k[0];else return}var m=da(k);if(m!==e){var A=
|
|
new Aa("Change Link URL");U(k,e);A.addSubCommand(new Na(k,{"#href":m}));ya(A)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:K.every(function(k){return k&&K[0]?k.nodeName==K[0].nodeName:null})};this.setRectRadius=function(e){c.elementsAreSame(K)&&K[0].tagName=="rect"&&K.forEach(function(k){var m=k.getAttribute("rx");if(m!=e){k.setAttribute("rx",e);k.setAttribute("ry",e);ya(new Na(k,{rx:m,ry:m},"Radius"));N("changed",[k])}})};this.makeHyperlink=function(e){c.groupSelectedElements("a",
|
|
e)};this.removeHyperlink=function(){c.ungroupSelectedElement()};this.setSegType=function(e){Ja.setSegType(e)};this.convertToPath=function(e,k){if(e==null)$.each(K,function(ca,S){S&&c.convertToPath(S)});else{if(!k)var m=new Aa("Convert element to Path");var A=k?{}:{fill:O.fill,"fill-opacity":O.fill_opacity,stroke:O.stroke,"stroke-width":O.stroke_width,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin,"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,opacity:O.opacity,
|
|
visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))A[this]=e.getAttribute(this)});var z=P({element:"path",attr:A}),G=e.getAttribute("transform");G&&z.setAttribute("transform",G);var B=e.id,w=e.parentNode;e.nextSibling?w.insertBefore(z,e):w.appendChild(z);var E="",I=function(ca){$.each(ca,function(S,W){var Z=W[1];E+=W[0];for(var qa=0;qa<Z.length;qa+=2)E+=Z[qa]+","+Z[qa+1]+" "})},F=1.81;switch(e.tagName){case "ellipse":case "circle":var g=
|
|
$(e).attr(["rx","ry","cx","cy"]),o=g.cx,v=g.cy,D=g.rx;g=g.ry;if(e.tagName=="circle")D=g=$(e).attr("r");I([["M",[o-D,v]],["C",[o-D,v-g/F,o-D/F,v-g,o,v-g]],["C",[o+D/F,v-g,o+D,v-g/F,o+D,v]],["C",[o+D,v+g/F,o+D/F,v+g,o,v+g]],["C",[o-D/F,v+g,o-D,v+g/F,o-D,v]],["Z",[]]]);break;case "path":E=e.getAttribute("d");break;case "line":g=$(e).attr(["x1","y1","x2","y2"]);E="M"+g.x1+","+g.y1+"L"+g.x2+","+g.y2;break;case "polyline":case "polygon":E="M"+e.getAttribute("points");break;case "rect":g=$(e).attr(["rx",
|
|
"ry"]);D=g.rx;g=g.ry;var H=e.getBBox();o=H.x;v=H.y;var J=H.width;H=H.height;F=4-F;!D&&!g?I([["M",[o,v]],["L",[o+J,v]],["L",[o+J,v+H]],["L",[o,v+H]],["L",[o,v]],["Z",[]]]):I([["M",[o,v+g]],["C",[o,v+g/F,o+D/F,v,o+D,v]],["L",[o+J-D,v]],["C",[o+J-D/F,v,o+J,v+g/F,o+J,v+g]],["L",[o+J,v+H-g]],["C",[o+J,v+H-g/F,o+J-D/F,v+H,o+J-D,v+H]],["L",[o+D,v+H]],["C",[o+D/F,v+H,o,v+H-g/F,o,v+H-g]],["L",[o,v+g]],["Z",[]]]);break;default:z.parentNode.removeChild(z)}E&&z.setAttribute("d",E);if(k){Ja.resetOrientation(z);
|
|
m=false;try{m=z.getBBox()}catch(X){}z.parentNode.removeChild(z);return m}else{if(G){G=T(z);na(G)&&Ja.resetOrientation(z)}m.addSubCommand(new Ka(e,e.nextSibling,w));m.addSubCommand(new za(z));Pa();e.parentNode.removeChild(e);z.setAttribute("id",B);z.removeAttribute("visibility");tb([z],true);ya(m)}}};var Cb=this.changeSelectedAttributeNoUndo=function(e,k,m){var A=d.suspendRedraw(1E3);Da=="pathedit"&&Ja.moveNode(e,k);m=m||K;for(var z=m.length,G=["g","polyline","path"];z--;){var B=m[z];if(B!=null){Da===
|
|
"textedit"&&e!=="#text"&&B.textContent.length&&cb.toSelectMode(B);if((e==="x"||e==="y")&&G.indexOf(B.tagName)>=0){var w=getStrokedBBox([B]);c.moveSelectedElements((e==="x"?k-w.x:0)*p,(e==="y"?k-w.y:0)*p,true)}else{w=e==="#text"?B.textContent:B.getAttribute(e);if(w==null)w="";if(w!==String(k)){if(e=="#text"){svgedit.utilities.getBBox(B);B.textContent=k}else e=="#href"?U(B,k):B.setAttribute(e,k);K.indexOf(B)>=0&&setTimeout(function(){B.parentNode&&Ga.requestSelector(B).resize()},0);w=oa(B);if(w!=0&&
|
|
e!="transform")for(var E=T(B),I=E.numberOfItems;I--;)if(E.getItem(I).type==4){E.removeItem(I);var F=svgedit.utilities.getBBox(B),g=M(F.x+F.width/2,F.y+F.height/2,fa(E).matrix);F=g.x;g=g.y;var o=d.createSVGTransform();o.setRotate(w,F,g);E.insertItemBefore(o,I);break}}}}}d.unsuspendRedraw(A)},ib=this.changeSelectedAttribute=function(e,k,m){m=m||K;c.undoMgr.beginUndoableChange(e,m);Cb(e,k,m);e=c.undoMgr.finishUndoableChange();e.isEmpty()||ya(e)};this.deleteSelectedElements=function(){for(var e=new Aa("Delete Elements"),
|
|
k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id);if(G.tagName==="a"&&G.childNodes.length===1){B=G;G=G.parentNode}var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa()};this.cutSelectedElements=function(){for(var e=new Aa("Cut Elements"),k=K.length,m=[],A=0;A<k;++A){var z=K[A];if(z==null)break;var G=z.parentNode,B=z;Ga.releaseSelector(B);svgedit.path.removePath_(B.id);
|
|
var w=B.nextSibling;B=G.removeChild(B);m.push(z);K[A]=null;e.addSubCommand(new Ka(B,w,G))}e.isEmpty()||ya(e);N("changed",m);Pa();c.clipBoard=m};this.copySelectedElements=function(){c.clipBoard=$.merge([],K)};this.pasteElements=function(){var e=c.clipBoard,k=e.length;if(k){for(var m=[],A=new Aa("Paste elements");k--;){var z=e[k];if(z){var G=ja(z);if(!pa(z.id))G.id=z.id;m.push(G);(L||C().getCurrentLayer()).appendChild(G);A.addSubCommand(new za(G))}}svgCanvas.clearSelection();setTimeout(function(){vb(m)},
|
|
100);ya(A);N("changed",m)}};this.groupSelectedElements=function(e){e||(e="g");var k="";switch(e){case "a":k="Make hyperlink";var m="";if(arguments.length>1)m=arguments[1];break;default:e="g";k="Group Elements"}k=new Aa(k);var A=P({element:e,attr:{id:ka()}});e==="a"&&U(A,m);k.addSubCommand(new za(A));for(m=K.length;m--;){var z=K[m];if(z!=null){if(z.parentNode.tagName==="a"&&z.parentNode.childNodes.length===1)z=z.parentNode;var G=z.nextSibling,B=z.parentNode;A.appendChild(z);k.addSubCommand(new Ia(z,
|
|
G,B))}}k.isEmpty()||ya(k);vb([A],true)};var Kb=this.pushGroupProperties=function(e,k){var m=e.childNodes,A=m.length,z=e.getAttribute("transform"),G=T(e),B=fa(G).matrix,w=new Aa("Push group properties"),E=0,I=oa(e),F=$(e).attr(["filter","opacity"]),g,o;for(E=0;E<A;E++){var v=m[E];if(v.nodeType===1){if(F.opacity!==null&&F.opacity!==1){v.getAttribute("opacity");var D=Math.round((v.getAttribute("opacity")||1)*F.opacity*100)/100;ib("opacity",D,[v])}if(F.filter){var H=D=this.getBlur(v);o||(o=this.getBlur(e));
|
|
if(D)D=o-0+(D-0);else if(D===0)D=o;if(H)g=Q(v.getAttribute("filter"));else if(g){g=ja(g);kb().appendChild(g)}else g=Q(F.filter);g.id=v.id+"_"+(g.firstChild.tagName==="feGaussianBlur"?"blur":"filter");ib("filter","url(#"+g.id+")",[v]);if(D){ib("stdDeviation",D,[g.firstChild]);c.setBlurOffsets(g,D)}}D=T(v);if(~v.tagName.indexOf("Gradient"))D=null;if(D)if(v.tagName!=="defs")if(G.numberOfItems){if(I&&G.numberOfItems==1){var J=G.getItem(0).matrix,X=d.createSVGMatrix();if(H=oa(v))X=D.getItem(0).matrix;
|
|
var ca=svgedit.utilities.getBBox(v),S=fa(D).matrix,W=M(ca.x+ca.width/2,ca.y+ca.height/2,S);ca=I+H;S=d.createSVGTransform();S.setRotate(ca,W.x,W.y);J=ha(J,X,S.matrix.inverse());H&&D.removeItem(0);if(ca)D.numberOfItems?D.insertItemBefore(S,0):D.appendItem(S);if(J.e||J.f){H=d.createSVGTransform();H.setTranslate(J.e,J.f);D.numberOfItems?D.insertItemBefore(H,0):D.appendItem(H)}}else{H=v.getAttribute("transform");J={};J.transform=H?H:"";H=d.createSVGTransform();J=fa(D).matrix;X=J.inverse();J=ha(X,B,J);
|
|
H.setMatrix(J);D.appendItem(H)}(v=Qa(v))&&w.addSubCommand(v)}}}if(z){J={};J.transform=z;e.setAttribute("transform","");e.removeAttribute("transform");w.addSubCommand(new Na(e,J))}if(k&&!w.isEmpty())return w};this.ungroupSelectedElement=function(){var e=K[0];if($(e).data("gsvg")||$(e).data("symbol"))Ob(e);else if(e.tagName==="use"){var k=pa(da(e).substr(1));$(e).data("symbol",k).data("ref",k);Ob(e)}else{k=$(e).parents("a");if(k.length)e=k[0];if(e.tagName==="g"||e.tagName==="a"){k=new Aa("Ungroup Elements");
|
|
var m=Kb(e,true);m&&k.addSubCommand(m);m=e.parentNode;for(var A=e.nextSibling,z=Array(e.childNodes.length),G=0;e.firstChild;){var B=e.firstChild,w=B.nextSibling,E=B.parentNode;if(B.tagName==="title"){k.addSubCommand(new Ka(B,B.nextSibling,E));E.removeChild(B)}else{z[G++]=B=m.insertBefore(B,A);k.addSubCommand(new Ia(B,w,E))}}Pa();A=e.nextSibling;e=m.removeChild(e);k.addSubCommand(new Ka(e,A,m));k.isEmpty()||ya(k);tb(z)}}};this.moveToTopSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode,
|
|
m=e.nextSibling;e=e.parentNode.appendChild(e);if(m!=e.nextSibling){ya(new Ia(e,m,k,"top"));N("changed",[e])}}};this.moveToBottomSelectedElement=function(){var e=K[0];if(e!=null){e=e;var k=e.parentNode,m=e.nextSibling,A=e.parentNode.firstChild;if(A.tagName=="title")A=A.nextSibling;if(A.tagName=="defs")A=A.nextSibling;e=e.parentNode.insertBefore(e,A);if(m!=e.nextSibling){ya(new Ia(e,m,k,"bottom"));N("changed",[e])}}};this.moveUpDownSelected=function(e){var k=K[0];if(k){jb=[];var m,A,z=$(sb(getStrokedBBox([k]))).toArray();
|
|
e=="Down"&&z.reverse();$.each(z,function(){if(A){m=this;return false}else if(this==k)A=true});if(m){z=k.parentNode;var G=k.nextSibling;$(m)[e=="Down"?"before":"after"](k);if(G!=k.nextSibling){ya(new Ia(k,G,z,"Move "+e));N("changed",[k])}}}};this.moveSelectedElements=function(e,k,m){if(e.constructor!=Array){e/=p;k/=p}m=m||true;for(var A=new Aa("position"),z=K.length;z--;){var G=K[z];if(G!=null){var B=d.createSVGTransform(),w=T(G);e.constructor==Array?B.setTranslate(e[z],k[z]):B.setTranslate(e,k);w.numberOfItems?
|
|
w.insertItemBefore(B,0):w.appendItem(B);(B=Qa(G))&&A.addSubCommand(B);Ga.requestSelector(G).resize()}}if(!A.isEmpty()){m&&ya(A);N("changed",K);return A}};this.cloneSelectedElements=function(e,k,m){for(var A=new Aa("Clone Elements"),z=K.length,G=0;G<z;++G)if(K[G]==null)break;z=K.slice(0,G);this.clearSelection(true);G=z.length;for(clones=[];G--;){var B=ja(z[G]);if(m){tlist=T(B);tlist.removeItem(m);Qa(B)}(L||C().getCurrentLayer()).appendChild(B);clones.push(B);A.addSubCommand(new za(B))}if(!A.isEmpty()){tb(z.reverse());
|
|
m||this.moveSelectedElements(e,k,false);ya(A)}return clones};this.alignSelectedElements=function(e,k){var m=[],A=Number.MAX_VALUE,z=Number.MIN_VALUE,G=Number.MAX_VALUE,B=Number.MIN_VALUE,w=Number.MIN_VALUE,E=Number.MIN_VALUE,I=K.length;if(I){for(var F=0;F<I;++F){if(K[F]==null)break;m[F]=getStrokedBBox([K[F]]);switch(k){case "smallest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w>m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E>m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width;
|
|
B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;case "largest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||w<m[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E<m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width;B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;default:if(m[F].x<A)A=m[F].x;if(m[F].y<G)G=m[F].y;if(m[F].x+m[F].width>z)z=m[F].x+m[F].width;if(m[F].y+m[F].height>B)B=m[F].y+m[F].height}}if(k=="page"){G=A=0;z=c.contentW;B=c.contentH}w=Array(I);E=Array(I);for(F=
|
|
0;F<I;++F){if(K[F]==null)break;var g=m[F];w[F]=0;E[F]=0;switch(e){case "l":w[F]=A-g.x;break;case "c":w[F]=(A+z)/2-(g.x+g.width/2);break;case "r":w[F]=z-(g.x+g.width);break;case "t":E[F]=G-g.y;break;case "m":E[F]=(G+B)/2-(g.y+g.height/2);break;case "b":E[F]=B-(g.y+g.height)}}this.moveSelectedElements(w,E)}};this.contentW=Ab().w;this.contentH=Ab().h;this.updateCanvas=function(e,k){d.setAttribute("width",e);d.setAttribute("height",k);var m=$("#canvasBackground")[0],A=l.getAttribute("x"),z=l.getAttribute("y"),
|
|
G=e/2-this.contentW*p/2,B=k/2-this.contentH*p/2;la(l,{width:this.contentW*p,height:this.contentH*p,x:G,y:B,viewBox:"0 0 "+this.contentW+" "+this.contentH});la(m,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:G,y:B});(m=pa("background_image"))&&la(m,{width:"100%",height:"100%"});Ga.selectorParentGroup.setAttribute("transform","translate("+G+","+B+")");return{x:G,y:B,old_x:A,old_y:z,d_x:G-A,d_y:B-z}};this.setBackground=function(e,k){var m=pa("canvasBackground"),A=$(m).find("rect")[0],
|
|
z=pa("background_image");A.setAttribute("fill",e);if(k){if(!z){z=f.createElementNS(b,"image");la(z,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}U(z,k);m.appendChild(z)}else z&&z.parentNode.removeChild(z)};this.cycleElement=function(e){var k=K[0],m=false,A=ob(L||C().getCurrentLayer());if(A.length){if(k==null){e=e?A.length-1:0;m=A[e]}else for(var z=A.length;z--;)if(A[z]==k){e=e?z-1:z+1;if(e>=A.length)e=0;else if(e<0)e=A.length-1;m=A[e];
|
|
break}vb([m],true);N("selected",K)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:ya,setGradient:Mb,addSvgElementFromJson:P,assignAttributes:la,BatchCommand:Aa,call:N,ChangeElementCommand:Na,copyElem:ja,ffClone:ea,findDefs:kb,findDuplicateGradient:Ib,getElem:pa,getId:ba,getIntersectionList:sb,getMouseTarget:mb,getNextId:ka,getPathBBox:Y,getUrlFromAttr:ia,hasMatrixTransform:na,identifyLayers:Db,InsertElementCommand:za,isIdentity:svgedit.math.isIdentity,logMatrix:Va,matrixMultiply:ha,
|
|
MoveElementCommand:Ia,preventClickDefault:Gb,recalculateAllSelectedDimensions:Fa,recalculateDimensions:Qa,remapElement:$a,RemoveElementCommand:Ka,removeUnusedDefElems:Nb,round:eb,runExtensions:lb,sanitizeSvg:Ea,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:fa,transformPoint:M,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function q(d,l){var s=h.setSvgString(d)!==false;l=l||a.noop;s?l(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){l(false)})}var h,b={},n=false;curConfig={canvas_expansion:1,dimensions:[580,400],
|
|
initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:[],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:svgedit.browser.isTouch()?false:true,show_outside_canvas:false,no_save_warning:true,initFont:"Helvetica, Arial, sans-serif"};uiStrings=b.uiStrings={common:{ok:"OK",cancel:"Cancel",key_up:"Up",
|
|
key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},notification:{invalidAttrValGiven:"Invalid value given",noContentToFitTo:"No content to fit to",dupeLayerName:"There is already a layer named that!",enterUniqueLayerName:"Please enter a unique layer name",enterNewLayerName:"Please enter the new layer name",layerHasThatName:"Layer already has that name",QmoveElemsToLayer:'Move selected elements to layer "%s"?',QwantToClear:"Do you want to clear the drawing?\nThis will also erase your undo history!",
|
|
QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo history!",QerrorsRevertToSource:"There were parsing errors in your SVG source.\nRevert back to original SVG source?",QignoreSourceChanges:"Ignore changes made to SVG source?",featNotSupported:"Feature not supported",enterNewImgURL:"Enter the new image URL",defsFailOnSave:"NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",loadingImage:"Loading image, please wait...",
|
|
saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions};
|
|
b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,o){var v=g.id,D=v.split("_"),H=D[0];D=D[1];o&&h.setStrokeAttr("stroke-"+H,D);nb();Ib("#cur_"+H,v,20);a(g).addClass("current").siblings().removeClass("current")}function l(g,
|
|
o){var v=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),H=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Qb){Qb.stopPropagation();v.style.left=Qb.pageX-66+H.scrollLeft+"px";D.style.top=Qb.pageY-48+H.scrollTop+"px"});o||(o=h.getZoom());g||(g=a("#svgcanvas"));for(var J=h.getContentElem(),X=svgedit.units.getTypeMap()[curConfig.baseUnit],
|
|
ca=0;ca<2;ca++){var S=ca===0,W=S?"x":"y",Z=S?"width":"height",qa=J.getAttribute(W)-0;W=a("#ruler_"+W+" canvas:first");$hcanv=W.clone();W.replaceWith($hcanv);var ta=$hcanv[0];var ga=W=g[Z]()*2;ta.parentNode.style[Z]=ga+"px";var Ta=0,Ha,sa=ta.getContext("2d");sa.fillStyle="rgb(200,0,0)";sa.fillRect(0,0,ta.width,ta.height);$hcanv.siblings().remove();if(W>=3E4){var Ma=parseInt(W/3E4)+1;Ha=Array(Ma);Ha[0]=sa;for(var va=1;va<Ma;va++){ta[Z]=3E4;var Za=ta.cloneNode(true);ta.parentNode.appendChild(Za);Ha[va]=
|
|
Za.getContext("2d")}Za[Z]=W%3E4;W=3E4}ta[Z]=W;Z=X*o;var Ua=50/Z;ta=1;for(va=0;va<E.length;va++){ta=Ma=E[va];if(Ua<=Ma)break}Ua=ta*Z;sa.font="normal 9px 'Lucida Grande', sans-serif";sa.fillStyle="#777";for(var bb=qa/Z%ta*Z,Fb=bb-Ua;bb<ga;bb+=Ua){Fb+=Ua;va=Math.round(bb)+0.5;if(S){sa.moveTo(va,15);sa.lineTo(va,0)}else{sa.moveTo(15,va);sa.lineTo(0,va)}Ma=(Fb-qa)/Z;if(ta>=1)va=Math.round(Ma);else{va=(ta+"").split(".")[1].length;va=Ma.toFixed(va)-0}if(va!==0&&va!==1E3&&va%1E3===0)va=va/1E3+"K";if(S){sa.fillText(va,
|
|
bb+2,8);sa.fillStyle="#777"}else{Ma=(va+"").split("");for(va=0;va<Ma.length;va++){sa.fillText(Ma[va],1,bb+9+va*9);sa.fillStyle="#777"}}Ma=Ua/10;for(va=1;va<10;va++){var wb=Math.round(bb+Ma*va)+0.5;if(Ha&&wb>W){Ta++;sa.stroke();if(Ta>=Ha.length){va=10;bb=ga;continue}sa=Ha[Ta];bb-=3E4;wb=Math.round(bb+Ma*va)+0.5}var Eb=va%2?12:10;if(S){sa.moveTo(wb,15);sa.lineTo(wb,Eb)}else{sa.moveTo(15,wb);sa.lineTo(Eb,wb)}}}sa.strokeStyle="#666";sa.stroke()}}(function(){var g=window.opener;if(g)try{var o=g.document.createEvent("Event");
|
|
o.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(o)}catch(v){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color="#"+g.bkgd_color;svgEditor.setConfig(g);var o=
|
|
g.source,v=a.param.querystring();if(!o)if(v.indexOf("source=data:")>=0)o=v.match(/source=(data:[^&]*)/)[1];if(o)if(o.indexOf("data:")===0){o=o.replace(/ /g,"+");b.loadFromDataURI(o)}else b.loadFromString(o);else if(v.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(v.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();var s=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(o){if(!o){o=document.createElement("script");o.src=curConfig.extPath+
|
|
g;document.querySelector("head").appendChild(o)}})})};document.location.protocol==="file:"?setTimeout(s,100):s();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png",
|
|
align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom",
|
|
"#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},
|
|
resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var o=
|
|
a("#"+this.id+"_show"),v=o.attr("data-curopt");if(!o.children("svg, img").length){v=a(v).children().clone();if(v.length){v[0].removeAttribute("style");o.append(v)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",
|
|
function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};s=navigator.platform.indexOf("Mac")>=0;var C=navigator.userAgent.indexOf("AppleWebKit")>=0,p=s?"meta+":"ctrl+",L=h.pathActions,R=h.undoMgr,O=svgedit.utilities,K=curConfig.imgPath+
|
|
"placeholder.svg",P=a("#workarea"),T=a("#cmenu_canvas"),M=null,ha=1,na="toolbars",fa="";s||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),o=a("#dialog_buttons"),v=function(D,H,J,X){a("#dialog_content").html("<p>"+H.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",D=="prompt");o.empty();var ca=a('<input type="button" value="'+
|
|
uiStrings.common.ok+'">').appendTo(o);D!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(o).on("click, touchstart",function(){g.hide();J(false)});if(D=="prompt"){var S=a('<input type="text">').prependTo(o);S.val(X||"");S.bind("keydown","return",function(){ca.trigger("click touchstart")})}D=="process"&&ca.hide();g.show();ca.on("click touchstart",function(){g.hide();var W=D=="prompt"?S.val():true;J&&J(W)}).focus();D=="prompt"&&S.focus()};a.alert=function(D,H){v("alert",
|
|
D,H)};a.confirm=function(D,H){v("confirm",D,H)};a.process_cancel=function(D,H){v("process",D,H)};a.prompt=function(D,H,J){v("prompt",D,J,H)}})();var aa=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},V=null,ra=false,ia=false,da="",U=function(g,o){var v=h.getResolution();a("#svgcanvas").position();var D=h.setBBoxZoom(o,
|
|
P.width()-15,P.height()-15);if(D){var H=D.zoom;D=D.bbox;if(H<0.0010)xa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),X=H-v.zoom;a("#zoom");var ca=v.zoom,S=function(W){W=(W-J)/500;W=Math.pow(W-1,3)+1;h.setZoom(ca+X*W);w();if(W<1)g.animatedZoom=requestAnimationFrame(S);else{a("#zoom").val(parseInt(H*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(H*100)+"]","#zoom_select").attr("selected","selected")}};S(Date.now());
|
|
h.getMode()=="zoom"&&D.width&&aa();Ab()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var Y=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},oa={},pa=function(g){a.each(g,function(o,v){var D=a(o).children(),H=o+"_show",J=a(H),X=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(W){var Z=v[W];oa[Z.sel]=Z.fn;if(Z.isDefault)X=W;W=function(qa){var ta=Z;if(qa.type===
|
|
"keydown"){var ga=a(ta.parent+"_show").hasClass("tool_button_current"),Ta=a(ta.parent+"_show").attr("data-curopt");a.each(g[Z.parent],function(sa,Ma){if(Ma.sel==Ta)ta=!qa.shiftKey||!ga?Ma:g[Z.parent][sa+1]||g[Z.parent][0]})}if(a(this).hasClass("disabled"))return false;Ya(H)&&ta.fn();var Ha=ta.icon?a.getSvgIcon(ta.icon,true):a(ta.sel).children().eq(0).clone();Ha[0].setAttribute("width",J.width());Ha[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ha).attr("data-curopt",
|
|
ta.sel)};a(this).mouseup(W);Z.key&&a(document).bind("keydown",Z.key[0]+" shift+"+Z.key[0],W)});if(X)J.attr("data-curopt",v[X].sel);else J.attr("data-curopt")||J.attr("data-curopt",v[0].sel);var ca,S=a(H).position();a(o).css({left:S.left+34,top:S.top+77});J.mousedown(function(W){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ya(H,false);if(J.hasClass("disabled"))return false;var Z=a(o),qa=S.left+34,ta=Z.width()*-1,ga=Z.data("shown_popop")?
|
|
200:0;ca=setTimeout(function(){J.data("isLibrary")?Z.css("left",qa).show():Z.css("left",ta).show().animate({left:qa},50);Z.data("shown_popop",true)},ga);W.preventDefault()}).mouseup(function(){clearTimeout(ca);var W=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(H.replace("_show","")).is(":visible"))Ya(H,true);else Ya(H)&&W in oa&&oa[W]()})});Ba()},la=function(g,o){return a("<div>",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(o)},ma=function(){a(".tools_flyout").each(function(){var g=
|
|
a("#"+this.id+"_show"),o=g.offset();g=g.outerWidth();a(this).css({left:(o.left+g)*ha,top:o.top})})},Ba=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var o=[];a(this).children().each(function(){o.push(this.title)});g[0].title=o.join(" / ")}})},Ea,Ia=function(g,o,v){var D=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+v+"_color defs *")[0];D={alpha:o};D[g.tagName]=g}else D=g.indexOf("#")===0?{alpha:o,solidColor:g.substr(1)}:
|
|
{alpha:o,solidColor:"none"};return new a.jGraduate.Paint(D)},za=h.getResolution();if(curConfig.baseUnit!=="px"){za.w=svgedit.units.convertUnit(za.w)+curConfig.baseUnit;za.h=svgedit.units.convertUnit(za.h)+curConfig.baseUnit}var Ka=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:za.w+2,height:za.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")};
|
|
document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(g){g||(g=K);h.setImageURL(g);a("#image_url").val(g)},Aa=function(){var g=V;if(g!=null&&!g.parentNode)g=null;if(ra&&ra[0]!=null&&!ra[0].parentNode)ra=false;var o=h.getCurrentDrawing().getCurrentLayerName(),v=h.getMode(),D=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,H=v=="pathedit";if(H){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();
|
|
o=L.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!L.canDeleteNodes);Ib("#tool_openclose_path",L.closed_subpath?"open_path":"close_path");if(o){H=a("#seg_type");if(D){o.x=svgedit.units.convertUnit(o.x);o.y=svgedit.units.convertUnit(o.y)}a("#path_node_x").val(Math.round(o.x));a("#path_node_y").val(Math.round(o.y));o.type?H.val(o.type).removeAttr("disabled"):H.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");
|
|
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(ra){ra=ra.filter(Boolean);(g=h.elementsAreSame(ra)?ra[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!ra){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var X=g.nodeName,ca=h.getRotationAngle(g);
|
|
a("#angle").val(Math.round(ca));ca=h.getBlur(g);a("#blur").val(ca);if(!H&&v!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var S,W;if(["g","polyline","path"].indexOf(X)>=0)if(v=h.getStrokedBBox([g])){S=v.x;W=v.y}if(D){S=svgedit.units.convertUnit(S);W=svgedit.units.convertUnit(W)}a("#"+X+"_x").val(Math.round(S));a("#"+X+"_y").val(Math.round(W));if(X==="polyline"){a("#path_x").val(Math.round(S));a("#path_y").val(Math.round(W))}["image","text","path","g","use"].indexOf(X)==
|
|
-1&&a(".action_path_convert_selected").removeClass("disabled");X==="path"&&a(".action_path_selected").removeClass("disabled")}D=null;if(Z==="a"){D=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();D=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1",
|
|
"y1","x2","y2"],text:["x","y"],use:[],path:[]};var Z=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(Z=="path"||Z=="polyline")a("#path_panel").show();if(D[Z]){D=D[Z];a("#"+Z+"_panel").show();Z=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(D,function(qa,ta){var ga=g.getAttribute(ta);if(curConfig.baseUnit!=="px"&&g[ta])ga=svgedit.units.convertUnit(g[ta].baseVal.value);var Ta=document.getElementById(Z+"_"+ta);Ta.value=Math.round(ga)||0;Ta.getAttribute("data-cursor")===
|
|
"true"&&a.fn.dragInput.updateCursor(Ta)});if(Z=="text"){D=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(D);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);h.addedNew&&setTimeout(function(){a("#text").focus().select()},
|
|
100)}else if(Z=="image")Na(h.getHref(g));else if(Z==="g"||Z==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(Z==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(Z==="g"||!ra?"dis":"en")+"ableContextMenuItems"]("#group")}if(ra){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
|
|
R.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");R.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!H||ra){a("#selLayerNames").removeAttr("disabled").val(o);T.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,o){var v=h.getMode();v==="select"&&
|
|
aa();if(v==="pathedit")return Aa();V=o.length==1||o[1]==null?o[0]:null;o=o.filter(Boolean);ra=o.length>=2?o:false;if(h.elementsAreSame(ra))V=ra[0];if(V!=null){a("#multiselected_panel").hide();if(V!=null)switch(V.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":v=null;for(var D=V.getElementsByTagName("*"),H=0,J=D.length;H<J;H++){var X=D[H].getAttribute("stroke-width");if(H===0)v=X;else if(v!==X)v=null}a("#stroke_width").val(v===null?"":v);break;default:a("#stroke_width").val(V.getAttribute("stroke-width")||
|
|
1);v=V.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+v+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);v=V.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+v).length!=0&&d(a("#linejoin_"+v)[0]);v=V.getAttribute("stroke-linecap")||"butt";a("#linecap_"+v).length!=0&&d(a("#linecap_"+v)[0])}if(V!=null){v=(V.getAttribute("opacity")||1)*100;a("#group_opacity").val(v);
|
|
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}ra.length&&a("#tools_top").addClass("multiselected")}else if(ra.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}h.runExtensions("selectedChanged",{elems:o,selectedElement:V,multiselected:ra})});h.bind("transition",function(g,o){var v=h.getMode(),D=o[0];if(D){ra=o.length>=2&&o[1]!=
|
|
null?o:null;if(!ra)switch(v){case "rotate":v=h.getRotationAngle(D);a("#angle").val(Math.round(v));rotateCursor(v);a("#tool_reorient").toggleClass("disabled",v==0)}h.runExtensions("elementTransition",{elems:o})}});h.bind("changed",function(g,o){var v=h.getMode();v==="select"&&aa();for(var D=0;D<o.length;++D){var H=o[D];if(H&&H.tagName==="svg")w();else if(H&&V&&V.parentNode==null)V=H}b.show_save_warning=true;Aa();if(V&&v==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}h.runExtensions("elementChanged",
|
|
{elems:o})});h.bind("saved",function(g,o){b.show_save_warning=false;o='<?xml version="1.0"?>\n'+o;var v=navigator.userAgent;if(~v.indexOf("Chrome")&&a.browser.version>=533||~v.indexOf("MSIE"))kb(0,true);else{var D=g.open("data:image/svg+xml;base64,"+O.encode64(o)),H=a.pref("save_notice_done");if(H!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(v.indexOf("Gecko/")!==-1)if(o.indexOf("<defs")!==-1){J+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done",
|
|
"all");H="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");H!=="part"&&D.alert(J)}}});h.bind("exported",function(g,o){var v=o.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=h.contentW;D.height=h.contentH;canvg(D,o.svg,{renderCallback:function(){var H=D.toDataURL("image/png");M.location.href=H;if(a.pref("export_notice_done")!=="all"){H=uiStrings.notification.saveFromBrowser.replace("%s",
|
|
"PNG");if(v.length)H+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+v.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(H)}}})});h.bind("zoomed",U);h.bind("contextset",function(g,o){var v="";if(o){var D="";v='<a href="#" data-root="y">'+h.getCurrentDrawing().getCurrentLayerName()+"</a>";a(o).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;v+=this!==o?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!o).html(v)});
|
|
h.bind("extension_added",function(g,o){function v(){if(Ea){clearTimeout(Ea);Ea=null}H||(Ea=setTimeout(function(){H=true;Kb(u.iconsize)},50))}var D=false,H=false,J=true,X=function(){if(o.callback&&!D&&J){D=true;o.callback()}},ca=[];o.context_tools&&a.each(o.context_tools,function(ta,ga){var Ta=ga.container_id?' id="'+ga.container_id+'"':"",Ha=a("#"+ga.panel);Ha.length||(Ha=a("<div>",{id:ga.panel}).appendTo("#tools_top").hide());switch(ga.type){case "tool_button":var sa='<div class="tool_button">'+
|
|
ga.id+"</div>",Ma=a(sa).appendTo(Ha);ga.events&&a.each(ga.events,function(Ua,bb){a(Ma).bind(Ua,bb)});break;case "select":sa="<label"+Ta+'><select id="'+ga.id+'">';a.each(ga.options,function(Ua,bb){sa+='<option value="'+Ua+'"'+(Ua==ga.defval?" selected":"")+">"+bb+"</option>"});sa+="</select></label>";var va=a(sa).appendTo(Ha).find("select");a.each(ga.events,function(Ua,bb){a(va).bind(Ua,bb)});break;case "button-select":sa='<div id="'+ga.id+'" class="dropdown toolset" title="'+ga.title+'"><div id="cur_'+
|
|
ga.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ga.id+'_opts"></ul>').appendTo("#option_lists");ga.colnum&&Ta.addClass("optcols"+ga.colnum);a(sa).appendTo(Ha).children();ca.push({elem:"#"+ga.id,list:"#"+ga.id+"_opts",title:ga.title,callback:ga.events.change,cur:"#cur_"+ga.id});break;case "input":sa="<label"+Ta+'><span id="'+ga.id+'_label">'+ga.label+':</span><input id="'+ga.id+'" title="'+ga.title+'" size="'+(ga.size||"4")+'" value="'+(ga.defval||"")+'" type="text"/></label>';
|
|
var Za=a(sa).appendTo(Ha).find("input");ga.spindata&&Za.SpinButton(ga.spindata);ga.events&&a.each(ga.events,function(Ua,bb){Za.bind(Ua,bb)})}});if(o.buttons){var S={},W={},Z=o.svgicons,qa={};a.each(o.buttons,function(ta,ga){for(var Ta,Ha=ga.id,sa=ta;a("#"+Ha).length;)Ha=ga.id+"_"+ ++sa;if(Z){S[Ha]=ga.icon;sa=ga.svgicon?ga.svgicon:ga.id;if(ga.type=="app_menu")W["#"+Ha+" > div"]=sa;else W["#"+Ha]=sa}else Ta=ga.type=="menu"?"":a('<img src="'+ga.icon+'">');var Ma,va;switch(ga.type){case "mode_flyout":case "mode":Ma=
|
|
"tool_button";if(ga.cls)Ma+=" "+ga.cls;va="#tools_left";break;case "context":Ma="tool_button";va="#"+ga.panel;a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";va="#"+(ga.after||ga.panel);break;case "app_menu":Ma="";va=ga.parent||"#main_menu ul";a(va).length||a("<div>",{id:ga.panel}).appendTo("#tools_top")}var Za=a(ga.list||ga.type=="app_menu"?"<li/>":"<div/>").attr("id",Ha).attr("title",ga.title).addClass(Ma);if(!ga.includeWith&&!ga.list){if("position"in
|
|
ga)a(va).children().eq(ga.position).before(Za);else ga.type!="menu"||!ga.after?Za.appendTo(va):a(va).after(Za);if(ga.type=="mode_flyout"){sa=a(Za);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Ua=sa[0].id.replace("tool_","tools_"),bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));sa.before(bb);Ma=la(Ua,sa);Ma.data("isLibrary",true);bb.data("isLibrary",true)}W["#"+Ua+"_show"]=ga.id;Ha=qa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,isDefault:true},
|
|
Fb]}else if(ga.type=="app_menu"||ga.type=="menu")Za.append(ga.title)}else if(ga.list){Za.addClass("push_button");a("#"+ga.list+"_opts").append(Za);if(ga.isDefault){a("#cur_"+ga.list).append(Za.children().clone());sa=ga.svgicon?ga.svgicon:ga.id;W["#cur_"+ga.list]=sa}}else if(ga.includeWith){va=ga.includeWith;sa=a(va.button);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Ua=sa[0].id.replace("tool_","tools_");bb=sa.clone().attr("id",Ua+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));
|
|
sa.before(bb);Ma=la(Ua,sa)}var Fb=B.getButtonData(va.button);if(va.isDefault)W["#"+Ua+"_show"]=ga.id;Ha=qa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,key:ga.key,isDefault:ga.includeWith?ga.includeWith.isDefault:0},Fb];Ua="position"in va?va.position:"last";Fb=Ma.children().length;if(!isNaN(Ua)&&Ua>=0&&Ua<Fb)Ma.children().eq(Ua).before(Za);else{Ma.append(Za);Ha.reverse()}}Z||Za.append(Ta);ga.list||a.each(ga.events,function(wb,Eb){if(wb=="click")if(ga.type=="mode"){ga.includeWith?Za.bind(wb,
|
|
Eb):Za.bind(wb,function(){Ya(Za)&&Eb()});if(ga.key){a(document).bind("keydown",ga.key,Eb);ga.title&&Za.attr("title",ga.title+" ["+ga.key+"]")}}else Za.bind(wb,Eb);else Za.bind(wb,Eb)});pa(qa)});a.each(ca,function(){Wa(this.elem,this.list,this.callback,{seticon:true})});if(Z)J=false;a.svgIcons(Z,{w:27,h:27,id_match:false,no_img:!C,fallback:S,placement:W,callback:function(){u.iconsize&&u.iconsize!="m"&&v();J=true;X()}})}X()});h.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';
|
|
a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(g,o){ya+='<div class="palette_item" style="background-color: '+o+';" data-rgb="'+o+'"></div>'});a("#palette").append(ya);
|
|
var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";Ga.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var xa=function(g){var o=g.value/100;if(o<0.0010)g.value=0.1;else{g=h.getZoom();U(window,{width:0,height:0,x:(P[0].scrollLeft+P.width()/2)/g,y:(P[0].scrollTop+P.height()/2)/g,zoom:o},true)}},nb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray",
|
|
a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);nb()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});changeAttribute=function(g){var o=g.getAttribute("data-attr"),v=g.getAttribute("data-multiplier")||1;v=parseFloat(v);
|
|
v=g.value*v;if(!svgedit.units.isValidUnit(o,v,V)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=V.getAttribute(o);return false}h.changeSelectedAttributeNoUndo(o,v)};a("#palette").mouseover(function(){var g=a('<input type="hidden">');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),o=g?"stroke":"fill",v=a(this).attr("data-rgb"),D=null;if(v==="transparent"||v==="initial"||v==="#none"){v=
|
|
"none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:v.substr(1)});b.paintBox[o].setPaint(D);if(g){h.setColor("stroke",v);v!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",v);v!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");m()},function(){a(".stroke_tool").css("display",
|
|
"none");a(this).removeClass("expanded");m()});var Ya=function(g,o){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var v=v||"normal";o||a(".tools_flyout").fadeOut(v);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=null,o=null,v=P[0],D=false,H=false;a("#svgcanvas").bind("mousemove mouseup touchend",
|
|
function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J.clientX;o=J.clientY;if(J.type==="mouseup"||J.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||H===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){D=true;g=J.clientX;o=J.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(J){J.preventDefault();h.spaceKey=H=true}).bind("keyup",
|
|
"space",function(J){J.preventDefault();h.spaceKey=H=false}).bind("keydown","alt",function(){h.getMode()==="zoom"&&P.addClass("out")}).bind("keyup","alt",function(){h.getMode()==="zoom"&&P.removeClass("out")})})();var fb=a(".menu"),Sa=function(g){g.target.style.background="#fff";setTimeout(function(){g.target.style.background="#ddd"},50);setTimeout(function(){g.target.style.background="#fff"},150);setTimeout(function(){g.target.style.background="#ddd"},200);setTimeout(function(){g.target.style.background=
|
|
""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(g){Sa(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?Sa(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,o,v,D){if(g.altKey){g.preventDefault();
|
|
zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+D*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");fb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){fb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,o,v){if(a(g).length!=0){var D=a(g).find("button"),H=a(g).find("ul").attr("id",a(g)[0].id+"-list");v||a("#option_lists").append(H);var J=false;v&&
|
|
a(g).addClass("dropup");H.find("li").bind("mouseup",o);a(window).mouseup(function(){if(!J){D.removeClass("down");H.hide()}J=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");H.hide()}else{D.addClass("down");if(!v){var X=a(g).offset();H.css({top:X.top,left:X.left-110})}H.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Wa=function(g,o,v,D){var H=a(g);o=a(o);var J=false,X=D.dropUp;X&&a(g).addClass("dropup");o.find("li").bind("mouseup",function(){if(D.seticon){Ib("#cur_"+
|
|
H[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}v.apply(this,arguments)});a(window).mouseup(function(){if(!J){H.removeClass("down");o.hide();o.css({top:0,left:0})}J=false});o.height();a(g).bind("mousedown",function(){var ca=a(g).offset();if(X){ca.top-=o.height();ca.left+=8}else ca.top+=a(g).height();a(o).offset(ca);if(H.hasClass("down")){H.removeClass("down");o.hide();o.css({top:0,left:0})}else{H.addClass("down");o.show();J=true;return false}}).hover(function(){J=
|
|
true}).mouseout(function(){J=false});D.multiclick&&o.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g=this.options[this.selectedIndex].value,o=this.options[this.selectedIndex].text;a("#preview_font").html(o).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,o=function(){a(g).blur()};
|
|
a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;na="toolbars";P.mousedown(o)}).blur(function(){na="canvas";P.unbind("mousedown",o);h.getMode()=="textedit"&&a("#text").focus()})})();var Ca=function(){Ya("#tool_select")&&h.setMode("select")},wa=function(){Ya("#tool_fhpath")&&h.setMode("fhpath")},db=function(){Ya("#tool_line")&&h.setMode("line")},La=function(){Ya("#tool_rect")&&h.setMode("rect")},Ra=function(){Ya("#tool_ellipse")&&h.setMode("ellipse")},Da=function(){Ya("#tool_image")&&
|
|
h.setMode("image")},gb=function(){Ya("#tool_zoom")&&h.setMode("zoom")},rb=function(){if(Ya("#tool_zoom")){Bb();aa()}},Xa=function(){Ya("#tool_text")&&h.setMode("text")},ab=function(){Ya("#tool_path")&&h.setMode("path")},xb=function(){if(V!=null||ra)h.deleteSelectedElements()},ua=function(){if(V!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cutSelectedElements()}},jb=function(){if(V!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.copySelectedElements()}},hb=function(){window.event.type===
|
|
"keydown"&&mb(a("#edit_menu"));var g=h.getZoom(),o=(P[0].scrollLeft+P.width()/2)/g-h.contentW;g=(P[0].scrollTop+P.height()/2)/g-h.contentH;h.pasteElements("point",o,g)},ub=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToTopSelectedElement()}},lb=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToBottomSelectedElement()}},eb=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Up")}},sb=
|
|
function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Down")}},ob=function(g){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected(g)}},yb=function(){if(V!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");L.toEditMode(elems[0]);h.clearSelection();Aa()}},zb=function(){V!=null&&L.reorient()},ja=function(){if(V!=null||
|
|
ra)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ba=function(g,o){if(V!=null||ra){if(curConfig.gridSnapping){var v=h.getZoom()*curConfig.snappingStep;g*=v;o*=v}a("input").blur();h.moveSelectedElements(g,o)}},ka=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);L.linkControlPoints(g)},
|
|
N=function(){L.getNodePoint()&&L.clonePathNode()},Q=function(){L.getNodePoint()&&L.deletePathNode()},ea=function(){var g=a("#tool_add_subpath"),o=!g.hasClass("push_button_pressed");o?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");L.addSubPath(o)},Fa=function(){L.opencloseSubPath()},Oa=function(){h.cycleElement(1)},Va=function(){h.cycleElement(0)},$a=function(g,o){if(!(V==null||ra)){g||(o*=-1);var v=a("#angle").val()*1+o;h.setRotationAngle(v);
|
|
Aa()}},qb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(o){if(o){aa();h.clear();h.setResolution(g[0],g[1]);w(true);Bb();Aa();Y();h.runExtensions("onNewDocument")}})},Qa=function(){h.setBold(!h.getBold());Aa()},pb=function(){h.setItalic(!h.getItalic());Aa()},Pa=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+g+"</title><h1>"+g+"</h1>")}window.canvg?h.rasterExport():a.getScript("canvg/rgbcolor.js",
|
|
function(){a.getScript("canvg/canvg.js",function(){h.rasterExport()})})},tb=function(){h.open()},vb=function(){},mb=function(g){var o=g.prev();o.css("background","#09f");setTimeout(function(){o.css("background","")},200)},Gb=function(){if(R.getUndoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.undo()}},cb=function(){if(R.getRedoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.redo()}},Ja=function(){if(ra)h.groupSelectedElements();else V&&h.ungroupSelectedElement()},
|
|
Nb=function(){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cloneSelectedElements(20,20)},Lb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Jb=function(){var g=document.querySelector("#tool_stroke rect"),o=document.querySelector("#tool_fill rect"),v=o.getAttribute("fill"),D=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;o=parseFloat(o.getAttribute("fill-opacity"));if(isNaN(o))o=100;
|
|
D=Ia(D,g,"stroke");v=Ia(v,o,"fill");b.paintBox.fill.setPaint(D,true);b.paintBox.stroke.setPaint(v,true)},Bb=function(g){var o=h.getResolution();g=g?o.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Ab();w(true)},Ob=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");P.toggleClass("wireframe");if(!z){var g=a("#wireframe_rules");g.length?g.empty():a('<style id="wireframe_rules"></style>').appendTo("head");
|
|
Ab()}},Db=function(){var g=!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Hb=function(){window.self!=window.top&&top.exit_fullscreen()},Pb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");
|
|
a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Ab=function(){if(!z){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(P.hasClass("wireframe")?g:"")}},kb=function(g,o){if(!ia){ia=true;a("#save_output_btns").toggle(!!o);a("#tool_source_back").toggle(!o);var v=fa=h.getSvgString();a("#svg_source_textarea").val(v);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},
|
|
Mb=function(){if(ia){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();k();Bb();Y()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();k();Bb();Y()});aa()}},Ib=b.setIcon=function(g,o){var v=typeof o==="string"?a.getSvgIcon(o,true):o.clone();v?a(g).find("img").replaceWith(v):console.log("NOTE: Icon image missing: "+o)},Cb;Cb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,o=document.getElementsByTagName("script")[0],
|
|
v;for(v in o.style)if(g.test(v))return v.match(g)[0];if("WebkitOpacity"in o.style)return"Webkit";if("KhtmlOpacity"in o.style)return"Khtml";return""}();var ib=function(g,o){Cb.toLowerCase();var v=["top","left","bottom","right"];g.each(function(){for(var D=a(this),H=D.outerWidth()*(o-1),J=D.outerHeight()*(o-1),X=0;X<4;X++){var ca=v[X],S=D.data("orig_margin-"+ca);if(S==null){S=parseInt(D.css("margin-"+ca));D.data("orig_margin-"+ca,S)}S=S*o;if(ca==="right")S+=H;else if(ca==="bottom")S+=J;D.css("margin-"+
|
|
ca,S)}})},Kb=b.setIconSize=function(g,o){if(!(g==u.size&&!o)){var v=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=ha=D;ma();var H=v.parents(":hidden");H.css("visibility","hidden").show();ib(v,D);H.css("visibility","visible").hide();v=a("#tool_size_rules");if(v.length)v.empty();
|
|
else v=a('<style id="tool_size_rules"></style>').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(X,ca){X="#svg_editor "+X.replace(/,/g,", #svg_editor");J+=X+"{";a.each(ca,function(S,W){if(typeof W==="number")var Z=W*D+"px";else if(W[g]||W.all)Z=W[g]||W.all;J+=S+":"+Z+";"});J+="}"});H="-"+Cb.toLowerCase()+"-";J+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
|
H+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+H+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+H+"transform: scale("+1/D+");}";v.text(J)}ma()}},e=function(){a("#dialog_box").hide();if(ia){if(ia)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&k()}):k();m()}else da&&h.leaveContext()},k=function(){a("#svg_source_editor").hide();ia=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
|
|
var m=a.noop;a(window).resize(function(){w()});(function(){P.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=P[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=P[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(V);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(o){o&&Na(o)})});var A=function(g){var o=g[0].id=="stroke_color"?"stroke":
|
|
"fill",v=g[0].id=="canvas_color";if(v)o="canvas";var D=b.paintBox[o].paint;g=o=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";v=v?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(v).jGraduate({paint:D,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(H){D=new a.jGraduate.Paint(H);b.paintBox[o].setPaint(D);
|
|
h.setPaint(o,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};s=function(g,o){var v=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(o=="stroke")D=curConfig.initStroke;if(o=="fill")D=curConfig.initFill;if(o=="canvas"&&v)if(v=v.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(v[1],10).toString(16)).slice(-2)+("0"+parseInt(v[2],10).toString(16)).slice(-2)+("0"+parseInt(v[3],10).toString(16)).slice(-2),opacity:1};v=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
|
|
D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;v=a(g)[0].appendChild(document.importNode(v,true));o==="canvas"?v.setAttribute("width",60.5):v.setAttribute("width","100%");this.rect=v.firstChild;this.defs=v.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=o;this.setPaint=function(H,J){this.paint=H;var X="none",ca=H.type,S=H.alpha/100;switch(ca){case "solidColor":X=
|
|
H[ca]=="none"||H[ca]=="one"?"none":"#"+H[ca];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(H[ca]);X="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",X);this.rect.setAttribute("opacity",S);if(J){h.setColor(this.type,X,true);h.setPaintOpacity(this.type,S,true)}if(this.type=="canvas")if(ca=document.getElementById("canvas_background")){za=h.getResolution();ca.setAttribute("x",-1);ca.setAttribute("y",-1);
|
|
ca.setAttribute("width",za.w+2);ca.setAttribute("height",za.h+2);ca.setAttribute("fill",X)}else Ka(X)};this.update=function(H){if(V){var J=this.type;switch(V.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var X=null,ca=V.getElementsByTagName("*"),S=0,W=ca.length;S<W;S++){var Z=ca[S].getAttribute(J);if(S===0)X=Z;else if(X!==Z){X=null;break}}if(X===null){ca=null;return}ca=X;X=1;break;default:X=parseFloat(V.getAttribute(J+"-opacity"));if(isNaN(X))X=1;ca=J==="fill"?
|
|
"black":"none";ca=V.getAttribute(J)||ca}if(H){h.setColor(J,ca,true);h.setPaintOpacity(J,X,true)}X*=100;this.setPaint(Ia(ca,X,J))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var H=new a.jGraduate.Paint({copy:this.paint});h.setPaint(o,H)}}};b.paintBox.fill=new s("#fill_color","fill");b.paintBox.stroke=new s("#stroke_color","stroke");b.paintBox.canvas=new s("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*
|
|
100);s=b.paintBox.fill.rect.cloneNode(false);s.setAttribute("style","vector-effect:non-scaling-stroke");var z=s.style.vectorEffect==="non-scaling-stroke";s.removeAttribute("style");s=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof s.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(s).remove();setTimeout(function(){h.embedImage("images/placeholder.svg",function(g){if(!g){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);
|
|
u.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))A(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))A(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
|
|
function(){A(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");A(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");A(a("#fill_color"))});a("#zoom_select").on("change",function(){var g=this.options[this.selectedIndex].text;g=g.split("%")[0];a("#zoom").val(g).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||
|
|
a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){P.css("line-height",P.height()+"px")});var G=function(){var g=a("#canvas_width"),o=a("#canvas_height"),v=g.val(),D=o.val();if(v!="fit"&&!svgedit.units.isValidUnit("width",v)){a.alert(uiStrings.notification.invalidAttrValGiven);
|
|
g.parent().addClass("error");return false}g.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);o.parent().addClass("error");return false}o.parent().removeClass("error");if(!h.setResolution(v,D)){a.alert(uiStrings.notification.noContentToFitTo);v=h.getResolution();g.val(v.w);o.val(v.h);return false}w()};a("#resolution").change(function(){var g=a("#canvas_width")[0],o=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
|
|
"content"){g.value="fit";o.value="fit";G();var v=h.getResolution();g.value=v.w;o.value=v.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var H=D[0]-g.value,J=D[1]-o.value,X=Date.now(),ca=function(S){S=(S-X)/1E3;S=Math.pow(S-1,3)+1;g.value=(D[0]-H+S*H).toFixed(0);o.value=(D[1]-J+S*J).toFixed(0);G();if(S>=1){S=h.getResolution();a("#canvas_width").val(S.w.toFixed());a("#canvas_height").val(S.h.toFixed());a("#resolution_label").html("<div class='pull'>"+S.w+"<span>\u00d7</span></br>"+
|
|
S.h+"</div>")}else requestAnimationFrame(ca)};ca(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;o.value=100}}});a("#zoom").change(function(){xa(this)});a("input,select").attr("autocomplete","off");var B=function(){var g=[{sel:"#tool_select",fn:Ca,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:wa,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:db,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:La,evt:"click",
|
|
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ra,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:ab,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Xa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Da,evt:"mouseup"},{sel:"#tool_zoom",fn:gb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:qb,evt:"mouseup",key:[p+"N",true]},{sel:"#tool_save",fn:function(){ia?Mb():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[p+"S",true]},{sel:"#tool_export",fn:Pa,evt:"mouseup"},
|
|
{sel:"#tool_open",fn:tb,evt:"mouseup"},{sel:"#tool_import",fn:vb,evt:"mouseup"},{sel:"#tool_source",fn:kb,evt:"click",key:[p+"U",true]},{sel:"#tool_wireframe",fn:Ob,evt:"click"},{sel:"#tool_snap",fn:Db,evt:"click"},{sel:"#tool_rulers",fn:Pb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:e,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Mb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:xb,evt:"click",key:["del/backspace",
|
|
true]},{sel:"#tool_reorient",fn:zb,evt:"click"},{sel:"#tool_node_link",fn:ka,evt:"click"},{sel:"#tool_node_clone",fn:N,evt:"click"},{sel:"#tool_node_delete",fn:Q,evt:"click"},{sel:"#tool_openclose_path",fn:Fa,evt:"click"},{sel:"#tool_add_subpath",fn:ea,evt:"click"},{sel:"#tool_move_top",fn:ub,evt:"click",key:p+"shift+up"},{sel:"#tool_move_bottom",fn:lb,evt:"click",key:p+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[p+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[p+"down",true]},
|
|
{sel:"#tool_topath",fn:yb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ja,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[p+"D",true]},{sel:"#tool_group",fn:Ja,evt:"click",key:[p+"G",true]},{sel:"#tool_ungroup",fn:Ja,evt:"click",key:p+"shift+G"},{sel:"#tool_unlink_use",fn:Ja,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:Gb,evt:"click",key:p+"z"},{sel:"#tool_redo",fn:cb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ua,evt:"click",
|
|
key:[p+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:p+"c"},{sel:"#tool_paste",fn:hb,evt:"click",key:p+"v"},{sel:"#tool_switch",fn:Jb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Qa,evt:"mousedown",key:[p+"B",true]},{sel:"#tool_italic",fn:pb,evt:"mousedown",key:[p+"I",true]},{sel:"#copy_save_done",fn:e,evt:"click"},{key:"ctrl+left",fn:function(){$a(0,1)}},{key:"ctrl+right",fn:function(){$a(1,1)}},{key:"ctrl+shift+left",fn:function(){$a(0,5)}},{key:"ctrl+shift+right",fn:function(){$a(1,5)}},
|
|
{key:"shift+O",fn:Va},{key:"shift+P",fn:Oa},{key:[p+"+",true],fn:function(){Bb(2)}},{key:[p+"-",true],fn:function(){Bb(0.5)}},{key:["up",true],fn:function(){ba(0,-1)}},{key:["down",true],fn:function(){ba(0,1)}},{key:["left",true],fn:function(){ba(-1,0)}},{key:["right",true],fn:function(){ba(1,0)}},{key:"shift+up",fn:function(){ba(0,-10)}},{key:"shift+down",fn:function(){ba(0,10)}},{key:"shift+left",fn:function(){ba(-10,0)}},{key:"shift+right",fn:function(){ba(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0,
|
|
-1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10,
|
|
0)}},{key:p+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var v=a(".tool_button_current");if(v.length&&v[0].id!=="tool_eyedropper"){v.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:p+"shift+z",fn:cb},{key:"esc",fn:Hb}],o={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var v={};a.each(g,function(D,H){if(H.sel){var J=
|
|
a(H.sel);if(J.length==0)return true;if(H.evt){if(svgedit.browser.isTouch()&&H.evt==="click")H.evt="mousedown";J[H.evt](H.fn)}if(H.parent&&a(H.parent+"_show").length!=0){var X=a(H.parent);X.length||(X=la(H.parent.substr(1)));X.append(J);a.isArray(v[H.parent])||(v[H.parent]=[]);v[H.parent].push(H)}}if(H.key){var ca=H.fn,S=false;if(a.isArray(H.key)){X=H.key[0];if(H.key.length>1)S=H.key[1]}else X=H.key;X+="";svgedit.browser.isMac&&X.indexOf("+")!=-1&&X.split("+")[0]=="ctrl"&&X.replace("ctrl","cmd");a.each(X.split("/"),
|
|
function(Z,qa){a(document).bind("keydown",qa,function(ta){ca();S&&ta.preventDefault();return false})});if(H.sel&&!H.hidekey&&J.attr("title")){var W=J.attr("title").split("[")[0]+" ("+X+")";o[X]=H.sel;J.parents("#main_menu").length||J.attr("title",W)}}});pa(v);a(window).bind("keydown","tab",function(D){if(na==="canvas"){D.preventDefault();Oa()}}).bind("keydown","shift+tab",function(D){if(na==="canvas"){D.preventDefault();Va()}});a("#tool_zoom").dblclick(rb)},setTitles:function(){a.each(o,function(v,
|
|
D){var H=a(D).parents("#main_menu").length;a(D).each(function(){var J=H?a(this).text().split(" [")[0]:this.title.split(" [")[0],X="";a.each(v.split("/"),function(ca,S){var W=S.split("+"),Z="";if(W.length>1){Z=W[0]+"+";S=W[1]}X+=(ca?"/":"")+Z+(uiStrings["key_"+S]||S)});if(H)this.lastChild.textContent=J+" ["+X+"]";else this.title=J+" ["+X+"]"})})},getButtonData:function(v){var D;a.each(g,function(H,J){if(J.sel===v)D=J});return D}}}();B.setAll();b.ready(function(){var g=curConfig.initTool,o=a("#tools_left, #svg_editor .tools_flyout"),
|
|
v=o.find("#tool_"+g);g=o.find("#"+g);(v.length?v:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
|
|
a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,
|
|
callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,
|
|
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,
|
|
cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,
|
|
step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,
|
|
max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var o=g.value;if(o==0&&V&&["line","polyline"].indexOf(V.nodeName)>=0)o=g.value=1;h.setStrokeWidth(o)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled",
|
|
g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,o){var v=g.value-0,D=v+o,H=D>=v;if(o===0)return v;return v>=24?H?Math.round(v*1.1):Math.round(v/1.1):v<=1?H?v*2:v/2:D},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(g){val=g.value;a("#blur").val(val);
|
|
h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":xb();break;case "cut":ua();break;case "copy":jb();break;case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":ub();break;case "move_up":ob("Up");break;case "move_down":ob("Down");break;
|
|
case "move_back":lb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu();T.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(R.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(g){a("#main_menu").hide();
|
|
R.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){s=a('<input type="file">').change(function(){var g=this;b.openPrep(function(o){if(o){h.clear();if(g.files.length==1){o=new FileReader;o.onloadend=function(v){q(v.target.result);w()};o.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(s);s=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;g.onloadend=function(o){h.importSvgString(o.target.result,
|
|
true);w()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(s)}var w=b.updateCanvas=function(g,o){var v=P.width(),D=P.height(),H=v,J=D,X=h.getZoom(),ca=a("#svgcanvas"),S={x:P[0].scrollLeft+H/2,y:P[0].scrollTop+J/2},W=curConfig.canvas_expansion;v=Math.max(H,h.contentW*X*W);D=Math.max(J,h.contentH*X*W);v==H&&D==J?P.css("overflow","hidden"):P.css("overflow","scroll");W=ca.height()/2;var Z=ca.width()/2;ca.width(v).height(D);var qa=D/2,ta=v/2,ga=h.updateCanvas(v,D),Ta=ta/Z;v=v/2-H/2;D=D/
|
|
2-J/2;if(o){o.x+=ga.x;o.y+=ga.y}else o={x:ta+(S.x-Z)*Ta,y:qa+(S.y-W)*Ta};if(g)if(h.contentW>P.width()){P[0].scrollLeft=ga.x-10;P[0].scrollTop=ga.y-10}else{P[0].scrollLeft=v;P[0].scrollTop=D}else{P[0].scrollLeft=o.x-H/2;P[0].scrollTop=o.y-J/2}if(curConfig.showRulers){l(ca,X);P.scroll()}},E=[];for(s=0.1;s<1E5;s*=10){E.push(1*s);E.push(2*s);E.push(5*s)}w(true);try{var I=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var o=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+
|
|
"";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(H){return"\\u"+("0000"+H.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var v=0;v<g.length;v++)g[v]=o(g[v]);return"["+g.join(",")+"]"}else{v=[];for(var D in g)v.push(o(D)+":"+o(g[D]));return"{"+v.join(",")+"}"}};window.addEventListener("message",function(g){var o=parseInt(g.data.substr(0,g.data.indexOf(";")));
|
|
try{g.source.postMessage("SVGe"+o+";"+I(eval(g.data)),"*")}catch(v){g.source.postMessage("SVGe"+o+";error:"+v.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=h;h.ready=svgEditor.ready});b.setLang=function(g,o){a.pref("lang",g);a("#lang_select").val(g);if(o){h.runExtensions("langChanged",g);Ba();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},
|
|
function(v,D){a(D).attr("title",a(v)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(d){n?d():f.push(d)};b.runCallbacks=function(){a.each(f,function(){this()});n=true};b.loadFromString=function(d){b.ready(function(){q(d)})};b.loadFromURL=function(d,l){l||(l={});var s=l.cache,C=l.callback;b.ready(function(){a.ajax({url:d,dataType:"text",cache:!!s,success:function(p){q(p,C)},error:function(p,
|
|
L,R){p.status!=404&&p.responseText?q(p.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+R+"",C)}})})};b.loadFromDataURI=function(d){b.ready(function(){var l=d.substring(26);q(svgedit.utilities.decode64(l))})};b.addExtension=function(){var d=arguments;a(function(){h&&h.addExtension.apply(this,d)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
|
|
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,h=$(this).parent(),b=$(this),n=this.dragCfg.height,u=this.dragCfg.min,c=this.dragCfg.max,f=this.dragCfg.step,d=c-u>0?(c-u)/f:200,l=d/n*f,s=0,C=this.getAttribute("data-attr"),p=svgEditor.canvas,L=p.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,K=d&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(h):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start*
|
|
-1/l+n);this.adjustValue=function(P,T){var M;P=parseFloat(P);if(isNaN(this.value))M=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){M=this.dragCfg.stepfunc(this,P);console.log(M)}else M=Number((Number(this.value)+Number(P)).toFixed(5));if(c!==null)M=Math.min(M,c);if(u!==null)M=Math.max(M,u);K&&this.updateCursor(M);this.value=M;h.attr("data-value",M);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,T)};h.toggleClass("draginput",h.is("label"));this.move=function(P,T,M){if(R)P=
|
|
P.originalEvent.touches[0];if(s===0)s=T;T=(P.pageY-s)*-1;s=P.pageY;M=T*l*q;this.adjustValue(M.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");s=0;if(L[0]){var P=p.undoMgr.finishUndoableChange();P.isEmpty()||p.undoMgr.addCommandToHistory(P)}this.adjustValue(0,O)};this.updateCursor=function(){var P=parseFloat(this.value)*-1/l+n;K.css("top",P)};this.start=
|
|
function(P){if(R)P=P.originalEvent.touches[0];var T=P.pageY,M=this.value,ha=this;p.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");h.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(na){ha.move(na,T,parseFloat(M))});$(window).bind("mouseup.draginput touchend.draginput",function(){ha.stop()})};$(this).attr("readonly","readonly").attr("data-scale",l).attr("data-domain",n).attr("data-cursor",K!=false).bind("mousedown touchstart",function(P){this.blur();
|
|
this.start(P)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(P){switch(P.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(P,T,M,ha){O&&p.undoMgr.beginUndoableChange(C,L);O=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){na.stop()},
|
|
1E3);var na=this;if(ha>0)this.adjustValue(this.dragCfg.step);else ha<0&&this.adjustValue(-this.dragCfg.step);P.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),h=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/h+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{};
|
|
(function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var q=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var h=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+h+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions=
|
|
{}};svgedit.contextmenu.add=function(q){if(q&&q.id&&q.label&&q.action&&typeof q.action=="function")if(q.id in a.contextMenuExtensions)console.error('Cannot add extension "'+q.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+q.id+", label:"+q.label+"}");a.contextMenuExtensions[q.id]=q}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=
|
|
function(q){return a.contextMenuExtensions[q]&&true};svgedit.contextmenu.getCustomHandler=function(q){return a.contextMenuExtensions[q].action}})();(function(a,q){function h(n){return!a(n).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(n,u){var c=n.nodeName.toLowerCase();if("area"===c){c=n.parentNode;var f=c.name;if(!n.href||!f||c.nodeName.toLowerCase()!=="map")return false;c=a("img[usemap=#"+f+"]")[0];return!!c&&h(c)}return(/input|select|textarea|button|object/.test(c)?!n.disabled:"a"==c?n.href||u:u)&&h(n)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",
|
|
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(n,u){return typeof n=="number"?this.each(function(){var c=
|
|
this;setTimeout(function(){a(c).focus();u&&u.call(c)},n)}):this._focus.apply(this,arguments)},scrollParent:function(){var n;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?n=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):n=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,
|
|
"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!n.length?a(document):n},zIndex:function(n){if(n!==q)return this.css("zIndex",n);if(this.length){n=a(this[0]);for(var u;n.length&&n[0]!==document;){u=n.css("position");if(u==="absolute"||u==="relative"||u==="fixed"){u=parseInt(n.css("zIndex"),10);if(!isNaN(u)&&u!==0)return u}n=n.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":
|
|
"mousedown")+".ui-disableSelection",function(n){n.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(n,u){function c(s,C,p,L){a.each(f,function(){C-=parseFloat(a.curCSS(s,"padding"+this,true))||0;p&&(C-=parseFloat(a.curCSS(s,"border"+this+"Width",true))||0);L&&(C-=parseFloat(a.curCSS(s,"margin"+this,true))||0)});return C}var f=u==="Width"?["Left","Right"]:["Top","Bottom"],d=u.toLowerCase(),l={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,
|
|
outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+u]=function(s){if(s===q)return l["inner"+u].call(this);return this.each(function(){a(this).css(d,c(this,s)+"px")})};a.fn["outer"+u]=function(s,C){if(typeof s!="number")return l["outer"+u].call(this,s);return this.each(function(){a(this).css(d,c(this,s,true,C)+"px")})}}),a.extend(a.expr[":"],{data:function(n,u,c){return!!a.data(n,c[3])},focusable:function(n){return b(n,!isNaN(a.attr(n,"tabindex")))},tabbable:function(n){var u=a.attr(n,
|
|
"tabindex"),c=isNaN(u);return(c||u>=0)&&b(n,!c)}}),a(function(){var n=document.body,u=n.appendChild(u=document.createElement("div"));a.extend(u.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=u.offsetHeight===100;a.support.selectstart="onselectstart"in u;n.removeChild(u).style.display="none"}),a.extend(a.ui,{plugin:{add:function(n,u,c){n=a.ui[n].prototype;for(var f in c){n.plugins[f]=n.plugins[f]||[];n.plugins[f].push([u,c[f]])}},call:function(n,u,c){if((u=n.plugins[u])&&
|
|
n.element[0].parentNode)for(var f=0;f<u.length;f++)n.options[u[f][0]]&&u[f][1].apply(n.element,c)}},contains:function(n,u){return document.compareDocumentPosition?n.compareDocumentPosition(u)&16:n!==u&&n.contains(u)},hasScroll:function(n,u){if(a(n).css("overflow")==="hidden")return false;var c=u&&u==="left"?"scrollLeft":"scrollTop",f=false;if(n[c]>0)return true;n[c]=1;f=n[c]>0;n[c]=0;return f},isOverAxis:function(n,u,c){return n>u&&n<u+c},isOver:function(n,u,c,f,d,l){return a.ui.isOverAxis(n,c,d)&&
|
|
a.ui.isOverAxis(u,f,l)}}))})(jQuery);
|
|
(function(a,q){if(a.cleanData){var h=a.cleanData;a.cleanData=function(n){for(var u=0,c;(c=n[u])!=null;u++)try{a(c).triggerHandler("remove")}catch(f){}h(n)}}else{var b=a.fn.remove;a.fn.remove=function(n,u){return this.each(function(){u||(!n||a.filter(n,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(c){}});return b.call(a(this),n,u)})}}a.widget=function(n,u,c){var f=n.split(".")[0],d;n=n.split(".")[1];d=f+"-"+n;c||(c=u,u=a.Widget);a.expr[":"][d]=
|
|
function(l){return!!a.data(l,n)};a[f]=a[f]||{};a[f][n]=function(l,s){arguments.length&&this._createWidget(l,s)};u=new u;u.options=a.extend(true,{},u.options);a[f][n].prototype=a.extend(true,u,{namespace:f,widgetName:n,widgetEventPrefix:a[f][n].prototype.widgetEventPrefix||n,widgetBaseClass:d},c);a.widget.bridge(n,a[f][n])};a.widget.bridge=function(n,u){a.fn[n]=function(c){var f=typeof c=="string",d=Array.prototype.slice.call(arguments,1),l=this;c=!f&&d.length?a.extend.apply(null,[true,c].concat(d)):
|
|
c;if(f&&c.charAt(0)==="_")return l;f?this.each(function(){var s=a.data(this,n),C=s&&a.isFunction(s[c])?s[c].apply(s,d):s;if(C!==s&&C!==q){l=C;return false}}):this.each(function(){var s=a.data(this,n);s?s.option(c||{})._init():a.data(this,n,new u(c,this))});return l}};a.Widget=function(n,u){arguments.length&&this._createWidget(n,u)};a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(n,u){a.data(u,this.widgetName,this);this.element=a(u);this.options=
|
|
a.extend(true,{},this.options,this._getCreateOptions(),n);var c=this;this.element.bind("remove."+this.widgetName,function(){c.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
|
|
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(n,u){var c=n;if(arguments.length===0)return a.extend({},this.options);if(typeof n=="string"){if(u===q)return this.options[n];c={};c[n]=u}this._setOptions(c);return this},_setOptions:function(n){var u=this;a.each(n,function(c,f){u._setOption(c,f)});return this},_setOption:function(n,u){this.options[n]=u;n==="disabled"&&this.widget()[u?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
|
|
u);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(n,u,c){var f,d=this.options[n];c=c||{};u=a.Event(u);u.type=(n===this.widgetEventPrefix?n:this.widgetEventPrefix+n).toLowerCase();u.target=this.element[0];if(n=u.originalEvent)for(f in n)f in u||(u[f]=n[f]);this.element.trigger(u,c);return!(a.isFunction(d)&&d.call(this.element[0],u,c)===false||u.isDefaultPrevented())}}})(jQuery);
|
|
(function(a){var q=false;a(document).mouseup(function(){q=false});a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var h=this;this.element.bind("mousedown."+this.widgetName,function(b){return h._mouseDown(b)}).bind("click."+this.widgetName,function(b){if(true===a.data(b.target,h.widgetName+".preventClickEvent")){a.removeData(b.target,h.widgetName+".preventClickEvent");b.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
|
|
this.widgetName)},_mouseDown:function(h){if(!q){this._mouseStarted&&this._mouseUp(h);this._mouseDownEvent=h;var b=this,n=h.which==1,u=typeof this.options.cancel=="string"&&h.target.nodeName?a(h.target).closest(this.options.cancel).length:false;if(!n||u||!this._mouseCapture(h))return true;(this.mouseDelayMet=!this.options.delay)||(this._mouseDelayTimer=setTimeout(function(){b.mouseDelayMet=true},this.options.delay));if(this._mouseDistanceMet(h)&&this._mouseDelayMet(h)){this._mouseStarted=this._mouseStart(h)!==
|
|
false;if(!this._mouseStarted){h.preventDefault();return true}}true===a.data(h.target,this.widgetName+".preventClickEvent")&&a.removeData(h.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(c){return b._mouseMove(c)};this._mouseUpDelegate=function(c){return b._mouseUp(c)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);h.preventDefault();return q=true}},_mouseMove:function(h){if(a.browser.msie&&
|
|
!(document.documentMode>=9)&&!h.button)return this._mouseUp(h);if(this._mouseStarted){this._mouseDrag(h);return h.preventDefault()}this._mouseDistanceMet(h)&&this._mouseDelayMet(h)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,h)!==false,this._mouseStarted?this._mouseDrag(h):this._mouseUp(h));return!this._mouseStarted},_mouseUp:function(h){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);this._mouseStarted&&
|
|
(this._mouseStarted=false,h.target==this._mouseDownEvent.target&&a.data(h.target,this.widgetName+".preventClickEvent",true),this._mouseStop(h));return false},_mouseDistanceMet:function(h){return Math.max(Math.abs(this._mouseDownEvent.pageX-h.pageX),Math.abs(this._mouseDownEvent.pageY-h.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
|
|
(function(a){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){this.options.helper=="original"&&
|
|
!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative");this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(q){var h=this.options;
|
|
if(this.helper||h.disabled||a(q.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(q);if(!this.handle)return false;h.iframeFix&&a(h.iframeFix===true?"iframe":h.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(a(this).offset()).appendTo("body")});return true},_mouseStart:function(q){var h=this.options;this.helper=
|
|
this._createHelper(q);this._cacheHelperProportions();a.ui.ddmanager&&(a.ui.ddmanager.current=this);this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};a.extend(this.offset,{click:{left:q.pageX-this.offset.left,top:q.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
|
|
this.originalPosition=this.position=this._generatePosition(q);this.originalPageX=q.pageX;this.originalPageY=q.pageY;h.cursorAt&&this._adjustOffsetFromHelper(h.cursorAt);h.containment&&this._setContainment();if(this._trigger("start",q)===false){this._clear();return false}this._cacheHelperProportions();a.ui.ddmanager&&!h.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,q);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(q,true);a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,q);return true},
|
|
_mouseDrag:function(q,h){this.position=this._generatePosition(q);this.positionAbs=this._convertPositionTo("absolute");if(!h){var b=this._uiHash();if(this._trigger("drag",q,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";a.ui.ddmanager&&a.ui.ddmanager.drag(this,q);return false},_mouseStop:function(q){var h=
|
|
false;a.ui.ddmanager&&!this.options.dropBehaviour&&(h=a.ui.ddmanager.drop(this,q));this.dropped&&(h=this.dropped,this.dropped=false);if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!h||this.options.revert=="valid"&&h||this.options.revert===true||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,h)){var b=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),
|
|
function(){b._trigger("stop",q)!==false&&b._clear()})}else this._trigger("stop",q)!==false&&this._clear();return false},_mouseUp:function(q){this.options.iframeFix===true&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,q);return a.ui.mouse.prototype._mouseUp.call(this,q)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(q){var h=!this.options.handle||
|
|
!a(this.options.handle,this.element).length?true:false;a(this.options.handle,this.element).find("*").andSelf().each(function(){this==q.target&&(h=true)});return h},_createHelper:function(q){var h=this.options;q=a.isFunction(h.helper)?a(h.helper.apply(this.element[0],[q])):h.helper=="clone"?this.element.clone().removeAttr("id"):this.element;q.parents("body").length||q.appendTo(h.appendTo=="parent"?this.element[0].parentNode:h.appendTo);q[0]!=this.element[0]&&!/(fixed|absolute)/.test(q.css("position"))&&
|
|
q.css("position","absolute");return q},_adjustOffsetFromHelper:function(q){typeof q=="string"&&(q=q.split(" "));a.isArray(q)&&(q={left:+q[0],top:+q[1]||0});"left"in q&&(this.offset.click.left=q.left+this.margins.left);"right"in q&&(this.offset.click.left=this.helperProportions.width-q.right+this.margins.left);"top"in q&&(this.offset.click.top=q.top+this.margins.top);"bottom"in q&&(this.offset.click.top=this.helperProportions.height-q.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=
|
|
this.helper.offsetParent();var q=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(q.left+=this.scrollParent.scrollLeft(),q.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)q={top:0,left:0};return{top:q.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:q.left+(parseInt(this.offsetParent.css("borderLeftWidth"),
|
|
10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var q=this.element.position();return{top:q.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:q.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),
|
|
10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var q=this.options;q.containment=="parent"&&(q.containment=this.helper[0].parentNode);if(q.containment=="document"||q.containment=="window")this.containment=[q.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,q.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,
|
|
(q.containment=="document"?0:a(window).scrollLeft())+a(q.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(q.containment=="document"?0:a(window).scrollTop())+(a(q.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(q.containment)&&q.containment.constructor!=Array){q=a(q.containment);var h=q[0];if(h){q.offset();var b=a(h).css("overflow")!=
|
|
"hidden";this.containment=[(parseInt(a(h).css("borderLeftWidth"),10)||0)+(parseInt(a(h).css("paddingLeft"),10)||0),(parseInt(a(h).css("borderTopWidth"),10)||0)+(parseInt(a(h).css("paddingTop"),10)||0),(b?Math.max(h.scrollWidth,h.offsetWidth):h.offsetWidth)-(parseInt(a(h).css("borderLeftWidth"),10)||0)-(parseInt(a(h).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(b?Math.max(h.scrollHeight,h.offsetHeight):h.offsetHeight)-(parseInt(a(h).css("borderTopWidth"),
|
|
10)||0)-(parseInt(a(h).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=q}}else q.containment.constructor==Array&&(this.containment=q.containment)},_convertPositionTo:function(q,h){h||(h=this.position);var b=q=="absolute"?1:-1,n=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,u=/(html|body)/i.test(n[0].tagName);return{top:h.top+
|
|
this.offset.relative.top*b+this.offset.parent.top*b-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():u?0:n.scrollTop())*b),left:h.left+this.offset.relative.left*b+this.offset.parent.left*b-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():u?0:n.scrollLeft())*b)}},_generatePosition:function(q){var h=this.options,b=this.cssPosition=="absolute"&&
|
|
(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,n=/(html|body)/i.test(b[0].tagName),u=q.pageX,c=q.pageY;if(this.originalPosition){var f;if(this.containment){if(this.relative_container){f=this.relative_container.offset();f=[this.containment[0]+f.left,this.containment[1]+f.top,this.containment[2]+f.left,this.containment[3]+f.top]}else f=this.containment;q.pageX-this.offset.click.left<f[0]&&(u=f[0]+this.offset.click.left);
|
|
q.pageY-this.offset.click.top<f[1]&&(c=f[1]+this.offset.click.top);q.pageX-this.offset.click.left>f[2]&&(u=f[2]+this.offset.click.left);q.pageY-this.offset.click.top>f[3]&&(c=f[3]+this.offset.click.top)}if(h.grid){c=h.grid[1]?this.originalPageY+Math.round((c-this.originalPageY)/h.grid[1])*h.grid[1]:this.originalPageY;c=f?c-this.offset.click.top<f[1]||c-this.offset.click.top>f[3]?c-this.offset.click.top<f[1]?c+h.grid[1]:c-h.grid[1]:c:c;u=h.grid[0]?this.originalPageX+Math.round((u-this.originalPageX)/
|
|
h.grid[0])*h.grid[0]:this.originalPageX;u=f?u-this.offset.click.left<f[0]||u-this.offset.click.left>f[2]?u-this.offset.click.left<f[0]?u+h.grid[0]:u-h.grid[0]:u:u}}return{top:c-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():n?0:b.scrollTop()),left:u-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&a.browser.version<
|
|
526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():n?0:b.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(q,h,b){b=b||this._uiHash();a.ui.plugin.call(this,q,[h,b]);q=="drag"&&(this.positionAbs=this._convertPositionTo("absolute"));return a.Widget.prototype._trigger.call(this,q,h,
|
|
b)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});a.extend(a.ui.draggable,{version:"1.8.17"});a.ui.plugin.add("draggable","connectToSortable",{start:function(q,h){var b=a(this).data("draggable"),n=b.options,u=a.extend({},h,{item:b.element});b.sortables=[];a(n.connectToSortable).each(function(){var c=a.data(this,"sortable");c&&!c.options.disabled&&(b.sortables.push({instance:c,shouldRevert:c.options.revert}),
|
|
c.refreshPositions(),c._trigger("activate",q,u))})},stop:function(q,h){var b=a(this).data("draggable"),n=a.extend({},h,{item:b.element});a.each(b.sortables,function(){this.instance.isOver?(this.instance.isOver=0,b.cancelHelperRemoval=true,this.instance.cancelHelperRemoval=false,this.shouldRevert&&(this.instance.options.revert=true),this.instance._mouseStop(q),this.instance.options.helper=this.instance.options._helper,b.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):
|
|
(this.instance.cancelHelperRemoval=false,this.instance._trigger("deactivate",q,n))})},drag:function(q,h){var b=a(this).data("draggable"),n=this;a.each(b.sortables,function(){this.instance.positionAbs=b.positionAbs;this.instance.helperProportions=b.helperProportions;this.instance.offset.click=b.offset.click;this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(n).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",
|
|
true),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return h.helper[0]},q.target=this.instance.currentItem[0],this.instance._mouseCapture(q,true),this.instance._mouseStart(q,true,true),this.instance.offset.click.top=b.offset.click.top,this.instance.offset.click.left=b.offset.click.left,this.instance.offset.parent.left-=b.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=b.offset.parent.top-this.instance.offset.parent.top,
|
|
b._trigger("toSortable",q),b.dropped=this.instance.element,b.currentItem=b.element,this.instance.fromOutside=b),this.instance.currentItem&&this.instance._mouseDrag(q)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=true,this.instance.options.revert=false,this.instance._trigger("out",q,this.instance._uiHash(this.instance)),this.instance._mouseStop(q,true),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&
|
|
this.instance.placeholder.remove(),b._trigger("fromSortable",q),b.dropped=false)})}});a.ui.plugin.add("draggable","cursor",{start:function(){var q=a("body"),h=a(this).data("draggable").options;q.css("cursor")&&(h._cursor=q.css("cursor"));q.css("cursor",h.cursor)},stop:function(){var q=a(this).data("draggable").options;q._cursor&&a("body").css("cursor",q._cursor)}});a.ui.plugin.add("draggable","opacity",{start:function(q,h){var b=a(h.helper),n=a(this).data("draggable").options;b.css("opacity")&&(n._opacity=
|
|
b.css("opacity"));b.css("opacity",n.opacity)},stop:function(q,h){var b=a(this).data("draggable").options;b._opacity&&a(h.helper).css("opacity",b._opacity)}});a.ui.plugin.add("draggable","scroll",{start:function(){var q=a(this).data("draggable");q.scrollParent[0]!=document&&q.scrollParent[0].tagName!="HTML"&&(q.overflowOffset=q.scrollParent.offset())},drag:function(q){var h=a(this).data("draggable"),b=h.options,n=false;if(h.scrollParent[0]!=document&&h.scrollParent[0].tagName!="HTML"){if(!b.axis||
|
|
b.axis!="x")h.overflowOffset.top+h.scrollParent[0].offsetHeight-q.pageY<b.scrollSensitivity?h.scrollParent[0].scrollTop=n=h.scrollParent[0].scrollTop+b.scrollSpeed:q.pageY-h.overflowOffset.top<b.scrollSensitivity&&(h.scrollParent[0].scrollTop=n=h.scrollParent[0].scrollTop-b.scrollSpeed);if(!b.axis||b.axis!="y")h.overflowOffset.left+h.scrollParent[0].offsetWidth-q.pageX<b.scrollSensitivity?h.scrollParent[0].scrollLeft=n=h.scrollParent[0].scrollLeft+b.scrollSpeed:q.pageX-h.overflowOffset.left<b.scrollSensitivity&&
|
|
(h.scrollParent[0].scrollLeft=n=h.scrollParent[0].scrollLeft-b.scrollSpeed)}else{if(!b.axis||b.axis!="x")q.pageY-a(document).scrollTop()<b.scrollSensitivity?n=a(document).scrollTop(a(document).scrollTop()-b.scrollSpeed):a(window).height()-(q.pageY-a(document).scrollTop())<b.scrollSensitivity&&(n=a(document).scrollTop(a(document).scrollTop()+b.scrollSpeed));if(!b.axis||b.axis!="y")q.pageX-a(document).scrollLeft()<b.scrollSensitivity?n=a(document).scrollLeft(a(document).scrollLeft()-b.scrollSpeed):
|
|
a(window).width()-(q.pageX-a(document).scrollLeft())<b.scrollSensitivity&&(n=a(document).scrollLeft(a(document).scrollLeft()+b.scrollSpeed))}n!==false&&a.ui.ddmanager&&!b.dropBehaviour&&a.ui.ddmanager.prepareOffsets(h,q)}});a.ui.plugin.add("draggable","snap",{start:function(){var q=a(this).data("draggable"),h=q.options;q.snapElements=[];a(h.snap.constructor!=String?h.snap.items||":data(draggable)":h.snap).each(function(){var b=a(this),n=b.offset();this!=q.element[0]&&q.snapElements.push({item:this,
|
|
width:b.outerWidth(),height:b.outerHeight(),top:n.top,left:n.left})})},drag:function(q,h){for(var b=a(this).data("draggable"),n=b.options,u=n.snapTolerance,c=h.offset.left,f=c+b.helperProportions.width,d=h.offset.top,l=d+b.helperProportions.height,s=b.snapElements.length-1;s>=0;s--){var C=b.snapElements[s].left,p=C+b.snapElements[s].width,L=b.snapElements[s].top,R=L+b.snapElements[s].height;if(C-u<c&&c<p+u&&L-u<d&&d<R+u||C-u<c&&c<p+u&&L-u<l&&l<R+u||C-u<f&&f<p+u&&L-u<d&&d<R+u||C-u<f&&f<p+u&&L-u<l&&
|
|
l<R+u){if(n.snapMode!="inner"){var O=Math.abs(L-l)<=u,K=Math.abs(R-d)<=u,P=Math.abs(C-f)<=u,T=Math.abs(p-c)<=u;O&&(h.position.top=b._convertPositionTo("relative",{top:L-b.helperProportions.height,left:0}).top-b.margins.top);K&&(h.position.top=b._convertPositionTo("relative",{top:R,left:0}).top-b.margins.top);P&&(h.position.left=b._convertPositionTo("relative",{top:0,left:C-b.helperProportions.width}).left-b.margins.left);T&&(h.position.left=b._convertPositionTo("relative",{top:0,left:p}).left-b.margins.left)}var M=
|
|
O||K||P||T;if(n.snapMode!="outer"){O=Math.abs(L-d)<=u;K=Math.abs(R-l)<=u;P=Math.abs(C-c)<=u;T=Math.abs(p-f)<=u;O&&(h.position.top=b._convertPositionTo("relative",{top:L,left:0}).top-b.margins.top);K&&(h.position.top=b._convertPositionTo("relative",{top:R-b.helperProportions.height,left:0}).top-b.margins.top);P&&(h.position.left=b._convertPositionTo("relative",{top:0,left:C}).left-b.margins.left);T&&(h.position.left=b._convertPositionTo("relative",{top:0,left:p-b.helperProportions.width}).left-b.margins.left)}!b.snapElements[s].snapping&&
|
|
(O||K||P||T||M)&&b.options.snap.snap&&b.options.snap.snap.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[s].item}));b.snapElements[s].snapping=O||K||P||T||M}else{b.snapElements[s].snapping&&b.options.snap.release&&b.options.snap.release.call(b.element,q,a.extend(b._uiHash(),{snapItem:b.snapElements[s].item}));b.snapElements[s].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var q=a(this).data("draggable").options;q=a.makeArray(a(q.stack)).sort(function(b,
|
|
n){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(n).css("zIndex"),10)||0)});if(q.length){var h=parseInt(q[0].style.zIndex)||0;a(q).each(function(b){this.style.zIndex=h+b});this[0].style.zIndex=h+q.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(q,h){var b=a(h.helper),n=a(this).data("draggable").options;b.css("zIndex")&&(n._zIndex=b.css("zIndex"));b.css("zIndex",n.zIndex)},stop:function(q,h){var b=a(this).data("draggable").options;b._zIndex&&a(h.helper).css("zIndex",b._zIndex)}})})(jQuery);
|
|
(function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var q=this,h=this.options,b=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),n=h.values&&h.values.length||1,u=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
|
|
this.orientation+" ui-widget ui-widget-content ui-corner-all"+(h.disabled?" ui-slider-disabled ui-disabled":""));this.range=a([]);h.range&&(h.range===true&&(h.values||(h.values=[this._valueMin(),this._valueMin()]),h.values.length&&h.values.length!==2&&(h.values=[h.values[0],h.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(h.range==="min"||h.range==="max"?" ui-slider-range-"+h.range:"")));for(var c=b.length;c<n;c+=1)u.push("<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>");
|
|
this.handles=b.add(a(u.join("")).appendTo(q.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(f){f.preventDefault()}).hover(function(){h.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){h.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")});this.handles.each(function(f){a(this).data("index.ui-slider-handle",
|
|
f)});this.handles.keydown(function(f){var d=true,l=a(this).data("index.ui-slider-handle"),s,C,p;if(!q.options.disabled){switch(f.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:d=false;if(!q._keySliding){q._keySliding=true;a(this).addClass("ui-state-active");s=q._start(f,l);if(s===false)return}}s=q.options.step;q.options.values&&q.options.values.length?
|
|
C=p=q.values(l):C=p=q.value();switch(f.keyCode){case a.ui.keyCode.HOME:p=q._valueMin();break;case a.ui.keyCode.END:p=q._valueMax();break;case a.ui.keyCode.PAGE_UP:p=q._trimAlignValue(C+(q._valueMax()-q._valueMin())/5);break;case a.ui.keyCode.PAGE_DOWN:p=q._trimAlignValue(C-(q._valueMax()-q._valueMin())/5);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(C===q._valueMax())return;p=q._trimAlignValue(C+s);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(C===q._valueMin())return;p=q._trimAlignValue(C-
|
|
s)}q._slide(f,l,p);return d}}).keyup(function(f){var d=a(this).data("index.ui-slider-handle");q._keySliding&&(q._keySliding=false,q._stop(f,d),q._change(f,d),a(this).removeClass("ui-state-active"))});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy();
|
|
return this},_mouseCapture:function(q){var h=this.options,b,n,u,c,f;if(h.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();b=this._normValueFromMouse({x:q.pageX,y:q.pageY});n=this._valueMax()-this._valueMin()+1;c=this;this.handles.each(function(d){var l=Math.abs(b-c.values(d));n>l&&(n=l,u=a(this),f=d)});h.range===true&&this.values(1)===h.min&&(f+=1,u=a(this.handles[f]));if(this._start(q,f)===false)return false;
|
|
this._mouseSliding=true;c._handleIndex=f;u.addClass("ui-state-active").focus();h=u.offset();this._clickOffset=!a(q.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:q.pageX-h.left-u.width()/2,top:q.pageY-h.top-u.height()/2-(parseInt(u.css("borderTopWidth"),10)||0)-(parseInt(u.css("borderBottomWidth"),10)||0)+(parseInt(u.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(q,f,b);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(q){var h=
|
|
this._normValueFromMouse({x:q.pageX,y:q.pageY});this._slide(q,this._handleIndex,h);return false},_mouseStop:function(q){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(q,this._handleIndex);this._change(q,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(q){var h,b;this.orientation==="horizontal"?
|
|
(h=this.elementSize.width,b=q.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(h=this.elementSize.height,b=q.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0));q=b/h;q>1&&(q=1);q<0&&(q=0);this.orientation==="vertical"&&(q=1-q);h=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+q*h)},_start:function(q,h){var b={handle:this.handles[h],value:this.value()};this.options.values&&this.options.values.length&&(b.value=this.values(h),
|
|
b.values=this.values());return this._trigger("start",q,b)},_slide:function(q,h,b){var n,u,c;this.options.values&&this.options.values.length?(n=this.values(h?0:1),this.options.values.length===2&&this.options.range===true&&(h===0&&b>n||h===1&&b<n)&&(b=n),b!==this.values(h)&&(u=this.values(),u[h]=b,c=this._trigger("slide",q,{handle:this.handles[h],value:b,values:u}),this.values(h?0:1),c!==false&&this.values(h,b,true))):b!==this.value()&&(c=this._trigger("slide",q,{handle:this.handles[h],value:b}),c!==
|
|
false&&this.value(b))},_stop:function(q,h){var b={handle:this.handles[h],value:this.value()};this.options.values&&this.options.values.length&&(b.value=this.values(h),b.values=this.values());this._trigger("stop",q,b)},_change:function(q,h){if(!this._keySliding&&!this._mouseSliding){var b={handle:this.handles[h],value:this.value()};this.options.values&&this.options.values.length&&(b.value=this.values(h),b.values=this.values());this._trigger("change",q,b)}},value:function(q){if(arguments.length){this.options.value=
|
|
this._trimAlignValue(q);this._refreshValue();this._change(null,0)}else return this._value()},values:function(q,h){var b,n,u;if(arguments.length>1){this.options.values[q]=this._trimAlignValue(h);this._refreshValue();this._change(null,q)}else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(q):this.value();b=this.options.values;n=arguments[0];for(u=0;u<b.length;u+=1){b[u]=this._trimAlignValue(n[u]);this._change(null,
|
|
u)}this._refreshValue()}},_setOption:function(q,h){var b,n=0;a.isArray(this.options.values)&&(n=this.options.values.length);a.Widget.prototype._setOption.apply(this,arguments);switch(q){case "disabled":h?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",true),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",false),this.element.removeClass("ui-disabled"));break;case "orientation":this._detectOrientation();
|
|
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(b=0;b<n;b+=1)this._change(null,b);this._animateOff=false}},_value:function(){var q=this.options.value;return q=this._trimAlignValue(q)},_values:function(q){var h,b;if(arguments.length){h=this.options.values[q];
|
|
return h=this._trimAlignValue(h)}h=this.options.values.slice();for(b=0;b<h.length;b+=1)h[b]=this._trimAlignValue(h[b]);return h},_trimAlignValue:function(q){if(q<=this._valueMin())return this._valueMin();if(q>=this._valueMax())return this._valueMax();var h=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%h;q=q-b;Math.abs(b)*2>=h&&(q+=b>0?h:-h);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q=
|
|
this.options.range,h=this.options,b=this,n=this._animateOff?false:h.animate,u,c={},f,d,l,s;this.options.values&&this.options.values.length?this.handles.each(function(C){u=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;c[b.orientation==="horizontal"?"left":"bottom"]=u+"%";a(this).stop(1,1)[n?"animate":"css"](c,h.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[n?"animate":"css"]({left:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({width:u-
|
|
f+"%"},{queue:false,duration:h.animate})):(C===0&&b.range.stop(1,1)[n?"animate":"css"]({bottom:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({height:u-f+"%"},{queue:false,duration:h.animate})));f=u}):(d=this.value(),l=this._valueMin(),s=this._valueMax(),u=s!==l?(d-l)/(s-l)*100:0,c[b.orientation==="horizontal"?"left":"bottom"]=u+"%",this.handle.stop(1,1)[n?"animate":"css"](c,h.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[n?"animate":"css"]({width:u+"%"},h.animate),
|
|
q==="max"&&this.orientation==="horizontal"&&this.range[n?"animate":"css"]({width:100-u+"%"},{queue:false,duration:h.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[n?"animate":"css"]({height:u+"%"},h.animate),q==="max"&&this.orientation==="vertical"&&this.range[n?"animate":"css"]({height:100-u+"%"},{queue:false,duration:h.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(c,f){if(f===undefined)f=0;return Math.round(c*Math.pow(10,f))/Math.pow(10,f)};var q=function(c,f){var d=this,l=c.find("img:first"),s=0,C=100,p=100,L=0,R=100,O=100,K=0,P=0,T,M,ha=[],na=function(U){for(var Y=0;Y<ha.length;Y++)ha[Y].call(d,d,U)},fa=function(U){var Y=c.offset();T={l:Y.left|0,t:Y.top|0};clearTimeout(M);M=setTimeout(function(){ra.call(d,U)},0);a(document).bind("mousemove",aa).bind("mouseup",V);U.preventDefault()},aa=function(U){clearTimeout(M);M=setTimeout(function(){ra.call(d,
|
|
U)},0);U.stopPropagation();U.preventDefault();return false},V=function(U){a(document).unbind("mouseup",V).unbind("mousemove",aa);U.stopPropagation();U.preventDefault();return false},ra=function(U){var Y=U.pageX-T.l;U=U.pageY-T.t;var oa=c.w,pa=c.h;if(Y<0)Y=0;else if(Y>oa)Y=oa;if(U<0)U=0;else if(U>pa)U=pa;ia.call(d,"xy",{x:Y/oa*p+s,y:U/pa*O+L})},ia=function(U,Y,oa){if(Y===undefined){if(U===undefined||U==null)U="xy";switch(U.toLowerCase()){case "x":return K;case "y":return P;default:return{x:K,y:P}}}if(!(oa!=
|
|
null&&oa==d)){var pa=false,la,ma;if(U==null)U="xy";switch(U.toLowerCase()){case "x":la=Y&&(Y.x&&Y.x|0||Y|0)||0;break;case "y":ma=Y&&(Y.y&&Y.y|0||Y|0)||0;break;default:la=Y&&Y.x&&Y.x|0||0;ma=Y&&Y.y&&Y.y|0||0}if(la!=null){if(la<s)la=s;else if(la>C)la=C;if(K!=la){K=la;pa=true}}if(ma!=null){if(ma<L)ma=L;else if(ma>R)ma=R;if(P!=ma){P=ma;pa=true}}pa&&na.call(d,oa||d)}},da=function(U){a.isFunction(U)&&ha.push(U)};a.extend(true,d,{val:ia,range:function(U,Y){if(Y===undefined){if(U===undefined||U==null)U="all";
|
|
switch(U.toLowerCase()){case "minx":return s;case "maxx":return C;case "rangex":return{minX:s,maxX:C,rangeX:p};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:O};default:return{minX:s,maxX:C,rangeX:p,minY:L,maxY:R,rangeY:O}}}var oa,pa,la,ma;if(U==null)U="all";switch(U.toLowerCase()){case "minx":oa=Y&&(Y.minX&&Y.minX|0||Y|0)||0;break;case "maxx":pa=Y&&(Y.maxX&&Y.maxX|0||Y|0)||0;break;case "rangex":oa=Y&&Y.minX&&Y.minX|0||0;pa=Y&&Y.maxX&&Y.maxX|0||0;break;case "miny":la=
|
|
Y&&(Y.minY&&Y.minY|0||Y|0)||0;break;case "maxy":ma=Y&&(Y.maxY&&Y.maxY|0||Y|0)||0;break;case "rangey":la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0;break;default:oa=Y&&Y.minX&&Y.minX|0||0;pa=Y&&Y.maxX&&Y.maxX|0||0;la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0}if(oa!=null&&s!=oa){s=oa;p=C-s}if(pa!=null&&C!=pa){C=pa;p=C-s}if(la!=null&&L!=la){L=la;O=R-L}if(ma!=null&&R!=ma){R=ma;O=R-L}},bind:da,unbind:function(U){if(a.isFunction(U))for(var Y;(Y=a.inArray(U,ha))!=-1;)ha.splice(Y,1)},destroy:function(){a(document).unbind("mouseup",
|
|
V).unbind("mousemove",aa);c.unbind("mousedown",fa);ha=l=c=null}});l.src=f.arrow&&f.arrow.image;l.w=f.arrow&&f.arrow.width||l.width();l.h=f.arrow&&f.arrow.height||l.height();c.w=f.map&&f.map.width||c.width();c.h=f.map&&f.map.height||c.height();c.bind("mousedown",fa);da.call(d,function(){var U=0,Y=0,oa=c.w,pa=c.h,la=l.w,ma=l.h;setTimeout(function(){if(p>0)U=K==C?oa:K/p*oa|0;if(O>0)Y=P==R?pa:P/O*pa|0;if(la>=oa)U=(oa>>1)-(la>>1);else U-=la>>1;if(ma>=pa)Y=(pa>>1)-(ma>>1);else Y-=ma>>1;l.css({left:U+"px",
|
|
top:Y+"px"})},0)})},h=function(c,f,d,l){var s=this;c=c.find("td.Text input");var C=c.eq(3),p=c.eq(4),L=c.eq(5),R=c.length>7?c.eq(6):null,O=c.eq(0),K=c.eq(1),P=c.eq(2),T=c.eq(c.length>7?7:6),M=c.length>7?c.eq(8):null,ha=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!aa(ia))return ia;switch(ia.target){case C.get(0):switch(ia.keyCode){case 38:C.val(V.call(s,(C.val()<<0)+1,0,255));f.val("r",C.val(),ia.target);return false;case 40:C.val(V.call(s,
|
|
(C.val()<<0)-1,0,255));f.val("r",C.val(),ia.target);return false}break;case p.get(0):switch(ia.keyCode){case 38:p.val(V.call(s,(p.val()<<0)+1,0,255));f.val("g",p.val(),ia.target);return false;case 40:p.val(V.call(s,(p.val()<<0)-1,0,255));f.val("g",p.val(),ia.target);return false}break;case L.get(0):switch(ia.keyCode){case 38:L.val(V.call(s,(L.val()<<0)+1,0,255));f.val("b",L.val(),ia.target);return false;case 40:L.val(V.call(s,(L.val()<<0)-1,0,255));f.val("b",L.val(),ia.target);return false}break;
|
|
case R&&R.get(0):switch(ia.keyCode){case 38:R.val(V.call(s,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false;case 40:R.val(V.call(s,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false}break;case O.get(0):switch(ia.keyCode){case 38:O.val(V.call(s,(O.val()<<0)+1,0,360));f.val("h",O.val(),ia.target);return false;case 40:O.val(V.call(s,(O.val()<<0)-1,0,360));f.val("h",O.val(),ia.target);return false}break;case K.get(0):switch(ia.keyCode){case 38:K.val(V.call(s,
|
|
(K.val()<<0)+1,0,100));f.val("s",K.val(),ia.target);return false;case 40:K.val(V.call(s,(K.val()<<0)-1,0,100));f.val("s",K.val(),ia.target);return false}break;case P.get(0):switch(ia.keyCode){case 38:P.val(V.call(s,(P.val()<<0)+1,0,100));f.val("v",P.val(),ia.target);return false;case 40:P.val(V.call(s,(P.val()<<0)-1,0,100));f.val("v",P.val(),ia.target);return false}}}},na=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!aa(ia))return ia;switch(ia.target){case C.get(0):C.val(V.call(s,
|
|
C.val(),0,255));f.val("r",C.val(),ia.target);break;case p.get(0):p.val(V.call(s,p.val(),0,255));f.val("g",p.val(),ia.target);break;case L.get(0):L.val(V.call(s,L.val(),0,255));f.val("b",L.val(),ia.target);break;case R&&R.get(0):R.val(V.call(s,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);break;case O.get(0):O.val(V.call(s,O.val(),0,360));f.val("h",O.val(),ia.target);break;case K.get(0):K.val(V.call(s,K.val(),0,100));f.val("s",K.val(),ia.target);break;case P.get(0):P.val(V.call(s,
|
|
P.val(),0,100));f.val("v",P.val(),ia.target);break;case T.get(0):T.val(T.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));d&&d.val(T.val());f.val("hex",T.val()!=""?T.val():null,ia.target);break;case d&&d.get(0):d.val(d.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));T.val(d.val());f.val("hex",d.val()!=""?d.val():null,ia.target);break;case M&&M.get(0):M.val(M.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));f.val("a",M.val()!=null?parseInt(M.val(),16):
|
|
null,ia.target)}}},fa=function(ia){if(f.val()!=null)switch(ia.target){case C.get(0):C.val(f.val("r"));break;case p.get(0):p.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case R&&R.get(0):R.val(Math.precision(f.val("a")*100/255,l));break;case O.get(0):O.val(f.val("h"));break;case K.get(0):K.val(f.val("s"));break;case P.get(0):P.val(f.val("v"));break;case T.get(0):case d&&d.get(0):T.val(f.val("hex"));d&&d.val(f.val("hex"));break;case M&&M.get(0):M.val(f.val("ahex").substring(6))}},aa=
|
|
function(ia){switch(ia.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ia.ctrlKey)return false}return true},V=function(ia,da,U){if(ia==""||isNaN(ia))return da;if(ia>U)return U;if(ia<da)return da;return ia},ra=function(ia,da){var U=ia.val("all");if(da!=C.get(0))C.val(U!=null?U.r:"");if(da!=p.get(0))p.val(U!=null?U.g:"");if(da!=L.get(0))L.val(U!=null?U.b:"");if(R&&da!=R.get(0))R.val(U!=null?Math.precision(U.a*100/255,l):"");if(da!=O.get(0))O.val(U!=
|
|
null?U.h:"");if(da!=K.get(0))K.val(U!=null?U.s:"");if(da!=P.get(0))P.val(U!=null?U.v:"");if(da!=T.get(0)&&(d&&da!=d.get(0)||!d))T.val(U!=null?U.hex:"");if(d&&da!=d.get(0)&&da!=T.get(0))d.val(U!=null?U.hex:"");if(M&&da!=M.get(0))M.val(U!=null?U.ahex.substring(6):"")};a.extend(true,s,{destroy:function(){C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).unbind("keyup",na).unbind("blur",fa);C.add(p).add(L).add(R).add(O).add(K).add(P).unbind("keydown",ha);f.unbind(ra);M=T=P=K=O=R=L=p=C=
|
|
null}});C.add(p).add(L).add(R).add(O).add(K).add(P).add(T).add(d).add(M).bind("keyup",na).bind("blur",fa);C.add(p).add(L).add(R).add(O).add(K).add(P).bind("keydown",ha);f.bind(ra)};a.jPicker={List:[],Color:function(c){var f=this,d,l,s,C,p,L,R,O=[],K=function(T){for(var M=0;M<O.length;M++)O[M].call(f,f,T)},P=function(T,M,ha){if(M===undefined){if(T===undefined||T==null||T=="")T="all";if(d==null)return null;switch(T.toLowerCase()){case "ahex":return u.rgbaToHex({r:d,g:l,b:s,a:C});case "hex":return P("ahex").substring(0,
|
|
6);case "all":return{r:d,g:l,b:s,a:C,h:p,s:L,v:R,hex:P.call(f,"hex"),ahex:P.call(f,"ahex")};default:M={};for(var na=0;na<T.length;na++)switch(T.charAt(na)){case "r":if(T.length==1)M=d;else M.r=d;break;case "g":if(T.length==1)M=l;else M.g=l;break;case "b":if(T.length==1)M=s;else M.b=s;break;case "a":if(T.length==1)M=C;else M.a=C;break;case "h":if(T.length==1)M=p;else M.h=p;break;case "s":if(T.length==1)M=L;else M.s=L;break;case "v":if(T.length==1)M=R;else M.v=R}return M=={}?P.call(f,"all"):M}}if(!(ha!=
|
|
null&&ha==f)){var fa=false;if(T==null)T="";if(M==null){if(d!=null){d=null;fa=true}if(l!=null){l=null;fa=true}if(s!=null){s=null;fa=true}if(C!=null){C=null;fa=true}if(p!=null){p=null;fa=true}if(L!=null){L=null;fa=true}if(R!=null){R=null;fa=true}fa&&K.call(f,ha||f)}else switch(T.toLowerCase()){case "ahex":case "hex":M=u.hexToRgba(M&&(M.ahex||M.hex)||M||"00000000");P.call(f,"rgba",{r:M.r,g:M.g,b:M.b,a:T=="ahex"?M.a:C!=null?C:255},ha);break;default:if(M&&(M.ahex!=null||M.hex!=null)){P.call(f,"ahex",M.ahex||
|
|
M.hex||"00000000",ha);break}var aa={},V=false,ra=false;if(M.r!==undefined&&!T.indexOf("r")==-1)T+="r";if(M.g!==undefined&&!T.indexOf("g")==-1)T+="g";if(M.b!==undefined&&!T.indexOf("b")==-1)T+="b";if(M.a!==undefined&&!T.indexOf("a")==-1)T+="a";if(M.h!==undefined&&!T.indexOf("h")==-1)T+="h";if(M.s!==undefined&&!T.indexOf("s")==-1)T+="s";if(M.v!==undefined&&!T.indexOf("v")==-1)T+="v";for(na=0;na<T.length;na++)switch(T.charAt(na)){case "r":if(ra)continue;V=true;aa.r=M&&M.r&&M.r|0||M&&M|0||0;if(aa.r<0)aa.r=
|
|
0;else if(aa.r>255)aa.r=255;if(d!=aa.r){d=aa.r;fa=true}break;case "g":if(ra)continue;V=true;aa.g=M&&M.g&&M.g|0||M&&M|0||0;if(aa.g<0)aa.g=0;else if(aa.g>255)aa.g=255;if(l!=aa.g){l=aa.g;fa=true}break;case "b":if(ra)continue;V=true;aa.b=M&&M.b&&M.b|0||M&&M|0||0;if(aa.b<0)aa.b=0;else if(aa.b>255)aa.b=255;if(s!=aa.b){s=aa.b;fa=true}break;case "a":aa.a=M&&M.a!=null?M.a|0:M!=null?M|0:255;if(aa.a<0)aa.a=0;else if(aa.a>255)aa.a=255;if(C!=aa.a){C=aa.a;fa=true}break;case "h":if(V)continue;ra=true;aa.h=M&&M.h&&
|
|
M.h|0||M&&M|0||0;if(aa.h<0)aa.h=0;else if(aa.h>360)aa.h=360;if(p!=aa.h){p=aa.h;fa=true}break;case "s":if(V)continue;ra=true;aa.s=M&&M.s!=null?M.s|0:M!=null?M|0:100;if(aa.s<0)aa.s=0;else if(aa.s>100)aa.s=100;if(L!=aa.s){L=aa.s;fa=true}break;case "v":if(V)continue;ra=true;aa.v=M&&M.v!=null?M.v|0:M!=null?M|0:100;if(aa.v<0)aa.v=0;else if(aa.v>100)aa.v=100;if(R!=aa.v){R=aa.v;fa=true}}if(fa){if(V){d=d||0;l=l||0;s=s||0;M=u.rgbToHsv({r:d,g:l,b:s});p=M.h;L=M.s;R=M.v}else if(ra){p=p||0;L=L!=null?L:100;R=R!=
|
|
null?R:100;M=u.hsvToRgb({h:p,s:L,v:R});d=M.r;l=M.g;s=M.b}C=C!=null?C:255;K.call(f,ha||f)}}}};a.extend(true,f,{val:P,bind:function(T){a.isFunction(T)&&O.push(T)},unbind:function(T){if(a.isFunction(T))for(var M;(M=a.inArray(T,O))!=-1;)O.splice(M,1)},destroy:function(){O=null}});if(c)if(c.ahex!=null)P("ahex",c);else if(c.hex!=null)P((c.a!=null?"a":"")+"hex",c.a!=null?{ahex:c.hex+u.intToHex(c.a)}:c);else if(c.r!=null&&c.g!=null&&c.b!=null)P("rgb"+(c.a!=null?"a":""),c);else if(c.h!=null&&c.s!=null&&c.v!=
|
|
null)P("hsv"+(c.a!=null?"a":""),c)},ColorMethods:{hexToRgba:function(c){c=this.validateHex(c);if(c=="")return{r:null,g:null,b:null,a:null};var f="00",d="00",l="00",s="255";if(c.length==6)c+="ff";if(c.length>6){f=c.substring(0,2);d=c.substring(2,4);l=c.substring(4,6);s=c.substring(6,c.length)}else{if(c.length>4){f=c.substring(4,c.length);c=c.substring(0,4)}if(c.length>2){d=c.substring(2,c.length);c=c.substring(0,2)}if(c.length>0)l=c.substring(0,c.length)}return{r:this.hexToInt(f),g:this.hexToInt(d),
|
|
b:this.hexToInt(l),a:this.hexToInt(s)}},validateHex:function(c){if(typeof c=="object")return"";c=c.toLowerCase().replace(/[^a-f0-9]/g,"");if(c.length>8)c=c.substring(0,8);return c},rgbaToHex:function(c){return this.intToHex(c.r)+this.intToHex(c.g)+this.intToHex(c.b)+this.intToHex(c.a)},intToHex:function(c){c=(c|0).toString(16);if(c.length==1)c="0"+c;return c.toLowerCase()},hexToInt:function(c){return parseInt(c,16)},rgbToHsv:function(c){var f=c.r/255,d=c.g/255;c=c.b/255;var l={h:0,s:0,v:0},s=0,C=
|
|
0;if(f>=d&&f>=c){C=f;s=d>c?c:d}else if(d>=c&&d>=f){C=d;s=f>c?c:f}else{C=c;s=d>f?f:d}l.v=C;l.s=C?(C-s)/C:0;if(l.s){s=C-s;l.h=f==C?(d-c)/s:d==C?2+(c-f)/s:4+(f-d)/s;l.h=parseInt(l.h*60);if(l.h<0)l.h+=360}else l.h=0;l.s=l.s*100|0;l.v=l.v*100|0;return l},hsvToRgb:function(c){var f={r:0,g:0,b:0,a:100},d=c.h,l=c.s;c=c.v;if(l==0)f.r=c==0?f.g=f.b=0:f.g=f.b=c*255/100|0;else{if(d==360)d=0;d/=60;l/=100;c/=100;var s=d|0,C=d-s;d=c*(1-l);var p=c*(1-l*C);l=c*(1-l*(1-C));switch(s){case 0:f.r=c;f.g=l;f.b=d;break;case 1:f.r=
|
|
p;f.g=c;f.b=d;break;case 2:f.r=d;f.g=c;f.b=l;break;case 3:f.r=d;f.g=p;f.b=c;break;case 4:f.r=l;f.g=d;f.b=c;break;case 5:f.r=c;f.g=d;f.b=p}f.r=f.r*255|0;f.g=f.g*255|0;f.b=f.b*255|0}return f}}};var b=a.jPicker.Color,n=a.jPicker.List,u=a.jPicker.ColorMethods;a.fn.jPicker=function(c){var f=arguments;return this.each(function(){var d=this,l=a.extend(true,{},a.fn.jPicker.defaults,c);if(a(d).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,input:a(d)}});if(a(d).val()==
|
|
""){l.color.active=new b({hex:null});l.color.current=new b({hex:null})}else if(u.validateHex(a(d).val())){l.color.active=new b({hex:a(d).val(),a:l.color.active.val("a")});l.color.current=new b({hex:a(d).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(d).after('<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>');
|
|
else l.window.liveUpdate=false;var s=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,p=null,L=null,R=null,O=null,K=null,P=null,T=null,M=null,ha=null,na=null,fa=null,aa=null,V=null,ra=null,ia=null,da=null,U=null,Y=null,oa=null,pa=null,la=null,ma=null,Ba=null,Ea=null,Ia=null,za=null,Ka=null,Na=function(N){var Q=ka.active,ea=Q.val("hex"),Fa,Oa;l.color.mode=N;switch(N){case "h":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,0);wa.call(d,R,100);Ca.call(d,
|
|
O,260);wa.call(d,O,100);Sa.call(d,L,"transparent");Ca.call(d,P,0);wa.call(d,P,100);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,ha,260);wa.call(d,ha,100);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:100,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:360});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("s"),y:100-Q.val("v")},aa);V.val("y",360-Q.val("h"),V);break;case "s":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,
|
|
O,-520);Ca.call(d,P,-260);Ca.call(d,T,-520);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:360,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("v")},aa);V.val("y",100-Q.val("s"),V);break;case "v":setTimeout(function(){Sa.call(d,p,"000000");Ca.call(d,R,-780);Ca.call(d,O,260);Sa.call(d,L,ea);Ca.call(d,P,-520);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:360,
|
|
minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("s")},aa);V.val("y",100-Q.val("v"),V);break;case "r":Fa=-1040;Oa=-780;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("b"),y:255-Q.val("g")},aa);V.val("y",255-Q.val("r"),V);break;case "g":Fa=-1560;Oa=-1820;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});
|
|
if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("b"),y:255-Q.val("r")},aa);V.val("y",255-Q.val("g"),V);break;case "b":Fa=-2080;Oa=-2860;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("r"),y:255-Q.val("g")},aa);V.val("y",255-Q.val("b"),V);break;case "a":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,O,-520);Ca.call(d,P,260);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,fa,0);wa.call(d,
|
|
fa,100)},0);aa.range("all",{minX:0,maxX:360,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("v")},aa);V.val("y",255-Q.val("a"),V);break;default:throw"Invalid Mode";}switch(N){case "s":case "v":case "a":setTimeout(function(){wa.call(d,R,100);wa.call(d,P,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Sa.call(d,p,"transparent");Sa.call(d,L,"transparent");
|
|
wa.call(d,P,100);wa.call(d,R,100);Ca.call(d,R,Fa);Ca.call(d,O,Fa-260);Ca.call(d,P,Oa-780);Ca.call(d,T,Oa-520);Ca.call(d,M,Oa);Ca.call(d,ha,Oa-260);Ca.call(d,fa,260);wa.call(d,fa,100)},0)}Q.val("ahex")!=null&&Aa.call(d,Q)},Aa=function(N,Q){if(Q==null||Q!=V&&Q!=aa)xa.call(d,N,Q);setTimeout(function(){nb.call(d,N);Ya.call(d,N);fb.call(d,N)},0)},ya=function(N,Q){var ea=ka.active;if(!(Q!=aa&&ea.val()==null)){var Fa=N.val("all");switch(l.color.mode){case "h":ea.val("sv",{s:Fa.x,v:100-Fa.y},Q);break;case "s":case "a":ea.val("hv",
|
|
{h:Fa.x,v:100-Fa.y},Q);break;case "v":ea.val("hs",{h:Fa.x,s:100-Fa.y},Q);break;case "r":ea.val("gb",{g:255-Fa.y,b:Fa.x},Q);break;case "g":ea.val("rb",{r:255-Fa.y,b:Fa.x},Q);break;case "b":ea.val("rg",{r:Fa.x,g:255-Fa.y},Q)}}},Ga=function(N,Q){var ea=ka.active;if(!(Q!=V&&ea.val()==null))switch(l.color.mode){case "h":ea.val("h",{h:360-N.val("y")},Q);break;case "s":ea.val("s",{s:100-N.val("y")},Q);break;case "v":ea.val("v",{v:100-N.val("y")},Q);break;case "r":ea.val("r",{r:255-N.val("y")},Q);break;case "g":ea.val("g",
|
|
{g:255-N.val("y")},Q);break;case "b":ea.val("b",{b:255-N.val("y")},Q);break;case "a":ea.val("a",255-N.val("y"),Q)}},xa=function(N,Q){if(Q!=aa)switch(l.color.mode){case "h":var ea=N.val("sv");aa.val("xy",{x:ea!=null?ea.s:100,y:100-(ea!=null?ea.v:100)},Q);break;case "s":case "a":ea=N.val("hv");aa.val("xy",{x:ea&&ea.h||0,y:100-(ea!=null?ea.v:100)},Q);break;case "v":ea=N.val("hs");aa.val("xy",{x:ea&&ea.h||0,y:100-(ea!=null?ea.s:100)},Q);break;case "r":ea=N.val("bg");aa.val("xy",{x:ea&&ea.b||0,y:255-(ea&&
|
|
ea.g||0)},Q);break;case "g":ea=N.val("br");aa.val("xy",{x:ea&&ea.b||0,y:255-(ea&&ea.r||0)},Q);break;case "b":ea=N.val("rg");aa.val("xy",{x:ea&&ea.r||0,y:255-(ea&&ea.g||0)},Q)}if(Q!=V)switch(l.color.mode){case "h":V.val("y",360-(N.val("h")||0),Q);break;case "s":ea=N.val("s");V.val("y",100-(ea!=null?ea:100),Q);break;case "v":ea=N.val("v");V.val("y",100-(ea!=null?ea:100),Q);break;case "r":V.val("y",255-(N.val("r")||0),Q);break;case "g":V.val("y",255-(N.val("g")||0),Q);break;case "b":V.val("y",255-(N.val("b")||
|
|
0),Q);break;case "a":ea=N.val("a");V.val("y",255-(ea!=null?ea:255),Q)}},nb=function(N){try{var Q=N.val("all");oa.css({backgroundColor:Q&&"#"+Q.hex||"transparent"});wa.call(d,oa,Q&&Math.precision(Q.a*100/255,4)||0)}catch(ea){}},Ya=function(N){switch(l.color.mode){case "h":Sa.call(d,p,(new b({h:N.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var Q=N.val("s");wa.call(d,O,100-(Q!=null?Q:100));break;case "v":Q=N.val("v");wa.call(d,R,Q!=null?Q:100);break;case "r":wa.call(d,O,Math.precision((N.val("r")||
|
|
0)/255*100,4));break;case "g":wa.call(d,O,Math.precision((N.val("g")||0)/255*100,4));break;case "b":wa.call(d,O,Math.precision((N.val("b")||0)/255*100))}N=N.val("a");wa.call(d,K,Math.precision((255-(N||0))*100/255,4))},fb=function(N){switch(l.color.mode){case "h":var Q=N.val("a");wa.call(d,na,Math.precision((255-(Q||0))*100/255,4));break;case "s":Q=N.val("hva");var ea=new b({h:Q&&Q.h||0,s:100,v:Q!=null?Q.v:100});Sa.call(d,L,ea.val("hex"));wa.call(d,T,100-(Q!=null?Q.v:100));wa.call(d,na,Math.precision((255-
|
|
(Q&&Q.a||0))*100/255,4));break;case "v":Q=N.val("hsa");ea=new b({h:Q&&Q.h||0,s:Q!=null?Q.s:100,v:100});Sa.call(d,L,ea.val("hex"));wa.call(d,na,Math.precision((255-(Q&&Q.a||0))*100/255,4));break;case "r":case "g":case "b":ea=Q=0;N=N.val("rgba");if(l.color.mode=="r"){Q=N&&N.b||0;ea=N&&N.g||0}else if(l.color.mode=="g"){Q=N&&N.b||0;ea=N&&N.r||0}else if(l.color.mode=="b"){Q=N&&N.r||0;ea=N&&N.g||0}var Fa=ea>Q?Q:ea;wa.call(d,T,Q>ea?Math.precision((Q-ea)/(255-ea)*100,4):0);wa.call(d,M,ea>Q?Math.precision((ea-
|
|
Q)/(255-Q)*100,4):0);wa.call(d,ha,Math.precision(Fa/255*100,4));wa.call(d,na,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "a":Q=N.val("a");Sa.call(d,L,N.val("hex")||"000000");wa.call(d,na,Q!=null?0:100);wa.call(d,fa,Q!=null?100:0)}},Sa=function(N,Q){N.css({backgroundColor:Q&&Q.length==6&&"#"+Q||"transparent"})},Wa=function(N,Q){if(s&&(Q.indexOf("AlphaBar.png")!=-1||Q.indexOf("Bars.png")!=-1||Q.indexOf("Maps.png")!=-1)){N.attr("pngSrc",Q);N.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
|
|
Q+"', sizingMethod='scale')"})}else N.css({backgroundImage:"url('"+Q+"')"})},Ca=function(N,Q){N.css({top:Q+"px"})},wa=function(N,Q){N.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(s){var ea=N.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):N.css({opacity:Math.precision(Q/
|
|
100,4)})}else N.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(s){ea=N.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale')"}):N.css({opacity:""})}else N.css({opacity:""})},db=function(){ka.active.val("ahex",ka.current.val("ahex"))},La=function(){ka.current.val("ahex",ka.active.val("ahex"))},Ra=function(N){a(this).parents("tbody:first").find('input:radio[value!="'+
|
|
N.target.value+'"]').removeAttr("checked");Na.call(d,N.target.value)},Da=function(){db.call(d)},gb=function(){db.call(d);l.window.expandable&&yb.call(d);a.isFunction(sb)&&sb.call(d,ka.active,ma)},rb=function(){La.call(d);l.window.expandable&&yb.call(d);a.isFunction(lb)&&lb.call(d,ka.active,la)},Xa=function(){ob.call(d)},ab=function(N){var Q=N.val("hex");pa.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,pa,Math.precision((N.val("a")||0)*100/255,4))},xb=function(N){var Q=N.val("hex");N=N.val("va");
|
|
Ea.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,Ia,Math.precision((255-(N&&N.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:N==null||N.v>75?"#000000":"#ffffff"})},ua=function(N){ia=parseInt(C.css("left"));da=parseInt(C.css("top"));U=N.pageX;Y=N.pageY;a(document).bind("mousemove",jb).bind("mouseup",hb);N.preventDefault()},jb=function(N){C.css({left:ia-(U-N.pageX)+"px",top:da-(Y-N.pageY)+"px"});l.window.expandable&&
|
|
!a.support.boxModel&&C.prev().css({left:C.css("left"),top:C.css("top")});N.stopPropagation();N.preventDefault();return false},hb=function(N){a(document).unbind("mousemove",jb).unbind("mouseup",hb);N.stopPropagation();N.preventDefault();return false},ub=function(N){N.preventDefault();N.stopPropagation();ka.active.val("ahex",a(this).attr("title")||null,N.target);return false},lb=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,sb=a.isFunction(f[3])&&f[3]||null,ob=function(){ka.current.val("ahex",
|
|
ka.active.val("ahex"));var N=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=C.find("table:first");C.before("<iframe/>");C.prev().css({width:Q.width(),height:C.height(),opacity:0,position:"absolute",left:C.css("left"),top:C.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})}switch(l.window.effects.type){case "fade":C.fadeIn(l.window.effects.speed.show,N);break;case "slide":C.slideDown(l.window.effects.speed.show,
|
|
N);break;default:C.show(l.window.effects.speed.show,N)}},yb=function(){var N=function(){l.window.expandable&&C.css({zIndex:10});!l.window.expandable||a.support.boxModel||C.prev().remove()};switch(l.window.effects.type){case "fade":C.fadeOut(l.window.effects.speed.hide,N);break;case "slide":C.slideUp(l.window.effects.speed.hide,N);break;default:C.hide(l.window.effects.speed.hide,N)}},zb=function(){var N=l.window,Q=N.expandable?a(d).next().find(".Container:first"):null;C=N.expandable?a("<div/>"):a(d);
|
|
C.addClass("jPicker Container");N.expandable&&C.hide();C.get(0).onselectstart=function(Pa){if(Pa.target.nodeName.toLowerCase()!=="input")return false};var ea=ka.active.val("all");if(N.alphaPrecision<0)N.alphaPrecision=0;else if(N.alphaPrecision>2)N.alphaPrecision=2;var Fa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(N.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(N.title||ba.text.title)+'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="'+
|
|
ja.clientPath+ja.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="'+ja.clientPath+ja.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+ba.text.newColor+'<div class="color_preview"><span class="Active" title="'+ba.tooltips.colors.newColor+
|
|
'"> </span><span class="Current" title="'+ba.tooltips.colors.currentColor+'"> </span></div></div>'+ba.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+ba.text.ok+'" title="'+ba.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+ba.text.cancel+'" title="'+ba.tooltips.buttons.cancel+'"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="'+ba.tooltips.hue.radio+'"><input type="radio" value="h"'+
|
|
(l.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.h:"")+'" title="'+ba.tooltips.hue.textbox+'"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+ba.tooltips.saturation.radio+'"><input type="radio" value="s"'+(l.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.s:"")+'" title="'+ba.tooltips.saturation.textbox+
|
|
'"/> %</td></tr><tr class="Value"><td class="Radio"><label title="'+ba.tooltips.value.radio+'"><input type="radio" value="v"'+(l.color.mode=="v"?' checked="checked"':"")+'/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.v:"")+'" title="'+ba.tooltips.value.textbox+'"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+ba.tooltips.red.radio+'"><input type="radio" value="r"'+(l.color.mode=="r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+
|
|
(ea!=null?ea.r:"")+'" title="'+ba.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+ba.tooltips.green.radio+'"><input type="radio" value="g"'+(l.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.g:"")+'" title="'+ba.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+ba.tooltips.blue.radio+'"><input type="radio" value="b"'+(l.color.mode=="b"?' checked="checked"':
|
|
"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(ea!=null?ea.b:"")+'" title="'+ba.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(N.alphaSupport?'<label title="'+ba.tooltips.alpha.radio+'"><input type="radio" value="a"'+(l.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":" ")+'</td><td class="Text">'+(N.alphaSupport?'<input type="text" maxlength="'+(3+N.alphaPrecision)+'" value="'+(ea!=null?Math.precision(ea.a*100/255,N.alphaPrecision):
|
|
"")+'" title="'+ba.tooltips.alpha.textbox+'"/> %':" ")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+ba.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(ea!=null?ea.hex:"")+'"/></label>'+(N.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(ea!=null?ea.ahex.substring(6):"")+'" title="'+ba.tooltips.hex.alpha+'"/></td>':" ")+"</tr></tbody></table>";if(N.expandable){C.html(Fa);a(document.body).children("div.jPicker.Container").length==
|
|
0?a(document.body).prepend(C):a(document.body).children("div.jPicker.Container:last").after(C);C.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});C.css({zIndex:20})});C.css({left:N.position.x=="left"?Q.offset().left-530-(N.position.y=="center"?25:0)+"px":N.position.x=="center"?Q.offset().left-260+"px":N.position.x=="right"?Q.offset().left-10+(N.position.y=="center"?25:0)+"px":N.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":Q.offset().left+parseInt(N.position.x)+
|
|
"px",position:"absolute",top:N.position.y=="top"?Q.offset().top-312+"px":N.position.y=="center"?Q.offset().top-156+"px":N.position.y=="bottom"?Q.offset().top+25+"px":Q.offset().top+parseInt(N.position.y)+"px"})}else{C=a(d);C.html(Fa)}Fa=C.find("tbody:first");p=Fa.find("div.Map:first");L=Fa.find("div.Bar:first");var Oa=p.find("span"),Va=L.find("span");R=Oa.filter(".Map1:first");O=Oa.filter(".Map2:first");K=Oa.filter(".Map3:first");P=Va.filter(".Map1:first");T=Va.filter(".Map2:first");M=Va.filter(".Map3:first");
|
|
ha=Va.filter(".Map4:first");na=Va.filter(".Map5:first");fa=Va.filter(".Map6:first");aa=new q(p,{map:{width:ja.colorMap.width,height:ja.colorMap.height},arrow:{image:ja.clientPath+ja.colorMap.arrow.file,width:ja.colorMap.arrow.width,height:ja.colorMap.arrow.height}});aa.bind(ya);V=new q(L,{map:{width:ja.colorBar.width,height:ja.colorBar.height},arrow:{image:ja.clientPath+ja.colorBar.arrow.file,width:ja.colorBar.arrow.width,height:ja.colorBar.arrow.height}});V.bind(Ga);ra=new h(Fa,ka.active,N.expandable&&
|
|
N.bindToInput?N.input:null,N.alphaPrecision);Oa=ea!=null?ea.hex:null;var $a=Fa.find(".Preview");Va=Fa.find(".Button");oa=$a.find(".Active:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});pa=$a.find(".Current:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"}).bind("click",Da);wa.call(d,pa,Math.precision(ka.current.val("a")*100)/255,4);la=Va.find(".Ok:first").bind("click touchstart",rb);ma=Va.find(".Cancel:first").bind("click touchstart",gb);Ba=Va.find(".Grid:first");setTimeout(function(){Wa.call(d,
|
|
R,ja.clientPath+"Maps.png");Wa.call(d,O,ja.clientPath+"Maps.png");Wa.call(d,K,ja.clientPath+"map-opacity.png");Wa.call(d,P,ja.clientPath+"Bars.png");Wa.call(d,T,ja.clientPath+"Bars.png");Wa.call(d,M,ja.clientPath+"Bars.png");Wa.call(d,ha,ja.clientPath+"Bars.png");Wa.call(d,na,ja.clientPath+"bar-opacity.png");Wa.call(d,fa,ja.clientPath+"AlphaBar.png");Wa.call(d,$a.find("div:last"),ja.clientPath+"preview-opacity.png")},0);Fa.find("td.Radio input").bind("click touchstart",Ra);if(ka.quickList&&ka.quickList.length>
|
|
0){Va="";for(i=0;i<ka.quickList.length;i++){if((typeof ka.quickList[i]).toString().toLowerCase()=="string")ka.quickList[i]=new b({hex:ka.quickList[i]});var qb=ka.quickList[i].val("a"),Qa=ka.quickList[i].val("ahex");if(!N.alphaSupport&&Qa)Qa=Qa.substring(0,6)+"ff";var pb=ka.quickList[i].val("hex");Va+='<span class="QuickColor"'+(Qa&&' title="#'+Qa+'"'||"")+' style="background-color:'+(pb&&"#"+pb||"")+";"+(pb?"":"background-image:url("+ja.clientPath+"NoColor.png)")+(N.alphaSupport&&qb&&qb<255?";opacity:"+
|
|
Math.precision(qb/255,4)+";filter:Alpha(opacity="+Math.precision(qb/2.55,4)+")":"")+'"> </span>'}Wa.call(d,Ba,ja.clientPath+"bar-opacity.png");Ba.html(Va);Ba.find(".QuickColor").click(ub)}Na.call(d,l.color.mode);ka.active.bind(Aa);a.isFunction(eb)&&ka.active.bind(eb);ka.current.bind(ab);if(N.expandable){d.icon=Q.parents(".Icon:first");Ea=d.icon.find(".Color:first").css({backgroundColor:Oa&&"#"+Oa||"transparent"});Ia=d.icon.find(".Alpha:first");Wa.call(d,Ia,ja.clientPath+"bar-opacity.png");wa.call(d,
|
|
Ia,Math.precision((255-(ea!=null?ea.a:0))*100/255,4));za=d.icon.find(".Image:first").css({backgroundImage:"url('"+ja.clientPath+ja.picker.file+"')"}).bind("click",Xa);if(N.bindToInput&&N.updateInputColor)N.input.css({backgroundColor:Oa&&"#"+Oa||"transparent",color:ea==null||ea.v>75?"#000000":"#ffffff"});Ka=Fa.find(".Move:first").bind("mousedown",ua);ka.active.bind(xb)}else ob.call(d)},ja=l.images,ba=l.localization,ka={active:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&&
|
|
l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new b({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new b({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),
|
|
quickList:l.color.quickList};a.extend(true,d,{commitCallback:lb,liveCallback:eb,cancelCallback:sb,color:ka,show:ob,hide:yb,destroy:function(){C.find("td.Radio input touchstart").unbind("click",Ra);pa.unbind("click touchstart",Da);ma.unbind("click touchstart",gb);la.unbind("click touchstart",rb);if(l.window.expandable){za.unbind("click",Xa);Ka.unbind("mousedown",ua);d.icon=null}C.find(".QuickColor").unbind("click",ub);fa=na=ha=M=T=P=K=O=R=L=p=null;aa.destroy();aa=null;V.destroy();V=null;ra.destroy();
|
|
eb=sb=lb=Ba=ma=la=pa=oa=ra=null;C.html("");for(i=0;i<n.length;i++)n[i]==d&&n.splice(i,1)}});n.push(d);setTimeout(function(){zb.call(d)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new b({ahex:"#ffcc00ff"}),quickList:[new b({h:360,s:33,v:100}),new b({h:360,s:66,v:100}),new b({h:360,s:100,v:100}),
|
|
new b({h:360,s:100,v:75}),new b({h:360,s:100,v:50}),new b({h:180,s:0,v:100}),new b({h:30,s:33,v:100}),new b({h:30,s:66,v:100}),new b({h:30,s:100,v:100}),new b({h:30,s:100,v:75}),new b({h:30,s:100,v:50}),new b({h:180,s:0,v:90}),new b({h:60,s:33,v:100}),new b({h:60,s:66,v:100}),new b({h:60,s:100,v:100}),new b({h:60,s:100,v:75}),new b({h:60,s:100,v:50}),new b({h:180,s:0,v:80}),new b({h:90,s:33,v:100}),new b({h:90,s:66,v:100}),new b({h:90,s:100,v:100}),new b({h:90,s:100,v:75}),new b({h:90,s:100,v:50}),
|
|
new b({h:180,s:0,v:70}),new b({h:120,s:33,v:100}),new b({h:120,s:66,v:100}),new b({h:120,s:100,v:100}),new b({h:120,s:100,v:75}),new b({h:120,s:100,v:50}),new b({h:180,s:0,v:60}),new b({h:150,s:33,v:100}),new b({h:150,s:66,v:100}),new b({h:150,s:100,v:100}),new b({h:150,s:100,v:75}),new b({h:150,s:100,v:50}),new b({h:180,s:0,v:50}),new b({h:180,s:33,v:100}),new b({h:180,s:66,v:100}),new b({h:180,s:100,v:100}),new b({h:180,s:100,v:75}),new b({h:180,s:100,v:50}),new b({h:180,s:0,v:40}),new b({h:210,
|
|
s:33,v:100}),new b({h:210,s:66,v:100}),new b({h:210,s:100,v:100}),new b({h:210,s:100,v:75}),new b({h:210,s:100,v:50}),new b({h:180,s:0,v:30}),new b({h:240,s:33,v:100}),new b({h:240,s:66,v:100}),new b({h:240,s:100,v:100}),new b({h:240,s:100,v:75}),new b({h:240,s:100,v:50}),new b({h:180,s:0,v:20}),new b({h:270,s:33,v:100}),new b({h:270,s:66,v:100}),new b({h:270,s:100,v:100}),new b({h:270,s:100,v:75}),new b({h:270,s:100,v:50}),new b({h:180,s:0,v:10}),new b({h:300,s:33,v:100}),new b({h:300,s:66,v:100}),
|
|
new b({h:300,s:100,v:100}),new b({h:300,s:100,v:75}),new b({h:300,s:100,v:50}),new b({h:180,s:0,v:0}),new b({h:330,s:33,v:100}),new b({h:330,s:66,v:100}),new b({h:330,s:100,v:100}),new b({h:330,s:100,v:75}),new b({h:330,s:100,v:50}),new b]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:20,height:7}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",
|
|
newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press “OK” To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To “Hue” Color Mode",textbox:"Enter A “Hue” Value (0-360°)"},saturation:{radio:"Set To “Saturation” Color Mode",textbox:"Enter A “Saturation” Value (0-100%)"},
|
|
value:{radio:"Set To “Value” Color Mode",textbox:"Enter A “Value” Value (0-100%)"},red:{radio:"Set To “Red” Color Mode",textbox:"Enter A “Red” Value (0-255)"},green:{radio:"Set To “Green” Color Mode",textbox:"Enter A “Green” Value (0-255)"},blue:{radio:"Set To “Blue” Color Mode",textbox:"Enter A “Blue” Value (0-255)"},alpha:{radio:"Set To “Alpha” Color Mode",textbox:"Enter A “Alpha” Value (0-100)"},
|
|
hex:{textbox:"Enter A “Hex” Color Value (#000000-#ffffff)",alpha:"Enter A “Alpha” Value (#00-#ff)"}}}}})(jQuery,"1.1.6");(function(a){function q(n){var u=n||window.event,c=[].slice.call(arguments,1),f=0,d=0,l=0;n=a.event.fix(u);n.type="mousewheel";if(u.wheelDelta)f=u.wheelDelta/120;if(u.detail)f=-u.detail/3;l=f;if(u.axis!==undefined&&u.axis===u.HORIZONTAL_AXIS){l=0;d=-1*f}if(u.wheelDeltaY!==undefined)l=u.wheelDeltaY/120;if(u.wheelDeltaX!==undefined)d=-1*u.wheelDeltaX/120;c.unshift(n,f,d,l);return(a.event.dispatch||a.event.handle).apply(this,c)}var h=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var b=h.length;b;)a.event.fixHooks[h[--b]]=
|
|
a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var n=h.length;n;)this.addEventListener(h[--n],q,false);else this.onmousewheel=q},teardown:function(){if(this.removeEventListener)for(var n=h.length;n;)this.removeEventListener(h[--n],q,false);else this.onmousewheel=null}};a.fn.extend({mousewheel:function(n){return n?this.bind("mousewheel",n):this.trigger("mousewheel")},unmousewheel:function(n){return this.unbind("mousewheel",n)}})})(jQuery);svgEditor.addExtension("eyedropper",function(a){var q=svgEditor.canvas,h=svgedit.history.ChangeElementCommand,b={fillPaint:"red",fillOpacity:1,strokePaint:"black",strokeOpacity:1,strokeWidth:5,strokeDashArray:null,opacity:1,strokeLinecap:"butt",strokeLinejoin:"miter"},n=function(u,c,f){var d=null;if(u.indexOf("url(#")===0){u=(u=q.getRefElem(u))?u.cloneNode(true):$("#"+f+"_color defs *")[0];d={alpha:c};d[u.tagName]=u}else d=u.indexOf("#")===0?{alpha:c,solidColor:u.substr(1)}:{alpha:c,solidColor:"none"};
|
|
return new $.jGraduate.Paint(d)};return{name:"eyedropper",svgicons:"extensions/eyedropper-icon.xml",buttons:[{id:"tool_eyedropper",type:"mode",title:"Eye Dropper Tool",position:8,key:"I",icon:"extensions/eyedropper.png",events:{click:function(){q.setMode("eyedropper")}}}],mouseDown:function(u){var c=q.getMode(),f=u.event;f=f.target.id==="svgroot"?document.getElementById("canvas_background"):f.target;if(c=="eyedropper"&&f){b.fillPaint=f.getAttribute("fill")||"white";b.fillOpacity=f.getAttribute("fill-opacity")||
|
|
1;b.strokePaint=f.getAttribute("stroke")||"none";b.strokeOpacity=f.getAttribute("stroke-opacity")||1;b.strokeWidth=f.getAttribute("stroke-width");b.strokeDashArray=f.getAttribute("stroke-dasharray");b.strokeLinecap=f.getAttribute("stroke-linecap");b.strokeLinejoin=f.getAttribute("stroke-linejoin");b.opacity=f.getAttribute("opacity")||1;u.selectedElements=u.selectedElements.filter(Boolean);if(u.selectedElements.length){if($.inArray(u.selectedElements.nodeName,["g","use"])==-1){var d={},l=function(C,
|
|
p,L){d[p]=C.getAttribute(p);C.setAttribute(p,L)},s=new a.BatchCommand;u.selectedElements.forEach(function(C){b.fillPaint&&l(C,"fill",b.fillPaint);b.fillOpacity&&l(C,"fill-opacity",b.fillOpacity);b.strokePaint&&l(C,"stroke",b.strokePaint);b.strokeOpacity&&l(C,"stroke-opacity",b.strokeOpacity);b.strokeWidth&&l(C,"stroke-width",b.strokeWidth);b.strokeDashArray&&l(C,"stroke-dasharray",b.strokeDashArray);b.opacity&&l(C,"opacity",b.opacity);b.strokeLinecap&&l(C,"stroke-linecap",b.strokeLinecap);b.strokeLinejoin&&
|
|
l(C,"stroke-linejoin",b.strokeLinejoin);s.addSubCommand(new h(C,d));d={}});u=n(b.fillPaint,b.fillOpacity*100,"fill");c=n(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.update(true);svgEditor.paintBox.stroke.update(true);q.undoMgr.addCommandToHistory(s)}}else{u=n(b.fillPaint,b.fillOpacity*100,"fill");c=n(b.strokePaint,b.strokeOpacity*100,"stroke");svgEditor.paintBox.fill.setPaint(u);svgEditor.paintBox.stroke.setPaint(c)}}}}});svgEditor.addExtension("view_grid",function(a){function q(d){c.attr("width");c.attr("height");var l=svgedit.units.getTypeMap()[svgEditor.curConfig.baseUnit],s=[0.01,0.1,1,10,100,1E3];svgCanvas.getContentElem().getAttribute("x");var C=n;l=l*d;var p=100/l,L=1;for(d=0;d<s.length;d++){var R=s[d];L=R;if(p<=R)break}s=L*l;C.width=s;C.height=s;l=C.getContext("2d");p=s/10;l.globalAlpha=0.2;l.strokeStyle="#000";for(d=1;d<10;d++){L=Math.round(p*d)+0.5;l.moveTo(L,s);l.lineTo(L,0);l.moveTo(s,L);l.lineTo(0,L)}l.stroke();
|
|
l.beginPath();l.globalAlpha=0.5;l.moveTo(0.5,s);l.lineTo(0.5,0);l.moveTo(s,0.5);l.lineTo(0,0.5);l.stroke();C=C.toDataURL("image/png");f.setAttribute("width",s);f.setAttribute("height",s);f.parentNode.setAttribute("width",s);f.parentNode.setAttribute("height",s);svgCanvas.setHref(f,C)}if(!document.getElementById("canvasGrid")){var h=document.getElementById("svgcanvas").ownerDocument,b=false;a=a.assignAttributes;var n=document.createElement("canvas");$(n).hide().appendTo("body");var u=h.createElementNS("http://www.w3.org/2000/svg",
|
|
"g");a(u,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var c=$("#canvas_background");c.after(u);u=h.createElementNS("http://www.w3.org/2000/svg","pattern");a(u,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var f=h.createElementNS("http://www.w3.org/2000/svg","image");a(f,{x:0,y:0,width:100,height:100});u.appendChild(f);$("#svgroot defs").append(u);h=h.createElementNS("http://www.w3.org/2000/svg","rect");a(h,{width:"100%",height:"100%",
|
|
x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(h)}return{name:"view_grid",zoomChanged:function(d){b&&q(d)},buttons:[{id:"view_grid",type:"menu",after:"tool_wireframe",panel:"view_menu",title:"View Grid",events:{click:function(){if($("#view_grid").hasClass("push_button_pressed")){svgEditor.curConfig.showGrid=b=false;$("#view_grid").removeClass("push_button_pressed");$("#canvasGrid").attr("display","none")}else{svgEditor.curConfig.showGrid=
|
|
b=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","normal");q(svgCanvas.getZoom())}}}}]}});svgEditor.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function q(O){var K=p[O];if(K){L=K;K.buttons.length||h(O,K);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+O+".json",function(P){L=p[O]={data:P.data,size:P.size,fill:P.fill};h(O,P);a()})}}function h(O,K){var P=L.size||300,T=L.fill||false,M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");P=T?0:P/30;P=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+
|
|
M+'"><path fill="#333" stroke="transparent" stroke-width="'+P+'" /></svg></svg>',"text/xml");P.documentElement.setAttribute("width",40);P.documentElement.setAttribute("height",40);T=$(document.importNode(P.documentElement,true));var ha=K.data;L.buttons=[];for(var na in ha){var fa=ha[na],aa=T.clone();if(fa.charAt(fa.length-1)=="x"){P=32;M=P*0.05;M=[-M,-M,P+M*2,P+M*2].join(" ");aa.find("svg").attr("viewBox",M);fa.replace("x","")}aa.find("path").attr("d",fa);P=aa.wrap('<div class="tool_button">').parent().attr({id:R+
|
|
"_"+na,title:na});L.buttons.push(P[0])}}var b,n,u=svgEditor.canvas,c,f,d,l=u.getRootElem(),s={},C={basic:"Basic",object:"Objects",symbol:"Symbols",arrow:"Arrows",flowchart:"Flowchart",nature:"Nature",game:"Cards & Chess",dialog_balloon:"Dialog balloons",music:"Music",weather:"Weather & Time",ui:"User Interface",social:"Social Web"},p={basic:{data:{star_points_5:"m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z",
|
|
donut:"m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z",triangle:"m1,280.375l149,-260.75l149,260.75z",right_triangle:"m1,299l0,-298l298,298z",diamond:"m1,150l149,-149l149,149l-149,149l-149,-149z",
|
|
pentagon:"m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z",hexagon:"m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z",septagon1:"m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z",heptagon:"m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z",
|
|
decagon:"m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z",dodecagon:"m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z",trapezoid:"m1,299l55.875,-298l186.25001,0l55.87498,298z",dialog_balloon_1:"m0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z",
|
|
heart:"m150,73c61,-175 300,0 0,225c-300,-225 -61,-400 0,-225z",cylinder:"m299.0007,83.77844c0,18.28676 -66.70958,33.11111 -149.00002,33.11111m149.00002,-33.11111l0,0c0,18.28676 -66.70958,33.11111 -149.00002,33.11111c-82.29041,0 -148.99997,-14.82432 -148.99997,-33.11111m0,0l0,0c0,-18.28674 66.70956,-33.1111 148.99997,-33.1111c82.29044,0 149.00002,14.82436 149.00002,33.1111l0,132.44449c0,18.28674 -66.70958,33.11105 -149.00002,33.11105c-82.29041,0 -148.99997,-14.82431 -148.99997,-33.11105z",arrow_up:"m1.49805,149.64304l148.50121,-148.00241l148.50121,148.00241l-74.25061,0l0,148.71457l-148.5012,0l0,-148.71457z",
|
|
arrow_u_turn:"m1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z",arrow_left_up:"m0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z",
|
|
plaque:"m-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z",page:"m249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234",cross:"m0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z",
|
|
divide:"m150,0.99785l0,0c25.17819,0 45.58916,20.41097 45.58916,45.58916c0,25.17821 -20.41096,45.58916 -45.58916,45.58916c-25.17822,0 -45.58916,-20.41093 -45.58916,-45.58916c0,-25.1782 20.41093,-45.58916 45.58916,-45.58916zm0,296.25203c-25.17822,0 -45.58916,-20.41095 -45.58916,-45.58917c0,-25.17819 20.41093,-45.58916 45.58916,-45.58916c25.17819,0 45.58916,20.41096 45.58916,45.58916c0,25.17822 -20.41096,45.58917 -45.58916,45.58917zm-134.06754,-193.71518l268.13507,0l0,91.17833l-268.13507,0z",minus:"m0.99887,102.39503l297.49445,0l0,95.2112l-297.49445,0z",
|
|
times:"m1.00089,73.36786l72.36697,-72.36697l76.87431,76.87368l76.87431,-76.87368l72.36765,72.36697l-76.87433,76.87431l76.87433,76.87431l-72.36765,72.36765l-76.87431,-76.87433l-76.87431,76.87433l-72.36697,-72.36765l76.87368,-76.87431l-76.87368,-76.87431z"},buttons:[]}},L=p.basic,R="shapelib";return{svgicons:"extensions/ext-shapes.xml",buttons:[{id:"tool_shapelib",type:"mode_flyout",position:6,title:"Shape library",icon:"extensions/ext-shapes.png",events:{click:function(){u.setMode(R)}}}],callback:function(){var O=
|
|
$('<div id="shape_buttons">');$("#tools_shapelib > *").wrapAll(O);var K=$("#tools_shapelib_show");q("basic");$("#shape_buttons").mouseup(function(T){T=$(T.target).closest("div.tool_button");if(T.length){var M=T.children().clone().attr({width:24,height:24});K.children(":not(.flyout_arrow_horiz)").remove();K.append(M).attr("data-curopt","#"+T[0].id).mouseup();u.setMode(R);n=T[0].id.substr((R+"_").length);b=L.data[n];$(".tools_flyout").fadeOut()}});O=$('<div id="shape_cats">');var P="";$.each(C,function(T,
|
|
M){P+="<div data-cat="+T+">"+M+"</div>"});O.html(P).children().bind("mouseup",function(){var T=$(this);T.siblings().removeClass("current");T.addClass("current");q(T.attr("data-cat"));return false});O.children().eq(0).addClass("current");$("#tools_shapelib").prepend(O);K.mouseup(function(){u.setMode(b?R:"select")});$("#tool_shapelib").remove();O=$("#tools_shapelib").height();$("#tools_shapelib").css({"margin-top":-(O/2),"margin-left":3})},mouseDown:function(O){if(u.getMode()===R){var K=f=O.start_x;
|
|
O=d=O.start_y;var P=u.getStyle();c=u.addSvgElementFromJson({element:"path",curStyles:true,attr:{d:b,id:u.getNextId(),opacity:P.opacity/2,style:"pointer-events:none"}});c.setAttribute("d",b);if(/[a-z]/.test(b)){b=L.data[n]=u.pathActions.convertPath(c);c.setAttribute("d",b);u.pathActions.fixEnd(c)}c.setAttribute("transform","translate("+K+","+O+") scale(0.005) translate("+-K+","+-O+")");u.recalculateDimensions(c);u.getTransformList(c);s=c.getBBox();totalScale={sx:1,sy:1};return{started:true}}},mouseMove:function(O){if(u.getMode()===
|
|
R){var K=u.getZoom(),P=O.event,T=O.mouse_x/K,M=O.mouse_y/K;O=u.getTransformList(c);var ha=c.getBBox();K=ha.x;var na=ha.y,fa=ha.width,aa=ha.height,V=T-f,ra=M-d,ia={x:Math.min(f,T),y:Math.min(d,M),width:Math.abs(T-f),height:Math.abs(M-d)},da=ha=0;aa=aa?(aa+ra)/aa:1;fa=fa?(fa+V)/fa:1;fa=ia.width/s.width;aa=ia.height/s.height;fa=fa||1;aa=aa||1;if(T<f)ha=s.width;if(M<d)da=s.height;T=l.createSVGTransform();M=l.createSVGTransform();ia=l.createSVGTransform();T.setTranslate(-(K+ha),-(na+da));if(P.shiftKey){replaced=
|
|
true;P=Math.min(Math.abs(fa),Math.abs(aa));fa=P*(fa<0?-1:1);aa=P*(aa<0?-1:1);if(totalScale.sx!=totalScale.sy){P=totalScale.sx>totalScale.sy?1:totalScale.sx/totalScale.sy;fa*=totalScale.sy>totalScale.sx?1:totalScale.sy/totalScale.sx;aa*=P}}totalScale.sx*=fa;totalScale.sy*=aa;M.setScale(fa,aa);ia.setTranslate(K+ha,na+da);O.appendItem(ia);O.appendItem(M);O.appendItem(T);u.recalculateDimensions(c);s=c.getBBox()}},mouseUp:function(O){if(u.getMode()===R){if(O.mouse_x==f&&O.mouse_y==d)return{keep:false,
|
|
element:c,started:false};u.setMode("select");return{keep:true,element:c,started:false}}}}});(function(){for(var a=0,q=["ms","moz","webkit","o"],h=0;h<q.length&&!window.requestAnimationFrame;++h){window.requestAnimationFrame=window[q[h]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[q[h]+"CancelAnimationFrame"]||window[q[h]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var n=(new Date).getTime(),u=Math.max(0,16-(n-a)),c=window.setTimeout(function(){b(n+u)},u);a=n+u;return c};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
|
|
function(b){clearTimeout(b)}})();(function(a){function q(p){var L=p.originalEvent;if(!L.touches||L.targetTouches.length===1&&L.touches.length===1){c.call(this,p);p=a(this);p.bind(s,h);p.bind(l,b)}else{clearTimeout(C);u.call(this)}}function h(p){if(C!=null){var L=p.originalEvent;p=L.changedTouches?L.changedTouches[0].pageX:L.pageX;L=L.changedTouches?L.changedTouches[0].pageY:L.pageY;var R=a(this).data("taphold.point");p=p-R.x;L=L-R.y;if(Math.sqrt(p*p+L*L)>d){clearTimeout(C);u.call(this)}}}function b(){clearTimeout(C);u.call(this)}
|
|
function n(p){u.call(this);a(this).data("taphold.handler").call(this,p)}function u(){C=null;a(this).unbind(s,h);a(this).unbind(l,b)}function c(p){if(C==null){var L=this;C=setTimeout(function(){n.call(L,p)},f);var R=p.originalEvent,O={};O.x=R.changedTouches?R.changedTouches[0].pageX:R.pageX;O.y=R.changedTouches?R.changedTouches[0].pageY:R.pageY;a(this).data("taphold.point",O)}}var f=1E3,d=5,l="touchend",s="touchmove",C=null;a.event.special.taphold={setup:function(){},add:function(p){a(this).data("taphold.handler",
|
|
p.handler);p.data?a(this).bind("touchstart",p.data,q):a(this).bind("touchstart",q)},remove:function(p){clearTimeout(C);u.call(this);p.data?a(this).unbind("touchstart",p.data,q):a(this).unbind("touchstart",q)},teardown:function(){}}})(jQuery);
|