bezier curves now behave better
parent
721816008d
commit
9d53f523d7
|
@ -1873,7 +1873,11 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1),
|
|||
}
|
||||
|
||||
.draginput input[type="checkbox"], .draginput input[type="checkbox"]:hover, .draginput input[type="checkbox"]:active {
|
||||
cursor: default;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.draginput.checkbox {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.draginput.active input, .draginput.active input:hover, .draginput.active input:active {
|
||||
|
|
|
@ -388,9 +388,9 @@
|
|||
<label id="seg_type_label">Straight</label>
|
||||
</div>
|
||||
|
||||
<label class="draginput checkbox" id="tool_node_link" data-title="Link Control Points">
|
||||
<label class="draginput checkbox" data-title="Link Control Points">
|
||||
<span>Linked Control Points</span>
|
||||
<div class="push_bottom"><input type="checkbox" checked="checked" /></div>
|
||||
<div class="push_bottom"><input type="checkbox" id="tool_node_link" checked="checked" /></div>
|
||||
</label>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
|
|
@ -2183,7 +2183,7 @@
|
|||
svgCanvas.setMode('path');
|
||||
}
|
||||
};
|
||||
console.log(path.getNodePoint());
|
||||
|
||||
// Delete is a contextual tool that only appears in the ribbon if
|
||||
// an element has been selected
|
||||
var deleteSelected = function() {
|
||||
|
@ -2293,7 +2293,8 @@
|
|||
};
|
||||
|
||||
var linkControlPoints = function() {
|
||||
var linked = !$('#tool_node_link').hasClass('checked');
|
||||
var linked = document.getElementById('tool_node_link').checked;
|
||||
console.log(linked);
|
||||
path.linkControlPoints(linked);
|
||||
}
|
||||
|
||||
|
@ -3253,7 +3254,7 @@
|
|||
{sel:'#tool_source_save', fn: saveSourceEditor, evt: 'click'},
|
||||
{sel:'#tool_delete,#tool_delete_multi', fn: deleteSelected, evt: 'click', key: ['del/backspace', true]},
|
||||
{sel:'#tool_reorient', fn: reorientPath, evt: 'click'},
|
||||
{sel:'#tool_node_link', fn: linkControlPoints, evt: 'click'},
|
||||
{sel:'#tool_node_link', fn: linkControlPoints, evt: 'change'},
|
||||
{sel:'#tool_node_clone', fn: clonePathNode, evt: 'click'},
|
||||
{sel:'#tool_node_delete', fn: deletePathNode, evt: 'click'},
|
||||
{sel:'#tool_openclose_path', fn: opencloseSubPath, evt: 'click'},
|
||||
|
|
|
@ -4625,7 +4625,7 @@ var pathActions = canvas.pathActions = function() {
|
|||
if (drawn_path) {
|
||||
var elem = getElem(getId());
|
||||
$(getElem("path_stretch_line")).remove();
|
||||
$(elem).remove();
|
||||
if (remove) $(elem).remove();
|
||||
$(getElem("pathpointgrip_container")).find('*').attr('display', 'none');
|
||||
drawn_path = firstCtrl = null;
|
||||
started = false;
|
||||
|
@ -6896,7 +6896,8 @@ this.getMode = function() {
|
|||
// Parameters:
|
||||
// name - String with the new mode to change to
|
||||
this.setMode = function(name) {
|
||||
pathActions.clear(true);
|
||||
|
||||
pathActions.clear();
|
||||
textActions.clear();
|
||||
$("#workarea").attr("class", name);
|
||||
cur_properties = (selectedElements[0] && selectedElements[0].nodeName == 'text') ? cur_text : cur_shape;
|
||||
|
|
|
@ -381,7 +381,8 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we
|
|||
#preview_font{font-size:20px;color:#fff;height:70px;line-height:75px;padding:0 0 0 10px;white-space:nowrap;width:100px;overflow:hidden;border-right:solid #2f2f2c 2px;position:relative}
|
||||
#preview_font:after{content:'';position:absolute;right:0;top:3px;bottom:3px;width:15px;border-right:solid #3f3f3c 10px;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjxsaW5lYXJHcmFkaWVudCBpZD0iZzU4MCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIwJSIgeTE9IjAlIiB4Mj0iMTAwJSIgeTI9IjAlIj48c3RvcCBzdG9wLWNvbG9yPSIjM2YzZjNjIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMzZjNmM2MiIG9mZnNldD0iMC43Ii8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c1ODApIiAvPjwvc3ZnPg==)}
|
||||
.draginput input,.draginput input:hover,.draginput input:active{cursor:url(images/drag.png),move;cursor:-webkit-grab;cursor:-moz-grab}
|
||||
.draginput input[type="checkbox"],.draginput input[type="checkbox"]:hover,.draginput input[type="checkbox"]:active{cursor:default}
|
||||
.draginput input[type="checkbox"],.draginput input[type="checkbox"]:hover,.draginput input[type="checkbox"]:active{cursor:pointer}
|
||||
.draginput.checkbox{cursor:pointer}
|
||||
.draginput.active input,.draginput.active input:hover,.draginput.active input:active{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing}
|
||||
.draginput span{font:11px/130% sans-serif;color:#ccc;display:block;position:absolute;top:5px;left:5px;text-align:left}
|
||||
.draginput.error{background:#900}
|
||||
|
|
|
@ -288,7 +288,7 @@ o=svgedit.path.getCtrlLine(1);var J=svgedit.path.getCtrlLine(2);ma(o,{x1:z,y1:F,
|
|||
this.prev){var O=sa.getBBox(),Y=svgedit.path.getGripPt(this);O=svgedit.math.rectsIntersect(O,{x:Y.x,y:Y.y,width:0,height:0});this.select(O);O&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z){if(Ga==="path"){l=null;if(!A){z=pa(aa());Ka=false;B=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");
|
||||
!D.shiftKey&&!G&&svgedit.path.path.selectPt(F)}else if(sa&&sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&La.toSelectMode(D.target)}else La.toSelectMode(D.target);G=false},toEditMode:function(D){svgedit.path.path=svgedit.path.getPath_(D);Ga="pathedit";xa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem;
|
||||
Ga="select";svgedit.path.path.show(false);h=false;xa();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Ga="path";e=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(h===D){La.toEditMode(D);Ga="pathedit"}else h=D},reorient:function(){var D=I[0];if(D)if(na(D)!=0){var z=new Da("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F));
|
||||
xa();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",I)}},clear:function(){h=null;if(A){var D=pa(aa());$(pa("path_stretch_line")).remove();$(D).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Ga=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=R(D),F=X(z).matrix;
|
||||
xa();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",I)}},clear:function(D){h=null;if(A){var z=pa(aa());$(pa("path_stretch_line")).remove();D&&$(z).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Ga=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=R(D),F=X(z).matrix;
|
||||
z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var k=z.numberOfItems,n=0;n<k;++n){var o=z.getItem(n),w=o.pathSegType;if(w!=1){var E=[];$.each(["",1,2],function(H,J){var O=o["x"+J],Y=o["y"+J];if(O!==undefined&&Y!==undefined){O=N(O,Y,F);E.splice(E.length,0,O.x,O.y)}});svgedit.path.replacePathSeg(w,n,E,D)}}g(D,F)},zoomChange:function(){Ga=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){if(svgedit.path.path){var D=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?
|
||||
svgedit.path.path.selected_pts[0]:1];return{x:D.item.x,y:D.item.y,type:D.type}}},linkControlPoints:function(D){svgedit.path.setLinkControlPoints(D)},clonePathNode:function(){svgedit.path.path.storeD();for(var D=svgedit.path.path.selected_pts,z=D.length,F=[];z--;){var k=D[z];svgedit.path.path.addSeg(k);F.push(k+z);F.push(k+z+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var D=svgedit.path.path.selected_pts;if(D.length===
|
||||
1){var z=svgedit.path.path.elem,F=z.pathSegList,k=D[0],n=null,o=null;svgedit.path.path.eachSeg(function(J){if(this.type===2&&J<=k)o=this.item;if(J<=k)return true;if(this.type===2){n=J;return false}else if(this.type===1)return n=false});if(n==null)n=svgedit.path.path.segs.length-1;if(n!==false){var w=z.createSVGPathSegLinetoAbs(o.x,o.y),E=z.createSVGPathSegClosePath();if(n==svgedit.path.path.segs.length){F.appendItem(w);F.appendItem(E)}else{svgedit.path.insertItemBefore(z,E,n);svgedit.path.insertItemBefore(z,
|
||||
|
@ -336,7 +336,7 @@ e}else{l=f.createElementNS(b,"title");l.textContent=e;$(h).prepend(l);B.addSubCo
|
|||
A.addSubCommand(new Ma(l,{"#text":B}));wa(A)};this.getEditorNS=function(e){e&&m.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,h){var l=zb(),B=l.w;l=l.h;var A;if(e=="fit"){var G=getStrokedBBox();if(G){A=new Da("Fit Canvas to Content");var D=pb();qb(D);var z=[],F=[];$.each(D,function(){z.push(G.x*-1);F.push(G.y*-1)});D=d.moveSelectedElements(z,F,true);A.addSubCommand(D);xa();e=Math.round(G.width);h=Math.round(G.height)}else return false}if(e!=
|
||||
B||h!=l){D=c.suspendRedraw(1E3);A||(A=new Da("Change Image Dimensions"));e=Ba("width",e);h=Ba("height",h);m.setAttribute("width",e);m.setAttribute("height",h);this.contentW=e;this.contentH=h;A.addSubCommand(new Ma(m,{width:B,height:l}));m.setAttribute("viewBox",[0,0,e/s,h/s].join(" "));A.addSubCommand(new Ma(m,{viewBox:["0 0",B,l].join(" ")}));wa(A);c.unsuspendRedraw(D);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width",
|
||||
e+2);background.setAttribute("height",h+2)}M("changed",[m])}return[e,h]};this.getOffset=function(){return $(m).attr(["x","y"])};this.setBBoxZoom=function(e,h,l){var B=0.85,A=function(G){if(!G)return false;var D=Math.min(Math.round(h/G.width*100*B)/100,Math.round(l/G.height*100*B)/100);d.setZoom(D);return{zoom:D,bbox:G}};if(typeof e=="object"){e=e;if(e.width==0||e.height==0){d.setZoom(e.zoom?e.zoom:s*e.factor);return{zoom:s,bbox:e}}return A(e)}switch(e){case "selection":if(!I[0])return;e=$.map(I,function(G){if(G)return G});
|
||||
e=getStrokedBBox(e);break;case "canvas":e=zb();B=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(pb(C().getCurrentLayer()));break;default:return}return A(e)};this.setZoom=function(e){var h=zb();m.setAttribute("viewBox","0 0 "+h.w/e+" "+h.h/e);s=e;$.each(I,function(l,B){B&&ra.requestSelector(B).resize()});La.zoomChange();ib("zoomChanged",e)};this.getMode=function(){return Ga};this.setMode=function(e){La.clear(true);bb.clear();$("#workarea").attr("class",
|
||||
e=getStrokedBBox(e);break;case "canvas":e=zb();B=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(pb(C().getCurrentLayer()));break;default:return}return A(e)};this.setZoom=function(e){var h=zb();m.setAttribute("viewBox","0 0 "+h.w/e+" "+h.h/e);s=e;$.each(I,function(l,B){B&&ra.requestSelector(B).resize()});La.zoomChange();ib("zoomChanged",e)};this.getMode=function(){return Ga};this.setMode=function(e){La.clear();bb.clear();$("#workarea").attr("class",
|
||||
e);Xa=I[0]&&I[0].nodeName=="text"?Ua:K;Ga=e};this.getColor=function(e){return Xa[e]};this.setColor=function(e,h,l){K[e]=h;Xa[e+"_paint"]={type:"solidColor"};for(var B=[],A=I.length;A--;){var G=I[A];if(G)if(G.tagName=="g")svgedit.utilities.walkTree(G,function(D){D.nodeName!="g"&&B.push(D)});else if(e=="fill")G.tagName!="polyline"&&G.tagName!="line"&&B.push(G);else B.push(G)}if(B.length>0)if(l)Ab(e,h,B);else{Ya(e,h,B);M("changed",B)}};var gb=function(){var e=m.getElementsByTagNameNS(b,"defs");if(e.length>
|
||||
0)e=e[0];else{e=f.createElementNS(b,"defs");m.firstChild?m.insertBefore(e,m.firstChild.nextSibling):m.appendChild(e)}return e},Nb=this.setGradient=function(e){if(!(!Xa[e+"_paint"]||Xa[e+"_paint"].type=="solidColor")){var h=d[e+"Grad"],l=Mb(h),B=gb();if(l)h=l;else{h=B.appendChild(f.importNode(h,true));h.id=ka()}d.setColor(e,"url(#"+h.id+")");if(e=="canvas")(e=document.getElementById("canvas_background"))&&e.setAttribute("fill","url(#"+h.id+")")}},Mb=function(e){var h=gb();h=$(h).find("linearGradient, radialGradient");
|
||||
for(var l=h.length,B=["r","cx","cy","fx","fy"];l--;){var A=h[l];if(e.tagName=="linearGradient"){if(e.getAttribute("x1")!=A.getAttribute("x1")||e.getAttribute("y1")!=A.getAttribute("y1")||e.getAttribute("x2")!=A.getAttribute("x2")||e.getAttribute("y2")!=A.getAttribute("y2"))continue}else{var G=$(e).attr(B),D=$(A).attr(B),z=false;$.each(B,function(E,H){if(G[H]!=D[H])z=true});if(z)continue}var F=e.getElementsByTagNameNS(b,"stop"),k=A.getElementsByTagNameNS(b,"stop");if(F.length==k.length){for(var n=
|
||||
|
@ -439,19 +439,19 @@ a(k)[0].id+"-list");o||a("#option_lists").append(E);var H=false;o&&a(k).addClass
|
|||
J=w.dropUp;J&&a(k).addClass("dropup");n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!H){E.removeClass("down");n.hide();n.css({top:0,left:0})}H=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");
|
||||
n.hide();n.css({top:0,left:0})}else{E.addClass("down");n.show();H=true;return false}}).hover(function(){H=true}).mouseout(function(){H=false});w.multiclick&&n.mousedown(function(){H=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos",
|
||||
"").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Fa=function(){ra("#tool_rect")&&
|
||||
g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Ga=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")};console.log(C.getNodePoint());var lb=function(){if(X!=null||U)g.deleteSelectedElements();C.getNodePoint()&&C.deletePathNode()},Ua=function(){if(X!=null||U){xa(a("#edit_menu"));
|
||||
g.cutSelectedElements()}},Xa=function(){if(X!=null||U){xa(a("#edit_menu"));g.copySelectedElements()}},wb=function(){xa(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){xa(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){xa(a("#object_menu"));g.moveToBottomSelectedElement()}},eb=function(){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected("Up")}},
|
||||
sb=function(){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ha()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=
|
||||
null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");
|
||||
n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},ca=function(){g.cycleElement(0)},Ea=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ha()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();g.setResolution(k[0],k[1]);G(true);yb();
|
||||
Ha();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ha()},Za=function(){g.setItalic(!g.getItalic());Ha()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;S=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},xa=function(k){var n=k.prev();n.css({background:"white",
|
||||
color:"black"});setTimeout(function(){n.removeAttr("style")},200)},qb=function(){if(s.getUndoStackSize()>0){xa(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>0){xa(a("#edit_menu"));s.redo()}},Bb=function(){if(U){xa(a("#object_menu"));g.groupSelectedElements()}else if(X){xa(a("#object_menu"));g.ungroupSelectedElement()}},Fb=function(){xa(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},
|
||||
La=function(){var k=document.querySelector("#tool_stroke rect");a("#tool_stroke").toggleClass("active");a("#tool_fill").toggleClass("active");var n=document.querySelector("#tool_fill rect"),o=n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=ya(w,k,"stroke");o=ya(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();
|
||||
k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){xa(a("#view_menu"));!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){xa(a("#view_menu"));var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):
|
||||
a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){xa(a("#view_menu"));if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},
|
||||
xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){xa(a("#view_menu"));ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();
|
||||
Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";
|
||||
if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),
|
||||
g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Ga=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements();C.getNodePoint()&&C.deletePathNode()},Ua=function(){if(X!=null||U){xa(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=
|
||||
null||U){xa(a("#edit_menu"));g.copySelectedElements()}},wb=function(){xa(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){xa(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){xa(a("#object_menu"));g.moveToBottomSelectedElement()}},eb=function(){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){xa(a("#object_menu"));
|
||||
g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ha()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,
|
||||
"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=document.getElementById("tool_node_link").checked;console.log(k);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):
|
||||
k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},ca=function(){g.cycleElement(0)},Ea=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ha()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Ha();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());
|
||||
Ha()},Za=function(){g.setItalic(!g.getItalic());Ha()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;S=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},xa=function(k){var n=k.prev();n.css({background:"white",color:"black"});setTimeout(function(){n.removeAttr("style")},200)},
|
||||
qb=function(){if(s.getUndoStackSize()>0){xa(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>0){xa(a("#edit_menu"));s.redo()}},Bb=function(){if(U){xa(a("#object_menu"));g.groupSelectedElements()}else if(X){xa(a("#object_menu"));g.ungroupSelectedElement()}},Fb=function(){xa(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect");
|
||||
a("#tool_stroke").toggleClass("active");a("#tool_fill").toggleClass("active");var n=document.querySelector("#tool_fill rect"),o=n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=ya(w,k,"stroke");o=ya(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();
|
||||
G(true)},Hb=function(){xa(a("#view_menu"));!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){xa(a("#view_menu"));var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");
|
||||
curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){xa(a("#view_menu"));if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+
|
||||
1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){xa(a("#view_menu"));ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,
|
||||
function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=
|
||||
function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),
|
||||
w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=R=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var H="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");H+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=
|
||||
da[k]||da.all;H+=Y+":"+V+";"});H+="}"});E="-"+gb.toLowerCase()+"-";H+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(H)}pa()}},Ab=function(){a("#dialog_box").hide();
|
||||
if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Ba&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[0].scrollTop})})();
|
||||
|
@ -470,7 +470,7 @@ if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.g
|
|||
1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-H+Y*H).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});
|
||||
a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Fa,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Ga,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},
|
||||
{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){if(ea)Kb();else{xa(a("#file_menu"));g.save({images:v.img_save,round_digits:6})}},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},{sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},
|
||||
{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:ob,evt:"click"},{sel:"#tool_node_link",fn:tb,evt:"click"},{sel:"#tool_node_clone",fn:ia,evt:"click"},{sel:"#tool_node_delete",fn:aa,evt:"click"},{sel:"#tool_openclose_path",
|
||||
{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:ob,evt:"click"},{sel:"#tool_node_link",fn:tb,evt:"change"},{sel:"#tool_node_clone",fn:ia,evt:"click"},{sel:"#tool_node_delete",fn:aa,evt:"click"},{sel:"#tool_openclose_path",
|
||||
fn:M,evt:"click"},{sel:"#tool_add_subpath",fn:ka,evt:"click"},{sel:"#tool_move_top",fn:sa,evt:"click",key:u+"shift+up"},{sel:"#tool_move_bottom",fn:hb,evt:"click",key:u+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[u+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[u+"down",true]},{sel:"#tool_topath",fn:ab,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:pb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Fb,evt:"click",key:[u+"D",true]},{sel:"#tool_group",fn:Bb,
|
||||
evt:"click",key:[u+"G",true]},{sel:"#tool_ungroup",fn:Bb,evt:"click",key:u+"shift+G"},{sel:"#tool_unlink_use",fn:Bb,evt:"click"},{sel:"[id^=tool_align]",fn:bb,evt:"click"},{sel:"#tool_undo",fn:qb,evt:"click",key:u+"z"},{sel:"#tool_redo",fn:rb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:Ua,evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",
|
||||
key:[u+"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Ea(0,1)}},{key:"ctrl+right",fn:function(){Ea(1,1)}},{key:"ctrl+shift+left",fn:function(){Ea(0,5)}},{key:"ctrl+shift+right",fn:function(){Ea(1,5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,
|
||||
|
|
|
@ -2455,7 +2455,11 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1),
|
|||
}
|
||||
|
||||
.draginput input[type="checkbox"], .draginput input[type="checkbox"]:hover, .draginput input[type="checkbox"]:active {
|
||||
cursor: default;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.draginput.checkbox {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.draginput.active input, .draginput.active input:hover, .draginput.active input:active {
|
||||
|
|
|
@ -1873,7 +1873,11 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1),
|
|||
}
|
||||
|
||||
.draginput input[type="checkbox"], .draginput input[type="checkbox"]:hover, .draginput input[type="checkbox"]:active {
|
||||
cursor: default;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.draginput.checkbox {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.draginput.active input, .draginput.active input:hover, .draginput.active input:active {
|
||||
|
|
|
@ -388,9 +388,9 @@
|
|||
<label id="seg_type_label">Straight</label>
|
||||
</div>
|
||||
|
||||
<label class="draginput checkbox" id="tool_node_link" data-title="Link Control Points">
|
||||
<label class="draginput checkbox" data-title="Link Control Points">
|
||||
<span>Linked Control Points</span>
|
||||
<div class="push_bottom"><input type="checkbox" checked="checked" /></div>
|
||||
<div class="push_bottom"><input type="checkbox" id="tool_node_link" checked="checked" /></div>
|
||||
</label>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
|
|
@ -2183,7 +2183,7 @@
|
|||
svgCanvas.setMode('path');
|
||||
}
|
||||
};
|
||||
console.log(path.getNodePoint());
|
||||
|
||||
// Delete is a contextual tool that only appears in the ribbon if
|
||||
// an element has been selected
|
||||
var deleteSelected = function() {
|
||||
|
@ -2293,7 +2293,8 @@
|
|||
};
|
||||
|
||||
var linkControlPoints = function() {
|
||||
var linked = !$('#tool_node_link').hasClass('checked');
|
||||
var linked = document.getElementById('tool_node_link').checked;
|
||||
console.log(linked);
|
||||
path.linkControlPoints(linked);
|
||||
}
|
||||
|
||||
|
@ -3253,7 +3254,7 @@
|
|||
{sel:'#tool_source_save', fn: saveSourceEditor, evt: 'click'},
|
||||
{sel:'#tool_delete,#tool_delete_multi', fn: deleteSelected, evt: 'click', key: ['del/backspace', true]},
|
||||
{sel:'#tool_reorient', fn: reorientPath, evt: 'click'},
|
||||
{sel:'#tool_node_link', fn: linkControlPoints, evt: 'click'},
|
||||
{sel:'#tool_node_link', fn: linkControlPoints, evt: 'change'},
|
||||
{sel:'#tool_node_clone', fn: clonePathNode, evt: 'click'},
|
||||
{sel:'#tool_node_delete', fn: deletePathNode, evt: 'click'},
|
||||
{sel:'#tool_openclose_path', fn: opencloseSubPath, evt: 'click'},
|
||||
|
|
|
@ -4625,7 +4625,7 @@ var pathActions = canvas.pathActions = function() {
|
|||
if (drawn_path) {
|
||||
var elem = getElem(getId());
|
||||
$(getElem("path_stretch_line")).remove();
|
||||
$(elem).remove();
|
||||
if (remove) $(elem).remove();
|
||||
$(getElem("pathpointgrip_container")).find('*').attr('display', 'none');
|
||||
drawn_path = firstCtrl = null;
|
||||
started = false;
|
||||
|
@ -6896,7 +6896,8 @@ this.getMode = function() {
|
|||
// Parameters:
|
||||
// name - String with the new mode to change to
|
||||
this.setMode = function(name) {
|
||||
pathActions.clear(true);
|
||||
|
||||
pathActions.clear();
|
||||
textActions.clear();
|
||||
$("#workarea").attr("class", name);
|
||||
cur_properties = (selectedElements[0] && selectedElements[0].nodeName == 'text') ? cur_text : cur_shape;
|
||||
|
|
|
@ -381,7 +381,8 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we
|
|||
#preview_font{font-size:20px;color:#fff;height:70px;line-height:75px;padding:0 0 0 10px;white-space:nowrap;width:100px;overflow:hidden;border-right:solid #2f2f2c 2px;position:relative}
|
||||
#preview_font:after{content:'';position:absolute;right:0;top:3px;bottom:3px;width:15px;border-right:solid #3f3f3c 10px;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIHZpZXdCb3g9IjAgMCAxIDEiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjxsaW5lYXJHcmFkaWVudCBpZD0iZzU4MCIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIwJSIgeTE9IjAlIiB4Mj0iMTAwJSIgeTI9IjAlIj48c3RvcCBzdG9wLWNvbG9yPSIjM2YzZjNjIiBzdG9wLW9wYWNpdHk9IjAiIG9mZnNldD0iMCIvPjxzdG9wIHN0b3AtY29sb3I9IiMzZjNmM2MiIG9mZnNldD0iMC43Ii8+PC9saW5lYXJHcmFkaWVudD48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2c1ODApIiAvPjwvc3ZnPg==)}
|
||||
.draginput input,.draginput input:hover,.draginput input:active{cursor:url(images/drag.png),move;cursor:-webkit-grab;cursor:-moz-grab}
|
||||
.draginput input[type="checkbox"],.draginput input[type="checkbox"]:hover,.draginput input[type="checkbox"]:active{cursor:default}
|
||||
.draginput input[type="checkbox"],.draginput input[type="checkbox"]:hover,.draginput input[type="checkbox"]:active{cursor:pointer}
|
||||
.draginput.checkbox{cursor:pointer}
|
||||
.draginput.active input,.draginput.active input:hover,.draginput.active input:active{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing}
|
||||
.draginput span{font:11px/130% sans-serif;color:#ccc;display:block;position:absolute;top:5px;left:5px;text-align:left}
|
||||
.draginput.error{background:#900}
|
||||
|
|
|
@ -288,7 +288,7 @@ o=svgedit.path.getCtrlLine(1);var J=svgedit.path.getCtrlLine(2);ma(o,{x1:z,y1:F,
|
|||
this.prev){var O=sa.getBBox(),Y=svgedit.path.getGripPt(this);O=svgedit.math.rectsIntersect(O,{x:Y.x,y:Y.y,width:0,height:0});this.select(O);O&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z){if(Ga==="path"){l=null;if(!A){z=pa(aa());Ka=false;B=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");
|
||||
!D.shiftKey&&!G&&svgedit.path.path.selectPt(F)}else if(sa&&sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&La.toSelectMode(D.target)}else La.toSelectMode(D.target);G=false},toEditMode:function(D){svgedit.path.path=svgedit.path.getPath_(D);Ga="pathedit";xa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem;
|
||||
Ga="select";svgedit.path.path.show(false);h=false;xa();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Ga="path";e=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(h===D){La.toEditMode(D);Ga="pathedit"}else h=D},reorient:function(){var D=I[0];if(D)if(na(D)!=0){var z=new Da("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F));
|
||||
xa();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",I)}},clear:function(){h=null;if(A){var D=pa(aa());$(pa("path_stretch_line")).remove();$(D).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Ga=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=R(D),F=X(z).matrix;
|
||||
xa();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",I)}},clear:function(D){h=null;if(A){var z=pa(aa());$(pa("path_stretch_line")).remove();D&&$(z).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Ga=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=R(D),F=X(z).matrix;
|
||||
z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var k=z.numberOfItems,n=0;n<k;++n){var o=z.getItem(n),w=o.pathSegType;if(w!=1){var E=[];$.each(["",1,2],function(H,J){var O=o["x"+J],Y=o["y"+J];if(O!==undefined&&Y!==undefined){O=N(O,Y,F);E.splice(E.length,0,O.x,O.y)}});svgedit.path.replacePathSeg(w,n,E,D)}}g(D,F)},zoomChange:function(){Ga=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){if(svgedit.path.path){var D=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?
|
||||
svgedit.path.path.selected_pts[0]:1];return{x:D.item.x,y:D.item.y,type:D.type}}},linkControlPoints:function(D){svgedit.path.setLinkControlPoints(D)},clonePathNode:function(){svgedit.path.path.storeD();for(var D=svgedit.path.path.selected_pts,z=D.length,F=[];z--;){var k=D[z];svgedit.path.path.addSeg(k);F.push(k+z);F.push(k+z+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var D=svgedit.path.path.selected_pts;if(D.length===
|
||||
1){var z=svgedit.path.path.elem,F=z.pathSegList,k=D[0],n=null,o=null;svgedit.path.path.eachSeg(function(J){if(this.type===2&&J<=k)o=this.item;if(J<=k)return true;if(this.type===2){n=J;return false}else if(this.type===1)return n=false});if(n==null)n=svgedit.path.path.segs.length-1;if(n!==false){var w=z.createSVGPathSegLinetoAbs(o.x,o.y),E=z.createSVGPathSegClosePath();if(n==svgedit.path.path.segs.length){F.appendItem(w);F.appendItem(E)}else{svgedit.path.insertItemBefore(z,E,n);svgedit.path.insertItemBefore(z,
|
||||
|
@ -336,7 +336,7 @@ e}else{l=f.createElementNS(b,"title");l.textContent=e;$(h).prepend(l);B.addSubCo
|
|||
A.addSubCommand(new Ma(l,{"#text":B}));wa(A)};this.getEditorNS=function(e){e&&m.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,h){var l=zb(),B=l.w;l=l.h;var A;if(e=="fit"){var G=getStrokedBBox();if(G){A=new Da("Fit Canvas to Content");var D=pb();qb(D);var z=[],F=[];$.each(D,function(){z.push(G.x*-1);F.push(G.y*-1)});D=d.moveSelectedElements(z,F,true);A.addSubCommand(D);xa();e=Math.round(G.width);h=Math.round(G.height)}else return false}if(e!=
|
||||
B||h!=l){D=c.suspendRedraw(1E3);A||(A=new Da("Change Image Dimensions"));e=Ba("width",e);h=Ba("height",h);m.setAttribute("width",e);m.setAttribute("height",h);this.contentW=e;this.contentH=h;A.addSubCommand(new Ma(m,{width:B,height:l}));m.setAttribute("viewBox",[0,0,e/s,h/s].join(" "));A.addSubCommand(new Ma(m,{viewBox:["0 0",B,l].join(" ")}));wa(A);c.unsuspendRedraw(D);if(background=document.getElementById("canvas_background")){background.setAttribute("x",-1);background.setAttribute("y",-1);background.setAttribute("width",
|
||||
e+2);background.setAttribute("height",h+2)}M("changed",[m])}return[e,h]};this.getOffset=function(){return $(m).attr(["x","y"])};this.setBBoxZoom=function(e,h,l){var B=0.85,A=function(G){if(!G)return false;var D=Math.min(Math.round(h/G.width*100*B)/100,Math.round(l/G.height*100*B)/100);d.setZoom(D);return{zoom:D,bbox:G}};if(typeof e=="object"){e=e;if(e.width==0||e.height==0){d.setZoom(e.zoom?e.zoom:s*e.factor);return{zoom:s,bbox:e}}return A(e)}switch(e){case "selection":if(!I[0])return;e=$.map(I,function(G){if(G)return G});
|
||||
e=getStrokedBBox(e);break;case "canvas":e=zb();B=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(pb(C().getCurrentLayer()));break;default:return}return A(e)};this.setZoom=function(e){var h=zb();m.setAttribute("viewBox","0 0 "+h.w/e+" "+h.h/e);s=e;$.each(I,function(l,B){B&&ra.requestSelector(B).resize()});La.zoomChange();ib("zoomChanged",e)};this.getMode=function(){return Ga};this.setMode=function(e){La.clear(true);bb.clear();$("#workarea").attr("class",
|
||||
e=getStrokedBBox(e);break;case "canvas":e=zb();B=0.95;e={width:e.w,height:e.h,x:0,y:0};break;case "content":e=getStrokedBBox();break;case "layer":e=getStrokedBBox(pb(C().getCurrentLayer()));break;default:return}return A(e)};this.setZoom=function(e){var h=zb();m.setAttribute("viewBox","0 0 "+h.w/e+" "+h.h/e);s=e;$.each(I,function(l,B){B&&ra.requestSelector(B).resize()});La.zoomChange();ib("zoomChanged",e)};this.getMode=function(){return Ga};this.setMode=function(e){La.clear();bb.clear();$("#workarea").attr("class",
|
||||
e);Xa=I[0]&&I[0].nodeName=="text"?Ua:K;Ga=e};this.getColor=function(e){return Xa[e]};this.setColor=function(e,h,l){K[e]=h;Xa[e+"_paint"]={type:"solidColor"};for(var B=[],A=I.length;A--;){var G=I[A];if(G)if(G.tagName=="g")svgedit.utilities.walkTree(G,function(D){D.nodeName!="g"&&B.push(D)});else if(e=="fill")G.tagName!="polyline"&&G.tagName!="line"&&B.push(G);else B.push(G)}if(B.length>0)if(l)Ab(e,h,B);else{Ya(e,h,B);M("changed",B)}};var gb=function(){var e=m.getElementsByTagNameNS(b,"defs");if(e.length>
|
||||
0)e=e[0];else{e=f.createElementNS(b,"defs");m.firstChild?m.insertBefore(e,m.firstChild.nextSibling):m.appendChild(e)}return e},Nb=this.setGradient=function(e){if(!(!Xa[e+"_paint"]||Xa[e+"_paint"].type=="solidColor")){var h=d[e+"Grad"],l=Mb(h),B=gb();if(l)h=l;else{h=B.appendChild(f.importNode(h,true));h.id=ka()}d.setColor(e,"url(#"+h.id+")");if(e=="canvas")(e=document.getElementById("canvas_background"))&&e.setAttribute("fill","url(#"+h.id+")")}},Mb=function(e){var h=gb();h=$(h).find("linearGradient, radialGradient");
|
||||
for(var l=h.length,B=["r","cx","cy","fx","fy"];l--;){var A=h[l];if(e.tagName=="linearGradient"){if(e.getAttribute("x1")!=A.getAttribute("x1")||e.getAttribute("y1")!=A.getAttribute("y1")||e.getAttribute("x2")!=A.getAttribute("x2")||e.getAttribute("y2")!=A.getAttribute("y2"))continue}else{var G=$(e).attr(B),D=$(A).attr(B),z=false;$.each(B,function(E,H){if(G[H]!=D[H])z=true});if(z)continue}var F=e.getElementsByTagNameNS(b,"stop"),k=A.getElementsByTagNameNS(b,"stop");if(F.length==k.length){for(var n=
|
||||
|
@ -439,19 +439,19 @@ a(k)[0].id+"-list");o||a("#option_lists").append(E);var H=false;o&&a(k).addClass
|
|||
J=w.dropUp;J&&a(k).addClass("dropup");n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!H){E.removeClass("down");n.hide();n.css({top:0,left:0})}H=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");
|
||||
n.hide();n.css({top:0,left:0})}else{E.addClass("down");n.show();H=true;return false}}).hover(function(){H=true}).mouseout(function(){H=false});w.multiclick&&n.mousedown(function(){H=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos",
|
||||
"").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Fa=function(){ra("#tool_rect")&&
|
||||
g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Ga=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")};console.log(C.getNodePoint());var lb=function(){if(X!=null||U)g.deleteSelectedElements();C.getNodePoint()&&C.deletePathNode()},Ua=function(){if(X!=null||U){xa(a("#edit_menu"));
|
||||
g.cutSelectedElements()}},Xa=function(){if(X!=null||U){xa(a("#edit_menu"));g.copySelectedElements()}},wb=function(){xa(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){xa(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){xa(a("#object_menu"));g.moveToBottomSelectedElement()}},eb=function(){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected("Up")}},
|
||||
sb=function(){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ha()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=
|
||||
null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");
|
||||
n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},ca=function(){g.cycleElement(0)},Ea=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ha()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();g.setResolution(k[0],k[1]);G(true);yb();
|
||||
Ha();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Ha()},Za=function(){g.setItalic(!g.getItalic());Ha()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;S=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},xa=function(k){var n=k.prev();n.css({background:"white",
|
||||
color:"black"});setTimeout(function(){n.removeAttr("style")},200)},qb=function(){if(s.getUndoStackSize()>0){xa(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>0){xa(a("#edit_menu"));s.redo()}},Bb=function(){if(U){xa(a("#object_menu"));g.groupSelectedElements()}else if(X){xa(a("#object_menu"));g.ungroupSelectedElement()}},Fb=function(){xa(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},
|
||||
La=function(){var k=document.querySelector("#tool_stroke rect");a("#tool_stroke").toggleClass("active");a("#tool_fill").toggleClass("active");var n=document.querySelector("#tool_fill rect"),o=n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=ya(w,k,"stroke");o=ya(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();
|
||||
k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){xa(a("#view_menu"));!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){xa(a("#view_menu"));var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):
|
||||
a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){xa(a("#view_menu"));if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},
|
||||
xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){xa(a("#view_menu"));ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();
|
||||
Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";
|
||||
if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),
|
||||
g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();oa()}},Ga=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements();C.getNodePoint()&&C.deletePathNode()},Ua=function(){if(X!=null||U){xa(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=
|
||||
null||U){xa(a("#edit_menu"));g.copySelectedElements()}},wb=function(){xa(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){xa(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){xa(a("#object_menu"));g.moveToBottomSelectedElement()}},eb=function(){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){xa(a("#object_menu"));
|
||||
g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){xa(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Ha()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,
|
||||
"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=document.getElementById("tool_node_link").checked;console.log(k);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):
|
||||
k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},ca=function(){g.cycleElement(0)},Ea=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Ha()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){oa();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Ha();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());
|
||||
Ha()},Za=function(){g.setItalic(!g.getItalic());Ha()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;S=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},xa=function(k){var n=k.prev();n.css({background:"white",color:"black"});setTimeout(function(){n.removeAttr("style")},200)},
|
||||
qb=function(){if(s.getUndoStackSize()>0){xa(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>0){xa(a("#edit_menu"));s.redo()}},Bb=function(){if(U){xa(a("#object_menu"));g.groupSelectedElements()}else if(X){xa(a("#object_menu"));g.ungroupSelectedElement()}},Fb=function(){xa(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect");
|
||||
a("#tool_stroke").toggleClass("active");a("#tool_fill").toggleClass("active");var n=document.querySelector("#tool_fill rect"),o=n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=ya(w,k,"stroke");o=ya(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();
|
||||
G(true)},Hb=function(){xa(a("#view_menu"));!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){xa(a("#view_menu"));var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");
|
||||
curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){xa(a("#view_menu"));if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+
|
||||
1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){xa(a("#view_menu"));ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,
|
||||
function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});oa()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=
|
||||
function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),
|
||||
w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=R=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var H="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");H+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=
|
||||
da[k]||da.all;H+=Y+":"+V+";"});H+="}"});E="-"+gb.toLowerCase()+"-";H+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(H)}pa()}},Ab=function(){a("#dialog_box").hide();
|
||||
if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Ba&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[0].scrollTop})})();
|
||||
|
@ -470,7 +470,7 @@ if(!g.setResolution(o,w)){a.alert(uiStrings.notification.noContentToFitTo);o=g.g
|
|||
1,3)+1;k.value=(w[0]-E+Y*E).toFixed(0);n.value=(w[1]-H+Y*H).toFixed(0);l();if(Y>=1){Y=g.getResolution();a("#canvas_width").val(Y.w.toFixed());a("#canvas_height").val(Y.h.toFixed());a("#resolution_label").html("<div class='pull'>"+Y.w+"<span>\u00d7</span></br>"+Y.h+"</div>")}else requestAnimationFrame(O)};O(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;n.value=100}}});a("#zoom").change(function(){wa(this)});
|
||||
a("input,select").attr("autocomplete","off");var B=function(){var k=[{sel:"#tool_select",fn:cb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Ta,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Va,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Fa,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:ta,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:db,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Ga,evt:"click",key:["T",true]},{sel:"#tool_image",fn:$a,evt:"mouseup"},
|
||||
{sel:"#tool_zoom",fn:Ka,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Oa,evt:"mouseup",key:[u+"N",true]},{sel:"#tool_save",fn:function(){if(ea)Kb();else{xa(a("#file_menu"));g.save({images:v.img_save,round_digits:6})}},evt:"mouseup",key:[u+"S",true]},{sel:"#tool_export",fn:nb,evt:"mouseup"},{sel:"#tool_open",fn:Ra,evt:"mouseup"},{sel:"#tool_import",fn:mb,evt:"mouseup"},{sel:"#tool_source",fn:Eb,evt:"click",key:[u+"U",true]},{sel:"#tool_wireframe",fn:Hb,evt:"click"},{sel:"#tool_snap",fn:Gb,evt:"click"},
|
||||
{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:ob,evt:"click"},{sel:"#tool_node_link",fn:tb,evt:"click"},{sel:"#tool_node_clone",fn:ia,evt:"click"},{sel:"#tool_node_delete",fn:aa,evt:"click"},{sel:"#tool_openclose_path",
|
||||
{sel:"#tool_rulers",fn:Lb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:Ab,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Kb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:lb,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:ob,evt:"click"},{sel:"#tool_node_link",fn:tb,evt:"change"},{sel:"#tool_node_clone",fn:ia,evt:"click"},{sel:"#tool_node_delete",fn:aa,evt:"click"},{sel:"#tool_openclose_path",
|
||||
fn:M,evt:"click"},{sel:"#tool_add_subpath",fn:ka,evt:"click"},{sel:"#tool_move_top",fn:sa,evt:"click",key:u+"shift+up"},{sel:"#tool_move_bottom",fn:hb,evt:"click",key:u+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[u+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[u+"down",true]},{sel:"#tool_topath",fn:ab,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:pb,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Fb,evt:"click",key:[u+"D",true]},{sel:"#tool_group",fn:Bb,
|
||||
evt:"click",key:[u+"G",true]},{sel:"#tool_ungroup",fn:Bb,evt:"click",key:u+"shift+G"},{sel:"#tool_unlink_use",fn:Bb,evt:"click"},{sel:"[id^=tool_align]",fn:bb,evt:"click"},{sel:"#tool_undo",fn:qb,evt:"click",key:u+"z"},{sel:"#tool_redo",fn:rb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:Ua,evt:"click",key:[u+"x",true]},{sel:"#tool_copy",fn:Xa,evt:"click",key:u+"c"},{sel:"#tool_paste",fn:wb,evt:"click",key:u+"v"},{sel:"#tool_switch",fn:La,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Wa,evt:"mousedown",
|
||||
key:[u+"B",true]},{sel:"#tool_italic",fn:Za,evt:"mousedown",key:[u+"I",true]},{sel:"#copy_save_done",fn:Ab,evt:"click"},{key:"ctrl+left",fn:function(){Ea(0,1)}},{key:"ctrl+right",fn:function(){Ea(1,1)}},{key:"ctrl+shift+left",fn:function(){Ea(0,5)}},{key:"ctrl+shift+right",fn:function(){Ea(1,5)}},{key:"shift+O",fn:ca},{key:"shift+P",fn:P},{key:[u+"+",true],fn:function(){yb(2)}},{key:[u+"-",true],fn:function(){yb(0.5)}},{key:["up",true],fn:function(){fb(0,-1)}},{key:["down",true],fn:function(){fb(0,
|
||||
|
|
|
@ -2455,7 +2455,11 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1),
|
|||
}
|
||||
|
||||
.draginput input[type="checkbox"], .draginput input[type="checkbox"]:hover, .draginput input[type="checkbox"]:active {
|
||||
cursor: default;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.draginput.checkbox {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.draginput.active input, .draginput.active input:hover, .draginput.active input:active {
|
||||
|
|
Loading…
Reference in New Issue