multi select no longer applies color

master
Mark MacKay 2012-07-28 19:17:40 -05:00
parent 8f71a040dd
commit 2684aaa032
4 changed files with 104 additions and 106 deletions

View File

@ -1338,15 +1338,15 @@
}
$('#stroke_width').val(gWidth === null ? "" : gWidth);
Editor.paintBox.fill.update(true);
Editor.paintBox.stroke.update(true);
//Editor.paintBox.fill.update(false);
//Editor.paintBox.stroke.update(false);
break;
default:
Editor.paintBox.fill.update(true);
Editor.paintBox.stroke.update(true);
//removed because multiselect shouldnt set color
//Editor.paintBox.fill.update(false);
//Editor.paintBox.stroke.update(false);
$('#stroke_width').val(selectedElement.getAttribute("stroke-width") || 1);
var dash = selectedElement.getAttribute("stroke-dasharray") || "none"
@ -2941,7 +2941,6 @@
this.setPaint = function(paint, apply) {
this.paint = paint;
var fillAttr = "none";
var ptype = paint.type;
var opac = paint.alpha / 100;

View File

@ -410,52 +410,52 @@ if(qa=="path"||qa=="polyline")a("#path_panel").show();if(D[qa]){D=D[qa];a("#"+qa
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(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");
g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"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(v);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,v){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa=v.length>=2?v:
false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){if(!C){a("#multiselected_panel").hide();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<S;U++){var Y=P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);b.paintBox.fill.update(true);b.paintBox.stroke.update(true);break;default:b.paintBox.fill.update(true);b.paintBox.stroke.update(true);
a("#stroke_width").val(X.getAttribute("stroke-width")||1);D=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+D+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";a("#linecap_"+D).length!=0&&d(a("#linecap_"+D)[0])}if(X!=
null){D=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(D);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}}sa.length&&a("#tools_top").addClass("multiselected")}else if(sa.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}D=v;a("#path_node_panel").toggle(C);a("#tools_bottom_2,#tools_bottom_3").toggle(!C);if(C){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");
a("#tool_canvas").hide();a("#tool_select").addClass("tool_button_current").removeClass("tool_button");yb("#tool_select","select_node");sa=false;if(D.length)X=D[0]}else{if(D[0]){C=g.selectorManager.requestSelector(D[0]);C.reset(D[0]);C.selectorRect.setAttribute("display","inline")}yb("#tool_select","select")}g.runExtensions("selectedChanged",{elems:v,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,v){var C=g.getMode(),D=v[0];if(D){sa=v.length>=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=
g.getRotationAngle(D);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var D=0;D<v.length;++D){var P=v[D];if(P&&P.tagName==="svg")F();else if(P&&X&&X.parentNode==null)X=P}b.show_save_warning=true;Aa();if(X&&C==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:v})});g.bind("saved",
function(k,v){b.show_save_warning=false;v='<?xml version="1.0"?>\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var D=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done",
"part");else a.pref("save_notice_done","all");P!=="part"&&D.alert(U)}}});g.bind("exported",function(k,v){var C=v.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,v.svg,{renderCallback:function(){var P=D.toDataURL("image/png");M.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");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==v?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){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(v.callback&&!D&&U){D=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,
cb)});break;case "select":ua="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ua+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";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='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').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="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></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(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[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('<img src="'+ha.icon+'">');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("<div>",{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("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").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("<div>",{"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("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.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<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}qa||ab.append(Ta);ha.list||a.each(ha.events,function(zb,Gb){if(zb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(zb,Gb):ab.bind(zb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",
ha.title+" ["+ha.key+"]")}}else ab.bind(zb,Gb);else ab.bind(zb,Gb)});ra(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(qa)U=false;a.svgIcons(qa,{w:27,h:27,id_match:false,no_img:!B,fallback:Z,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00",
"#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,v){ya+='<div class="palette_item" style="background-color: '+v+';" data-rgb="'+v+'"></div>'});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 v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/2)/k,zoom:v},true)}},qb=function(){window.opera&&a("<p/>").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){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);
k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),v=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)});b.paintBox[v].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,v){if(a(k).hasClass("disabled"))return false;
if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||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,v=null,C=Q[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-v;k=U.clientX;v=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;v=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"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.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){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,v,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(E=0;E<v;E++){C=
Math.min(v,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,v,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);
var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,D){var P=a(k);v=a(v);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",
function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=v.height();Y.left+=8}else Y.top+=a(k).height();a(v).offset(Y);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=
true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});
(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&
g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));
g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&
pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection()}},la=function(){X!=
null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},N=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
false);K.linkControlPoints(k)},R=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),v=!k.hasClass("push_button_pressed");v?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(v)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(X==null||sa)){k||(v*=-1);
var C=a("#angle").val()*1+v;g.setRotationAngle(C);Aa()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(v){if(v){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();Aa();aa();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());Aa();return false},Qa=function(){g.setItalic(!g.getItalic());Aa();return false},vb=function(){if(!c.pngsave){var k=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+
k+"</title><h1>"+k+"</h1>")}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 v=k.prev();v.css("background","#09f");setTimeout(function(){v.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"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;D=Ia(D,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(D,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.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");Q.toggleClass("wireframe");if(!H){var k=
a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').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(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);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();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},yb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):
console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(v-1),U=D.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=D.data("orig_margin-"+
Y);if(Z==null){Z=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;D.css("margin-"+Y,Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){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];b.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('<style id="tool_size_rules"></style>').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(Z,ga){if(typeof ga==="number")var qa=ga*D+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});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{"+
false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){if(!C){a("#multiselected_panel").hide();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<S;U++){var Y=P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||1);D=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");
a('#stroke_style option[value="'+D+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";a("#linecap_"+D).length!=0&&d(a("#linecap_"+D)[0])}if(X!=null){D=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(D);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}}sa.length&&a("#tools_top").addClass("multiselected")}else if(sa.length){a(".context_panel").hide();
a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}D=v;a("#path_node_panel").toggle(C);a("#tools_bottom_2,#tools_bottom_3").toggle(!C);if(C){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_canvas").hide();a("#tool_select").addClass("tool_button_current").removeClass("tool_button");yb("#tool_select","select_node");sa=false;if(D.length)X=
D[0]}else{if(D[0]){C=g.selectorManager.requestSelector(D[0]);C.reset(D[0]);C.selectorRect.setAttribute("display","inline")}yb("#tool_select","select")}g.runExtensions("selectedChanged",{elems:v,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,v){var C=g.getMode(),D=v[0];if(D){sa=v.length>=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(D);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",
{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var D=0;D<v.length;++D){var P=v[D];if(P&&P.tagName==="svg")F();else if(P&&X&&X.parentNode==null)X=P}b.show_save_warning=true;Aa();if(X&&C==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:v})});g.bind("saved",function(k,v){b.show_save_warning=false;v='<?xml version="1.0"?>\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,
true);else{var D=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");P!=="part"&&D.alert(U)}}});g.bind("exported",function(k,v){var C=v.issues;a("#export_canvas").length||a("<canvas>",
{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,v.svg,{renderCallback:function(){var P=D.toDataURL("image/png");M.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");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,
v){var C="";if(v){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==v?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){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(v.callback&&
!D&&U){D=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ua+=
'<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";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='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').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="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></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(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};
a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[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('<img src="'+ha.icon+'">');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("<div>",{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("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").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("<div>",{"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("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.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<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}qa||ab.append(Ta);ha.list||a.each(ha.events,function(zb,Gb){if(zb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(zb,Gb):ab.bind(zb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",ha.title+" ["+ha.key+"]")}}else ab.bind(zb,Gb);else ab.bind(zb,
Gb)});ra(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(qa)U=false;a.svgIcons(qa,{w:27,h:27,id_match:false,no_img:!B,fallback:Z,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff",
"#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,v){ya+='<div class="palette_item" style="background-color: '+v+';" data-rgb="'+v+'"></div>'});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 v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/2)/k,zoom:v},true)}},qb=function(){window.opera&&a("<p/>").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){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,
C)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),v=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)});b.paintBox[v].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,v){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;
var C=C||"normal";v||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,v=null,C=Q[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-v;k=U.clientX;v=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;v=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"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&
Q.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){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,v,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(E=0;E<v;E++){C=Math.min(v,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=
Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,v,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",
v);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,D){var P=a(k);v=a(v);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());
a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=v.height();Y.left+=8}else Y.top+=a(k).height();a(v).offset(Y);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=
false});D.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=
this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},
Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),
v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&
pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection()}},la=function(){X!=null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",
function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},N=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);K.linkControlPoints(k)},R=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&
K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),v=!k.hasClass("push_button_pressed");v?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(v)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(X==null||sa)){k||(v*=-1);var C=a("#angle").val()*1+v;g.setRotationAngle(C);Aa()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,
function(v){if(v){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();Aa();aa();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());Aa();return false},Qa=function(){g.setItalic(!g.getItalic());Aa();return false},vb=function(){if(!c.pngsave){var k=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}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 v=k.prev();v.css("background","#09f");setTimeout(function(){v.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"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;D=Ia(D,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(D,
true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.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");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').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(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);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();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},yb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],
C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(v-1),U=D.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=D.data("orig_margin-"+Y);if(Z==null){Z=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;D.css("margin-"+Y,
Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){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];b.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('<style id="tool_size_rules"></style>').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(Z,ga){if(typeof ga==="number")var qa=ga*D+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});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(){Q.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=Q[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=Q[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(v){v&&Na(v)})});var w=function(k){var v=k[0].id=="stroke_color"?"stroke":
"fill",C=k[0].id=="canvas_color";if(C)v="canvas";var D=b.paintBox[v].paint;k=v=="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);b.paintBox[v].setPaint(D);

View File

@ -1338,15 +1338,15 @@
}
$('#stroke_width').val(gWidth === null ? "" : gWidth);
Editor.paintBox.fill.update(true);
Editor.paintBox.stroke.update(true);
//Editor.paintBox.fill.update(false);
//Editor.paintBox.stroke.update(false);
break;
default:
Editor.paintBox.fill.update(true);
Editor.paintBox.stroke.update(true);
//removed because multiselect shouldnt set color
//Editor.paintBox.fill.update(false);
//Editor.paintBox.stroke.update(false);
$('#stroke_width').val(selectedElement.getAttribute("stroke-width") || 1);
var dash = selectedElement.getAttribute("stroke-dasharray") || "none"
@ -2941,7 +2941,6 @@
this.setPaint = function(paint, apply) {
this.paint = paint;
var fillAttr = "none";
var ptype = paint.type;
var opac = paint.alpha / 100;

View File

@ -410,52 +410,52 @@ if(qa=="path"||qa=="polyline")a("#path_panel").show();if(D[qa]){D=D[qa];a("#"+qa
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(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");
g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"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(v);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,v){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa=v.length>=2?v:
false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){if(!C){a("#multiselected_panel").hide();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<S;U++){var Y=P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);b.paintBox.fill.update(true);b.paintBox.stroke.update(true);break;default:b.paintBox.fill.update(true);b.paintBox.stroke.update(true);
a("#stroke_width").val(X.getAttribute("stroke-width")||1);D=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+D+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";a("#linecap_"+D).length!=0&&d(a("#linecap_"+D)[0])}if(X!=
null){D=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(D);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}}sa.length&&a("#tools_top").addClass("multiselected")}else if(sa.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}D=v;a("#path_node_panel").toggle(C);a("#tools_bottom_2,#tools_bottom_3").toggle(!C);if(C){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");
a("#tool_canvas").hide();a("#tool_select").addClass("tool_button_current").removeClass("tool_button");yb("#tool_select","select_node");sa=false;if(D.length)X=D[0]}else{if(D[0]){C=g.selectorManager.requestSelector(D[0]);C.reset(D[0]);C.selectorRect.setAttribute("display","inline")}yb("#tool_select","select")}g.runExtensions("selectedChanged",{elems:v,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,v){var C=g.getMode(),D=v[0];if(D){sa=v.length>=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=
g.getRotationAngle(D);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var D=0;D<v.length;++D){var P=v[D];if(P&&P.tagName==="svg")F();else if(P&&X&&X.parentNode==null)X=P}b.show_save_warning=true;Aa();if(X&&C==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:v})});g.bind("saved",
function(k,v){b.show_save_warning=false;v='<?xml version="1.0"?>\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var D=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done",
"part");else a.pref("save_notice_done","all");P!=="part"&&D.alert(U)}}});g.bind("exported",function(k,v){var C=v.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,v.svg,{renderCallback:function(){var P=D.toDataURL("image/png");M.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");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==v?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){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(v.callback&&!D&&U){D=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,
cb)});break;case "select":ua="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ua+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";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='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').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="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></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(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[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('<img src="'+ha.icon+'">');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("<div>",{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("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").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("<div>",{"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("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.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<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}qa||ab.append(Ta);ha.list||a.each(ha.events,function(zb,Gb){if(zb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(zb,Gb):ab.bind(zb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",
ha.title+" ["+ha.key+"]")}}else ab.bind(zb,Gb);else ab.bind(zb,Gb)});ra(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(qa)U=false;a.svgIcons(qa,{w:27,h:27,id_match:false,no_img:!B,fallback:Z,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00",
"#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,v){ya+='<div class="palette_item" style="background-color: '+v+';" data-rgb="'+v+'"></div>'});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 v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/2)/k,zoom:v},true)}},qb=function(){window.opera&&a("<p/>").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){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);
k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),v=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)});b.paintBox[v].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,v){if(a(k).hasClass("disabled"))return false;
if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||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,v=null,C=Q[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-v;k=U.clientX;v=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;v=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"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.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){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,v,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(E=0;E<v;E++){C=
Math.min(v,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,v,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);
var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,D){var P=a(k);v=a(v);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",
function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=v.height();Y.left+=8}else Y.top+=a(k).height();a(v).offset(Y);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=
true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});
(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&
g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));
g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&
pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection()}},la=function(){X!=
null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},N=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
false);K.linkControlPoints(k)},R=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),v=!k.hasClass("push_button_pressed");v?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(v)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(X==null||sa)){k||(v*=-1);
var C=a("#angle").val()*1+v;g.setRotationAngle(C);Aa()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(v){if(v){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();Aa();aa();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());Aa();return false},Qa=function(){g.setItalic(!g.getItalic());Aa();return false},vb=function(){if(!c.pngsave){var k=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+
k+"</title><h1>"+k+"</h1>")}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 v=k.prev();v.css("background","#09f");setTimeout(function(){v.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"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;D=Ia(D,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(D,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.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");Q.toggleClass("wireframe");if(!H){var k=
a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').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(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);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();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},yb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):
console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(v-1),U=D.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=D.data("orig_margin-"+
Y);if(Z==null){Z=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;D.css("margin-"+Y,Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){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];b.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('<style id="tool_size_rules"></style>').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(Z,ga){if(typeof ga==="number")var qa=ga*D+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});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{"+
false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){if(!C){a("#multiselected_panel").hide();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<S;U++){var Y=P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||1);D=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");
a('#stroke_style option[value="'+D+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";a("#linecap_"+D).length!=0&&d(a("#linecap_"+D)[0])}if(X!=null){D=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(D);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}}sa.length&&a("#tools_top").addClass("multiselected")}else if(sa.length){a(".context_panel").hide();
a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}D=v;a("#path_node_panel").toggle(C);a("#tools_bottom_2,#tools_bottom_3").toggle(!C);if(C){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_canvas").hide();a("#tool_select").addClass("tool_button_current").removeClass("tool_button");yb("#tool_select","select_node");sa=false;if(D.length)X=
D[0]}else{if(D[0]){C=g.selectorManager.requestSelector(D[0]);C.reset(D[0]);C.selectorRect.setAttribute("display","inline")}yb("#tool_select","select")}g.runExtensions("selectedChanged",{elems:v,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,v){var C=g.getMode(),D=v[0];if(D){sa=v.length>=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(D);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",
{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var D=0;D<v.length;++D){var P=v[D];if(P&&P.tagName==="svg")F();else if(P&&X&&X.parentNode==null)X=P}b.show_save_warning=true;Aa();if(X&&C==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:v})});g.bind("saved",function(k,v){b.show_save_warning=false;v='<?xml version="1.0"?>\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,
true);else{var D=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");P!=="part"&&D.alert(U)}}});g.bind("exported",function(k,v){var C=v.issues;a("#export_canvas").length||a("<canvas>",
{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,v.svg,{renderCallback:function(){var P=D.toDataURL("image/png");M.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");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,
v){var C="";if(v){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==v?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){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(v.callback&&
!D&&U){D=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ua+=
'<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";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='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').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="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></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(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};
a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[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('<img src="'+ha.icon+'">');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("<div>",{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("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").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("<div>",{"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("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.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<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}qa||ab.append(Ta);ha.list||a.each(ha.events,function(zb,Gb){if(zb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(zb,Gb):ab.bind(zb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",ha.title+" ["+ha.key+"]")}}else ab.bind(zb,Gb);else ab.bind(zb,
Gb)});ra(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(qa)U=false;a.svgIcons(qa,{w:27,h:27,id_match:false,no_img:!B,fallback:Z,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff",
"#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,v){ya+='<div class="palette_item" style="background-color: '+v+';" data-rgb="'+v+'"></div>'});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 v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/2)/k,zoom:v},true)}},qb=function(){window.opera&&a("<p/>").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){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,
C)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),v=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)});b.paintBox[v].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,v){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;
var C=C||"normal";v||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,v=null,C=Q[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-v;k=U.clientX;v=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;v=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"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&
Q.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){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,v,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(E=0;E<v;E++){C=Math.min(v,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=
Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,v,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",
v);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,D){var P=a(k);v=a(v);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());
a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=v.height();Y.left+=8}else Y.top+=a(k).height();a(v).offset(Y);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=
false});D.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=
this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},
Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),
v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&
pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection()}},la=function(){X!=null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",
function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},N=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);K.linkControlPoints(k)},R=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&
K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),v=!k.hasClass("push_button_pressed");v?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(v)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(X==null||sa)){k||(v*=-1);var C=a("#angle").val()*1+v;g.setRotationAngle(C);Aa()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,
function(v){if(v){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();Aa();aa();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());Aa();return false},Qa=function(){g.setItalic(!g.getItalic());Aa();return false},vb=function(){if(!c.pngsave){var k=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}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 v=k.prev();v.css("background","#09f");setTimeout(function(){v.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"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;D=Ia(D,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(D,
true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.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");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').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(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);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();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},yb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],
C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(v-1),U=D.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=D.data("orig_margin-"+Y);if(Z==null){Z=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;D.css("margin-"+Y,
Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){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];b.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('<style id="tool_size_rules"></style>').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(Z,ga){if(typeof ga==="number")var qa=ga*D+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});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(){Q.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=Q[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=Q[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(v){v&&Na(v)})});var w=function(k){var v=k[0].id=="stroke_color"?"stroke":
"fill",C=k[0].id=="canvas_color";if(C)v="canvas";var D=b.paintBox[v].paint;k=v=="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);b.paintBox[v].setPaint(D);