removing the no image directive from svg icons
parent
e12250b221
commit
336145771a
|
@ -218,7 +218,7 @@
|
|||
$.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
|
||||
w:27, h:27,
|
||||
id_match: false,
|
||||
no_img: !svgedit.browser.isWebkit(), // Opera & Firefox 4 gives odd behavior w/images
|
||||
no_img: true, // Opera & Firefox 4 gives odd behavior w/images
|
||||
fallback_path: curConfig.imgPath,
|
||||
fallback:{
|
||||
'logo':'logo.png',
|
||||
|
|
|
@ -385,76 +385,76 @@ Ra[xa]=ab.getContext("2d")}ab[qa]=ga%3E4;ga=3E4}Ba[qa]=ga;qa=S*v;var Xa=50/qa;Ba
|
|||
xa/1E3+"K";if(Z){ua.fillText(xa,cb+2,8);ua.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xa<Ma.length;xa++){ua.fillText(Ma[xa],1,cb+9+xa*9);ua.fillStyle="#777"}}Ma=Xa/10;for(xa=1;xa<10;xa++){var yb=Math.round(cb+Ma*xa)+0.5;if(Ra&&yb>ga){Ta++;ua.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ua=Ra[Ta];cb-=3E4;yb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(Z){ua.moveTo(yb,15);ua.lineTo(yb,Gb)}else{ua.moveTo(15,yb);ua.lineTo(Gb,yb)}}}ua.strokeStyle="#666";ua.stroke()}}(function(){var k=window.opener;
|
||||
if(k)try{var v=k.document.createEvent("Event");v.initEvent("svgEditorReady",true,true);k.document.documentElement.dispatchEvent(v)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var k=a.deparam.querystring(true);if(!a.isEmptyObject(k)){if(k.dimensions)k.dimensions=k.dimensions.split(",");if(k.extensions)k.extensions=k.extensions.split(",");if(k.bkgd_color)k.bkgd_color=
|
||||
"#"+k.bkgd_color;svgEditor.setConfig(k);var v=k.source,C=a.param.querystring();if(!v)if(C.indexOf("source=data:")>=0)v=C.match(/source=(data:[^&]*)/)[1];if(v)if(v.indexOf("data:")===0){v=v.replace(/ /g,"+");b.loadFromDataURI(v)}else b.loadFromString(v);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();var q=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(v){if(!v){v=document.createElement("script");
|
||||
v.src=curConfig.extPath+k;document.querySelector("head").appendChild(v)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",
|
||||
spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text",
|
||||
"#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom",
|
||||
"#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");
|
||||
var k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var v=a("#"+this.id+"_show"),C=v.attr("data-curopt");if(!v.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");v.append(C)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(k){a("#base_unit_container").css({top:k.pageY-
|
||||
10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>=
|
||||
0,o=q?"meta+":"ctrl+",K=g.pathActions,T=g.undoMgr,O=svgedit.utilities,J=curConfig.imgPath+"placeholder.svg",Q=a("#workarea"),V=a("#cmenu_canvas"),M=null,ia=1,oa="toolbars",fa="";q||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),v=a("#dialog_buttons"),C=function(F,P,U,S){a("#dialog_content").html("<p>"+P.replace(/\n/g,
|
||||
"</p><p>")+"</p>").toggleClass("prompt",F=="prompt");v.empty();var Y=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(v);F!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(v).on("click, touchstart",function(){k.hide();U(false)});if(F=="prompt"){var Z=a('<input type="text">').prependTo(v);Z.val(S||"");Z.bind("keydown","return",function(){Y.trigger("click touchstart")})}F=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=
|
||||
F=="prompt"?Z.val():true;U&&U(ga)}).focus();F=="prompt"&&Z.focus()};a.alert=function(F,P){C("alert",F,P)};a.confirm=function(F,P){C("confirm",F,P)};a.process_cancel=function(F,P){C("process",F,P)};a.prompt=function(F,P,U){C("prompt",F,U,P)}})();var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=
|
||||
false,ka=false,da="",W=function(k,v){var C=g.getResolution();a("#svgcanvas").position();var F=g.setBBoxZoom(v,Q.width()-15,Q.height()-15);if(F){var P=F.zoom;F=F.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=C.zoom,Z=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);E();if(ga<1)requestAnimationFrame(Z);else{a("#zoom").val(P*100);a("option","#zoom_select").removeAttr("selected");a("option[value="+P*100+"]","#zoom_select").attr("selected","selected")}};
|
||||
Z(Date.now());g.getMode()=="zoom"&&F.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var aa=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},pa={},ra=function(k){a.each(k,function(v,C){var F=a(v).children(),P=v+"_show",U=a(P),S=false;F.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var qa=C[ga];pa[qa.sel]=qa.fn;if(qa.isDefault)S=ga;ga=function(Oa){var Ba=
|
||||
qa;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[qa.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[qa.parent][ua+1]||k[qa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",U.height());U.children(":not(.flyout_arrow_horiz)").remove();
|
||||
U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);qa.key&&a(document).bind("keydown",qa.key[0]+" shift+"+qa.key[0],ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,Z=a(P).position();a(v).css({left:Z.left+34,top:Z.top+77});U.mousedown(function(ga){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var qa=a(v),Oa=Z.left+34,
|
||||
Ba=qa.width()*-1,ha=qa.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?qa.css("left",Oa).show():qa.css("left",Ba).show().animate({left:Oa},50);qa.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in pa&&pa[ga]()})});Aa()},ma=function(k,v){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(v)},
|
||||
na=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),v=k.offset();k=k.outerWidth();a(this).css({left:(v.left+k)*ia,top:v.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var v=[];a(this).children().each(function(){v.push(this.title)});k[0].title=v.join(" / ")}})},Fa,Ia=function(k,v,C){var F=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];F={alpha:v};F[k.tagName]=
|
||||
k}else F=k.indexOf("#")===0?{alpha:v,solidColor:k.substr(1)}:{alpha:v,solidColor:"none"};return new a.jGraduate.Paint(F)},Ca=g.getResolution();if(curConfig.baseUnit!=="px"){Ca.w=svgedit.units.convertUnit(Ca.w)+curConfig.baseUnit;Ca.h=svgedit.units.convertUnit(Ca.h)+curConfig.baseUnit}var Ka=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Ca.w+2,height:Ca.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});
|
||||
g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(k){k||(k=J);g.setImageURL(k);a("#image_url").val(k)},za=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(sa&&sa[0]!=null&&!sa[0].parentNode)sa=false;var v=g.getCurrentDrawing().getCurrentLayerName(),C=g.getMode(),F=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,P=C=="pathedit";if(P){a(".context_panel").hide();
|
||||
a("#path_node_panel").show();a("#stroke_panel").hide();v=K.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);Cb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(v){P=a("#seg_type");if(F){v.x=svgedit.units.convertUnit(v.x);v.y=svgedit.units.convertUnit(v.y)}a("#path_node_x").val(Math.round(v.x));a("#path_node_y").val(Math.round(v.y));v.type?P.val(v.type).removeAttr("disabled"):
|
||||
P.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var U=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(sa){sa=sa.filter(Boolean);(k=g.elementsAreSame(sa)?sa[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!sa){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=
|
||||
null){a("#stroke_panel").show();var S=k.nodeName,Y=g.getRotationAngle(k);a("#angle").val(Math.round(Y));Y=g.getBlur(k);a("#blur").val(Y);if(!P&&C!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Z,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){Z=C.x;ga=C.y}if(F){Z=svgedit.units.convertUnit(Z);ga=svgedit.units.convertUnit(ga)}a("#"+S+"_x").val(Math.round(Z));a("#"+S+"_y").val(Math.round(ga));if(S==="polyline"){a("#path_x").val(Math.round(Z));
|
||||
a("#path_y").val(Math.round(ga))}["image","text","path","g","use"].indexOf(S)==-1&&a(".action_path_convert_selected").removeClass("disabled");S==="path"&&a(".action_path_selected").removeClass("disabled")}F=null;if(qa==="a"){F=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();F=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!F);F&&a("#link_url").val(F);F={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 qa=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(qa=="path"||qa=="polyline")a("#path_panel").show();if(F[qa]){F=F[qa];a("#"+qa+"_panel").show();qa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(F,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(qa+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(qa=="text"){F=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(F);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(F.split(",")[0].replace(/'/g,
|
||||
"")).css("font-family",F);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||
|
||||
U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(v);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",
|
||||
function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,v){var C=g.getMode();C==="select"&&ba();if(C==="pathedit")return za();X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa=v.length>=2?v:false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":C=null;for(var F=X.getElementsByTagName("*"),P=0,U=F.length;P<U;P++){var S=F[P].getAttribute("stroke-width");
|
||||
if(P===0)C=S;else if(C!==S)C=null}a("#stroke_width").val(C===null?"":C);break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||1);C=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+C+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);C=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+C).length!=0&&d(a("#linejoin_"+C)[0]);C=X.getAttribute("stroke-linecap")||
|
||||
"butt";a("#linecap_"+C).length!=0&&d(a("#linecap_"+C)[0])}if(X!=null){C=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(C);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}sa.length&&a("#tools_top").addClass("multiselected")}else if(sa.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:v,
|
||||
selectedElement:X,multiselected:sa})});g.bind("transition",function(k,v){var C=g.getMode(),F=v[0];if(F){sa=v.length>=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(F);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var F=0;F<v.length;++F){var P=v[F];if(P&&P.tagName==="svg")E();else if(P&&X&&X.parentNode==
|
||||
null)X=P}b.show_save_warning=true;za();if(X&&C==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:v})});g.bind("saved",function(k,v){b.show_save_warning=false;v='<?xml version="1.0"?>\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var F=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s",
|
||||
"SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");P!=="part"&&F.alert(U)}}});g.bind("exported",function(k,v){var C=v.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var F=a("#export_canvas")[0];F.width=g.contentW;F.height=g.contentH;canvg(F,v.svg,{renderCallback:function(){var P=
|
||||
F.toDataURL("image/png");M.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var F="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){F+=
|
||||
" > "+this.id;C+=this!==v?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=F}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var F=false,P=false,U=true,S=function(){if(v.callback&&!F&&U){F=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||
|
||||
(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ua+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,
|
||||
cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="<label"+Ta+'><span id="'+ha.id+'_label">'+
|
||||
ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></label>';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+
|
||||
Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('<img src="'+ha.icon+'">');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=
|
||||
a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);
|
||||
Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=
|
||||
ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}qa||
|
||||
ab.append(Ta);ha.list||a.each(ha.events,function(yb,Gb){if(yb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(yb,Gb):ab.bind(yb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",ha.title+" ["+ha.key+"]")}}else ab.bind(yb,Gb);else ab.bind(yb,Gb)});ra(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(qa)U=false;a.svgIcons(qa,{w:27,h:27,id_match:false,no_img:!B,fallback:Z,placement:ga,callback:function(){s.iconsize&&
|
||||
s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff",
|
||||
"#aad4ff"],function(k,v){ya+='<div class="palette_item" style="background-color: '+v+';" data-rgb="'+v+'"></div>'});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/
|
||||
2)/k,zoom:v},true)}},qb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});
|
||||
changeAttribute=function(k){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),
|
||||
v=k?"stroke":"fill",C=a(this).attr("data-rgb"),F=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";F=new a.jGraduate.Paint}else F=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});b.paintBox[v].setPaint(F);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
|
||||
"table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=
|
||||
null,v=null,C=Q[0],F=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(F!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY;if(U.type==="mouseup"||U.type==="touchend")F=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){F=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){F=false;a("body").removeClass("dragging")});a(document).bind("keydown",
|
||||
"space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background=
|
||||
"#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});
|
||||
var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,F){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(D=0;D<v;D++){C=Math.min(v,D+1);if(F>0)zoom=Sa[D]<=k?Sa[C]:zoom;if(F<0)zoom=Sa[D]<k?Sa[D]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");
|
||||
a(this).parent().addClass("open")});b.addDropDown=function(k,v,C){if(a(k).length!=0){var F=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){F.removeClass("down");P.hide()}U=false});F.bind("mousedown",function(){if(F.hasClass("down")){F.removeClass("down");P.hide()}else{F.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-
|
||||
110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,F){var P=a(k);v=a(v);var U=false,S=F.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",function(){if(F.seticon){Cb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var Y=
|
||||
a(k).offset();if(S){Y.top-=v.height();Y.left+=8}else Y.top+=a(k).height();a(v).offset(Y);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});F.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);
|
||||
a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&
|
||||
g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Bb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=
|
||||
null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},zb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(X!=null){window.event.type===
|
||||
"keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},
|
||||
Ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection();za()}},la=function(){X!=null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();
|
||||
g.moveSelectedElements(k,v)}},N=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);K.linkControlPoints(k)},R=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),v=!k.hasClass("push_button_pressed");v?k.addClass("push_button_pressed").removeClass("tool_button"):
|
||||
k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(v)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(X==null||sa)){k||(v*=-1);var C=a("#angle").val()*1+v;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(v){if(v){ba();g.clear();g.setResolution(k[0],k[1]);E(true);Db();za();aa();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());
|
||||
za()},Qa=function(){g.setItalic(!g.getItalic());za()},vb=function(){if(!c.pngsave){var k=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var v=k.prev();v.css("background","#09f");setTimeout(function(){v.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>
|
||||
0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),
|
||||
v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),F=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;F=Ia(F,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(F,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();E(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
|
||||
a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exit_fullscreen()},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");
|
||||
a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=
|
||||
fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},Cb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+
|
||||
v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var F=a(this),P=F.outerWidth()*(v-1),U=F.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=F.data("orig_margin-"+Y);if(Z==null){Z=parseInt(F.css("margin-"+
|
||||
Y));F.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;F.css("margin-"+Y,Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),F=1;F=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=ia=F;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();
|
||||
Mb(C,F);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(Z,ga){if(typeof ga==="number")var qa=ga*F+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
v.src=curConfig.extPath+k;document.querySelector("head").appendChild(v)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",
|
||||
node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image",
|
||||
"#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},
|
||||
resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var v=
|
||||
a("#"+this.id+"_show"),C=v.attr("data-curopt");if(!v.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");v.append(C)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(k){a("#base_unit_container").css({top:k.pageY-10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",
|
||||
function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>=0,o=q?"meta+":"ctrl+",K=g.pathActions,T=g.undoMgr,O=svgedit.utilities,J=curConfig.imgPath+
|
||||
"placeholder.svg",Q=a("#workarea"),V=a("#cmenu_canvas"),M=null,ia=1,oa="toolbars",fa="";q||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),v=a("#dialog_buttons"),C=function(F,P,U,S){a("#dialog_content").html("<p>"+P.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",F=="prompt");v.empty();var Y=a('<input type="button" value="'+
|
||||
uiStrings.common.ok+'">').appendTo(v);F!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(v).on("click, touchstart",function(){k.hide();U(false)});if(F=="prompt"){var Z=a('<input type="text">').prependTo(v);Z.val(S||"");Z.bind("keydown","return",function(){Y.trigger("click touchstart")})}F=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=F=="prompt"?Z.val():true;U&&U(ga)}).focus();F=="prompt"&&Z.focus()};a.alert=function(F,P){C("alert",
|
||||
F,P)};a.confirm=function(F,P){C("confirm",F,P)};a.process_cancel=function(F,P){C("process",F,P)};a.prompt=function(F,P,U){C("prompt",F,U,P)}})();var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=false,ka=false,da="",W=function(k,v){var C=g.getResolution();a("#svgcanvas").position();var F=g.setBBoxZoom(v,
|
||||
Q.width()-15,Q.height()-15);if(F){var P=F.zoom;F=F.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=C.zoom,Z=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);E();if(ga<1)requestAnimationFrame(Z);else{a("#zoom").val(P*100);a("option","#zoom_select").removeAttr("selected");a("option[value="+P*100+"]","#zoom_select").attr("selected","selected")}};Z(Date.now());g.getMode()=="zoom"&&F.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=
|
||||
a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var aa=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},pa={},ra=function(k){a.each(k,function(v,C){var F=a(v).children(),P=v+"_show",U=a(P),S=false;F.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var qa=C[ga];pa[qa.sel]=qa.fn;if(qa.isDefault)S=ga;ga=function(Oa){var Ba=qa;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");
|
||||
a.each(k[qa.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[qa.parent][ua+1]||k[qa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",U.height());U.children(":not(.flyout_arrow_horiz)").remove();U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);qa.key&&a(document).bind("keydown",qa.key[0]+" shift+"+qa.key[0],
|
||||
ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,Z=a(P).position();a(v).css({left:Z.left+34,top:Z.top+77});U.mousedown(function(ga){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var qa=a(v),Oa=Z.left+34,Ba=qa.width()*-1,ha=qa.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?qa.css("left",Oa).show():qa.css("left",
|
||||
Ba).show().animate({left:Oa},50);qa.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in pa&&pa[ga]()})});Aa()},ma=function(k,v){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(v)},na=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),v=k.offset();k=k.outerWidth();a(this).css({left:(v.left+
|
||||
k)*ia,top:v.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var v=[];a(this).children().each(function(){v.push(this.title)});k[0].title=v.join(" / ")}})},Fa,Ia=function(k,v,C){var F=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];F={alpha:v};F[k.tagName]=k}else F=k.indexOf("#")===0?{alpha:v,solidColor:k.substr(1)}:{alpha:v,solidColor:"none"};return new a.jGraduate.Paint(F)},Ca=g.getResolution();
|
||||
if(curConfig.baseUnit!=="px"){Ca.w=svgedit.units.convertUnit(Ca.w)+curConfig.baseUnit;Ca.h=svgedit.units.convertUnit(Ca.h)+curConfig.baseUnit}var Ka=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Ca.w+2,height:Ca.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");
|
||||
var Na=b.setImageURL=function(k){k||(k=J);g.setImageURL(k);a("#image_url").val(k)},za=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(sa&&sa[0]!=null&&!sa[0].parentNode)sa=false;var v=g.getCurrentDrawing().getCurrentLayerName(),C=g.getMode(),F=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,P=C=="pathedit";if(P){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();v=K.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");
|
||||
a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);Cb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(v){P=a("#seg_type");if(F){v.x=svgedit.units.convertUnit(v.x);v.y=svgedit.units.convertUnit(v.y)}a("#path_node_x").val(Math.round(v.x));a("#path_node_y").val(Math.round(v.y));v.type?P.val(v.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var U=a("#cmenu_canvas li");
|
||||
a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(sa){sa=sa.filter(Boolean);(k=g.elementsAreSame(sa)?sa[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!sa){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var S=k.nodeName,Y=g.getRotationAngle(k);a("#angle").val(Math.round(Y));Y=g.getBlur(k);a("#blur").val(Y);if(!P&&C!="pathedit"){a("#selected_panel").show();
|
||||
a(".action_selected").removeClass("disabled");var Z,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){Z=C.x;ga=C.y}if(F){Z=svgedit.units.convertUnit(Z);ga=svgedit.units.convertUnit(ga)}a("#"+S+"_x").val(Math.round(Z));a("#"+S+"_y").val(Math.round(ga));if(S==="polyline"){a("#path_x").val(Math.round(Z));a("#path_y").val(Math.round(ga))}["image","text","path","g","use"].indexOf(S)==-1&&a(".action_path_convert_selected").removeClass("disabled");S==="path"&&a(".action_path_selected").removeClass("disabled")}F=
|
||||
null;if(qa==="a"){F=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();F=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!F);F&&a("#link_url").val(F);F={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 qa=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(qa=="path"||qa==
|
||||
"polyline")a("#path_panel").show();if(F[qa]){F=F[qa];a("#"+qa+"_panel").show();qa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(F,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(qa+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(qa=="text"){F=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(F);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(F.split(",")[0].replace(/'/g,"")).css("font-family",F);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");
|
||||
g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");
|
||||
T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(v);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,v){var C=g.getMode();C==="select"&&ba();if(C==="pathedit")return za();X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa=
|
||||
v.length>=2?v:false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":C=null;for(var F=X.getElementsByTagName("*"),P=0,U=F.length;P<U;P++){var S=F[P].getAttribute("stroke-width");if(P===0)C=S;else if(C!==S)C=null}a("#stroke_width").val(C===null?"":C);break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||1);C=X.getAttribute("stroke-dasharray")||"none";a("option",
|
||||
"#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+C+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);C=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+C).length!=0&&d(a("#linejoin_"+C)[0]);C=X.getAttribute("stroke-linecap")||"butt";a("#linecap_"+C).length!=0&&d(a("#linecap_"+C)[0])}if(X!=null){C=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(C);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}sa.length&&
|
||||
a("#tools_top").addClass("multiselected")}else if(sa.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:v,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,v){var C=g.getMode(),F=v[0];if(F){sa=v.length>=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(F);
|
||||
a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var F=0;F<v.length;++F){var P=v[F];if(P&&P.tagName==="svg")E();else if(P&&X&&X.parentNode==null)X=P}b.show_save_warning=true;za();if(X&&C==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:v})});g.bind("saved",function(k,v){b.show_save_warning=
|
||||
false;v='<?xml version="1.0"?>\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var F=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done",
|
||||
"all");P!=="part"&&F.alert(U)}}});g.bind("exported",function(k,v){var C=v.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var F=a("#export_canvas")[0];F.width=g.contentW;F.height=g.contentH;canvg(F,v.svg,{renderCallback:function(){var P=F.toDataURL("image/png");M.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+
|
||||
C.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var F="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){F+=" > "+this.id;C+=this!==v?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=F}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){function C(){if(Fa){clearTimeout(Fa);
|
||||
Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var F=false,P=false,U=true,S=function(){if(v.callback&&!F&&U){F=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,
|
||||
cb)});break;case "select":ua="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ua+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').appendTo("#option_lists");
|
||||
ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></label>';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,
|
||||
cb){ab.bind(Xa,cb)})}});if(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('<img src="'+ha.icon+'">');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+
|
||||
ha.panel;a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):
|
||||
a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");
|
||||
a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+
|
||||
Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}qa||ab.append(Ta);ha.list||a.each(ha.events,function(yb,Gb){if(yb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(yb,Gb):ab.bind(yb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",
|
||||
ha.title+" ["+ha.key+"]")}}else ab.bind(yb,Gb);else ab.bind(yb,Gb)});ra(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(qa)U=false;a.svgIcons(qa,{w:27,h:27,id_match:false,no_img:!B,fallback:Z,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00",
|
||||
"#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,v){ya+='<div class="palette_item" style="background-color: '+v+';" data-rgb="'+v+'"></div>'});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k=
|
||||
"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/2)/k,zoom:v},true)}},qb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);
|
||||
qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);
|
||||
k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),v=k?"stroke":"fill",C=a(this).attr("data-rgb"),F=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";F=new a.jGraduate.Paint}else F=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});b.paintBox[v].setPaint(F);
|
||||
if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false;
|
||||
if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,v=null,C=Q[0],F=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(F!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY;
|
||||
if(U.type==="mouseup"||U.type==="touchend")F=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){F=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){F=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()===
|
||||
"zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",
|
||||
function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,F){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(D=0;D<v;D++){C=
|
||||
Math.min(v,D+1);if(F>0)zoom=Sa[D]<=k?Sa[C]:zoom;if(F<0)zoom=Sa[D]<k?Sa[D]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,v,C){if(a(k).length!=0){var F=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);
|
||||
var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){F.removeClass("down");P.hide()}U=false});F.bind("mousedown",function(){if(F.hasClass("down")){F.removeClass("down");P.hide()}else{F.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,F){var P=a(k);v=a(v);var U=false,S=F.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",
|
||||
function(){if(F.seticon){Cb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=v.height();Y.left+=8}else Y.top+=a(k).height();a(v).offset(Y);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=
|
||||
true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});F.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});
|
||||
(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&
|
||||
g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Bb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));
|
||||
g.copySelectedElements()}},zb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&
|
||||
pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection();za()}},la=function(){X!=
|
||||
null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},N=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
|
||||
false);K.linkControlPoints(k)},R=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),v=!k.hasClass("push_button_pressed");v?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(v)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(X==null||sa)){k||(v*=-1);
|
||||
var C=a("#angle").val()*1+v;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(v){if(v){ba();g.clear();g.setResolution(k[0],k[1]);E(true);Db();za();aa();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za()},Qa=function(){g.setItalic(!g.getItalic());za()},vb=function(){if(!c.pngsave){var k=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?
|
||||
g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var v=k.prev();v.css("background","#09f");setTimeout(function(){v.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();
|
||||
else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),F=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));
|
||||
if(isNaN(v))v=100;F=Ia(F,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(F,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();E(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");
|
||||
lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exit_fullscreen()},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");
|
||||
a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},
|
||||
Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},Cb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],
|
||||
C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var F=a(this),P=F.outerWidth()*(v-1),U=F.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=F.data("orig_margin-"+Y);if(Z==null){Z=parseInt(F.css("margin-"+Y));F.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;F.css("margin-"+Y,
|
||||
Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),F=1;F=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=ia=F;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,F);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();
|
||||
else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(Z,ga){if(typeof ga==="number")var qa=ga*F+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
P+"transform: scale("+F+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/F+");}";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(){E()});(function(){Q.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=Q[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=Q[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(v){v&&Na(v)})});var w=function(k){var v=k[0].id=="stroke_color"?"stroke":
|
||||
"fill",C=k[0].id=="canvas_color";if(C)v="canvas";var F=b.paintBox[v].paint;k=v=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(C).jGraduate({paint:F,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){F=new a.jGraduate.Paint(P);b.paintBox[v].setPaint(F);
|
||||
|
|
|
@ -377,19 +377,6 @@ $(function() {
|
|||
var old_val = 'url(#' + id + ')';
|
||||
var new_val = 'url(#' + new_id + ')';
|
||||
|
||||
// Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svg_el.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + new_id + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + new_id + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + new_id);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + new_id + ')');
|
||||
// });
|
||||
|
||||
for(var i = 0; i < len; i++) {
|
||||
var elem = all_elems[i];
|
||||
if(elem.getAttribute('fill') === old_val) {
|
||||
|
|
|
@ -218,7 +218,7 @@
|
|||
$.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
|
||||
w:27, h:27,
|
||||
id_match: false,
|
||||
no_img: !svgedit.browser.isWebkit(), // Opera & Firefox 4 gives odd behavior w/images
|
||||
no_img: true, // Opera & Firefox 4 gives odd behavior w/images
|
||||
fallback_path: curConfig.imgPath,
|
||||
fallback:{
|
||||
'logo':'logo.png',
|
||||
|
|
|
@ -385,76 +385,76 @@ Ra[xa]=ab.getContext("2d")}ab[qa]=ga%3E4;ga=3E4}Ba[qa]=ga;qa=S*v;var Xa=50/qa;Ba
|
|||
xa/1E3+"K";if(Z){ua.fillText(xa,cb+2,8);ua.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xa<Ma.length;xa++){ua.fillText(Ma[xa],1,cb+9+xa*9);ua.fillStyle="#777"}}Ma=Xa/10;for(xa=1;xa<10;xa++){var yb=Math.round(cb+Ma*xa)+0.5;if(Ra&&yb>ga){Ta++;ua.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ua=Ra[Ta];cb-=3E4;yb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(Z){ua.moveTo(yb,15);ua.lineTo(yb,Gb)}else{ua.moveTo(15,yb);ua.lineTo(Gb,yb)}}}ua.strokeStyle="#666";ua.stroke()}}(function(){var k=window.opener;
|
||||
if(k)try{var v=k.document.createEvent("Event");v.initEvent("svgEditorReady",true,true);k.document.documentElement.dispatchEvent(v)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var k=a.deparam.querystring(true);if(!a.isEmptyObject(k)){if(k.dimensions)k.dimensions=k.dimensions.split(",");if(k.extensions)k.extensions=k.extensions.split(",");if(k.bkgd_color)k.bkgd_color=
|
||||
"#"+k.bkgd_color;svgEditor.setConfig(k);var v=k.source,C=a.param.querystring();if(!v)if(C.indexOf("source=data:")>=0)v=C.match(/source=(data:[^&]*)/)[1];if(v)if(v.indexOf("data:")===0){v=v.replace(/ /g,"+");b.loadFromDataURI(v)}else b.loadFromString(v);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();var q=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(v){if(!v){v=document.createElement("script");
|
||||
v.src=curConfig.extPath+k;document.querySelector("head").appendChild(v)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",
|
||||
spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text",
|
||||
"#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom",
|
||||
"#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");
|
||||
var k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var v=a("#"+this.id+"_show"),C=v.attr("data-curopt");if(!v.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");v.append(C)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(k){a("#base_unit_container").css({top:k.pageY-
|
||||
10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>=
|
||||
0,o=q?"meta+":"ctrl+",K=g.pathActions,T=g.undoMgr,O=svgedit.utilities,J=curConfig.imgPath+"placeholder.svg",Q=a("#workarea"),V=a("#cmenu_canvas"),M=null,ia=1,oa="toolbars",fa="";q||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),v=a("#dialog_buttons"),C=function(F,P,U,S){a("#dialog_content").html("<p>"+P.replace(/\n/g,
|
||||
"</p><p>")+"</p>").toggleClass("prompt",F=="prompt");v.empty();var Y=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(v);F!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(v).on("click, touchstart",function(){k.hide();U(false)});if(F=="prompt"){var Z=a('<input type="text">').prependTo(v);Z.val(S||"");Z.bind("keydown","return",function(){Y.trigger("click touchstart")})}F=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=
|
||||
F=="prompt"?Z.val():true;U&&U(ga)}).focus();F=="prompt"&&Z.focus()};a.alert=function(F,P){C("alert",F,P)};a.confirm=function(F,P){C("confirm",F,P)};a.process_cancel=function(F,P){C("process",F,P)};a.prompt=function(F,P,U){C("prompt",F,U,P)}})();var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=
|
||||
false,ka=false,da="",W=function(k,v){var C=g.getResolution();a("#svgcanvas").position();var F=g.setBBoxZoom(v,Q.width()-15,Q.height()-15);if(F){var P=F.zoom;F=F.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=C.zoom,Z=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);E();if(ga<1)requestAnimationFrame(Z);else{a("#zoom").val(P*100);a("option","#zoom_select").removeAttr("selected");a("option[value="+P*100+"]","#zoom_select").attr("selected","selected")}};
|
||||
Z(Date.now());g.getMode()=="zoom"&&F.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var aa=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},pa={},ra=function(k){a.each(k,function(v,C){var F=a(v).children(),P=v+"_show",U=a(P),S=false;F.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var qa=C[ga];pa[qa.sel]=qa.fn;if(qa.isDefault)S=ga;ga=function(Oa){var Ba=
|
||||
qa;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[qa.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[qa.parent][ua+1]||k[qa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",U.height());U.children(":not(.flyout_arrow_horiz)").remove();
|
||||
U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);qa.key&&a(document).bind("keydown",qa.key[0]+" shift+"+qa.key[0],ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,Z=a(P).position();a(v).css({left:Z.left+34,top:Z.top+77});U.mousedown(function(ga){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var qa=a(v),Oa=Z.left+34,
|
||||
Ba=qa.width()*-1,ha=qa.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?qa.css("left",Oa).show():qa.css("left",Ba).show().animate({left:Oa},50);qa.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in pa&&pa[ga]()})});Aa()},ma=function(k,v){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(v)},
|
||||
na=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),v=k.offset();k=k.outerWidth();a(this).css({left:(v.left+k)*ia,top:v.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var v=[];a(this).children().each(function(){v.push(this.title)});k[0].title=v.join(" / ")}})},Fa,Ia=function(k,v,C){var F=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];F={alpha:v};F[k.tagName]=
|
||||
k}else F=k.indexOf("#")===0?{alpha:v,solidColor:k.substr(1)}:{alpha:v,solidColor:"none"};return new a.jGraduate.Paint(F)},Ca=g.getResolution();if(curConfig.baseUnit!=="px"){Ca.w=svgedit.units.convertUnit(Ca.w)+curConfig.baseUnit;Ca.h=svgedit.units.convertUnit(Ca.h)+curConfig.baseUnit}var Ka=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Ca.w+2,height:Ca.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});
|
||||
g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(k){k||(k=J);g.setImageURL(k);a("#image_url").val(k)},za=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(sa&&sa[0]!=null&&!sa[0].parentNode)sa=false;var v=g.getCurrentDrawing().getCurrentLayerName(),C=g.getMode(),F=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,P=C=="pathedit";if(P){a(".context_panel").hide();
|
||||
a("#path_node_panel").show();a("#stroke_panel").hide();v=K.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);Cb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(v){P=a("#seg_type");if(F){v.x=svgedit.units.convertUnit(v.x);v.y=svgedit.units.convertUnit(v.y)}a("#path_node_x").val(Math.round(v.x));a("#path_node_y").val(Math.round(v.y));v.type?P.val(v.type).removeAttr("disabled"):
|
||||
P.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var U=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(sa){sa=sa.filter(Boolean);(k=g.elementsAreSame(sa)?sa[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!sa){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=
|
||||
null){a("#stroke_panel").show();var S=k.nodeName,Y=g.getRotationAngle(k);a("#angle").val(Math.round(Y));Y=g.getBlur(k);a("#blur").val(Y);if(!P&&C!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Z,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){Z=C.x;ga=C.y}if(F){Z=svgedit.units.convertUnit(Z);ga=svgedit.units.convertUnit(ga)}a("#"+S+"_x").val(Math.round(Z));a("#"+S+"_y").val(Math.round(ga));if(S==="polyline"){a("#path_x").val(Math.round(Z));
|
||||
a("#path_y").val(Math.round(ga))}["image","text","path","g","use"].indexOf(S)==-1&&a(".action_path_convert_selected").removeClass("disabled");S==="path"&&a(".action_path_selected").removeClass("disabled")}F=null;if(qa==="a"){F=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();F=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!F);F&&a("#link_url").val(F);F={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 qa=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(qa=="path"||qa=="polyline")a("#path_panel").show();if(F[qa]){F=F[qa];a("#"+qa+"_panel").show();qa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(F,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(qa+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(qa=="text"){F=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(F);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(F.split(",")[0].replace(/'/g,
|
||||
"")).css("font-family",F);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||
|
||||
U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(v);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",
|
||||
function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,v){var C=g.getMode();C==="select"&&ba();if(C==="pathedit")return za();X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa=v.length>=2?v:false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":C=null;for(var F=X.getElementsByTagName("*"),P=0,U=F.length;P<U;P++){var S=F[P].getAttribute("stroke-width");
|
||||
if(P===0)C=S;else if(C!==S)C=null}a("#stroke_width").val(C===null?"":C);break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||1);C=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+C+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);C=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+C).length!=0&&d(a("#linejoin_"+C)[0]);C=X.getAttribute("stroke-linecap")||
|
||||
"butt";a("#linecap_"+C).length!=0&&d(a("#linecap_"+C)[0])}if(X!=null){C=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(C);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}sa.length&&a("#tools_top").addClass("multiselected")}else if(sa.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:v,
|
||||
selectedElement:X,multiselected:sa})});g.bind("transition",function(k,v){var C=g.getMode(),F=v[0];if(F){sa=v.length>=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(F);a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var F=0;F<v.length;++F){var P=v[F];if(P&&P.tagName==="svg")E();else if(P&&X&&X.parentNode==
|
||||
null)X=P}b.show_save_warning=true;za();if(X&&C==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:v})});g.bind("saved",function(k,v){b.show_save_warning=false;v='<?xml version="1.0"?>\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var F=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s",
|
||||
"SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");P!=="part"&&F.alert(U)}}});g.bind("exported",function(k,v){var C=v.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var F=a("#export_canvas")[0];F.width=g.contentW;F.height=g.contentH;canvg(F,v.svg,{renderCallback:function(){var P=
|
||||
F.toDataURL("image/png");M.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var F="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){F+=
|
||||
" > "+this.id;C+=this!==v?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=F}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var F=false,P=false,U=true,S=function(){if(v.callback&&!F&&U){F=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||
|
||||
(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ua+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,
|
||||
cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="<label"+Ta+'><span id="'+ha.id+'_label">'+
|
||||
ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></label>';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+
|
||||
Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('<img src="'+ha.icon+'">');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=
|
||||
a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);
|
||||
Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=
|
||||
ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}qa||
|
||||
ab.append(Ta);ha.list||a.each(ha.events,function(yb,Gb){if(yb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(yb,Gb):ab.bind(yb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",ha.title+" ["+ha.key+"]")}}else ab.bind(yb,Gb);else ab.bind(yb,Gb)});ra(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(qa)U=false;a.svgIcons(qa,{w:27,h:27,id_match:false,no_img:!B,fallback:Z,placement:ga,callback:function(){s.iconsize&&
|
||||
s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff",
|
||||
"#aad4ff"],function(k,v){ya+='<div class="palette_item" style="background-color: '+v+';" data-rgb="'+v+'"></div>'});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/
|
||||
2)/k,zoom:v},true)}},qb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});
|
||||
changeAttribute=function(k){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),
|
||||
v=k?"stroke":"fill",C=a(this).attr("data-rgb"),F=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";F=new a.jGraduate.Paint}else F=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});b.paintBox[v].setPaint(F);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
|
||||
"table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=
|
||||
null,v=null,C=Q[0],F=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(F!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY;if(U.type==="mouseup"||U.type==="touchend")F=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){F=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){F=false;a("body").removeClass("dragging")});a(document).bind("keydown",
|
||||
"space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background=
|
||||
"#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});
|
||||
var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,F){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(D=0;D<v;D++){C=Math.min(v,D+1);if(F>0)zoom=Sa[D]<=k?Sa[C]:zoom;if(F<0)zoom=Sa[D]<k?Sa[D]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");
|
||||
a(this).parent().addClass("open")});b.addDropDown=function(k,v,C){if(a(k).length!=0){var F=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){F.removeClass("down");P.hide()}U=false});F.bind("mousedown",function(){if(F.hasClass("down")){F.removeClass("down");P.hide()}else{F.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-
|
||||
110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,F){var P=a(k);v=a(v);var U=false,S=F.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",function(){if(F.seticon){Cb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var Y=
|
||||
a(k).offset();if(S){Y.top-=v.height();Y.left+=8}else Y.top+=a(k).height();a(v).offset(Y);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});F.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);
|
||||
a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&
|
||||
g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Bb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=
|
||||
null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},zb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(X!=null){window.event.type===
|
||||
"keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},
|
||||
Ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection();za()}},la=function(){X!=null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();
|
||||
g.moveSelectedElements(k,v)}},N=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);K.linkControlPoints(k)},R=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),v=!k.hasClass("push_button_pressed");v?k.addClass("push_button_pressed").removeClass("tool_button"):
|
||||
k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(v)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(X==null||sa)){k||(v*=-1);var C=a("#angle").val()*1+v;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(v){if(v){ba();g.clear();g.setResolution(k[0],k[1]);E(true);Db();za();aa();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());
|
||||
za()},Qa=function(){g.setItalic(!g.getItalic());za()},vb=function(){if(!c.pngsave){var k=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var v=k.prev();v.css("background","#09f");setTimeout(function(){v.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>
|
||||
0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),
|
||||
v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),F=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;F=Ia(F,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(F,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();E(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
|
||||
a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exit_fullscreen()},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");
|
||||
a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=
|
||||
fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},Cb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+
|
||||
v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var F=a(this),P=F.outerWidth()*(v-1),U=F.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=F.data("orig_margin-"+Y);if(Z==null){Z=parseInt(F.css("margin-"+
|
||||
Y));F.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;F.css("margin-"+Y,Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),F=1;F=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=ia=F;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();
|
||||
Mb(C,F);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(Z,ga){if(typeof ga==="number")var qa=ga*F+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
v.src=curConfig.extPath+k;document.querySelector("head").appendChild(v)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",
|
||||
node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image",
|
||||
"#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},
|
||||
resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var v=
|
||||
a("#"+this.id+"_show"),C=v.attr("data-curopt");if(!v.children("svg, img").length){C=a(C).children().clone();if(C.length){C[0].removeAttribute("style");v.append(C)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(k){a("#base_unit_container").css({top:k.pageY-10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",
|
||||
function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};q=navigator.platform.indexOf("Mac")>=0;var B=navigator.userAgent.indexOf("AppleWebKit")>=0,o=q?"meta+":"ctrl+",K=g.pathActions,T=g.undoMgr,O=svgedit.utilities,J=curConfig.imgPath+
|
||||
"placeholder.svg",Q=a("#workarea"),V=a("#cmenu_canvas"),M=null,ia=1,oa="toolbars",fa="";q||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),v=a("#dialog_buttons"),C=function(F,P,U,S){a("#dialog_content").html("<p>"+P.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",F=="prompt");v.empty();var Y=a('<input type="button" value="'+
|
||||
uiStrings.common.ok+'">').appendTo(v);F!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(v).on("click, touchstart",function(){k.hide();U(false)});if(F=="prompt"){var Z=a('<input type="text">').prependTo(v);Z.val(S||"");Z.bind("keydown","return",function(){Y.trigger("click touchstart")})}F=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=F=="prompt"?Z.val():true;U&&U(ga)}).focus();F=="prompt"&&Z.focus()};a.alert=function(F,P){C("alert",
|
||||
F,P)};a.confirm=function(F,P){C("confirm",F,P)};a.process_cancel=function(F,P){C("process",F,P)};a.prompt=function(F,P,U){C("prompt",F,U,P)}})();var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=false,ka=false,da="",W=function(k,v){var C=g.getResolution();a("#svgcanvas").position();var F=g.setBBoxZoom(v,
|
||||
Q.width()-15,Q.height()-15);if(F){var P=F.zoom;F=F.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=C.zoom,Z=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);E();if(ga<1)requestAnimationFrame(Z);else{a("#zoom").val(P*100);a("option","#zoom_select").removeAttr("selected");a("option[value="+P*100+"]","#zoom_select").attr("selected","selected")}};Z(Date.now());g.getMode()=="zoom"&&F.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=
|
||||
a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var aa=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},pa={},ra=function(k){a.each(k,function(v,C){var F=a(v).children(),P=v+"_show",U=a(P),S=false;F.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var qa=C[ga];pa[qa.sel]=qa.fn;if(qa.isDefault)S=ga;ga=function(Oa){var Ba=qa;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");
|
||||
a.each(k[qa.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[qa.parent][ua+1]||k[qa.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",U.height());U.children(":not(.flyout_arrow_horiz)").remove();U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);qa.key&&a(document).bind("keydown",qa.key[0]+" shift+"+qa.key[0],
|
||||
ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,Z=a(P).position();a(v).css({left:Z.left+34,top:Z.top+77});U.mousedown(function(ga){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var qa=a(v),Oa=Z.left+34,Ba=qa.width()*-1,ha=qa.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?qa.css("left",Oa).show():qa.css("left",
|
||||
Ba).show().animate({left:Oa},50);qa.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in pa&&pa[ga]()})});Aa()},ma=function(k,v){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(v)},na=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),v=k.offset();k=k.outerWidth();a(this).css({left:(v.left+
|
||||
k)*ia,top:v.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var v=[];a(this).children().each(function(){v.push(this.title)});k[0].title=v.join(" / ")}})},Fa,Ia=function(k,v,C){var F=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];F={alpha:v};F[k.tagName]=k}else F=k.indexOf("#")===0?{alpha:v,solidColor:k.substr(1)}:{alpha:v,solidColor:"none"};return new a.jGraduate.Paint(F)},Ca=g.getResolution();
|
||||
if(curConfig.baseUnit!=="px"){Ca.w=svgedit.units.convertUnit(Ca.w)+curConfig.baseUnit;Ca.h=svgedit.units.convertUnit(Ca.h)+curConfig.baseUnit}var Ka=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:Ca.w+2,height:Ca.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");
|
||||
var Na=b.setImageURL=function(k){k||(k=J);g.setImageURL(k);a("#image_url").val(k)},za=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(sa&&sa[0]!=null&&!sa[0].parentNode)sa=false;var v=g.getCurrentDrawing().getCurrentLayerName(),C=g.getMode(),F=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,P=C=="pathedit";if(P){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();v=K.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");
|
||||
a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);Cb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(v){P=a("#seg_type");if(F){v.x=svgedit.units.convertUnit(v.x);v.y=svgedit.units.convertUnit(v.y)}a("#path_node_x").val(Math.round(v.x));a("#path_node_y").val(Math.round(v.y));v.type?P.val(v.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var U=a("#cmenu_canvas li");
|
||||
a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(sa){sa=sa.filter(Boolean);(k=g.elementsAreSame(sa)?sa[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!sa){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var S=k.nodeName,Y=g.getRotationAngle(k);a("#angle").val(Math.round(Y));Y=g.getBlur(k);a("#blur").val(Y);if(!P&&C!="pathedit"){a("#selected_panel").show();
|
||||
a(".action_selected").removeClass("disabled");var Z,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){Z=C.x;ga=C.y}if(F){Z=svgedit.units.convertUnit(Z);ga=svgedit.units.convertUnit(ga)}a("#"+S+"_x").val(Math.round(Z));a("#"+S+"_y").val(Math.round(ga));if(S==="polyline"){a("#path_x").val(Math.round(Z));a("#path_y").val(Math.round(ga))}["image","text","path","g","use"].indexOf(S)==-1&&a(".action_path_convert_selected").removeClass("disabled");S==="path"&&a(".action_path_selected").removeClass("disabled")}F=
|
||||
null;if(qa==="a"){F=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();F=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!F);F&&a("#link_url").val(F);F={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 qa=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(qa=="path"||qa==
|
||||
"polyline")a("#path_panel").show();if(F[qa]){F=F[qa];a("#"+qa+"_panel").show();qa=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(F,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(qa+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(qa=="text"){F=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(F);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(F.split(",")[0].replace(/'/g,"")).css("font-family",F);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(qa=="image")Na(g.getHref(k));else if(qa==="g"||qa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");
|
||||
g.getTitle()}}U[(qa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(qa==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");
|
||||
T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(v);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,v){var C=g.getMode();C==="select"&&ba();if(C==="pathedit")return za();X=v.length==1||v[1]==null?v[0]:null;v=v.filter(Boolean);sa=
|
||||
v.length>=2?v:false;if(g.elementsAreSame(sa))X=sa[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":C=null;for(var F=X.getElementsByTagName("*"),P=0,U=F.length;P<U;P++){var S=F[P].getAttribute("stroke-width");if(P===0)C=S;else if(C!==S)C=null}a("#stroke_width").val(C===null?"":C);break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||1);C=X.getAttribute("stroke-dasharray")||"none";a("option",
|
||||
"#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+C+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0]);C=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+C).length!=0&&d(a("#linejoin_"+C)[0]);C=X.getAttribute("stroke-linecap")||"butt";a("#linecap_"+C).length!=0&&d(a("#linecap_"+C)[0])}if(X!=null){C=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(C);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}sa.length&&
|
||||
a("#tools_top").addClass("multiselected")}else if(sa.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:v,selectedElement:X,multiselected:sa})});g.bind("transition",function(k,v){var C=g.getMode(),F=v[0];if(F){sa=v.length>=2&&v[1]!=null?v:null;if(!sa)switch(C){case "rotate":C=g.getRotationAngle(F);
|
||||
a("#angle").val(Math.round(C));rotateCursor(C);a("#tool_reorient").toggleClass("disabled",C==0)}g.runExtensions("elementTransition",{elems:v})}});g.bind("changed",function(k,v){var C=g.getMode();C==="select"&&ba();for(var F=0;F<v.length;++F){var P=v[F];if(P&&P.tagName==="svg")E();else if(P&&X&&X.parentNode==null)X=P}b.show_save_warning=true;za();if(X&&C==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:v})});g.bind("saved",function(k,v){b.show_save_warning=
|
||||
false;v='<?xml version="1.0"?>\n'+v;var C=navigator.userAgent;if(~C.indexOf("Chrome")&&a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var F=k.open("data:image/svg+xml;base64,"+O.encode64(v)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(v.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done",
|
||||
"all");P!=="part"&&F.alert(U)}}});g.bind("exported",function(k,v){var C=v.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var F=a("#export_canvas")[0];F.width=g.contentW;F.height=g.contentH;canvg(F,v.svg,{renderCallback:function(){var P=F.toDataURL("image/png");M.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+
|
||||
C.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(P)}}})});g.bind("zoomed",W);g.bind("contextset",function(k,v){var C="";if(v){var F="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(v).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){F+=" > "+this.id;C+=this!==v?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=F}else da=null;a("#cur_context_panel").toggle(!!v).html(C)});g.bind("extension_added",function(k,v){function C(){if(Fa){clearTimeout(Fa);
|
||||
Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},50))}var F=false,P=false,U=true,S=function(){if(v.callback&&!F&&U){F=true;v.callback()}},Y=[];v.context_tools&&a.each(v.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,
|
||||
cb)});break;case "select":ua="<label"+Ta+'><select id="'+ha.id+'">';a.each(ha.options,function(Xa,cb){ua+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').appendTo("#option_lists");
|
||||
ha.colnum&&Ta.addClass("optcols"+ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></label>';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,
|
||||
cb){ab.bind(Xa,cb)})}});if(v.buttons){var Z={},ga={},qa=v.svgicons,Oa={};a.each(v.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(qa){Z[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('<img src="'+ha.icon+'">');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+
|
||||
ha.panel;a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):
|
||||
a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");
|
||||
a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=u.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+
|
||||
Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}qa||ab.append(Ta);ha.list||a.each(ha.events,function(yb,Gb){if(yb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(yb,Gb):ab.bind(yb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",
|
||||
ha.title+" ["+ha.key+"]")}}else ab.bind(yb,Gb);else ab.bind(yb,Gb)});ra(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(qa)U=false;a.svgIcons(qa,{w:27,h:27,id_match:false,no_img:!B,fallback:Z,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00",
|
||||
"#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,v){ya+='<div class="palette_item" style="background-color: '+v+';" data-rgb="'+v+'"></div>'});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k=
|
||||
"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var v=k.value/100;if(v<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(Q[0].scrollLeft+Q.width()/2)/k,y:(Q[0].scrollTop+Q.height()/2)/k,zoom:v},true)}},qb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);
|
||||
qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var v=k.getAttribute("data-attr"),C=k.getAttribute("data-multiplier")||1;C=parseFloat(C);C=k.value*C;if(!svgedit.units.isValidUnit(v,C,X)){a.alert(uiStrings.notification.invalidAttrValGiven);
|
||||
k.value=X.getAttribute(v);return false}g.changeSelectedAttributeNoUndo(v,C)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),v=k?"stroke":"fill",C=a(this).attr("data-rgb"),F=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";F=new a.jGraduate.Paint}else F=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});b.paintBox[v].setPaint(F);
|
||||
if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false;
|
||||
if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,v=null,C=Q[0],F=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(F!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY;
|
||||
if(U.type==="mouseup"||U.type==="touchend")F=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){F=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){F=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()===
|
||||
"zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",
|
||||
function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,F){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(D=0;D<v;D++){C=
|
||||
Math.min(v,D+1);if(F>0)zoom=Sa[D]<=k?Sa[C]:zoom;if(F<0)zoom=Sa[D]<k?Sa[D]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,v,C){if(a(k).length!=0){var F=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);
|
||||
var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){F.removeClass("down");P.hide()}U=false});F.bind("mousedown",function(){if(F.hasClass("down")){F.removeClass("down");P.hide()}else{F.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,F){var P=a(k);v=a(v);var U=false,S=F.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",
|
||||
function(){if(F.seticon){Cb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=v.height();Y.left+=8}else Y.top+=a(k).height();a(v).offset(Y);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=
|
||||
true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});F.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});
|
||||
(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&
|
||||
g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Bb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));
|
||||
g.copySelectedElements()}},zb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&
|
||||
pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection();za()}},la=function(){X!=
|
||||
null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},N=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
|
||||
false);K.linkControlPoints(k)},R=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),v=!k.hasClass("push_button_pressed");v?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(v)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(X==null||sa)){k||(v*=-1);
|
||||
var C=a("#angle").val()*1+v;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(v){if(v){ba();g.clear();g.setResolution(k[0],k[1]);E(true);Db();za();aa();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za()},Qa=function(){g.setItalic(!g.getItalic());za()},vb=function(){if(!c.pngsave){var k=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?
|
||||
g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var v=k.prev();v.css("background","#09f");setTimeout(function(){v.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();
|
||||
else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),F=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));
|
||||
if(isNaN(v))v=100;F=Ia(F,k,"stroke");C=Ia(C,v,"fill");b.paintBox.fill.setPaint(F,true);b.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();E(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");
|
||||
lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exit_fullscreen()},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");
|
||||
a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},
|
||||
Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();aa()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();aa()});ba()}},Cb=b.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],
|
||||
C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var F=a(this),P=F.outerWidth()*(v-1),U=F.outerHeight()*(v-1),S=0;S<4;S++){var Y=C[S],Z=F.data("orig_margin-"+Y);if(Z==null){Z=parseInt(F.css("margin-"+Y));F.data("orig_margin-"+Y,Z)}Z=Z*v;if(Y==="right")Z+=P;else if(Y==="bottom")Z+=U;F.css("margin-"+Y,
|
||||
Z)}})},e=b.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),F=1;F=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=ia=F;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,F);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();
|
||||
else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(Z,ga){if(typeof ga==="number")var qa=ga*F+"px";else if(ga[k]||ga.all)qa=ga[k]||ga.all;U+=Z+":"+qa+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
P+"transform: scale("+F+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/F+");}";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(){E()});(function(){Q.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=Q[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=Q[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(v){v&&Na(v)})});var w=function(k){var v=k[0].id=="stroke_color"?"stroke":
|
||||
"fill",C=k[0].id=="canvas_color";if(C)v="canvas";var F=b.paintBox[v].paint;k=v=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(C).jGraduate({paint:F,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){F=new a.jGraduate.Paint(P);b.paintBox[v].setPaint(F);
|
||||
|
|
|
@ -377,19 +377,6 @@ $(function() {
|
|||
var old_val = 'url(#' + id + ')';
|
||||
var new_val = 'url(#' + new_id + ')';
|
||||
|
||||
// Selector method, possibly faster but fails in Opera / jQuery 1.4.3
|
||||
// svg_el.find('[fill="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('fill', 'url(#' + new_id + ')');
|
||||
// }).end().find('[stroke="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('stroke', 'url(#' + new_id + ')');
|
||||
// }).end().find('use').each(function() {
|
||||
// if(this.getAttribute('xlink:href') == '#' + id) {
|
||||
// this.setAttributeNS(xlinkns,'href','#' + new_id);
|
||||
// }
|
||||
// }).end().find('[filter="url(#' + id + ')"]').each(function() {
|
||||
// this.setAttribute('filter', 'url(#' + new_id + ')');
|
||||
// });
|
||||
|
||||
for(var i = 0; i < len; i++) {
|
||||
var elem = all_elems[i];
|
||||
if(elem.getAttribute('fill') === old_val) {
|
||||
|
|
Loading…
Reference in New Issue