blur cursor now updates, undo enabled for blur

master
Mark MacKay 2012-08-23 05:17:09 -05:00
parent 4d2f536a73
commit 95f54d4034
7 changed files with 177 additions and 159 deletions

View File

@ -154,7 +154,7 @@ $.fn.dragInput = function(cfg){
clearTimeout(window.undoTimeout)
window.undoTimeout = setTimeout(function(){
wheel_input.stop()
},500)
},200)
var wheel_input = this;
if (deltaY > 0)

View File

@ -1360,6 +1360,7 @@
$('#stroke_style').trigger('change');
$.fn.dragInput.updateCursor($('#stroke_width')[0])
$.fn.dragInput.updateCursor($('#blur')[0])
}
}
@ -1703,7 +1704,12 @@
var changeBlur = function(ctl, completed) {
val = ctl.value;
$('#blur').val(val);
svgCanvas.setBlur(val, true);
if (completed) {
svgCanvas.setBlur(val, true);
}
else {
svgCanvas.setBlurNoUndo(val);
}
}
var operaRepaint = function() {
@ -2188,20 +2194,20 @@
var cutSelected = function() {
if (selectedElement != null || multiselected) {
if (window.event && window.event.type === "keydown") flash($('#edit_menu'));
flash($('#edit_menu'));
svgCanvas.cutSelectedElements();
}
};
var copySelected = function() {
if (selectedElement != null || multiselected) {
if (window.event && window.event.type === "keydown") flash($('#edit_menu'));
flash($('#edit_menu'));
svgCanvas.copySelectedElements();
}
};
var pasteSelected = function() {
if (window.event && window.event.type === "keydown") flash($('#edit_menu'));
flash($('#edit_menu'));
var zoom = svgCanvas.getZoom();
var x = (workarea[0].scrollLeft + workarea.width()/2)/zoom - svgCanvas.contentW;
var y = (workarea[0].scrollTop + workarea.height()/2)/zoom - svgCanvas.contentH;
@ -2210,35 +2216,35 @@
var moveToTopSelected = function() {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveToTopSelectedElement();
}
};
var moveToBottomSelected = function() {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveToBottomSelectedElement();
}
};
var moveUpSelected = function() {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveUpDownSelected("Up");
}
};
var moveDownSelected = function() {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveUpDownSelected("Down");
}
};
var moveUpDownSelected = function(dir) {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveUpDownSelected(dir);
}
};
@ -2392,8 +2398,11 @@
var flash = function($menu){
var menu_title = $menu.prev();
menu_title.css("background", "#09f");
setTimeout(function(){menu_title.css("background", "")}, 200);
menu_title.css({
"background": "white",
"color": "black"
});
setTimeout(function(){menu_title.removeAttr("style")}, 200);
}
var clickUndo = function(){

View File

@ -409,9 +409,9 @@ a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathe
100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}I[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");I[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");I.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||I.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);H.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,n){var o=g.getMode();o==="select"&&
oa();if(o==="pathedit")return Ga();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,I=w.length;E<I;E++){var J=
w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Ga();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o);
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null?
n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&oa();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Ga();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",
w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Ga();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);a.fn.dragInput.updateCursor(a("#blur")[0])}if(X!=null){o=(X.getAttribute("opacity")||
1)*100;a("#group_opacity").val(o);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];
if(w){U=n.length>=2&&n[1]!=null?n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&oa();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Ga();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",
{elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var I=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){I+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");E="all"}else a.pref("save_notice_done",
"part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(I)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");S.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+
"\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");S.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la);
@ -439,74 +439,74 @@ o||a("#option_lists").append(E);var I=false;o&&a(k).addClass("dropup");E.find("l
n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!I){E.removeClass("down");n.hide();n.css({top:0,left:0})}I=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down");
n.show();I=true;return false}}).hover(function(){I=true}).mouseout(function(){I=false});w.multiclick&&n.mousedown(function(){I=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).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,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Ea=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&
g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Fa=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type===
"keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},
eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display",
"none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ga()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=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);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},
ca=function(){g.cycleElement(0)},Da=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ga()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Ga();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ga()},Za=function(){g.setItalic(!g.getItalic());Ga()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;
S=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()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>
0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=
n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=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},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=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)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=
ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+
n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),I=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+
O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=I;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=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"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=R=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();
Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var I="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");I+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;I+=Y+":"+V+";"});I+="}"});E="-"+gb.toLowerCase()+"-";I+="#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{"+
E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(I)}pa()}},Ab=function(){a("#dialog_box").hide();if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[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(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke":
"fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w);
g.setPaint(n,w);a("#color_picker").hide()},function(){a("#color_picker").hide()})};c=function(k,n){var o=document.getElementById("canvas_background"),w={color:"fff",opacity:1};if(n=="stroke")w=curConfig.initStroke;if(n=="fill")w=curConfig.initFill;if(n=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))w={color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
w.color+'" opacity="'+w.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(k)[0].appendChild(document.importNode(o,true));n==="canvas"?o.setAttribute("width",60.5):o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:w.color});this.type=n;this.setPaint=function(E,I){this.paint=E;var J="none",O=E.type,Y=E.alpha/100;switch(O){case "solidColor":J=
E[O]=="none"||E[O]=="one"?"none":"#"+E[O];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(E[O]);J="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",J);this.rect.setAttribute("opacity",Y);if(this.type=="canvas")if(O=document.getElementById("canvas_background")){ya=g.getResolution();O.setAttribute("x",-1);O.setAttribute("y",-1);O.setAttribute("width",ya.w+2);O.setAttribute("height",ya.h+2);J.indexOf("url")==
-1&&O.setAttribute("fill",J)}else Ja(J);if(I){g.setColor(this.type,J,true);g.setPaintOpacity(this.type,Y,true)}};this.update=function(E){if(X){var I=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var J=null,O=X.getElementsByTagName("*"),Y=0,da=O.length;Y<da;Y++){var V=O[Y].getAttribute(I);if(Y===0)J=V;else if(J!==V){J=null;break}}if(J===null){O=null;return}O=J;J=1;break;default:J=parseFloat(X.getAttribute(I+"-opacity"));if(isNaN(J))J=1;O=I===
"fill"?"black":"none";O=X.getAttribute(I)||O}if(E){g.setColor(I,O,true);g.setPaintOpacity(I,J,true)}J*=100;this.setPaint(xa(O,J,I))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var E=new a.jGraduate.Paint({copy:this.paint});g.setPaint(n,E)}}};b.paintBox.fill=new c("#fill_color","fill");b.paintBox.stroke=new c("#stroke_color","stroke");b.paintBox.canvas=new c("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*
100);c=b.paintBox.fill.rect.cloneNode(false);c.setAttribute("style","vector-effect:non-scaling-stroke");var h=c.style.vectorEffect==="non-scaling-stroke";c.removeAttribute("style");c=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof c.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(c).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"]);
v.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"))e(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"))e(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
function(){e(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");e(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");e(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(){K.css("line-height",K.height()+"px")});var l=function(){var k=a("#canvas_width"),n=a("#canvas_height"),o=k.val(),w=n.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){a.alert(uiStrings.notification.invalidAttrValGiven);
k.parent().addClass("error");return false}k.parent().removeClass("error");if(w!="fit"&&!svgedit.units.isValidUnit("height",w)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.getResolution();k.val(o.w);n.val(o.h);return false}G()};a("#resolution").change(function(){var k=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
"content"){k.value="fit";n.value="fit";l();var o=g.getResolution();k.value=o.w;n.value=o.h}else{var w=this.value.split("x");w[0]=parseInt(w[0]);w[1]=parseInt(w[1]);var E=w[0]-k.value,I=w[1]-n.value,J=Date.now(),O=function(Y){Y=(Y-J)/1E3;Y=Math.pow(Y-1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-I+Y*I).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+
Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ea,evt:"click",
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Fa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){ea?Kb():g.save({images:v.img_save,round_digits:6})},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},
{sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",
true]},{sel:"#tool_reorient",fn:ob,evt:"click"},{sel:"#tool_node_link",fn:tb,evt:"click"},{sel:"#tool_node_clone",fn:ia,evt:"click"},{sel:"#tool_node_delete",fn:aa,evt:"click"},{sel:"#tool_openclose_path",fn:M,evt:"click"},{sel:"#tool_add_subpath",fn:ka,evt:"click"},{sel:"#tool_move_top",fn:sa,evt:"click",key:u+"shift+up"},{sel:"#tool_move_bottom",fn:hb,evt:"click",key:u+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[u+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[u+"down",
true]},{sel:"#tool_topath",fn:ab,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:pb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Fb,evt:"click",key:[u+"D",true]},{sel:"#tool_group",fn:Bb,evt:"click",key:[u+"G",true]},{sel:"#tool_ungroup",fn:Bb,evt:"click",key:u+"shift+G"},{sel:"#tool_unlink_use",fn:Bb,evt:"click"},{sel:"[id^=tool_align]",fn:bb,evt:"click"},{sel:"#tool_undo",fn:qb,evt:"click",key:u+"z"},{sel:"#tool_redo",fn:rb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:Ua,
evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",key:[u+"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Da(0,1)}},{key:"ctrl+right",fn:function(){Da(1,1)}},{key:"ctrl+shift+left",fn:function(){Da(0,5)}},{key:"ctrl+shift+right",fn:function(){Da(1,
5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,1)}},{key:["left",true],fn:function(){fb(-1,0)}},{key:["right",true],fn:function(){fb(1,0)}},{key:"shift+up",fn:function(){fb(0,-10)}},{key:"shift+down",fn:function(){fb(0,10)}},{key:"shift+left",fn:function(){fb(-10,0)}},{key:"shift+right",fn:function(){fb(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,
-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,
0)}},{key:u+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}g.setMode("eyedropper")}},{key:u+"shift+z",fn:rb},{key:"esc",fn:Ib}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(k,function(w,E){if(E.sel){var I=
a(E.sel);if(I.length==0)return true;if(E.evt){if(svgedit.browser.isTouch()&&E.evt==="click")E.evt="mousedown";I[E.evt](E.fn)}if(E.parent&&a(E.parent+"_show").length!=0){var J=a(E.parent);J.length||(J=na(E.parent.substr(1)));J.append(I);a.isArray(o[E.parent])||(o[E.parent]=[]);o[E.parent].push(E)}}if(E.key){var O=E.fn,Y=false;if(a.isArray(E.key)){J=E.key[0];if(E.key.length>1)Y=E.key[1]}else J=E.key;J+="";svgedit.browser.isMac&&J.indexOf("+")!=-1&&J.split("+")[0]=="ctrl"&&J.replace("ctrl","cmd");a.each(J.split("/"),
function(V,fa){a(document).bind("keydown",fa,function(ha){O();Y&&ha.preventDefault();return false})});if(E.sel&&!E.hidekey&&I.attr("title")){var da=I.attr("title").split("[")[0]+" ("+J+")";n[J]=E.sel;I.parents("#main_menu").length||I.attr("title",da)}}});Z(o);a(window).bind("keydown","tab",function(w){if(N==="canvas"){w.preventDefault();P()}}).bind("keydown","shift+tab",function(w){if(N==="canvas"){w.preventDefault();ca()}});a("#tool_zoom").dblclick(Sa)},setTitles:function(){a.each(n,function(o,w){var E=
a(w).parents("#main_menu").length;a(w).each(function(){var I=E?a(this).text().split(" [")[0]:this.title.split(" [")[0],J="";a.each(o.split("/"),function(O,Y){var da=Y.split("+"),V="";if(da.length>1){V=da[0]+"+";Y=da[1]}J+=(O?"/":"")+V+(uiStrings["key_"+Y]||Y)});if(E)this.lastChild.textContent=I+" ["+J+"]";else this.title=I+" ["+J+"]"})})},getButtonData:function(o){var w;a.each(k,function(E,I){if(I.sel===o)w=I});return w}}}();B.setAll();b.ready(function(){var k=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"),
o=n.find("#tool_"+k);k=n.find("#"+k);(o.length?o:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,
callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,
step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var n=k.value;if(n==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)n=k.value=1;g.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value,true);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",
k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,n){var o=k.value-0,w=o+n,E=w>=o;if(n===0)return o;return o>=24?E?Math.round(o*1.1):Math.round(o/1.1):o<=1?E?o*2:o/2:w},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k){val=k.value;a("#blur").val(val);
g.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":lb();break;case "cut":Ua();break;case "copy":Xa();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":sa();break;case "move_up":ib("Up");break;case "move_down":ib("Down");break;
case "move_back":hb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();H.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(s.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(k){a("#main_menu").hide();
s.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){c=function(k){k.stopPropagation();k.preventDefault();a("#workarea").removeAttr("style");a("#main_menu").hide();var n=null;if(n=k.type=="drop"?k.dataTransfer.files[0]:this.files[0])if(n.type.indexOf("image")!=-1)if(n.type.indexOf("svg")!=-1){k=new FileReader;k.onloadend=function(o){g.importSvgString(o.target.result,true);g.ungroupSelectedElement();g.ungroupSelectedElement();g.groupSelectedElements();
g.alignSelectedElements("m","page");g.alignSelectedElements("c","page")};k.readAsText(n)}else alert("sorry, bitmap import is temporalily disabled")};K=a("#workarea");K[0].addEventListener("dragenter",function(k){k.stopPropagation();k.preventDefault();K.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)","-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);K[0].addEventListener("dragover",function(k){k.stopPropagation();
k.preventDefault()},false);K[0].addEventListener("dragleave",function(k){K.removeAttr("style");k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("drop",c,false);var A=a('<input type="file">').change(function(){var k=this;b.openPrep(function(n){if(n){g.clear();if(k.files.length==1){n=new FileReader;n.onloadend=function(o){q(o.target.result);G()};n.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(A);c=a('<input type="file">').change(c);a("#tool_import").show().prepend(c)}var G=
b.updateCanvas=function(k,n){var o=K.width(),w=K.height(),E=o,I=w,J=g.getZoom(),O=K,Y=a("#svgcanvas"),da={x:O[0].scrollLeft+E/2,y:O[0].scrollTop+I/2},V=curConfig.canvas_expansion;o=Math.max(E,g.contentW*J*V);w=Math.max(I,g.contentH*J*V);o==E&&w==I?K.css("overflow","hidden"):K.css("overflow","scroll");V=Y.height()/2;var fa=Y.width()/2;Y.width(o).height(w);var ha=w/2,W=o/2,qa=g.updateCanvas(o,w),ua=W/fa;o=o/2-E/2;w=w/2-I/2;if(n){n.x+=qa.x;n.y+=qa.y}else n={x:W+(da.x-fa)*ua,y:ha+(da.y-V)*ua};if(k)if(g.contentW>
O.width()){K[0].scrollLeft=qa.x-10;K[0].scrollTop=qa.y-10}else{O[0].scrollLeft=o;O[0].scrollTop=w}else{O[0].scrollLeft=n.x-E/2;O[0].scrollTop=n.y-I/2}if(curConfig.showRulers){E=Y;J=J;document.getElementById("workarea");document.getElementById("title_show");J||(J=g.getZoom());E||(E=a("#svgcanvas"));I=g.getContentElem();O=svgedit.units.getTypeMap()[curConfig.baseUnit];for(Y=0;Y<2;Y++){fa=(da=Y===0)?"x":"y";ua=da?"width":"height";V=I.getAttribute(fa)-0;fa=a("#ruler_"+fa+" canvas:first");$hcanv=fa.clone();
fa.replaceWith($hcanv);o=$hcanv[0];ha=fa=E[ua]()*2;o.parentNode.style[ua]=ha+"px";W=0;var za;qa=o.getContext("2d");qa.fillStyle="rgb(200,0,0)";qa.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(fa>=3E4){var Ba=parseInt(fa/3E4)+1;za=Array(Ba);za[0]=qa;for(w=1;w<Ba;w++){o[ua]=3E4;var Pa=o.cloneNode(true);o.parentNode.appendChild(Pa);za[w]=Pa.getContext("2d")}Pa[ua]=fa%3E4;fa=3E4}o[ua]=fa;ua=O*J;var Qa=50/ua;o=1;for(w=0;w<D.length;w++){o=Ba=D[w];if(Qa<=Ba)break}Qa=o*ua;qa.font="normal 9px 'Lucida Grande', sans-serif";
qa.fillStyle="#777";for(var Na=V/ua%o*ua,jb=Na-Qa;Na<ha;Na+=Qa){jb+=Qa;w=Math.round(Na)+0.5;if(da){qa.moveTo(w,15);qa.lineTo(w,0)}else{qa.moveTo(15,w);qa.lineTo(0,w)}Ba=(jb-V)/ua;if(o>=1)w=Math.round(Ba);else{w=(o+"").split(".")[1].length;w=Ba.toFixed(w)-0}if(w!==0&&w!==1E3&&w%1E3===0)w=w/1E3+"K";if(da){qa.fillText(w,Na+2,8);qa.fillStyle="#777"}else{Ba=(w+"").split("");for(w=0;w<Ba.length;w++){qa.fillText(Ba[w],1,Na+9+w*9);qa.fillStyle="#777"}}Ba=Qa/10;for(w=1;w<10;w++){var ub=Math.round(Na+Ba*w)+
0.5;if(za&&ub>fa){W++;qa.stroke();if(W>=za.length){w=10;Na=ha;continue}qa=za[W];Na-=3E4;ub=Math.round(Na+Ba*w)+0.5}var Cb=w%2?12:10;if(da){qa.moveTo(ub,15);qa.lineTo(ub,Cb)}else{qa.moveTo(15,ub);qa.lineTo(Cb,ub)}}}qa.strokeStyle="#666";qa.stroke()}K.scroll()}},D=[];for(c=0.1;c<1E5;c*=10){D.push(1*c);D.push(2*c);D.push(5*c)}G(true);try{var z=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var n=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k==
"string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(E){return"\\u"+("0000"+E.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var o=0;o<k.length;o++)k[o]=n(k[o]);return"["+k.join(",")+"]"}else{o=[];for(var w in k)o.push(n(w)+":"+n(k[w]));return"{"+o.join(",")+"}"}};window.addEventListener("message",function(k){var n=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+
n+";"+z(eval(k.data)),"*")}catch(o){k.source.postMessage("SVGe"+n+";error:"+o.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=g;g.ready=svgEditor.ready});b.setLang=function(k,n){a.pref("lang",k);a("#lang_select").val(k);if(n){g.runExtensions("langChanged",k);ma();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(o,
w){a(w).attr("title",a(o)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(c){p?c():f.push(c)};b.runCallbacks=function(){a.each(f,function(){this()});p=true};b.loadFromString=function(c){b.ready(function(){q(c)})};b.loadFromURL=function(c,m){m||(m={});var u=m.cache,C=m.callback;b.ready(function(){a.ajax({url:c,dataType:"text",cache:!!u,success:function(s){q(s,C)},error:function(s,L,Q){s.status!=
404&&s.responseText?q(s.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+Q+"",C)}})})};b.loadFromDataURI=function(c){b.ready(function(){var m=c.substring(26);q(svgedit.utilities.decode64(m))})};b.addExtension=function(){var c=arguments;a(function(){g&&g.addExtension.apply(this,c)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Fa=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){Ia(a("#edit_menu"));
var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},eb=function(){if(X!=null){Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){Ia(a("#object_menu"));
g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ga()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||
U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=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);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),
n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},ca=function(){g.cycleElement(0)},Da=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ga()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();
g.setResolution(k[0],k[1]);G(true);yb();Ga();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ga()},Za=function(){g.setItalic(!g.getItalic());Ga()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;S=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()})})},Ra=function(){g.open()},mb=function(){},
Ia=function(k){var n=k.prev();n.css({background:"white",color:"black"});setTimeout(function(){n.removeAttr("style")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));
g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,
true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=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},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=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)},
xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();
ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";
if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),I=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=I;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=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"),
w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=R=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var I="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");I+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=
da[k]||da.all;I+=Y+":"+V+";"});I+="}"});E="-"+gb.toLowerCase()+"-";I+="#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{"+E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(I)}pa()}},Ab=function(){a("#dialog_box").hide();
if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[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(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke":"fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",
containment:"window"}).removeAttr("style").css(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w);g.setPaint(n,w);a("#color_picker").hide()},function(){a("#color_picker").hide()})};c=function(k,n){var o=document.getElementById("canvas_background"),w={color:"fff",opacity:1};if(n=="stroke")w=curConfig.initStroke;if(n=="fill")w=curConfig.initFill;if(n=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))w=
{color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+w.color+'" opacity="'+w.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(k)[0].appendChild(document.importNode(o,true));n==="canvas"?o.setAttribute("width",60.5):
o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:w.color});this.type=n;this.setPaint=function(E,I){this.paint=E;var J="none",O=E.type,Y=E.alpha/100;switch(O){case "solidColor":J=E[O]=="none"||E[O]=="one"?"none":"#"+E[O];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(E[O]);J="url(#"+(this.grad.id="gradbox_"+
this.type)+")"}this.rect.setAttribute("fill",J);this.rect.setAttribute("opacity",Y);if(this.type=="canvas")if(O=document.getElementById("canvas_background")){ya=g.getResolution();O.setAttribute("x",-1);O.setAttribute("y",-1);O.setAttribute("width",ya.w+2);O.setAttribute("height",ya.h+2);J.indexOf("url")==-1&&O.setAttribute("fill",J)}else Ja(J);if(I){g.setColor(this.type,J,true);g.setPaintOpacity(this.type,Y,true)}};this.update=function(E){if(X){var I=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;
case "g":case "a":for(var J=null,O=X.getElementsByTagName("*"),Y=0,da=O.length;Y<da;Y++){var V=O[Y].getAttribute(I);if(Y===0)J=V;else if(J!==V){J=null;break}}if(J===null){O=null;return}O=J;J=1;break;default:J=parseFloat(X.getAttribute(I+"-opacity"));if(isNaN(J))J=1;O=I==="fill"?"black":"none";O=X.getAttribute(I)||O}if(E){g.setColor(I,O,true);g.setPaintOpacity(I,J,true)}J*=100;this.setPaint(xa(O,J,I))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var E=
new a.jGraduate.Paint({copy:this.paint});g.setPaint(n,E)}}};b.paintBox.fill=new c("#fill_color","fill");b.paintBox.stroke=new c("#stroke_color","stroke");b.paintBox.canvas=new c("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);c=b.paintBox.fill.rect.cloneNode(false);c.setAttribute("style","vector-effect:non-scaling-stroke");var h=c.style.vectorEffect==="non-scaling-stroke";c.removeAttribute("style");c=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"feGaussianBlur");typeof c.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(c).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"]);v.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"))e(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"))e(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){e(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");e(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active");e(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(){K.css("line-height",K.height()+"px")});var l=function(){var k=a("#canvas_width"),n=a("#canvas_height"),o=k.val(),w=n.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(w!="fit"&&!svgedit.units.isValidUnit("height",w)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");
if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.getResolution();k.val(o.w);n.val(o.h);return false}G()};a("#resolution").change(function(){var k=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";n.value="fit";l();var o=g.getResolution();k.value=o.w;n.value=o.h}else{var w=this.value.split("x");w[0]=parseInt(w[0]);w[1]=parseInt(w[1]);var E=w[0]-k.value,I=w[1]-n.value,J=Date.now(),O=function(Y){Y=(Y-J)/1E3;Y=Math.pow(Y-
1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-I+Y*I).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});
a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ea,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Fa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},
{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){ea?Kb():g.save({images:v.img_save,round_digits:6})},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},{sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},{sel:"#tool_rulers",
fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:ob,evt:"click"},{sel:"#tool_node_link",fn:tb,evt:"click"},{sel:"#tool_node_clone",fn:ia,evt:"click"},{sel:"#tool_node_delete",fn:aa,evt:"click"},{sel:"#tool_openclose_path",fn:M,evt:"click"},
{sel:"#tool_add_subpath",fn:ka,evt:"click"},{sel:"#tool_move_top",fn:sa,evt:"click",key:u+"shift+up"},{sel:"#tool_move_bottom",fn:hb,evt:"click",key:u+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[u+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[u+"down",true]},{sel:"#tool_topath",fn:ab,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:pb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Fb,evt:"click",key:[u+"D",true]},{sel:"#tool_group",fn:Bb,evt:"click",key:[u+
"G",true]},{sel:"#tool_ungroup",fn:Bb,evt:"click",key:u+"shift+G"},{sel:"#tool_unlink_use",fn:Bb,evt:"click"},{sel:"[id^=tool_align]",fn:bb,evt:"click"},{sel:"#tool_undo",fn:qb,evt:"click",key:u+"z"},{sel:"#tool_redo",fn:rb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:Ua,evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",key:[u+
"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Da(0,1)}},{key:"ctrl+right",fn:function(){Da(1,1)}},{key:"ctrl+shift+left",fn:function(){Da(0,5)}},{key:"ctrl+shift+right",fn:function(){Da(1,5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,1)}},
{key:["left",true],fn:function(){fb(-1,0)}},{key:["right",true],fn:function(){fb(1,0)}},{key:"shift+up",fn:function(){fb(0,-10)}},{key:"shift+down",fn:function(){fb(0,10)}},{key:"shift+left",fn:function(){fb(-10,0)}},{key:"shift+right",fn:function(){fb(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,
0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,0)}},{key:u+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");
a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}g.setMode("eyedropper")}},{key:u+"shift+z",fn:rb},{key:"esc",fn:Ib}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(k,function(w,E){if(E.sel){var I=a(E.sel);if(I.length==0)return true;if(E.evt){if(svgedit.browser.isTouch()&&E.evt==="click")E.evt="mousedown";I[E.evt](E.fn)}if(E.parent&&a(E.parent+"_show").length!=0){var J=a(E.parent);J.length||(J=na(E.parent.substr(1)));
J.append(I);a.isArray(o[E.parent])||(o[E.parent]=[]);o[E.parent].push(E)}}if(E.key){var O=E.fn,Y=false;if(a.isArray(E.key)){J=E.key[0];if(E.key.length>1)Y=E.key[1]}else J=E.key;J+="";svgedit.browser.isMac&&J.indexOf("+")!=-1&&J.split("+")[0]=="ctrl"&&J.replace("ctrl","cmd");a.each(J.split("/"),function(V,fa){a(document).bind("keydown",fa,function(ha){O();Y&&ha.preventDefault();return false})});if(E.sel&&!E.hidekey&&I.attr("title")){var da=I.attr("title").split("[")[0]+" ("+J+")";n[J]=E.sel;I.parents("#main_menu").length||
I.attr("title",da)}}});Z(o);a(window).bind("keydown","tab",function(w){if(N==="canvas"){w.preventDefault();P()}}).bind("keydown","shift+tab",function(w){if(N==="canvas"){w.preventDefault();ca()}});a("#tool_zoom").dblclick(Sa)},setTitles:function(){a.each(n,function(o,w){var E=a(w).parents("#main_menu").length;a(w).each(function(){var I=E?a(this).text().split(" [")[0]:this.title.split(" [")[0],J="";a.each(o.split("/"),function(O,Y){var da=Y.split("+"),V="";if(da.length>1){V=da[0]+"+";Y=da[1]}J+=(O?
"/":"")+V+(uiStrings["key_"+Y]||Y)});if(E)this.lastChild.textContent=I+" ["+J+"]";else this.title=I+" ["+J+"]"})})},getButtonData:function(o){var w;a.each(k,function(E,I){if(I.sel===o)w=I});return w}}}();B.setAll();b.ready(function(){var k=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"),o=n.find("#tool_"+k);k=n.find("#"+k);(o.length?o:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});
a("#canvas_height").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,
step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,
max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var n=k.value;if(n==0&&
X&&["line","polyline"].indexOf(X.nodeName)>=0)n=k.value=1;g.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value,true);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,n){var o=k.value-0,w=o+n,E=w>=o;if(n===0)return o;
return o>=24?E?Math.round(o*1.1):Math.round(o/1.1):o<=1?E?o*2:o/2:w},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k,n){val=k.value;a("#blur").val(val);n?g.setBlur(val,true):g.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":lb();break;case "cut":Ua();
break;case "copy":Xa();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":sa();break;case "move_up":ib("Up");break;case "move_down":ib("Down");break;case "move_back":hb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});
a("#cmenu_canvas li").disableContextMenu();H.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(s.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(k){a("#main_menu").hide();s.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){c=function(k){k.stopPropagation();k.preventDefault();a("#workarea").removeAttr("style");
a("#main_menu").hide();var n=null;if(n=k.type=="drop"?k.dataTransfer.files[0]:this.files[0])if(n.type.indexOf("image")!=-1)if(n.type.indexOf("svg")!=-1){k=new FileReader;k.onloadend=function(o){g.importSvgString(o.target.result,true);g.ungroupSelectedElement();g.ungroupSelectedElement();g.groupSelectedElements();g.alignSelectedElements("m","page");g.alignSelectedElements("c","page")};k.readAsText(n)}else alert("sorry, bitmap import is temporalily disabled")};K=a("#workarea");K[0].addEventListener("dragenter",
function(k){k.stopPropagation();k.preventDefault();K.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)","-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);K[0].addEventListener("dragover",function(k){k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("dragleave",function(k){K.removeAttr("style");k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("drop",c,false);var A=a('<input type="file">').change(function(){var k=
this;b.openPrep(function(n){if(n){g.clear();if(k.files.length==1){n=new FileReader;n.onloadend=function(o){q(o.target.result);G()};n.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(A);c=a('<input type="file">').change(c);a("#tool_import").show().prepend(c)}var G=b.updateCanvas=function(k,n){var o=K.width(),w=K.height(),E=o,I=w,J=g.getZoom(),O=K,Y=a("#svgcanvas"),da={x:O[0].scrollLeft+E/2,y:O[0].scrollTop+I/2},V=curConfig.canvas_expansion;o=Math.max(E,g.contentW*J*V);w=Math.max(I,g.contentH*
J*V);o==E&&w==I?K.css("overflow","hidden"):K.css("overflow","scroll");V=Y.height()/2;var fa=Y.width()/2;Y.width(o).height(w);var ha=w/2,W=o/2,qa=g.updateCanvas(o,w),ua=W/fa;o=o/2-E/2;w=w/2-I/2;if(n){n.x+=qa.x;n.y+=qa.y}else n={x:W+(da.x-fa)*ua,y:ha+(da.y-V)*ua};if(k)if(g.contentW>O.width()){K[0].scrollLeft=qa.x-10;K[0].scrollTop=qa.y-10}else{O[0].scrollLeft=o;O[0].scrollTop=w}else{O[0].scrollLeft=n.x-E/2;O[0].scrollTop=n.y-I/2}if(curConfig.showRulers){E=Y;J=J;document.getElementById("workarea");document.getElementById("title_show");
J||(J=g.getZoom());E||(E=a("#svgcanvas"));I=g.getContentElem();O=svgedit.units.getTypeMap()[curConfig.baseUnit];for(Y=0;Y<2;Y++){fa=(da=Y===0)?"x":"y";ua=da?"width":"height";V=I.getAttribute(fa)-0;fa=a("#ruler_"+fa+" canvas:first");$hcanv=fa.clone();fa.replaceWith($hcanv);o=$hcanv[0];ha=fa=E[ua]()*2;o.parentNode.style[ua]=ha+"px";W=0;var za;qa=o.getContext("2d");qa.fillStyle="rgb(200,0,0)";qa.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(fa>=3E4){var Ba=parseInt(fa/3E4)+1;za=Array(Ba);
za[0]=qa;for(w=1;w<Ba;w++){o[ua]=3E4;var Pa=o.cloneNode(true);o.parentNode.appendChild(Pa);za[w]=Pa.getContext("2d")}Pa[ua]=fa%3E4;fa=3E4}o[ua]=fa;ua=O*J;var Qa=50/ua;o=1;for(w=0;w<D.length;w++){o=Ba=D[w];if(Qa<=Ba)break}Qa=o*ua;qa.font="normal 9px 'Lucida Grande', sans-serif";qa.fillStyle="#777";for(var Na=V/ua%o*ua,jb=Na-Qa;Na<ha;Na+=Qa){jb+=Qa;w=Math.round(Na)+0.5;if(da){qa.moveTo(w,15);qa.lineTo(w,0)}else{qa.moveTo(15,w);qa.lineTo(0,w)}Ba=(jb-V)/ua;if(o>=1)w=Math.round(Ba);else{w=(o+"").split(".")[1].length;
w=Ba.toFixed(w)-0}if(w!==0&&w!==1E3&&w%1E3===0)w=w/1E3+"K";if(da){qa.fillText(w,Na+2,8);qa.fillStyle="#777"}else{Ba=(w+"").split("");for(w=0;w<Ba.length;w++){qa.fillText(Ba[w],1,Na+9+w*9);qa.fillStyle="#777"}}Ba=Qa/10;for(w=1;w<10;w++){var ub=Math.round(Na+Ba*w)+0.5;if(za&&ub>fa){W++;qa.stroke();if(W>=za.length){w=10;Na=ha;continue}qa=za[W];Na-=3E4;ub=Math.round(Na+Ba*w)+0.5}var Cb=w%2?12:10;if(da){qa.moveTo(ub,15);qa.lineTo(ub,Cb)}else{qa.moveTo(15,ub);qa.lineTo(Cb,ub)}}}qa.strokeStyle="#666";qa.stroke()}K.scroll()}},
D=[];for(c=0.1;c<1E5;c*=10){D.push(1*c);D.push(2*c);D.push(5*c)}G(true);try{var z=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var n=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k=="string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(E){return"\\u"+("0000"+E.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var o=
0;o<k.length;o++)k[o]=n(k[o]);return"["+k.join(",")+"]"}else{o=[];for(var w in k)o.push(n(w)+":"+n(k[w]));return"{"+o.join(",")+"}"}};window.addEventListener("message",function(k){var n=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+n+";"+z(eval(k.data)),"*")}catch(o){k.source.postMessage("SVGe"+n+";error:"+o.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=g;g.ready=svgEditor.ready});b.setLang=function(k,n){a.pref("lang",k);a("#lang_select").val(k);
if(n){g.runExtensions("langChanged",k);ma();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(o,w){a(w).attr("title",a(o)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(c){p?c():f.push(c)};b.runCallbacks=function(){a.each(f,function(){this()});
p=true};b.loadFromString=function(c){b.ready(function(){q(c)})};b.loadFromURL=function(c,m){m||(m={});var u=m.cache,C=m.callback;b.ready(function(){a.ajax({url:c,dataType:"text",cache:!!u,success:function(s){q(s,C)},error:function(s,L,Q){s.status!=404&&s.responseText?q(s.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+Q+"",C)}})})};b.loadFromDataURI=function(c){b.ready(function(){var m=c.substring(26);q(svgedit.utilities.decode64(m))})};b.addExtension=function(){var c=arguments;
a(function(){g&&g.addExtension.apply(this,c)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,g=$(this).parent(),b=$(this),p=this.dragCfg.height,v=this.dragCfg.min,d=this.dragCfg.max,f=this.dragCfg.step,c=d-v>0?(d-v)/f:200,m=c/p*f,u=0,C=this.getAttribute("data-attr"),s=svgEditor.canvas,L=svgedit.browser.isTouch(),Q=true,K=c&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(g):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start*-1/m+p);this.adjustValue=
function(H,S){var R;H=parseFloat(H);R=isNaN(this.value)?this.dragCfg.reset:$.isFunction(this.dragCfg.stepfunc)?this.dragCfg.stepfunc(this,H):Number((Number(this.value)+Number(H)).toFixed(5));if(d!==null)R=Math.min(R,d);if(v!==null)R=Math.max(R,v);K&&this.updateCursor(R);this.value=R;g.attr("data-value",R);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,S)};g.toggleClass("draginput",g.is("label"));this.move=function(H,S,R){if(L)H=H.originalEvent.touches[0];if(u===0)u=S;S=(H.pageY-u)*
-1;u=H.pageY;R=S*m*q;this.adjustValue(R.toFixed(f<1?1:0))};this.stop=function(){var H=s.getSelectedElems();$("body").removeClass("dragging");g.removeClass("active");Q=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");u=0;if(H[0]){H=s.undoMgr.finishUndoableChange();H.isEmpty()||s.undoMgr.addCommandToHistory(H)}this.adjustValue(0,Q)};this.updateCursor=function(){var H=parseFloat(this.value)*-1/m+p;K.css("top",H)};this.start=function(H){var S=s.getSelectedElems();
if(L)H=H.originalEvent.touches[0];var R=H.pageY,N=this.value,ga=this;s.undoMgr.beginUndoableChange(C,S);$("body").addClass("dragging");g.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(oa){ga.move(oa,R,parseFloat(N))});$(window).bind("mouseup.draginput touchend.draginput",function(){ga.stop()})};$(this).attr("readonly","readonly").attr("data-scale",m).attr("data-domain",p).attr("data-cursor",K!=false).bind("mousedown touchstart",function(H){this.blur();this.start(H)}).bind("dblclick taphold",
function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(H){switch(H.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(H,S,R,N){S=s.getSelectedElems();Q&&s.undoMgr.beginUndoableChange(C,S);Q=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){ga.stop()},500);var ga=
function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(H){switch(H.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(H,S,R,N){S=s.getSelectedElems();Q&&s.undoMgr.beginUndoableChange(C,S);Q=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){ga.stop()},200);var ga=
this;if(N>0)this.adjustValue(this.dragCfg.step);else N<0&&this.adjustValue(-this.dragCfg.step);H.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),g=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/g+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{};
(function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var q=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var g=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+g+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions=
{}};svgedit.contextmenu.add=function(q){if(q&&q.id&&q.label&&q.action&&typeof q.action=="function")if(q.id in a.contextMenuExtensions)console.error('Cannot add extension "'+q.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+q.id+", label:"+q.label+"}");a.contextMenuExtensions[q.id]=q}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=

View File

@ -409,7 +409,7 @@
<div id="selected_panel" class="context_panel">
<label id="tool_angle" data-title="Change rotation angle" class="draginput">
<input id="angle" class="attr_changer" size="2" value="0" data-min="-180" data-max="180" type="text"/>
<input id="angle" class="attr_changer" size="2" value="0" data-attr="transform" data-min="-180" data-max="180" type="text"/>
<span class="icon_label">Rotation</span>
<div id="tool_angle_indicator">
<div id="tool_angle_indicator_cursor"></div>

View File

@ -154,7 +154,7 @@ $.fn.dragInput = function(cfg){
clearTimeout(window.undoTimeout)
window.undoTimeout = setTimeout(function(){
wheel_input.stop()
},500)
},200)
var wheel_input = this;
if (deltaY > 0)

View File

@ -1360,6 +1360,7 @@
$('#stroke_style').trigger('change');
$.fn.dragInput.updateCursor($('#stroke_width')[0])
$.fn.dragInput.updateCursor($('#blur')[0])
}
}
@ -1703,7 +1704,12 @@
var changeBlur = function(ctl, completed) {
val = ctl.value;
$('#blur').val(val);
svgCanvas.setBlur(val, true);
if (completed) {
svgCanvas.setBlur(val, true);
}
else {
svgCanvas.setBlurNoUndo(val);
}
}
var operaRepaint = function() {
@ -2188,20 +2194,20 @@
var cutSelected = function() {
if (selectedElement != null || multiselected) {
if (window.event && window.event.type === "keydown") flash($('#edit_menu'));
flash($('#edit_menu'));
svgCanvas.cutSelectedElements();
}
};
var copySelected = function() {
if (selectedElement != null || multiselected) {
if (window.event && window.event.type === "keydown") flash($('#edit_menu'));
flash($('#edit_menu'));
svgCanvas.copySelectedElements();
}
};
var pasteSelected = function() {
if (window.event && window.event.type === "keydown") flash($('#edit_menu'));
flash($('#edit_menu'));
var zoom = svgCanvas.getZoom();
var x = (workarea[0].scrollLeft + workarea.width()/2)/zoom - svgCanvas.contentW;
var y = (workarea[0].scrollTop + workarea.height()/2)/zoom - svgCanvas.contentH;
@ -2210,35 +2216,35 @@
var moveToTopSelected = function() {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveToTopSelectedElement();
}
};
var moveToBottomSelected = function() {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveToBottomSelectedElement();
}
};
var moveUpSelected = function() {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveUpDownSelected("Up");
}
};
var moveDownSelected = function() {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveUpDownSelected("Down");
}
};
var moveUpDownSelected = function(dir) {
if (selectedElement != null) {
if (window.event && window.event.type === "keydown") flash($('#object_menu'));
flash($('#object_menu'));
svgCanvas.moveUpDownSelected(dir);
}
};
@ -2392,8 +2398,11 @@
var flash = function($menu){
var menu_title = $menu.prev();
menu_title.css("background", "#09f");
setTimeout(function(){menu_title.css("background", "")}, 200);
menu_title.css({
"background": "white",
"color": "black"
});
setTimeout(function(){menu_title.removeAttr("style")}, 200);
}
var clickUndo = function(){

View File

@ -409,9 +409,9 @@ a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathe
100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}I[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");I[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");I.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||I.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);H.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,n){var o=g.getMode();o==="select"&&
oa();if(o==="pathedit")return Ga();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,I=w.length;E<I;E++){var J=
w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Ga();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o);
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null?
n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&oa();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Ga();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",
w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Ga();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);a.fn.dragInput.updateCursor(a("#blur")[0])}if(X!=null){o=(X.getAttribute("opacity")||
1)*100;a("#group_opacity").val(o);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];
if(w){U=n.length>=2&&n[1]!=null?n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&oa();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Ga();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",
{elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var I=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){I+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");E="all"}else a.pref("save_notice_done",
"part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(I)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");S.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+
"\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");S.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la);
@ -439,74 +439,74 @@ o||a("#option_lists").append(E);var I=false;o&&a(k).addClass("dropup");E.find("l
n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!I){E.removeClass("down");n.hide();n.css({top:0,left:0})}I=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down");
n.show();I=true;return false}}).hover(function(){I=true}).mouseout(function(){I=false});w.multiclick&&n.mousedown(function(){I=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).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,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Ea=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&
g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Fa=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type===
"keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},
eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display",
"none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ga()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=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);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},
ca=function(){g.cycleElement(0)},Da=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ga()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Ga();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ga()},Za=function(){g.setItalic(!g.getItalic());Ga()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;
S=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()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>
0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=
n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=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},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=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)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=
ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+
n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),I=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+
O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=I;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=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"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=R=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();
Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var I="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");I+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;I+=Y+":"+V+";"});I+="}"});E="-"+gb.toLowerCase()+"-";I+="#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{"+
E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(I)}pa()}},Ab=function(){a("#dialog_box").hide();if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[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(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke":
"fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w);
g.setPaint(n,w);a("#color_picker").hide()},function(){a("#color_picker").hide()})};c=function(k,n){var o=document.getElementById("canvas_background"),w={color:"fff",opacity:1};if(n=="stroke")w=curConfig.initStroke;if(n=="fill")w=curConfig.initFill;if(n=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))w={color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
w.color+'" opacity="'+w.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(k)[0].appendChild(document.importNode(o,true));n==="canvas"?o.setAttribute("width",60.5):o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:w.color});this.type=n;this.setPaint=function(E,I){this.paint=E;var J="none",O=E.type,Y=E.alpha/100;switch(O){case "solidColor":J=
E[O]=="none"||E[O]=="one"?"none":"#"+E[O];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(E[O]);J="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",J);this.rect.setAttribute("opacity",Y);if(this.type=="canvas")if(O=document.getElementById("canvas_background")){ya=g.getResolution();O.setAttribute("x",-1);O.setAttribute("y",-1);O.setAttribute("width",ya.w+2);O.setAttribute("height",ya.h+2);J.indexOf("url")==
-1&&O.setAttribute("fill",J)}else Ja(J);if(I){g.setColor(this.type,J,true);g.setPaintOpacity(this.type,Y,true)}};this.update=function(E){if(X){var I=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var J=null,O=X.getElementsByTagName("*"),Y=0,da=O.length;Y<da;Y++){var V=O[Y].getAttribute(I);if(Y===0)J=V;else if(J!==V){J=null;break}}if(J===null){O=null;return}O=J;J=1;break;default:J=parseFloat(X.getAttribute(I+"-opacity"));if(isNaN(J))J=1;O=I===
"fill"?"black":"none";O=X.getAttribute(I)||O}if(E){g.setColor(I,O,true);g.setPaintOpacity(I,J,true)}J*=100;this.setPaint(xa(O,J,I))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var E=new a.jGraduate.Paint({copy:this.paint});g.setPaint(n,E)}}};b.paintBox.fill=new c("#fill_color","fill");b.paintBox.stroke=new c("#stroke_color","stroke");b.paintBox.canvas=new c("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*
100);c=b.paintBox.fill.rect.cloneNode(false);c.setAttribute("style","vector-effect:non-scaling-stroke");var h=c.style.vectorEffect==="non-scaling-stroke";c.removeAttribute("style");c=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof c.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(c).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"]);
v.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"))e(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"))e(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",
function(){e(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");e(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");e(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(){K.css("line-height",K.height()+"px")});var l=function(){var k=a("#canvas_width"),n=a("#canvas_height"),o=k.val(),w=n.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){a.alert(uiStrings.notification.invalidAttrValGiven);
k.parent().addClass("error");return false}k.parent().removeClass("error");if(w!="fit"&&!svgedit.units.isValidUnit("height",w)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.getResolution();k.val(o.w);n.val(o.h);return false}G()};a("#resolution").change(function(){var k=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value==
"content"){k.value="fit";n.value="fit";l();var o=g.getResolution();k.value=o.w;n.value=o.h}else{var w=this.value.split("x");w[0]=parseInt(w[0]);w[1]=parseInt(w[1]);var E=w[0]-k.value,I=w[1]-n.value,J=Date.now(),O=function(Y){Y=(Y-J)/1E3;Y=Math.pow(Y-1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-I+Y*I).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+
Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ea,evt:"click",
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Fa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){ea?Kb():g.save({images:v.img_save,round_digits:6})},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},
{sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",
true]},{sel:"#tool_reorient",fn:ob,evt:"click"},{sel:"#tool_node_link",fn:tb,evt:"click"},{sel:"#tool_node_clone",fn:ia,evt:"click"},{sel:"#tool_node_delete",fn:aa,evt:"click"},{sel:"#tool_openclose_path",fn:M,evt:"click"},{sel:"#tool_add_subpath",fn:ka,evt:"click"},{sel:"#tool_move_top",fn:sa,evt:"click",key:u+"shift+up"},{sel:"#tool_move_bottom",fn:hb,evt:"click",key:u+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[u+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[u+"down",
true]},{sel:"#tool_topath",fn:ab,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:pb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Fb,evt:"click",key:[u+"D",true]},{sel:"#tool_group",fn:Bb,evt:"click",key:[u+"G",true]},{sel:"#tool_ungroup",fn:Bb,evt:"click",key:u+"shift+G"},{sel:"#tool_unlink_use",fn:Bb,evt:"click"},{sel:"[id^=tool_align]",fn:bb,evt:"click"},{sel:"#tool_undo",fn:qb,evt:"click",key:u+"z"},{sel:"#tool_redo",fn:rb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:Ua,
evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",key:[u+"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Da(0,1)}},{key:"ctrl+right",fn:function(){Da(1,1)}},{key:"ctrl+shift+left",fn:function(){Da(0,5)}},{key:"ctrl+shift+right",fn:function(){Da(1,
5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,1)}},{key:["left",true],fn:function(){fb(-1,0)}},{key:["right",true],fn:function(){fb(1,0)}},{key:"shift+up",fn:function(){fb(0,-10)}},{key:"shift+down",fn:function(){fb(0,10)}},{key:"shift+left",fn:function(){fb(-10,0)}},{key:"shift+right",fn:function(){fb(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,
-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,
0)}},{key:u+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}g.setMode("eyedropper")}},{key:u+"shift+z",fn:rb},{key:"esc",fn:Ib}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(k,function(w,E){if(E.sel){var I=
a(E.sel);if(I.length==0)return true;if(E.evt){if(svgedit.browser.isTouch()&&E.evt==="click")E.evt="mousedown";I[E.evt](E.fn)}if(E.parent&&a(E.parent+"_show").length!=0){var J=a(E.parent);J.length||(J=na(E.parent.substr(1)));J.append(I);a.isArray(o[E.parent])||(o[E.parent]=[]);o[E.parent].push(E)}}if(E.key){var O=E.fn,Y=false;if(a.isArray(E.key)){J=E.key[0];if(E.key.length>1)Y=E.key[1]}else J=E.key;J+="";svgedit.browser.isMac&&J.indexOf("+")!=-1&&J.split("+")[0]=="ctrl"&&J.replace("ctrl","cmd");a.each(J.split("/"),
function(V,fa){a(document).bind("keydown",fa,function(ha){O();Y&&ha.preventDefault();return false})});if(E.sel&&!E.hidekey&&I.attr("title")){var da=I.attr("title").split("[")[0]+" ("+J+")";n[J]=E.sel;I.parents("#main_menu").length||I.attr("title",da)}}});Z(o);a(window).bind("keydown","tab",function(w){if(N==="canvas"){w.preventDefault();P()}}).bind("keydown","shift+tab",function(w){if(N==="canvas"){w.preventDefault();ca()}});a("#tool_zoom").dblclick(Sa)},setTitles:function(){a.each(n,function(o,w){var E=
a(w).parents("#main_menu").length;a(w).each(function(){var I=E?a(this).text().split(" [")[0]:this.title.split(" [")[0],J="";a.each(o.split("/"),function(O,Y){var da=Y.split("+"),V="";if(da.length>1){V=da[0]+"+";Y=da[1]}J+=(O?"/":"")+V+(uiStrings["key_"+Y]||Y)});if(E)this.lastChild.textContent=I+" ["+J+"]";else this.title=I+" ["+J+"]"})})},getButtonData:function(o){var w;a.each(k,function(E,I){if(I.sel===o)w=I});return w}}}();B.setAll();b.ready(function(){var k=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"),
o=n.find("#tool_"+k);k=n.find("#"+k);(o.length?o:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,
callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,
step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var n=k.value;if(n==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)n=k.value=1;g.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value,true);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",
k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,n){var o=k.value-0,w=o+n,E=w>=o;if(n===0)return o;return o>=24?E?Math.round(o*1.1):Math.round(o/1.1):o<=1?E?o*2:o/2:w},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k){val=k.value;a("#blur").val(val);
g.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":lb();break;case "cut":Ua();break;case "copy":Xa();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":sa();break;case "move_up":ib("Up");break;case "move_down":ib("Down");break;
case "move_back":hb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();H.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(s.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(k){a("#main_menu").hide();
s.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){c=function(k){k.stopPropagation();k.preventDefault();a("#workarea").removeAttr("style");a("#main_menu").hide();var n=null;if(n=k.type=="drop"?k.dataTransfer.files[0]:this.files[0])if(n.type.indexOf("image")!=-1)if(n.type.indexOf("svg")!=-1){k=new FileReader;k.onloadend=function(o){g.importSvgString(o.target.result,true);g.ungroupSelectedElement();g.ungroupSelectedElement();g.groupSelectedElements();
g.alignSelectedElements("m","page");g.alignSelectedElements("c","page")};k.readAsText(n)}else alert("sorry, bitmap import is temporalily disabled")};K=a("#workarea");K[0].addEventListener("dragenter",function(k){k.stopPropagation();k.preventDefault();K.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)","-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);K[0].addEventListener("dragover",function(k){k.stopPropagation();
k.preventDefault()},false);K[0].addEventListener("dragleave",function(k){K.removeAttr("style");k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("drop",c,false);var A=a('<input type="file">').change(function(){var k=this;b.openPrep(function(n){if(n){g.clear();if(k.files.length==1){n=new FileReader;n.onloadend=function(o){q(o.target.result);G()};n.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(A);c=a('<input type="file">').change(c);a("#tool_import").show().prepend(c)}var G=
b.updateCanvas=function(k,n){var o=K.width(),w=K.height(),E=o,I=w,J=g.getZoom(),O=K,Y=a("#svgcanvas"),da={x:O[0].scrollLeft+E/2,y:O[0].scrollTop+I/2},V=curConfig.canvas_expansion;o=Math.max(E,g.contentW*J*V);w=Math.max(I,g.contentH*J*V);o==E&&w==I?K.css("overflow","hidden"):K.css("overflow","scroll");V=Y.height()/2;var fa=Y.width()/2;Y.width(o).height(w);var ha=w/2,W=o/2,qa=g.updateCanvas(o,w),ua=W/fa;o=o/2-E/2;w=w/2-I/2;if(n){n.x+=qa.x;n.y+=qa.y}else n={x:W+(da.x-fa)*ua,y:ha+(da.y-V)*ua};if(k)if(g.contentW>
O.width()){K[0].scrollLeft=qa.x-10;K[0].scrollTop=qa.y-10}else{O[0].scrollLeft=o;O[0].scrollTop=w}else{O[0].scrollLeft=n.x-E/2;O[0].scrollTop=n.y-I/2}if(curConfig.showRulers){E=Y;J=J;document.getElementById("workarea");document.getElementById("title_show");J||(J=g.getZoom());E||(E=a("#svgcanvas"));I=g.getContentElem();O=svgedit.units.getTypeMap()[curConfig.baseUnit];for(Y=0;Y<2;Y++){fa=(da=Y===0)?"x":"y";ua=da?"width":"height";V=I.getAttribute(fa)-0;fa=a("#ruler_"+fa+" canvas:first");$hcanv=fa.clone();
fa.replaceWith($hcanv);o=$hcanv[0];ha=fa=E[ua]()*2;o.parentNode.style[ua]=ha+"px";W=0;var za;qa=o.getContext("2d");qa.fillStyle="rgb(200,0,0)";qa.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(fa>=3E4){var Ba=parseInt(fa/3E4)+1;za=Array(Ba);za[0]=qa;for(w=1;w<Ba;w++){o[ua]=3E4;var Pa=o.cloneNode(true);o.parentNode.appendChild(Pa);za[w]=Pa.getContext("2d")}Pa[ua]=fa%3E4;fa=3E4}o[ua]=fa;ua=O*J;var Qa=50/ua;o=1;for(w=0;w<D.length;w++){o=Ba=D[w];if(Qa<=Ba)break}Qa=o*ua;qa.font="normal 9px 'Lucida Grande', sans-serif";
qa.fillStyle="#777";for(var Na=V/ua%o*ua,jb=Na-Qa;Na<ha;Na+=Qa){jb+=Qa;w=Math.round(Na)+0.5;if(da){qa.moveTo(w,15);qa.lineTo(w,0)}else{qa.moveTo(15,w);qa.lineTo(0,w)}Ba=(jb-V)/ua;if(o>=1)w=Math.round(Ba);else{w=(o+"").split(".")[1].length;w=Ba.toFixed(w)-0}if(w!==0&&w!==1E3&&w%1E3===0)w=w/1E3+"K";if(da){qa.fillText(w,Na+2,8);qa.fillStyle="#777"}else{Ba=(w+"").split("");for(w=0;w<Ba.length;w++){qa.fillText(Ba[w],1,Na+9+w*9);qa.fillStyle="#777"}}Ba=Qa/10;for(w=1;w<10;w++){var ub=Math.round(Na+Ba*w)+
0.5;if(za&&ub>fa){W++;qa.stroke();if(W>=za.length){w=10;Na=ha;continue}qa=za[W];Na-=3E4;ub=Math.round(Na+Ba*w)+0.5}var Cb=w%2?12:10;if(da){qa.moveTo(ub,15);qa.lineTo(ub,Cb)}else{qa.moveTo(15,ub);qa.lineTo(Cb,ub)}}}qa.strokeStyle="#666";qa.stroke()}K.scroll()}},D=[];for(c=0.1;c<1E5;c*=10){D.push(1*c);D.push(2*c);D.push(5*c)}G(true);try{var z=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var n=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k==
"string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(E){return"\\u"+("0000"+E.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var o=0;o<k.length;o++)k[o]=n(k[o]);return"["+k.join(",")+"]"}else{o=[];for(var w in k)o.push(n(w)+":"+n(k[w]));return"{"+o.join(",")+"}"}};window.addEventListener("message",function(k){var n=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+
n+";"+z(eval(k.data)),"*")}catch(o){k.source.postMessage("SVGe"+n+";error:"+o.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=g;g.ready=svgEditor.ready});b.setLang=function(k,n){a.pref("lang",k);a("#lang_select").val(k);if(n){g.runExtensions("langChanged",k);ma();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(o,
w){a(w).attr("title",a(o)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(c){p?c():f.push(c)};b.runCallbacks=function(){a.each(f,function(){this()});p=true};b.loadFromString=function(c){b.ready(function(){q(c)})};b.loadFromURL=function(c,m){m||(m={});var u=m.cache,C=m.callback;b.ready(function(){a.ajax({url:c,dataType:"text",cache:!!u,success:function(s){q(s,C)},error:function(s,L,Q){s.status!=
404&&s.responseText?q(s.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+Q+"",C)}})})};b.loadFromDataURI=function(c){b.ready(function(){var m=c.substring(26);q(svgedit.utilities.decode64(m))})};b.addExtension=function(){var c=arguments;a(function(){g&&g.addExtension.apply(this,c)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Fa=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){Ia(a("#edit_menu"));
var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},eb=function(){if(X!=null){Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){Ia(a("#object_menu"));
g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ga()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||
U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=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);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),
n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},ca=function(){g.cycleElement(0)},Da=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ga()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();
g.setResolution(k[0],k[1]);G(true);yb();Ga();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ga()},Za=function(){g.setItalic(!g.getItalic());Ga()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;S=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()})})},Ra=function(){g.open()},mb=function(){},
Ia=function(k){var n=k.prev();n.css({background:"white",color:"black"});setTimeout(function(){n.removeAttr("style")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));
g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,
true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=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},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=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)},
xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();
ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";
if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),I=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=I;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=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"),
w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=R=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var I="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");I+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=
da[k]||da.all;I+=Y+":"+V+";"});I+="}"});E="-"+gb.toLowerCase()+"-";I+="#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{"+E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(I)}pa()}},Ab=function(){a("#dialog_box").hide();
if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[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(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke":"fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",
containment:"window"}).removeAttr("style").css(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w);g.setPaint(n,w);a("#color_picker").hide()},function(){a("#color_picker").hide()})};c=function(k,n){var o=document.getElementById("canvas_background"),w={color:"fff",opacity:1};if(n=="stroke")w=curConfig.initStroke;if(n=="fill")w=curConfig.initFill;if(n=="canvas"&&o)if(o=o.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))w=
{color:("0"+parseInt(o[1],10).toString(16)).slice(-2)+("0"+parseInt(o[2],10).toString(16)).slice(-2)+("0"+parseInt(o[3],10).toString(16)).slice(-2),opacity:1};o=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+w.color+'" opacity="'+w.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;o=a(k)[0].appendChild(document.importNode(o,true));n==="canvas"?o.setAttribute("width",60.5):
o.setAttribute("width","100%");this.rect=o.firstChild;this.defs=o.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:w.color});this.type=n;this.setPaint=function(E,I){this.paint=E;var J="none",O=E.type,Y=E.alpha/100;switch(O){case "solidColor":J=E[O]=="none"||E[O]=="one"?"none":"#"+E[O];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(E[O]);J="url(#"+(this.grad.id="gradbox_"+
this.type)+")"}this.rect.setAttribute("fill",J);this.rect.setAttribute("opacity",Y);if(this.type=="canvas")if(O=document.getElementById("canvas_background")){ya=g.getResolution();O.setAttribute("x",-1);O.setAttribute("y",-1);O.setAttribute("width",ya.w+2);O.setAttribute("height",ya.h+2);J.indexOf("url")==-1&&O.setAttribute("fill",J)}else Ja(J);if(I){g.setColor(this.type,J,true);g.setPaintOpacity(this.type,Y,true)}};this.update=function(E){if(X){var I=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;
case "g":case "a":for(var J=null,O=X.getElementsByTagName("*"),Y=0,da=O.length;Y<da;Y++){var V=O[Y].getAttribute(I);if(Y===0)J=V;else if(J!==V){J=null;break}}if(J===null){O=null;return}O=J;J=1;break;default:J=parseFloat(X.getAttribute(I+"-opacity"));if(isNaN(J))J=1;O=I==="fill"?"black":"none";O=X.getAttribute(I)||O}if(E){g.setColor(I,O,true);g.setPaintOpacity(I,J,true)}J*=100;this.setPaint(xa(O,J,I))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var E=
new a.jGraduate.Paint({copy:this.paint});g.setPaint(n,E)}}};b.paintBox.fill=new c("#fill_color","fill");b.paintBox.stroke=new c("#stroke_color","stroke");b.paintBox.canvas=new c("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);c=b.paintBox.fill.rect.cloneNode(false);c.setAttribute("style","vector-effect:non-scaling-stroke");var h=c.style.vectorEffect==="non-scaling-stroke";c.removeAttribute("style");c=b.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"feGaussianBlur");typeof c.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(c).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"]);v.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"))e(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"))e(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){e(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");e(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active");e(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(){K.css("line-height",K.height()+"px")});var l=function(){var k=a("#canvas_width"),n=a("#canvas_height"),o=k.val(),w=n.val();if(o!="fit"&&!svgedit.units.isValidUnit("width",o)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(w!="fit"&&!svgedit.units.isValidUnit("height",w)){a.alert(uiStrings.notification.invalidAttrValGiven);n.parent().addClass("error");return false}n.parent().removeClass("error");
if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.getResolution();k.val(o.w);n.val(o.h);return false}G()};a("#resolution").change(function(){var k=a("#canvas_width")[0],n=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";n.value="fit";l();var o=g.getResolution();k.value=o.w;n.value=o.h}else{var w=this.value.split("x");w[0]=parseInt(w[0]);w[1]=parseInt(w[1]);var E=w[0]-k.value,I=w[1]-n.value,J=Date.now(),O=function(Y){Y=(Y-J)/1E3;Y=Math.pow(Y-
1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-I+Y*I).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});
a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ea,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Fa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},
{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){ea?Kb():g.save({images:v.img_save,round_digits:6})},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},{sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},{sel:"#tool_rulers",
fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:ob,evt:"click"},{sel:"#tool_node_link",fn:tb,evt:"click"},{sel:"#tool_node_clone",fn:ia,evt:"click"},{sel:"#tool_node_delete",fn:aa,evt:"click"},{sel:"#tool_openclose_path",fn:M,evt:"click"},
{sel:"#tool_add_subpath",fn:ka,evt:"click"},{sel:"#tool_move_top",fn:sa,evt:"click",key:u+"shift+up"},{sel:"#tool_move_bottom",fn:hb,evt:"click",key:u+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[u+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[u+"down",true]},{sel:"#tool_topath",fn:ab,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:pb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Fb,evt:"click",key:[u+"D",true]},{sel:"#tool_group",fn:Bb,evt:"click",key:[u+
"G",true]},{sel:"#tool_ungroup",fn:Bb,evt:"click",key:u+"shift+G"},{sel:"#tool_unlink_use",fn:Bb,evt:"click"},{sel:"[id^=tool_align]",fn:bb,evt:"click"},{sel:"#tool_undo",fn:qb,evt:"click",key:u+"z"},{sel:"#tool_redo",fn:rb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:Ua,evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",key:[u+
"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Da(0,1)}},{key:"ctrl+right",fn:function(){Da(1,1)}},{key:"ctrl+shift+left",fn:function(){Da(0,5)}},{key:"ctrl+shift+right",fn:function(){Da(1,5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,1)}},
{key:["left",true],fn:function(){fb(-1,0)}},{key:["right",true],fn:function(){fb(1,0)}},{key:"shift+up",fn:function(){fb(0,-10)}},{key:"shift+down",fn:function(){fb(0,10)}},{key:"shift+left",fn:function(){fb(-10,0)}},{key:"shift+right",fn:function(){fb(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,
0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,0)}},{key:u+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:"I",fn:function(){var o=a(".tool_button_current");if(o.length&&o[0].id!=="tool_eyedropper"){o.removeClass("tool_button_current").addClass("tool_button");
a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}g.setMode("eyedropper")}},{key:u+"shift+z",fn:rb},{key:"esc",fn:Ib}],n={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var o={};a.each(k,function(w,E){if(E.sel){var I=a(E.sel);if(I.length==0)return true;if(E.evt){if(svgedit.browser.isTouch()&&E.evt==="click")E.evt="mousedown";I[E.evt](E.fn)}if(E.parent&&a(E.parent+"_show").length!=0){var J=a(E.parent);J.length||(J=na(E.parent.substr(1)));
J.append(I);a.isArray(o[E.parent])||(o[E.parent]=[]);o[E.parent].push(E)}}if(E.key){var O=E.fn,Y=false;if(a.isArray(E.key)){J=E.key[0];if(E.key.length>1)Y=E.key[1]}else J=E.key;J+="";svgedit.browser.isMac&&J.indexOf("+")!=-1&&J.split("+")[0]=="ctrl"&&J.replace("ctrl","cmd");a.each(J.split("/"),function(V,fa){a(document).bind("keydown",fa,function(ha){O();Y&&ha.preventDefault();return false})});if(E.sel&&!E.hidekey&&I.attr("title")){var da=I.attr("title").split("[")[0]+" ("+J+")";n[J]=E.sel;I.parents("#main_menu").length||
I.attr("title",da)}}});Z(o);a(window).bind("keydown","tab",function(w){if(N==="canvas"){w.preventDefault();P()}}).bind("keydown","shift+tab",function(w){if(N==="canvas"){w.preventDefault();ca()}});a("#tool_zoom").dblclick(Sa)},setTitles:function(){a.each(n,function(o,w){var E=a(w).parents("#main_menu").length;a(w).each(function(){var I=E?a(this).text().split(" [")[0]:this.title.split(" [")[0],J="";a.each(o.split("/"),function(O,Y){var da=Y.split("+"),V="";if(da.length>1){V=da[0]+"+";Y=da[1]}J+=(O?
"/":"")+V+(uiStrings["key_"+Y]||Y)});if(E)this.lastChild.textContent=I+" ["+J+"]";else this.title=I+" ["+J+"]"})})},getButtonData:function(o){var w;a.each(k,function(E,I){if(I.sel===o)w=I});return w}}}();B.setAll();b.ready(function(){var k=curConfig.initTool,n=a("#tools_left, #svg_editor .tools_flyout"),o=n.find("#tool_"+k);k=n.find("#"+k);(o.length?o:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});
a("#canvas_height").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:l,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,
step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,
max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var n=k.value;if(n==0&&
X&&["line","polyline"].indexOf(X.nodeName)>=0)n=k.value=1;g.setStrokeWidth(n)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value,true);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,n){var o=k.value-0,w=o+n,E=w>=o;if(n===0)return o;
return o>=24?E?Math.round(o*1.1):Math.round(o/1.1):o<=1?E?o*2:o/2:w},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k,n){val=k.value;a("#blur").val(val);n?g.setBlur(val,true):g.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":lb();break;case "cut":Ua();
break;case "copy":Xa();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":sa();break;case "move_up":ib("Up");break;case "move_down":ib("Down");break;case "move_back":hb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});
a("#cmenu_canvas li").disableContextMenu();H.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(s.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(k){a("#main_menu").hide();s.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){c=function(k){k.stopPropagation();k.preventDefault();a("#workarea").removeAttr("style");
a("#main_menu").hide();var n=null;if(n=k.type=="drop"?k.dataTransfer.files[0]:this.files[0])if(n.type.indexOf("image")!=-1)if(n.type.indexOf("svg")!=-1){k=new FileReader;k.onloadend=function(o){g.importSvgString(o.target.result,true);g.ungroupSelectedElement();g.ungroupSelectedElement();g.groupSelectedElements();g.alignSelectedElements("m","page");g.alignSelectedElements("c","page")};k.readAsText(n)}else alert("sorry, bitmap import is temporalily disabled")};K=a("#workarea");K[0].addEventListener("dragenter",
function(k){k.stopPropagation();k.preventDefault();K.css({"-webkit-transform":"scale3d(1.1,1.1,1)","-moz-transform":"scale3d(1.1,1.1,1)","-o-transform":"scale(1.1)","-ms-transform":"scale3d(1.1,1.1,1)",transform:"scale3d(1.1,1.1,1)"})},false);K[0].addEventListener("dragover",function(k){k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("dragleave",function(k){K.removeAttr("style");k.stopPropagation();k.preventDefault()},false);K[0].addEventListener("drop",c,false);var A=a('<input type="file">').change(function(){var k=
this;b.openPrep(function(n){if(n){g.clear();if(k.files.length==1){n=new FileReader;n.onloadend=function(o){q(o.target.result);G()};n.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(A);c=a('<input type="file">').change(c);a("#tool_import").show().prepend(c)}var G=b.updateCanvas=function(k,n){var o=K.width(),w=K.height(),E=o,I=w,J=g.getZoom(),O=K,Y=a("#svgcanvas"),da={x:O[0].scrollLeft+E/2,y:O[0].scrollTop+I/2},V=curConfig.canvas_expansion;o=Math.max(E,g.contentW*J*V);w=Math.max(I,g.contentH*
J*V);o==E&&w==I?K.css("overflow","hidden"):K.css("overflow","scroll");V=Y.height()/2;var fa=Y.width()/2;Y.width(o).height(w);var ha=w/2,W=o/2,qa=g.updateCanvas(o,w),ua=W/fa;o=o/2-E/2;w=w/2-I/2;if(n){n.x+=qa.x;n.y+=qa.y}else n={x:W+(da.x-fa)*ua,y:ha+(da.y-V)*ua};if(k)if(g.contentW>O.width()){K[0].scrollLeft=qa.x-10;K[0].scrollTop=qa.y-10}else{O[0].scrollLeft=o;O[0].scrollTop=w}else{O[0].scrollLeft=n.x-E/2;O[0].scrollTop=n.y-I/2}if(curConfig.showRulers){E=Y;J=J;document.getElementById("workarea");document.getElementById("title_show");
J||(J=g.getZoom());E||(E=a("#svgcanvas"));I=g.getContentElem();O=svgedit.units.getTypeMap()[curConfig.baseUnit];for(Y=0;Y<2;Y++){fa=(da=Y===0)?"x":"y";ua=da?"width":"height";V=I.getAttribute(fa)-0;fa=a("#ruler_"+fa+" canvas:first");$hcanv=fa.clone();fa.replaceWith($hcanv);o=$hcanv[0];ha=fa=E[ua]()*2;o.parentNode.style[ua]=ha+"px";W=0;var za;qa=o.getContext("2d");qa.fillStyle="rgb(200,0,0)";qa.fillRect(0,0,o.width,o.height);$hcanv.siblings().remove();if(fa>=3E4){var Ba=parseInt(fa/3E4)+1;za=Array(Ba);
za[0]=qa;for(w=1;w<Ba;w++){o[ua]=3E4;var Pa=o.cloneNode(true);o.parentNode.appendChild(Pa);za[w]=Pa.getContext("2d")}Pa[ua]=fa%3E4;fa=3E4}o[ua]=fa;ua=O*J;var Qa=50/ua;o=1;for(w=0;w<D.length;w++){o=Ba=D[w];if(Qa<=Ba)break}Qa=o*ua;qa.font="normal 9px 'Lucida Grande', sans-serif";qa.fillStyle="#777";for(var Na=V/ua%o*ua,jb=Na-Qa;Na<ha;Na+=Qa){jb+=Qa;w=Math.round(Na)+0.5;if(da){qa.moveTo(w,15);qa.lineTo(w,0)}else{qa.moveTo(15,w);qa.lineTo(0,w)}Ba=(jb-V)/ua;if(o>=1)w=Math.round(Ba);else{w=(o+"").split(".")[1].length;
w=Ba.toFixed(w)-0}if(w!==0&&w!==1E3&&w%1E3===0)w=w/1E3+"K";if(da){qa.fillText(w,Na+2,8);qa.fillStyle="#777"}else{Ba=(w+"").split("");for(w=0;w<Ba.length;w++){qa.fillText(Ba[w],1,Na+9+w*9);qa.fillStyle="#777"}}Ba=Qa/10;for(w=1;w<10;w++){var ub=Math.round(Na+Ba*w)+0.5;if(za&&ub>fa){W++;qa.stroke();if(W>=za.length){w=10;Na=ha;continue}qa=za[W];Na-=3E4;ub=Math.round(Na+Ba*w)+0.5}var Cb=w%2?12:10;if(da){qa.moveTo(ub,15);qa.lineTo(ub,Cb)}else{qa.moveTo(15,ub);qa.lineTo(Cb,ub)}}}qa.strokeStyle="#666";qa.stroke()}K.scroll()}},
D=[];for(c=0.1;c<1E5;c*=10){D.push(1*c);D.push(2*c);D.push(5*c)}G(true);try{var z=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var n=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k=="string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(E){return"\\u"+("0000"+E.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var o=
0;o<k.length;o++)k[o]=n(k[o]);return"["+k.join(",")+"]"}else{o=[];for(var w in k)o.push(n(w)+":"+n(k[w]));return"{"+o.join(",")+"}"}};window.addEventListener("message",function(k){var n=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+n+";"+z(eval(k.data)),"*")}catch(o){k.source.postMessage("SVGe"+n+";error:"+o.message,"*")}},false)}catch(F){window.embed_error=F}a(function(){window.svgCanvas=g;g.ready=svgEditor.ready});b.setLang=function(k,n){a.pref("lang",k);a("#lang_select").val(k);
if(n){g.runExtensions("langChanged",k);ma();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(o,w){a(w).attr("title",a(o)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var f=[];b.ready=function(c){p?c():f.push(c)};b.runCallbacks=function(){a.each(f,function(){this()});
p=true};b.loadFromString=function(c){b.ready(function(){q(c)})};b.loadFromURL=function(c,m){m||(m={});var u=m.cache,C=m.callback;b.ready(function(){a.ajax({url:c,dataType:"text",cache:!!u,success:function(s){q(s,C)},error:function(s,L,Q){s.status!=404&&s.responseText?q(s.responseText,C):a.alert(uiStrings.notification.URLloadFail+": \n"+Q+"",C)}})})};b.loadFromDataURI=function(c){b.ready(function(){var m=c.substring(26);q(svgedit.utilities.decode64(m))})};b.addExtension=function(){var c=arguments;
a(function(){g&&g.addExtension.apply(this,c)})};return b}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
a&&a.smallStep?a.smallStep:this.dragCfg.step/2;var q=this.dragCfg.dragAdjust,g=$(this).parent(),b=$(this),p=this.dragCfg.height,v=this.dragCfg.min,d=this.dragCfg.max,f=this.dragCfg.step,c=d-v>0?(d-v)/f:200,m=c/p*f,u=0,C=this.getAttribute("data-attr"),s=svgEditor.canvas,L=svgedit.browser.isTouch(),Q=true,K=c&&this.dragCfg.cursor?$("<div class='draginput_cursor' />").appendTo(g):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start*-1/m+p);this.adjustValue=
function(H,S){var R;H=parseFloat(H);R=isNaN(this.value)?this.dragCfg.reset:$.isFunction(this.dragCfg.stepfunc)?this.dragCfg.stepfunc(this,H):Number((Number(this.value)+Number(H)).toFixed(5));if(d!==null)R=Math.min(R,d);if(v!==null)R=Math.max(R,v);K&&this.updateCursor(R);this.value=R;g.attr("data-value",R);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,S)};g.toggleClass("draginput",g.is("label"));this.move=function(H,S,R){if(L)H=H.originalEvent.touches[0];if(u===0)u=S;S=(H.pageY-u)*
-1;u=H.pageY;R=S*m*q;this.adjustValue(R.toFixed(f<1?1:0))};this.stop=function(){var H=s.getSelectedElems();$("body").removeClass("dragging");g.removeClass("active");Q=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");u=0;if(H[0]){H=s.undoMgr.finishUndoableChange();H.isEmpty()||s.undoMgr.addCommandToHistory(H)}this.adjustValue(0,Q)};this.updateCursor=function(){var H=parseFloat(this.value)*-1/m+p;K.css("top",H)};this.start=function(H){var S=s.getSelectedElems();
if(L)H=H.originalEvent.touches[0];var R=H.pageY,N=this.value,ga=this;s.undoMgr.beginUndoableChange(C,S);$("body").addClass("dragging");g.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(oa){ga.move(oa,R,parseFloat(N))});$(window).bind("mouseup.draginput touchend.draginput",function(){ga.stop()})};$(this).attr("readonly","readonly").attr("data-scale",m).attr("data-domain",p).attr("data-cursor",K!=false).bind("mousedown touchstart",function(H){this.blur();this.start(H)}).bind("dblclick taphold",
function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(H){switch(H.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(H,S,R,N){S=s.getSelectedElems();Q&&s.undoMgr.beginUndoableChange(C,S);Q=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){ga.stop()},500);var ga=
function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(H){switch(H.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(H,S,R,N){S=s.getSelectedElems();Q&&s.undoMgr.beginUndoableChange(C,S);Q=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){ga.stop()},200);var ga=
this;if(N>0)this.adjustValue(this.dragCfg.step);else N<0&&this.adjustValue(-this.dragCfg.step);H.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),g=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/g+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{};
(function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var q=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var g=q.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+q.id+"'>"+q.label+"<span class='shortcut'>"+g+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions=
{}};svgedit.contextmenu.add=function(q){if(q&&q.id&&q.label&&q.action&&typeof q.action=="function")if(q.id in a.contextMenuExtensions)console.error('Cannot add extension "'+q.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+q.id+", label:"+q.label+"}");a.contextMenuExtensions[q.id]=q}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=