From 8cc00ebf03e50f271a6060ffdb9cb871fe3ff0e6 Mon Sep 17 00:00:00 2001 From: Mark MacKay Date: Thu, 26 Jul 2012 11:03:39 -0500 Subject: [PATCH] text sill peeks out of the box --- editor/svg-editor.css | 1 + editor/svg-editor.js | 2 +- editor/svgedit.compiled.css | 2 +- editor/svgedit.compiled.js | 129 ++++++++++++++++--------------- editor/temp.css | 1 + method-draw/svg-editor.css | 1 + method-draw/svg-editor.js | 2 +- method-draw/svgedit.compiled.css | 2 +- method-draw/svgedit.compiled.js | 129 ++++++++++++++++--------------- method-draw/temp.css | 1 + 10 files changed, 138 insertions(+), 132 deletions(-) diff --git a/editor/svg-editor.css b/editor/svg-editor.css index e98bfe0..f14b92c 100644 --- a/editor/svg-editor.css +++ b/editor/svg-editor.css @@ -1830,6 +1830,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), font-size: 24px; color: #fff; margin: 30px 0 0 10px; + white-space: nowrap; } #preview_font:after { diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 73bbe92..d682821 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -1544,7 +1544,7 @@ $('#font_family').val(font_family); $('#font_size').val(elem.getAttribute("font-size")); $('#text').val(elem.textContent); - $('#preview_font').text(font_family.split(",")[0]).css('font-family', font_family); + $('#preview_font').text(font_family.split(",")[0].replace(/'/g, "")).css('font-family', font_family); if (svgCanvas.addedNew) { // Timeout needed for IE9 setTimeout(function() { diff --git a/editor/svgedit.compiled.css b/editor/svgedit.compiled.css index 588d7cc..2e1efc8 100644 --- a/editor/svgedit.compiled.css +++ b/editor/svgedit.compiled.css @@ -387,7 +387,7 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we .draginput input{border:0;background:transparent;font:24px/normal sans-serif;text-align:center;color:#4f80ff;padding:30px 0 16px;width:100%;height:24px;position:relative;z-index:2} .draginput.twocol{width:145px} #tool_font_family .caret{right:10px;top:55%} -#preview_font{font-size:24px;color:#fff;margin:30px 0 0 10px} +#preview_font{font-size:24px;color:#fff;margin:30px 0 0 10px;white-space:nowrap} #preview_font:after{content:'';position:absolute;right:0;top:3px;bottom:3px;width:40px;border-right:solid #3f3f3c 10px;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjxsaW5lYXJHcmFkaWVudCBpZD0iZzU4MCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIwJSIgeTE9IjAlIiB4Mj0iMTAwJSIgeTI9IjAlIj48c3RvcCBzdG9wLWNvbG9yPSIjM2YzZjNjIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMzZjNmM2MiIG9mZnNldD0iMC43Ii8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c1ODApIiAvPjwvc3ZnPg==)} .draginput input,.draginput input:hover,.draginput input:active{cursor:url(images/drag.png),move;cursor:-webkit-grab;cursor:-moz-grab} .draginput.active input,.draginput.active input:hover,.draginput.active input:active{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing} diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 9369ce1..20b3446 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -407,70 +407,71 @@ var aa,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){a a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(u){P=a("#seg_type");if(D){u.x=svgedit.units.convertUnit(u.x);u.y=svgedit.units.convertUnit(u.y)}a("#path_node_x").val(Math.round(u.x));a("#path_node_y").val(Math.round(u.y));u.type?P.val(u.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}return}D=null;if(ra==="a"){D=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show(); D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide(); a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active", -g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0]).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show(); -a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u); -V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=null,P=X.getElementsByTagName("*"),U=0,S=P.length;U=2&&u[1]!=null?u:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(D);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition", -{elems:u})}});g.bind("changed",function(k,u){var C=g.getMode();C==="select"&&ba();for(var D=0;D\n'+u;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0, -true);else{var D=k.open("data:image/svg+xml;base64,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("", -{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k, -u){var C="";if(u){var D="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > '+this.id+"":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var D=false,P=false,U=true,S=function(){if(u.callback&& -!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("
",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='
'+ha.id+"
",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='';Ta=a('
    ').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ta).appendTo(Ra).children(); -Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="'+ha.label+':';var ab=a(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa={},ga={},ra=u.svgicons,Oa= -{};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("
    ",{id:ha.panel}).appendTo("#tools_top"); -break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
    ",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"
  • ":"
    ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ta=a(ab);Ma=ta.parent(); -if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("
    ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ -ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("
    ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key, -isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
    '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k, -"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("

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

    "+k+"

    ")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu")); -T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity")); -if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");R.toggleClass("wireframe");if(!H){var k= -a("#wireframe_rules");k.length?k.empty():a('').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked", -false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C); -a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,true):u.clone();C?a(k).find("img").replaceWith(C): -console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+ -Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na(); -var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ -P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); -var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke": -"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D); -g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('\t\t\t\t\t',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S= -P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type; -switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("
    "+aa.w+"\u00d7
    "+aa.h+"
    ")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)}); -a("input,select").attr("autocomplete","off");var v=function(){var k=[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"}, -{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel", +g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa? +"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled"); +g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D= +null,P=X.getElementsByTagName("*"),U=0,S=P.length;U=2&&u[1]!=null?u:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(D);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled", +C==0)}g.runExtensions("elementTransition",{elems:u})}});g.bind("changed",function(k,u){var C=g.getMode();C==="select"&&ba();for(var D=0;D\n'+u;var C=navigator.userAgent;if(~C.indexOf("Chrome")&& +a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var D=k.open("data:image/svg+xml;base64,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})}); +g.bind("zoomed",W);g.bind("contextset",function(k,u){var C="";if(u){var D="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > '+this.id+"":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)}, +50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("
    ",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='
    '+ha.id+"
    ",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='';Ta=a('
      ').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ +ha.colnum);a(ta).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="'+ha.label+':';var ab=a(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa= +{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("
      ", +{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
      ",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"
    • ":"
      ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type== +"mode_flyout"){ta=a(ab);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("
      ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button"); +a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("
      ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+ +Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
      '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k= +"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("

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

      "+k+"

      ")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()> +0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill"); +k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed"); +R.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed"); +a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C= +fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u, +true):u.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()* +(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"? +k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ +ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()? +a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)}); +a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker", +containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D= +{color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('\t\t\t\t\t',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5): +C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+ +this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("
      "+aa.w+"\u00d7
      "+aa.h+"
      ")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k= +[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear", +fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel", fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"}, {sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"}, {sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"}, diff --git a/editor/temp.css b/editor/temp.css index a26f8d0..0e44b45 100644 --- a/editor/temp.css +++ b/editor/temp.css @@ -2475,6 +2475,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), font-size: 24px; color: #fff; margin: 30px 0 0 10px; + white-space: nowrap; } #preview_font:after { diff --git a/method-draw/svg-editor.css b/method-draw/svg-editor.css index e98bfe0..f14b92c 100644 --- a/method-draw/svg-editor.css +++ b/method-draw/svg-editor.css @@ -1830,6 +1830,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), font-size: 24px; color: #fff; margin: 30px 0 0 10px; + white-space: nowrap; } #preview_font:after { diff --git a/method-draw/svg-editor.js b/method-draw/svg-editor.js index 73bbe92..d682821 100644 --- a/method-draw/svg-editor.js +++ b/method-draw/svg-editor.js @@ -1544,7 +1544,7 @@ $('#font_family').val(font_family); $('#font_size').val(elem.getAttribute("font-size")); $('#text').val(elem.textContent); - $('#preview_font').text(font_family.split(",")[0]).css('font-family', font_family); + $('#preview_font').text(font_family.split(",")[0].replace(/'/g, "")).css('font-family', font_family); if (svgCanvas.addedNew) { // Timeout needed for IE9 setTimeout(function() { diff --git a/method-draw/svgedit.compiled.css b/method-draw/svgedit.compiled.css index 588d7cc..2e1efc8 100644 --- a/method-draw/svgedit.compiled.css +++ b/method-draw/svgedit.compiled.css @@ -387,7 +387,7 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we .draginput input{border:0;background:transparent;font:24px/normal sans-serif;text-align:center;color:#4f80ff;padding:30px 0 16px;width:100%;height:24px;position:relative;z-index:2} .draginput.twocol{width:145px} #tool_font_family .caret{right:10px;top:55%} -#preview_font{font-size:24px;color:#fff;margin:30px 0 0 10px} +#preview_font{font-size:24px;color:#fff;margin:30px 0 0 10px;white-space:nowrap} #preview_font:after{content:'';position:absolute;right:0;top:3px;bottom:3px;width:40px;border-right:solid #3f3f3c 10px;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjxsaW5lYXJHcmFkaWVudCBpZD0iZzU4MCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIwJSIgeTE9IjAlIiB4Mj0iMTAwJSIgeTI9IjAlIj48c3RvcCBzdG9wLWNvbG9yPSIjM2YzZjNjIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMzZjNmM2MiIG9mZnNldD0iMC43Ii8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c1ODApIiAvPjwvc3ZnPg==)} .draginput input,.draginput input:hover,.draginput input:active{cursor:url(images/drag.png),move;cursor:-webkit-grab;cursor:-moz-grab} .draginput.active input,.draginput.active input:hover,.draginput.active input:active{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing} diff --git a/method-draw/svgedit.compiled.js b/method-draw/svgedit.compiled.js index 9369ce1..20b3446 100644 --- a/method-draw/svgedit.compiled.js +++ b/method-draw/svgedit.compiled.js @@ -407,70 +407,71 @@ var aa,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){a a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(u){P=a("#seg_type");if(D){u.x=svgedit.units.convertUnit(u.x);u.y=svgedit.units.convertUnit(u.y)}a("#path_node_x").val(Math.round(u.x));a("#path_node_y").val(Math.round(u.y));u.type?P.val(u.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}return}D=null;if(ra==="a"){D=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show(); D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide(); a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active", -g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0]).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show(); -a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u); -V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=null,P=X.getElementsByTagName("*"),U=0,S=P.length;U=2&&u[1]!=null?u:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(D);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition", -{elems:u})}});g.bind("changed",function(k,u){var C=g.getMode();C==="select"&&ba();for(var D=0;D\n'+u;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0, -true);else{var D=k.open("data:image/svg+xml;base64,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("", -{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k, -u){var C="";if(u){var D="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > '+this.id+"":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var D=false,P=false,U=true,S=function(){if(u.callback&& -!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("
      ",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='
      '+ha.id+"
      ",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='';Ta=a('
        ').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ta).appendTo(Ra).children(); -Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="'+ha.label+':';var ab=a(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa={},ga={},ra=u.svgicons,Oa= -{};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("
        ",{id:ha.panel}).appendTo("#tools_top"); -break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
        ",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"
      • ":"
        ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ta=a(ab);Ma=ta.parent(); -if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("
        ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ -ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("
        ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key, -isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
        '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k, -"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("

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

        "+k+"

        ")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu")); -T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity")); -if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");R.toggleClass("wireframe");if(!H){var k= -a("#wireframe_rules");k.length?k.empty():a('').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked", -false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C); -a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,true):u.clone();C?a(k).find("img").replaceWith(C): -console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+ -Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na(); -var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ -P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); -var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke": -"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D); -g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('\t\t\t\t\t',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S= -P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type; -switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("
        "+aa.w+"\u00d7
        "+aa.h+"
        ")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)}); -a("input,select").attr("autocomplete","off");var v=function(){var k=[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"}, -{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel", +g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa? +"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled"); +g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D= +null,P=X.getElementsByTagName("*"),U=0,S=P.length;U=2&&u[1]!=null?u:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(D);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled", +C==0)}g.runExtensions("elementTransition",{elems:u})}});g.bind("changed",function(k,u){var C=g.getMode();C==="select"&&ba();for(var D=0;D\n'+u;var C=navigator.userAgent;if(~C.indexOf("Chrome")&& +a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var D=k.open("data:image/svg+xml;base64,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})}); +g.bind("zoomed",W);g.bind("contextset",function(k,u){var C="";if(u){var D="";C=''+g.getCurrentDrawing().getCurrentLayerName()+"";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > '+this.id+"":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)}, +50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("
        ",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='
        '+ha.id+"
        ",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='';Ta=a('
          ').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ +ha.colnum);a(ta).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="'+ha.label+':';var ab=a(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa= +{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("
          ", +{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("
          ",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"
        • ":"
          ").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type== +"mode_flyout"){ta=a(ab);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("
          ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button"); +a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("
          ",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+ +Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa
          '});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k= +"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("

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

          "+k+"

          ")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()> +0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill"); +k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed"); +R.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed"); +a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C= +fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u, +true):u.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()* +(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"? +k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ +ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()? +a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)}); +a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker", +containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D= +{color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('\t\t\t\t\t',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5): +C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+ +this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("
          "+aa.w+"\u00d7
          "+aa.h+"
          ")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k= +[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear", +fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():clickSave()},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel", fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"}, {sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"}, {sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"}, diff --git a/method-draw/temp.css b/method-draw/temp.css index a26f8d0..0e44b45 100644 --- a/method-draw/temp.css +++ b/method-draw/temp.css @@ -2475,6 +2475,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), font-size: 24px; color: #fff; margin: 30px 0 0 10px; + white-space: nowrap; } #preview_font:after {