diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 9dd0989..8306488 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -1014,7 +1014,6 @@ } else { fallback_obj[id] = btn.icon; var svgicon = btn.svgicon ? btn.svgicon : btn.id; - console.log(svgicon); if(btn.type == 'app_menu') { placement_obj['#' + id + ' > div'] = svgicon; } else { @@ -1563,15 +1562,17 @@ } menu_items[(el_name === 'g' ? 'en':'dis') + 'ableContextMenuItems']('#ungroup'); menu_items[((el_name === 'g' || !multiselected) ? 'dis':'en') + 'ableContextMenuItems']('#group'); - - } // if (elem != null) - else if (multiselected) { + } + + if (multiselected) { $('#multiselected_panel').show(); $('.action_multi_selected').removeClass('disabled'); menu_items .enableContextMenuItems('#group') .disableContextMenuItems('#ungroup'); - } else { + } + + if (!elem) { menu_items.disableContextMenuItems('#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back'); } @@ -3550,7 +3551,7 @@ $('#image_y') .dragInput({ min: null, max: null, step: 1, callback: changeAttribute, cursor: false }); $('#rect_rx') .dragInput({ min: 0, max: 100, step: 1, callback: changeRectRadius, 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 }); + $('#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 }); $('#group_opacity').dragInput({ min: 0, max: 100, step: 5, callback: changeOpacity, cursor: true, start: 100 }); $('#blur') .dragInput({ min: 0, max: 10, step: .1, callback: changeBlur, cursor: true, start: 0 }); diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 687ccea..fbec379 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -42,11 +42,11 @@ ia}).data("coord","center").appendTo(da),Ha=ya.clone().text("F").css({top:Ka*ia, 1)this.value=1;if(!(ca[0]==="f"&&!jb))if(M&&ba==="radialGradient"||!M&&ba==="linearGradient")X.setAttribute(ca,this.value);var Q=M?ca[0]==="c"?ya:Ha:ca[1]==="1"?Na:za,ea=ca.indexOf("x")>=0?"left":"top";Q.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= O.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/pa;ja=ja/fa;var M=Za.data("coord"),Q=X;switch(M){case "start":ka.x1.val(ca);ka.y1.val(ja);Q.setAttribute("x1",ca);Q.setAttribute("y1",ja);break;case "end":ka.x2.val(ca);ka.y2.val(ja);Q.setAttribute("x2",ca);Q.setAttribute("y2",ja);break;case "center":ka.cx.val(ca); -ka.cy.val(ja);Q.setAttribute("cx",ca);Q.setAttribute("cy",ja);Ea=ca;kb=ja;d();break;case "focus":ka.fx.val(ca);ka.fy.val(ja);Q.setAttribute("fx",ca);Q.setAttribute("fy",ja);d()}la.preventDefault()},Cb=function(){Za=null;R.unbind("mousemove",bb).unbind("mouseup",Cb)};wa=X.getElementsByTagNameNS(p.svg,"stop");if(ua<2){for(;ua<2;){X.appendChild(document.createElementNS(p.svg,"stop"));++ua}wa=X.getElementsByTagNameNS(p.svg,"stop")}var ua=wa.length;for(na=0;na99.5)M=99.5;if(M>0)La=1-M/100;else fb=-(M/100)-1;Q=145*((M+100)/ 2)/100;ea&&d();break;case "angle":Va=M;Q=Va/180;Q+=0.5;Q*=145;ea&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ja.css({"margin-left":Q-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(){R.unbind("mousemove",tb).unbind("mouseup",ub);eb=null};for(O=(q.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=q.paint.solidColor=="none"?"":q.paint.solidColor+O;qa||(J=wa[0].getAttribute("stop-color")); @@ -206,9 +206,9 @@ Ia=svgedit.history.MoveElementCommand,Ca=svgedit.history.InsertElementCommand,Ka Ia.type()){m=m?h.newParent:h.oldParent;m==l&&b.identifyLayers()}else if(z==Ca.type()||z==Ka.type()){h.parent==l&&b.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&&b.identifyLayers();m=m?h.newValues:h.oldValues;m.stdDeviation&&b.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){b.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return b.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return l},currentZoom:function(){return o},getStrokedBBox:function(e){return b.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(!qa(z)){lb().appendChild(Ab[z]);delete Ab[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(m=e.length;h=0)E=G=b.convertToPath(I,true);else if(I.tagName=="rect"){var L=I.getAttribute("rx"),k=I.getAttribute("ry");if(L||k)E=G=b.convertToPath(I,true)}if(!G){var u=I.cloneNode(true),C=document.createElementNS(c,"g"),D=I.parentNode;D.appendChild(C);C.appendChild(u);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,v=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=v(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=v(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(c,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg", @@ -244,25 +244,25 @@ J)},vb=this.addToSelection=function(e,h){if(e.length!=0){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(v){if(!(v.originalEvent.touches&&v.originalEvent.touches>1)){var F=v.button===2;rb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);v.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(v);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=v.target;var u=ib(G,"type");if(u=="rotate"){Ea="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ea="resize";kb=ib(G,"dir")}G=J[0]}Va=G.getAttribute("transform");u=V(G);switch(Ea){case "select":La=true;kb="none";if(F)La=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Qa(true);vb([G]);Cb=G;Ja.clear()}if(!F)for(F=0;F1))if(La)if(!(v.button=== 1||b.spaceKey)){var F=J[0],I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);var G=qa(ca()),L=x=E/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ea){case "select":if(J[0]!==null){L=x-h;var u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=ba(h,m,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k0&&b.removeFromSelection(G);L.length>0&&vb(L);break;case "resize":G=V(F);L=(D=pa(G))?H:svgedit.utilities.getBBox(F);C=L.x;k=L.y;var P=L.width,U=L.height;L=x-h;u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u);U=wa(U);P=wa(P)}var S=oa(F);if(S){var Y=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-S*Math.PI/180;L=Y*Math.cos(u);u=Y*Math.sin(u)}if(kb.indexOf("n")==-1&&kb.indexOf("s")==-1)u=0;if(kb.indexOf("e")==-1&&kb.indexOf("w")==-1)L=0;var aa=Y=0,ga=U?(U+u)/U:1,ra=P?(P+L)/P:1;if(kb.indexOf("n")>=0){ga=U?(U-u)/ U:1;aa=U}if(kb.indexOf("w")>=0){ra=P?(P-L)/P:1;Y=P}L=d.createSVGTransform();u=d.createSVGTransform();P=d.createSVGTransform();if(n.gridSnapping){C=wa(C);Y=wa(Y);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+Y),-(k+aa));if(v.shiftKey)if(ra==1)ra=ga;else ga=ra;u.setScale(ra,ga);P.setTranslate(C+Y,k+aa);if(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(u,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(u,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).resize();M("transition", -J);break;case "zoom":L*=o;k*=o;ma(ua,{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(v.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== +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(v.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"||v.shiftKey){L=D=Math.max(L,D);C=hm?m+k:m-k}if(v.altKey){D=h;C=m;k=Math.abs(x-D);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);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(v.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(ua&&ua.getAttribute("display")!=="none"){L*=o;k*=o;ma(ua,{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(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":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(v.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(v,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=O(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(v.shiftKey)S=Math.round(S/45)*45;b.setRotationAngle(S<-180?360+S:S,true);M("transition",J)}ob("mouseMove", {event:v,mouse_x:E,mouse_y:I,selected:F})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var F=v.target.parentNode;if(F!==K){var I=Ib(v),E=I.tagName;if(E==="text"&&Ea!=="textedit"){v=O(v.pageX,v.pageY,rb);hb.select(I,v.x,v.y)}if((E==="g"||E==="a")&&oa(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(v){b.addClones=false;window.removeEventListener("keyup",b.removeClones); -if(v.button!==2){var F=Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ua!=null){ua.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= +if(v.button!==2){var F=Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=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){v=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"]);u=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(k).attr(["width","height"]);u=F.width!=0||F.height!=0||Ea==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":F=$(k).attr(["rx","ry"]);u=F.rx!=null||F.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({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]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({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]);u=true}break;case "text":u=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;F=Ja.mouseUp(v,k,E,I);k=F.element;u=F.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v); break;case "textedit":u=false;k=null;hb.mouseUp(v,E,I);break;case "rotate":u=true;k=null;Ea="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();M("changed",J)}E=ob("mouseUp",{event:v,mouse_x:E,mouse_y:I},true);$.each(E,function(P,U){if(U){u=U.keep||u;k=U.element;La=U.started||La}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(E=v.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&& @@ -281,12 +281,12 @@ fill:"none"});F=qa("selectorParentGroup").appendChild(F)}F.setAttribute("display I,v);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,v);I=A.x;v=A.y}A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(eb(I),eb(v)):w.createSVGPathSegCurvetoCubicAbs(eb(I),eb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;F.setAttribute("d",["M",I,v,I,v].join(" "));F=E;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,I,v)}}else{d_attr= "M"+I+","+v+" ";w=R({element:"path",curStyles:true,attr:{d:d_attr,id:ja(),opacity:N.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();L=A.target.id;if(L.substr(0,14)=="pathpointgrip_"){v=svgedit.path.path.cur_pt=parseInt(L.substr(14));svgedit.path.path.dragging=[F,I];E=svgedit.path.path.segs[v];if(A.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(v): -svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I= +svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ta==null)ta=Ha.getRubberBandBox();ma(ta,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I= w.pathSegList;A=I.numberOfItems-1;if(m){var E=svgedit.path.addCtrlGrip("1c1"),G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");E.setAttribute("cx",v);E.setAttribute("cy",F);E.setAttribute("display","inline");E=m[0];var L=m[1];I.getItem(A);var k=E+(E-v/o),u=L+(L-F/o);G.setAttribute("cx",k*o);G.setAttribute("cy",u*o);G.setAttribute("display","inline");G=svgedit.path.getCtrlLine(1);var C=svgedit.path.getCtrlLine(2);ma(G,{x1:v,y1:F,x2:E*o,y2:L*o,display:"inline"});ma(C,{x1:k* o,y1:u*o,x2:E*o,y2:L*o,display:"inline"});if(A===0)z=[v,F];else{I=I.getItem(A-1);v=I.x;F=I.y;if(I.pathSegType===6){v+=v-I.x2;F+=F-I.y2}else if(z){v=z[0]/o;F=z[1]/o}svgedit.path.replacePathSeg(6,A,[E,L,v,F,k,u],w)}}else if(E=qa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,F,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,F],E);else z?svgedit.path.replacePathSeg(6,1,[v,F,z[0],z[1],v,F],E):svgedit.path.replacePathSeg(4,1,[v,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:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,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=ua.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,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}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(ua&&ua.getAttribute("display")!= -"none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.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 v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&& +svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,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,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}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 v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&& svgedit.path.recalcRotatedPath();if(v){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(oa(A)!=0){var v=new za("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Na(A,F));Qa();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix=null; this.clear();vb([A],true);M("changed",J)}},clear:function(){h=null;if(w){var A=qa(ca());$(qa("path_stretch_line")).remove();$(A).remove();$(qa("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 v=V(A),F=fa(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems, E=0;E=4){var I=v.getItem(0),E=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=F-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(E)if((I=svgedit.path.smoothControlPoints(E, 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,u.x,u.y].join(","));I=u;E=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= @@ -328,7 +328,7 @@ if(v&&v.tagName=="title"){for(;v.firstChild;)v.removeChild(v.firstChild);v.textC e){h=m.all_layers[z][1];break}if(!h)return false;e=new za("Move Elements to Layer");m=J;for(z=m.length;z--;){var w=m[z];if(w){var H=w.nextSibling,A=w.parentNode;h.appendChild(w);e.addSubCommand(new Ia(w,H,A))}}ya(e);return true};this.mergeLayer=function(e){var h=new za("Merge Layer"),m=B(),z=$(m.current_layer).prev()[0];if(z){for(h.addSubCommand(new Ka(m.current_layer,m.current_layer.nextSibling,l));m.current_layer.firstChild;){var w=m.current_layer.firstChild;if(w.localName=="title"){h.addSubCommand(new Ka(w, w.nextSibling,m.current_layer));m.current_layer.removeChild(w)}else{var H=w.nextSibling;z.appendChild(w);h.addSubCommand(new Ia(w,H,m.current_layer))}}l.removeChild(m.current_layer);if(!e){Qa();Fb();M("changed",[l]);ya(h)}m.current_layer=z;return h}};this.mergeAllLayers=function(){var e=new za("Merge all Layers"),h=B();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(l).children("g").length>1;)e.addSubCommand(b.mergeLayer(true));Qa();Fb();M("changed",[l]);ya(e)};var Jb=this.leaveContext= function(){var e=va.length;if(e){for(var h=0;h input[type="file"]').remove();a("#tool_open").show();g.open=d.open}if(d.save){c.show_save_warning=false;g.bind("saved",d.save)}d.pngsave&&g.bind("exported",d.pngsave);b=d})};c.randomizeIds=function(){g.randomizeIds(arguments)};c.init=function(){function d(k,u){var C=k.id,D=C.split("_"),P=D[0];D=D[1];u&&g.setStrokeAttr("stroke-"+P,D);qb();yb("#cur_"+P,C,20);a(k).addClass("current").siblings().removeClass("current")}function l(k, u){var C=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),P=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Sb){Sb.stopPropagation();C.style.left=Sb.pageX-66+P.scrollLeft+"px";D.style.top=Sb.pageY-48+P.scrollTop+"px"});u||(u=g.getZoom());k||(k=a("#svgcanvas"));for(var U=g.getContentElem(),S=svgedit.units.getTypeMap()[curConfig.baseUnit], -Y=0;Y<2;Y++){var aa=Y===0,ga=aa?"x":"y",ra=aa?"width":"height",Oa=U.getAttribute(ga)-0;ga=a("#ruler_"+ga+" canvas:first");$hcanv=ga.clone();ga.replaceWith($hcanv);var Ba=$hcanv[0];var ha=ga=k[ra]()*2;Ba.parentNode.style[ra]=ha+"px";var Ta=0,Ra,ta=Ba.getContext("2d");ta.fillStyle="rgb(200,0,0)";ta.fillRect(0,0,Ba.width,Ba.height);$hcanv.siblings().remove();if(ga>=3E4){var Ma=parseInt(ga/3E4)+1;Ra=Array(Ma);Ra[0]=ta;for(var xa=1;xa=1)xa=Math.round(Ma);else{xa=(Ba+"").split(".")[1].length;xa=Ma.toFixed(xa)-0}if(xa!==0&&xa!==1E3&&xa%1E3===0)xa= -xa/1E3+"K";if(aa){ta.fillText(xa,cb+2,8);ta.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xaga){Ta++;ta.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ta=Ra[Ta];cb-=3E4;zb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(aa){ta.moveTo(zb,15);ta.lineTo(zb,Gb)}else{ta.moveTo(15,zb);ta.lineTo(Gb,zb)}}}ta.strokeStyle="#666";ta.stroke()}}(function(){var k=window.opener; +Y=0;Y<2;Y++){var aa=Y===0,ga=aa?"x":"y",ra=aa?"width":"height",Oa=U.getAttribute(ga)-0;ga=a("#ruler_"+ga+" canvas:first");$hcanv=ga.clone();ga.replaceWith($hcanv);var Ba=$hcanv[0];var ha=ga=k[ra]()*2;Ba.parentNode.style[ra]=ha+"px";var Ta=0,Ra,ua=Ba.getContext("2d");ua.fillStyle="rgb(200,0,0)";ua.fillRect(0,0,Ba.width,Ba.height);$hcanv.siblings().remove();if(ga>=3E4){var Ma=parseInt(ga/3E4)+1;Ra=Array(Ma);Ra[0]=ua;for(var xa=1;xa=1)xa=Math.round(Ma);else{xa=(Ba+"").split(".")[1].length;xa=Ma.toFixed(xa)-0}if(xa!==0&&xa!==1E3&&xa%1E3===0)xa= +xa/1E3+"K";if(aa){ua.fillText(xa,cb+2,8);ua.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xaga){Ta++;ua.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ua=Ra[Ta];cb-=3E4;zb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(aa){ua.moveTo(zb,15);ua.lineTo(zb,Gb)}else{ua.moveTo(15,zb);ua.lineTo(Gb,zb)}}}ua.strokeStyle="#666";ua.stroke()}}(function(){var k=window.opener; if(k)try{var u=k.document.createEvent("Event");u.initEvent("svgEditorReady",true,true);k.document.documentElement.dispatchEvent(u)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var k=a.deparam.querystring(true);if(!a.isEmptyObject(k)){if(k.dimensions)k.dimensions=k.dimensions.split(",");if(k.extensions)k.extensions=k.extensions.split(",");if(k.bkgd_color)k.bkgd_color= "#"+k.bkgd_color;svgEditor.setConfig(k);var u=k.source,C=a.param.querystring();if(!u)if(C.indexOf("source=data:")>=0)u=C.match(/source=(data:[^&]*)/)[1];if(u)if(u.indexOf("data:")===0){u=u.replace(/ /g,"+");c.loadFromDataURI(u)}else c.loadFromString(u);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();var q=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(u){if(!u){u=document.createElement("script"); u.src=curConfig.extPath+k;document.querySelector("head").appendChild(u)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",square:"square.png",rect:"square.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png", @@ -396,7 +396,7 @@ a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container function(){k.hide();U(false)});if(D=="prompt"){var aa=a('').prependTo(u);aa.val(S||"");aa.bind("keydown","return",function(){Y.trigger("click touchstart")})}D=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=D=="prompt"?aa.val():true;U&&U(ga)}).focus();D=="prompt"&&aa.focus()};a.alert=function(D,P){C("alert",D,P)};a.confirm=function(D,P){C("confirm",D,P)};a.process_cancel=function(D,P){C("process",D,P)};a.prompt=function(D,P,U){C("prompt",D,U,P)}})(); var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=false,ka=false,da="",W=function(k,u){var C=g.getResolution();a("#svgcanvas").position();var D=g.setBBoxZoom(u,R.width()-15,R.height()-15);if(D){var P=D.zoom;D=D.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y= C.zoom,aa=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);F();ga<1?requestAnimationFrame(aa):a("#zoom").val(P*100)};aa(Date.now());g.getMode()=="zoom"&&D.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var Z=function(){c.paintBox.fill.prep();c.paintBox.stroke.prep()},oa={},qa=function(k){a.each(k,function(u,C){var D=a(u).children(),P=u+"_show",U=a(P),S=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var ra= -C[ga];oa[ra.sel]=ra.fn;if(ra.isDefault)S=ga;ga=function(Oa){var Ba=ra;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[ra.parent],function(ta,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[ra.parent][ta+1]||k[ra.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height", +C[ga];oa[ra.sel]=ra.fn;if(ra.isDefault)S=ga;ga=function(Oa){var Ba=ra;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[ra.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[ra.parent][ua+1]||k[ra.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height", U.height());U.children(":not(.flyout_arrow_horiz)").remove();U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);ra.key&&a(document).bind("keydown",ra.key[0]+" shift+"+ra.key[0],ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,aa=a(P).position();a(u).css({left:aa.left+34,top:aa.top+77});U.mousedown(function(ga){a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var ra=a(u),Oa=aa.left+34,Ba=ra.width()* -1,ha=ra.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?ra.css("left",Oa).show():ra.css("left",Ba).show().animate({left:Oa},150);ra.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in oa&&oa[ga]()})});Aa()},ma=function(k,u){return a("
",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(u)},na=function(){a(".tools_flyout").each(function(){var k= a("#"+this.id+"_show"),u=k.offset();k=k.outerWidth();a(this).css({left:(u.left+k)*ia,top:u.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var u=[];a(this).children().each(function(){u.push(this.title)});k[0].title=u.join(" / ")}})},Fa,Ia=function(k,u,C){var D=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];D={alpha:u};D[k.tagName]=k}else D=k.indexOf("#")===0?{alpha:u,solidColor:k.substr(1)}: @@ -408,7 +408,7 @@ a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openc D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide(); a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active", g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa? -"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled"); +"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled"); g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D= null,P=X.getElementsByTagName("*"),U=0,S=P.length;U=533||~C.indexOf("MSIE"))Qb(0,true);else{var D=k.open("data:image/svg+xml;base64,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})}); g.bind("zoomed",W);g.bind("contextset",function(k,u){var C="";if(u){var D="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > '+this.id+"":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)}, -50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("
",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='
'+ha.id+"
",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='';Ta=a('
    ').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ -ha.colnum);a(ta).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="'+ha.label+':';var ab=a(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa= -{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("
    ", -{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
    ",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"
  • ":"
    ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type== -"mode_flyout"){ta=a(ab);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("
    ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button"); -a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("
    ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+ -Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
    '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k= -"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("

    ").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text); -qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u? -g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,D)};a("#palette").mouseover(function(){var k=a('');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D); -if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false; -if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY; -if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()=== -"zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart", -function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel", -function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;u=Sa.length;for(E=0;E0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]"+k+"

    "+k+"

    ")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()> -0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill"); -k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed"); -R.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed"); -a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C= -fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u, -true):u.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()* -(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"? -k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ -ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()? -a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)}); -a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker", -containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D= -{color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('\t\t\t\t\t',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5): -C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+ -this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("
    "+aa.w+"\u00d7
    "+aa.h+"
    ")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k= -[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear", -fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():g.save({images:s.img_save,round_digits:6})},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel", -fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"}, -{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"}, -{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"}, -{key:"ctrl+left",fn:function(){nb(0,1)}},{key:"ctrl+right",fn:function(){nb(1,1)}},{key:"ctrl+shift+left",fn:function(){nb(0,5)}},{key:"ctrl+shift+right",fn:function(){nb(1,5)}},{key:"shift+O",fn:db},{key:"shift+P",fn:Ya},{key:[o+"+",true],fn:function(){Db(2)}},{key:[o+"-",true],fn:function(){Db(0.5)}},{key:["up",true],fn:function(){ja(0,-1)}},{key:["down",true],fn:function(){ja(0,1)}},{key:["left",true],fn:function(){ja(-1,0)}},{key:["right",true],fn:function(){ja(1,0)}},{key:"shift+up",fn:function(){ja(0, --10)}},{key:"shift+down",fn:function(){ja(0,10)}},{key:"shift+left",fn:function(){ja(-10,0)}},{key:"shift+right",fn:function(){ja(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down", -true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,0)}},{key:o+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:o+"shift+z",fn:Ja},{key:"esc",fn:Rb}],u={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var C={};a.each(k,function(D,P){if(P.sel){var U=a(P.sel);if(U.length==0)return true;if(P.evt){if(svgedit.browser.isTouch()&& -P.evt==="click")P.evt="mousedown";U[P.evt](P.fn)}if(P.parent&&a(P.parent+"_show").length!=0){var S=a(P.parent);S.length||(S=ma(P.parent.substr(1)));S.append(U);a.isArray(C[P.parent])||(C[P.parent]=[]);C[P.parent].push(P)}}if(P.key){var Y=P.fn,aa=false;if(a.isArray(P.key)){S=P.key[0];if(P.key.length>1)aa=P.key[1]}else S=P.key;S+="";svgedit.browser.isMac&&S.indexOf("+")!=-1&&S.split("+")[0]=="ctrl"&&S.replace("ctrl","cmd");a.each(S.split("/"),function(ra,Oa){a(document).bind("keydown",Oa,function(Ba){Y(); -aa&&Ba.preventDefault();return false})});if(P.sel&&!P.hidekey&&U.attr("title")){var ga=U.attr("title").split("[")[0]+" ("+S+")";u[S]=P.sel;U.parents("#main_menu").length||U.attr("title",ga)}}});qa(C);a(window).bind("keydown","tab",function(D){if(pa==="canvas"){D.preventDefault();Ya()}}).bind("keydown","shift+tab",function(D){if(pa==="canvas"){D.preventDefault();db()}});a("#tool_zoom").dblclick(Za)},setTitles:function(){a.each(u,function(C,D){var P=a(D).parents("#main_menu").length;a(D).each(function(){var U= -P?a(this).text().split(" [")[0]:this.title.split(" [")[0],S="";a.each(C.split("/"),function(Y,aa){var ga=aa.split("+"),ra="";if(ga.length>1){ra=ga[0]+"+";aa=ga[1]}S+=(Y?"/":"")+ra+(uiStrings["key_"+aa]||aa)});if(P)this.lastChild.textContent=U+" ["+S+"]";else this.title=U+" ["+S+"]"})})},getButtonData:function(C){var D;a.each(k,function(P,U){if(U.sel===C)D=U});return D}}}();v.setAll();c.ready(function(){var k=curConfig.initTool,u=a("#tools_left, #svg_editor .tools_flyout"),C=u.find("#tool_"+k);k=u.find("#"+ -k);(C.length?C:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:0, -max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false}); -a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null, -max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false}); -a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute, -cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:function(k){g.setRectRadius(k.value)},cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var u=k.value;if(u==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)u=k.value=1;g.setStrokeWidth(u)},cursor:true,smallStep:0.1,start:1.5}); -a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",k.value==0)},cursor:false});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,u){var C=k.value-0,D=C+u,P=D>=C;if(u===0)return C;return C>=24?P?Math.round(C*1.1):Math.round(C/1.1):C<=1?P?C*2:C/2:D}});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:function(k, -u){if(u==null)u=k.value;a("#group_opacity").val(u);if(!k||!k.handle)a("#opac_slider").slider("option","value",u);g.setOpacity(u/100)},cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k){val=k.value;a("#blur").val(val);window.event.type=="mouseup"?g.setBlur(val,true):g.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":ua();break;case "cut":mb(); -break;case "copy":jb();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":ob();break;case "move_up":wb("Up");break;case "move_down":wb("Down");break;case "move_back":eb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()}); -a("#cmenu_canvas li").disableContextMenu();V.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(T.getUndoStackSize()===0)c.show_save_warning=false;if(!curConfig.no_save_warning&&c.show_save_warning)return uiStrings.notification.unsavedChanges};c.openPrep=function(k){a("#main_menu").hide();T.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){q=a('').change(function(){var k=this;c.openPrep(function(u){if(u){g.clear(); -if(k.files.length==1){u=new FileReader;u.onloadend=function(C){p(C.target.result);F()};u.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(q);q=a('').change(function(){a("#main_menu").hide();if(this.files.length==1){var k=new FileReader;k.onloadend=function(u){g.importSvgString(u.target.result,true);F()};k.readAsText(this.files[0])}});a("#tool_import").show().prepend(q)}for(var F=c.updateCanvas=function(k,u){var C=R.width(),D=R.height(),P=C,U=D,S=g.getZoom(),Y=a("#svgcanvas"), -aa={x:R[0].scrollLeft+P/2,y:R[0].scrollTop+U/2},ga=curConfig.canvas_expansion;C=Math.max(P,g.contentW*S*ga);D=Math.max(U,g.contentH*S*ga);C==P&&D==U?R.css("overflow","hidden"):R.css("overflow","scroll");ga=Y.height()/2;var ra=Y.width()/2;Y.width(C).height(D);var Oa=D/2,Ba=C/2,ha=g.updateCanvas(C,D),Ta=Ba/ra;C=C/2-P/2;D=D/2-U/2;if(u){u.x+=ha.x;u.y+=ha.y}else u={x:Ba+(aa.x-ra)*Ta,y:Oa+(aa.y-ga)*Ta};if(k)if(g.contentW>R.width()){R[0].scrollLeft=ha.x-10;R[0].scrollTop=ha.y-10}else{R[0].scrollLeft=C;R[0].scrollTop= -D}else{R[0].scrollLeft=u.x-P/2;R[0].scrollTop=u.y-U/2}if(curConfig.showRulers){l(Y,S);R.scroll()}},I=[],E=0.1;E<1E5;E*=10){I.push(1*E);I.push(2*E);I.push(5*E)}F(true);try{var G=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var u=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k=="string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(P){return"\\u"+ -("0000"+P.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var C=0;C",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='
    '+ha.id+"
    ",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='';Ta=a('
      ').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ +ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="'+ha.label+':';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa= +{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(ra){aa[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("
      ",{id:ha.panel}).appendTo("#tools_top"); +break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
      ",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"
    • ":"
      ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent(); +if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("
      ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ +ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("
      ",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key, +isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
      '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k, +"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("

      ").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);qb()});a("#seg_type").change(function(){g.setSegType(a(this).val()); +a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C, +D)};a("#palette").mouseover(function(){var k=a('');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!= +1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true; +var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove", +function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&& +R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart", +function(k){top!=self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()* +100;u=Sa.length;for(E=0;E0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]"+ +k+"

      "+k+"

      ")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu")); +T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity")); +if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");R.toggleClass("wireframe");if(!H){var k= +a("#wireframe_rules");k.length?k.empty():a('').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked", +false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C); +a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,true):u.clone();C?a(k).find("img").replaceWith(C): +console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+ +Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na(); +var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ +P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); +var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke": +"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D); +g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('\t\t\t\t\t',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S= +P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type; +switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("
      "+aa.w+"\u00d7
      "+aa.h+"
      ")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)}); +a("input,select").attr("autocomplete","off");var v=function(){var k=[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"}, +{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():g.save({images:s.img_save,round_digits:6})},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers", +fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ta,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"}, +{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+ +"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+ +"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},{key:"ctrl+left",fn:function(){nb(0,1)}},{key:"ctrl+right",fn:function(){nb(1,1)}},{key:"ctrl+shift+left",fn:function(){nb(0,5)}},{key:"ctrl+shift+right",fn:function(){nb(1,5)}},{key:"shift+O",fn:db},{key:"shift+P",fn:Ya},{key:[o+"+",true],fn:function(){Db(2)}},{key:[o+"-",true],fn:function(){Db(0.5)}},{key:["up",true],fn:function(){ja(0,-1)}},{key:["down",true],fn:function(){ja(0,1)}}, +{key:["left",true],fn:function(){ja(-1,0)}},{key:["right",true],fn:function(){ja(1,0)}},{key:"shift+up",fn:function(){ja(0,-10)}},{key:"shift+down",fn:function(){ja(0,10)}},{key:"shift+left",fn:function(){ja(-10,0)}},{key:"shift+right",fn:function(){ja(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1, +0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,0)}},{key:o+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:o+"shift+z",fn:Ja},{key:"esc",fn:Rb}],u={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var C= +{};a.each(k,function(D,P){if(P.sel){var U=a(P.sel);if(U.length==0)return true;if(P.evt){if(svgedit.browser.isTouch()&&P.evt==="click")P.evt="mousedown";U[P.evt](P.fn)}if(P.parent&&a(P.parent+"_show").length!=0){var S=a(P.parent);S.length||(S=ma(P.parent.substr(1)));S.append(U);a.isArray(C[P.parent])||(C[P.parent]=[]);C[P.parent].push(P)}}if(P.key){var Y=P.fn,aa=false;if(a.isArray(P.key)){S=P.key[0];if(P.key.length>1)aa=P.key[1]}else S=P.key;S+="";svgedit.browser.isMac&&S.indexOf("+")!=-1&&S.split("+")[0]== +"ctrl"&&S.replace("ctrl","cmd");a.each(S.split("/"),function(ra,Oa){a(document).bind("keydown",Oa,function(Ba){Y();aa&&Ba.preventDefault();return false})});if(P.sel&&!P.hidekey&&U.attr("title")){var ga=U.attr("title").split("[")[0]+" ("+S+")";u[S]=P.sel;U.parents("#main_menu").length||U.attr("title",ga)}}});qa(C);a(window).bind("keydown","tab",function(D){if(pa==="canvas"){D.preventDefault();Ya()}}).bind("keydown","shift+tab",function(D){if(pa==="canvas"){D.preventDefault();db()}});a("#tool_zoom").dblclick(Za)}, +setTitles:function(){a.each(u,function(C,D){var P=a(D).parents("#main_menu").length;a(D).each(function(){var U=P?a(this).text().split(" [")[0]:this.title.split(" [")[0],S="";a.each(C.split("/"),function(Y,aa){var ga=aa.split("+"),ra="";if(ga.length>1){ra=ga[0]+"+";aa=ga[1]}S+=(Y?"/":"")+ra+(uiStrings["key_"+aa]||aa)});if(P)this.lastChild.textContent=U+" ["+S+"]";else this.title=U+" ["+S+"]"})})},getButtonData:function(C){var D;a.each(k,function(P,U){if(U.sel===C)D=U});return D}}}();v.setAll();c.ready(function(){var k= +curConfig.initTool,u=a("#tools_left, #svg_editor .tools_flyout"),C=u.find("#tool_"+k);k=u.find("#"+k);(C.length?C:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1, +max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false}); +a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null, +max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false}); +a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute, +cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:function(k){g.setRectRadius(k.value)},cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var u=k.value;if(u==0&&X&&["line","polyline"].indexOf(X.nodeName)>= +0)u=k.value=1;g.setStrokeWidth(u)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,u){var C=k.value-0,D=C+u,P=D>=C;if(u===0)return C;return C>=24?P?Math.round(C*1.1):Math.round(C/1.1): +C<=1?P?C*2:C/2:D}});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:function(k,u){if(u==null)u=k.value;a("#group_opacity").val(u);if(!k||!k.handle)a("#opac_slider").slider("option","value",u);g.setOpacity(u/100)},cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k){val=k.value;a("#blur").val(val);window.event.type=="mouseup"?g.setBlur(val,true):g.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas", +inSpeed:0},function(k){switch(k){case "delete":ta();break;case "cut":mb();break;case "copy":jb();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":ob();break;case "move_up":wb("Up");break;case "move_down":wb("Down");break;case "move_back":eb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}}); +a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();V.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(T.getUndoStackSize()===0)c.show_save_warning=false;if(!curConfig.no_save_warning&&c.show_save_warning)return uiStrings.notification.unsavedChanges};c.openPrep=function(k){a("#main_menu").hide();T.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){q=a('').change(function(){var k= +this;c.openPrep(function(u){if(u){g.clear();if(k.files.length==1){u=new FileReader;u.onloadend=function(C){p(C.target.result);F()};u.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(q);q=a('').change(function(){a("#main_menu").hide();if(this.files.length==1){var k=new FileReader;k.onloadend=function(u){g.importSvgString(u.target.result,true);F()};k.readAsText(this.files[0])}});a("#tool_import").show().prepend(q)}for(var F=c.updateCanvas=function(k,u){var C=R.width(), +D=R.height(),P=C,U=D,S=g.getZoom(),Y=a("#svgcanvas"),aa={x:R[0].scrollLeft+P/2,y:R[0].scrollTop+U/2},ga=curConfig.canvas_expansion;C=Math.max(P,g.contentW*S*ga);D=Math.max(U,g.contentH*S*ga);C==P&&D==U?R.css("overflow","hidden"):R.css("overflow","scroll");ga=Y.height()/2;var ra=Y.width()/2;Y.width(C).height(D);var Oa=D/2,Ba=C/2,ha=g.updateCanvas(C,D),Ta=Ba/ra;C=C/2-P/2;D=D/2-U/2;if(u){u.x+=ha.x;u.y+=ha.y}else u={x:Ba+(aa.x-ra)*Ta,y:Oa+(aa.y-ga)*Ta};if(k)if(g.contentW>R.width()){R[0].scrollLeft=ha.x- +10;R[0].scrollTop=ha.y-10}else{R[0].scrollLeft=C;R[0].scrollTop=D}else{R[0].scrollLeft=u.x-P/2;R[0].scrollTop=u.y-U/2}if(curConfig.showRulers){l(Y,S);R.scroll()}},I=[],E=0.1;E<1E5;E*=10){I.push(1*E);I.push(2*E);I.push(5*E)}F(true);try{var G=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var u=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k=="string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, +function(P){return"\\u"+("0000"+P.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var C=0;C0?"visible":"hidden"});if(Q>0&&Q<100)if(q){var ea=M.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):M.css({opacity:Math.precision(Q/ 100,4)})}else M.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(q){ea=M.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},fb=function(){ja.active.val("ahex",ja.current.val("ahex"))},La=function(){ja.current.val("ahex",ja.active.val("ahex"))},Va=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+ M.target.value+'"]').removeAttr("checked");Na.call(d,M.target.value)},Ea=function(){fb.call(d)},kb=function(){fb.call(d);l.window.expandable&&wb.call(d);a.isFunction(tb)&&tb.call(d,ja.active,na)},sb=function(){La.call(d);l.window.expandable&&wb.call(d);a.isFunction(ob)&&ob.call(d,ja.active,ma)},Za=function(){ub.call(d)},bb=function(M){var Q=M.val("hex");qa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,qa,Math.precision((M.val("a")||0)*100/255,4))},Cb=function(M){var Q=M.val("hex");M=M.val("va"); -Fa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,Ia,Math.precision((255-(M&&M.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:M==null||M.v>75?"#000000":"#ffffff"})},ua=function(M){ka=parseInt(B.css("left"));da=parseInt(B.css("top"));W=M.pageX;Z=M.pageY;a(document).bind("mousemove",mb).bind("mouseup",jb);M.preventDefault()},mb=function(M){B.css({left:ka-(W-M.pageX)+"px",top:da-(Z-M.pageY)+"px"});l.window.expandable&& +Fa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,Ia,Math.precision((255-(M&&M.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:M==null||M.v>75?"#000000":"#ffffff"})},ta=function(M){ka=parseInt(B.css("left"));da=parseInt(B.css("top"));W=M.pageX;Z=M.pageY;a(document).bind("mousemove",mb).bind("mouseup",jb);M.preventDefault()},mb=function(M){B.css({left:ka-(W-M.pageX)+"px",top:da-(Z-M.pageY)+"px"});l.window.expandable&& !a.support.boxModel&&B.prev().css({left:B.css("left"),top:B.css("top")});M.stopPropagation();M.preventDefault();return false},jb=function(M){a(document).unbind("mousemove",mb).unbind("mouseup",jb);M.stopPropagation();M.preventDefault();return false},Ab=function(M){M.preventDefault();M.stopPropagation();ja.active.val("ahex",a(this).attr("title")||null,M.target);return false},ob=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,tb=a.isFunction(f[3])&&f[3]||null,ub=function(){ja.current.val("ahex", ja.active.val("ahex"));var M=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=B.find("table:first");B.before("