removed method of action specific code
parent
a22a387f24
commit
0459d1ff03
|
@ -1866,9 +1866,6 @@
|
|||
return false;
|
||||
}
|
||||
var closer = function(e){
|
||||
//Method of Action specific to detect when the iframe has focus
|
||||
if((top != self && !e.isTrigger) && typeof top.exports.focus_editor == 'function') top.exports.focus_editor();
|
||||
|
||||
if (e.target.nodeName.toLowerCase() === "input") return false;
|
||||
if (!$(e.target).hasClass("menu_title") && !$(e.target).parent().hasClass("menu_title")) {
|
||||
if(!$(e.target).hasClass("disabled") && $(e.target).hasClass("menu_item")) blinker(e)
|
||||
|
|
|
@ -434,28 +434,28 @@ a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_it
|
|||
C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);
|
||||
a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,v=null,C=Q[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY;if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(U){if(U.button===
|
||||
1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();
|
||||
var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=
|
||||
self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;
|
||||
for(E=0;E<v;E++){C=Math.min(v,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(k,v,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||
|
||||
a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,D){var P=a(k);v=a(v);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");
|
||||
v.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var X=a(k).offset();if(S){X.top-=v.height();X.left+=8}else X.top+=a(k).height();a(v).offset(X);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");
|
||||
v.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,
|
||||
"page")})});(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&
|
||||
g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(Y!=null||sa)g.deleteSelectedElements()},mb=function(){if(Y!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(Y!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));
|
||||
g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(Y!=null){window.event.type==="keydown"&&
|
||||
pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(Y!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");J.toEditMode(elems[0]);g.clearSelection()}},la=function(){Y!=
|
||||
null&&J.reorient()},ca=function(){if(Y!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(Y!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},M=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
|
||||
false);J.linkControlPoints(k)},R=function(){J.getNodePoint()&&J.clonePathNode()},ea=function(){J.getNodePoint()&&J.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");J.addSubPath(v)},Pa=function(){J.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(Y==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]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;N=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 Y&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
|
||||
if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;D=Ia(D,k,"stroke");C=Ia(C,v,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=
|
||||
a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",
|
||||
false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);
|
||||
a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):
|
||||
console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(v-1),U=D.outerHeight()*(v-1),S=0;S<4;S++){var X=C[S],aa=D.data("orig_margin-"+
|
||||
X);if(aa==null){aa=parseInt(D.css("margin-"+X));D.data("orig_margin-"+X,aa)}aa=aa*v;if(X==="right")aa+=P;else if(X==="bottom")aa+=U;D.css("margin-"+X,aa)}})},e=c.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();
|
||||
var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,X){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(X,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!==
|
||||
"input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(E=0;E<v;E++){C=Math.min(v,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});
|
||||
a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(k,v,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){D.removeClass("down");
|
||||
P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,D){var P=a(k);v=a(v);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,
|
||||
arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var X=a(k).offset();if(S){X.top-=v.height();X.left+=8}else X.top+=a(k).height();a(v).offset(X);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=
|
||||
this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa=
|
||||
"canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},
|
||||
bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(Y!=null||sa)g.deleteSelectedElements()},mb=function(){if(Y!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(Y!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;
|
||||
k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},
|
||||
wb=function(k){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(Y!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");J.toEditMode(elems[0]);g.clearSelection()}},la=function(){Y!=null&&J.reorient()},ca=function(){if(Y!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,
|
||||
v){if(Y!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},M=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);J.linkControlPoints(k)},R=function(){J.getNodePoint()&&J.clonePathNode()},ea=function(){J.getNodePoint()&&J.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");J.addSubPath(v)},Pa=function(){J.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(Y==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]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;N=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 Y&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));
|
||||
g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;D=Ia(D,k,"stroke");C=Ia(C,v,"fill");c.paintBox.fill.setPaint(D,
|
||||
true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");
|
||||
k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=
|
||||
true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},
|
||||
Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],
|
||||
C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(v-1),U=D.outerHeight()*(v-1),S=0;S<4;S++){var X=C[S],aa=D.data("orig_margin-"+X);if(aa==null){aa=parseInt(D.css("margin-"+X));D.data("orig_margin-"+X,aa)}aa=aa*v;if(X==="right")aa+=P;else if(X==="bottom")aa+=U;D.css("margin-"+
|
||||
X,aa)}})},e=c.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();
|
||||
else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,X){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(X,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
|
||||
var z=a.noop;a(window).resize(function(){F()});(function(){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(Y);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(v){v&&Na(v)})});var w=function(k){var v=k[0].id=="stroke_color"?"stroke":
|
||||
"fill",C=k[0].id=="canvas_color";if(C)v="canvas";var D=c.paintBox[v].paint;k=v=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[v].setPaint(D);
|
||||
|
|
|
@ -413,7 +413,7 @@ $(function(){
|
|||
</label>
|
||||
|
||||
<label class="toolset" id="tool_opacity" data-title="Change selected item opacity">
|
||||
<input id="group_opacity" size="3" value="100" step="5" min="0" max="100" />
|
||||
<input id="group_opacity" class="attr_changer" data-attr="opacity" data-multiplier="0.01" size="3" value="100" step="5" min="0" max="100" />
|
||||
<span id="group_opacityLabel" class="icon_label">Opacity</span>
|
||||
</label>
|
||||
|
||||
|
@ -450,8 +450,15 @@ $(function(){
|
|||
<!-- Buttons when multiple elements are selected -->
|
||||
<div id="multiselected_panel" class="context_panel clearfix">
|
||||
<h4 class="hidable">Multiple Elements</h4>
|
||||
<div class="toolset align_buttons">
|
||||
<h4>Align</h4>
|
||||
|
||||
<div class="toolset align_buttons" style="position: relative">
|
||||
<label id="tool_align_relative" style="margin-top: 10px;">
|
||||
<select id="align_relative_to" title="Align relative to ...">
|
||||
<option id="selected_objects" value="selected">Align to objects</option>
|
||||
<option id="page" value="page">Align to page</option>
|
||||
</select>
|
||||
</label>
|
||||
<h4> </h4>
|
||||
<div class="col last clear">
|
||||
<div class="draginput_cell" id="tool_alignleft" title="Align Left"></div>
|
||||
<div class="draginput_cell" id="tool_aligncenter" title="Align Center"></div>
|
||||
|
@ -462,14 +469,6 @@ $(function(){
|
|||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<label id="tool_align_relative" style="margin-top: 10px;">
|
||||
<span id="relativeToLabel">Relative to:</span>
|
||||
<select id="align_relative_to" title="Align relative to ...">
|
||||
<option id="selected_objects" value="selected">Objects</option>
|
||||
<option id="page" value="page">Page</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="tool_sep"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -547,20 +546,20 @@ $(function(){
|
|||
<label class="draginput select" id="zoom_label">
|
||||
<span id="zoomLabel" class="zoom_tool icon_label"></span>
|
||||
<select id="zoom_select">
|
||||
<option>6%</option>
|
||||
<option>12%</option>
|
||||
<option>16%</option>
|
||||
<option>25%</option>
|
||||
<option>50%</option>
|
||||
<option>75%</option>
|
||||
<option selected>100%</option>
|
||||
<option>150%</option>
|
||||
<option>200%</option>
|
||||
<option>300%</option>
|
||||
<option>400%</option>
|
||||
<option>600%</option>
|
||||
<option>800%</option>
|
||||
<option>1600%</option>
|
||||
<option value="6">6%</option>
|
||||
<option value="12">12%</option>
|
||||
<option value="16">16%</option>
|
||||
<option value="25">25%</option>
|
||||
<option value="50">50%</option>
|
||||
<option value="75">75%</option>
|
||||
<option selected value="100">100%</option>
|
||||
<option value="150">150%</option>
|
||||
<option value="200">200%</option>
|
||||
<option value="300">300%</option>
|
||||
<option value="400">400%</option>
|
||||
<option value="600">600%</option>
|
||||
<option value="800">800%</option>
|
||||
<option value="1600">1600%</option>
|
||||
</select>
|
||||
<div class="caret"></div>
|
||||
<input id="zoom" size="3" value="100%" type="text" readonly="readonly" />
|
||||
|
|
|
@ -1866,9 +1866,6 @@
|
|||
return false;
|
||||
}
|
||||
var closer = function(e){
|
||||
//Method of Action specific to detect when the iframe has focus
|
||||
if((top != self && !e.isTrigger) && typeof top.exports.focus_editor == 'function') top.exports.focus_editor();
|
||||
|
||||
if (e.target.nodeName.toLowerCase() === "input") return false;
|
||||
if (!$(e.target).hasClass("menu_title") && !$(e.target).parent().hasClass("menu_title")) {
|
||||
if(!$(e.target).hasClass("disabled") && $(e.target).hasClass("menu_item")) blinker(e)
|
||||
|
|
|
@ -434,28 +434,28 @@ a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_it
|
|||
C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,v){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";v||a(".tools_flyout").fadeOut(C);
|
||||
a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,v=null,C=Q[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-v;k=U.clientX;v=U.clientY;if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(U){if(U.button===
|
||||
1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;v=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&Q.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&Q.removeClass("out")})})();
|
||||
var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=
|
||||
self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;
|
||||
for(E=0;E<v;E++){C=Math.min(v,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(k,v,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||
|
||||
a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,D){var P=a(k);v=a(v);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");
|
||||
v.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var X=a(k).offset();if(S){X.top-=v.height();X.left+=8}else X.top+=a(k).height();a(v).offset(X);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");
|
||||
v.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,
|
||||
"page")})});(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa="canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&
|
||||
g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(Y!=null||sa)g.deleteSelectedElements()},mb=function(){if(Y!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(Y!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));
|
||||
g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(Y!=null){window.event.type==="keydown"&&
|
||||
pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(Y!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");J.toEditMode(elems[0]);g.clearSelection()}},la=function(){Y!=
|
||||
null&&J.reorient()},ca=function(){if(Y!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,v){if(Y!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},M=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
|
||||
false);J.linkControlPoints(k)},R=function(){J.getNodePoint()&&J.clonePathNode()},ea=function(){J.getNodePoint()&&J.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");J.addSubPath(v)},Pa=function(){J.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(Y==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]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;N=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 Y&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
|
||||
if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;D=Ia(D,k,"stroke");C=Ia(C,v,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=
|
||||
a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",
|
||||
false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);
|
||||
a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):
|
||||
console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(v-1),U=D.outerHeight()*(v-1),S=0;S<4;S++){var X=C[S],aa=D.data("orig_margin-"+
|
||||
X);if(aa==null){aa=parseInt(D.css("margin-"+X));D.data("orig_margin-"+X,aa)}aa=aa*v;if(X==="right")aa+=P;else if(X==="bottom")aa+=U;D.css("margin-"+X,aa)}})},e=c.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();
|
||||
var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,X){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(X,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){if(k.target.nodeName.toLowerCase()!==
|
||||
"input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,v,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;v=Sa.length;for(E=0;E<v;E++){C=Math.min(v,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});
|
||||
a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(k,v,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",v);a(window).mouseup(function(){if(!U){D.removeClass("down");
|
||||
P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,v,C,D){var P=a(k);v=a(v);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");v.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,
|
||||
arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");v.hide();v.css({top:0,left:0})}U=false});v.height();a(k).bind("mousedown",function(){var X=a(k).offset();if(S){X.top-=v.height();X.left+=8}else X.top+=a(k).height();a(v).offset(X);if(P.hasClass("down")){P.removeClass("down");v.hide();v.css({top:0,left:0})}else{P.addClass("down");v.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&v.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=
|
||||
this.options[this.selectedIndex].value,v=this.options[this.selectedIndex].text;a("#preview_font").html(v).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,v=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;oa="toolbars";Q.mousedown(v)}).blur(function(){oa=
|
||||
"canvas";Q.unbind("mousedown",v);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},
|
||||
bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(Y!=null||sa)g.deleteSelectedElements()},mb=function(){if(Y!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(Y!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),v=(Q[0].scrollLeft+Q.width()/2)/k-g.contentW;
|
||||
k=(Q[0].scrollTop+Q.height()/2)/k-g.contentH;g.pasteElements("point",v,k)},ob=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},
|
||||
wb=function(k){if(Y!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(Y!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");J.toEditMode(elems[0]);g.clearSelection()}},la=function(){Y!=null&&J.reorient()},ca=function(){if(Y!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,
|
||||
v){if(Y!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;v*=C}a("input").blur();g.moveSelectedElements(k,v)}},M=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);J.linkControlPoints(k)},R=function(){J.getNodePoint()&&J.clonePathNode()},ea=function(){J.getNodePoint()&&J.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");J.addSubPath(v)},Pa=function(){J.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,v){if(!(Y==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]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;N=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 Y&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));
|
||||
g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),v=document.querySelector("#tool_fill rect"),C=v.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;v=parseFloat(v.getAttribute("fill-opacity"));if(isNaN(v))v=100;D=Ia(D,k,"stroke");C=Ia(C,v,"fill");c.paintBox.fill.setPaint(D,
|
||||
true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var v=g.getResolution();k=k?v.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");Q.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");
|
||||
k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=
|
||||
true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(Q.hasClass("wireframe")?k:"")}},Qb=function(k,v){if(!ka){ka=true;a("#save_output_btns").toggle(!!v);a("#tool_source_back").toggle(!v);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},
|
||||
Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,v){var C=typeof v==="string"?a.getSvgIcon(v,true):v.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+v)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,v=document.getElementsByTagName("script")[0],
|
||||
C;for(C in v.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in v.style)return"Webkit";if("KhtmlOpacity"in v.style)return"Khtml";return""}();var Mb=function(k,v){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(v-1),U=D.outerHeight()*(v-1),S=0;S<4;S++){var X=C[S],aa=D.data("orig_margin-"+X);if(aa==null){aa=parseInt(D.css("margin-"+X));D.data("orig_margin-"+X,aa)}aa=aa*v;if(X==="right")aa+=P;else if(X==="bottom")aa+=U;D.css("margin-"+
|
||||
X,aa)}})},e=c.setIconSize=function(k,v){if(!(k==s.size&&!v)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();
|
||||
else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,X){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(X,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
|
||||
var z=a.noop;a(window).resize(function(){F()});(function(){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(Y);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(v){v&&Na(v)})});var w=function(k){var v=k[0].id=="stroke_color"?"stroke":
|
||||
"fill",C=k[0].id=="canvas_color";if(C)v="canvas";var D=c.paintBox[v].paint;k=v=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[v].setPaint(D);
|
||||
|
|
Loading…
Reference in New Issue