font preview now updated on click
parent
69bd85b3ce
commit
5507eb4584
|
@ -1544,6 +1544,7 @@
|
||||||
$('#font_family').val(font_family);
|
$('#font_family').val(font_family);
|
||||||
$('#font_size').val(elem.getAttribute("font-size"));
|
$('#font_size').val(elem.getAttribute("font-size"));
|
||||||
$('#text').val(elem.textContent);
|
$('#text').val(elem.textContent);
|
||||||
|
$('#preview_font').text(font_family.split(",")[0]).css('font-family', font_family);
|
||||||
if (svgCanvas.addedNew) {
|
if (svgCanvas.addedNew) {
|
||||||
// Timeout needed for IE9
|
// Timeout needed for IE9
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
|
@ -2374,10 +2374,10 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
||||||
var right_click = evt.button === 2;
|
var right_click = evt.button === 2;
|
||||||
|
|
||||||
root_sctm = svgcontent.getScreenCTM().inverse();
|
root_sctm = svgcontent.getScreenCTM().inverse();
|
||||||
|
isBotchedZoom = svgedit.browser.isGecko();
|
||||||
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
||||||
mouse_x = pt.x * current_zoom,
|
mouse_x = pt.x * (isBotchedZoom ? 1 : current_zoom),
|
||||||
mouse_y = pt.y * current_zoom;
|
mouse_y = pt.y * (isBotchedZoom ? 1 : current_zoom);
|
||||||
|
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
|
@ -2733,8 +2733,8 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
||||||
if(evt.button === 1 || canvas.spaceKey) return;
|
if(evt.button === 1 || canvas.spaceKey) return;
|
||||||
var selected = selectedElements[0],
|
var selected = selectedElements[0],
|
||||||
pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
||||||
mouse_x = pt.x * current_zoom,
|
mouse_x = pt.x * (isBotchedZoom ? 1 : current_zoom),
|
||||||
mouse_y = pt.y * current_zoom,
|
mouse_y = pt.y * (isBotchedZoom ? 1 : current_zoom),
|
||||||
shape = getElem(getId());
|
shape = getElem(getId());
|
||||||
|
|
||||||
var real_x = x = mouse_x / current_zoom;
|
var real_x = x = mouse_x / current_zoom;
|
||||||
|
|
|
@ -242,62 +242,62 @@ A.points=Array(F);for(I=0;I<F;++I){E=w.getItem(I);A.points[I]={x:E.x,y:E.y}}}cas
|
||||||
J)},vb=this.addToSelection=function(e,h){if(e.length!=0){for(var m=0;m<J.length;){if(J[m]==null)break;++m}for(var z=e.length;z--;){var w=e[z];if(w&&svgedit.utilities.getBBox(w)){if(w.tagName==="a"&&w.childNodes.length===1)w=w.firstChild;if(J.indexOf(w)==-1){J[m]=w;m++;w=Ha.requestSelector(w);J.length>1&&w.showGrips(false)}}}M("selected",J);h||J.length==1?Ha.requestSelector(J[0]).showGrips(true):Ha.requestSelector(J[0]).showGrips(false);for(J.sort(function(H,A){if(H&&A&&H.compareDocumentPosition)return 3-
|
J)},vb=this.addToSelection=function(e,h){if(e.length!=0){for(var m=0;m<J.length;){if(J[m]==null)break;++m}for(var z=e.length;z--;){var w=e[z];if(w&&svgedit.utilities.getBBox(w)){if(w.tagName==="a"&&w.childNodes.length===1)w=w.firstChild;if(J.indexOf(w)==-1){J[m]=w;m++;w=Ha.requestSelector(w);J.length>1&&w.showGrips(false)}}}M("selected",J);h||J.length==1?Ha.requestSelector(J[0]).showGrips(true):Ha.requestSelector(J[0]).showGrips(false);for(J.sort(function(H,A){if(H&&A&&H.compareDocumentPosition)return 3-
|
||||||
(A.compareDocumentPosition(H)&6);else if(H==null)return 1});J[0]==null;)J.shift(0)}},xb=this.selectOnly=function(e,h){Qa(true);vb(e,h)};this.removeFromSelection=function(e){if(J[0]!=null)if(e.length!=0){var h=Array(J.length);j=0;len=J.length;for(var m=0;m<len;++m){var z=J[m];if(z)if(e.indexOf(z)==-1){h[j]=z;j++}else Ha.releaseSelector(z)}J=h}};this.selectAllInCurrentLayer=function(){var e=B().getCurrentLayer();if(e){Ea="select";xb($(K||e).children())}};var Ib=this.getMouseTarget=function(e){if(e==
|
(A.compareDocumentPosition(H)&6);else if(H==null)return 1});J[0]==null;)J.shift(0)}},xb=this.selectOnly=function(e,h){Qa(true);vb(e,h)};this.removeFromSelection=function(e){if(J[0]!=null)if(e.length!=0){var h=Array(J.length);j=0;len=J.length;for(var m=0;m<len;++m){var z=J[m];if(z)if(e.indexOf(z)==-1){h[j]=z;j++}else Ha.releaseSelector(z)}J=h}};this.selectAllInCurrentLayer=function(){var e=B().getCurrentLayer();if(e){Ea="select";xb($(K||e).children())}};var Ib=this.getMouseTarget=function(e){if(e==
|
||||||
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,l,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ha.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,m=null,z=
|
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,l,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ha.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,m=null,z=
|
||||||
null,w=null,H={},A={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches>1)){var F=v.button===2;rb=l.getScreenCTM().inverse();var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;v.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(v);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=E,k=w=m=I;if(n.gridSnapping){E=wa(E);I=wa(I);h=wa(h);m=wa(m)}if(G==Ha.selectorParentGroup&&J[0]!=null){G=v.target;var u=ib(G,"type");
|
null,w=null,H={},A={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches>1)){var F=v.button===2;rb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);v.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(v);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=E,k=w=m=I;if(n.gridSnapping){E=wa(E);I=wa(I);h=wa(h);m=wa(m)}if(G==
|
||||||
if(u=="rotate"){Ea="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ea="resize";kb=ib(G,"dir")}G=J[0]}Va=G.getAttribute("transform");u=V(G);switch(Ea){case "select":La=true;kb="none";if(F)La=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Qa(true);vb([G]);Cb=G;Ja.clear()}if(!F)for(F=0;F<J.length;++F)if(J[F]!=null){var C=V(J[F]);C.numberOfItems?C.insertItemBefore(d.createSVGTransform(),0):C.appendItem(d.createSVGTransform())}}else if(!F){Qa();Ea="multiselect";if(ua==null)ua=Ha.getRubberBandBox();
|
Ha.selectorParentGroup&&J[0]!=null){G=v.target;var u=ib(G,"type");if(u=="rotate"){Ea="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ea="resize";kb=ib(G,"dir")}G=J[0]}Va=G.getAttribute("transform");u=V(G);switch(Ea){case "select":La=true;kb="none";if(F)La=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Qa(true);vb([G]);Cb=G;Ja.clear()}if(!F)for(F=0;F<J.length;++F)if(J[F]!=null){var C=V(J[F]);C.numberOfItems?C.insertItemBefore(d.createSVGTransform(),0):C.appendItem(d.createSVGTransform())}}else if(!F){Qa();
|
||||||
z*=o;w*=o;ma(ua,{x:z,y:w,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:L*o,y:L*o,width:0,height:0,display:"inline"},100);break;case "resize":La=true;h=E;m=I;H=svgedit.utilities.getBBox($("#selectedBox0")[0]);var D={};$.each(H,function(P,U){D[P]=U/o});H=D;F=oa(G)?1:0;if(pa(u)){u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F)}else{u.appendItem(d.createSVGTransform());
|
Ea="multiselect";if(ua==null)ua=Ha.getRubberBandBox();z*=o;w*=o;ma(ua,{x:z,y:w,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:L*o,y:L*o,width:0,height:0,display:"inline"},100);break;case "resize":La=true;h=E;m=I;H=svgedit.utilities.getBBox($("#selectedBox0")[0]);var D={};$.each(H,function(P,U){D[P]=U/o});H=D;F=oa(G)?1:0;if(pa(u)){u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),
|
||||||
u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(E=svgedit.browser.isChrome())C=function(P){var U=P.getAttributeNS(null,"stroke");P.removeAttributeNS(null,"stroke");setTimeout(function(){P.setAttributeNS(null,"stroke",U)},1)};G.style.vectorEffect="non-scaling-stroke";E&&C(G);I=G.getElementsByTagName("*");L=I.length;for(F=0;F<L;F++){I[F].style.vectorEffect="non-scaling-stroke";E&&C(I[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=
|
F)}else{u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(E=svgedit.browser.isChrome())C=function(P){var U=P.getAttributeNS(null,"stroke");P.removeAttributeNS(null,"stroke");setTimeout(function(){P.setAttributeNS(null,"stroke",U)},1)};G.style.vectorEffect="non-scaling-stroke";E&&C(G);I=G.getElementsByTagName("*");L=I.length;for(F=0;F<L;F++){I[F].style.vectorEffect="non-scaling-stroke";E&&
|
||||||
true;e=L+","+k+" ";C=N.stroke_width==0?1:N.stroke_width;R({element:"polyline",curStyles:true,attr:{points:e,id:ja(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});A.minx=L;A.maxx=L;A.miny=k;A.maxy=k;break;case "image":La=true;C=R({element:"image",attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2,style:"pointer-events:inherit"}});W(C,Da);pb(C);break;case "square":case "rect":La=true;h=E;m=I;R({element:"rect",curStyles:true,attr:{x:E,y:I,width:0,height:0,
|
C(I[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=L+","+k+" ";C=N.stroke_width==0?1:N.stroke_width;R({element:"polyline",curStyles:true,attr:{points:e,id:ja(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});A.minx=L;A.maxx=L;A.miny=k;A.maxy=k;break;case "image":La=true;C=R({element:"image",attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2,style:"pointer-events:inherit"}});W(C,Da);pb(C);break;case "square":case "rect":La=true;h=
|
||||||
id:ja(),opacity:N.opacity/2}});break;case "line":La=true;C=N.stroke_width==0?1:N.stroke_width;R({element:"line",curStyles:true,attr:{x1:E,y1:I,x2:E,y2:I,id:ja(),stroke:N.stroke,"stroke-width":C,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;R({element:"circle",curStyles:true,attr:{cx:E,cy:I,r:0,id:ja(),opacity:N.opacity/
|
E;m=I;R({element:"rect",curStyles:true,attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2}});break;case "line":La=true;C=N.stroke_width==0?1:N.stroke_width;R({element:"line",curStyles:true,attr:{x1:E,y1:I,x2:E,y2:I,id:ja(),stroke:N.stroke,"stroke-width":C,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;R({element:"circle",
|
||||||
2}});break;case "ellipse":La=true;R({element:"ellipse",curStyles:true,attr:{cx:E,cy:I,rx:0,ry:0,id:ja(),opacity:N.opacity/2}});break;case "text":La=true;R({element:"text",curStyles:true,attr:{x:E,y:I,id:ja(),fill:Za.fill,"stroke-width":Za.stroke_width,"font-size":Za.font_size,"font-family":Za.font_family,"text-anchor":"left","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=o;m*=o;Ja.mouseDown(v,G,h,m);La=true;break;case "textedit":h*=o;m*=o;hb.mouseDown(v,G,h,m);La=
|
curStyles:true,attr:{cx:E,cy:I,r:0,id:ja(),opacity:N.opacity/2}});break;case "ellipse":La=true;R({element:"ellipse",curStyles:true,attr:{cx:E,cy:I,rx:0,ry:0,id:ja(),opacity:N.opacity/2}});break;case "text":La=true;R({element:"text",curStyles:true,attr:{x:E,y:I,id:ja(),fill:Za.fill,"stroke-width":Za.stroke_width,"font-size":Za.font_size,"font-family":Za.font_family,"text-anchor":"left","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=o;m*=o;Ja.mouseDown(v,G,h,m);La=
|
||||||
true;break;case "rotate":La=true;b.undoMgr.beginUndoableChange("transform",J);document.getElementById("workarea").className="rotate"}C=ob("mouseDown",{event:v,start_x:h,start_y:m,selectedElements:J},true);$.each(C,function(P,U){if(U&&U.started)La=true});if(Ea)document.getElementById("workarea").className=Ea=="resize"?v.target.style.cursor:Ea}}).mousemove(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches.length>1))if(La)if(!(v.button===1||b.spaceKey)){var F=J[0],I=O(v.pageX,v.pageY,
|
true;break;case "textedit":h*=o;m*=o;hb.mouseDown(v,G,h,m);La=true;break;case "rotate":La=true;b.undoMgr.beginUndoableChange("transform",J);document.getElementById("workarea").className="rotate"}C=ob("mouseDown",{event:v,start_x:h,start_y:m,selectedElements:J},true);$.each(C,function(P,U){if(U&&U.started)La=true});if(Ea)document.getElementById("workarea").className=Ea=="resize"?v.target.style.cursor:Ea}}).mousemove(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches.length>1))if(La)if(!(v.button===
|
||||||
rb),E=I.x*o;I=I.y*o;var G=qa(ca()),L=x=E/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ea){case "select":if(J[0]!==null){L=x-h;var u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=ba(h,m,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k<C;++k){F=J[k];if(F==null)break;var D=d.createSVGTransform();G=V(F);D.setTranslate(L,u);G.numberOfItems?G.replaceItem(D,0):G.appendItem(D);Ha.requestSelector(F).resize()}if(v.altKey)if(!b.addClones){b.addClones=b.cloneSelectedElements(0,
|
1||b.spaceKey)){var F=J[0],I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);var G=qa(ca()),L=x=E/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ea){case "select":if(J[0]!==null){L=x-h;var u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=ba(h,m,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k<C;++k){F=J[k];if(F==null)break;var D=d.createSVGTransform();G=V(F);D.setTranslate(L,u);G.numberOfItems?G.replaceItem(D,0):G.appendItem(D);Ha.requestSelector(F).resize()}if(v.altKey)if(!b.addClones){b.addClones=
|
||||||
0,D);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(Oa){Oa.parentNode&&Oa.parentNode.removeChild(Oa);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}M("transition",J)}}break;case "multiselect":L*=o;k*=o;ma(ua,{x:Math.min(z,L),y:Math.min(w,k),width:Math.abs(L-z),height:Math.abs(k-w)},100);G=[];L=[];D=tb();C=J.length;for(k=0;k<C;++k){u=D.indexOf(J[k]);if(u==-1)G.push(J[k]);else D[u]=null}C=D.length;for(k=0;k<C;++k)D[k]&&L.push(D[k]);G.length>0&&b.removeFromSelection(G);
|
b.cloneSelectedElements(0,0,D);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(Oa){Oa.parentNode&&Oa.parentNode.removeChild(Oa);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}M("transition",J)}}break;case "multiselect":L*=o;k*=o;ma(ua,{x:Math.min(z,L),y:Math.min(w,k),width:Math.abs(L-z),height:Math.abs(k-w)},100);G=[];L=[];D=tb();C=J.length;for(k=0;k<C;++k){u=D.indexOf(J[k]);if(u==-1)G.push(J[k]);else D[u]=null}C=D.length;for(k=0;k<C;++k)D[k]&&L.push(D[k]);
|
||||||
L.length>0&&vb(L);break;case "resize":G=V(F);L=(D=pa(G))?H:svgedit.utilities.getBBox(F);C=L.x;k=L.y;var P=L.width,U=L.height;L=x-h;u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u);U=wa(U);P=wa(P)}var S=oa(F);if(S){var Y=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-S*Math.PI/180;L=Y*Math.cos(u);u=Y*Math.sin(u)}if(kb.indexOf("n")==-1&&kb.indexOf("s")==-1)u=0;if(kb.indexOf("e")==-1&&kb.indexOf("w")==-1)L=0;var aa=Y=0,ga=U?(U+u)/U:1,ra=P?(P+L)/P:1;if(kb.indexOf("n")>=0){ga=U?(U-u)/U:1;aa=U}if(kb.indexOf("w")>=0){ra=
|
G.length>0&&b.removeFromSelection(G);L.length>0&&vb(L);break;case "resize":G=V(F);L=(D=pa(G))?H:svgedit.utilities.getBBox(F);C=L.x;k=L.y;var P=L.width,U=L.height;L=x-h;u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u);U=wa(U);P=wa(P)}var S=oa(F);if(S){var Y=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-S*Math.PI/180;L=Y*Math.cos(u);u=Y*Math.sin(u)}if(kb.indexOf("n")==-1&&kb.indexOf("s")==-1)u=0;if(kb.indexOf("e")==-1&&kb.indexOf("w")==-1)L=0;var aa=Y=0,ga=U?(U+u)/U:1,ra=P?(P+L)/P:1;if(kb.indexOf("n")>=0){ga=U?(U-u)/
|
||||||
P?(P-L)/P:1;Y=P}L=d.createSVGTransform();u=d.createSVGTransform();P=d.createSVGTransform();if(n.gridSnapping){C=wa(C);Y=wa(Y);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+Y),-(k+aa));if(v.shiftKey)if(ra==1)ra=ga;else ga=ra;u.setScale(ra,ga);P.setTranslate(C+Y,k+aa);if(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(u,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(u,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).resize();M("transition",J);break;case "zoom":L*=o;k*=o;ma(ua,
|
U:1;aa=U}if(kb.indexOf("w")>=0){ra=P?(P-L)/P:1;Y=P}L=d.createSVGTransform();u=d.createSVGTransform();P=d.createSVGTransform();if(n.gridSnapping){C=wa(C);Y=wa(Y);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+Y),-(k+aa));if(v.shiftKey)if(ra==1)ra=ga;else ga=ra;u.setScale(ra,ga);P.setTranslate(C+Y,k+aa);if(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(u,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(u,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).resize();M("transition",
|
||||||
{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}D=x;C=y;if(v.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea=="square"||v.shiftKey){L=D=Math.max(L,
|
J);break;case "zoom":L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}D=x;C=y;if(v.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea==
|
||||||
D);C=h<x?h:h-L;k=m<y?m:m-D}else{C=Math.min(h,x);k=Math.min(m,y)}if(v.altKey){L*=2;D*=2;C=h-L/2;k=m-D/2}if(n.gridSnapping){L=wa(L);D=wa(D);C=wa(C);k=wa(k)}ma(G,{width:L,height:D,x:C,y:k},1E3);break;case "circle":L=$(G).attr(["cx","cy"]);D=L.cx;C=L.cy;L=Math.sqrt((x-D)*(x-D)+(y-C)*(y-C));if(n.gridSnapping)L=wa(L);G.setAttributeNS(null,"r",L);break;case "ellipse":L=$(G).attr(["cx","cy"]);D=Math.abs(h+(x-h)/2);C=Math.abs(m+(y-m)/2);L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);
|
"square"||v.shiftKey){L=D=Math.max(L,D);C=h<x?h:h-L;k=m<y?m:m-D}else{C=Math.min(h,x);k=Math.min(m,y)}if(v.altKey){L*=2;D*=2;C=h-L/2;k=m-D/2}if(n.gridSnapping){L=wa(L);D=wa(D);C=wa(C);k=wa(k)}ma(G,{width:L,height:D,x:C,y:k},1E3);break;case "circle":L=$(G).attr(["cx","cy"]);D=L.cx;C=L.cy;L=Math.sqrt((x-D)*(x-D)+(y-C)*(y-C));if(n.gridSnapping)L=wa(L);G.setAttributeNS(null,"r",L);break;case "ellipse":L=$(G).attr(["cx","cy"]);D=Math.abs(h+(x-h)/2);C=Math.abs(m+(y-m)/2);L=null;window.opera||d.suspendRedraw(1E3);
|
||||||
D=wa(D);y=wa(y);C=wa(C)}k=Math.abs(h-D);u=Math.abs(m-C);if(v.shiftKey){u=k;C=y>m?m+k:m-k}if(v.altKey){D=h;C=m;k=Math.abs(x-D);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);G.setAttributeNS(null,"cx",D);G.setAttributeNS(null,"cy",C);window.opera||d.unsuspendRedraw(L);break;case "fhellipse":case "fhrect":A.minx=Math.min(L,A.minx);A.maxx=Math.max(L,A.maxx);A.miny=Math.min(k,A.miny);A.maxy=Math.max(k,A.maxy);case "fhpath":e+=+L+","+k+" ";G.setAttributeNS(null,
|
if(n.gridSnapping){x=wa(x);D=wa(D);y=wa(y);C=wa(C)}k=Math.abs(h-D);u=Math.abs(m-C);if(v.shiftKey){u=k;C=y>m?m+k:m-k}if(v.altKey){D=h;C=m;k=Math.abs(x-D);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);G.setAttributeNS(null,"cx",D);G.setAttributeNS(null,"cy",C);window.opera||d.unsuspendRedraw(L);break;case "fhellipse":case "fhrect":A.minx=Math.min(L,A.minx);A.maxx=Math.max(L,A.maxx);A.miny=Math.min(k,A.miny);A.maxy=Math.max(k,A.maxy);case "fhpath":e+=+L+","+
|
||||||
"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(v.shiftKey){if(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,x,y);x=C.x;y=C.y}if(ua&&ua.getAttribute("display")!=="none"){L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":L=svgedit.utilities.getBBox(F);
|
k+" ";G.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(v.shiftKey){if(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,x,y);x=C.x;y=C.y}if(ua&&ua.getAttribute("display")!=="none"){L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":L=
|
||||||
D=L.x+L.width/2;C=L.y+L.height/2;G=X(F);G=O(D,C,G);D=G.x;C=G.y;G=L.x;k=L.y;if(current_rotate_mode=="nw")G=L.x+L.width;if(current_rotate_mode=="se")k=L.y+L.height;if(current_rotate_mode=="sw"){G=L.x+L.width;k=L.y+L.height}compensation_angle=(Math.atan2(C-k,D-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,D-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=wa(S);if(v.shiftKey)S=Math.round(S/45)*45;b.setRotationAngle(S<-180?360+S:S,true);M("transition",J)}ob("mouseMove",{event:v,mouse_x:E,
|
svgedit.utilities.getBBox(F);D=L.x+L.width/2;C=L.y+L.height/2;G=X(F);G=O(D,C,G);D=G.x;C=G.y;G=L.x;k=L.y;if(current_rotate_mode=="nw")G=L.x+L.width;if(current_rotate_mode=="se")k=L.y+L.height;if(current_rotate_mode=="sw"){G=L.x+L.width;k=L.y+L.height}compensation_angle=(Math.atan2(C-k,D-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,D-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=wa(S);if(v.shiftKey)S=Math.round(S/45)*45;b.setRotationAngle(S<-180?360+S:S,true);M("transition",J)}ob("mouseMove",
|
||||||
mouse_y:I,selected:F})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var F=v.target.parentNode;if(F!==K){var I=Ib(v),E=I.tagName;if(E==="text"&&Ea!=="textedit"){v=O(v.pageX,v.pageY,rb);hb.select(I,v.x,v.y)}if((E==="g"||E==="a")&&oa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(v){b.addClones=false;window.removeEventListener("keyup",b.removeClones);if(v.button!==2){var F=
|
{event:v,mouse_x:E,mouse_y:I,selected:F})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var F=v.target.parentNode;if(F!==K){var I=Ib(v),E=I.tagName;if(E==="text"&&Ea!=="textedit"){v=O(v.pageX,v.pageY,rb);hb.select(I,v.x,v.y)}if((E==="g"||E==="a")&&oa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(v){b.addClones=false;window.removeEventListener("keyup",b.removeClones);
|
||||||
Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity=E.getAttribute("stroke-opacity");
|
if(v.button!==2){var F=Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity=
|
||||||
bb.stroke_width=E.getAttribute("stroke-width");bb.stroke_dasharray=E.getAttribute("stroke-dasharray");bb.stroke_linejoin=E.getAttribute("stroke-linejoin");bb.stroke_linecap=E.getAttribute("stroke-linecap")}if(E.tagName=="text"){Za.font_size=E.getAttribute("font-size");Za.font_family=E.getAttribute("font-family")}Ha.requestSelector(E).showGrips(true)}Ga();if(G!=z||L!=w){v=J.length;for(E=0;E<v;++E){if(J[E]==null)break;J[E].firstChild||Ha.requestSelector(J[E]).resize()}}else{E=v.target;if(J[0].nodeName===
|
E.getAttribute("stroke-opacity");bb.stroke_width=E.getAttribute("stroke-width");bb.stroke_dasharray=E.getAttribute("stroke-dasharray");bb.stroke_linejoin=E.getAttribute("stroke-linejoin");bb.stroke_linecap=E.getAttribute("stroke-linecap")}if(E.tagName=="text"){Za.font_size=E.getAttribute("font-size");Za.font_family=E.getAttribute("font-family")}Ha.requestSelector(E).showGrips(true)}Ga();if(G!=z||L!=w){v=J.length;for(E=0;E<v;++E){if(J[E]==null)break;J[E].firstChild||Ha.requestSelector(J[E]).resize()}}else{E=
|
||||||
"path"&&J[1]==null)Ja.select(J[0]);else v.shiftKey&&F!=E&&b.removeFromSelection([E])}if(svgedit.browser.supportsNonScalingStroke())if(v=J[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(P){P.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");M("zoomed",{x:Math.min(z,G),y:Math.min(w,L),width:Math.abs(G-z),height:Math.abs(L-w),factor:v.altKey?0.5:2});return;case "fhpath":F=k.getAttribute("points");G=F.indexOf(",");if(u=G>=0?F.indexOf(",",
|
v.target;if(J[0].nodeName==="path"&&J[1]==null)Ja.select(J[0]);else v.shiftKey&&F!=E&&b.removeFromSelection([E])}if(svgedit.browser.supportsNonScalingStroke())if(v=J[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(P){P.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");M("zoomed",{x:Math.min(z,G),y:Math.min(w,L),width:Math.abs(G-z),height:Math.abs(L-w),factor:v.altKey?0.5:2});return;case "fhpath":F=k.getAttribute("points");G=F.indexOf(",");
|
||||||
G+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":F=$(k).attr(["x1","x2","y1","y2"]);u=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(k).attr(["width","height"]);u=F.width!=0||F.height!=0||Ea==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":F=$(k).attr(["rx","ry"]);u=F.rx!=null||F.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"ellipse",curStyles:true,
|
if(u=G>=0?F.indexOf(",",G+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":F=$(k).attr(["x1","x2","y1","y2"]);u=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(k).attr(["width","height"]);u=F.width!=0||F.height!=0||Ea==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":F=$(k).attr(["rx","ry"]);u=F.rx!=null||F.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"ellipse",
|
||||||
attr:{cx:(A.minx+A.maxx)/2,cy:(A.miny+A.maxy)/2,rx:(A.maxx-A.minx)/2,ry:(A.maxy-A.miny)/2,id:ca()}});M("changed",[k]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});M("changed",[k]);u=true}break;case "text":u=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;F=Ja.mouseUp(v,k,E,I);k=F.element;u=F.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v);break;case "textedit":u=
|
curStyles:true,attr:{cx:(A.minx+A.maxx)/2,cy:(A.miny+A.maxy)/2,rx:(A.maxx-A.minx)/2,ry:(A.maxy-A.miny)/2,id:ca()}});M("changed",[k]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});M("changed",[k]);u=true}break;case "text":u=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;F=Ja.mouseUp(v,k,E,I);k=F.element;u=F.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v);
|
||||||
false;k=null;hb.mouseUp(v,E,I);break;case "rotate":u=true;k=null;Ea="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();M("changed",J)}E=ob("mouseUp",{event:v,mouse_x:E,mouse_y:I},true);$.each(E,function(P,U){if(U){u=U.keep||u;k=U.element;La=U.started||La}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(E=v.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&&E.id!="svgcanvas"&&
|
break;case "textedit":u=false;k=null;hb.mouseUp(v,E,I);break;case "rotate":u=true;k=null;Ea="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();M("changed",J)}E=ob("mouseUp",{event:v,mouse_x:E,mouse_y:I},true);$.each(E,function(P,U){if(U){u=U.keep||u;k=U.element;La=U.started||La}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(E=v.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&&
|
||||||
E.id!="svgroot"){b.setMode("select");xb([E],true)}}else if(k!=null){b.addedNew=true;v=0.2;var C;if(false.beginElement&&k.getAttribute("opacity")!=N.opacity){C=$(false).clone().attr({to:N.opacity,dur:v}).appendTo(k);try{C[0].beginElement()}catch(D){}}else v=0;setTimeout(function(){C&&C.remove();k.setAttribute("opacity",N.opacity);k.setAttribute("style","pointer-events:inherit");na(k);if(Ea==="path")Ja.toEditMode(k);else n.selectNew&&xb([k],true);ya(new Ca(k));M("changed",[k])},v*1E3)}Va=null}}});$(a).bind("mousewheel DOMMouseScroll",
|
E.id!="svgcanvas"&&E.id!="svgroot"){b.setMode("select");xb([E],true)}}else if(k!=null){b.addedNew=true;v=0.2;var C;if(false.beginElement&&k.getAttribute("opacity")!=N.opacity){C=$(false).clone().attr({to:N.opacity,dur:v}).appendTo(k);try{C[0].beginElement()}catch(D){}}else v=0;setTimeout(function(){C&&C.remove();k.setAttribute("opacity",N.opacity);k.setAttribute("style","pointer-events:inherit");na(k);if(Ea==="path")Ja.toEditMode(k);else n.selectNew&&xb([k],true);ya(new Ca(k));M("changed",[k])},v*
|
||||||
function(v){if(v.shiftKey){v.preventDefault();rb=l.getScreenCTM().inverse();var F=O(v.pageX,v.pageY,rb);F={x:F.x,y:F.y,width:0,height:0};if(v.wheelDelta)if(v.wheelDelta>=120)F.factor=2;else{if(v.wheelDelta<=-120)F.factor=0.5}else if(v.detail)if(v.detail>0)F.factor=0.5;else if(v.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var pb=function(e){$(e).click(function(h){h.preventDefault()})},hb=b.textActions=function(){function e(S){var Y=I.value==="";$(I).focus();if(!arguments.length)if(Y)S=0;else{if(I.selectionEnd!==
|
1E3)}Va=null}}});$(a).bind("mousewheel DOMMouseScroll",function(v){if(v.shiftKey){v.preventDefault();rb=l.getScreenCTM().inverse();var F=O(v.pageX,v.pageY,rb);F={x:F.x,y:F.y,width:0,height:0};if(v.wheelDelta)if(v.wheelDelta>=120)F.factor=2;else{if(v.wheelDelta<=-120)F.factor=0.5}else if(v.detail)if(v.detail>0)F.factor=0.5;else if(v.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var pb=function(e){$(e).click(function(h){h.preventDefault()})},hb=b.textActions=function(){function e(S){var Y=I.value===
|
||||||
I.selectionStart)return;S=I.selectionEnd}var aa;aa=k[S];Y||I.setSelectionRange(S,S);E=qa("text_cursor");if(!E){E=document.createElementNS(c,"line");ma(E,{id:"text_cursor",stroke:"#333","stroke-width":1});E=qa("selectorParentGroup").appendChild(E)}L||(L=setInterval(function(){var ga=E.getAttribute("display")==="none";E.setAttribute("display",ga?"inline":"none")},600));Y=H(aa.x,u.y);aa=H(aa.x,u.y+u.height);ma(E,{x1:Y.x,y1:Y.y,x2:aa.x,y2:aa.y,visibility:"visible",display:"inline"});G&&G.setAttribute("d",
|
"";$(I).focus();if(!arguments.length)if(Y)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var aa;aa=k[S];Y||I.setSelectionRange(S,S);E=qa("text_cursor");if(!E){E=document.createElementNS(c,"line");ma(E,{id:"text_cursor",stroke:"#333","stroke-width":1});E=qa("selectorParentGroup").appendChild(E)}L||(L=setInterval(function(){var ga=E.getAttribute("display")==="none";E.setAttribute("display",ga?"inline":"none")},600));Y=H(aa.x,u.y);aa=H(aa.x,u.y+u.height);ma(E,{x1:Y.x,y1:Y.y,x2:aa.x,
|
||||||
"")}function h(S,Y,aa){if(S===Y)e(Y);else{aa||I.setSelectionRange(S,Y);G=qa("text_selectblock");if(!G){G=document.createElementNS(c,"path");ma(G,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});qa("selectorParentGroup").appendChild(G)}S=k[S];var ga=k[Y];E.setAttribute("visibility","hidden");Y=H(S.x,u.y);aa=H(S.x+(ga.x-S.x),u.y);var ra=H(S.x,u.y+u.height);S=H(S.x+(ga.x-S.x),u.y+u.height);ma(G,{d:"M"+Y.x+","+Y.y+" L"+aa.x+","+aa.y+" "+S.x+","+S.y+" "+ra.x+","+ra.y+"z",display:"inline"})}}
|
y2:aa.y,visibility:"visible",display:"inline"});G&&G.setAttribute("d","")}function h(S,Y,aa){if(S===Y)e(Y);else{aa||I.setSelectionRange(S,Y);G=qa("text_selectblock");if(!G){G=document.createElementNS(c,"path");ma(G,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});qa("selectorParentGroup").appendChild(G)}S=k[S];var ga=k[Y];E.setAttribute("visibility","hidden");Y=H(S.x,u.y);aa=H(S.x+(ga.x-S.x),u.y);var ra=H(S.x,u.y+u.height);S=H(S.x+(ga.x-S.x),u.y+u.height);ma(G,{d:"M"+
|
||||||
function m(S,Y){var aa=d.createSVGPoint();aa.x=S;aa.y=Y;if(k.length==1)return 0;aa=F.getCharNumAtPosition(aa);if(aa<0){aa=k.length-2;if(S<=k[0].x)aa=0}else if(aa>=k.length-2)aa=k.length-2;var ga=k[aa];S>ga.x+ga.width/2&&aa++;return aa}function z(S,Y,aa){var ga=I.selectionStart;S=m(S,Y);h(Math.min(ga,S),Math.max(ga,S),!aa)}function w(S,Y){var aa={x:S,y:Y};aa.x/=o;aa.y/=o;if(C){var ga=O(aa.x,aa.y,C.inverse());aa.x=ga.x;aa.y=ga.y}return aa}function H(S,Y){var aa={x:S,y:Y};if(C){var ga=O(aa.x,aa.y,C);
|
Y.x+","+Y.y+" L"+aa.x+","+aa.y+" "+S.x+","+S.y+" "+ra.x+","+ra.y+"z",display:"inline"})}}function m(S,Y){var aa=d.createSVGPoint();aa.x=S;aa.y=Y;if(k.length==1)return 0;aa=F.getCharNumAtPosition(aa);if(aa<0){aa=k.length-2;if(S<=k[0].x)aa=0}else if(aa>=k.length-2)aa=k.length-2;var ga=k[aa];S>ga.x+ga.width/2&&aa++;return aa}function z(S,Y,aa){var ga=I.selectionStart;S=m(S,Y);h(Math.min(ga,S),Math.max(ga,S),!aa)}function w(S,Y){var aa={x:S,y:Y};aa.x/=o;aa.y/=o;if(C){var ga=O(aa.x,aa.y,C.inverse());aa.x=
|
||||||
aa.x=ga.x;aa.y=ga.y}aa.x*=o;aa.y*=o;return aa}function A(S){h(0,F.textContent.length);$(this).unbind(S)}function v(S){if(U&&F){var Y=O(S.pageX,S.pageY,rb);Y=w(Y.x*o,Y.y*o);Y=m(Y.x,Y.y);var aa=F.textContent,ga=aa.substr(0,Y).replace(/[a-z0-9]+$/i,"").length;aa=aa.substr(Y).match(/^[a-z0-9]+/i);h(ga,(aa?aa[0].length:0)+Y);$(S.target).click(A);setTimeout(function(){$(S.target).unbind("click",A)},300)}}var F,I,E,G,L,k=[],u,C,D,P,U;return{select:function(S,Y,aa){F=S;hb.toEditMode(Y,aa)},start:function(S){F=
|
ga.x;aa.y=ga.y}return aa}function H(S,Y){var aa={x:S,y:Y};if(C){var ga=O(aa.x,aa.y,C);aa.x=ga.x;aa.y=ga.y}aa.x*=o;aa.y*=o;return aa}function A(S){h(0,F.textContent.length);$(this).unbind(S)}function v(S){if(U&&F){var Y=O(S.pageX,S.pageY,rb);Y=w(Y.x*o,Y.y*o);Y=m(Y.x,Y.y);var aa=F.textContent,ga=aa.substr(0,Y).replace(/[a-z0-9]+$/i,"").length;aa=aa.substr(Y).match(/^[a-z0-9]+/i);h(ga,(aa?aa[0].length:0)+Y);$(S.target).click(A);setTimeout(function(){$(S.target).unbind("click",A)},300)}}var F,I,E,G,L,
|
||||||
S;hb.toEditMode()},mouseDown:function(S,Y,aa,ga){S=w(aa,ga);I.focus();e(m(S.x,S.y));D=aa;P=ga},mouseMove:function(S,Y){var aa=w(S,Y);z(aa.x,aa.y)},mouseUp:function(S,Y,aa){var ga=w(Y,aa);z(ga.x,ga.y,true);S.target!==F&&Y<D+2&&Y>D-2&&aa<P+2&&aa>P-2&&hb.toSelectMode(true)},setCursor:e,toEditMode:function(S,Y){xb([F],false);U=false;Ea="textedit";Ha.requestSelector(F);hb.init();$(F).css("cursor","text");if(arguments.length){var aa=w(S,Y);e(m(aa.x,aa.y))}else e();setTimeout(function(){U=true},300)},toSelectMode:function(S){Ea=
|
k=[],u,C,D,P,U;return{select:function(S,Y,aa){F=S;hb.toEditMode(Y,aa)},start:function(S){F=S;hb.toEditMode()},mouseDown:function(S,Y,aa,ga){S=w(aa,ga);I.focus();e(m(S.x,S.y));D=aa;P=ga},mouseMove:function(S,Y){var aa=w(S,Y);z(aa.x,aa.y)},mouseUp:function(S,Y,aa){var ga=w(Y,aa);z(ga.x,ga.y,true);S.target!==F&&Y<D+2&&Y>D-2&&aa<P+2&&aa>P-2&&hb.toSelectMode(true)},setCursor:e,toEditMode:function(S,Y){xb([F],false);U=false;Ea="textedit";Ha.requestSelector(F);hb.init();$(F).css("cursor","text");if(arguments.length){var aa=
|
||||||
"select";clearInterval(L);L=null;G&&$(G).attr("display","none");E&&$(E).attr("visibility","hidden");$(F).css("cursor","move");if(S){Qa();$(F).css("cursor","move");M("selected",[F]);vb([F],true)}F&&!F.textContent.length&&b.deleteSelectedElements();$(I).blur();F=false},setInputElem:function(S){I=S},clear:function(){Ea=="textedit"&&hb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=J[0];Ha.requestSelector(F).showGrips(false)}var S=F.textContent.length,Y=F.getAttribute("transform");u=svgedit.utilities.getBBox(F);
|
w(S,Y);e(m(aa.x,aa.y))}else e();setTimeout(function(){U=true},300)},toSelectMode:function(S){Ea="select";clearInterval(L);L=null;G&&$(G).attr("display","none");E&&$(E).attr("visibility","hidden");$(F).css("cursor","move");if(S){Qa();$(F).css("cursor","move");M("selected",[F]);vb([F],true)}F&&!F.textContent.length&&b.deleteSelectedElements();$(I).blur();F=false},setInputElem:function(S){I=S},clear:function(){Ea=="textedit"&&hb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=J[0];Ha.requestSelector(F).showGrips(false)}var S=
|
||||||
C=Y?X(F):null;k=Array(S);I.focus();$(F).unbind("dblclick",v).dblclick(v);if(!S)var aa={x:u.x+u.width/2,width:0};for(Y=0;Y<S;Y++){var ga=F.getStartPositionOfChar(Y);aa=F.getEndPositionOfChar(Y);if(!svgedit.browser.supportsGoodTextCharPos()){var ra=b.contentW*o;ga.x-=ra;aa.x-=ra;ga.x/=o;aa.x/=o}k[Y]={x:ga.x,y:u.y,width:aa.x-ga.x,height:u.height}}k.push({x:aa.x,width:0});h(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=b.pathActions=function(){var e=false,h,m,z;svgedit.path.Path.prototype.endChanges=
|
F.textContent.length,Y=F.getAttribute("transform");u=svgedit.utilities.getBBox(F);C=Y?X(F):null;k=Array(S);I.focus();$(F).unbind("dblclick",v).dblclick(v);if(!S)var aa={x:u.x+u.width/2,width:0};for(Y=0;Y<S;Y++){var ga=F.getStartPositionOfChar(Y);aa=F.getEndPositionOfChar(Y);if(!svgedit.browser.supportsGoodTextCharPos()){var ra=b.contentW*o;ga.x-=ra;aa.x-=ra;ga.x/=o;aa.x/=o}k[Y]={x:ga.x,y:u.y,width:aa.x-ga.x,height:u.height}}k.push({x:aa.x,width:0});h(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=
|
||||||
function(A){if(svgedit.browser.isWebkit()){var v=this.elem;v.setAttribute("d",Ja.convertPath(v))}A=new Na(this.elem,{d:this.last_d},A);ya(A);M("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(A){$.isArray(A)||(A=[A]);for(var v=0;v<A.length;v++){var F=A[v],I=this.segs[F];I.ptgrip&&this.selected_pts.indexOf(F)==-1&&F>=0&&this.selected_pts.push(F)}this.selected_pts.sort();v=this.selected_pts.length;for(A=Array(v);v--;){I=this.segs[this.selected_pts[v]];I.select(true);A[v]=
|
b.pathActions=function(){var e=false,h,m,z;svgedit.path.Path.prototype.endChanges=function(A){if(svgedit.browser.isWebkit()){var v=this.elem;v.setAttribute("d",Ja.convertPath(v))}A=new Na(this.elem,{d:this.last_d},A);ya(A);M("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(A){$.isArray(A)||(A=[A]);for(var v=0;v<A.length;v++){var F=A[v],I=this.segs[F];I.ptgrip&&this.selected_pts.indexOf(F)==-1&&F>=0&&this.selected_pts.push(F)}this.selected_pts.sort();v=this.selected_pts.length;
|
||||||
I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",A)};var w=h=null,H=false;return{mouseDown:function(A,v,F,I){if(Ea==="path"){mouse_x=F;mouse_y=I;I=mouse_x/o;v=mouse_y/o;F=qa("path_stretch_line");m=[I,v];if(n.gridSnapping){I=wa(I);v=wa(v);mouse_x=wa(mouse_x);mouse_y=wa(mouse_y)}if(!F){F=document.createElementNS(c,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});F=qa("selectorParentGroup").appendChild(F)}F.setAttribute("display",
|
for(A=Array(v);v--;){I=this.segs[this.selected_pts[v]];I.select(true);A[v]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",A)};var w=h=null,H=false;return{mouseDown:function(A,v,F,I){if(Ea==="path"){mouse_x=F;mouse_y=I;I=mouse_x/o;v=mouse_y/o;F=qa("path_stretch_line");m=[I,v];if(n.gridSnapping){I=wa(I);v=wa(v);mouse_x=wa(mouse_x);mouse_y=wa(mouse_y)}if(!F){F=document.createElementNS(c,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",
|
||||||
"inline");var E=null;if(w){E=w.pathSegList;for(var G=E.numberOfItems,L=6/o,k=false;G;){G--;var u=E.getItem(G),C=u.x;u=u.y;if(I>=C-L&&I<=C+L&&v>=u-L&&v<=u+L){k=true;break}}L=ca();svgedit.path.removePath_(L);L=qa(L);C=E.numberOfItems;if(k){if(G<=1&&C>=2){I=E.getItem(0).x;v=E.getItem(0).y;A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(I,v):w.createSVGPathSegCurvetoCubicAbs(I,v,A.x1/o,A.y1/o,I,v);I=w.createSVGPathSegClosePath();E.appendItem(A);E.appendItem(I)}else if(C<3)return E=
|
fill:"none"});F=qa("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var E=null;if(w){E=w.pathSegList;for(var G=E.numberOfItems,L=6/o,k=false;G;){G--;var u=E.getItem(G),C=u.x;u=u.y;if(I>=C-L&&I<=C+L&&v>=u-L&&v<=u+L){k=true;break}}L=ca();svgedit.path.removePath_(L);L=qa(L);C=E.numberOfItems;if(k){if(G<=1&&C>=2){I=E.getItem(0).x;v=E.getItem(0).y;A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(I,v):w.createSVGPathSegCurvetoCubicAbs(I,v,A.x1/o,A.y1/o,
|
||||||
false;$(F).remove();element=L;w=null;La=false;if(e){svgedit.path.path.matrix&&db(L,{},svgedit.path.path.matrix.inverse());F=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+F);$(L).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Ib(A))){console.log("Clicked outside canvas");return false}E=w.pathSegList.numberOfItems;
|
I,v);I=w.createSVGPathSegClosePath();E.appendItem(A);E.appendItem(I)}else if(C<3)return E=false;$(F).remove();element=L;w=null;La=false;if(e){svgedit.path.path.matrix&&db(L,{},svgedit.path.path.matrix.inverse());F=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+F);$(L).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,
|
||||||
G=w.pathSegList.getItem(E-1);L=G.x;G=G.y;if(A.shiftKey){A=ba(L,G,I,v);I=A.x;v=A.y}A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(eb(I),eb(v)):w.createSVGPathSegCurvetoCubicAbs(eb(I),eb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;F.setAttribute("d",["M",I,v,I,v].join(" "));F=E;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,I,v)}}else{d_attr="M"+I+","+v+" ";w=R({element:"path",curStyles:true,attr:{d:d_attr,id:ja(),opacity:N.opacity/
|
Ib(A))){console.log("Clicked outside canvas");return false}E=w.pathSegList.numberOfItems;G=w.pathSegList.getItem(E-1);L=G.x;G=G.y;if(A.shiftKey){A=ba(L,G,I,v);I=A.x;v=A.y}A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(eb(I),eb(v)):w.createSVGPathSegCurvetoCubicAbs(eb(I),eb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;F.setAttribute("d",["M",I,v,I,v].join(" "));F=E;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,I,v)}}else{d_attr=
|
||||||
2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();L=A.target.id;if(L.substr(0,14)=="pathpointgrip_"){v=svgedit.path.path.cur_pt=parseInt(L.substr(14));svgedit.path.path.dragging=[F,I];E=svgedit.path.path.segs[v];if(A.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(v):svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=
|
"M"+I+","+v+" ";w=R({element:"path",curStyles:true,attr:{d:d_attr,id:ja(),opacity:N.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();L=A.target.id;if(L.substr(0,14)=="pathpointgrip_"){v=svgedit.path.path.cur_pt=parseInt(L.substr(14));svgedit.path.path.dragging=[F,I];E=svgedit.path.path.segs[v];if(A.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(v):
|
||||||
1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I=w.pathSegList;A=I.numberOfItems-1;if(m){var E=svgedit.path.addCtrlGrip("1c1"),
|
svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I=
|
||||||
G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");E.setAttribute("cx",v);E.setAttribute("cy",F);E.setAttribute("display","inline");E=m[0];var L=m[1];I.getItem(A);var k=E+(E-v/o),u=L+(L-F/o);G.setAttribute("cx",k*o);G.setAttribute("cy",u*o);G.setAttribute("display","inline");G=svgedit.path.getCtrlLine(1);var C=svgedit.path.getCtrlLine(2);ma(G,{x1:v,y1:F,x2:E*o,y2:L*o,display:"inline"});ma(C,{x1:k*o,y1:u*o,x2:E*o,y2:L*o,display:"inline"});if(A===0)z=[v,F];else{I=I.getItem(A-
|
w.pathSegList;A=I.numberOfItems-1;if(m){var E=svgedit.path.addCtrlGrip("1c1"),G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");E.setAttribute("cx",v);E.setAttribute("cy",F);E.setAttribute("display","inline");E=m[0];var L=m[1];I.getItem(A);var k=E+(E-v/o),u=L+(L-F/o);G.setAttribute("cx",k*o);G.setAttribute("cy",u*o);G.setAttribute("display","inline");G=svgedit.path.getCtrlLine(1);var C=svgedit.path.getCtrlLine(2);ma(G,{x1:v,y1:F,x2:E*o,y2:L*o,display:"inline"});ma(C,{x1:k*
|
||||||
1);v=I.x;F=I.y;if(I.pathSegType===6){v+=v-I.x2;F+=F-I.y2}else if(z){v=z[0]/o;F=z[1]/o}svgedit.path.replacePathSeg(6,A,[E,L,v,F,k,u],w)}}else if(E=qa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,F,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,F],E);else z?svgedit.path.replacePathSeg(6,1,[v,F,z[0],z[1],v,F],E):svgedit.path.replacePathSeg(4,1,[v,F],E)}}}else if(svgedit.path.path.dragging){E=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},
|
o,y1:u*o,x2:E*o,y2:L*o,display:"inline"});if(A===0)z=[v,F];else{I=I.getItem(A-1);v=I.x;F=I.y;if(I.pathSegType===6){v+=v-I.x2;F+=F-I.y2}else if(z){v=z[0]/o;F=z[1]/o}svgedit.path.replacePathSeg(6,A,[E,L,v,F,k,u],w)}}else if(E=qa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,F,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,F],E);else z?svgedit.path.replacePathSeg(6,1,[v,F,z[0],z[1],v,F],E):svgedit.path.replacePathSeg(4,1,[v,F],E)}}}else if(svgedit.path.path.dragging){E=
|
||||||
svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ua.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&svgedit.path.path.selected_pts.push(this.index)}})}},
|
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ua.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,
|
||||||
mouseUp:function(A,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}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();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(F)}else if(ua&&ua.getAttribute("display")!="none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=
|
{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(A,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}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();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(F)}else if(ua&&ua.getAttribute("display")!=
|
||||||
2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(v){M("selected",[A]);vb([A],true)}},addSubPath:function(A){if(A){Ea=
|
"none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&&
|
||||||
"path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ea="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(oa(A)!=0){var v=new za("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Na(A,F));Qa();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix=null;this.clear();vb([A],true);M("changed",J)}},clear:function(){h=null;if(w){var A=qa(ca());$(qa("path_stretch_line")).remove();
|
svgedit.path.recalcRotatedPath();if(v){M("selected",[A]);vb([A],true)}},addSubPath:function(A){if(A){Ea="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ea="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(oa(A)!=0){var v=new za("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Na(A,F));Qa();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix=null;
|
||||||
$(A).remove();$(qa("pathpointgrip_container")).find("*").attr("display","none");w=z=null;La=false}else Ea=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(A){if(A==null||A.nodeName!="path")return false;var v=V(A),F=fa(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems,E=0;E<I;++E){var G=v.getItem(E),L=G.pathSegType;if(L!=1){var k=[];$.each(["",1,2],function(u,C){var D=G["x"+C],P=G["y"+C];if(D!==
|
this.clear();vb([A],true);M("changed",J)}},clear:function(){h=null;if(w){var A=qa(ca());$(qa("path_stretch_line")).remove();$(A).remove();$(qa("pathpointgrip_container")).find("*").attr("display","none");w=z=null;La=false}else Ea=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(A){if(A==null||A.nodeName!="path")return false;var v=V(A),F=fa(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems,
|
||||||
undefined&&P!==undefined){D=O(D,P,F);k.splice(k.length,0,D.x,D.y)}});svgedit.path.replacePathSeg(L,E,k,A)}}g(A,F)},zoomChange:function(){Ea=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var A=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:A.item.x,y:A.item.y,type:A.type}},linkControlPoints:function(A){svgedit.path.setLinkControlPoints(A)},clonePathNode:function(){svgedit.path.path.storeD();for(var A=svgedit.path.path.selected_pts,
|
E=0;E<I;++E){var G=v.getItem(E),L=G.pathSegType;if(L!=1){var k=[];$.each(["",1,2],function(u,C){var D=G["x"+C],P=G["y"+C];if(D!==undefined&&P!==undefined){D=O(D,P,F);k.splice(k.length,0,D.x,D.y)}});svgedit.path.replacePathSeg(L,E,k,A)}}g(A,F)},zoomChange:function(){Ea=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var A=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:A.item.x,y:A.item.y,type:A.type}},linkControlPoints:function(A){svgedit.path.setLinkControlPoints(A)},
|
||||||
v=A.length,F=[];v--;){var I=A[v];svgedit.path.path.addSeg(I);F.push(I+v);F.push(I+v+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var A=svgedit.path.path.selected_pts;if(A.length===1){var v=svgedit.path.path.elem,F=v.pathSegList,I=A[0],E=null,G=null;svgedit.path.path.eachSeg(function(C){if(this.type===2&&C<=I)G=this.item;if(C<=I)return true;if(this.type===2){E=C;return false}else if(this.type===1)return E=false});if(E==
|
clonePathNode:function(){svgedit.path.path.storeD();for(var A=svgedit.path.path.selected_pts,v=A.length,F=[];v--;){var I=A[v];svgedit.path.path.addSeg(I);F.push(I+v);F.push(I+v+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var A=svgedit.path.path.selected_pts;if(A.length===1){var v=svgedit.path.path.elem,F=v.pathSegList,I=A[0],E=null,G=null;svgedit.path.path.eachSeg(function(C){if(this.type===2&&C<=I)G=this.item;if(C<=
|
||||||
null)E=svgedit.path.path.segs.length-1;if(E!==false){var L=v.createSVGPathSegLinetoAbs(G.x,G.y),k=v.createSVGPathSegClosePath();if(E==svgedit.path.path.segs.length-1){F.appendItem(L);F.appendItem(k)}else{svgedit.path.insertItemBefore(v,k,E);svgedit.path.insertItemBefore(v,L,E)}svgedit.path.path.init().selectPt(E+1)}else if(svgedit.path.path.segs[I].mate){F.removeItem(I);F.removeItem(I);svgedit.path.path.init().selectPt(I-1)}else{for(A=0;A<F.numberOfItems;A++){var u=F.getItem(A);if(u.pathSegType===
|
I)return true;if(this.type===2){E=C;return false}else if(this.type===1)return E=false});if(E==null)E=svgedit.path.path.segs.length-1;if(E!==false){var L=v.createSVGPathSegLinetoAbs(G.x,G.y),k=v.createSVGPathSegClosePath();if(E==svgedit.path.path.segs.length-1){F.appendItem(L);F.appendItem(k)}else{svgedit.path.insertItemBefore(v,k,E);svgedit.path.insertItemBefore(v,L,E)}svgedit.path.path.init().selectPt(E+1)}else if(svgedit.path.path.segs[I].mate){F.removeItem(I);F.removeItem(I);svgedit.path.path.init().selectPt(I-
|
||||||
2)L=A;else if(A===I)F.removeItem(L);else if(u.pathSegType===1&&I<A){k=A-1;F.removeItem(A);break}}for(A=I-L-1;A--;)svgedit.path.insertItemBefore(v,F.getItem(L),k);v=F.getItem(L);svgedit.path.replacePathSeg(2,L,[v.x,v.y]);A=I;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ja.canDeleteNodes){svgedit.path.path.storeD();for(var A=svgedit.path.path.selected_pts,v=A.length;v--;)svgedit.path.path.deleteSeg(A[v]);var F=function(){var I=svgedit.path.path.elem.pathSegList,E=I.numberOfItems,
|
1)}else{for(A=0;A<F.numberOfItems;A++){var u=F.getItem(A);if(u.pathSegType===2)L=A;else if(A===I)F.removeItem(L);else if(u.pathSegType===1&&I<A){k=A-1;F.removeItem(A);break}}for(A=I-L-1;A--;)svgedit.path.insertItemBefore(v,F.getItem(L),k);v=F.getItem(L);svgedit.path.replacePathSeg(2,L,[v.x,v.y]);A=I;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ja.canDeleteNodes){svgedit.path.path.storeD();for(var A=svgedit.path.path.selected_pts,v=A.length;v--;)svgedit.path.path.deleteSeg(A[v]);
|
||||||
G=function(u,C){for(;C--;)I.removeItem(u)};if(E<=1)return true;for(;E--;){var L=I.getItem(E);if(L.pathSegType===1){L=I.getItem(E-1);var k=I.getItem(E-2);if(L.pathSegType===2){G(E-1,2);F();break}else if(k.pathSegType===2){G(E-2,3);F();break}}else if(L.pathSegType===2)if(E>0){L=I.getItem(E-1).pathSegType;if(L===2){G(E-1,1);F();break}else if(L===1&&I.numberOfItems-1===E){G(E,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ja.toSelectMode(svgedit.path.path.elem);
|
var F=function(){var I=svgedit.path.path.elem.pathSegList,E=I.numberOfItems,G=function(u,C){for(;C--;)I.removeItem(u)};if(E<=1)return true;for(;E--;){var L=I.getItem(E);if(L.pathSegType===1){L=I.getItem(E-1);var k=I.getItem(E-2);if(L.pathSegType===2){G(E-1,2);F();break}else if(k.pathSegType===2){G(E-2,3);F();break}}else if(L.pathSegType===2)if(E>0){L=I.getItem(E-1).pathSegType;if(L===2){G(E-1,1);F();break}else if(L===1&&I.numberOfItems-1===E){G(E,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=
|
||||||
b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){A=$(svgedit.path.path.elem);A.attr("d",A.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(A){var v=A.points,F=v.numberOfItems;if(F>=4){var I=v.getItem(0),E=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=F-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(E)if((I=svgedit.path.smoothControlPoints(E,L,I))&&I.length==
|
1){Ja.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){A=$(svgedit.path.path.elem);A.attr("d",A.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(A){var v=A.points,F=v.numberOfItems;if(F>=4){var I=v.getItem(0),E=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=F-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(E)if((I=svgedit.path.smoothControlPoints(E,
|
||||||
2){L=A[A.length-1].split(",");L[2]=I[0].x;L[3]=I[0].y;A[A.length-1]=L.join(",");L=I[1]}A.push([L.x,L.y,k.x,k.y,u.x,u.y].join(","));I=u;E=k}for(A.push("L");G<F;++G){k=v.getItem(G);A.push([k.x,k.y].join(","))}A=A.join(" ");A=R({element:"path",curStyles:true,attr:{id:ca(),d:A,fill:"none"}})}return A},setSegType:function(A){svgedit.path.path.setSegType(A)},moveNode:function(A,v){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];var I={x:0,y:0};
|
L,I))&&I.length==2){L=A[A.length-1].split(",");L[2]=I[0].x;L[3]=I[0].y;A[A.length-1]=L.join(",");L=I[1]}A.push([L.x,L.y,k.x,k.y,u.x,u.y].join(","));I=u;E=k}for(A.push("L");G<F;++G){k=v.getItem(G);A.push([k.x,k.y].join(","))}A=A.join(" ");A=R({element:"path",curStyles:true,attr:{id:ca(),d:A,fill:"none"}})}return A},setSegType:function(A){svgedit.path.path.setSegType(A)},moveNode:function(A,v){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];
|
||||||
I[A]=v-F.item[A];F.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(A){for(var v=A.pathSegList,F=v.numberOfItems,I,E=0;E<F;++E){var G=v.getItem(E);if(G.pathSegType===2)I=G;if(G.pathSegType===1){G=v.getItem(E-1);if(G.x!=I.x||G.y!=I.y){v=A.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(A,v,E);Ja.fixEnd(A);break}}}svgedit.browser.isWebkit()&&A.setAttribute("d",Ja.convertPath(A))},convertPath:function(A,v){for(var F=A.pathSegList,I=F.numberOfItems,E=0,
|
var I={x:0,y:0};I[A]=v-F.item[A];F.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(A){for(var v=A.pathSegList,F=v.numberOfItems,I,E=0;E<F;++E){var G=v.getItem(E);if(G.pathSegType===2)I=G;if(G.pathSegType===1){G=v.getItem(E-1);if(G.x!=I.x||G.y!=I.y){v=A.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(A,v,E);Ja.fixEnd(A);break}}}svgedit.browser.isWebkit()&&A.setAttribute("d",Ja.convertPath(A))},convertPath:function(A,v){for(var F=A.pathSegList,I=F.numberOfItems,
|
||||||
G=0,L="",k=null,u=0;u<I;++u){var C=F.getItem(u),D=C.x||0,P=C.y||0,U=C.x1||0,S=C.y1||0,Y=C.x2||0,aa=C.y2||0,ga=C.pathSegType,ra=Pa[ga]["to"+(v?"Lower":"Upper")+"Case"](),Oa=function(Ba,ha,Ta){ha=ha?" "+ha.join(" "):"";Ta=Ta?" "+svgedit.units.shortFloat(Ta):"";$.each(Ba,function(Ra,ta){Ba[Ra]=svgedit.units.shortFloat(ta)});L+=ra+Ba.join(" ")+ha+Ta};switch(ga){case 1:L+="z";break;case 12:D-=E;case 13:if(v){E+=D;ra="l"}else{D+=E;E=D;ra="L"}Oa([[D,G]]);break;case 14:P-=G;case 15:if(v){G+=P;ra="l"}else{P+=
|
E=0,G=0,L="",k=null,u=0;u<I;++u){var C=F.getItem(u),D=C.x||0,P=C.y||0,U=C.x1||0,S=C.y1||0,Y=C.x2||0,aa=C.y2||0,ga=C.pathSegType,ra=Pa[ga]["to"+(v?"Lower":"Upper")+"Case"](),Oa=function(Ba,ha,Ta){ha=ha?" "+ha.join(" "):"";Ta=Ta?" "+svgedit.units.shortFloat(Ta):"";$.each(Ba,function(Ra,ta){Ba[Ra]=svgedit.units.shortFloat(ta)});L+=ra+Ba.join(" ")+ha+Ta};switch(ga){case 1:L+="z";break;case 12:D-=E;case 13:if(v){E+=D;ra="l"}else{D+=E;E=D;ra="L"}Oa([[D,G]]);break;case 14:P-=G;case 15:if(v){G+=P;ra="l"}else{P+=
|
||||||
G;G=P;ra="L"}Oa([[E,P]]);break;case 2:case 4:case 18:D-=E;P-=G;case 5:case 3:if(k&&F.getItem(u-1).pathSegType===1&&!v){E=k[0];G=k[1]}case 19:if(v){E+=D;G+=P}else{D+=E;P+=G;E=D;G=P}if(ga===3)k=[E,G];Oa([[D,P]]);break;case 6:D-=E;U-=E;Y-=E;P-=G;S-=G;aa-=G;case 7:if(v){E+=D;G+=P}else{D+=E;U+=E;Y+=E;P+=G;S+=G;aa+=G;E=D;G=P}Oa([[U,S],[Y,aa],[D,P]]);break;case 8:D-=E;U-=E;P-=G;S-=G;case 9:if(v){E+=D;G+=P}else{D+=E;U+=E;P+=G;S+=G;E=D;G=P}Oa([[U,S],[D,P]]);break;case 10:D-=E;P-=G;case 11:if(v){E+=D;G+=P}else{D+=
|
G;G=P;ra="L"}Oa([[E,P]]);break;case 2:case 4:case 18:D-=E;P-=G;case 5:case 3:if(k&&F.getItem(u-1).pathSegType===1&&!v){E=k[0];G=k[1]}case 19:if(v){E+=D;G+=P}else{D+=E;P+=G;E=D;G=P}if(ga===3)k=[E,G];Oa([[D,P]]);break;case 6:D-=E;U-=E;Y-=E;P-=G;S-=G;aa-=G;case 7:if(v){E+=D;G+=P}else{D+=E;U+=E;Y+=E;P+=G;S+=G;aa+=G;E=D;G=P}Oa([[U,S],[Y,aa],[D,P]]);break;case 8:D-=E;U-=E;P-=G;S-=G;case 9:if(v){E+=D;G+=P}else{D+=E;U+=E;P+=G;S+=G;E=D;G=P}Oa([[U,S],[D,P]]);break;case 10:D-=E;P-=G;case 11:if(v){E+=D;G+=P}else{D+=
|
||||||
E;P+=G;E=D;G=P}Oa([[C.r1,C.r2]],[C.angle,C.largeArcFlag?1:0,C.sweepFlag?1:0],[D,P]);break;case 16:D-=E;Y-=E;P-=G;aa-=G;case 17:if(v){E+=D;G+=P}else{D+=E;Y+=E;P+=G;aa+=G;E=D;G=P}Oa([[Y,aa],[D,P]])}}return L}}}(),Kb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(c,"defs");if(!e||!e.length)return 0;for(var h=[],m=0,z=["fill","stroke","filter","marker-start","marker-mid","marker-end"],w=z.length,H=l.getElementsByTagNameNS(c,"*"),A=H.length,v=0;v<A;v++){for(var F=H[v],I=0;I<w;I++){var E=
|
E;P+=G;E=D;G=P}Oa([[C.r1,C.r2]],[C.angle,C.largeArcFlag?1:0,C.sweepFlag?1:0],[D,P]);break;case 16:D-=E;Y-=E;P-=G;aa-=G;case 17:if(v){E+=D;G+=P}else{D+=E;Y+=E;P+=G;aa+=G;E=D;G=P}Oa([[Y,aa],[D,P]])}}return L}}}(),Kb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(c,"defs");if(!e||!e.length)return 0;for(var h=[],m=0,z=["fill","stroke","filter","marker-start","marker-mid","marker-end"],w=z.length,H=l.getElementsByTagNameNS(c,"*"),A=H.length,v=0;v<A;v++){for(var F=H[v],I=0;I<w;I++){var E=
|
||||||
ka(F.getAttribute(z[I]));E&&h.push(E.substr(1))}(F=da(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(v=e.length;v--;){z=e[v];w=z.id;if(h.indexOf(w)<0){Ab[w]=z;z.parentNode.removeChild(z);m++}}return m};this.svgCanvasToString=function(){for(;Kb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,z){m&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&l.insertBefore(z,l.firstChild)});if(K){Jb();xb([K])}var e=
|
ka(F.getAttribute(z[I]));E&&h.push(E.substr(1))}(F=da(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(v=e.length;v--;){z=e[v];w=z.id;if(h.indexOf(w)<0){Ab[w]=z;z.parentNode.removeChild(z);m++}}return m};this.svgCanvasToString=function(){for(;Kb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,z){m&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&l.insertBefore(z,l.firstChild)});if(K){Jb();xb([K])}var e=
|
||||||
|
@ -407,7 +407,7 @@ var aa,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){a
|
||||||
a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(u){P=a("#seg_type");if(D){u.x=svgedit.units.convertUnit(u.x);u.y=svgedit.units.convertUnit(u.y)}a("#path_node_x").val(Math.round(u.x));a("#path_node_y").val(Math.round(u.y));u.type?P.val(u.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}return}D=null;if(ra==="a"){D=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();
|
a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(u){P=a("#seg_type");if(D){u.x=svgedit.units.convertUnit(u.x);u.y=svgedit.units.convertUnit(u.y)}a("#path_node_x").val(Math.round(u.x));a("#path_node_y").val(Math.round(u.y));u.type?P.val(u.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}return}D=null;if(ra==="a"){D=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();
|
||||||
D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();
|
D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();
|
||||||
a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",
|
a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",
|
||||||
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();
|
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0]).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();
|
||||||
a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);
|
a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);
|
||||||
V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<S;U++){var Y=
|
V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<S;U++){var Y=
|
||||||
P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";
|
P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";
|
||||||
|
|
|
@ -1544,6 +1544,7 @@
|
||||||
$('#font_family').val(font_family);
|
$('#font_family').val(font_family);
|
||||||
$('#font_size').val(elem.getAttribute("font-size"));
|
$('#font_size').val(elem.getAttribute("font-size"));
|
||||||
$('#text').val(elem.textContent);
|
$('#text').val(elem.textContent);
|
||||||
|
$('#preview_font').text(font_family.split(",")[0]).css('font-family', font_family);
|
||||||
if (svgCanvas.addedNew) {
|
if (svgCanvas.addedNew) {
|
||||||
// Timeout needed for IE9
|
// Timeout needed for IE9
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
|
@ -2374,10 +2374,10 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
||||||
var right_click = evt.button === 2;
|
var right_click = evt.button === 2;
|
||||||
|
|
||||||
root_sctm = svgcontent.getScreenCTM().inverse();
|
root_sctm = svgcontent.getScreenCTM().inverse();
|
||||||
|
isBotchedZoom = svgedit.browser.isGecko();
|
||||||
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
||||||
mouse_x = pt.x * current_zoom,
|
mouse_x = pt.x * (isBotchedZoom ? 1 : current_zoom),
|
||||||
mouse_y = pt.y * current_zoom;
|
mouse_y = pt.y * (isBotchedZoom ? 1 : current_zoom);
|
||||||
|
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
|
@ -2733,8 +2733,8 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
||||||
if(evt.button === 1 || canvas.spaceKey) return;
|
if(evt.button === 1 || canvas.spaceKey) return;
|
||||||
var selected = selectedElements[0],
|
var selected = selectedElements[0],
|
||||||
pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
pt = transformPoint( evt.pageX, evt.pageY, root_sctm ),
|
||||||
mouse_x = pt.x * current_zoom,
|
mouse_x = pt.x * (isBotchedZoom ? 1 : current_zoom),
|
||||||
mouse_y = pt.y * current_zoom,
|
mouse_y = pt.y * (isBotchedZoom ? 1 : current_zoom),
|
||||||
shape = getElem(getId());
|
shape = getElem(getId());
|
||||||
|
|
||||||
var real_x = x = mouse_x / current_zoom;
|
var real_x = x = mouse_x / current_zoom;
|
||||||
|
|
|
@ -242,62 +242,62 @@ A.points=Array(F);for(I=0;I<F;++I){E=w.getItem(I);A.points[I]={x:E.x,y:E.y}}}cas
|
||||||
J)},vb=this.addToSelection=function(e,h){if(e.length!=0){for(var m=0;m<J.length;){if(J[m]==null)break;++m}for(var z=e.length;z--;){var w=e[z];if(w&&svgedit.utilities.getBBox(w)){if(w.tagName==="a"&&w.childNodes.length===1)w=w.firstChild;if(J.indexOf(w)==-1){J[m]=w;m++;w=Ha.requestSelector(w);J.length>1&&w.showGrips(false)}}}M("selected",J);h||J.length==1?Ha.requestSelector(J[0]).showGrips(true):Ha.requestSelector(J[0]).showGrips(false);for(J.sort(function(H,A){if(H&&A&&H.compareDocumentPosition)return 3-
|
J)},vb=this.addToSelection=function(e,h){if(e.length!=0){for(var m=0;m<J.length;){if(J[m]==null)break;++m}for(var z=e.length;z--;){var w=e[z];if(w&&svgedit.utilities.getBBox(w)){if(w.tagName==="a"&&w.childNodes.length===1)w=w.firstChild;if(J.indexOf(w)==-1){J[m]=w;m++;w=Ha.requestSelector(w);J.length>1&&w.showGrips(false)}}}M("selected",J);h||J.length==1?Ha.requestSelector(J[0]).showGrips(true):Ha.requestSelector(J[0]).showGrips(false);for(J.sort(function(H,A){if(H&&A&&H.compareDocumentPosition)return 3-
|
||||||
(A.compareDocumentPosition(H)&6);else if(H==null)return 1});J[0]==null;)J.shift(0)}},xb=this.selectOnly=function(e,h){Qa(true);vb(e,h)};this.removeFromSelection=function(e){if(J[0]!=null)if(e.length!=0){var h=Array(J.length);j=0;len=J.length;for(var m=0;m<len;++m){var z=J[m];if(z)if(e.indexOf(z)==-1){h[j]=z;j++}else Ha.releaseSelector(z)}J=h}};this.selectAllInCurrentLayer=function(){var e=B().getCurrentLayer();if(e){Ea="select";xb($(K||e).children())}};var Ib=this.getMouseTarget=function(e){if(e==
|
(A.compareDocumentPosition(H)&6);else if(H==null)return 1});J[0]==null;)J.shift(0)}},xb=this.selectOnly=function(e,h){Qa(true);vb(e,h)};this.removeFromSelection=function(e){if(J[0]!=null)if(e.length!=0){var h=Array(J.length);j=0;len=J.length;for(var m=0;m<len;++m){var z=J[m];if(z)if(e.indexOf(z)==-1){h[j]=z;j++}else Ha.releaseSelector(z)}J=h}};this.selectAllInCurrentLayer=function(){var e=B().getCurrentLayer();if(e){Ea="select";xb($(K||e).children())}};var Ib=this.getMouseTarget=function(e){if(e==
|
||||||
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,l,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ha.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,m=null,z=
|
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,l,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ha.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,m=null,z=
|
||||||
null,w=null,H={},A={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches>1)){var F=v.button===2;rb=l.getScreenCTM().inverse();var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;v.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(v);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=E,k=w=m=I;if(n.gridSnapping){E=wa(E);I=wa(I);h=wa(h);m=wa(m)}if(G==Ha.selectorParentGroup&&J[0]!=null){G=v.target;var u=ib(G,"type");
|
null,w=null,H={},A={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches>1)){var F=v.button===2;rb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);v.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(v);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=E,k=w=m=I;if(n.gridSnapping){E=wa(E);I=wa(I);h=wa(h);m=wa(m)}if(G==
|
||||||
if(u=="rotate"){Ea="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ea="resize";kb=ib(G,"dir")}G=J[0]}Va=G.getAttribute("transform");u=V(G);switch(Ea){case "select":La=true;kb="none";if(F)La=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Qa(true);vb([G]);Cb=G;Ja.clear()}if(!F)for(F=0;F<J.length;++F)if(J[F]!=null){var C=V(J[F]);C.numberOfItems?C.insertItemBefore(d.createSVGTransform(),0):C.appendItem(d.createSVGTransform())}}else if(!F){Qa();Ea="multiselect";if(ua==null)ua=Ha.getRubberBandBox();
|
Ha.selectorParentGroup&&J[0]!=null){G=v.target;var u=ib(G,"type");if(u=="rotate"){Ea="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ea="resize";kb=ib(G,"dir")}G=J[0]}Va=G.getAttribute("transform");u=V(G);switch(Ea){case "select":La=true;kb="none";if(F)La=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Qa(true);vb([G]);Cb=G;Ja.clear()}if(!F)for(F=0;F<J.length;++F)if(J[F]!=null){var C=V(J[F]);C.numberOfItems?C.insertItemBefore(d.createSVGTransform(),0):C.appendItem(d.createSVGTransform())}}else if(!F){Qa();
|
||||||
z*=o;w*=o;ma(ua,{x:z,y:w,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:L*o,y:L*o,width:0,height:0,display:"inline"},100);break;case "resize":La=true;h=E;m=I;H=svgedit.utilities.getBBox($("#selectedBox0")[0]);var D={};$.each(H,function(P,U){D[P]=U/o});H=D;F=oa(G)?1:0;if(pa(u)){u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F)}else{u.appendItem(d.createSVGTransform());
|
Ea="multiselect";if(ua==null)ua=Ha.getRubberBandBox();z*=o;w*=o;ma(ua,{x:z,y:w,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:L*o,y:L*o,width:0,height:0,display:"inline"},100);break;case "resize":La=true;h=E;m=I;H=svgedit.utilities.getBBox($("#selectedBox0")[0]);var D={};$.each(H,function(P,U){D[P]=U/o});H=D;F=oa(G)?1:0;if(pa(u)){u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),
|
||||||
u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(E=svgedit.browser.isChrome())C=function(P){var U=P.getAttributeNS(null,"stroke");P.removeAttributeNS(null,"stroke");setTimeout(function(){P.setAttributeNS(null,"stroke",U)},1)};G.style.vectorEffect="non-scaling-stroke";E&&C(G);I=G.getElementsByTagName("*");L=I.length;for(F=0;F<L;F++){I[F].style.vectorEffect="non-scaling-stroke";E&&C(I[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=
|
F)}else{u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(E=svgedit.browser.isChrome())C=function(P){var U=P.getAttributeNS(null,"stroke");P.removeAttributeNS(null,"stroke");setTimeout(function(){P.setAttributeNS(null,"stroke",U)},1)};G.style.vectorEffect="non-scaling-stroke";E&&C(G);I=G.getElementsByTagName("*");L=I.length;for(F=0;F<L;F++){I[F].style.vectorEffect="non-scaling-stroke";E&&
|
||||||
true;e=L+","+k+" ";C=N.stroke_width==0?1:N.stroke_width;R({element:"polyline",curStyles:true,attr:{points:e,id:ja(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});A.minx=L;A.maxx=L;A.miny=k;A.maxy=k;break;case "image":La=true;C=R({element:"image",attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2,style:"pointer-events:inherit"}});W(C,Da);pb(C);break;case "square":case "rect":La=true;h=E;m=I;R({element:"rect",curStyles:true,attr:{x:E,y:I,width:0,height:0,
|
C(I[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=L+","+k+" ";C=N.stroke_width==0?1:N.stroke_width;R({element:"polyline",curStyles:true,attr:{points:e,id:ja(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});A.minx=L;A.maxx=L;A.miny=k;A.maxy=k;break;case "image":La=true;C=R({element:"image",attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2,style:"pointer-events:inherit"}});W(C,Da);pb(C);break;case "square":case "rect":La=true;h=
|
||||||
id:ja(),opacity:N.opacity/2}});break;case "line":La=true;C=N.stroke_width==0?1:N.stroke_width;R({element:"line",curStyles:true,attr:{x1:E,y1:I,x2:E,y2:I,id:ja(),stroke:N.stroke,"stroke-width":C,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;R({element:"circle",curStyles:true,attr:{cx:E,cy:I,r:0,id:ja(),opacity:N.opacity/
|
E;m=I;R({element:"rect",curStyles:true,attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2}});break;case "line":La=true;C=N.stroke_width==0?1:N.stroke_width;R({element:"line",curStyles:true,attr:{x1:E,y1:I,x2:E,y2:I,id:ja(),stroke:N.stroke,"stroke-width":C,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;R({element:"circle",
|
||||||
2}});break;case "ellipse":La=true;R({element:"ellipse",curStyles:true,attr:{cx:E,cy:I,rx:0,ry:0,id:ja(),opacity:N.opacity/2}});break;case "text":La=true;R({element:"text",curStyles:true,attr:{x:E,y:I,id:ja(),fill:Za.fill,"stroke-width":Za.stroke_width,"font-size":Za.font_size,"font-family":Za.font_family,"text-anchor":"left","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=o;m*=o;Ja.mouseDown(v,G,h,m);La=true;break;case "textedit":h*=o;m*=o;hb.mouseDown(v,G,h,m);La=
|
curStyles:true,attr:{cx:E,cy:I,r:0,id:ja(),opacity:N.opacity/2}});break;case "ellipse":La=true;R({element:"ellipse",curStyles:true,attr:{cx:E,cy:I,rx:0,ry:0,id:ja(),opacity:N.opacity/2}});break;case "text":La=true;R({element:"text",curStyles:true,attr:{x:E,y:I,id:ja(),fill:Za.fill,"stroke-width":Za.stroke_width,"font-size":Za.font_size,"font-family":Za.font_family,"text-anchor":"left","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=o;m*=o;Ja.mouseDown(v,G,h,m);La=
|
||||||
true;break;case "rotate":La=true;b.undoMgr.beginUndoableChange("transform",J);document.getElementById("workarea").className="rotate"}C=ob("mouseDown",{event:v,start_x:h,start_y:m,selectedElements:J},true);$.each(C,function(P,U){if(U&&U.started)La=true});if(Ea)document.getElementById("workarea").className=Ea=="resize"?v.target.style.cursor:Ea}}).mousemove(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches.length>1))if(La)if(!(v.button===1||b.spaceKey)){var F=J[0],I=O(v.pageX,v.pageY,
|
true;break;case "textedit":h*=o;m*=o;hb.mouseDown(v,G,h,m);La=true;break;case "rotate":La=true;b.undoMgr.beginUndoableChange("transform",J);document.getElementById("workarea").className="rotate"}C=ob("mouseDown",{event:v,start_x:h,start_y:m,selectedElements:J},true);$.each(C,function(P,U){if(U&&U.started)La=true});if(Ea)document.getElementById("workarea").className=Ea=="resize"?v.target.style.cursor:Ea}}).mousemove(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches.length>1))if(La)if(!(v.button===
|
||||||
rb),E=I.x*o;I=I.y*o;var G=qa(ca()),L=x=E/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ea){case "select":if(J[0]!==null){L=x-h;var u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=ba(h,m,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k<C;++k){F=J[k];if(F==null)break;var D=d.createSVGTransform();G=V(F);D.setTranslate(L,u);G.numberOfItems?G.replaceItem(D,0):G.appendItem(D);Ha.requestSelector(F).resize()}if(v.altKey)if(!b.addClones){b.addClones=b.cloneSelectedElements(0,
|
1||b.spaceKey)){var F=J[0],I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);var G=qa(ca()),L=x=E/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ea){case "select":if(J[0]!==null){L=x-h;var u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=ba(h,m,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k<C;++k){F=J[k];if(F==null)break;var D=d.createSVGTransform();G=V(F);D.setTranslate(L,u);G.numberOfItems?G.replaceItem(D,0):G.appendItem(D);Ha.requestSelector(F).resize()}if(v.altKey)if(!b.addClones){b.addClones=
|
||||||
0,D);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(Oa){Oa.parentNode&&Oa.parentNode.removeChild(Oa);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}M("transition",J)}}break;case "multiselect":L*=o;k*=o;ma(ua,{x:Math.min(z,L),y:Math.min(w,k),width:Math.abs(L-z),height:Math.abs(k-w)},100);G=[];L=[];D=tb();C=J.length;for(k=0;k<C;++k){u=D.indexOf(J[k]);if(u==-1)G.push(J[k]);else D[u]=null}C=D.length;for(k=0;k<C;++k)D[k]&&L.push(D[k]);G.length>0&&b.removeFromSelection(G);
|
b.cloneSelectedElements(0,0,D);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(Oa){Oa.parentNode&&Oa.parentNode.removeChild(Oa);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}M("transition",J)}}break;case "multiselect":L*=o;k*=o;ma(ua,{x:Math.min(z,L),y:Math.min(w,k),width:Math.abs(L-z),height:Math.abs(k-w)},100);G=[];L=[];D=tb();C=J.length;for(k=0;k<C;++k){u=D.indexOf(J[k]);if(u==-1)G.push(J[k]);else D[u]=null}C=D.length;for(k=0;k<C;++k)D[k]&&L.push(D[k]);
|
||||||
L.length>0&&vb(L);break;case "resize":G=V(F);L=(D=pa(G))?H:svgedit.utilities.getBBox(F);C=L.x;k=L.y;var P=L.width,U=L.height;L=x-h;u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u);U=wa(U);P=wa(P)}var S=oa(F);if(S){var Y=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-S*Math.PI/180;L=Y*Math.cos(u);u=Y*Math.sin(u)}if(kb.indexOf("n")==-1&&kb.indexOf("s")==-1)u=0;if(kb.indexOf("e")==-1&&kb.indexOf("w")==-1)L=0;var aa=Y=0,ga=U?(U+u)/U:1,ra=P?(P+L)/P:1;if(kb.indexOf("n")>=0){ga=U?(U-u)/U:1;aa=U}if(kb.indexOf("w")>=0){ra=
|
G.length>0&&b.removeFromSelection(G);L.length>0&&vb(L);break;case "resize":G=V(F);L=(D=pa(G))?H:svgedit.utilities.getBBox(F);C=L.x;k=L.y;var P=L.width,U=L.height;L=x-h;u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u);U=wa(U);P=wa(P)}var S=oa(F);if(S){var Y=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-S*Math.PI/180;L=Y*Math.cos(u);u=Y*Math.sin(u)}if(kb.indexOf("n")==-1&&kb.indexOf("s")==-1)u=0;if(kb.indexOf("e")==-1&&kb.indexOf("w")==-1)L=0;var aa=Y=0,ga=U?(U+u)/U:1,ra=P?(P+L)/P:1;if(kb.indexOf("n")>=0){ga=U?(U-u)/
|
||||||
P?(P-L)/P:1;Y=P}L=d.createSVGTransform();u=d.createSVGTransform();P=d.createSVGTransform();if(n.gridSnapping){C=wa(C);Y=wa(Y);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+Y),-(k+aa));if(v.shiftKey)if(ra==1)ra=ga;else ga=ra;u.setScale(ra,ga);P.setTranslate(C+Y,k+aa);if(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(u,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(u,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).resize();M("transition",J);break;case "zoom":L*=o;k*=o;ma(ua,
|
U:1;aa=U}if(kb.indexOf("w")>=0){ra=P?(P-L)/P:1;Y=P}L=d.createSVGTransform();u=d.createSVGTransform();P=d.createSVGTransform();if(n.gridSnapping){C=wa(C);Y=wa(Y);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+Y),-(k+aa));if(v.shiftKey)if(ra==1)ra=ga;else ga=ra;u.setScale(ra,ga);P.setTranslate(C+Y,k+aa);if(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(u,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(u,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).resize();M("transition",
|
||||||
{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}D=x;C=y;if(v.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea=="square"||v.shiftKey){L=D=Math.max(L,
|
J);break;case "zoom":L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}D=x;C=y;if(v.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea==
|
||||||
D);C=h<x?h:h-L;k=m<y?m:m-D}else{C=Math.min(h,x);k=Math.min(m,y)}if(v.altKey){L*=2;D*=2;C=h-L/2;k=m-D/2}if(n.gridSnapping){L=wa(L);D=wa(D);C=wa(C);k=wa(k)}ma(G,{width:L,height:D,x:C,y:k},1E3);break;case "circle":L=$(G).attr(["cx","cy"]);D=L.cx;C=L.cy;L=Math.sqrt((x-D)*(x-D)+(y-C)*(y-C));if(n.gridSnapping)L=wa(L);G.setAttributeNS(null,"r",L);break;case "ellipse":L=$(G).attr(["cx","cy"]);D=Math.abs(h+(x-h)/2);C=Math.abs(m+(y-m)/2);L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);
|
"square"||v.shiftKey){L=D=Math.max(L,D);C=h<x?h:h-L;k=m<y?m:m-D}else{C=Math.min(h,x);k=Math.min(m,y)}if(v.altKey){L*=2;D*=2;C=h-L/2;k=m-D/2}if(n.gridSnapping){L=wa(L);D=wa(D);C=wa(C);k=wa(k)}ma(G,{width:L,height:D,x:C,y:k},1E3);break;case "circle":L=$(G).attr(["cx","cy"]);D=L.cx;C=L.cy;L=Math.sqrt((x-D)*(x-D)+(y-C)*(y-C));if(n.gridSnapping)L=wa(L);G.setAttributeNS(null,"r",L);break;case "ellipse":L=$(G).attr(["cx","cy"]);D=Math.abs(h+(x-h)/2);C=Math.abs(m+(y-m)/2);L=null;window.opera||d.suspendRedraw(1E3);
|
||||||
D=wa(D);y=wa(y);C=wa(C)}k=Math.abs(h-D);u=Math.abs(m-C);if(v.shiftKey){u=k;C=y>m?m+k:m-k}if(v.altKey){D=h;C=m;k=Math.abs(x-D);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);G.setAttributeNS(null,"cx",D);G.setAttributeNS(null,"cy",C);window.opera||d.unsuspendRedraw(L);break;case "fhellipse":case "fhrect":A.minx=Math.min(L,A.minx);A.maxx=Math.max(L,A.maxx);A.miny=Math.min(k,A.miny);A.maxy=Math.max(k,A.maxy);case "fhpath":e+=+L+","+k+" ";G.setAttributeNS(null,
|
if(n.gridSnapping){x=wa(x);D=wa(D);y=wa(y);C=wa(C)}k=Math.abs(h-D);u=Math.abs(m-C);if(v.shiftKey){u=k;C=y>m?m+k:m-k}if(v.altKey){D=h;C=m;k=Math.abs(x-D);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);G.setAttributeNS(null,"cx",D);G.setAttributeNS(null,"cy",C);window.opera||d.unsuspendRedraw(L);break;case "fhellipse":case "fhrect":A.minx=Math.min(L,A.minx);A.maxx=Math.max(L,A.maxx);A.miny=Math.min(k,A.miny);A.maxy=Math.max(k,A.maxy);case "fhpath":e+=+L+","+
|
||||||
"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(v.shiftKey){if(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,x,y);x=C.x;y=C.y}if(ua&&ua.getAttribute("display")!=="none"){L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":L=svgedit.utilities.getBBox(F);
|
k+" ";G.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(v.shiftKey){if(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,x,y);x=C.x;y=C.y}if(ua&&ua.getAttribute("display")!=="none"){L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":L=
|
||||||
D=L.x+L.width/2;C=L.y+L.height/2;G=X(F);G=O(D,C,G);D=G.x;C=G.y;G=L.x;k=L.y;if(current_rotate_mode=="nw")G=L.x+L.width;if(current_rotate_mode=="se")k=L.y+L.height;if(current_rotate_mode=="sw"){G=L.x+L.width;k=L.y+L.height}compensation_angle=(Math.atan2(C-k,D-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,D-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=wa(S);if(v.shiftKey)S=Math.round(S/45)*45;b.setRotationAngle(S<-180?360+S:S,true);M("transition",J)}ob("mouseMove",{event:v,mouse_x:E,
|
svgedit.utilities.getBBox(F);D=L.x+L.width/2;C=L.y+L.height/2;G=X(F);G=O(D,C,G);D=G.x;C=G.y;G=L.x;k=L.y;if(current_rotate_mode=="nw")G=L.x+L.width;if(current_rotate_mode=="se")k=L.y+L.height;if(current_rotate_mode=="sw"){G=L.x+L.width;k=L.y+L.height}compensation_angle=(Math.atan2(C-k,D-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,D-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=wa(S);if(v.shiftKey)S=Math.round(S/45)*45;b.setRotationAngle(S<-180?360+S:S,true);M("transition",J)}ob("mouseMove",
|
||||||
mouse_y:I,selected:F})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var F=v.target.parentNode;if(F!==K){var I=Ib(v),E=I.tagName;if(E==="text"&&Ea!=="textedit"){v=O(v.pageX,v.pageY,rb);hb.select(I,v.x,v.y)}if((E==="g"||E==="a")&&oa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(v){b.addClones=false;window.removeEventListener("keyup",b.removeClones);if(v.button!==2){var F=
|
{event:v,mouse_x:E,mouse_y:I,selected:F})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var F=v.target.parentNode;if(F!==K){var I=Ib(v),E=I.tagName;if(E==="text"&&Ea!=="textedit"){v=O(v.pageX,v.pageY,rb);hb.select(I,v.x,v.y)}if((E==="g"||E==="a")&&oa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(v){b.addClones=false;window.removeEventListener("keyup",b.removeClones);
|
||||||
Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity=E.getAttribute("stroke-opacity");
|
if(v.button!==2){var F=Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity=
|
||||||
bb.stroke_width=E.getAttribute("stroke-width");bb.stroke_dasharray=E.getAttribute("stroke-dasharray");bb.stroke_linejoin=E.getAttribute("stroke-linejoin");bb.stroke_linecap=E.getAttribute("stroke-linecap")}if(E.tagName=="text"){Za.font_size=E.getAttribute("font-size");Za.font_family=E.getAttribute("font-family")}Ha.requestSelector(E).showGrips(true)}Ga();if(G!=z||L!=w){v=J.length;for(E=0;E<v;++E){if(J[E]==null)break;J[E].firstChild||Ha.requestSelector(J[E]).resize()}}else{E=v.target;if(J[0].nodeName===
|
E.getAttribute("stroke-opacity");bb.stroke_width=E.getAttribute("stroke-width");bb.stroke_dasharray=E.getAttribute("stroke-dasharray");bb.stroke_linejoin=E.getAttribute("stroke-linejoin");bb.stroke_linecap=E.getAttribute("stroke-linecap")}if(E.tagName=="text"){Za.font_size=E.getAttribute("font-size");Za.font_family=E.getAttribute("font-family")}Ha.requestSelector(E).showGrips(true)}Ga();if(G!=z||L!=w){v=J.length;for(E=0;E<v;++E){if(J[E]==null)break;J[E].firstChild||Ha.requestSelector(J[E]).resize()}}else{E=
|
||||||
"path"&&J[1]==null)Ja.select(J[0]);else v.shiftKey&&F!=E&&b.removeFromSelection([E])}if(svgedit.browser.supportsNonScalingStroke())if(v=J[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(P){P.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");M("zoomed",{x:Math.min(z,G),y:Math.min(w,L),width:Math.abs(G-z),height:Math.abs(L-w),factor:v.altKey?0.5:2});return;case "fhpath":F=k.getAttribute("points");G=F.indexOf(",");if(u=G>=0?F.indexOf(",",
|
v.target;if(J[0].nodeName==="path"&&J[1]==null)Ja.select(J[0]);else v.shiftKey&&F!=E&&b.removeFromSelection([E])}if(svgedit.browser.supportsNonScalingStroke())if(v=J[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(P){P.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");M("zoomed",{x:Math.min(z,G),y:Math.min(w,L),width:Math.abs(G-z),height:Math.abs(L-w),factor:v.altKey?0.5:2});return;case "fhpath":F=k.getAttribute("points");G=F.indexOf(",");
|
||||||
G+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":F=$(k).attr(["x1","x2","y1","y2"]);u=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(k).attr(["width","height"]);u=F.width!=0||F.height!=0||Ea==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":F=$(k).attr(["rx","ry"]);u=F.rx!=null||F.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"ellipse",curStyles:true,
|
if(u=G>=0?F.indexOf(",",G+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":F=$(k).attr(["x1","x2","y1","y2"]);u=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(k).attr(["width","height"]);u=F.width!=0||F.height!=0||Ea==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":F=$(k).attr(["rx","ry"]);u=F.rx!=null||F.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"ellipse",
|
||||||
attr:{cx:(A.minx+A.maxx)/2,cy:(A.miny+A.maxy)/2,rx:(A.maxx-A.minx)/2,ry:(A.maxy-A.miny)/2,id:ca()}});M("changed",[k]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});M("changed",[k]);u=true}break;case "text":u=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;F=Ja.mouseUp(v,k,E,I);k=F.element;u=F.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v);break;case "textedit":u=
|
curStyles:true,attr:{cx:(A.minx+A.maxx)/2,cy:(A.miny+A.maxy)/2,rx:(A.maxx-A.minx)/2,ry:(A.maxy-A.miny)/2,id:ca()}});M("changed",[k]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});M("changed",[k]);u=true}break;case "text":u=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;F=Ja.mouseUp(v,k,E,I);k=F.element;u=F.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v);
|
||||||
false;k=null;hb.mouseUp(v,E,I);break;case "rotate":u=true;k=null;Ea="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();M("changed",J)}E=ob("mouseUp",{event:v,mouse_x:E,mouse_y:I},true);$.each(E,function(P,U){if(U){u=U.keep||u;k=U.element;La=U.started||La}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(E=v.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&&E.id!="svgcanvas"&&
|
break;case "textedit":u=false;k=null;hb.mouseUp(v,E,I);break;case "rotate":u=true;k=null;Ea="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();M("changed",J)}E=ob("mouseUp",{event:v,mouse_x:E,mouse_y:I},true);$.each(E,function(P,U){if(U){u=U.keep||u;k=U.element;La=U.started||La}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(E=v.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&&
|
||||||
E.id!="svgroot"){b.setMode("select");xb([E],true)}}else if(k!=null){b.addedNew=true;v=0.2;var C;if(false.beginElement&&k.getAttribute("opacity")!=N.opacity){C=$(false).clone().attr({to:N.opacity,dur:v}).appendTo(k);try{C[0].beginElement()}catch(D){}}else v=0;setTimeout(function(){C&&C.remove();k.setAttribute("opacity",N.opacity);k.setAttribute("style","pointer-events:inherit");na(k);if(Ea==="path")Ja.toEditMode(k);else n.selectNew&&xb([k],true);ya(new Ca(k));M("changed",[k])},v*1E3)}Va=null}}});$(a).bind("mousewheel DOMMouseScroll",
|
E.id!="svgcanvas"&&E.id!="svgroot"){b.setMode("select");xb([E],true)}}else if(k!=null){b.addedNew=true;v=0.2;var C;if(false.beginElement&&k.getAttribute("opacity")!=N.opacity){C=$(false).clone().attr({to:N.opacity,dur:v}).appendTo(k);try{C[0].beginElement()}catch(D){}}else v=0;setTimeout(function(){C&&C.remove();k.setAttribute("opacity",N.opacity);k.setAttribute("style","pointer-events:inherit");na(k);if(Ea==="path")Ja.toEditMode(k);else n.selectNew&&xb([k],true);ya(new Ca(k));M("changed",[k])},v*
|
||||||
function(v){if(v.shiftKey){v.preventDefault();rb=l.getScreenCTM().inverse();var F=O(v.pageX,v.pageY,rb);F={x:F.x,y:F.y,width:0,height:0};if(v.wheelDelta)if(v.wheelDelta>=120)F.factor=2;else{if(v.wheelDelta<=-120)F.factor=0.5}else if(v.detail)if(v.detail>0)F.factor=0.5;else if(v.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var pb=function(e){$(e).click(function(h){h.preventDefault()})},hb=b.textActions=function(){function e(S){var Y=I.value==="";$(I).focus();if(!arguments.length)if(Y)S=0;else{if(I.selectionEnd!==
|
1E3)}Va=null}}});$(a).bind("mousewheel DOMMouseScroll",function(v){if(v.shiftKey){v.preventDefault();rb=l.getScreenCTM().inverse();var F=O(v.pageX,v.pageY,rb);F={x:F.x,y:F.y,width:0,height:0};if(v.wheelDelta)if(v.wheelDelta>=120)F.factor=2;else{if(v.wheelDelta<=-120)F.factor=0.5}else if(v.detail)if(v.detail>0)F.factor=0.5;else if(v.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var pb=function(e){$(e).click(function(h){h.preventDefault()})},hb=b.textActions=function(){function e(S){var Y=I.value===
|
||||||
I.selectionStart)return;S=I.selectionEnd}var aa;aa=k[S];Y||I.setSelectionRange(S,S);E=qa("text_cursor");if(!E){E=document.createElementNS(c,"line");ma(E,{id:"text_cursor",stroke:"#333","stroke-width":1});E=qa("selectorParentGroup").appendChild(E)}L||(L=setInterval(function(){var ga=E.getAttribute("display")==="none";E.setAttribute("display",ga?"inline":"none")},600));Y=H(aa.x,u.y);aa=H(aa.x,u.y+u.height);ma(E,{x1:Y.x,y1:Y.y,x2:aa.x,y2:aa.y,visibility:"visible",display:"inline"});G&&G.setAttribute("d",
|
"";$(I).focus();if(!arguments.length)if(Y)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var aa;aa=k[S];Y||I.setSelectionRange(S,S);E=qa("text_cursor");if(!E){E=document.createElementNS(c,"line");ma(E,{id:"text_cursor",stroke:"#333","stroke-width":1});E=qa("selectorParentGroup").appendChild(E)}L||(L=setInterval(function(){var ga=E.getAttribute("display")==="none";E.setAttribute("display",ga?"inline":"none")},600));Y=H(aa.x,u.y);aa=H(aa.x,u.y+u.height);ma(E,{x1:Y.x,y1:Y.y,x2:aa.x,
|
||||||
"")}function h(S,Y,aa){if(S===Y)e(Y);else{aa||I.setSelectionRange(S,Y);G=qa("text_selectblock");if(!G){G=document.createElementNS(c,"path");ma(G,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});qa("selectorParentGroup").appendChild(G)}S=k[S];var ga=k[Y];E.setAttribute("visibility","hidden");Y=H(S.x,u.y);aa=H(S.x+(ga.x-S.x),u.y);var ra=H(S.x,u.y+u.height);S=H(S.x+(ga.x-S.x),u.y+u.height);ma(G,{d:"M"+Y.x+","+Y.y+" L"+aa.x+","+aa.y+" "+S.x+","+S.y+" "+ra.x+","+ra.y+"z",display:"inline"})}}
|
y2:aa.y,visibility:"visible",display:"inline"});G&&G.setAttribute("d","")}function h(S,Y,aa){if(S===Y)e(Y);else{aa||I.setSelectionRange(S,Y);G=qa("text_selectblock");if(!G){G=document.createElementNS(c,"path");ma(G,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});qa("selectorParentGroup").appendChild(G)}S=k[S];var ga=k[Y];E.setAttribute("visibility","hidden");Y=H(S.x,u.y);aa=H(S.x+(ga.x-S.x),u.y);var ra=H(S.x,u.y+u.height);S=H(S.x+(ga.x-S.x),u.y+u.height);ma(G,{d:"M"+
|
||||||
function m(S,Y){var aa=d.createSVGPoint();aa.x=S;aa.y=Y;if(k.length==1)return 0;aa=F.getCharNumAtPosition(aa);if(aa<0){aa=k.length-2;if(S<=k[0].x)aa=0}else if(aa>=k.length-2)aa=k.length-2;var ga=k[aa];S>ga.x+ga.width/2&&aa++;return aa}function z(S,Y,aa){var ga=I.selectionStart;S=m(S,Y);h(Math.min(ga,S),Math.max(ga,S),!aa)}function w(S,Y){var aa={x:S,y:Y};aa.x/=o;aa.y/=o;if(C){var ga=O(aa.x,aa.y,C.inverse());aa.x=ga.x;aa.y=ga.y}return aa}function H(S,Y){var aa={x:S,y:Y};if(C){var ga=O(aa.x,aa.y,C);
|
Y.x+","+Y.y+" L"+aa.x+","+aa.y+" "+S.x+","+S.y+" "+ra.x+","+ra.y+"z",display:"inline"})}}function m(S,Y){var aa=d.createSVGPoint();aa.x=S;aa.y=Y;if(k.length==1)return 0;aa=F.getCharNumAtPosition(aa);if(aa<0){aa=k.length-2;if(S<=k[0].x)aa=0}else if(aa>=k.length-2)aa=k.length-2;var ga=k[aa];S>ga.x+ga.width/2&&aa++;return aa}function z(S,Y,aa){var ga=I.selectionStart;S=m(S,Y);h(Math.min(ga,S),Math.max(ga,S),!aa)}function w(S,Y){var aa={x:S,y:Y};aa.x/=o;aa.y/=o;if(C){var ga=O(aa.x,aa.y,C.inverse());aa.x=
|
||||||
aa.x=ga.x;aa.y=ga.y}aa.x*=o;aa.y*=o;return aa}function A(S){h(0,F.textContent.length);$(this).unbind(S)}function v(S){if(U&&F){var Y=O(S.pageX,S.pageY,rb);Y=w(Y.x*o,Y.y*o);Y=m(Y.x,Y.y);var aa=F.textContent,ga=aa.substr(0,Y).replace(/[a-z0-9]+$/i,"").length;aa=aa.substr(Y).match(/^[a-z0-9]+/i);h(ga,(aa?aa[0].length:0)+Y);$(S.target).click(A);setTimeout(function(){$(S.target).unbind("click",A)},300)}}var F,I,E,G,L,k=[],u,C,D,P,U;return{select:function(S,Y,aa){F=S;hb.toEditMode(Y,aa)},start:function(S){F=
|
ga.x;aa.y=ga.y}return aa}function H(S,Y){var aa={x:S,y:Y};if(C){var ga=O(aa.x,aa.y,C);aa.x=ga.x;aa.y=ga.y}aa.x*=o;aa.y*=o;return aa}function A(S){h(0,F.textContent.length);$(this).unbind(S)}function v(S){if(U&&F){var Y=O(S.pageX,S.pageY,rb);Y=w(Y.x*o,Y.y*o);Y=m(Y.x,Y.y);var aa=F.textContent,ga=aa.substr(0,Y).replace(/[a-z0-9]+$/i,"").length;aa=aa.substr(Y).match(/^[a-z0-9]+/i);h(ga,(aa?aa[0].length:0)+Y);$(S.target).click(A);setTimeout(function(){$(S.target).unbind("click",A)},300)}}var F,I,E,G,L,
|
||||||
S;hb.toEditMode()},mouseDown:function(S,Y,aa,ga){S=w(aa,ga);I.focus();e(m(S.x,S.y));D=aa;P=ga},mouseMove:function(S,Y){var aa=w(S,Y);z(aa.x,aa.y)},mouseUp:function(S,Y,aa){var ga=w(Y,aa);z(ga.x,ga.y,true);S.target!==F&&Y<D+2&&Y>D-2&&aa<P+2&&aa>P-2&&hb.toSelectMode(true)},setCursor:e,toEditMode:function(S,Y){xb([F],false);U=false;Ea="textedit";Ha.requestSelector(F);hb.init();$(F).css("cursor","text");if(arguments.length){var aa=w(S,Y);e(m(aa.x,aa.y))}else e();setTimeout(function(){U=true},300)},toSelectMode:function(S){Ea=
|
k=[],u,C,D,P,U;return{select:function(S,Y,aa){F=S;hb.toEditMode(Y,aa)},start:function(S){F=S;hb.toEditMode()},mouseDown:function(S,Y,aa,ga){S=w(aa,ga);I.focus();e(m(S.x,S.y));D=aa;P=ga},mouseMove:function(S,Y){var aa=w(S,Y);z(aa.x,aa.y)},mouseUp:function(S,Y,aa){var ga=w(Y,aa);z(ga.x,ga.y,true);S.target!==F&&Y<D+2&&Y>D-2&&aa<P+2&&aa>P-2&&hb.toSelectMode(true)},setCursor:e,toEditMode:function(S,Y){xb([F],false);U=false;Ea="textedit";Ha.requestSelector(F);hb.init();$(F).css("cursor","text");if(arguments.length){var aa=
|
||||||
"select";clearInterval(L);L=null;G&&$(G).attr("display","none");E&&$(E).attr("visibility","hidden");$(F).css("cursor","move");if(S){Qa();$(F).css("cursor","move");M("selected",[F]);vb([F],true)}F&&!F.textContent.length&&b.deleteSelectedElements();$(I).blur();F=false},setInputElem:function(S){I=S},clear:function(){Ea=="textedit"&&hb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=J[0];Ha.requestSelector(F).showGrips(false)}var S=F.textContent.length,Y=F.getAttribute("transform");u=svgedit.utilities.getBBox(F);
|
w(S,Y);e(m(aa.x,aa.y))}else e();setTimeout(function(){U=true},300)},toSelectMode:function(S){Ea="select";clearInterval(L);L=null;G&&$(G).attr("display","none");E&&$(E).attr("visibility","hidden");$(F).css("cursor","move");if(S){Qa();$(F).css("cursor","move");M("selected",[F]);vb([F],true)}F&&!F.textContent.length&&b.deleteSelectedElements();$(I).blur();F=false},setInputElem:function(S){I=S},clear:function(){Ea=="textedit"&&hb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=J[0];Ha.requestSelector(F).showGrips(false)}var S=
|
||||||
C=Y?X(F):null;k=Array(S);I.focus();$(F).unbind("dblclick",v).dblclick(v);if(!S)var aa={x:u.x+u.width/2,width:0};for(Y=0;Y<S;Y++){var ga=F.getStartPositionOfChar(Y);aa=F.getEndPositionOfChar(Y);if(!svgedit.browser.supportsGoodTextCharPos()){var ra=b.contentW*o;ga.x-=ra;aa.x-=ra;ga.x/=o;aa.x/=o}k[Y]={x:ga.x,y:u.y,width:aa.x-ga.x,height:u.height}}k.push({x:aa.x,width:0});h(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=b.pathActions=function(){var e=false,h,m,z;svgedit.path.Path.prototype.endChanges=
|
F.textContent.length,Y=F.getAttribute("transform");u=svgedit.utilities.getBBox(F);C=Y?X(F):null;k=Array(S);I.focus();$(F).unbind("dblclick",v).dblclick(v);if(!S)var aa={x:u.x+u.width/2,width:0};for(Y=0;Y<S;Y++){var ga=F.getStartPositionOfChar(Y);aa=F.getEndPositionOfChar(Y);if(!svgedit.browser.supportsGoodTextCharPos()){var ra=b.contentW*o;ga.x-=ra;aa.x-=ra;ga.x/=o;aa.x/=o}k[Y]={x:ga.x,y:u.y,width:aa.x-ga.x,height:u.height}}k.push({x:aa.x,width:0});h(I.selectionStart,I.selectionEnd,true)}}}}(),Ja=
|
||||||
function(A){if(svgedit.browser.isWebkit()){var v=this.elem;v.setAttribute("d",Ja.convertPath(v))}A=new Na(this.elem,{d:this.last_d},A);ya(A);M("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(A){$.isArray(A)||(A=[A]);for(var v=0;v<A.length;v++){var F=A[v],I=this.segs[F];I.ptgrip&&this.selected_pts.indexOf(F)==-1&&F>=0&&this.selected_pts.push(F)}this.selected_pts.sort();v=this.selected_pts.length;for(A=Array(v);v--;){I=this.segs[this.selected_pts[v]];I.select(true);A[v]=
|
b.pathActions=function(){var e=false,h,m,z;svgedit.path.Path.prototype.endChanges=function(A){if(svgedit.browser.isWebkit()){var v=this.elem;v.setAttribute("d",Ja.convertPath(v))}A=new Na(this.elem,{d:this.last_d},A);ya(A);M("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(A){$.isArray(A)||(A=[A]);for(var v=0;v<A.length;v++){var F=A[v],I=this.segs[F];I.ptgrip&&this.selected_pts.indexOf(F)==-1&&F>=0&&this.selected_pts.push(F)}this.selected_pts.sort();v=this.selected_pts.length;
|
||||||
I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",A)};var w=h=null,H=false;return{mouseDown:function(A,v,F,I){if(Ea==="path"){mouse_x=F;mouse_y=I;I=mouse_x/o;v=mouse_y/o;F=qa("path_stretch_line");m=[I,v];if(n.gridSnapping){I=wa(I);v=wa(v);mouse_x=wa(mouse_x);mouse_y=wa(mouse_y)}if(!F){F=document.createElementNS(c,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});F=qa("selectorParentGroup").appendChild(F)}F.setAttribute("display",
|
for(A=Array(v);v--;){I=this.segs[this.selected_pts[v]];I.select(true);A[v]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",A)};var w=h=null,H=false;return{mouseDown:function(A,v,F,I){if(Ea==="path"){mouse_x=F;mouse_y=I;I=mouse_x/o;v=mouse_y/o;F=qa("path_stretch_line");m=[I,v];if(n.gridSnapping){I=wa(I);v=wa(v);mouse_x=wa(mouse_x);mouse_y=wa(mouse_y)}if(!F){F=document.createElementNS(c,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",
|
||||||
"inline");var E=null;if(w){E=w.pathSegList;for(var G=E.numberOfItems,L=6/o,k=false;G;){G--;var u=E.getItem(G),C=u.x;u=u.y;if(I>=C-L&&I<=C+L&&v>=u-L&&v<=u+L){k=true;break}}L=ca();svgedit.path.removePath_(L);L=qa(L);C=E.numberOfItems;if(k){if(G<=1&&C>=2){I=E.getItem(0).x;v=E.getItem(0).y;A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(I,v):w.createSVGPathSegCurvetoCubicAbs(I,v,A.x1/o,A.y1/o,I,v);I=w.createSVGPathSegClosePath();E.appendItem(A);E.appendItem(I)}else if(C<3)return E=
|
fill:"none"});F=qa("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var E=null;if(w){E=w.pathSegList;for(var G=E.numberOfItems,L=6/o,k=false;G;){G--;var u=E.getItem(G),C=u.x;u=u.y;if(I>=C-L&&I<=C+L&&v>=u-L&&v<=u+L){k=true;break}}L=ca();svgedit.path.removePath_(L);L=qa(L);C=E.numberOfItems;if(k){if(G<=1&&C>=2){I=E.getItem(0).x;v=E.getItem(0).y;A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(I,v):w.createSVGPathSegCurvetoCubicAbs(I,v,A.x1/o,A.y1/o,
|
||||||
false;$(F).remove();element=L;w=null;La=false;if(e){svgedit.path.path.matrix&&db(L,{},svgedit.path.path.matrix.inverse());F=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+F);$(L).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Ib(A))){console.log("Clicked outside canvas");return false}E=w.pathSegList.numberOfItems;
|
I,v);I=w.createSVGPathSegClosePath();E.appendItem(A);E.appendItem(I)}else if(C<3)return E=false;$(F).remove();element=L;w=null;La=false;if(e){svgedit.path.path.matrix&&db(L,{},svgedit.path.path.matrix.inverse());F=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+F);$(L).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,
|
||||||
G=w.pathSegList.getItem(E-1);L=G.x;G=G.y;if(A.shiftKey){A=ba(L,G,I,v);I=A.x;v=A.y}A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(eb(I),eb(v)):w.createSVGPathSegCurvetoCubicAbs(eb(I),eb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;F.setAttribute("d",["M",I,v,I,v].join(" "));F=E;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,I,v)}}else{d_attr="M"+I+","+v+" ";w=R({element:"path",curStyles:true,attr:{d:d_attr,id:ja(),opacity:N.opacity/
|
Ib(A))){console.log("Clicked outside canvas");return false}E=w.pathSegList.numberOfItems;G=w.pathSegList.getItem(E-1);L=G.x;G=G.y;if(A.shiftKey){A=ba(L,G,I,v);I=A.x;v=A.y}A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(eb(I),eb(v)):w.createSVGPathSegCurvetoCubicAbs(eb(I),eb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;F.setAttribute("d",["M",I,v,I,v].join(" "));F=E;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,I,v)}}else{d_attr=
|
||||||
2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();L=A.target.id;if(L.substr(0,14)=="pathpointgrip_"){v=svgedit.path.path.cur_pt=parseInt(L.substr(14));svgedit.path.path.dragging=[F,I];E=svgedit.path.path.segs[v];if(A.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(v):svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=
|
"M"+I+","+v+" ";w=R({element:"path",curStyles:true,attr:{d:d_attr,id:ja(),opacity:N.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();L=A.target.id;if(L.substr(0,14)=="pathpointgrip_"){v=svgedit.path.path.cur_pt=parseInt(L.substr(14));svgedit.path.path.dragging=[F,I];E=svgedit.path.path.segs[v];if(A.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(v):
|
||||||
1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I=w.pathSegList;A=I.numberOfItems-1;if(m){var E=svgedit.path.addCtrlGrip("1c1"),
|
svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I=
|
||||||
G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");E.setAttribute("cx",v);E.setAttribute("cy",F);E.setAttribute("display","inline");E=m[0];var L=m[1];I.getItem(A);var k=E+(E-v/o),u=L+(L-F/o);G.setAttribute("cx",k*o);G.setAttribute("cy",u*o);G.setAttribute("display","inline");G=svgedit.path.getCtrlLine(1);var C=svgedit.path.getCtrlLine(2);ma(G,{x1:v,y1:F,x2:E*o,y2:L*o,display:"inline"});ma(C,{x1:k*o,y1:u*o,x2:E*o,y2:L*o,display:"inline"});if(A===0)z=[v,F];else{I=I.getItem(A-
|
w.pathSegList;A=I.numberOfItems-1;if(m){var E=svgedit.path.addCtrlGrip("1c1"),G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");E.setAttribute("cx",v);E.setAttribute("cy",F);E.setAttribute("display","inline");E=m[0];var L=m[1];I.getItem(A);var k=E+(E-v/o),u=L+(L-F/o);G.setAttribute("cx",k*o);G.setAttribute("cy",u*o);G.setAttribute("display","inline");G=svgedit.path.getCtrlLine(1);var C=svgedit.path.getCtrlLine(2);ma(G,{x1:v,y1:F,x2:E*o,y2:L*o,display:"inline"});ma(C,{x1:k*
|
||||||
1);v=I.x;F=I.y;if(I.pathSegType===6){v+=v-I.x2;F+=F-I.y2}else if(z){v=z[0]/o;F=z[1]/o}svgedit.path.replacePathSeg(6,A,[E,L,v,F,k,u],w)}}else if(E=qa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,F,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,F],E);else z?svgedit.path.replacePathSeg(6,1,[v,F,z[0],z[1],v,F],E):svgedit.path.replacePathSeg(4,1,[v,F],E)}}}else if(svgedit.path.path.dragging){E=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},
|
o,y1:u*o,x2:E*o,y2:L*o,display:"inline"});if(A===0)z=[v,F];else{I=I.getItem(A-1);v=I.x;F=I.y;if(I.pathSegType===6){v+=v-I.x2;F+=F-I.y2}else if(z){v=z[0]/o;F=z[1]/o}svgedit.path.replacePathSeg(6,A,[E,L,v,F,k,u],w)}}else if(E=qa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,F,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,F],E);else z?svgedit.path.replacePathSeg(6,1,[v,F,z[0],z[1],v,F],E):svgedit.path.replacePathSeg(4,1,[v,F],E)}}}else if(svgedit.path.path.dragging){E=
|
||||||
svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ua.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&svgedit.path.path.selected_pts.push(this.index)}})}},
|
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ua.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,
|
||||||
mouseUp:function(A,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}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();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(F)}else if(ua&&ua.getAttribute("display")!="none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=
|
{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(A,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}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();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(F)}else if(ua&&ua.getAttribute("display")!=
|
||||||
2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(v){M("selected",[A]);vb([A],true)}},addSubPath:function(A){if(A){Ea=
|
"none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&&
|
||||||
"path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ea="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(oa(A)!=0){var v=new za("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Na(A,F));Qa();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix=null;this.clear();vb([A],true);M("changed",J)}},clear:function(){h=null;if(w){var A=qa(ca());$(qa("path_stretch_line")).remove();
|
svgedit.path.recalcRotatedPath();if(v){M("selected",[A]);vb([A],true)}},addSubPath:function(A){if(A){Ea="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ea="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(oa(A)!=0){var v=new za("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Na(A,F));Qa();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix=null;
|
||||||
$(A).remove();$(qa("pathpointgrip_container")).find("*").attr("display","none");w=z=null;La=false}else Ea=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(A){if(A==null||A.nodeName!="path")return false;var v=V(A),F=fa(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems,E=0;E<I;++E){var G=v.getItem(E),L=G.pathSegType;if(L!=1){var k=[];$.each(["",1,2],function(u,C){var D=G["x"+C],P=G["y"+C];if(D!==
|
this.clear();vb([A],true);M("changed",J)}},clear:function(){h=null;if(w){var A=qa(ca());$(qa("path_stretch_line")).remove();$(A).remove();$(qa("pathpointgrip_container")).find("*").attr("display","none");w=z=null;La=false}else Ea=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(A){if(A==null||A.nodeName!="path")return false;var v=V(A),F=fa(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems,
|
||||||
undefined&&P!==undefined){D=O(D,P,F);k.splice(k.length,0,D.x,D.y)}});svgedit.path.replacePathSeg(L,E,k,A)}}g(A,F)},zoomChange:function(){Ea=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var A=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:A.item.x,y:A.item.y,type:A.type}},linkControlPoints:function(A){svgedit.path.setLinkControlPoints(A)},clonePathNode:function(){svgedit.path.path.storeD();for(var A=svgedit.path.path.selected_pts,
|
E=0;E<I;++E){var G=v.getItem(E),L=G.pathSegType;if(L!=1){var k=[];$.each(["",1,2],function(u,C){var D=G["x"+C],P=G["y"+C];if(D!==undefined&&P!==undefined){D=O(D,P,F);k.splice(k.length,0,D.x,D.y)}});svgedit.path.replacePathSeg(L,E,k,A)}}g(A,F)},zoomChange:function(){Ea=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var A=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:A.item.x,y:A.item.y,type:A.type}},linkControlPoints:function(A){svgedit.path.setLinkControlPoints(A)},
|
||||||
v=A.length,F=[];v--;){var I=A[v];svgedit.path.path.addSeg(I);F.push(I+v);F.push(I+v+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var A=svgedit.path.path.selected_pts;if(A.length===1){var v=svgedit.path.path.elem,F=v.pathSegList,I=A[0],E=null,G=null;svgedit.path.path.eachSeg(function(C){if(this.type===2&&C<=I)G=this.item;if(C<=I)return true;if(this.type===2){E=C;return false}else if(this.type===1)return E=false});if(E==
|
clonePathNode:function(){svgedit.path.path.storeD();for(var A=svgedit.path.path.selected_pts,v=A.length,F=[];v--;){var I=A[v];svgedit.path.path.addSeg(I);F.push(I+v);F.push(I+v+1)}svgedit.path.path.init().addPtsToSelection(F);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var A=svgedit.path.path.selected_pts;if(A.length===1){var v=svgedit.path.path.elem,F=v.pathSegList,I=A[0],E=null,G=null;svgedit.path.path.eachSeg(function(C){if(this.type===2&&C<=I)G=this.item;if(C<=
|
||||||
null)E=svgedit.path.path.segs.length-1;if(E!==false){var L=v.createSVGPathSegLinetoAbs(G.x,G.y),k=v.createSVGPathSegClosePath();if(E==svgedit.path.path.segs.length-1){F.appendItem(L);F.appendItem(k)}else{svgedit.path.insertItemBefore(v,k,E);svgedit.path.insertItemBefore(v,L,E)}svgedit.path.path.init().selectPt(E+1)}else if(svgedit.path.path.segs[I].mate){F.removeItem(I);F.removeItem(I);svgedit.path.path.init().selectPt(I-1)}else{for(A=0;A<F.numberOfItems;A++){var u=F.getItem(A);if(u.pathSegType===
|
I)return true;if(this.type===2){E=C;return false}else if(this.type===1)return E=false});if(E==null)E=svgedit.path.path.segs.length-1;if(E!==false){var L=v.createSVGPathSegLinetoAbs(G.x,G.y),k=v.createSVGPathSegClosePath();if(E==svgedit.path.path.segs.length-1){F.appendItem(L);F.appendItem(k)}else{svgedit.path.insertItemBefore(v,k,E);svgedit.path.insertItemBefore(v,L,E)}svgedit.path.path.init().selectPt(E+1)}else if(svgedit.path.path.segs[I].mate){F.removeItem(I);F.removeItem(I);svgedit.path.path.init().selectPt(I-
|
||||||
2)L=A;else if(A===I)F.removeItem(L);else if(u.pathSegType===1&&I<A){k=A-1;F.removeItem(A);break}}for(A=I-L-1;A--;)svgedit.path.insertItemBefore(v,F.getItem(L),k);v=F.getItem(L);svgedit.path.replacePathSeg(2,L,[v.x,v.y]);A=I;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ja.canDeleteNodes){svgedit.path.path.storeD();for(var A=svgedit.path.path.selected_pts,v=A.length;v--;)svgedit.path.path.deleteSeg(A[v]);var F=function(){var I=svgedit.path.path.elem.pathSegList,E=I.numberOfItems,
|
1)}else{for(A=0;A<F.numberOfItems;A++){var u=F.getItem(A);if(u.pathSegType===2)L=A;else if(A===I)F.removeItem(L);else if(u.pathSegType===1&&I<A){k=A-1;F.removeItem(A);break}}for(A=I-L-1;A--;)svgedit.path.insertItemBefore(v,F.getItem(L),k);v=F.getItem(L);svgedit.path.replacePathSeg(2,L,[v.x,v.y]);A=I;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ja.canDeleteNodes){svgedit.path.path.storeD();for(var A=svgedit.path.path.selected_pts,v=A.length;v--;)svgedit.path.path.deleteSeg(A[v]);
|
||||||
G=function(u,C){for(;C--;)I.removeItem(u)};if(E<=1)return true;for(;E--;){var L=I.getItem(E);if(L.pathSegType===1){L=I.getItem(E-1);var k=I.getItem(E-2);if(L.pathSegType===2){G(E-1,2);F();break}else if(k.pathSegType===2){G(E-2,3);F();break}}else if(L.pathSegType===2)if(E>0){L=I.getItem(E-1).pathSegType;if(L===2){G(E-1,1);F();break}else if(L===1&&I.numberOfItems-1===E){G(E,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ja.toSelectMode(svgedit.path.path.elem);
|
var F=function(){var I=svgedit.path.path.elem.pathSegList,E=I.numberOfItems,G=function(u,C){for(;C--;)I.removeItem(u)};if(E<=1)return true;for(;E--;){var L=I.getItem(E);if(L.pathSegType===1){L=I.getItem(E-1);var k=I.getItem(E-2);if(L.pathSegType===2){G(E-1,2);F();break}else if(k.pathSegType===2){G(E-2,3);F();break}}else if(L.pathSegType===2)if(E>0){L=I.getItem(E-1).pathSegType;if(L===2){G(E-1,1);F();break}else if(L===1&&I.numberOfItems-1===E){G(E,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=
|
||||||
b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){A=$(svgedit.path.path.elem);A.attr("d",A.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(A){var v=A.points,F=v.numberOfItems;if(F>=4){var I=v.getItem(0),E=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=F-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(E)if((I=svgedit.path.smoothControlPoints(E,L,I))&&I.length==
|
1){Ja.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){A=$(svgedit.path.path.elem);A.attr("d",A.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(A){var v=A.points,F=v.numberOfItems;if(F>=4){var I=v.getItem(0),E=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=F-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(E)if((I=svgedit.path.smoothControlPoints(E,
|
||||||
2){L=A[A.length-1].split(",");L[2]=I[0].x;L[3]=I[0].y;A[A.length-1]=L.join(",");L=I[1]}A.push([L.x,L.y,k.x,k.y,u.x,u.y].join(","));I=u;E=k}for(A.push("L");G<F;++G){k=v.getItem(G);A.push([k.x,k.y].join(","))}A=A.join(" ");A=R({element:"path",curStyles:true,attr:{id:ca(),d:A,fill:"none"}})}return A},setSegType:function(A){svgedit.path.path.setSegType(A)},moveNode:function(A,v){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];var I={x:0,y:0};
|
L,I))&&I.length==2){L=A[A.length-1].split(",");L[2]=I[0].x;L[3]=I[0].y;A[A.length-1]=L.join(",");L=I[1]}A.push([L.x,L.y,k.x,k.y,u.x,u.y].join(","));I=u;E=k}for(A.push("L");G<F;++G){k=v.getItem(G);A.push([k.x,k.y].join(","))}A=A.join(" ");A=R({element:"path",curStyles:true,attr:{id:ca(),d:A,fill:"none"}})}return A},setSegType:function(A){svgedit.path.path.setSegType(A)},moveNode:function(A,v){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];
|
||||||
I[A]=v-F.item[A];F.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(A){for(var v=A.pathSegList,F=v.numberOfItems,I,E=0;E<F;++E){var G=v.getItem(E);if(G.pathSegType===2)I=G;if(G.pathSegType===1){G=v.getItem(E-1);if(G.x!=I.x||G.y!=I.y){v=A.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(A,v,E);Ja.fixEnd(A);break}}}svgedit.browser.isWebkit()&&A.setAttribute("d",Ja.convertPath(A))},convertPath:function(A,v){for(var F=A.pathSegList,I=F.numberOfItems,E=0,
|
var I={x:0,y:0};I[A]=v-F.item[A];F.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(A){for(var v=A.pathSegList,F=v.numberOfItems,I,E=0;E<F;++E){var G=v.getItem(E);if(G.pathSegType===2)I=G;if(G.pathSegType===1){G=v.getItem(E-1);if(G.x!=I.x||G.y!=I.y){v=A.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(A,v,E);Ja.fixEnd(A);break}}}svgedit.browser.isWebkit()&&A.setAttribute("d",Ja.convertPath(A))},convertPath:function(A,v){for(var F=A.pathSegList,I=F.numberOfItems,
|
||||||
G=0,L="",k=null,u=0;u<I;++u){var C=F.getItem(u),D=C.x||0,P=C.y||0,U=C.x1||0,S=C.y1||0,Y=C.x2||0,aa=C.y2||0,ga=C.pathSegType,ra=Pa[ga]["to"+(v?"Lower":"Upper")+"Case"](),Oa=function(Ba,ha,Ta){ha=ha?" "+ha.join(" "):"";Ta=Ta?" "+svgedit.units.shortFloat(Ta):"";$.each(Ba,function(Ra,ta){Ba[Ra]=svgedit.units.shortFloat(ta)});L+=ra+Ba.join(" ")+ha+Ta};switch(ga){case 1:L+="z";break;case 12:D-=E;case 13:if(v){E+=D;ra="l"}else{D+=E;E=D;ra="L"}Oa([[D,G]]);break;case 14:P-=G;case 15:if(v){G+=P;ra="l"}else{P+=
|
E=0,G=0,L="",k=null,u=0;u<I;++u){var C=F.getItem(u),D=C.x||0,P=C.y||0,U=C.x1||0,S=C.y1||0,Y=C.x2||0,aa=C.y2||0,ga=C.pathSegType,ra=Pa[ga]["to"+(v?"Lower":"Upper")+"Case"](),Oa=function(Ba,ha,Ta){ha=ha?" "+ha.join(" "):"";Ta=Ta?" "+svgedit.units.shortFloat(Ta):"";$.each(Ba,function(Ra,ta){Ba[Ra]=svgedit.units.shortFloat(ta)});L+=ra+Ba.join(" ")+ha+Ta};switch(ga){case 1:L+="z";break;case 12:D-=E;case 13:if(v){E+=D;ra="l"}else{D+=E;E=D;ra="L"}Oa([[D,G]]);break;case 14:P-=G;case 15:if(v){G+=P;ra="l"}else{P+=
|
||||||
G;G=P;ra="L"}Oa([[E,P]]);break;case 2:case 4:case 18:D-=E;P-=G;case 5:case 3:if(k&&F.getItem(u-1).pathSegType===1&&!v){E=k[0];G=k[1]}case 19:if(v){E+=D;G+=P}else{D+=E;P+=G;E=D;G=P}if(ga===3)k=[E,G];Oa([[D,P]]);break;case 6:D-=E;U-=E;Y-=E;P-=G;S-=G;aa-=G;case 7:if(v){E+=D;G+=P}else{D+=E;U+=E;Y+=E;P+=G;S+=G;aa+=G;E=D;G=P}Oa([[U,S],[Y,aa],[D,P]]);break;case 8:D-=E;U-=E;P-=G;S-=G;case 9:if(v){E+=D;G+=P}else{D+=E;U+=E;P+=G;S+=G;E=D;G=P}Oa([[U,S],[D,P]]);break;case 10:D-=E;P-=G;case 11:if(v){E+=D;G+=P}else{D+=
|
G;G=P;ra="L"}Oa([[E,P]]);break;case 2:case 4:case 18:D-=E;P-=G;case 5:case 3:if(k&&F.getItem(u-1).pathSegType===1&&!v){E=k[0];G=k[1]}case 19:if(v){E+=D;G+=P}else{D+=E;P+=G;E=D;G=P}if(ga===3)k=[E,G];Oa([[D,P]]);break;case 6:D-=E;U-=E;Y-=E;P-=G;S-=G;aa-=G;case 7:if(v){E+=D;G+=P}else{D+=E;U+=E;Y+=E;P+=G;S+=G;aa+=G;E=D;G=P}Oa([[U,S],[Y,aa],[D,P]]);break;case 8:D-=E;U-=E;P-=G;S-=G;case 9:if(v){E+=D;G+=P}else{D+=E;U+=E;P+=G;S+=G;E=D;G=P}Oa([[U,S],[D,P]]);break;case 10:D-=E;P-=G;case 11:if(v){E+=D;G+=P}else{D+=
|
||||||
E;P+=G;E=D;G=P}Oa([[C.r1,C.r2]],[C.angle,C.largeArcFlag?1:0,C.sweepFlag?1:0],[D,P]);break;case 16:D-=E;Y-=E;P-=G;aa-=G;case 17:if(v){E+=D;G+=P}else{D+=E;Y+=E;P+=G;aa+=G;E=D;G=P}Oa([[Y,aa],[D,P]])}}return L}}}(),Kb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(c,"defs");if(!e||!e.length)return 0;for(var h=[],m=0,z=["fill","stroke","filter","marker-start","marker-mid","marker-end"],w=z.length,H=l.getElementsByTagNameNS(c,"*"),A=H.length,v=0;v<A;v++){for(var F=H[v],I=0;I<w;I++){var E=
|
E;P+=G;E=D;G=P}Oa([[C.r1,C.r2]],[C.angle,C.largeArcFlag?1:0,C.sweepFlag?1:0],[D,P]);break;case 16:D-=E;Y-=E;P-=G;aa-=G;case 17:if(v){E+=D;G+=P}else{D+=E;Y+=E;P+=G;aa+=G;E=D;G=P}Oa([[Y,aa],[D,P]])}}return L}}}(),Kb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(c,"defs");if(!e||!e.length)return 0;for(var h=[],m=0,z=["fill","stroke","filter","marker-start","marker-mid","marker-end"],w=z.length,H=l.getElementsByTagNameNS(c,"*"),A=H.length,v=0;v<A;v++){for(var F=H[v],I=0;I<w;I++){var E=
|
||||||
ka(F.getAttribute(z[I]));E&&h.push(E.substr(1))}(F=da(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(v=e.length;v--;){z=e[v];w=z.id;if(h.indexOf(w)<0){Ab[w]=z;z.parentNode.removeChild(z);m++}}return m};this.svgCanvasToString=function(){for(;Kb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,z){m&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&l.insertBefore(z,l.firstChild)});if(K){Jb();xb([K])}var e=
|
ka(F.getAttribute(z[I]));E&&h.push(E.substr(1))}(F=da(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(v=e.length;v--;){z=e[v];w=z.id;if(h.indexOf(w)<0){Ab[w]=z;z.parentNode.removeChild(z);m++}}return m};this.svgCanvasToString=function(){for(;Kb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,z){m&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&l.insertBefore(z,l.firstChild)});if(K){Jb();xb([K])}var e=
|
||||||
|
@ -407,7 +407,7 @@ var aa,ga;if(["g","polyline","path"].indexOf(S)>=0)if(C=g.getStrokedBBox([k])){a
|
||||||
a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(u){P=a("#seg_type");if(D){u.x=svgedit.units.convertUnit(u.x);u.y=svgedit.units.convertUnit(u.y)}a("#path_node_x").val(Math.round(u.x));a("#path_node_y").val(Math.round(u.y));u.type?P.val(u.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}return}D=null;if(ra==="a"){D=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();
|
a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openclose_path",K.closed_subpath?"open_path":"close_path");if(u){P=a("#seg_type");if(D){u.x=svgedit.units.convertUnit(u.x);u.y=svgedit.units.convertUnit(u.y)}a("#path_node_x").val(Math.round(u.x));a("#path_node_y").val(Math.round(u.y));u.type?P.val(u.type).removeAttr("disabled"):P.val(4).attr("disabled","disabled")}return}D=null;if(ra==="a"){D=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();
|
||||||
D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();
|
D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();
|
||||||
a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",
|
a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",
|
||||||
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();
|
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0]).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();
|
||||||
a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);
|
a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);
|
||||||
V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<S;U++){var Y=
|
V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<S;U++){var Y=
|
||||||
P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";
|
P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";
|
||||||
|
|
Loading…
Reference in New Issue