changing group context no longer causes errors

master
Mark MacKay 2012-12-04 11:43:02 -06:00
parent 1ca2f48b86
commit dd6fcebc62
6 changed files with 16 additions and 16 deletions

View File

@ -721,6 +721,7 @@
} else {
svgCanvas.setContext(link.text());
}
svgCanvas.clearSelection();
return false;
});

View File

@ -3279,7 +3279,6 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
var difference_x = Math.abs(real_x-r_start_x);
var difference_y = Math.abs(real_y-r_start_y);
console.log(difference_x, difference_y)
if (difference_y > 1 || difference_y > 1) {
var len = selectedElements.length;
for (var i = 0; i < len; ++i) {

View File

@ -261,11 +261,11 @@ Math.max(E,D.maxy);case "fhpath":e+=+u+","+E+" ";o.setAttributeNS(null,"points",
q;y*=q;bb.mouseMove(n,k);break;case "rotate":u=svgedit.utilities.getBBox(F);J=u.x+u.width/2;E=u.y+u.height/2;o=ea(F);o=N(J,E,o);J=o.x;E=o.y;o=u.x;O=u.y;if(current_rotate_mode=="nw")o=u.x+u.width;if(current_rotate_mode=="se")O=u.y+u.height;if(current_rotate_mode=="sw"){o=u.x+u.width;O=u.y+u.height}compensation_angle=(Math.atan2(E-O,J-o)*(180/Math.PI)-90)%360;X=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;X+=compensation_angle;if(p.gridSnapping)X=va(X);if(z.shiftKey)X=Math.round(X/45)*45;d.setRotationAngle(X<
-180?360+X:X,true);M("transition",I)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode,k=Bb(z),n=k.tagName;if(F!==L){if(n==="text"&&Ga!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&na(k)){Db(k);k=I[0];xa(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){d.addClones=false;window.removeEventListener("keyup",
d.removeClones);I=I.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var k=N(z.pageX,z.pageY,mb),n=k.x*q;k=k.y*q;var o=n/q,u=k/q,E=pa(aa()),H=false;Ka=false;switch(Ga){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Ga="select";case "select":if(I[0]!=null){if(I.length==1){n=I[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity");Xa.stroke=n.getAttribute("stroke");
Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Ea();B=(n=svgedit.browser.isGecko())?B*q:B;A=n?A*q:A;n=Math.abs(u-A);console.log(Math.abs(o-B),n);
if(n>1||n>1){z=I.length;for(n=0;n<z;++n){if(I[n]==null)break;I[n].firstChild||ra.requestSelector(I[n]).resize()}}else{n=z.target;if(I[0].nodeName==="path"&&I[1]==null)La.select(I[0]);else z.shiftKey&&F!=n&&d.removeFromSelection([n])}if(svgedit.browser.supportsNonScalingStroke())if(z=I[0]){z.removeAttribute("style");svgedit.utilities.walkTree(z,function(X){X.removeAttribute("style")})}}return;case "zoom":sa!=null&&sa.setAttribute("display","none");M("zoomed",{x:Math.min(B,o),y:Math.min(A,u),width:Math.abs(o-
B),height:Math.abs(u-A),factor:z.altKey?0.5:2});return;case "fhpath":F=E.getAttribute("points");o=F.indexOf(",");if(H=o>=0?F.indexOf(",",o+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);H=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);H=F.width!=0||F.height!=0||Ga==="image";break;case "circle":H=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx",
"ry"]);H=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);H=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);H=true}break;case "text":H=true;rb([E]);bb.start(E);break;case "path":E=
null;Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;H=F.keep;break;case "pathedit":H=true;E=null;La.mouseUp(z);break;case "textedit":H=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":H=true;E=null;Ga="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Ea();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(X,ba){if(ba){H=ba.keep||H;E=ba.element;Ka=ba.started||Ka}});if(!H&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName==
Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Ea();B=(n=svgedit.browser.isGecko())?B*q:B;A=n?A*q:A;n=Math.abs(u-A);if(n>1||n>1){z=I.length;for(n=
0;n<z;++n){if(I[n]==null)break;I[n].firstChild||ra.requestSelector(I[n]).resize()}}else{n=z.target;if(I[0].nodeName==="path"&&I[1]==null)La.select(I[0]);else z.shiftKey&&F!=n&&d.removeFromSelection([n])}if(svgedit.browser.supportsNonScalingStroke())if(z=I[0]){z.removeAttribute("style");svgedit.utilities.walkTree(z,function(X){X.removeAttribute("style")})}}return;case "zoom":sa!=null&&sa.setAttribute("display","none");M("zoomed",{x:Math.min(B,o),y:Math.min(A,u),width:Math.abs(o-B),height:Math.abs(u-
A),factor:z.altKey?0.5:2});return;case "fhpath":F=E.getAttribute("points");u=F.indexOf(",");if(H=u>=0?F.indexOf(",",u+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);H=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);H=F.width!=0||F.height!=0||Ga==="image";break;case "circle":H=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);H=F.rx!=
null||F.ry!=null;break;case "fhellipse":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);H=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);H=true}break;case "text":H=true;rb([E]);bb.start(E);break;case "path":E=null;
Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;H=F.keep;break;case "pathedit":H=true;E=null;La.mouseUp(z);break;case "textedit":H=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":H=true;E=null;Ga="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Ea();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(X,ba){if(ba){H=ba.keep||H;E=ba.element;Ka=ba.started||Ka}});if(!H&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName==
"g";)n=n.parentNode;if((Ga!="path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&&n.id!="svgcanvas"&&n.id!="svgroot"){d.setMode("select");rb([n],true)}}else if(E!=null){d.addedNew=true;z=0.2;var J;if(false.beginElement&&E.getAttribute("opacity")!=K.opacity){J=$(false).clone().attr({to:K.opacity,dur:z}).appendTo(E);try{J[0].beginElement()}catch(O){}}else z=0;setTimeout(function(){J&&J.remove();E.setAttribute("opacity",K.opacity);E.setAttribute("style","pointer-events:inherit");la(E);if(Ga===
"path")La.toEditMode(E);else p.selectNew&&rb([E],true);wa(new Ia(E));M("changed",[E])},z*1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=m.getScreenCTM().inverse();var F=N(z.pageX,z.pageY,mb);F={x:F.x,y:F.y,width:0,height:0};if(z.wheelDelta)if(z.wheelDelta>=120)F.factor=2;else{if(z.wheelDelta<=-120)F.factor=0.5}else if(z.detail)if(z.detail>0)F.factor=0.5;else if(z.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var Fb=function(e){$(e).click(function(h){h.preventDefault()})},
bb=d.textActions=function(){function e(T){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)T=0;else{if(k.selectionEnd!==k.selectionStart)return;T=k.selectionEnd}var ha;ha=E[T];fa||k.setSelectionRange(T,T);n=pa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=pa("selectorParentGroup").appendChild(n)}u||(u=setInterval(function(){var W=n.getAttribute("display")==="none";n.setAttribute("display",W?"inline":"none")},600));fa=
@ -397,8 +397,8 @@ ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.spli
uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();H(false)});if(u=="prompt"){var X=a('<input type="text">').prependTo(n);X.val(J||"");X.bind("keydown","return",function(){O.trigger("click touchstart")})}u=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var ba=u=="prompt"?X.val():true;H&&H(ba)}).focus();u=="prompt"&&X.focus()};a.alert=function(u,E){o("alert",u,E)};a.confirm=function(u,E){o("confirm",u,E)};a.process_cancel=function(u,E){o("process",
u,E)};a.prompt=function(u,E,H){o("prompt",u,H,E)}})();var oa=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},Y=null,V=false,ea=false,Ba="",ja=function(k,n){var o=g.getResolution(),u=K;a("#svgcanvas").position();if(u=g.setBBoxZoom(n,u.width()-15,u.height()-15)){var E=u.zoom;u=u.bbox;if(E<0.0010)wa({value:0.1});
else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var H=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,X=function(ba){ba=(ba-H)/500;ba=Math.pow(ba-1,3)+1;g.setZoom(O+J*ba);G();if(ba<1)k.animatedZoom=requestAnimationFrame(X);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};X(Date.now());g.getMode()=="zoom"&&u.width&&oa();xb()}}};a("#cur_context_panel").delegate("a",
"click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ca=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},U={},Z=function(k){a.each(k,function(n,o){var u=a(n).children(),E=n+"_show",H=a(E),J=false;u.addClass("tool_button").unbind("click mousedown mouseup").each(function(ba){var T=o[ba];U[T.sel]=T.fn;if(T.isDefault)J=ba;ba=function(fa){var ha=T;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),qa=
a(ha.parent+"_show").attr("data-curopt");a.each(k[T.parent],function(Aa,Ca){if(Ca.sel==qa)ha=!fa.shiftKey||!W?Ca:k[T.parent][Aa+1]||k[T.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(ba);T.key&&a(document).bind("keydown",
"click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());g.clearSelection();return false});var ca=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},U={},Z=function(k){a.each(k,function(n,o){var u=a(n).children(),E=n+"_show",H=a(E),J=false;u.addClass("tool_button").unbind("click mousedown mouseup").each(function(ba){var T=o[ba];U[T.sel]=T.fn;if(T.isDefault)J=ba;ba=function(fa){var ha=T;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),
qa=a(ha.parent+"_show").attr("data-curopt");a.each(k[T.parent],function(Aa,Ca){if(Ca.sel==qa)ha=!fa.shiftKey||!W?Ca:k[T.parent][Aa+1]||k[T.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(ba);T.key&&a(document).bind("keydown",
T.key[0]+" shift+"+T.key[0],ba)});if(J)H.attr("data-curopt",o[J].sel);else H.attr("data-curopt")||H.attr("data-curopt",o[0].sel);var O,X=a(E).position();a(n).css({left:X.left+34,top:X.top+77});H.mousedown(function(ba){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(H.hasClass("disabled"))return false;var T=a(n),fa=X.left+34,ha=T.width()*-1,W=T.data("shown_popop")?200:0;O=setTimeout(function(){H.data("isLibrary")?T.css("left",
fa).show():T.css("left",ha).show().animate({left:fa},50);T.data("shown_popop",true)},W);ba.preventDefault()}).mouseup(function(){clearTimeout(O);var ba=a(this).attr("data-curopt");if(H.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&ba in U&&U[ba]()})});ma()},na=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth();
a(this).css({left:(n.left+k)*R,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,ya=function(k,n,o){var u=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];u={alpha:n};u[k.tagName]=k}else u=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(u)},

View File

@ -721,6 +721,7 @@
} else {
svgCanvas.setContext(link.text());
}
svgCanvas.clearSelection();
return false;
});

View File

@ -3279,7 +3279,6 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
var difference_x = Math.abs(real_x-r_start_x);
var difference_y = Math.abs(real_y-r_start_y);
console.log(difference_x, difference_y)
if (difference_y > 1 || difference_y > 1) {
var len = selectedElements.length;
for (var i = 0; i < len; ++i) {

View File

@ -261,11 +261,11 @@ Math.max(E,D.maxy);case "fhpath":e+=+u+","+E+" ";o.setAttributeNS(null,"points",
q;y*=q;bb.mouseMove(n,k);break;case "rotate":u=svgedit.utilities.getBBox(F);J=u.x+u.width/2;E=u.y+u.height/2;o=ea(F);o=N(J,E,o);J=o.x;E=o.y;o=u.x;O=u.y;if(current_rotate_mode=="nw")o=u.x+u.width;if(current_rotate_mode=="se")O=u.y+u.height;if(current_rotate_mode=="sw"){o=u.x+u.width;O=u.y+u.height}compensation_angle=(Math.atan2(E-O,J-o)*(180/Math.PI)-90)%360;X=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;X+=compensation_angle;if(p.gridSnapping)X=va(X);if(z.shiftKey)X=Math.round(X/45)*45;d.setRotationAngle(X<
-180?360+X:X,true);M("transition",I)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode,k=Bb(z),n=k.tagName;if(F!==L){if(n==="text"&&Ga!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&na(k)){Db(k);k=I[0];xa(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){d.addClones=false;window.removeEventListener("keyup",
d.removeClones);I=I.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var k=N(z.pageX,z.pageY,mb),n=k.x*q;k=k.y*q;var o=n/q,u=k/q,E=pa(aa()),H=false;Ka=false;switch(Ga){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Ga="select";case "select":if(I[0]!=null){if(I.length==1){n=I[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity");Xa.stroke=n.getAttribute("stroke");
Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Ea();B=(n=svgedit.browser.isGecko())?B*q:B;A=n?A*q:A;n=Math.abs(u-A);console.log(Math.abs(o-B),n);
if(n>1||n>1){z=I.length;for(n=0;n<z;++n){if(I[n]==null)break;I[n].firstChild||ra.requestSelector(I[n]).resize()}}else{n=z.target;if(I[0].nodeName==="path"&&I[1]==null)La.select(I[0]);else z.shiftKey&&F!=n&&d.removeFromSelection([n])}if(svgedit.browser.supportsNonScalingStroke())if(z=I[0]){z.removeAttribute("style");svgedit.utilities.walkTree(z,function(X){X.removeAttribute("style")})}}return;case "zoom":sa!=null&&sa.setAttribute("display","none");M("zoomed",{x:Math.min(B,o),y:Math.min(A,u),width:Math.abs(o-
B),height:Math.abs(u-A),factor:z.altKey?0.5:2});return;case "fhpath":F=E.getAttribute("points");o=F.indexOf(",");if(H=o>=0?F.indexOf(",",o+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);H=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);H=F.width!=0||F.height!=0||Ga==="image";break;case "circle":H=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx",
"ry"]);H=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);H=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);H=true}break;case "text":H=true;rb([E]);bb.start(E);break;case "path":E=
null;Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;H=F.keep;break;case "pathedit":H=true;E=null;La.mouseUp(z);break;case "textedit":H=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":H=true;E=null;Ga="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Ea();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(X,ba){if(ba){H=ba.keep||H;E=ba.element;Ka=ba.started||Ka}});if(!H&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName==
Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Ea();B=(n=svgedit.browser.isGecko())?B*q:B;A=n?A*q:A;n=Math.abs(u-A);if(n>1||n>1){z=I.length;for(n=
0;n<z;++n){if(I[n]==null)break;I[n].firstChild||ra.requestSelector(I[n]).resize()}}else{n=z.target;if(I[0].nodeName==="path"&&I[1]==null)La.select(I[0]);else z.shiftKey&&F!=n&&d.removeFromSelection([n])}if(svgedit.browser.supportsNonScalingStroke())if(z=I[0]){z.removeAttribute("style");svgedit.utilities.walkTree(z,function(X){X.removeAttribute("style")})}}return;case "zoom":sa!=null&&sa.setAttribute("display","none");M("zoomed",{x:Math.min(B,o),y:Math.min(A,u),width:Math.abs(o-B),height:Math.abs(u-
A),factor:z.altKey?0.5:2});return;case "fhpath":F=E.getAttribute("points");u=F.indexOf(",");if(H=u>=0?F.indexOf(",",u+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);H=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);H=F.width!=0||F.height!=0||Ga==="image";break;case "circle":H=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);H=F.rx!=
null||F.ry!=null;break;case "fhellipse":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);H=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);H=true}break;case "text":H=true;rb([E]);bb.start(E);break;case "path":E=null;
Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;H=F.keep;break;case "pathedit":H=true;E=null;La.mouseUp(z);break;case "textedit":H=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":H=true;E=null;Ga="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Ea();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(X,ba){if(ba){H=ba.keep||H;E=ba.element;Ka=ba.started||Ka}});if(!H&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName==
"g";)n=n.parentNode;if((Ga!="path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&&n.id!="svgcanvas"&&n.id!="svgroot"){d.setMode("select");rb([n],true)}}else if(E!=null){d.addedNew=true;z=0.2;var J;if(false.beginElement&&E.getAttribute("opacity")!=K.opacity){J=$(false).clone().attr({to:K.opacity,dur:z}).appendTo(E);try{J[0].beginElement()}catch(O){}}else z=0;setTimeout(function(){J&&J.remove();E.setAttribute("opacity",K.opacity);E.setAttribute("style","pointer-events:inherit");la(E);if(Ga===
"path")La.toEditMode(E);else p.selectNew&&rb([E],true);wa(new Ia(E));M("changed",[E])},z*1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=m.getScreenCTM().inverse();var F=N(z.pageX,z.pageY,mb);F={x:F.x,y:F.y,width:0,height:0};if(z.wheelDelta)if(z.wheelDelta>=120)F.factor=2;else{if(z.wheelDelta<=-120)F.factor=0.5}else if(z.detail)if(z.detail>0)F.factor=0.5;else if(z.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var Fb=function(e){$(e).click(function(h){h.preventDefault()})},
bb=d.textActions=function(){function e(T){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)T=0;else{if(k.selectionEnd!==k.selectionStart)return;T=k.selectionEnd}var ha;ha=E[T];fa||k.setSelectionRange(T,T);n=pa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=pa("selectorParentGroup").appendChild(n)}u||(u=setInterval(function(){var W=n.getAttribute("display")==="none";n.setAttribute("display",W?"inline":"none")},600));fa=
@ -397,8 +397,8 @@ ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.spli
uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();H(false)});if(u=="prompt"){var X=a('<input type="text">').prependTo(n);X.val(J||"");X.bind("keydown","return",function(){O.trigger("click touchstart")})}u=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var ba=u=="prompt"?X.val():true;H&&H(ba)}).focus();u=="prompt"&&X.focus()};a.alert=function(u,E){o("alert",u,E)};a.confirm=function(u,E){o("confirm",u,E)};a.process_cancel=function(u,E){o("process",
u,E)};a.prompt=function(u,E,H){o("prompt",u,H,E)}})();var oa=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},Y=null,V=false,ea=false,Ba="",ja=function(k,n){var o=g.getResolution(),u=K;a("#svgcanvas").position();if(u=g.setBBoxZoom(n,u.width()-15,u.height()-15)){var E=u.zoom;u=u.bbox;if(E<0.0010)wa({value:0.1});
else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var H=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,X=function(ba){ba=(ba-H)/500;ba=Math.pow(ba-1,3)+1;g.setZoom(O+J*ba);G();if(ba<1)k.animatedZoom=requestAnimationFrame(X);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};X(Date.now());g.getMode()=="zoom"&&u.width&&oa();xb()}}};a("#cur_context_panel").delegate("a",
"click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ca=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},U={},Z=function(k){a.each(k,function(n,o){var u=a(n).children(),E=n+"_show",H=a(E),J=false;u.addClass("tool_button").unbind("click mousedown mouseup").each(function(ba){var T=o[ba];U[T.sel]=T.fn;if(T.isDefault)J=ba;ba=function(fa){var ha=T;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),qa=
a(ha.parent+"_show").attr("data-curopt");a.each(k[T.parent],function(Aa,Ca){if(Ca.sel==qa)ha=!fa.shiftKey||!W?Ca:k[T.parent][Aa+1]||k[T.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(ba);T.key&&a(document).bind("keydown",
"click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());g.clearSelection();return false});var ca=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},U={},Z=function(k){a.each(k,function(n,o){var u=a(n).children(),E=n+"_show",H=a(E),J=false;u.addClass("tool_button").unbind("click mousedown mouseup").each(function(ba){var T=o[ba];U[T.sel]=T.fn;if(T.isDefault)J=ba;ba=function(fa){var ha=T;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),
qa=a(ha.parent+"_show").attr("data-curopt");a.each(k[T.parent],function(Aa,Ca){if(Ca.sel==qa)ha=!fa.shiftKey||!W?Ca:k[T.parent][Aa+1]||k[T.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(ba);T.key&&a(document).bind("keydown",
T.key[0]+" shift+"+T.key[0],ba)});if(J)H.attr("data-curopt",o[J].sel);else H.attr("data-curopt")||H.attr("data-curopt",o[0].sel);var O,X=a(E).position();a(n).css({left:X.left+34,top:X.top+77});H.mousedown(function(ba){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(H.hasClass("disabled"))return false;var T=a(n),fa=X.left+34,ha=T.width()*-1,W=T.data("shown_popop")?200:0;O=setTimeout(function(){H.data("isLibrary")?T.css("left",
fa).show():T.css("left",ha).show().animate({left:fa},50);T.data("shown_popop",true)},W);ba.preventDefault()}).mouseup(function(){clearTimeout(O);var ba=a(this).attr("data-curopt");if(H.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&ba in U&&U[ba]()})});ma()},na=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth();
a(this).css({left:(n.left+k)*R,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,ya=function(k,n,o){var u=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];u={alpha:n};u[k.tagName]=k}else u=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(u)},