diff --git a/editor/jquery-draginput.js b/editor/jquery-draginput.js index 0017153..7319507 100644 --- a/editor/jquery-draginput.js +++ b/editor/jquery-draginput.js @@ -48,10 +48,12 @@ $.fn.dragInput = function(cfg){ //this is where all the magic happens this.adjustValue = function(i, completed){ var v; + i = parseFloat(i); if(isNaN(this.value)) { v = this.dragCfg.reset; } else if($.isFunction(this.dragCfg.stepfunc)) { v = this.dragCfg.stepfunc(this, i); + console.log(v); } else { v = Number((Number(this.value) + Number(i)).toFixed(5)); } diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 4f78244..0fdaee0 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -825,6 +825,7 @@ // Clicking the "show" icon should set the current mode shower.mousedown(function(evt) { + $('#workarea').one("mousedown", function(){$('#tools_shapelib').hide()}) if ($('#tools_shapelib').is(":visible")) toolButtonClick(show_sel, false); if(shower.hasClass('disabled')) return false; var holder = $(hold_sel); @@ -3560,7 +3561,7 @@ $('#rect_rx') .dragInput({ min: 0, max: 100, step: 1, callback: changeAttribute, cursor: true }); $('#stroke_width') .dragInput({ min: 0, max: 99, step: 1, callback: changeStrokeWidth, cursor: true, smallStep: 0.1, start: 1.5 }); $('#angle') .dragInput({ min: -180, max: 180, step: 1, callback: changeRotationAngle, cursor: false, dragAdjust: 0.5 }); - $('#font_size') .dragInput({ min: 1, max: 250, step: 1, callback: changeFontSize, cursor: true, stepfunc: stepFontSize }); + $('#font_size') .dragInput({ min: 1, max: 250, step: 1, callback: changeFontSize, cursor: true, stepfunc: stepFontSize, dragAdjust: .15 }); $('#group_opacity').dragInput({ min: 0, max: 100, step: 5, callback: changeAttribute, cursor: true, start: 100 }); $('#blur') .dragInput({ min: 0, max: 10, step: .1, callback: changeBlur, cursor: true, start: 0 }); // Set default zoom diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 0c8fe7a..a626025 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -1,33 +1,33 @@ 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]= 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:N](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:N]()}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,N="querystring", -ia="fragment",oa="location",fa="href",ba=/^.*\?|#.*$/g,X=/^.*\#/,sa,ka={};q[N]=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("="), +106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add: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("="), za=l(na[0]),Fa=aa,Ia=0,Ca=za.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++){za=Ca[Ia]===""?Fa.length:Ca[Ia];Fa=Fa[za]=Ia').hide().insertAfter("body")[0].contentWindow; -J=function(){return b(T.document[c][f])};O=function(Q,V){if(Q!==V){var N=T.document;N.open().close();N[c].hash="#"+Q}};O(b())}}var o={},K,T,O,J;o.start=function(){if(!K){var Q=b();O||B();(function V(){var N=b(),ia=J(Q);if(N!==Q){O(Q=N,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()})}} +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 Aa=a(new Image).attr({"class":"svg_icon",src:pa+Na,width:B,height:o,alt:"icon"});ka(Aa,Ka)})}else for(var ra=K.length,ma=0;ma0&&!da)ya=g(ya,Aa,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,za,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;za=ra&63;if(isNaN(pa))na=za=64;else if(isNaN(ra))za=64;W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(aa);W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(na); -W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(za)}while(Fa-1&&N.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); +W[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(za)}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 za="url(#"+ma+")"; for(ma=0;ma=0;jQuery.fn.jGraduate=function(b){var n= -arguments;return this.each(function(){function s(la,ca,ja,M,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= +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}});M&&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 M=0;$(X).find("stop").each(function(){var R=this.getAttribute("offset"), -ea=$(this);if(Ria+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"),N=$(K+"> .jGraduate_gradPick");N.html('

    '+B.window.pickerTitle+'

    ');var V=$(K+"> .jGraduate_colPick"),M=$(K+"> .jGraduate_gradPick");M.html('

    '+B.window.pickerTitle+'


    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ia,left:J*ia}).data("coord","start").appendTo(da),Aa=Na.clone().text(2).css({top:za*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),M=isNaN(ca[1]);ja||(ja=M?"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(M&&ba==="radialGradient"||!M&&ba==="linearGradient")X.setAttribute(ca,this.value);var R=M?ca[0]==="c"?ya:Ha:ca[1]==="1"?Na:Aa,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, +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:Aa,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= -N.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 M=Za.data("coord"),R=X;switch(M){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); +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()},Cb=function(){Za=null;Q.unbind("mousemove",bb).unbind("mouseup",Cb)};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)M=99.5;if(M>0)La=1-M/100;else fb=-(M/100)-1;R=145*((M+100)/ -2)/100;ea&&d();break;case "angle":Va=M;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(N=(q.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];J=q.paint.solidColor=="none"?"":q.paint.solidColor+N;ra||(J=wa[0].getAttribute("stop-color")); +"stop"));++ta}wa=X.getElementsByTagNameNS(p.svg,"stop")}var eb;pa=M=0;if(ba==="radialGradient"){W=X.gradientTransform.baseVal;if(W.numberOfItems===2){ta=W.getItem(0);W=W.getItem(1);if(ta.type===2&&W.type===3){ta=W.matrix;if(ta.a!==1)M=Math.round(-(1-ta.a)*100);else if(ta.d!==1)M=Math.round((1-ta.d)*100)}}else if(W.numberOfItems===3){da=W.getItem(0);ta=W.getItem(1);W=W.getItem(2);if(da.type===4&&ta.type===2&&W.type===3){pa=Math.round(da.angle);ta=W.matrix;if(ta.a!==1)M=Math.round(-(1-ta.a)*100);else if(ta.d!== +1)M=Math.round((1-ta.d)*100)}}}M={radius:{handle:"#"+o+"_jGraduate_RadiusArrows",input:"#"+o+"_jGraduate_RadiusInput",val:(X.getAttribute("r")||0.5)*100},opacity:{handle:"#"+o+"_jGraduate_OpacArrows",input:"#"+o+"_jGraduate_OpacInput",val:q.paint.alpha||100},ellip:{handle:"#"+o+"_jGraduate_EllipArrows",input:"#"+o+"_jGraduate_EllipInput",val:M},angle:{handle:"#"+o+"_jGraduate_AngleArrows",input:"#"+o+"_jGraduate_AngleInput",val:pa}};$.each(M,function(la,ca){var ja=$(ca.handle);ja.mousedown(function(N){var R= +ja.parent();eb={type:la,elem:ja,input:$(ca.input),parent:R,offset:R.offset()};Q.mousemove(tb).mouseup(ub);N.preventDefault()});$(ca.input).val(ca.val).change(function(){var N=+this.value,R=0,ea=ba==="radialGradient";switch(la){case "radius":ea&&X.setAttribute("r",N/100);R=Math.pow(N/100,0.4)/2*145;break;case "opacity":q.paint.alpha=N;sa.setAttribute("fill-opacity",N/100);R=N*1.45;break;case "ellip":fb=La=1;if(N===0){R=72.5;break}if(N>99.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 Bb;switch(q.paint.type){case "linearGradient":Bb=$(K+" .jGraduate_tab_lingrad");break;case "radialGradient":Bb= @@ -65,9 +65,9 @@ function(){return false})});return $(this)},disableContextMenuItems:function(g){ 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}(),N=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}; +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 N};svgedit.browser.supportsNativeTransformLists=function(){return ia}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; +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>4;l=(l&15)<<4|B>>2;q=(B&3)<<6|o;f+=String.fromCharCode(d);if(B!=64)f+= 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)}}; 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;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,N=svgedit.math.transformPoint,ia=c.matrixMultiply=svgedit.math.matrixMultiply,oa=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,fa=c.transformListToTransform=svgedit.math.transformListToTransform, +"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,za=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,Aa=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();M("changed",z);z=h.type(); +svgedit.sanitize.sanitizeSvg,Ia=svgedit.history.MoveElementCommand,Ca=svgedit.history.InsertElementCommand,Ka=svgedit.history.RemoveElementCommand,Na=svgedit.history.ChangeElementCommand,Aa=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(Ab[z]);delete Ab[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(m=e.length;h=0)E=G=c.convertToPath(I,true);else if(I.tagName=="rect"){var L=I.getAttribute("rx"),k=I.getAttribute("ry");if(L||k)E=G=c.convertToPath(I,true)}if(!G){var v=I.cloneNode(true),C=document.createElementNS(b,"g"),D=I.parentNode;D.appendChild(C);C.appendChild(v);E=svgedit.utilities.bboxToObj(C.getBBox());D.removeChild(C)}}return E}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 E=I.getAttribute("stroke-width"),G=0;if(I.getAttribute("stroke")!="none"&&!isNaN(E))G+=E/2;return G},F=[];$.each(e,function(I,E){var G=h(E);if(G){var L=u(E);H=Math.min(H,G.x-L);A=Math.min(A,G.y-L);F.push(G)}});m.x=H;m.y=A;$.each(e,function(I,E){var G=F[I];if(G&&E.nodeType==1){var L=u(E);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()},Bb=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,M;(function(e){var h={};ca=e.getId=function(){return B().getId()};ja=e.getNextId=function(){return B().getNextId()};M=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=N(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);M("changed",J)}ra("pathpointgrip_container");m=Ha.requestSelector(J[0]);m.resize();m.updateGripCursors(e)};var Ga=this.recalculateAllSelectedDimensions=function(){for(var e=new Aa(kb== -"none"?"position":"size"),h=J.length;h--;){var m=Ua(J[h]);m&&e.addSubCommand(m)}if(!e.isEmpty()){ya(e);M("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", +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 Aa(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 F=u.getAttribute("x1"),I=u.getAttribute("x2");u.setAttribute("x1",-(F-1));u.setAttribute("x2",-(I-1))}if(m.d<0){F=u.getAttribute("y1");I=u.getAttribute("y2");u.setAttribute("y1",-(F-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=N(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=N(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=N(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=N(h.x1,h.y1,m);F=N(h.x2,h.y2,m);h.x1=A.x;h.y1=A.y;h.x2=F.x;h.y2=F.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"));F=sa("y",e.getAttribute("y"));I=sa("y",m[H].getAttribute("y"));var E={};if(!isNaN(A)&&!isNaN(u)&&A!=0&&u!=0&&h.x)E.x=h.x-(A-u);if(!isNaN(F)&&!isNaN(I)&&F!=0&&I!=0&&h.y)E.y=h.y-(F-I);if(E.x||E.y)ma(m[H],E,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 Aa("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 F=w.numberOfItems;A.points=Array(F);for(var I=0;I1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(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,D=h.getItem(k-2).matrix,P=h.getItem(k-1).matrix;F=e.childNodes;for(E=F.length;E--;){var U=F.item(E);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,D,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,D,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){F=e.childNodes;E=F.length;for(k=[];E--;){U=F.item(E);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--;){D=S.item(C);if(U==da(D)){P=d.createSVGTransform();P.setTranslate(-H,-z);V(D).insertItemBefore(P,0);m.addSubCommand(Ua(D))}}Va=Y}}}k=[];Va=Y}}else if(k==1&&h.getItem(0).type==1&&!w){I=1;z=h.getItem(0).matrix;F=e.childNodes;for(E=F.length;E--;){U=F.item(E);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){F=e.childNodes;for(E=F.length;E--;){U=F.item(E);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=N(w.x+w.width/2,w.y+w.height/2,fa(h).matrix);I=H*Math.PI/180;F=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(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;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;F=w.numberOfItems; A.points=Array(F);for(I=0;I1&&w.showGrips(false)}}}M("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- +3&&H){z=fa(h).matrix;v=d.createSVGTransform();v.setRotate(H,G.x,G.y);v=v.matrix;G=d.createSVGTransform();G.setRotate(H,L.x,L.y);L=G.matrix.inverse();Y=z.inverse();L=ia(Y,L,v,z);db(e,A,L);if(H)h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}}h.numberOfItems==0&&e.removeAttribute("transform");m.addSubCommand(new Na(e,u));return m},rb=null,Qa=this.clearSelection=function(e){if(J[0]!=null)for(var h=J.length,m=0;m1&&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 F=u.button===2;rb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=N(u.pageX,u.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);u.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(u);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=E,k=w=m=I;if(n.gridSnapping){E=wa(E);I=wa(I);h=wa(h);m=wa(m)}if(G== +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 F=u.button===2;rb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=M(u.pageX,u.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);u.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(u);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=E,k=w=m=I;if(n.gridSnapping){E=wa(E);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(F)La=false;if(G!=d){if(J.indexOf(G)==-1){u.shiftKey||Qa(true);vb([G]);Cb=G;Ja.clear()}if(!F)for(F=0;F1))if(La)if(!(u.button=== -1||c.spaceKey)){var F=J[0],I=N(u.pageX,u.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);var G=ra(ca()),L=x=E/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(F);L=(D=oa(G))?H:svgedit.utilities.getBBox(F);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(F);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(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(v,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(v,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).resize();M("transition",J);break; +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(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(v,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(v,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).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)}D=x;C=y;if(u.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea=="square"|| u.shiftKey){L=D=Math.max(L,D);C=hm?m+k:m-k}if(u.altKey){D=h;C=m;k=Math.abs(x-D);v=u.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",v);G.setAttributeNS(null,"cx",D);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(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,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(E,I);break;case "rotate":L= -svgedit.utilities.getBBox(F);D=L.x+L.width/2;C=L.y+L.height/2;G=X(F);G=N(D,C,G);D=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,D-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,D-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);M("transition",J)}ob("mouseMove", -{event:u,mouse_x:E,mouse_y:I,selected:F})}}).click(function(u){u.preventDefault();return false}).dblclick(function(u){var F=u.target.parentNode;if(F!==K){var I=Ib(u),E=I.tagName;if(E==="text"&&Ea!=="textedit"){u=N(u.pageX,u.pageY,rb);hb.select(I,u.x,u.y)}if((E==="g"||E==="a")&&pa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(u){c.addClones=false;window.removeEventListener("keyup",c.removeClones); -if(u.button!==2){var F=Cb;Cb=null;if(La){var I=N(u.pageX,u.pageY,rb),E=I.x*o;I=I.y*o;var G=E/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[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity= +svgedit.utilities.getBBox(F);D=L.x+L.width/2;C=L.y+L.height/2;G=X(F);G=M(D,C,G);D=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,D-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,D-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:E,mouse_y:I,selected:F})}}).click(function(u){u.preventDefault();return false}).dblclick(function(u){var F=u.target.parentNode;if(F!==K){var I=Ib(u),E=I.tagName;if(E==="text"&&Ea!=="textedit"){u=M(u.pageX,u.pageY,rb);hb.select(I,u.x,u.y)}if((E==="g"||E==="a")&&pa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(u){c.addClones=false;window.removeEventListener("keyup",c.removeClones); +if(u.button!==2){var F=Cb;Cb=null;if(La){var I=M(u.pageX,u.pageY,rb),E=I.x*o;I=I.y*o;var G=E/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[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity= E.getAttribute("stroke-opacity");bb.stroke_width=E.getAttribute("stroke-width");bb.stroke_dasharray=E.getAttribute("stroke-dasharray");bb.stroke_linejoin=E.getAttribute("stroke-linejoin");bb.stroke_linecap=E.getAttribute("stroke-linecap")}if(E.tagName=="text"){Za.font_size=E.getAttribute("font-size");Za.font_family=E.getAttribute("font-family")}Ha.requestSelector(E).showGrips(true)}Ga();if(G!=z||L!=w){u=J.length;for(E=0;E=0?F.indexOf(",",G+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":F=$(k).attr(["x1","x2","y1","y2"]);v=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(k).attr(["width","height"]);v=F.width!=0||F.height!=0||Ea==="image";break;case "circle":v=k.getAttribute("r")!=0;break;case "ellipse":F=$(k).attr(["rx","ry"]);v=F.rx!=null||F.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()}});M("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()}});M("changed",[k]);v=true}break;case "text":v=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;F=Ja.mouseUp(u,k,E,I);k=F.element;v=F.keep;break;case "pathedit":v=true;k=null;Ja.mouseUp(u); -break;case "textedit":v=false;k=null;hb.mouseUp(u,E,I);break;case "rotate":v=true;k=null;Ea="select";F=c.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();M("changed",J)}E=ob("mouseUp",{event:u,mouse_x:E,mouse_y:I},true);$.each(E,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(E=u.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&& -E.id!="svgcanvas"&&E.id!="svgroot"){c.setMode("select");xb([E],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(D){}}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));M("changed",[k])},u* -1E3)}Va=null}}});$(a).bind("mousewheel DOMMouseScroll",function(u){if(u.shiftKey){u.preventDefault();rb=l.getScreenCTM().inverse();var F=N(u.pageX,u.pageY,rb);F={x:F.x,y:F.y,width:0,height:0};if(u.wheelDelta)if(u.wheelDelta>=120)F.factor=2;else{if(u.wheelDelta<=-120)F.factor=0.5}else if(u.detail)if(u.detail>0)F.factor=0.5;else if(u.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var pb=function(e){$(e).click(function(h){h.preventDefault()})},hb=c.textActions=function(){function e(S){var Y=I.value=== +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;F=Ja.mouseUp(u,k,E,I);k=F.element;v=F.keep;break;case "pathedit":v=true;k=null;Ja.mouseUp(u); +break;case "textedit":v=false;k=null;hb.mouseUp(u,E,I);break;case "rotate":v=true;k=null;Ea="select";F=c.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();N("changed",J)}E=ob("mouseUp",{event:u,mouse_x:E,mouse_y:I},true);$.each(E,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(E=u.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&& +E.id!="svgcanvas"&&E.id!="svgroot"){c.setMode("select");xb([E],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(D){}}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 F=M(u.pageX,u.pageY,rb);F={x:F.x,y:F.y,width:0,height:0};if(u.wheelDelta)if(u.wheelDelta>=120)F.factor=2;else{if(u.wheelDelta<=-120)F.factor=0.5}else if(u.detail)if(u.detail>0)F.factor=0.5;else if(u.detail<0)F.factor=2;F.factor&&N("zoomed",F)}})})();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);E=ra("text_cursor");if(!E){E=document.createElementNS(b,"line");ma(E,{id:"text_cursor",stroke:"#333","stroke-width":1});E=ra("selectorParentGroup").appendChild(E)}L||(L=setInterval(function(){var ga=E.getAttribute("display")==="none";E.setAttribute("display",ga?"inline":"none")},600));Y=H(Z.x,v.y);Z=H(Z.x,v.y+v.height);ma(E,{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];E.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=F.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=N(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=N(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,F.textContent.length);$(this).unbind(S)}function u(S){if(U&&F){var Y=N(S.pageX,S.pageY,rb);Y=w(Y.x*o,Y.y*o);Y=m(Y.x,Y.y);var Z=F.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 F,I,E,G,L,k=[],v,C,D,P,U;return{select:function(S, +","+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=F.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,F.textContent.length);$(this).unbind(S)}function u(S){if(U&&F){var Y=M(S.pageX,S.pageY,rb);Y=w(Y.x*o,Y.y*o);Y=m(Y.x,Y.y);var Z=F.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 F,I,E,G,L,k=[],v,C,D,P,U;return{select:function(S, Y,Z){F=S;hb.toEditMode(Y,Z)},start:function(S){F=S;hb.toEditMode()},mouseDown:function(S,Y,Z,ga){S=w(Z,ga);I.focus();e(m(S.x,S.y));D=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!==F&&YD-2&&ZP-2&&hb.toSelectMode(true)},setCursor:e,toEditMode:function(S,Y){xb([F],false);U=false;Ea="textedit";Ha.requestSelector(F);hb.init();$(F).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");E&&$(E).attr("visibility","hidden");$(F).css("cursor","move");if(S){Qa();$(F).css("cursor","move");M("selected",[F]);vb([F],true)}F&&!F.textContent.length&&c.deleteSelectedElements();$(I).blur();F=false},setInputElem:function(S){I=S},clear:function(){Ea=="textedit"&&hb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=J[0];Ha.requestSelector(F).showGrips(false)}var S=F.textContent.length, +true},300)},toSelectMode:function(S){Ea="select";clearInterval(L);L=null;G&&$(G).attr("display","none");E&&$(E).attr("visibility","hidden");$(F).css("cursor","move");if(S){Qa();$(F).css("cursor","move");N("selected",[F]);vb([F],true)}F&&!F.textContent.length&&c.deleteSelectedElements();$(I).blur();F=false},setInputElem:function(S){I=S},clear:function(){Ea=="textedit"&&hb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=J[0];Ha.requestSelector(F).showGrips(false)}var S=F.textContent.length, Y=F.getAttribute("transform");v=svgedit.utilities.getBBox(F);C=Y?X(F):null;k=Array(S);I.focus();$(F).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(F)}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]);M("selected",A)};var w=h=null,H=false;return{mouseDown:function(A,u,F,I){if(Ea==="path"){mouse_x=F;mouse_y=I;I=mouse_x/o;u=mouse_y/o;F=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(!F){F=document.createElementNS(b,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}); +false,h,m,z;svgedit.path.Path.prototype.endChanges=function(A){if(svgedit.browser.isWebkit()){var u=this.elem;u.setAttribute("d",Ja.convertPath(u))}A=new Na(this.elem,{d:this.last_d},A);ya(A);N("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(A){$.isArray(A)||(A=[A]);for(var u=0;u=0&&this.selected_pts.push(F)}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,F,I){if(Ea==="path"){mouse_x=F;mouse_y=I;I=mouse_x/o;u=mouse_y/o;F=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(!F){F=document.createElementNS(b,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}); F=ra("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var E=null;if(w){E=w.pathSegList;for(var G=E.numberOfItems,L=6/o,k=false;G;){G--;var v=E.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=E.numberOfItems;if(k){if(G<=1&&C>=2){I=E.getItem(0).x;u=E.getItem(0).y;A=F.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(); E.appendItem(A);E.appendItem(I)}else if(C<3)return E=false;$(F).remove();element=L;w=null;La=false;if(e){svgedit.path.path.matrix&&db(L,{},svgedit.path.path.matrix.inverse());F=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+F);$(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}E=w.pathSegList.numberOfItems;G=w.pathSegList.getItem(E-1);L=G.x;G=G.y;if(A.shiftKey){A=ba(L,G,I,u);I=A.x;u=A.y}A=F.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;F.setAttribute("d",["M",I,u,I,u].join(" "));F=E;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,I,u)}}else{d_attr="M"+I+","+u+" ";w=Q({element:"path",curStyles:true, @@ -286,10 +286,10 @@ else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path. if(A===0)z=[u,F];else{I=I.getItem(A-1);u=I.x;F=I.y;if(I.pathSegType===6){u+=u-I.x2;F+=F-I.y2}else if(z){u=z[0]/o;F=z[1]/o}svgedit.path.replacePathSeg(6,A,[E,L,u,F,k,v],w)}}else if(E=ra("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[u,F,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,u,F],E);else z?svgedit.path.replacePathSeg(6,1,[u,F,z[0],z[1],u,F],E):svgedit.path.replacePathSeg(4,1,[u,F],E)}}}else if(svgedit.path.path.dragging){E=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:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[u,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ta.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&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 F=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(F)}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){M("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 Aa("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};u.addSubCommand(new Na(A,F));Qa();this.resetOrientation(A);ya(u);svgedit.path.getPath_(A).show(false).matrix=null;this.clear();vb([A],true);M("changed",J)}},clear:function(){h=null;if(w){var A=ra(ca());$(ra("path_stretch_line")).remove(); +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 Aa("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};u.addSubCommand(new Na(A,F));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),F=fa(u).matrix;u.clear();A.removeAttribute("transform");u=A.pathSegList;for(var I=u.numberOfItems,E=0;E=0;F--){u=A.item(F);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||za[u.namespaceURI]){m.push(u.nodeName);m.push('="');m.push(G);m.push('"')}}}}if(e.hasChildNodes()){m.push(">");h++;A=false;for(F=0;F");break;case 8:m.push("\n");m.push(Array(h+1).join(" "));m.push("