text sill peeks out of the box

master
Mark MacKay 2012-07-26 11:03:39 -05:00
parent 5507eb4584
commit 8cc00ebf03
10 changed files with 138 additions and 132 deletions

View File

@ -1830,6 +1830,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1),
font-size: 24px;
color: #fff;
margin: 30px 0 0 10px;
white-space: nowrap;
}
#preview_font:after {

View File

@ -1544,7 +1544,7 @@
$('#font_family').val(font_family);
$('#font_size').val(elem.getAttribute("font-size"));
$('#text').val(elem.textContent);
$('#preview_font').text(font_family.split(",")[0]).css('font-family', font_family);
$('#preview_font').text(font_family.split(",")[0].replace(/'/g, "")).css('font-family', font_family);
if (svgCanvas.addedNew) {
// Timeout needed for IE9
setTimeout(function() {

View File

@ -387,7 +387,7 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we
.draginput input{border:0;background:transparent;font:24px/normal sans-serif;text-align:center;color:#4f80ff;padding:30px 0 16px;width:100%;height:24px;position:relative;z-index:2}
.draginput.twocol{width:145px}
#tool_font_family .caret{right:10px;top:55%}
#preview_font{font-size:24px;color:#fff;margin:30px 0 0 10px}
#preview_font{font-size:24px;color:#fff;margin:30px 0 0 10px;white-space:nowrap}
#preview_font:after{content:'';position:absolute;right:0;top:3px;bottom:3px;width:40px;border-right:solid #3f3f3c 10px;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjxsaW5lYXJHcmFkaWVudCBpZD0iZzU4MCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIwJSIgeTE9IjAlIiB4Mj0iMTAwJSIgeTI9IjAlIj48c3RvcCBzdG9wLWNvbG9yPSIjM2YzZjNjIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMzZjNmM2MiIG9mZnNldD0iMC43Ii8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c1ODApIiAvPjwvc3ZnPg==)}
.draginput input,.draginput input:hover,.draginput input:active{cursor:url(images/drag.png),move;cursor:-webkit-grab;cursor:-moz-grab}
.draginput.active input,.draginput.active input:hover,.draginput.active input:active{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing}

View File

@ -407,70 +407,71 @@ var aa,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){a
a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(u){P=a("#seg_type");if(D){u.x=svgedit.units.convertUnit(u.x);u.y=svgedit.units.convertUnit(u.y)}a("#path_node_x").val(Math.round(u.x));a("#path_node_y").val(Math.round(u.y));u.type?P.val(u.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}return}D=null;if(ra==="a"){D=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();
D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();
a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0]).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();
a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);
V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<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);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");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("#opac_slider").slider("option","value",D);a("#elem_id").val(X.id)}}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_select").addClass("tool_button_current").removeClass("tool_button");yb("#tool_select","select_node");sa=false;if(u.length)X=
u[0]}else{if(u[0]){C=g.selectorManager.requestSelector(u[0]);C.reset(u[0]);C.selectorRect.setAttribute("display","inline")}yb("#tool_select","select")}za();g.runExtensions("selectedChanged",{elems:u,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,u){var C=g.getMode(),D=u[0];if(D){sa=u.length>=2&&u[1]!=null?u: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:u})}});g.bind("changed",function(k,u){var C=g.getMode();C==="select"&&ba();for(var D=0;D<u.length;++D){var P=u[D];if(P&&P.tagName==="svg")F();else if(P&&X&&X.parentNode==null)X=P}c.show_save_warning=true;za();if(X&&C==="select"){c.paintBox.fill.update();c.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:u})});g.bind("saved",function(k,u){c.show_save_warning=false;u='<?xml version="1.0"?>\n'+u;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,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("<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,u){var C=u.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,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,
u){var C="";if(u){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var D=false,P=false,U=true,S=function(){if(u.callback&&
!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='<div class="tool_button">'+ha.id+"</div>",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ta+=
'<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ta+="</select></label>";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='<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(ta).appendTo(Ra).children();
Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="<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(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa={},ga={},ra=u.svgicons,Oa=
{};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('<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"){ta=a(ab);Ma=ta.parent();
if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+
ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,
isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}ra||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)});qa(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(ra)U=false;a.svgIcons(ra,{w:27,h:27,id_match:false,no_img:!B,fallback:aa,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,u){ya+='<div class="palette_item" style="background-color: '+u+';" data-rgb="'+u+'"></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 u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("<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,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,
D)};a("#palette").mouseover(function(){var k=a('<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"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=
1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;
var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",
function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&
R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",
function(k){top!=self&&!k.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*
100;u=Sa.length;for(E=0;E<u;E++){C=Math.min(u,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")});c.addDropDown=function(k,u,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",u);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,u,C,D){var P=a(k);u=a(u);var U=false,S=D.dropUp;
S&&a(k).addClass("dropup");u.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");u.hide();u.css({top:0,left:0})}U=false});u.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=u.height();Y.left+=8}else Y.top+=a(k).height();a(u).offset(Y);if(P.hasClass("down")){P.removeClass("down");u.hide();u.css({top:0,
left:0})}else{P.addClass("down");u.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&u.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,u=this.options[this.selectedIndex].text;a("#preview_font").html(u).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,u=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;pa="toolbars";R.mousedown(u)}).blur(function(){pa="canvas";R.unbind("mousedown",u);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")},ua=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(),u=(R[0].scrollLeft+R.width()/2)/k-g.contentW;k=(R[0].scrollTop+R.height()/2)/k-g.contentH;g.pasteElements("point",u,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,u){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;u*=C}a("input").blur();g.moveSelectedElements(k,u)}},M=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)},Q=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),u=!k.hasClass("push_button_pressed");u?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(u)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,u){if(!(X==null||sa)){k||(u*=-1);
var C=a("#angle").val()*1+u;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(u){if(u){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;O=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 u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));
T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");R.toggleClass("wireframe");if(!H){var k=
a("#wireframe_rules");k.length?k.empty():a('<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(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);
a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,true):u.clone();C?a(k).find("img").replaceWith(C):
console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+
Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();
var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<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(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":
"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);
g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=
P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;
switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa<ga;aa++){var ra=Y[aa].getAttribute(U);if(aa===0)S=ra;else if(S!==ra){S=null;break}}if(S===null){Y=null;return}Y=S;S=1;break;default:S=parseFloat(X.getAttribute(U+"-opacity"));if(isNaN(S))S=1;Y=U==="fill"?"black":"none";Y=X.getAttribute(U)||Y}if(P){g.setColor(U,Y,true);g.setPaintOpacity(U,S,true)}S*=100;this.setPaint(Ia(Y,S,U))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var P=
new a.jGraduate.Paint({copy:this.paint});g.setPaint(u,P)}}};c.paintBox.fill=new q("#fill_color","fill");c.paintBox.stroke=new q("#stroke_color","stroke");c.paintBox.canvas=new q("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);q=c.paintBox.fill.rect.cloneNode(false);q.setAttribute("style","vector-effect:non-scaling-stroke");var H=q.style.vectorEffect==="non-scaling-stroke";q.removeAttribute("style");q=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"feGaussianBlur");typeof q.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(q).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);s.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))w(a("#fill_color"));else{a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))w(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){w(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");w(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active");w(a("#fill_color"))});a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});
a(window).bind("load resize",function(){R.css("line-height",R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height"),C=k.val(),D=u.val();if(C!="fit"&&!svgedit.units.isValidUnit("width",C)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);u.parent().addClass("error");return false}u.parent().removeClass("error");
if(!g.setResolution(C,D)){a.alert(uiStrings.notification.noContentToFitTo);C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=
Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});
a("input,select").attr("autocomplete","off");var v=function(){var k=[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},
{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?
"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");
g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=
null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<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);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");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("#opac_slider").slider("option","value",D);a("#elem_id").val(X.id)}}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_select").addClass("tool_button_current").removeClass("tool_button");
yb("#tool_select","select_node");sa=false;if(u.length)X=u[0]}else{if(u[0]){C=g.selectorManager.requestSelector(u[0]);C.reset(u[0]);C.selectorRect.setAttribute("display","inline")}yb("#tool_select","select")}za();g.runExtensions("selectedChanged",{elems:u,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,u){var C=g.getMode(),D=u[0];if(D){sa=u.length>=2&&u[1]!=null?u: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:u})}});g.bind("changed",function(k,u){var C=g.getMode();C==="select"&&ba();for(var D=0;D<u.length;++D){var P=u[D];if(P&&P.tagName==="svg")F();else if(P&&X&&X.parentNode==null)X=P}c.show_save_warning=true;za();if(X&&C==="select"){c.paintBox.fill.update();c.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:u})});g.bind("saved",function(k,u){c.show_save_warning=false;u='<?xml version="1.0"?>\n'+u;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,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("<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,
u){var C=u.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,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})});
g.bind("zoomed",W);g.bind("contextset",function(k,u){var C="";if(u){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},
50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='<div class="tool_button">'+ha.id+"</div>",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="<label"+Ta+'><select id="'+
ha.id+'">';a.each(ha.options,function(Xa,cb){ta+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ta+="</select></label>";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='<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(ta).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="<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(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa=
{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('<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"){ta=a(ab);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");
a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+
Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}ra||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)});qa(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(ra)U=false;a.svgIcons(ra,{w:27,h:27,id_match:false,no_img:!B,fallback:aa,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,u){ya+='<div class="palette_item" style="background-color: '+u+';" data-rgb="'+u+'"></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 u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("<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,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?
g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,D)};a("#palette").mouseover(function(){var k=a('<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"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);
if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;
if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;
if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()===
"zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",
function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",
function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;u=Sa.length;for(E=0;E<u;E++){C=Math.min(u,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")});c.addDropDown=function(k,u,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",u);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,u,C,D){var P=a(k);u=a(u);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");u.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");u.hide();u.css({top:0,left:0})}U=false});u.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=u.height();Y.left+=8}else Y.top+=a(k).height();a(u).offset(Y);
if(P.hasClass("down")){P.removeClass("down");u.hide();u.css({top:0,left:0})}else{P.addClass("down");u.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&u.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,u=this.options[this.selectedIndex].text;a("#preview_font").html(u).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,u=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;pa="toolbars";R.mousedown(u)}).blur(function(){pa="canvas";R.unbind("mousedown",u);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")},ua=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(),u=(R[0].scrollLeft+R.width()/2)/k-g.contentW;k=(R[0].scrollTop+R.height()/2)/k-g.contentH;g.pasteElements("point",u,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,u){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;u*=C}a("input").blur();g.moveSelectedElements(k,u)}},M=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)},Q=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),u=!k.hasClass("push_button_pressed");u?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(u)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},
db=function(){g.cycleElement(0)},nb=function(k,u){if(!(X==null||sa)){k||(u*=-1);var C=a("#angle").val()*1+u;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(u){if(u){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;
O=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 u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>
0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");
k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");
R.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<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(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=
fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,
true):u.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*
(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?
k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<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(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+
ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?
a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});
a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",
containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D=
{color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):
C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+
this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa<ga;aa++){var ra=Y[aa].getAttribute(U);if(aa===
0)S=ra;else if(S!==ra){S=null;break}}if(S===null){Y=null;return}Y=S;S=1;break;default:S=parseFloat(X.getAttribute(U+"-opacity"));if(isNaN(S))S=1;Y=U==="fill"?"black":"none";Y=X.getAttribute(U)||Y}if(P){g.setColor(U,Y,true);g.setPaintOpacity(U,S,true)}S*=100;this.setPaint(Ia(Y,S,U))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var P=new a.jGraduate.Paint({copy:this.paint});g.setPaint(u,P)}}};c.paintBox.fill=new q("#fill_color","fill");c.paintBox.stroke=
new q("#stroke_color","stroke");c.paintBox.canvas=new q("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);q=c.paintBox.fill.rect.cloneNode(false);q.setAttribute("style","vector-effect:non-scaling-stroke");var H=q.style.vectorEffect==="non-scaling-stroke";q.removeAttribute("style");q=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof q.stdDeviationX==="undefined"&&a("#tool_blur").hide();
a(q).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);s.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))w(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",
function(){if(a("#tool_stroke").hasClass("active"))w(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){w(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");w(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");w(a("#fill_color"))});
a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){R.css("line-height",
R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height"),C=k.val(),D=u.val();if(C!="fit"&&!svgedit.units.isValidUnit("width",C)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);u.parent().addClass("error");return false}u.parent().removeClass("error");if(!g.setResolution(C,D)){a.alert(uiStrings.notification.noContentToFitTo);
C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);
A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k=
[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",
fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},
{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},
{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},

View File

@ -2475,6 +2475,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1),
font-size: 24px;
color: #fff;
margin: 30px 0 0 10px;
white-space: nowrap;
}
#preview_font:after {

View File

@ -1830,6 +1830,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1),
font-size: 24px;
color: #fff;
margin: 30px 0 0 10px;
white-space: nowrap;
}
#preview_font:after {

View File

@ -1544,7 +1544,7 @@
$('#font_family').val(font_family);
$('#font_size').val(elem.getAttribute("font-size"));
$('#text').val(elem.textContent);
$('#preview_font').text(font_family.split(",")[0]).css('font-family', font_family);
$('#preview_font').text(font_family.split(",")[0].replace(/'/g, "")).css('font-family', font_family);
if (svgCanvas.addedNew) {
// Timeout needed for IE9
setTimeout(function() {

View File

@ -387,7 +387,7 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we
.draginput input{border:0;background:transparent;font:24px/normal sans-serif;text-align:center;color:#4f80ff;padding:30px 0 16px;width:100%;height:24px;position:relative;z-index:2}
.draginput.twocol{width:145px}
#tool_font_family .caret{right:10px;top:55%}
#preview_font{font-size:24px;color:#fff;margin:30px 0 0 10px}
#preview_font{font-size:24px;color:#fff;margin:30px 0 0 10px;white-space:nowrap}
#preview_font:after{content:'';position:absolute;right:0;top:3px;bottom:3px;width:40px;border-right:solid #3f3f3c 10px;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjxsaW5lYXJHcmFkaWVudCBpZD0iZzU4MCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIwJSIgeTE9IjAlIiB4Mj0iMTAwJSIgeTI9IjAlIj48c3RvcCBzdG9wLWNvbG9yPSIjM2YzZjNjIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMzZjNmM2MiIG9mZnNldD0iMC43Ii8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c1ODApIiAvPjwvc3ZnPg==)}
.draginput input,.draginput input:hover,.draginput input:active{cursor:url(images/drag.png),move;cursor:-webkit-grab;cursor:-moz-grab}
.draginput.active input,.draginput.active input:hover,.draginput.active input:active{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing}

View File

@ -407,70 +407,71 @@ var aa,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){a
a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(u){P=a("#seg_type");if(D){u.x=svgedit.units.convertUnit(u.x);u.y=svgedit.units.convertUnit(u.y)}a("#path_node_x").val(Math.round(u.x));a("#path_node_y").val(Math.round(u.y));u.type?P.val(u.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}return}D=null;if(ra==="a"){D=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();
D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();
a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0]).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();
a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);
V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<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);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");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("#opac_slider").slider("option","value",D);a("#elem_id").val(X.id)}}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_select").addClass("tool_button_current").removeClass("tool_button");yb("#tool_select","select_node");sa=false;if(u.length)X=
u[0]}else{if(u[0]){C=g.selectorManager.requestSelector(u[0]);C.reset(u[0]);C.selectorRect.setAttribute("display","inline")}yb("#tool_select","select")}za();g.runExtensions("selectedChanged",{elems:u,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,u){var C=g.getMode(),D=u[0];if(D){sa=u.length>=2&&u[1]!=null?u: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:u})}});g.bind("changed",function(k,u){var C=g.getMode();C==="select"&&ba();for(var D=0;D<u.length;++D){var P=u[D];if(P&&P.tagName==="svg")F();else if(P&&X&&X.parentNode==null)X=P}c.show_save_warning=true;za();if(X&&C==="select"){c.paintBox.fill.update();c.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:u})});g.bind("saved",function(k,u){c.show_save_warning=false;u='<?xml version="1.0"?>\n'+u;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,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("<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,u){var C=u.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,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,
u){var C="";if(u){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var D=false,P=false,U=true,S=function(){if(u.callback&&
!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='<div class="tool_button">'+ha.id+"</div>",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ta+=
'<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ta+="</select></label>";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='<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(ta).appendTo(Ra).children();
Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="<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(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa={},ga={},ra=u.svgicons,Oa=
{};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('<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"){ta=a(ab);Ma=ta.parent();
if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+
ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,
isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}ra||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)});qa(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(ra)U=false;a.svgIcons(ra,{w:27,h:27,id_match:false,no_img:!B,fallback:aa,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,u){ya+='<div class="palette_item" style="background-color: '+u+';" data-rgb="'+u+'"></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 u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("<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,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,
D)};a("#palette").mouseover(function(){var k=a('<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"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=
1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;
var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",
function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&
R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",
function(k){top!=self&&!k.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*
100;u=Sa.length;for(E=0;E<u;E++){C=Math.min(u,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")});c.addDropDown=function(k,u,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",u);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,u,C,D){var P=a(k);u=a(u);var U=false,S=D.dropUp;
S&&a(k).addClass("dropup");u.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");u.hide();u.css({top:0,left:0})}U=false});u.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=u.height();Y.left+=8}else Y.top+=a(k).height();a(u).offset(Y);if(P.hasClass("down")){P.removeClass("down");u.hide();u.css({top:0,
left:0})}else{P.addClass("down");u.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&u.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,u=this.options[this.selectedIndex].text;a("#preview_font").html(u).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,u=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;pa="toolbars";R.mousedown(u)}).blur(function(){pa="canvas";R.unbind("mousedown",u);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")},ua=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(),u=(R[0].scrollLeft+R.width()/2)/k-g.contentW;k=(R[0].scrollTop+R.height()/2)/k-g.contentH;g.pasteElements("point",u,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,u){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;u*=C}a("input").blur();g.moveSelectedElements(k,u)}},M=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)},Q=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),u=!k.hasClass("push_button_pressed");u?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(u)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,u){if(!(X==null||sa)){k||(u*=-1);
var C=a("#angle").val()*1+u;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(u){if(u){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;O=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 u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));
T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");R.toggleClass("wireframe");if(!H){var k=
a("#wireframe_rules");k.length?k.empty():a('<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(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);
a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,true):u.clone();C?a(k).find("img").replaceWith(C):
console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+
Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();
var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<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(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":
"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);
g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=
P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;
switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa<ga;aa++){var ra=Y[aa].getAttribute(U);if(aa===0)S=ra;else if(S!==ra){S=null;break}}if(S===null){Y=null;return}Y=S;S=1;break;default:S=parseFloat(X.getAttribute(U+"-opacity"));if(isNaN(S))S=1;Y=U==="fill"?"black":"none";Y=X.getAttribute(U)||Y}if(P){g.setColor(U,Y,true);g.setPaintOpacity(U,S,true)}S*=100;this.setPaint(Ia(Y,S,U))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var P=
new a.jGraduate.Paint({copy:this.paint});g.setPaint(u,P)}}};c.paintBox.fill=new q("#fill_color","fill");c.paintBox.stroke=new q("#stroke_color","stroke");c.paintBox.canvas=new q("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);q=c.paintBox.fill.rect.cloneNode(false);q.setAttribute("style","vector-effect:non-scaling-stroke");var H=q.style.vectorEffect==="non-scaling-stroke";q.removeAttribute("style");q=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"feGaussianBlur");typeof q.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(q).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);s.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))w(a("#fill_color"));else{a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))w(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){w(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");w(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active");w(a("#fill_color"))});a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});
a(window).bind("load resize",function(){R.css("line-height",R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height"),C=k.val(),D=u.val();if(C!="fit"&&!svgedit.units.isValidUnit("width",C)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);u.parent().addClass("error");return false}u.parent().removeClass("error");
if(!g.setResolution(C,D)){a.alert(uiStrings.notification.noContentToFitTo);C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=
Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});
a("input,select").attr("autocomplete","off");var v=function(){var k=[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},
{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?
"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");
g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=
null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<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);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");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("#opac_slider").slider("option","value",D);a("#elem_id").val(X.id)}}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_select").addClass("tool_button_current").removeClass("tool_button");
yb("#tool_select","select_node");sa=false;if(u.length)X=u[0]}else{if(u[0]){C=g.selectorManager.requestSelector(u[0]);C.reset(u[0]);C.selectorRect.setAttribute("display","inline")}yb("#tool_select","select")}za();g.runExtensions("selectedChanged",{elems:u,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,u){var C=g.getMode(),D=u[0];if(D){sa=u.length>=2&&u[1]!=null?u: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:u})}});g.bind("changed",function(k,u){var C=g.getMode();C==="select"&&ba();for(var D=0;D<u.length;++D){var P=u[D];if(P&&P.tagName==="svg")F();else if(P&&X&&X.parentNode==null)X=P}c.show_save_warning=true;za();if(X&&C==="select"){c.paintBox.fill.update();c.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:u})});g.bind("saved",function(k,u){c.show_save_warning=false;u='<?xml version="1.0"?>\n'+u;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,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("<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,
u){var C=u.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,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})});
g.bind("zoomed",W);g.bind("contextset",function(k,u){var C="";if(u){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},
50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='<div class="tool_button">'+ha.id+"</div>",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="<label"+Ta+'><select id="'+
ha.id+'">';a.each(ha.options,function(Xa,cb){ta+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ta+="</select></label>";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='<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(ta).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="<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(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa=
{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('<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"){ta=a(ab);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");
a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+
Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}ra||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)});qa(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(ra)U=false;a.svgIcons(ra,{w:27,h:27,id_match:false,no_img:!B,fallback:aa,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,u){ya+='<div class="palette_item" style="background-color: '+u+';" data-rgb="'+u+'"></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 u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("<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,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?
g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,D)};a("#palette").mouseover(function(){var k=a('<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"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);
if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;
if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;
if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()===
"zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",
function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",
function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;u=Sa.length;for(E=0;E<u;E++){C=Math.min(u,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")});c.addDropDown=function(k,u,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",u);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,u,C,D){var P=a(k);u=a(u);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");u.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");u.hide();u.css({top:0,left:0})}U=false});u.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=u.height();Y.left+=8}else Y.top+=a(k).height();a(u).offset(Y);
if(P.hasClass("down")){P.removeClass("down");u.hide();u.css({top:0,left:0})}else{P.addClass("down");u.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&u.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,u=this.options[this.selectedIndex].text;a("#preview_font").html(u).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,u=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;pa="toolbars";R.mousedown(u)}).blur(function(){pa="canvas";R.unbind("mousedown",u);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")},ua=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(),u=(R[0].scrollLeft+R.width()/2)/k-g.contentW;k=(R[0].scrollTop+R.height()/2)/k-g.contentH;g.pasteElements("point",u,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,u){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;u*=C}a("input").blur();g.moveSelectedElements(k,u)}},M=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)},Q=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),u=!k.hasClass("push_button_pressed");u?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(u)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},
db=function(){g.cycleElement(0)},nb=function(k,u){if(!(X==null||sa)){k||(u*=-1);var C=a("#angle").val()*1+u;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(u){if(u){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;
O=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 u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>
0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");
k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");
R.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<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(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=
fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,
true):u.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*
(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?
k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<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(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+
ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?
a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});
a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",
containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D=
{color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):
C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+
this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa<ga;aa++){var ra=Y[aa].getAttribute(U);if(aa===
0)S=ra;else if(S!==ra){S=null;break}}if(S===null){Y=null;return}Y=S;S=1;break;default:S=parseFloat(X.getAttribute(U+"-opacity"));if(isNaN(S))S=1;Y=U==="fill"?"black":"none";Y=X.getAttribute(U)||Y}if(P){g.setColor(U,Y,true);g.setPaintOpacity(U,S,true)}S*=100;this.setPaint(Ia(Y,S,U))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var P=new a.jGraduate.Paint({copy:this.paint});g.setPaint(u,P)}}};c.paintBox.fill=new q("#fill_color","fill");c.paintBox.stroke=
new q("#stroke_color","stroke");c.paintBox.canvas=new q("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);q=c.paintBox.fill.rect.cloneNode(false);q.setAttribute("style","vector-effect:non-scaling-stroke");var H=q.style.vectorEffect==="non-scaling-stroke";q.removeAttribute("style");q=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof q.stdDeviationX==="undefined"&&a("#tool_blur").hide();
a(q).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);s.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))w(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",
function(){if(a("#tool_stroke").hasClass("active"))w(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){w(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");w(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");w(a("#fill_color"))});
a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){R.css("line-height",
R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height"),C=k.val(),D=u.val();if(C!="fit"&&!svgedit.units.isValidUnit("width",C)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);u.parent().addClass("error");return false}u.parent().removeClass("error");if(!g.setResolution(C,D)){a.alert(uiStrings.notification.noContentToFitTo);
C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);
A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k=
[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",
fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},
{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},
{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},

View File

@ -2475,6 +2475,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1),
font-size: 24px;
color: #fff;
margin: 30px 0 0 10px;
white-space: nowrap;
}
#preview_font:after {