From 2309cc64eb3d6cbb70469ff01886f6a2dfc2bfa0 Mon Sep 17 00:00:00 2001 From: Mark MacKay Date: Mon, 30 Jul 2012 19:49:46 -0500 Subject: [PATCH] alt zoom new method --- editor/svg-editor.js | 20 +- editor/svgedit.compiled.js | 1248 +++++++++++++++---------------- method-draw/svg-editor.js | 20 +- method-draw/svgedit.compiled.js | 1248 +++++++++++++++---------------- 4 files changed, 1262 insertions(+), 1274 deletions(-) diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 3d6d78e..d9cfa7c 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -660,7 +660,7 @@ changeZoom({value: .1}); return; } - + if (typeof animatedZoom != 'undefined') window.cancelAnimationFrame(animatedZoom) //animate var start = Date.now(); var duration = 500; @@ -674,12 +674,12 @@ svgCanvas.setZoom(current_zoom + (diff*tick)); updateCanvas(); if (tick < 1) { - requestAnimationFrame(animateZoom) + window.animatedZoom = requestAnimationFrame(animateZoom) } else { - $("#zoom").val(zoomlevel*100) + $("#zoom").val(parseInt(zoomlevel*100)) $("option", "#zoom_select").removeAttr("selected") - $("option[value="+ zoomlevel*100 +"]", "#zoom_select").attr("selected", "selected") + $("option[value="+ parseInt(zoomlevel*100) +"]", "#zoom_select").attr("selected", "selected") } } animateZoom(Date.now()) @@ -1892,19 +1892,13 @@ $('.menu_item').on('mousedown touchstart', function(e){blinker(e)}); $("svg, body").on('mousedown touchstart', function(e){closer(e)}); + var accumulatedDelta = 0 - var zoomSteps = [6, 12, 16, 33, 50, 66, 100, 150, 200, 300, 400, 600, 800, 1200] $('#workarea').on('mousewheel', function(e, delta, deltaX, deltaY){ if (e.altKey) { e.preventDefault(); - var currentZoom = svgCanvas.getZoom()*100; - var arr_length = zoomSteps.length; - for (i=0; i 0) zoom = (zoomSteps[i] <= currentZoom) ? zoomSteps[max] : zoom; - if (deltaY < 0) zoom = (zoomSteps[i] < currentZoom) ? zoomSteps[i] : zoom; - } - if (zoom) changeZoom({value: zoom}); + zoom = parseInt($("#zoom").val()) + $("#zoom").val(parseInt(zoom + deltaY*10)).change() } }) $('.menu_title') diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 33a0c5c..2026771 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -1,105 +1,105 @@ -function touchHandler(a){var p=a.changedTouches,g=p[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,g.screenX,g.screenY,g.clientX,g.clientY,false,false,false,false,0,null);if(p.length<2){g.target.dispatchEvent(n);a.preventDefault()}};(function(a){function p(g){if(typeof g.data==="string"){var b=g.handler,n=g.data.toLowerCase().split(" ");g.handler=function(s){if(!(this!==s.target&&(/textarea|select/i.test(s.target.nodeName)||s.target.type==="text"))){var c=s.type!=="keypress"&&a.hotkeys.specialKeys[s.which],f=String.fromCharCode(s.which).toLowerCase(),d="",l={};if(s.altKey&&c!=="alt")d+="alt+";if(s.ctrlKey&&c!=="ctrl")d+="ctrl+";if(s.metaKey&&!s.ctrlKey&&c!=="meta")d+="meta+";if(s.shiftKey&&c!=="shift")d+="shift+";if(c)l[d+c]= +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","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:p}})})(jQuery);(function(a,p){function g(da){return typeof da==="string"}function b(da){var W=d.call(arguments,1);return function(){return da.apply(this,W.concat(d.call(arguments)))}}function n(da,W,aa,pa,ra){var ma;if(pa!==f){W=aa.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);aa=W[3]||"";if(ra===2&&g(pa))pa=pa.replace(da?X:ba,"");else{ma=o(W[2]);pa=g(pa)?o[da?ia:M](pa):pa;pa=ra===2?pa:ra===1?a.extend({},pa,ma):a.extend({},ma,pa);pa=q(pa);if(da)pa=pa.replace(sa,l)}da=W[1]+(da?"#":pa||!W[1]?"?":"")+pa+ -aa}else da=W(aa!==f?aa:p[oa][fa]);return da}function s(da,W,aa){if(W===f||typeof W==="boolean"){aa=W;W=q[da?ia:M]()}else W=g(W)?W.replace(da?X:ba,""):W;return o(W,aa)}function c(da,W,aa,pa){if(!g(aa)&&typeof aa!=="object"){pa=aa;aa=W;W=f}return this.each(function(){var ra=a(this),ma=W||Q()[(this.nodeName||"").toLowerCase()]||"",na=ma&&ra.attr(ma)||"";ra.attr(ma,q[da](na,aa,pa))})}var f,d=Array.prototype.slice,l=decodeURIComponent,q=a.param,B,o,K,T=a.bbq=a.bbq||{},O,J,Q,V=a.event.special,M="querystring", -ia="fragment",oa="location",fa="href",ba=/^.*\?|#.*$/g,X=/^.*\#/,sa,ka={};q[M]=b(n,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});q[ia]=B=b(n,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});B.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);sa=RegExp(da.join("|"),"g")};B.noEscape(",/");a.deparam=o=function(da,W){var aa={},pa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(ra,ma){var na=ma.split("="), -Aa=l(na[0]),Fa=aa,Ia=0,Ca=Aa.split("]["),Ka=Ca.length-1;if(/\[/.test(Ca[0])&&/\]$/.test(Ca[Ka])){Ca[Ka]=Ca[Ka].replace(/\]$/,"");Ca=Ca.shift().split("[").concat(Ca);Ka=Ca.length-1}else Ka=0;if(na.length===2){na=l(na[1]);if(W)na=na&&!isNaN(na)?+na:na==="undefined"?f:pa[na]!==f?pa[na]:na;if(Ka)for(;Ia<=Ka;Ia++){Aa=Ca[Ia]===""?Fa.length:Ca[Ia];Fa=Fa[Aa]=Ia').hide().insertAfter("body")[0].contentWindow; -J=function(){return b(T.document[c][f])};O=function(Q,V){if(Q!==V){var M=T.document;M.open().close();M[c].hash="#"+Q}};O(b())}}var o={},K,T,O,J;o.start=function(){if(!K){var Q=b();O||B();(function V(){var M=b(),ia=J(Q);if(M!==Q){O(Q=M,ia);a(p).trigger("hashchange")}else if(ia!==Q)p[c][f]=p[c][f].replace(/#.*/,"")+"#"+ia;K=setTimeout(V,a.hashchangeDelay)})()}};o.stop=function(){if(!T){K&&clearTimeout(K);K=0}};return o}()})(jQuery,this);(function(a){var p={},g;a.svgIcons=function(b,n){function s(da,W){if(da!=="ajax"){if(Q)return;var aa=(T=fa[0].contentDocument)&&T.getElementById("svg_eof");if(!aa&&!(W&&aa)){V++;if(V<50)setTimeout(s,20);else{f();Q=true}return}Q=true}K=a(T.firstChild).children();if(n.no_img)setTimeout(function(){J||c()},500);else{aa=oa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";O=a(new Image).attr({src:aa,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}} -function c(da,W){if(!J){if(n.no_img)da=false;if(da){var aa=a(document.createElement("div"));aa.hide().appendTo("body")}if(W){var pa=n.fallback_path?n.fallback_path:"";a.each(W,function(Ka,Na){a("#"+Ka);var za=a(new Image).attr({"class":"svg_icon",src:pa+Na,width:B,height:o,alt:"icon"});ka(za,Ka)})}else for(var ra=K.length,ma=0;ma0&&!da)ya=g(ya,za,true);sa(a(this),ya,Na)})});if(!W){da&&aa.remove();fa&&fa.remove();O&&O.remove()}n.resize&&a.resizeSvgIcons(n.resize);J=true;n.callback&&n.callback(p)}}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 W=Array(Math.floor((da.length+2)/3)*4),aa,pa,ra,ma,na,Aa,Fa=0,Ia=0;do{aa=da.charCodeAt(Fa++);pa=da.charCodeAt(Fa++);ra=da.charCodeAt(Fa++);ma=aa>>2;aa=(aa&3)<<4|pa>>4;na=(pa&15)<<2|ra>>6;Aa=ra&63;if(isNaN(pa))na=Aa=64;else if(isNaN(ra))Aa=64;W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(aa);W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(na); -W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Fa-1&&M.indexOf("Chrome/");var oa="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var fa=a('').appendTo("body").hide();try{T=fa[0].contentDocument;fa.load(s); -s(0,true)}catch(ba){f()}}else{var X=new DOMParser;a.ajax({url:b,dataType:"string",success:function(da){if(da){T=X.parseFromString(da,"text/xml");a(function(){s("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){T=X.parseFromString(da.responseText,"text/xml");T.childNodes.length||a(f);a(function(){s("ajax")})}else a(f)}})}var sa=function(da,W,aa,pa){ia&&W.css("visibility","hidden");if(n.replace){pa&&W.attr("id",aa);(aa=da.attr("class"))&&W.attr("class", -"svg_icon "+aa);da.replaceWith(W)}else da.append(W);ia&&setTimeout(function(){W.removeAttr("style")},1)},ka=function(da,W){if(n.id_match===undefined||n.id_match!==false)sa(holder,da,W,true);p[W]=da};g=function(da,W){var aa=da.find("defs");if(!aa.length)return da;aa=ia?aa.find("*").filter(function(){return!!this.id}):aa.find("[id]");var pa=da[0].getElementsByTagName("*"),ra=pa.length;aa.each(function(ma){var na=this.id;a(T).find("#"+na);this.id=ma="x"+na+W+ma;na="url(#"+na+")";var Aa="url(#"+ma+")"; -for(ma=0;ma","/":"?","\\":"|"}};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("="),Aa=l(ma[0]),Ea=Y,Ia= +0,Ba=Aa.split("]["),Ka=Ba.length-1;if(/\[/.test(Ba[0])&&/\]$/.test(Ba[Ka])){Ba[Ka]=Ba[Ka].replace(/\]$/,"");Ba=Ba.shift().split("[").concat(Ba);Ka=Ba.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++){Aa=Ba[Ia]===""?Ea.length:Ba[Ia];Ea=Ea[Aa]=Ia').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 za=a(new Image).attr({"class":"svg_icon",src:oa+Na,width:C,height:p,alt:"icon"});ia(za,Ka)})}else for(var pa=L.length,la=0;la0&&!da)ya=h(ya,za,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,Aa,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;Aa=pa&63;if(isNaN(oa))ma=Aa=64;else if(isNaN(pa))Aa=64;U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); +U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ea-1&&M.indexOf("Chrome/");var na="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var fa=a('').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 Aa="url(#"+la+")";for(la= +0;la=0;jQuery.fn.jGraduate=function(b){var n= -arguments;return this.each(function(){function s(la,ca,ja,N,R){var ea=R||a("stop",{"stop-color":ca,"stop-opacity":ja,offset:la},X);if(R){ca=R.getAttribute("stop-color");ja=R.getAttribute("stop-opacity");la=R.getAttribute("offset")}else X.appendChild(ea);if(ja===null)ja=1;R=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+la*ia)+", 26)"},qb);var Ga= -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:ca,"fill-opacity":ja,transform:"translate("+(10+la*ia)+", 26)",stroke:"#000","stroke-width":1.5},qb);$(Ga).mousedown(function(Pa){c(this);Sa=ib;Q.mousemove(l).mouseup(f);va=$a.offset();Pa.preventDefault();return false}).data("stop",ea).data("bg",R).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Pa=this,Ya=+ea.getAttribute("stop-opacity")|| -1,db=ea.getAttribute("stop-color")||1,nb=(parseFloat(Ya)*255).toString(16);nb.length<2;)nb="0"+nb;ca=db.substr(1)+nb;$("#"+o+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:B.images.clientPath},color:{active:ca,alphaSupport:true}},function(Ua){db=Ua.val("hex")?"#"+Ua.val("hex"):"none";Ya=Ua.val("a")!==null?Ua.val("a")/256:1;Pa.setAttribute("fill",db);Pa.setAttribute("fill-opacity",Ya);ea.setAttribute("stop-color", -db);ea.setAttribute("stop-opacity",Ya);$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()})});$(X).find("stop").each(function(){var Pa=$(this);if(+this.getAttribute("offset")>la){if(!ca){var Ya=this.getAttribute("stop-color"),db=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Ya);Ga.setAttribute("fill",Ya);ea.setAttribute("stop-opacity",db===null?1:db);Ga.setAttribute("fill-opacity", -db===null?1:db)}Pa.before(ea);return false}});N&&c(Ga);return ea}function c(la){ib&&ib.setAttribute("stroke","#000");la.setAttribute("stroke","blue");ib=la;ib.parentNode.appendChild(ib)}function f(){Q.unbind("mousemove",l);if(Da.getAttribute("display")!=="none"){Da.setAttribute("display","none");var la=$(ib),ca=la.data("stop");la=la.data("bg");$([ib,ca,la]).remove()}Sa=null}function d(){var la=Va?"rotate("+Va+","+Ea+","+kb+") ":"";fb===1&&La===1?X.removeAttribute("gradientTransform"):X.setAttribute("gradientTransform", -la+"translate("+-Ea*(fb-1)+","+-kb*(La-1)+") scale("+fb+","+La+")")}function l(la){var ca=la.pageX-va.left;la=la.pageY-va.top;ca=ca<10?10:ca>ia+10?ia+10:ca;var ja="translate("+ca+", 26)";if(la<-60||la>130){Da.setAttribute("display","block");Da.setAttribute("transform",ja)}else Da.setAttribute("display","none");Sa.setAttribute("transform",ja);$.data(Sa,"bg").setAttribute("transform",ja);$.data(Sa,"stop").setAttribute("offset",(ca-10)/ia);var N=0;$(X).find("stop").each(function(){var R=this.getAttribute("offset"), -ea=$(this);if(R
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var V=$(K+"> .jGraduate_colPick"),M=$(K+"> .jGraduate_gradPick");M.html('

    '+B.window.pickerTitle+'


    ');var ia=256,oa=ia-0,fa=ia-0,ba,X,sa,ka={};$(".jGraduate_SliderBar").width(145);var da=$("#"+o+"_jGraduate_GradContainer")[0],W=a("svg",{id:o+"_jgraduate_svg",width:ia,height:ia,xmlns:p.svg},da);ba=ba||q.paint.type;var aa=X=q.paint[ba],pa=q.paint.alpha,ra=ba==="solidColor";switch(ba){case "solidColor":case "linearGradient":if(!ra){X.id=o+"_lg_jgraduate_grad"; -aa=X=W.appendChild(X)}a("radialGradient",{id:o+"_rg_jgraduate_grad"},W);if(ba==="linearGradient")break;case "radialGradient":if(!ra){X.id=o+"_rg_jgraduate_grad";aa=X=W.appendChild(X)}a("linearGradient",{id:o+"_lg_jgraduate_grad"},W)}if(ra){aa=X=$("#"+o+"_lg_jgraduate_grad")[0];J=q.paint[ba];s(0,"#"+J,1);var ma=typeof B.newstop;if(ma==="string")switch(B.newstop){case "same":s(1,"#"+J,1);break;case "inverse":ma="";for(var na=0;na<6;na+=2){J.substr(na,2);var Aa=(255-parseInt(J.substr(na,2),16)).toString(16); -if(Aa.length<2)Aa=0+Aa;ma+=Aa}s(1,"#"+ma,1);break;case "white":s(1,"#ffffff",1);break;case "black":s(1,"#000000",1)}else if(ma==="object")s(1,B.newstop.color||"#"+J,"opac"in B.newstop?B.newstop.opac:1)}J=parseFloat(aa.getAttribute("x1")||0);ma=parseFloat(aa.getAttribute("y1")||0);na=parseFloat(aa.getAttribute("x2")||1);Aa=parseFloat(aa.getAttribute("y2")||0);var Fa=parseFloat(aa.getAttribute("cx")||0.5),Ia=parseFloat(aa.getAttribute("cy")||0.5),Ca=parseFloat(aa.getAttribute("fx")||Fa),Ka=parseFloat(aa.getAttribute("fy")|| -Ia);sa=a("rect",{id:o+"_jgraduate_rect",x:0,y:0,width:oa,height:fa,fill:"url(#"+o+"_jgraduate_grad)","fill-opacity":pa/100},W);var Na=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ia,left:J*ia}).data("coord","start").appendTo(da),za=Na.clone().text(2).css({top:Aa*ia,left:na*ia}).attr("title","End stop").data("coord","end").appendTo(da),ya=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ia*ia,left:Fa* -ia}).data("coord","center").appendTo(da),Ha=ya.clone().text("F").css({top:Ka*ia,left:Ca*ia,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ha[0].id=o+"_jGraduate_focusCoord";$(K+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(la,ca){var ja=X.getAttribute(ca),N=isNaN(ca[1]);ja||(ja=N?"0.5":ca==="x2"?"1.0":"0.0");ka[ca]=$("#"+o+"_jGraduate_"+ca).val(ja).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(ca[0]==="f"&&!jb))if(N&&ba==="radialGradient"||!N&&ba==="linearGradient")X.setAttribute(ca,this.value);var R=N?ca[0]==="c"?ya:Ha:ca[1]==="1"?Na:za,ea=ca.indexOf("x")>=0?"left":"top";R.css(ea,this.value*ia)}).change()});var wa,qb,$a=$("#"+o+"_jGraduate_StopSlider"),ib,Wa,Sa,Da=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Wa),va,fb=1,La=1,Va=0,Ea=Fa,kb=Ia;Wa=a("svg",{width:"100%",height:45},$a[0]);da=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Wa);a("image",{width:16,height:16},da).setAttributeNS(p.xlink,"xlink:href",B.images.clientPath+"map-opacity.png");$(Wa).on("click touchstart",function(la){va=$a.offset();if(la.target.tagName!=="path"){var ca=la.pageX-va.left-8;ca=ca<10?10:ca>ia+10?ia+10:ca;s(ca/ia,0,0,true);la.stopPropagation()}});$(Wa).mouseover(function(){Wa.appendChild(Da)});qb=a("g",{},Wa);a("line",{x1:10,y1:15,x2:ia+10,y2:15,"stroke-width":2,stroke:"#000"},Wa);var sb= -M.find(".jGraduate_spreadMethod").change(function(){X.setAttribute("spreadMethod",$(this).val())}),Za=null,bb=function(la){var ca=la.pageX-mb.left,ja=la.pageY-mb.top;ca=ca<0?0:ca>ia?ia:ca;ja=ja<0?0:ja>ia?ia:ja;Za.css("left",ca).css("top",ja);ca=ca/oa;ja=ja/fa;var N=Za.data("coord"),R=X;switch(N){case "start":ka.x1.val(ca);ka.y1.val(ja);R.setAttribute("x1",ca);R.setAttribute("y1",ja);break;case "end":ka.x2.val(ca);ka.y2.val(ja);R.setAttribute("x2",ca);R.setAttribute("y2",ja);break;case "center":ka.cx.val(ca); -ka.cy.val(ja);R.setAttribute("cx",ca);R.setAttribute("cy",ja);Ea=ca;kb=ja;d();break;case "focus":ka.fx.val(ca);ka.fy.val(ja);R.setAttribute("fx",ca);R.setAttribute("fy",ja);d()}la.preventDefault()},Bb=function(){Za=null;Q.unbind("mousemove",bb).unbind("mouseup",Bb)};wa=X.getElementsByTagNameNS(p.svg,"stop");if(ta<2){for(;ta<2;){X.appendChild(document.createElementNS(p.svg,"stop"));++ta}wa=X.getElementsByTagNameNS(p.svg,"stop")}var ta=wa.length;for(na=0;na99.5)N=99.5;if(N>0)La=1-N/100;else fb=-(N/100)-1;R=145*((N+100)/ -2)/100;ea&&d();break;case "angle":Va=N;R=Va/180;R+=0.5;R*=145;ea&&d()}if(R>145)R=145;else if(R<0)R=0;ja.css({"margin-left":R-5})}).change()});var tb=function(la){var ca=la.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ca>145)ca=145;if(ca<=0)ca=0;var ja=ca-5;ca/=145;switch(eb.type){case "radius":ca=Math.pow(ca*2,2.5);if(ca>0.98&&ca<1.02)ca=1;if(ca<=0.01)ca=0.01;X.setAttribute("r",ca);break;case "opacity":q.paint.alpha=parseInt(ca*100);sa.setAttribute("fill-opacity",ca);break; -case "ellip":La=fb=1;if(ca<0.5){ca/=0.5;fb=ca<=0?0.01:ca}else if(ca>0.5){ca/=0.5;ca=2-ca;La=ca<=0?0.01:ca}d();ca-=1;if(La===ca+1)ca=Math.abs(ca);break;case "angle":ca-=0.5;Va=ca*=180;d();ca/=100}eb.elem.css({"margin-left":ja});ca=Math.round(ca*100);eb.input.val(ca);la.preventDefault()},ub=function(){Q.unbind("mousemove",tb).unbind("mouseup",ub);eb=null};for(M=(q.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];J=q.paint.solidColor=="none"?"":q.paint.solidColor+M;ra||(J=wa[0].getAttribute("stop-color")); -$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});V.jPicker({window:{title:B.window.pickerTitle},images:{clientPath:B.images.clientPath},color:{active:J,alphaSupport:true}},function(la){q.paint.type="solidColor";q.paint.alpha=la.val("ahex")?Math.round(la.val("a")/255*100):100;q.paint.solidColor=la.val("hex")?la.val("hex"):"none";q.paint.radialGradient=null;T()},null,function(){O()});var wb=$(K+" .jGraduate_tabs li");wb.on("click touchstart",function(){wb.removeClass("jGraduate_tab_current"); -$(this).addClass("jGraduate_tab_current");$(K+" > div").hide();var la=$(this).attr("data-type");$(K+" .jGraduate_gradPick").show();if(la==="rg"||la==="lg"){$(".jGraduate_"+la+"_field").show();$(".jGraduate_"+(la==="lg"?"rg":"lg")+"_field").hide();$("#"+o+"_jgraduate_rect")[0].setAttribute("fill","url(#"+o+"_"+la+"_jgraduate_grad)");ba=la==="lg"?"linearGradient":"radialGradient";$("#"+o+"_jGraduate_OpacInput").val(q.paint.alpha).change();var ca=$("#"+o+"_"+la+"_jgraduate_grad")[0];if(X!==ca){var ja= -$(X).find("stop");$(ca).empty().append(ja);X=ca;ca=sb.val();X.setAttribute("spreadMethod",ca)}jb=la==="rg"&&X.getAttribute("fx")!=null&&!(Fa==Ca&&Ia==Ka);$("#"+o+"_jGraduate_focusCoord").toggle(jb);if(jb)$("#"+o+"_jGraduate_match_ctr")[0].checked=false}else{$(K+" .jGraduate_gradPick").hide();$(K+" .jGraduate_colPick").show()}});$(K+" > div").hide();wb.removeClass("jGraduate_tab_current");var Ab;switch(q.paint.type){case "linearGradient":Ab=$(K+" .jGraduate_tab_lingrad");break;case "radialGradient":Ab= -$(K+" .jGraduate_tab_radgrad");break;default:Ab=$(K+" .jGraduate_tab_color")}q.show();setTimeout(function(){Ab.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),p=$(document);$.extend($.fn,{contextMenu:function(g,b){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var n=$(this),s=$(n).offset(),c=$("#"+g.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(l){var q=$(this);q.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| -g.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(l,d,q)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var l=$(this);l.unbind("mouseup");f(d,d,l)});var f=function(d,l,q){if(typeof l=="undefined")l=d;d.stopPropagation();if(n.hasClass("disabled")||l.altKey)return false;var B=d.pageX,o=d.pageY;if(svgedit.browser.isTouch()){B=d.originalEvent.touches[0].pageX;o=d.originalEvent.touches[0].pageY}d=a.width()-c.width();l=a.height()-c.height();if(B>d-15)B=d-15; -if(o>l-30)o=l-30;if(svgedit.browser.isTouch())o-=c.height()/2;p.unbind("click");c.css({top:o,left:B}).fadeIn(g.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});p.keypress(function(K){switch(K.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:p.trigger("click")}});c.find("A").unbind("mouseup");c.find("LI:not(.disabled) A").mouseup(function(){p.unbind("click").unbind("keypress");$(".contextMenu").hide();b&&b($(this).attr("href").substr(1), -$(q),{x:B-s.left,y:o-s.top,docX:B,docY:o});return false});setTimeout(function(){p.click(function(){p.unbind("click").unbind("keypress");c.fadeOut(g.outSpeed);return false})},0)};if($.browser.mozilla)$("#"+g.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+g.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+g.menu).each(function(){$(this).bind("mousedown.disableTextSelect",function(){return false})});$(n).add($("UL.contextMenu")).bind("contextmenu", -function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),n=0;n=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
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var T=$(L+"> .jGraduate_colPick"),M=$(L+"> .jGraduate_gradPick");M.html('

    '+C.window.pickerTitle+'


    ');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 Aa=(255-parseInt(K.substr(ma,2),16)).toString(16); +if(Aa.length<2)Aa=0+Aa;la+=Aa}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);Aa=parseFloat(Y.getAttribute("y2")||0);var Ea=parseFloat(Y.getAttribute("cx")||0.5),Ia=parseFloat(Y.getAttribute("cy")||0.5),Ba=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=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:la*ha,left:K*ha}).data("coord","start").appendTo(da),za=Na.clone().text(2).css({top:Aa*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(da),ya=$("
    ").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:Ba*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:za,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;ma99.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==Ba&&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=0,s=p.indexOf("Gecko/")>=0,c=p.indexOf("MSIE")>=0,f=p.indexOf("Chrome/")>=0,d=p.indexOf("Windows")>=0,l=p.indexOf("Macintosh")>= -0,q="ontouchstart"in window,B=!!g.querySelector,o=!!document.evaluate,K=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var fa=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{fa.replaceItem(oa,0);return true}catch(ba){}return false}(),T=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var fa=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{fa.insertItemBefore(oa, -0);return true}catch(ba){}return false}(),O=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg"),fa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);fa.setAttribute("x",5);oa.appendChild(fa);var ba=document.createElementNS("http://www.w3.org/2000/svg","text");ba.textContent="a";fa.appendChild(ba);fa=ba.getStartPositionOfChar(0).x;document.documentElement.removeChild(oa);return fa===0}(),J=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(oa);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 C0,0 10,10 10,0");oa.appendChild(fa);fa=fa.getBBox();document.documentElement.removeChild(oa);return fa.height>4&&fa.height<5}(),Q=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 10,0");var ba= -document.createElementNS("http://www.w3.org/2000/svg","path");ba.setAttribute("d","M5,0 15,0");var X=document.createElementNS("http://www.w3.org/2000/svg","g");X.appendChild(fa);X.appendChild(ba);oa.appendChild(X);fa=X.getBBox();document.documentElement.removeChild(oa);return fa.width==15}(),V=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect");oa.setAttribute("x",0.1);(oa=oa.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 latest version in which the problems have been fixed."); -return oa}(),M=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect");oa.setAttribute("style","vector-effect:non-scaling-stroke");return oa.style.vectorEffect==="non-scaling-stroke"}(),ia=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,fa=g.createSVGTransform();oa.appendItem(fa);return oa.getItem(0)==fa}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return s}; -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 q};svgedit.browser.supportsSelectors=function(){return B};svgedit.browser.supportsXpath=function(){return o};svgedit.browser.supportsPathReplaceItem=function(){return K};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return J}; -svgedit.browser.supportsHVLineContainerBBox=function(){return Q};svgedit.browser.supportsGoodTextCharPos=function(){return O};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return M};svgedit.browser.supportsNativeTransformLists=function(){return ia}}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"),p={};svgedit.transformlist.SVGTransformList=function(g){this._elem=g||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var n=0;n=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,n){var s=null;if(n>=0)if(n=0){this._removeFromOtherLists(b);s=this._xforms[n]=b;this._list._update()}return s};this.removeItem=function(b){if(b=0){for(var n=this._xforms[b],s=Array(this.numberOfItems- -1),c=0;c1;)b=p[g-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(p){if(!p)return false;for(var g=p.numberOfItems;g--;){var b=p.getItem(g);if(b.type==1&&!svgedit.math.isIdentity(b.matrix))return true}return false};svgedit.math.transformBox=function(p,g,b,n,s){var c={x:p,y:g},f={x:p+b,y:g};b={x:p+b,y:g+n};p={x:p,y:g+n};g=svgedit.math.transformPoint;c=g(c.x,c.y,s);var d=n=c.x,l=c.y,q=c.y;f=g(f.x,f.y,s);n=Math.min(n,f.x);d=Math.max(d,f.x); -l=Math.min(l,f.y);q=Math.max(q,f.y);p=g(p.x,p.y,s);n=Math.min(n,p.x);d=Math.max(d,p.x);l=Math.min(l,p.y);q=Math.max(q,p.y);b=g(b.x,b.y,s);n=Math.min(n,b.x);d=Math.max(d,b.x);l=Math.min(l,b.y);q=Math.max(q,b.y);return{tl:c,tr:f,bl:p,br:b,aabox:{x:n,y:l,width:d-n,height:q-l}}};svgedit.math.transformListToTransform=function(p,g,b){if(p==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());g=g==undefined?0:g;b=b==undefined?p.numberOfItems-1:b;g=parseInt(g);b=parseInt(b);if(g>b){var n=b;b=g; -g=n}n=a.createSVGMatrix();for(g=g;g<=b;++g){var s=g>=0&&gp.x&&g.yp.y}})();svgedit=svgedit||{}; -(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],p=["y","y1","cy","ry","height"],g=$.merge(["r","radius"],a);$.merge(g,p);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); +(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 latest version 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=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,n){var u=null;if(n>=0)if(n=0){this._removeFromOtherLists(b);u=this._xforms[n]=b;this._list._update()}return u};this.removeItem=function(b){if(b=0){for(var n=this._xforms[b],u=Array(this.numberOfItems- +1),c=0;c1;)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&&hq.x&&h.yq.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 s={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=s[f])for(var l=f.length,q=0;q=0?d*l:p.indexOf(c)>=0?d*q:d*Math.sqrt(l*l+q*q)/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(g.indexOf(c)>=0)if(isNaN(f)){f=f.toLowerCase();$.each(n,function(o){if(!l)if(RegExp("^-?[\\d\\.]+"+o+"$").test(f))l=true})}else l=true;else if(c=="id"){c=false;try{var q=b.getElement(f); -c=q==null||q===d}catch(B){}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 q=$(d).children().clone().attr("visibility","hidden");$(s).append(q);l=q.filter("line, path")}else l=$(c).find("line, path");var B=false;if(l.length){l.each(function(){var o=this.getBBox();if(!o.width||!o.height)B=true});if(B){c=d?q:$(c).children();ret=getStrokedBBox(c)}else ret=c.getBBox()}else ret=c.getBBox();d&&q.remove();return ret}if(!svgedit.utilities)svgedit.utilities= -{};var p="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,b=null,n=null,s=null;svgedit.utilities.init=function(c){g=c;b=c.getDOMDocument();n=c.getDOMContainer();s=c.getSVGRoot()};svgedit.utilities.toXml=function(c){return $("

    ").text(c).html()};svgedit.utilities.fromXml=function(c){return $("

    ").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,q,B,o,K,T=0,O=0;do{d=c.charCodeAt(T++);l=c.charCodeAt(T++);q=c.charCodeAt(T++);B=d>>2;d=(d&3)<<4|l>>4;o=(l&15)<<2|q>>6;K=q&63;if(isNaN(l))o=K=64;else if(isNaN(q))K=64;f[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(B);f[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);f[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(o);f[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(K)}while(T< -c.length);return f.join("")};svgedit.utilities.decode64=function(c){if(window.atob)return window.atob(c);var f="",d,l,q="",B,o="",K=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(K++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(K++));B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(K++));o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(K++)); -d=d<<2|l>>4;l=(l&15)<<4|B>>2;q=(B&3)<<6|o;f+=String.fromCharCode(d);if(B!=64)f+=String.fromCharCode(l);if(o!=64)f+=String.fromCharCode(q)}while(K127)f+="&#"+l+";"}return f};svgedit.utilities.text2xml=function(c){if(c.indexOf("=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(q){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)}}; +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=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 $("

    ").text(c).html()};svgedit.utilities.fromXml=function(c){return $("

    ").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(L127)f+="&#"+l+";"}return f};svgedit.utilities.text2xml=function(c){if(c.indexOf("=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=g.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), -q=[l.x,l.y];for(l=0;l0?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= -0){var l=d.split(":");c[l[1]]=p[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 s=n.parentNode;if(n.ownerDocument&&s){var c=g[n.nodeName],f=b[n.nodeName];if(c!=undefined){for(var d=[],l=n.attributes.length;l--;){var q=n.attributes.item(l),B=q.nodeName, -o=q.localName,K=q.namespaceURI;if(!(f.hasOwnProperty(o)&&K==f[o]&&K!="http://www.w3.org/2000/xmlns/")&&!(K=="http://www.w3.org/2000/xmlns/"&&a[q.nodeValue])){B.indexOf("se:")==0&&d.push([B,q.nodeValue]);n.removeAttributeNS(K,o)}if(svgedit.browser.isGecko())switch(B){case "transform":case "gradientTransform":case "patternTransform":o=q.nodeValue.replace(/(\d)-/g,"$1 -");n.setAttribute(B,o)}if(B=="style"){q=q.nodeValue.split(";");for(B=q.length;B--;){o=q[B].split(":");c.indexOf(o[0])>=0&&n.setAttribute(o[0], -o[1])}n.removeAttribute("style")}}$.each(d,function(T,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))s.removeChild(n);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],function(T,O){var J=n.getAttribute(O);if(J)if((J=svgedit.utilities.getUrlFromAttr(J))&&J[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(s.insertBefore(n.firstChild,n));s.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,p,g,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=p;this.oldParent=g;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= +"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,p){this.elem=a;this.text=p||"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= +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,p,g,b){this.elem=a;this.text=b||"Delete "+a.tagName;this.nextSibling=p;this.parent=g;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"}; +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,p,g){this.elem=a;this.text=g?"Change "+a.tagName+" "+g:"Change "+a.tagName;this.newValues={};this.oldValues=p;for(var b in p)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 p=false,g;for(g in this.newValues){if(this.newValues[g])if(g=="#text")this.elem.textContent=this.newValues[g];else g=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[g]):this.elem.setAttribute(g,this.newValues[g]);else if(g=="#text")this.elem.textContent="";else{this.elem.setAttribute(g,"");this.elem.removeAttribute(g)}if(g== -"transform")p=true}if(!p)if(p=svgedit.utilities.getRotationAngle(this.elem)){g=elem.getBBox();p=["rotate(",p," ",g.x+g.width/2,",",g.y+g.height/2,")"].join("");p!=elem.getAttribute("transform")&&elem.setAttribute("transform",p)}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 p=false,g;for(g in this.oldValues){if(this.oldValues[g])if(g== -"#text")this.elem.textContent=this.oldValues[g];else g=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[g]):this.elem.setAttribute(g,this.oldValues[g]);else if(g=="#text")this.elem.textContent="";else this.elem.removeAttribute(g);if(g=="transform")p=true}if(!p)if(p=svgedit.utilities.getRotationAngle(this.elem)){g=this.elem.getBBox();p=["rotate(",p," ",g.x+g.width/2,",",g.y+g.height/2,")"].join("");p!=this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",p)}svgedit.transformlist.removeElementFromListMap(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 p=this.stack.length,g=0;g=0;p--)this.stack[p].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, -this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],p=this.stack.length;p--;)for(var g=this.stack[p].elements(),b=g.length;b--;)a.indexOf(g[b])==-1&&a.push(g[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= +function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var q=this.stack.length,h=0;h=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.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}; -svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,p){for(var g=++this.undoChangeStackPointer,b=p.length,n=Array(b),s=Array(b);b--;){var c=p[b];if(c!=null){s[b]=c;n[b]=c.getAttribute(a)}}this.undoableChangeStack[g]= -{attrName:a,oldValues:n,elements:s}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,p=this.undoableChangeStack[a],g=p.elements.length,b=p.attrName,n=new svgedit.history.BatchCommand("Change "+b);g--;){var s=p.elements[g];if(s!=null){var c={};c[b]=p.oldValues[g];c[b]!=s.getAttribute(b)&&n.addSubCommand(new svgedit.history.ChangeElementCommand(s,c,b))}}this.undoableChangeStack[a]=null;return n}})();svgedit=svgedit||{}; -(function(){if(!svgedit.select)svgedit.select={};var a,p,g;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 s in g.selectorGrips)n.push(s);for(;b>0;){n.push(n.shift());b--}b=0;for(s in g.selectorGrips){g.selectorGrips[s].setAttribute("style", -"cursor:"+n[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){g.selectorGripsGroup.setAttribute("display",b?"inline":"none");var n=this.selectedElement;this.hasGrips=b;if(n&&b){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(n))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,n=g,s=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 q=c.tagName;if(q==="text")l+=2/d;f=svgedit.transformlist.getTransformList(c);f=svgedit.math.transformListToTransform(f).matrix;f.e*=d;f.f*=d;var B=svgedit.utilities.getBBox(c);if(q==="g"&&!$.data(c,"gsvg"))if(q=a.getStrokedBBox(c.childNodes))B=q;q=B.x;var o=B.y,K=B.width;B=B.height;l*=d;d=svgedit.math.transformBox(q*d,o*d,K*d,B*d,f);f=d.aabox;q=f.x-l;o=f.y-l;K=f.width+l*2;var T=f.height+l*2;f=q+K/2;B=o+T/2;if(c=svgedit.utilities.getRotationAngle(c)){q=a.svgRoot().createSVGTransform(); -q.setRotate(-c,f,B);q=q.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,q);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,q);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,q);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,q);q=d.tl;K=q.x;T=q.y;var O=q.x,J=q.y;q=Math.min;o=Math.max;K=q(K,q(d.tr.x,q(d.bl.x,d.br.x)))-l;T=q(T,q(d.tr.y,q(d.bl.y,d.br.y)))-l;O=o(O,o(d.tr.x,o(d.bl.x,d.br.x)))+l;J=o(J,o(d.tr.y,o(d.bl.y,d.br.y)))+l;q=K;o=T;K=O-K;T=J-T}l=a.svgRoot().suspendRedraw(100);b.setAttribute("d", -"M"+q+","+o+" L"+(q+K)+","+o+" "+(q+K)+","+(o+T)+" "+q+","+(o+T)+"z");this.selectorGroup.setAttribute("transform",c?"rotate("+[c,f,B].join(",")+")":"");if(svgedit.browser.isTouch()){q-=15.75;o-=15.75}else{q-=4;o-=4}this.gripCoords={nw:[q,o].map(Math.round),ne:[q+K,o].map(Math.round),sw:[q,o+T].map(Math.round),se:[q+K,o+T].map(Math.round),n:[q+K/2,o].map(Math.round),w:[q,o+T/2].map(Math.round),e:[q+K,o+T/2].map(Math.round),s:[q+K/2,o+T].map(Math.round)};for(var Q in this.gripCoords){b=this.gripCoords[Q]; -s[Q].setAttribute("x",b[0]);s[Q].setAttribute("y",b[1])}this.rotateCoords={nw:[q,o],ne:[q+K+8,o],sw:[q,o+T+8],se:[q+K+8,o+T+8]};for(Q in this.rotateCoords){b=this.rotateCoords[Q];n.rotateGrips[Q].setAttribute("cx",b[0]);n.rotateGrips[Q].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}; +svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)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("+p.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=p.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 s=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(s);s.appendChild(c);s.appendChild(f);s.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 s=0;s element";this.svgElem_=b;this.obj_num=0;this.idPrefix=n||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= -"";var s=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(s&&g!=p.NEVER_RANDOMIZE)this.nonce_=s;else g==p.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_}; +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 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 s=this.getId();this.getElem_(s);){if(n){this.obj_num=b;n=false}this.obj_num++;s=this.getId()}if(n)this.obj_num=b;return s};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.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=0&&b1){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=[],s=[],c=null,f=false,d=0;d0||!f){for(d=1;s.indexOf("Layer "+d)>=0;)d++;s="Layer "+d;c=b.createElementNS("http://www.w3.org/2000/svg","g");f=b.createElementNS("http://www.w3.org/2000/svg","title");f.textContent=s; -c.appendChild(f);for(f=0;f1))for(var s=0;s1){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;d0||!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;f1))for(var u=0;u0){f=T0){f=R 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?null:f[l+1],K=l-1<0?null:f[l-1];if(B.type===2){if(K&&K.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip()}q=l}else if(o&&o.type===1){B.next=f[q+1];B.next.prev=B;B.mate=f[q];B.addGrip();if(this.first_seg==null)this.first_seg=B}else if(o){if(B.type!==1){B.addGrip();if(o&&o.type!==2){B.next=o;B.next.prev=B}}}else if(B.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip();B.addGrip();if(!this.first_seg)this.first_seg= -f[q]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var d=this.segs.length,l=0;l 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?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').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:s[0],height:s[1],x:s[0],y:s[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 q="svg_";c.setIdPrefix= -function(e){q=e};c.current_drawing_=new svgedit.draw.Drawing(l,q);var B=c.getCurrentDrawing=function(){return c.current_drawing_},o=1,K=null,T={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}};T.text=$.extend(true,{},T.shape);$.extend(T.text, -{fill:"#000000",stroke_width:0,font_size:24,font_family:"Helvetica, Arial, sans-serif"});var O=T.shape,J=Array(1),Q=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),m=B().getCurrentLayer();if(h&&e.element!=h.tagName){m.removeChild(h);h=null}if(!h){h=f.createElementNS(b,e.element);if(m)(K||m).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{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(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},V=c.getTransformList=svgedit.transformlist.getTransformList,M=svgedit.math.transformPoint,ia=c.matrixMultiply=svgedit.math.matrixMultiply,oa=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,fa=c.transformListToTransform=svgedit.math.transformListToTransform, -ba=svgedit.math.snapToAngle,X=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return n.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/o},getWidth:function(){return l.getAttribute("width")/o},getRoundDigits:function(){return fb.round_digits}});var sa=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return J}, -getSVGContent:function(){return l}});var ka=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,da=c.getHref=svgedit.utilities.getHref,W=c.setHref=svgedit.utilities.setHref,aa=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var pa=c.getRotationAngle=svgedit.utilities.getRotationAngle,ra=c.getElem=svgedit.utilities.getElem,ma=c.assignAttributes=svgedit.utilities.assignAttributes,na=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Fa=c.sanitizeSvg= -svgedit.sanitize.sanitizeSvg,Ia=svgedit.history.MoveElementCommand,Ca=svgedit.history.InsertElementCommand,Ka=svgedit.history.RemoveElementCommand,Na=svgedit.history.ChangeElementCommand,za=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,h){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 z=h.elements();c.pathActions.clear();N("changed",z);z=h.type(); -m=e==m.AFTER_APPLY;if(z==Ia.type()){m=m?h.newParent:h.oldParent;m==l&&c.identifyLayers()}else if(z==Ca.type()||z==Ka.type()){h.parent==l&&c.identifyLayers();if(z==Ca.type())m&&Wa(h.elem);else m||Wa(h.elem);h.elem.tagName==="use"&&Lb(h.elem)}else if(z==Na.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&c.identifyLayers();m=m?h.newValues:h.oldValues;m.stdDeviation&&c.setBlurOffsets(h.elem.parentNode,m.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){z=h.elem;if(!z.getAttribute("x")&& -!z.getAttribute("y")){m=z.parentNode;var w=z.nextSibling;m.removeChild(z);m.insertBefore(z,w)}}}}}});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 o},getStrokedBBox:function(e){return c.getStrokedBBox([e])}});var Ha=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return o}, -getSVGRoot:function(){return d}});svgedit.utilities.snapToGrid=function(e){var h=n.snappingStep,m=n.baseUnit;if(m!=="px")h*=svgedit.units.getTypeMap()[m];return e=Math.round(e/h)*h};var wa=svgedit.utilities.snapToGrid,qb={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"},$a=["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],ib=$.data,Wa=function(e){var h=$(e).attr($a),m;for(m in h){var z=h[m];if(z&&z.indexOf("url(")===0){z=ka(z).substr(1);if(!ra(z)){lb().appendChild(zb[z]);delete zb[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(m=e.length;h=0)D=G=c.convertToPath(I,true);else if(I.tagName=="rect"){var L=I.getAttribute("rx"),k=I.getAttribute("ry");if(L||k)D=G=c.convertToPath(I,true)}if(!G){var v=I.cloneNode(true),C=document.createElementNS(b,"g"),F=I.parentNode;F.appendChild(C);C.appendChild(v);D=svgedit.utilities.bboxToObj(C.getBBox());F.removeChild(C)}}return D}catch(P){console.log(I,P);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=h(this)}); -if(m==null)return null;var z=m.x+m.width,w=m.y+m.height,H=m.x,A=m.y,u=function(I){var D=I.getAttribute("stroke-width"),G=0;if(I.getAttribute("stroke")!="none"&&!isNaN(D))G+=D/2;return G},E=[];$.each(e,function(I,D){var G=h(D);if(G){var L=u(D);H=Math.min(H,G.x-L);A=Math.min(A,G.y-L);E.push(G)}});m.x=H;m.y=A;$.each(e,function(I,D){var G=E[I];if(G&&D.nodeType==1){var L=u(D);z=Math.max(z,G.x+G.width+L);w=Math.max(w,G.y+G.height+L)}});m.width=z-H;m.height=w-A;return m};var ub=this.getVisibleElements=function(e){e|| -(e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(m,z){try{z.getBBox()&&h.push(z)}catch(w){}});return h.reverse()},wb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var h=[];$(e).children().each(function(m,z){try{z.getBBox()&&h.push({elem:z,bbox:getStrokedBBox([z])})}catch(w){}});return h.reverse()},Ab=this.groupSvgElem=function(e){var h=document.createElementNS(b,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg", -e)[0].id=ja()},la=function(e){var h=document.createElementNS(e.namespaceURI,e.nodeName);h.removeAttribute("id");$.each(e.attributes,function(z,w){w.localName!="-moz-math-font-style"&&h.setAttributeNS(w.namespaceURI,w.nodeName,w.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var m=Ja.convertPath(e);h.setAttribute("d",m)}$.each(e.childNodes,function(z,w){switch(w.nodeType){case 1:h.appendChild(la(w));break;case 3:h.textContent=w.nodeValue}});if($(e).data("gsvg"))$(h).data("gsvg",h.firstChild); -else if($(e).data("symbol")){e=$(e).data("symbol");$(h).data("ref",e).data("symbol",e)}else h.tagName=="image"&&pb(h);h.id=ja();return h},ca,ja,N;(function(e){var h={};ca=e.getId=function(){return B().getId()};ja=e.getNextId=function(){return B().getNextId()};N=e.call=function(m,z){if(h[m])return h[m](this,z)};e.bind=function(m,z){var w=h[m];h[m]=z;return w}})(c);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var h=0,m=e.length;h -0&&w.getItem(0).type==4&&w.removeItem(0);if(e!=0){H=M(H,A,fa(w).matrix);A=d.createSVGTransform();A.setRotate(e,H.x,H.y);w.numberOfItems?w.insertItemBefore(A,0):w.appendItem(A)}else w.numberOfItems==0&&m.removeAttribute("transform");if(!h){w=m.getAttribute("transform");m.setAttribute("transform",z);gb("transform",w,J);N("changed",J)}ra("pathpointgrip_container");m=Ha.requestSelector(J[0]);m.resize();m.updateGripCursors(e)};var Ga=this.recalculateAllSelectedDimensions=function(){for(var e=new za(kb== -"none"?"position":"size"),h=J.length;h--;){var m=Ua(J[h]);m&&e.addSubCommand(m)}if(!e.isEmpty()){ya(e);N("changed",J)}},Pa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Ya=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},db=this.remapElement=function(e,h,m){var z=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",w=function(){if(z)for(var G in h)h[G]=wa(h[G]);ma(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var H=0;H<2;H++){var A=H===0?"fill":"stroke", -u=e.getAttribute(A);if(u&&u.indexOf("url(")===0)if(m.a<0||m.d<0){u=R(u).cloneNode(true);if(m.a<0){var E=u.getAttribute("x1"),I=u.getAttribute("x2");u.setAttribute("x1",-(E-1));u.setAttribute("x2",-(I-1))}if(m.d<0){E=u.getAttribute("y1");I=u.getAttribute("y2");u.setAttribute("y1",-(E-1));u.setAttribute("y2",-(I-1))}u.id=ja();lb().appendChild(u);e.setAttribute(A,"url(#"+u.id+")")}}H=e.tagName;if(H==="g"||H==="text"||H==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){A=fa(e).matrix;A=ia(A.inverse(), -m,A);h.x=parseFloat(h.x)+A.e;h.y=parseFloat(h.y)+A.f}else{A=V(e);u=d.createSVGTransform();u.setMatrix(ia(fa(A).matrix,m));A.clear();A.appendItem(u)}switch(H){case "foreignObject":case "rect":case "image":if(H==="image"&&(m.a<0||m.d<0)){A=V(e);u=d.createSVGTransform();u.setMatrix(ia(fa(A).matrix,m));A.clear();A.appendItem(u)}else{A=M(h.x,h.y,m);h.width=m.a*h.width;h.height=m.d*h.height;h.x=A.x+Math.min(0,h.width);h.y=A.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}w(); -break;case "ellipse":H=M(h.cx,h.cy,m);h.cx=H.x;h.cy=H.y;h.rx=m.a*h.rx;h.ry=m.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);w();break;case "circle":H=M(h.cx,h.cy,m);h.cx=H.x;h.cy=H.y;H=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);h.r=Math.min((H.tr.x-H.tl.x)/2,(H.bl.y-H.tl.y)/2);if(h.r)h.r=Math.abs(h.r);w();break;case "line":A=M(h.x1,h.y1,m);E=M(h.x2,h.y2,m);h.x1=A.x;h.y1=A.y;h.x2=E.x;h.y2=E.y;case "text":m=e.querySelectorAll("tspan");for(H=m.length;H--;){A=sa("x",e.getAttribute("x")); -u=sa("x",m[H].getAttribute("x"));E=sa("y",e.getAttribute("y"));I=sa("y",m[H].getAttribute("y"));var D={};if(!isNaN(A)&&!isNaN(u)&&A!=0&&u!=0&&h.x)D.x=h.x-(A-u);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&h.y)D.y=h.y-(E-I);if(D.x||D.y)ma(m[H],D,1E3,true)}w();break;case "use":w();break;case "g":(w=$(e).data("gsvg"))&&ma(w,h,1E3,true);break;case "polyline":case "polygon":w=h.points.length;for(H=0;H0){for(var m=h.numberOfItems;m--;){var z=h.getItem(m);if(z.type===0)h.removeItem(m);else if(z.type=== -1)svgedit.math.isIdentity(z.matrix)&&h.removeItem(m);else z.type===4&&z.angle===0&&h.removeItem(m)}if(h.numberOfItems===1&&pa(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){m=h.numberOfItems;for(var w=[];m--;){z=h.getItem(m);if(z.type===1)w.push([z.matrix,m]);else if(w.length)w=[]}if(w.length===2){m=d.createSVGTransformFromMatrix(ia(w[1][0],w[0][0]));h.removeItem(w[0][1]);h.removeItem(w[1][1]);h.insertItemBefore(m,w[1][1])}m=h.numberOfItems;if(m>=2&&h.getItem(m- -2).type===1&&h.getItem(m-1).type===2){w=d.createSVGTransform();z=ia(h.getItem(m-2).matrix,h.getItem(m-1).matrix);w.setMatrix(z);h.removeItem(m-2);h.removeItem(m-2);h.appendItem(w)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var H=$(e).data("gsvg");m=new za("Transform");var A={},u=null;z=[];switch(e.tagName){case "line":z=["x1","y1", -"x2","y2"];break;case "circle":z=["cx","cy","r"];break;case "ellipse":z=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":z=["width","height","x","y"];break;case "use":case "text":case "tspan":z=["x","y"];break;case "polygon":case "polyline":u={};u.points=e.getAttribute("points");w=e.points;var E=w.numberOfItems;A.points=Array(E);for(var I=0;I1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&h.getItem(k-2).type==3&&h.getItem(k-3).type==2&&h.getItem(k-1).type==2){I=3;var C=h.getItem(k-3).matrix,F=h.getItem(k-2).matrix,P=h.getItem(k-1).matrix;E=e.childNodes;for(D=E.length;D--;){var U=E.item(D);z=H=0;if(U.nodeType==1){var S=V(U);if(S){z=fa(S).matrix;H=pa(U);var Y=Va,Z=[];Va=U.getAttribute("transform");if(H||oa(S)){var ga= -d.createSVGTransform();ga.setMatrix(ia(C,F,P,z));S.clear();S.appendItem(ga);Z.push(ga)}else{H=ia(z.inverse(),P,z);ga=d.createSVGMatrix();ga.e=-H.e;ga.f=-H.f;z=ia(ga.inverse(),z.inverse(),C,F,P,z,H.inverse());var qa=d.createSVGTransform(),Oa=d.createSVGTransform(),Ba=d.createSVGTransform();qa.setTranslate(H.e,H.f);Oa.setScale(z.a,z.d);Ba.setTranslate(ga.e,ga.f);S.appendItem(Ba);S.appendItem(Oa);S.appendItem(qa);Z.push(Ba);Z.push(Oa);Z.push(qa)}m.addSubCommand(Ua(U));Va=Y}}}h.removeItem(k-1);h.removeItem(k- -2);h.removeItem(k-3)}else if(k>=3&&h.getItem(k-1).type==1){I=3;z=fa(h).matrix;ga=d.createSVGTransform();ga.setMatrix(z);h.clear();h.appendItem(ga)}else if((k==1||k>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){I=2;H=fa(h).matrix;h.removeItem(0);z=fa(h).matrix.inverse();z=ia(z,H);H=z.e;z=z.f;if(H!=0||z!=0){E=e.childNodes;D=E.length;for(k=[];D--;){U=E.item(D);if(U.nodeType==1){if(U.getAttribute("clip-path")){Y=U.getAttribute("clip-path");if(k.indexOf(Y)===-1){nb(Y,H,z);k.push(Y)}}Y=Va;Va=U.getAttribute("transform"); -if(S=V(U)){C=d.createSVGTransform();C.setTranslate(H,z);S.numberOfItems?S.insertItemBefore(C,0):S.appendItem(C);m.addSubCommand(Ua(U));S=e.getElementsByTagNameNS(b,"use");U="#"+U.id;for(C=S.length;C--;){F=S.item(C);if(U==da(F)){P=d.createSVGTransform();P.setTranslate(-H,-z);V(F).insertItemBefore(P,0);m.addSubCommand(Ua(F))}}Va=Y}}}k=[];Va=Y}}else if(k==1&&h.getItem(0).type==1&&!w){I=1;z=h.getItem(0).matrix;E=e.childNodes;for(D=E.length;D--;){U=E.item(D);if(U.nodeType==1){Y=Va;Va=U.getAttribute("transform"); -if(S=V(U)){H=ia(z,fa(S).matrix);k=d.createSVGTransform();k.setMatrix(H);S.clear();S.appendItem(k,0);m.addSubCommand(Ua(U));Va=Y;Y=U.getAttribute("stroke-width");U.getAttribute("stroke")!=="none"&&!isNaN(Y)&&U.setAttribute("stroke-width",Y*((Math.abs(H.a)+Math.abs(H.d))/2))}}}h.clear()}else{if(w){G=d.createSVGTransform();G.setRotate(w,L.x,L.y);h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(w){L={x:G.x+v.e,y:G.y+v.f}; -G=d.createSVGTransform();G.setRotate(w,L.x,L.y);h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}}else if(I==3){z=fa(h).matrix;v=d.createSVGTransform();v.setRotate(w,G.x,G.y);v=v.matrix;G=d.createSVGTransform();G.setRotate(w,L.x,L.y);L=G.matrix.inverse();Y=z.inverse();L=ia(Y,L,v,z);H=L.e;z=L.f;if(H!=0||z!=0){E=e.childNodes;for(D=E.length;D--;){U=E.item(D);if(U.nodeType==1){Y=Va;Va=U.getAttribute("transform");S=V(U);C=d.createSVGTransform();C.setTranslate(H,z);S.numberOfItems?S.insertItemBefore(C, -0):S.appendItem(C);m.addSubCommand(Ua(U));Va=Y}}}if(w)h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}}else{w=svgedit.utilities.getBBox(e);if(!w&&e.tagName!="path")return null;z=d.createSVGMatrix();if(H=pa(e)){G={x:w.x+w.width/2,y:w.y+w.height/2};L=M(w.x+w.width/2,w.y+w.height/2,fa(h).matrix);I=H*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&h.getItem(k-2).type==3&&h.getItem(k-3).type==2&&h.getItem(k-1).type==2){I=3;z=fa(h,k-3,k-1).matrix;h.removeItem(k-1);h.removeItem(k-2);h.removeItem(k-3)}else if(k== -4&&h.getItem(k-1).type==1){I=3;z=fa(h).matrix;ga=d.createSVGTransform();ga.setMatrix(z);h.clear();h.appendItem(ga);z=d.createSVGMatrix()}else if((k==1||k>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){I=2;v=h.getItem(0).matrix;Y=fa(h,1).matrix;w=Y.inverse();z=ia(w,v,Y);h.removeItem(0)}else if(k==1&&h.getItem(0).type==1&&!H){z=fa(h).matrix;switch(e.tagName){case "line":A=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":A.points=e.getAttribute("points");if(A.points){w=e.points;E=w.numberOfItems; -A.points=Array(E);for(I=0;I1&&w.showGrips(false)}}}N("selected",J);h||J.length==1?Ha.requestSelector(J[0]).showGrips(true):Ha.requestSelector(J[0]).showGrips(false);for(J.sort(function(H,A){if(H&&A&&H.compareDocumentPosition)return 3- -(A.compareDocumentPosition(H)&6);else if(H==null)return 1});J[0]==null;)J.shift(0)}},xb=this.selectOnly=function(e,h){Qa(true);vb(e,h)};this.removeFromSelection=function(e){if(J[0]!=null)if(e.length!=0){var h=Array(J.length);j=0;len=J.length;for(var m=0;m=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,l,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ha.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,m=null,z= -null,w=null,H={},A={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(u){if(!(u.originalEvent.touches&&u.originalEvent.touches>1)){var E=u.button===2;rb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=M(u.pageX,u.pageY,rb),D=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);u.preventDefault();if(E)Ea="select";D=D/o;I=I/o;var G=Ib(u);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=D,k=w=m=I;if(n.gridSnapping){D=wa(D);I=wa(I);h=wa(h);m=wa(m)}if(G== -Ha.selectorParentGroup&&J[0]!=null){G=u.target;var v=ib(G,"type");if(v=="rotate"){Ea="rotate";current_rotate_mode=ib(G,"dir")}else if(v=="resize"){Ea="resize";kb=ib(G,"dir")}G=J[0]}Va=G.getAttribute("transform");v=V(G);switch(Ea){case "select":La=true;kb="none";if(E)La=false;if(G!=d){if(J.indexOf(G)==-1){u.shiftKey||Qa(true);vb([G]);Bb=G;Ja.clear()}if(!E)for(E=0;E1))if(La)if(!(u.button=== -1||c.spaceKey)){var E=J[0],I=M(u.pageX,u.pageY,rb),D=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);var G=ra(ca()),L=x=D/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}u.preventDefault();switch(Ea){case "select":if(J[0]!==null){L=x-h;var v=y-m;if(n.gridSnapping){L=wa(L);v=wa(v)}if(u.shiftKey){var C=ba(h,m,x,y);x=C.x;y=C.y}if(L!=0||v!=0){C=J.length;for(k=0;k0&&c.removeFromSelection(G);L.length>0&&vb(L);break;case "resize":G=V(E);L=(F=oa(G))?H:svgedit.utilities.getBBox(E);C=L.x;k=L.y;var P=L.width,U=L.height;L=x-h;v=y-m;if(n.gridSnapping){L=wa(L);v=wa(v);U=wa(U);P=wa(P)}var S=pa(E);if(S){var Y=Math.sqrt(L*L+v*v);v=Math.atan2(v,L)-S*Math.PI/180;L=Y*Math.cos(v);v=Y*Math.sin(v)}if(kb.indexOf("n")==-1&&kb.indexOf("s")==-1)v=0;if(kb.indexOf("e")==-1&&kb.indexOf("w")==-1)L=0;var Z=Y=0,ga=U?(U+v)/U:1,qa=P?(P+L)/P:1;if(kb.indexOf("n")>=0){ga=U?(U-v)/ -U:1;Z=U}if(kb.indexOf("w")>=0){qa=P?(P-L)/P:1;Y=P}L=d.createSVGTransform();v=d.createSVGTransform();P=d.createSVGTransform();if(n.gridSnapping){C=wa(C);Y=wa(Y);k=wa(k);Z=wa(Z)}L.setTranslate(-(C+Y),-(k+Z));if(u.shiftKey)if(qa==1)qa=ga;else ga=qa;v.setScale(qa,ga);P.setTranslate(C+Y,k+Z);if(F){F=S?1:0;G.replaceItem(L,2+F);G.replaceItem(v,1+F);G.replaceItem(P,0+F)}else{F=G.numberOfItems;G.replaceItem(P,F-3);G.replaceItem(v,F-2);G.replaceItem(L,F-1)}Ha.requestSelector(E).resize();N("transition",J);break; -case "zoom":L*=o;k*=o;ma(ta,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}F=x;C=y;if(u.shiftKey){C=ba(h,m,F,C);F=C.x;C=C.y}G.setAttributeNS(null,"x2",F);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);F=Math.abs(y-m);if(Ea=="square"|| -u.shiftKey){L=F=Math.max(L,F);C=hm?m+k:m-k}if(u.altKey){F=h;C=m;k=Math.abs(x-F);v=u.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",v);G.setAttributeNS(null,"cx",F);G.setAttributeNS(null,"cy",C);window.opera||d.unsuspendRedraw(L);break;case "fhellipse":case "fhrect":A.minx=Math.min(L,A.minx);A.maxx=Math.max(L,A.maxx);A.miny=Math.min(k,A.miny);A.maxy=Math.max(k,A.maxy);case "fhpath":e+=+L+","+ -k+" ";G.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(u.shiftKey){if(F=svgedit.path.path){G=F.dragging?F.dragging[0]:h;F=F.dragging?F.dragging[1]:m}else{G=h;F=m}C=ba(G,F,x,y);x=C.x;y=C.y}if(ta&&ta.getAttribute("display")!=="none"){L*=o;k*=o;ma(ta,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(u,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(D,I);break;case "rotate":L= -svgedit.utilities.getBBox(E);F=L.x+L.width/2;C=L.y+L.height/2;G=X(E);G=M(F,C,G);F=G.x;C=G.y;G=L.x;k=L.y;if(current_rotate_mode=="nw")G=L.x+L.width;if(current_rotate_mode=="se")k=L.y+L.height;if(current_rotate_mode=="sw"){G=L.x+L.width;k=L.y+L.height}compensation_angle=(Math.atan2(C-k,F-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,F-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=wa(S);if(u.shiftKey)S=Math.round(S/45)*45;c.setRotationAngle(S<-180?360+S:S,true);N("transition",J)}ob("mouseMove", -{event:u,mouse_x:D,mouse_y:I,selected:E})}}).click(function(u){u.preventDefault();return false}).dblclick(function(u){var E=u.target.parentNode;if(E!==K){var I=Ib(u),D=I.tagName;if(D==="text"&&Ea!=="textedit"){u=M(u.pageX,u.pageY,rb);hb.select(I,u.x,u.y)}if((D==="g"||D==="a")&&pa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();E.tagName!=="g"&&E.tagName!=="a"||E===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(u){c.addClones=false;window.removeEventListener("keyup",c.removeClones); -J=J.filter(Boolean);if(u.button!==2){var E=Bb;Bb=null;if(La){var I=M(u.pageX,u.pageY,rb),D=I.x*o;I=I.y*o;var G=D/o,L=I/o,k=ra(ca()),v=false;La=false;switch(Ea){case "resize":case "multiselect":if(ta!=null){ta.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J.length==1){D=J[0];switch(D.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=D.getAttribute("fill");bb.fill_opacity=D.getAttribute("fill-opacity");bb.stroke=D.getAttribute("stroke"); -bb.stroke_opacity=D.getAttribute("stroke-opacity");bb.stroke_width=D.getAttribute("stroke-width");bb.stroke_dasharray=D.getAttribute("stroke-dasharray");bb.stroke_linejoin=D.getAttribute("stroke-linejoin");bb.stroke_linecap=D.getAttribute("stroke-linecap")}if(D.tagName=="text"){Za.font_size=D.getAttribute("font-size");Za.font_family=D.getAttribute("font-family")}Ha.requestSelector(D).showGrips(true)}Ga();if(G!=z||L!=w){u=J.length;for(D=0;D=0?E.indexOf(",",G+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":E=$(k).attr(["x1","x2","y1","y2"]);v=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(k).attr(["width","height"]);v=E.width!=0||E.height!=0||Ea==="image";break;case "circle":v=k.getAttribute("r")!=0;break;case "ellipse":E=$(k).attr(["rx","ry"]);v=E.rx!=null||E.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=Q({element:"ellipse", -curStyles:true,attr:{cx:(A.minx+A.maxx)/2,cy:(A.miny+A.maxy)/2,rx:(A.maxx-A.minx)/2,ry:(A.maxy-A.miny)/2,id:ca()}});N("changed",[k]);v=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=Q({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});N("changed",[k]);v=true}break;case "text":v=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;E=Ja.mouseUp(u,k,D,I);k=E.element;v=E.keep;break;case "pathedit":v=true;k=null;Ja.mouseUp(u); -break;case "textedit":v=false;k=null;hb.mouseUp(u,D,I);break;case "rotate":v=true;k=null;Ea="select";E=c.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Ga();N("changed",J)}D=ob("mouseUp",{event:u,mouse_x:D,mouse_y:I},true);$.each(D,function(P,U){if(U){v=U.keep||v;k=U.element;La=U.started||La}});if(!v&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(D=u.target;D.parentNode.parentNode.tagName=="g";)D=D.parentNode;if((Ea!="path"||!drawn_path)&&D.parentNode.id!="selectorParentGroup"&& -D.id!="svgcanvas"&&D.id!="svgroot"){c.setMode("select");xb([D],true)}}else if(k!=null){c.addedNew=true;u=0.2;var C;if(false.beginElement&&k.getAttribute("opacity")!=O.opacity){C=$(false).clone().attr({to:O.opacity,dur:u}).appendTo(k);try{C[0].beginElement()}catch(F){}}else u=0;setTimeout(function(){C&&C.remove();k.setAttribute("opacity",O.opacity);k.setAttribute("style","pointer-events:inherit");na(k);if(Ea==="path")Ja.toEditMode(k);else n.selectNew&&xb([k],true);ya(new Ca(k));N("changed",[k])},u* -1E3)}Va=null}}});$(a).bind("mousewheel DOMMouseScroll",function(u){if(u.shiftKey){u.preventDefault();rb=l.getScreenCTM().inverse();var E=M(u.pageX,u.pageY,rb);E={x:E.x,y:E.y,width:0,height:0};if(u.wheelDelta)if(u.wheelDelta>=120)E.factor=2;else{if(u.wheelDelta<=-120)E.factor=0.5}else if(u.detail)if(u.detail>0)E.factor=0.5;else if(u.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var pb=function(e){$(e).click(function(h){h.preventDefault()})},hb=c.textActions=function(){function e(S){var Y=I.value=== -"";$(I).focus();if(!arguments.length)if(Y)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var Z;Z=k[S];Y||I.setSelectionRange(S,S);D=ra("text_cursor");if(!D){D=document.createElementNS(b,"line");ma(D,{id:"text_cursor",stroke:"#333","stroke-width":1});D=ra("selectorParentGroup").appendChild(D)}L||(L=setInterval(function(){var ga=D.getAttribute("display")==="none";D.setAttribute("display",ga?"inline":"none")},600));Y=H(Z.x,v.y);Z=H(Z.x,v.y+v.height);ma(D,{x1:Y.x,y1:Y.y,x2:Z.x, -y2:Z.y,visibility:"visible",display:"inline"});G&&G.setAttribute("d","")}function h(S,Y,Z){if(S===Y)e(Y);else{Z||I.setSelectionRange(S,Y);G=ra("text_selectblock");if(!G){G=document.createElementNS(b,"path");ma(G,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});ra("selectorParentGroup").appendChild(G)}S=k[S];var ga=k[Y];D.setAttribute("visibility","hidden");Y=H(S.x,v.y);Z=H(S.x+(ga.x-S.x),v.y);var qa=H(S.x,v.y+v.height);S=H(S.x+(ga.x-S.x),v.y+v.height);ma(G,{d:"M"+Y.x+ -","+Y.y+" L"+Z.x+","+Z.y+" "+S.x+","+S.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function m(S,Y){var Z=d.createSVGPoint();Z.x=S;Z.y=Y;if(k.length==1)return 0;Z=E.getCharNumAtPosition(Z);if(Z<0){Z=k.length-2;if(S<=k[0].x)Z=0}else if(Z>=k.length-2)Z=k.length-2;var ga=k[Z];S>ga.x+ga.width/2&&Z++;return Z}function z(S,Y,Z){var ga=I.selectionStart;S=m(S,Y);h(Math.min(ga,S),Math.max(ga,S),!Z)}function w(S,Y){var Z={x:S,y:Y};Z.x/=o;Z.y/=o;if(C){var ga=M(Z.x,Z.y,C.inverse());Z.x=ga.x;Z.y=ga.y}return Z} -function H(S,Y){var Z={x:S,y:Y};if(C){var ga=M(Z.x,Z.y,C);Z.x=ga.x;Z.y=ga.y}Z.x*=o;Z.y*=o;return Z}function A(S){h(0,E.textContent.length);$(this).unbind(S)}function u(S){if(U&&E){var Y=M(S.pageX,S.pageY,rb);Y=w(Y.x*o,Y.y*o);Y=m(Y.x,Y.y);var Z=E.textContent,ga=Z.substr(0,Y).replace(/[a-z0-9]+$/i,"").length;Z=Z.substr(Y).match(/^[a-z0-9]+/i);h(ga,(Z?Z[0].length:0)+Y);$(S.target).click(A);setTimeout(function(){$(S.target).unbind("click",A)},300)}}var E,I,D,G,L,k=[],v,C,F,P,U;return{select:function(S, -Y,Z){E=S;hb.toEditMode(Y,Z)},start:function(S){E=S;hb.toEditMode()},mouseDown:function(S,Y,Z,ga){S=w(Z,ga);I.focus();e(m(S.x,S.y));F=Z;P=ga},mouseMove:function(S,Y){var Z=w(S,Y);z(Z.x,Z.y)},mouseUp:function(S,Y,Z){var ga=w(Y,Z);z(ga.x,ga.y,true);S.target!==E&&YF-2&&ZP-2&&hb.toSelectMode(true)},setCursor:e,toEditMode:function(S,Y){xb([E],false);U=false;Ea="textedit";Ha.requestSelector(E).showGrips(false);Ha.requestSelector(E);hb.init();$(E).css("cursor","text");if(arguments.length){var Z= -w(S,Y);e(m(Z.x,Z.y))}else e();setTimeout(function(){U=true},300)},toSelectMode:function(S){Ea="select";clearInterval(L);L=null;G&&$(G).attr("display","none");D&&$(D).attr("visibility","hidden");$(E).css("cursor","move");if(S){Qa();$(E).css("cursor","move");N("selected",[E]);vb([E],true)}E&&!E.textContent.length&&c.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(S){I=S},clear:function(){Ea=="textedit"&&hb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=J[0];Ha.requestSelector(E).showGrips(false)}var S= -E.textContent.length,Y=E.getAttribute("transform");v=svgedit.utilities.getBBox(E);C=Y?X(E):null;k=Array(S);I.focus();$(E).unbind("dblclick",u).dblclick(u);if(!S)var Z={x:v.x+v.width/2,width:0};for(Y=0;Y=0&&this.selected_pts.push(E)}this.selected_pts.sort();u=this.selected_pts.length;for(A= -Array(u);u--;){I=this.segs[this.selected_pts[u]];I.select(true);A[u]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",A)};var w=h=null,H=false;return{mouseDown:function(A,u,E,I){if(Ea==="path"){mouse_x=E;mouse_y=I;I=mouse_x/o;u=mouse_y/o;E=ra("path_stretch_line");m=[I,u];if(n.gridSnapping){I=wa(I);u=wa(u);mouse_x=wa(mouse_x);mouse_y=wa(mouse_y)}if(!E){E=document.createElementNS(b,"path");ma(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5", -fill:"none"});E=ra("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var D=null;if(w){D=w.pathSegList;for(var G=D.numberOfItems,L=6/o,k=false;G;){G--;var v=D.getItem(G),C=v.x;v=v.y;if(I>=C-L&&I<=C+L&&u>=v-L&&u<=v+L){k=true;break}}L=ca();svgedit.path.removePath_(L);L=ra(L);C=D.numberOfItems;if(k){if(G<=1&&C>=2){I=D.getItem(0).x;u=D.getItem(0).y;A=E.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(I,u):w.createSVGPathSegCurvetoCubicAbs(I,u,A.x1/o,A.y1/o, -I,u);I=w.createSVGPathSegClosePath();D.appendItem(A);D.appendItem(I)}else if(C<3)return D=false;$(E).remove();element=L;w=null;La=false;if(e){svgedit.path.path.matrix&&db(L,{},svgedit.path.path.matrix.inverse());E=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+E);$(L).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, -Ib(A))){console.log("Clicked outside canvas");return false}D=w.pathSegList.numberOfItems;G=w.pathSegList.getItem(D-1);L=G.x;G=G.y;if(A.shiftKey){A=ba(L,G,I,u);I=A.x;u=A.y}A=E.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(eb(I),eb(u)):w.createSVGPathSegCurvetoCubicAbs(eb(I),eb(u),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;u*=o;E.setAttribute("d",["M",I,u,I,u].join(" "));E=D;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,u)}}else{d_attr= -"M"+I+","+u+" ";w=Q({element:"path",curStyles:true,attr:{d:d_attr,id:ja(),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();L=A.target.id;if(L.substr(0,14)=="pathpointgrip_"){u=svgedit.path.path.cur_pt=parseInt(L.substr(14));svgedit.path.path.dragging=[E,I];D=svgedit.path.path.segs[u];if(A.shiftKey)D.selected?svgedit.path.path.removePtFromSelection(u): -svgedit.path.path.addPtsToSelection(u);else{if(svgedit.path.path.selected_pts.length<=1||!D.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(u)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,I];A=L.split("_")[1].split("c");u=A[0]-0;svgedit.path.path.selectPt(u,A[1]-0)}if(!svgedit.path.path.dragging){if(ta==null)ta=Ha.getRubberBandBox();ma(ta,{x:E*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,u,E){H=true;if(Ea==="path"){if(w){var I= -w.pathSegList;A=I.numberOfItems-1;if(m){var D=svgedit.path.addCtrlGrip("1c1"),G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");D.setAttribute("cx",u);D.setAttribute("cy",E);D.setAttribute("display","inline");D=m[0];var L=m[1];I.getItem(A);var k=D+(D-u/o),v=L+(L-E/o);G.setAttribute("cx",k*o);G.setAttribute("cy",v*o);G.setAttribute("display","inline");G=svgedit.path.getCtrlLine(1);var C=svgedit.path.getCtrlLine(2);ma(G,{x1:u,y1:E,x2:D*o,y2:L*o,display:"inline"});ma(C,{x1:k* -o,y1:v*o,x2:D*o,y2:L*o,display:"inline"});if(A===0)z=[u,E];else{I=I.getItem(A-1);u=I.x;E=I.y;if(I.pathSegType===6){u+=u-I.x2;E+=E-I.y2}else if(z){u=z[0]/o;E=z[1]/o}svgedit.path.replacePathSeg(6,A,[D,L,u,E,k,v],w)}}else if(D=ra("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[u,E,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,u,E],D);else z?svgedit.path.replacePathSeg(6,1,[u,E,z[0],z[1],u,E],D):svgedit.path.replacePathSeg(4,1,[u,E],D)}}}else if(svgedit.path.path.dragging){D= -svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);L=svgedit.path.getPointFromGrip({x:u,y:E},svgedit.path.path);A=L.x-D.x;D=L.y-D.y;svgedit.path.path.dragging=[u,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,D):svgedit.path.path.movePts(A,D)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var F=ta.getBBox(),P=svgedit.path.getGripPt(this);F=svgedit.math.rectsIntersect(F, -{x:P.x,y:P.y,width:0,height:0});this.select(F);F&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(A,u){if(Ea==="path"){m=null;if(!w){u=ra(ca());La=false;z=null}return{keep:true,element:u}}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();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(E)}else if(ta&&ta.getAttribute("display")!= -"none"){ta.setAttribute("display","none");ta.getAttribute("width")<=2&&ta.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var u=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&& -svgedit.path.recalcRotatedPath();if(u){N("selected",[A]);vb([A],true)}},addSubPath:function(A){if(A){Ea="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ea="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(pa(A)!=0){var u=new za("Reorient path"),E={d:A.getAttribute("d"),transform:A.getAttribute("transform")};u.addSubCommand(new Na(A,E));Qa();this.resetOrientation(A);ya(u);svgedit.path.getPath_(A).show(false).matrix=null; -this.clear();vb([A],true);N("changed",J)}},clear:function(){h=null;if(w){var A=ra(ca());$(ra("path_stretch_line")).remove();$(A).remove();$(ra("pathpointgrip_container")).find("*").attr("display","none");w=z=null;La=false}else Ea=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(A){if(A==null||A.nodeName!="path")return false;var u=V(A),E=fa(u).matrix;u.clear();A.removeAttribute("transform");u=A.pathSegList;for(var I=u.numberOfItems, -D=0;D0){L=I.getItem(D-1).pathSegType;if(L===2){G(D-1,1);E();break}else if(L===1&&I.numberOfItems-1===D){G(D,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){A=$(svgedit.path.path.elem);A.attr("d",A.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(A){var u=A.points,E=u.numberOfItems;if(E>=4){var I=u.getItem(0),D=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=E-4;G+=3){var L=u.getItem(G),k=u.getItem(G+1),v=u.getItem(G+2);if(D)if((I=svgedit.path.smoothControlPoints(D, -L,I))&&I.length==2){L=A[A.length-1].split(",");L[2]=I[0].x;L[3]=I[0].y;A[A.length-1]=L.join(",");L=I[1]}A.push([L.x,L.y,k.x,k.y,v.x,v.y].join(","));I=v;D=k}for(A.push("L");G0;);Ja.clear(true);$.each(l.childNodes,function(m,z){m&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&l.insertBefore(z,l.firstChild)});if(K){Jb();xb([K])}var e= -[];$(l).find("g:data(gsvg)").each(function(){for(var m=this.attributes,z=m.length,w=0;w=0;E--){u=A.item(E);G=z(u.nodeValue);if(!(L.indexOf(u.localName)>=0))if(G!="")if(G.indexOf("pointer-events")!==0)if(!(u.localName==="class"&&G.indexOf("se_")===0)){m.push(" ");if(u.localName==="d")G=Ja.convertPath(e,true);if(isNaN(G)){if(H.test(G))G= -svgedit.units.shortFloat(G)+w}else G=svgedit.units.shortFloat(G);if(fb.apply&&e.nodeName==="image"&&u.localName==="href"&&fb.images&&fb.images==="embed"){var k=Sa[G];if(k)G=k}if(!u.namespaceURI||u.namespaceURI==b||Aa[u.namespaceURI]){m.push(u.nodeName);m.push('="');m.push(G);m.push('"')}}}}if(e.hasChildNodes()){m.push(">");h++;A=false;for(E=0;E");break;case 8:m.push("\n");m.push(Array(h+1).join(" "));m.push("