diff --git a/editor/contextmenu/jquery.contextMenu.js b/editor/contextmenu/jquery.contextMenu.js index 3c4563e..46be3ad 100755 --- a/editor/contextmenu/jquery.contextMenu.js +++ b/editor/contextmenu/jquery.contextMenu.js @@ -37,88 +37,108 @@ if(jQuery)( function() { // Add contextMenu class menu.addClass('contextMenu'); // Simulate a true right click + $(this).bind( "mousedown", function(e) { var evt = e; - $(this).mouseup( function(e) { + $(this).on("mouseup", function(e) { var srcElement = $(this); srcElement.unbind('mouseup'); $(".contextMenu").hide(); if( evt.button === 2 || o.allowLeft || (evt.ctrlKey && svgedit.browser.isMac()) ) { - e.stopPropagation(); - - // Get this context menu - - if( el.hasClass('disabled') || evt.altKey ) return false; - - // Detect mouse position - var d = {}, x = e.pageX, y = e.pageY; - - var x_off = win.width() - menu.width(), - y_off = win.height() - menu.height(); - - if(x > x_off - 15) x = x_off-15; - if(y > y_off - 30) y = y_off-30; // 30 is needed to prevent scrollbars in FF - - // Show the menu - doc.unbind('click'); - menu.css({ top: y, left: x }).fadeIn(o.inSpeed); - // Hover events - menu.find('A').mouseover( function() { - menu.find('LI.hover').removeClass('hover'); - $(this).parent().addClass('hover'); - }).mouseout( function() { - menu.find('LI.hover').removeClass('hover'); - }); - - // Keyboard - doc.keypress( function(e) { - switch( e.keyCode ) { - case 38: // up - if( !menu.find('LI.hover').length ) { - menu.find('LI:last').addClass('hover'); - } else { - menu.find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover'); - if( !menu.find('LI.hover').length ) menu.find('LI:last').addClass('hover'); - } - break; - case 40: // down - if( menu.find('LI.hover').length == 0 ) { - menu.find('LI:first').addClass('hover'); - } else { - menu.find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover'); - if( !menu.find('LI.hover').length ) menu.find('LI:first').addClass('hover'); - } - break; - case 13: // enter - menu.find('LI.hover A').trigger('click'); - break; - case 27: // esc - doc.trigger('click'); - break - } - }); - - // When items are selected - menu.find('A').unbind('mouseup'); - menu.find('LI:not(.disabled) A').mouseup( function() { - doc.unbind('click').unbind('keypress'); - $(".contextMenu").hide(); - // Callback - if( callback ) callback( $(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y} ); - return false; - }); - - // Hide bindings - setTimeout( function() { // Delay for Mozilla - doc.click( function() { - doc.unbind('click').unbind('keypress'); - menu.fadeOut(o.outSpeed); - return false; - }); - }, 0); + if (!svgedit.browser.isTouch()) open_context_menu(e, evt, srcElement); } }); }); + + if (svgedit.browser.isTouch()) { + $(this).bind("taphold", function(e){ + var srcElement = $(this); + srcElement.unbind('mouseup'); + open_context_menu(e,e, srcElement); + }) + } + + var open_context_menu = function(e, evt, srcElement) { + if (typeof evt == 'undefined') evt = e; + e.stopPropagation(); + + // Get this context menu + + if( el.hasClass('disabled') || evt.altKey ) return false; + + // Detect mouse position + var d = {}, x = e.pageX, y = e.pageY; + if (svgedit.browser.isTouch()) var d = {}, x = e.originalEvent.touches[0].pageX, y = e.originalEvent.touches[0].pageY; + + var x_off = win.width() - menu.width(), + y_off = win.height() - menu.height(); + + if(x > x_off - 15) x = x_off-15; + if(y > y_off - 30) y = y_off-30; // 30 is needed to prevent scrollbars in FF + + if(svgedit.browser.isTouch()) + y = y - (menu.height()/2) + + // Show the menu + doc.unbind('click'); + menu.css({ top: y, left: x }).fadeIn(o.inSpeed); + // Hover events + menu.find('A').mouseover( function() { + menu.find('LI.hover').removeClass('hover'); + $(this).parent().addClass('hover'); + }).mouseout( function() { + menu.find('LI.hover').removeClass('hover'); + }); + + // Keyboard + doc.keypress( function(e) { + switch( e.keyCode ) { + case 38: // up + if( !menu.find('LI.hover').length ) { + menu.find('LI:last').addClass('hover'); + } else { + menu.find('LI.hover').removeClass('hover').prevAll('LI:not(.disabled)').eq(0).addClass('hover'); + if( !menu.find('LI.hover').length ) menu.find('LI:last').addClass('hover'); + } + break; + case 40: // down + if( menu.find('LI.hover').length == 0 ) { + menu.find('LI:first').addClass('hover'); + } else { + menu.find('LI.hover').removeClass('hover').nextAll('LI:not(.disabled)').eq(0).addClass('hover'); + if( !menu.find('LI.hover').length ) menu.find('LI:first').addClass('hover'); + } + break; + case 13: // enter + menu.find('LI.hover A').trigger('click'); + break; + case 27: // esc + doc.trigger('click'); + break + } + }); + + // When items are selected + menu.find('A').unbind('mouseup'); + menu.find('LI:not(.disabled) A').mouseup( function() { + doc.unbind('click').unbind('keypress'); + $(".contextMenu").hide(); + // Callback + if( callback ) callback( $(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y} ); + return false; + }); + + // Hide bindings + setTimeout( function() { // Delay for Mozilla + doc.click( function() { + doc.unbind('click').unbind('keypress'); + menu.fadeOut(o.outSpeed); + return false; + }); + }, 0); + } + + // Disable text selection if( $.browser.mozilla ) { diff --git a/editor/path.js b/editor/path.js index f306f5c..77ccef1 100644 --- a/editor/path.js +++ b/editor/path.js @@ -147,8 +147,8 @@ svgedit.path.addPointGrip = function(index, x, y) { svgedit.utilities.assignAttributes(pointGrip, { 'id': "pathpointgrip_" + index, 'display': "none", - 'width': 5, - 'height': 5, + 'width': svgeditor.browser.isTouch() ? 30 : 5, + 'height': svgeditor.browser.isTouch() ? 30 : 5, 'fill': "#fff", 'stroke': "#4F80FF", 'shape-rendering': "crispEdges", @@ -167,8 +167,8 @@ svgedit.path.addPointGrip = function(index, x, y) { if(x && y) { // set up the point grip element and display it svgedit.utilities.assignAttributes(pointGrip, { - 'x': x-2.5, - 'y': y-2.5, + 'x': x-(svgeditor.browser.isTouch() ? 15 : 2.5), + 'y': y-(svgeditor.browser.isTouch() ? 15 : 2.5), 'display': "inline" }); } @@ -193,7 +193,7 @@ svgedit.path.addCtrlGrip = function(id) { svgedit.utilities.assignAttributes(pointGrip, { 'id': "ctrlpointgrip_" + id, 'display': "none", - 'r': 3, + 'r': svgeditor.browser.isTouch() ? 15 : 3, 'fill': "#4F80FF", 'cursor': 'move', 'style': 'pointer-events:all', @@ -224,8 +224,8 @@ svgedit.path.getPointGrip = function(seg, update) { if(update) { var pt = svgedit.path.getGripPt(seg); svgedit.utilities.assignAttributes(pointGrip, { - 'x': pt.x-2.5, - 'y': pt.y-2.5, + 'x': pt.x-(svgeditor.browser.isTouch() ? 15 : 2.5), + 'y': pt.y-(svgeditor.browser.isTouch() ? 15 : 2.5), 'display': "inline" }); } @@ -446,7 +446,8 @@ svgedit.path.Segment.prototype.addGrip = function() { svgedit.path.Segment.prototype.update = function(full) { if(this.ptgrip) { var pt = svgedit.path.getGripPt(this); - var properties = (this.ptgrip.nodeName == "rect") ? {'x': pt.x-2.5, 'y': pt.y-2.5} : {'cx': pt.x, 'cy': pt.y}; + var reposition = (svgeditor.browser.isTouch() ? 15 : 2.5) + var properties = (this.ptgrip.nodeName == "rect") ? {'x': pt.x-reposition, 'y': pt.y-reposition} : {'cx': pt.x, 'cy': pt.y}; svgedit.utilities.assignAttributes(this.ptgrip, properties); svgedit.path.getSegSelector(this, true); diff --git a/editor/svg-editor.css b/editor/svg-editor.css index e863e34..cfa3abb 100644 --- a/editor/svg-editor.css +++ b/editor/svg-editor.css @@ -509,7 +509,6 @@ html, body { div#palette { float: left; - width: 810px; height: 16px; } @@ -1492,7 +1491,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), padding: 5px 0; margin: 0px; display: none; - font: 12px/15px Lucida Sans, Helvetica, Verdana, sans-serif; + font: 12px/15px 'Lucida Sans', 'Lucida Grande', Helvetica, Verdana, sans-serif; border-radius: 5px; -moz-border-radius: 5px; -moz-box-shadow: 2px 5px 10px rgba(0,0,0,.3); @@ -1500,6 +1499,29 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), box-shadow: 2px 5px 10px rgba(0,0,0,.3); } +.touch .contextMenu { + border: solid 5px rgba(0,0,0,.7); + padding: 0; + margin: 0 0 0 20px; + font: 18px/24px sans-serif; + border-radius: 5px; + -webkit-box-shadow: 2px 5px 20px 3px #000; + box-shadow: 2px 5px 20px rgba(0,0,0,0.5); +} + +.touch .contextMenu:after { + content: ''; + width: 0; + height: 0; + border: solid transparent 10px; + border-right-color: rgba(0,0,0,.7); + position: absolute; + top: 50%; + left: -25px; + margin-top: -10px; + z-index: 1000; +} + .contextMenu LI { list-style: none; padding: 0px; @@ -1512,6 +1534,16 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), float:right; } +.touch .contextMenu .shortcut { + display: none; +} + + +.touch .shortcut { + display: none; +} + + .contextMenu A { -moz-user-select: none; -webkit-user-select: none; @@ -1526,6 +1558,16 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), padding: 0px 15px 1px 20px; } +.touch .contextMenu A { + padding: 0 15px; + border-bottom: #; + font-weight: bold; + border-top: solid 1px #E3E3E3; + height: 40px; + line-height: 40px; + min-width: 200px; +} + .contextMenu LI.hover A { background-color: #2e5dea; color: white; @@ -1534,6 +1576,11 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), .contextMenu LI.disabled A { color: #999; + +} + +.touch .contextMenu LI.disabled A { + display: none; } .contextMenu LI.hover.disabled A { @@ -1546,6 +1593,12 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), margin-top: 5px; } +.touch .contextMenu LI.separator { + border-top: none; + margin: 0; + padding: 0; +} + #menu { display: none; position: absolute; diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 7fc7a4a..d176234 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -361,6 +361,7 @@ Utils = svgedit.utilities, default_img_url = curConfig.imgPath + "placeholder.svg", workarea = $("#workarea"), + canv_menu = $("#cmenu_canvas"), exportWindow = null, tool_scale = 1, ui_context = 'toolbars', @@ -1571,6 +1572,7 @@ } menu_items[(el_name === 'g' ? 'en':'dis') + 'ableContextMenuItems']('#ungroup'); menu_items[((el_name === 'g' || !multiselected) ? 'dis':'en') + 'ableContextMenuItems']('#group'); + } // if (elem != null) else if (multiselected) { $('#multiselected_panel').show(); @@ -1597,6 +1599,14 @@ } svgCanvas.addedNew = false; + + if ( (elem && !is_node) || multiselected) { + // update the selected elements' layer + $('#selLayerNames').removeAttr('disabled').val(currentLayerName); + + // Enable regular menu options + canv_menu.enableContextMenuItems('#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back'); + } }; $('#text').on("focus", function(e){ textBeingEntered = true; } ); @@ -3617,6 +3627,9 @@ ev.preventDefault(); }) + $('#cmenu_canvas li').disableContextMenu(); + canv_menu.enableContextMenuItems('#delete,#cut,#copy'); + window.onbeforeunload = function() { // Suppress warning if page is empty if(undoMgr.getUndoStackSize() === 0) { diff --git a/editor/svgedit.compiled.css b/editor/svgedit.compiled.css index 1d1cb4f..b0ed85e 100644 --- a/editor/svgedit.compiled.css +++ b/editor/svgedit.compiled.css @@ -175,7 +175,7 @@ div#palette_holder #palette .palette_item{cursor:pointer} .touch #color_tools #tool_stroke .color_block>div{position:relative} #color_tools .icon_label{padding:0;width:24px;height:100%;cursor:pointer;position:absolute} #linkLabel>svg{height:20px;padding-top:4px} -div#palette{float:left;width:810px;height:16px} +div#palette{float:left;height:16px} div#workarea{display:inline-table-cell;position:absolute;top:30px;left:50px;bottom:40px;right:175px;background-color:#444;overflow:auto;text-align:center} .touch div#workarea{top:40px} div.palette_item{height:16px;width:16px;float:left} @@ -335,14 +335,21 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we .ui-slider-handle:focus{outline:0} #shape_buttons{background:#fff;border-radius:0 3px 3px 0;padding:10px} .tools_flyout .tool_button,.tools_flyout .tool_flyout{background:#fff;width:40px;height:40px;margin:5px;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0;border-width:0} -.contextMenu{position:absolute;z-index:99999;border:solid 1px rgba(0,0,0,.33);background:rgba(255,255,255,.95);padding:5px 0;margin:0;display:none;font:12px/15px Lucida Sans,Helvetica,Verdana,sans-serif;border-radius:5px;-moz-border-radius:5px;-moz-box-shadow:2px 5px 10px rgba(0,0,0,.3);-webkit-box-shadow:2px 5px 10px rgba(0,0,0,.3);box-shadow:2px 5px 10px rgba(0,0,0,.3)} +.contextMenu{position:absolute;z-index:99999;border:solid 1px rgba(0,0,0,.33);background:rgba(255,255,255,.95);padding:5px 0;margin:0;display:none;font:12px/15px 'Lucida Sans','Lucida Grande',Helvetica,Verdana,sans-serif;border-radius:5px;-moz-border-radius:5px;-moz-box-shadow:2px 5px 10px rgba(0,0,0,.3);-webkit-box-shadow:2px 5px 10px rgba(0,0,0,.3);box-shadow:2px 5px 10px rgba(0,0,0,.3)} +.touch .contextMenu{border:solid 5px rgba(0,0,0,.7);padding:0;margin:0 0 0 20px;font:18px/24px sans-serif;border-radius:5px;-webkit-box-shadow:2px 5px 20px 3px #000;box-shadow:2px 5px 20px rgba(0,0,0,0.5)} +.touch .contextMenu:after{content:'';width:0;height:0;border:solid transparent 10px;border-right-color:rgba(0,0,0,.7);position:absolute;top:50%;left:-25px;margin-top:-10px;z-index:1000} .contextMenu LI{list-style:none;padding:0;margin:0} .contextMenu .shortcut{width:115px;text-align:right;float:right} +.touch .contextMenu .shortcut{display:none} +.touch .shortcut{display:none} .contextMenu A{-moz-user-select:none;-webkit-user-select:none;color:#222;text-decoration:none;display:block;line-height:20px;height:20px;background-position:6px center;background-repeat:no-repeat;outline:0;padding:0 15px 1px 20px} +.touch .contextMenu A{padding:0 15px;border-bottom:#;font-weight:bold;border-top:solid 1px #e3e3e3;height:40px;line-height:40px;min-width:200px} .contextMenu LI.hover A{background-color:#2e5dea;color:white;cursor:default} .contextMenu LI.disabled A{color:#999} +.touch .contextMenu LI.disabled A{display:none} .contextMenu LI.hover.disabled A{background-color:transparent} .contextMenu LI.separator{border-top:solid 1px #e3e3e3;padding-top:5px;margin-top:5px} +.touch .contextMenu LI.separator{border-top:0;margin:0;padding:0} #menu{display:none;position:absolute;top:0;left:0;right:0;height:30px;background:#000;z-index:10;color:#fff} #workarea.rect,#workarea.line,#workarea.ellipse,#workarea.path,#workarea.shapelib{cursor:crosshair} #workarea.text{cursor:text} diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 74023bc..ba308ed 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -1,104 +1,105 @@ -function touchHandler(a){var p=a.changedTouches,g=p[0],c="";switch(a.type){case "touchstart":c="mousedown";break;case "touchmove":c="mousemove";break;case "touchend":c="mouseup";break;default:return}var n=document.createEvent("MouseEvent");n.initMouseEvent(c,true,true,window,1,g.screenX,g.screenY,g.clientX,g.clientY,false,false,false,false,0,null);if(p.length<2){g.target.dispatchEvent(n);a.preventDefault()}};(function(a){function p(g){if(typeof g.data==="string"){var c=g.handler,n=g.data.toLowerCase().split(" ");g.handler=function(s){if(!(this!==s.target&&(/textarea|select/i.test(s.target.nodeName)||s.target.type==="text"))){var b=s.type!=="keypress"&&a.hotkeys.specialKeys[s.which],f=String.fromCharCode(s.which).toLowerCase(),d="",m={};if(s.altKey&&b!=="alt")d+="alt+";if(s.ctrlKey&&b!=="ctrl")d+="ctrl+";if(s.metaKey&&!s.ctrlKey&&b!=="meta")d+="meta+";if(s.shiftKey&&b!=="shift")d+="shift+";if(b)m[d+b]= -true;else{m[d+f]=true;m[d+a.hotkeys.shiftNums[f]]=true;if(d==="shift+")m[a.hotkeys.shiftNums[f]]=true}b=0;for(f=n.length;b","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:p}})})(jQuery);(function(a,p){function g(da){return typeof da==="string"}function c(da){var W=d.call(arguments,1);return function(){return da.apply(this,W.concat(d.call(arguments)))}}function n(da,W,Z,oa,pa){var na;if(oa!==f){W=Z.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Z=W[3]||"";if(pa===2&&g(oa))oa=oa.replace(da?ba:U,"");else{na=o(W[2]);oa=g(oa)?o[da?ia:P](oa):oa;oa=pa===2?oa:pa===1?a.extend({},oa,na):a.extend({},na,oa);oa=q(oa);if(da)oa=oa.replace(xa,m)}da=W[1]+(da?"#":oa||!W[1]?"?":"")+oa+Z}else da= -W(Z!==f?Z:p[qa][ga]);return da}function s(da,W,Z){if(W===f||typeof W==="boolean"){Z=W;W=q[da?ia:P]()}else W=g(W)?W.replace(da?ba:U,""):W;return o(W,Z)}function b(da,W,Z,oa){if(!g(Z)&&typeof Z!=="object"){oa=Z;Z=W;W=f}return this.each(function(){var pa=a(this),na=W||Q()[(this.nodeName||"").toLowerCase()]||"",ma=na&&pa.attr(na)||"";pa.attr(na,q[da](ma,Z,oa))})}var f,d=Array.prototype.slice,m=decodeURIComponent,q=a.param,B,o,K,S=a.bbq=a.bbq||{},M,J,Q,Y=a.event.special,P="querystring",ia="fragment",qa= -"location",ga="href",U=/^.*\?|#.*$/g,ba=/^.*\#/,xa,ka={};q[P]=c(n,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});q[ia]=B=c(n,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});B.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);xa=RegExp(da.join("|"),"g")};B.noEscape(",/");a.deparam=o=function(da,W){var Z={},oa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(pa,na){var ma=na.split("="),za=m(ma[0]),Ha=Z,Fa= -0,Ia=za.split("]["),La=Ia.length-1;if(/\[/.test(Ia[0])&&/\]$/.test(Ia[La])){Ia[La]=Ia[La].replace(/\]$/,"");Ia=Ia.shift().split("[").concat(Ia);La=Ia.length-1}else La=0;if(ma.length===2){ma=m(ma[1]);if(W)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:oa[ma]!==f?oa[ma]:ma;if(La)for(;Fa<=La;Fa++){za=Ia[Fa]===""?Ha.length:Ia[Fa];Ha=Ha[za]=Fa').hide().insertAfter("body")[0].contentWindow; -J=function(){return c(S.document[b][f])};M=function(Q,Y){if(Q!==Y){var P=S.document;P.open().close();P[b].hash="#"+Q}};M(c())}}var o={},K,S,M,J;o.start=function(){if(!K){var Q=c();M||B();(function Y(){var P=c(),ia=J(Q);if(P!==Q){M(Q=P,ia);a(p).trigger("hashchange")}else if(ia!==Q)p[b][f]=p[b][f].replace(/#.*/,"")+"#"+ia;K=setTimeout(Y,a.hashchangeDelay)})()}};o.stop=function(){if(!S){K&&clearTimeout(K);K=0}};return o}()})(jQuery,this);(function(a){var p={},g;a.svgIcons=function(c,n){function s(da,W){if(da!=="ajax"){if(Q)return;var Z=(S=ga[0].contentDocument)&&S.getElementById("svg_eof");if(!Z&&!(W&&Z)){Y++;if(Y<50)setTimeout(s,20);else{f();Q=true}return}Q=true}K=a(S.firstChild).children();if(n.no_img)setTimeout(function(){J||b()},500);else{Z=qa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} -function b(da,W){if(!J){if(n.no_img)da=false;if(da){var Z=a(document.createElement("div"));Z.hide().appendTo("body")}if(W){var oa=n.fallback_path?n.fallback_path:"";a.each(W,function(La,Ka){a("#"+La);var Ea=a(new Image).attr({"class":"svg_icon",src:oa+Ka,width:B,height:o,alt:"icon"});ka(Ea,La)})}else for(var pa=K.length,na=0;na0&&!da)ya=g(ya,Ea,true);xa(a(this),ya,Ka)})});if(!W){da&&Z.remove();ga&&ga.remove();M&&M.remove()}n.resize&&a.resizeSvgIcons(n.resize);J=true;n.callback&&n.callback(p)}}function f(){if(c.indexOf(".svgz")!=-1){var da=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,n)}else n.fallback&&b(false,n.fallback)} -function d(da){if(window.btoa)return window.btoa(da);var W=Array(Math.floor((da.length+2)/3)*4),Z,oa,pa,na,ma,za,Ha=0,Fa=0;do{Z=da.charCodeAt(Ha++);oa=da.charCodeAt(Ha++);pa=da.charCodeAt(Ha++);na=Z>>2;Z=(Z&3)<<4|oa>>4;ma=(oa&15)<<2|pa>>6;za=pa&63;if(isNaN(oa))ma=za=64;else if(isNaN(pa))za=64;W[Fa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(na);W[Fa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);W[Fa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); -W[Fa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(za)}while(Ha-1&&P.indexOf("Chrome/");var qa="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var ga=a('').appendTo("body").hide();try{S=ga[0].contentDocument;ga.load(s); -s(0,true)}catch(U){f()}}else{var ba=new DOMParser;a.ajax({url:c,dataType:"string",success:function(da){if(da){S=ba.parseFromString(da,"text/xml");a(function(){s("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){S=ba.parseFromString(da.responseText,"text/xml");S.childNodes.length||a(f);a(function(){s("ajax")})}else a(f)}})}var xa=function(da,W,Z,oa){ia&&W.css("visibility","hidden");if(n.replace){oa&&W.attr("id",Z);(Z=da.attr("class"))&&W.attr("class", -"svg_icon "+Z);da.replaceWith(W)}else da.append(W);ia&&setTimeout(function(){W.removeAttr("style")},1)},ka=function(da,W){if(n.id_match===undefined||n.id_match!==false)xa(holder,da,W,true);p[W]=da};g=function(da,W){var Z=da.find("defs");if(!Z.length)return da;Z=ia?Z.find("*").filter(function(){return!!this.id}):Z.find("[id]");var oa=da[0].getElementsByTagName("*"),pa=oa.length;Z.each(function(na){var ma=this.id;a(S).find("#"+ma);this.id=na="x"+ma+W+na;ma="url(#"+ma+")";var za="url(#"+na+")";for(na= -0;na","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:p}})})(jQuery);(function(a,p){function g(da){return typeof da==="string"}function c(da){var X=d.call(arguments,1);return function(){return da.apply(this,X.concat(d.call(arguments)))}}function m(da,X,Z,oa,ra){var ma;if(oa!==f){X=Z.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Z=X[3]||"";if(ra===2&&g(oa))oa=oa.replace(da?W:ba,"");else{ma=o(X[2]);oa=g(oa)?o[da?ia:P](oa):oa;oa=ra===2?oa:ra===1?a.extend({},oa,ma):a.extend({},ma,oa);oa=q(oa);if(da)oa=oa.replace(ta,k)}da=X[1]+(da?"#":oa||!X[1]?"?":"")+oa+Z}else da= +X(Z!==f?Z:p[qa][ga]);return da}function s(da,X,Z){if(X===f||typeof X==="boolean"){Z=X;X=q[da?ia:P]()}else X=g(X)?X.replace(da?W:ba,""):X;return o(X,Z)}function b(da,X,Z,oa){if(!g(Z)&&typeof Z!=="object"){oa=Z;Z=X;X=f}return this.each(function(){var ra=a(this),ma=X||S()[(this.nodeName||"").toLowerCase()]||"",na=ma&&ra.attr(ma)||"";ra.attr(ma,q[da](na,Z,oa))})}var f,d=Array.prototype.slice,k=decodeURIComponent,q=a.param,B,o,J,U=a.bbq=a.bbq||{},M,I,S,Y=a.event.special,P="querystring",ia="fragment",qa= +"location",ga="href",ba=/^.*\?|#.*$/g,W=/^.*\#/,ta,ka={};q[P]=c(m,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});q[ia]=B=c(m,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});B.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);ta=RegExp(da.join("|"),"g")};B.noEscape(",/");a.deparam=o=function(da,X){var Z={},oa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(ra,ma){var na=ma.split("="),Ca=k(na[0]),Ga=Z,Ja= +0,Da=Ca.split("]["),La=Da.length-1;if(/\[/.test(Da[0])&&/\]$/.test(Da[La])){Da[La]=Da[La].replace(/\]$/,"");Da=Da.shift().split("[").concat(Da);La=Da.length-1}else La=0;if(na.length===2){na=k(na[1]);if(X)na=na&&!isNaN(na)?+na:na==="undefined"?f:oa[na]!==f?oa[na]:na;if(La)for(;Ja<=La;Ja++){Ca=Da[Ja]===""?Ga.length:Da[Ja];Ga=Ga[Ca]=Ja').hide().insertAfter("body")[0].contentWindow; +I=function(){return c(U.document[b][f])};M=function(S,Y){if(S!==Y){var P=U.document;P.open().close();P[b].hash="#"+S}};M(c())}}var o={},J,U,M,I;o.start=function(){if(!J){var S=c();M||B();(function Y(){var P=c(),ia=I(S);if(P!==S){M(S=P,ia);a(p).trigger("hashchange")}else if(ia!==S)p[b][f]=p[b][f].replace(/#.*/,"")+"#"+ia;J=setTimeout(Y,a.hashchangeDelay)})()}};o.stop=function(){if(!U){J&&clearTimeout(J);J=0}};return o}()})(jQuery,this);(function(a){var p={},g;a.svgIcons=function(c,m){function s(da,X){if(da!=="ajax"){if(S)return;var Z=(U=ga[0].contentDocument)&&U.getElementById("svg_eof");if(!Z&&!(X&&Z)){Y++;if(Y<50)setTimeout(s,20);else{f();S=true}return}S=true}J=a(U.firstChild).children();if(m.no_img)setTimeout(function(){I||b()},500);else{Z=qa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} +function b(da,X){if(!I){if(m.no_img)da=false;if(da){var Z=a(document.createElement("div"));Z.hide().appendTo("body")}if(X){var oa=m.fallback_path?m.fallback_path:"";a.each(X,function(La,Oa){a("#"+La);var Ba=a(new Image).attr({"class":"svg_icon",src:oa+Oa,width:B,height:o,alt:"icon"});ka(Ba,La)})}else for(var ra=J.length,ma=0;ma0&&!da)za=g(za,Ba,true);ta(a(this),za,Oa)})});if(!X){da&&Z.remove();ga&&ga.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);I=true;m.callback&&m.callback(p)}}function f(){if(c.indexOf(".svgz")!=-1){var da=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,m)}else m.fallback&&b(false,m.fallback)} +function d(da){if(window.btoa)return window.btoa(da);var X=Array(Math.floor((da.length+2)/3)*4),Z,oa,ra,ma,na,Ca,Ga=0,Ja=0;do{Z=da.charCodeAt(Ga++);oa=da.charCodeAt(Ga++);ra=da.charCodeAt(Ga++);ma=Z>>2;Z=(Z&3)<<4|oa>>4;na=(oa&15)<<2|ra>>6;Ca=ra&63;if(isNaN(oa))na=Ca=64;else if(isNaN(ra))Ca=64;X[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);X[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);X[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(na); +X[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ca)}while(Ga-1&&P.indexOf("Chrome/");var qa="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ga=a('').appendTo("body").hide();try{U=ga[0].contentDocument;ga.load(s); +s(0,true)}catch(ba){f()}}else{var W=new DOMParser;a.ajax({url:c,dataType:"string",success:function(da){if(da){U=W.parseFromString(da,"text/xml");a(function(){s("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){U=W.parseFromString(da.responseText,"text/xml");U.childNodes.length||a(f);a(function(){s("ajax")})}else a(f)}})}var ta=function(da,X,Z,oa){ia&&X.css("visibility","hidden");if(m.replace){oa&&X.attr("id",Z);(Z=da.attr("class"))&&X.attr("class", +"svg_icon "+Z);da.replaceWith(X)}else da.append(X);ia&&setTimeout(function(){X.removeAttr("style")},1)},ka=function(da,X){if(m.id_match===undefined||m.id_match!==false)ta(holder,da,X,true);p[X]=da};g=function(da,X){var Z=da.find("defs");if(!Z.length)return da;Z=ia?Z.find("*").filter(function(){return!!this.id}):Z.find("[id]");var oa=da[0].getElementsByTagName("*"),ra=oa.length;Z.each(function(ma){var na=this.id;a(U).find("#"+na);this.id=ma="x"+na+X+ma;na="url(#"+na+")";var Ca="url(#"+ma+")";for(ma= +0;ma=0;jQuery.fn.jGraduate=function(c){var n= -arguments;return this.each(function(){function s(ja,ca,la,N,R){var ea=R||a("stop",{"stop-color":ca,"stop-opacity":la,offset:ja},ba);if(R){ca=R.getAttribute("stop-color");la=R.getAttribute("stop-opacity");ja=R.getAttribute("offset")}else ba.appendChild(ea);if(la===null)la=1;R=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ja*ia)+", 26)"},Va);var Ga= -a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ca,"fill-opacity":la,transform:"translate("+(10+ja*ia)+", 26)",stroke:"#000","stroke-width":1.5},Va);$(Ga).mousedown(function(Oa){b(this);Ya=ib;Q.mousemove(m).mouseup(f);ua=yb.offset();Oa.preventDefault();return false}).data("stop",ea).data("bg",R).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Xa=+ea.getAttribute("stop-opacity")|| -1,bb=ea.getAttribute("stop-color")||1,rb=(parseFloat(Xa)*255).toString(16);rb.length<2;)rb="0"+rb;ca=bb.substr(1)+rb;$("#"+o+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:B.images.clientPath},color:{active:ca,alphaSupport:true}},function(Wa){bb=Wa.val("hex")?"#"+Wa.val("hex"):"none";Xa=Wa.val("a")!==null?Wa.val("a")/256:1;Oa.setAttribute("fill",bb);Oa.setAttribute("fill-opacity",Xa);ea.setAttribute("stop-color", -bb);ea.setAttribute("stop-opacity",Xa);$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()})});$(ba).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ja){if(!ca){var Xa=this.getAttribute("stop-color"),bb=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Xa);Ga.setAttribute("fill",Xa);ea.setAttribute("stop-opacity",bb===null?1:bb);Ga.setAttribute("fill-opacity", -bb===null?1:bb)}Oa.before(ea);return false}});N&&b(Ga);return ea}function b(ja){ib&&ib.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");ib=ja;ib.parentNode.appendChild(ib)}function f(){Q.unbind("mousemove",m);if(Aa.getAttribute("display")!=="none"){Aa.setAttribute("display","none");var ja=$(ib),ca=ja.data("stop");ja=ja.data("bg");$([ib,ca,ja]).remove()}Ya=null}function d(){var ja=Ta?"rotate("+Ta+","+Ba+","+jb+") ":"";fb===1&&Ma===1?ba.removeAttribute("gradientTransform"):ba.setAttribute("gradientTransform", -ja+"translate("+-Ba*(fb-1)+","+-jb*(Ma-1)+") scale("+fb+","+Ma+")")}function m(ja){var ca=ja.pageX-ua.left;ja=ja.pageY-ua.top;ca=ca<10?10:ca>ia+10?ia+10:ca;var la="translate("+ca+", 26)";if(ja<-60||ja>130){Aa.setAttribute("display","block");Aa.setAttribute("transform",la)}else Aa.setAttribute("display","none");Ya.setAttribute("transform",la);$.data(Ya,"bg").setAttribute("transform",la);$.data(Ya,"stop").setAttribute("offset",(ca-10)/ia);var N=0;$(ba).find("stop").each(function(){var R=this.getAttribute("offset"), -ea=$(this);if(R
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var Y=$(K+"> .jGraduate_colPick"),P=$(K+"> .jGraduate_gradPick");P.html('

    '+B.window.pickerTitle+'

    =0;jQuery.fn.jGraduate=function(c){var m= +arguments;return this.each(function(){function s(la,ca,ja,O,T){var ea=T||a("stop",{"stop-color":ca,"stop-opacity":ja,offset:la},W);if(T){ca=T.getAttribute("stop-color");ja=T.getAttribute("stop-opacity");la=T.getAttribute("offset")}else W.appendChild(ea);if(ja===null)ja=1;T=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+la*ia)+", 26)"},rb);var Ha= +a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ca,"fill-opacity":ja,transform:"translate("+(10+la*ia)+", 26)",stroke:"#000","stroke-width":1.5},rb);$(Ha).mousedown(function(Pa){b(this);Sa=jb;S.mousemove(k).mouseup(f);wa=$a.offset();Pa.preventDefault();return false}).data("stop",ea).data("bg",T).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Pa=this,Xa=+ea.getAttribute("stop-opacity")|| +1,fb=ea.getAttribute("stop-color")||1,ob=(parseFloat(Xa)*255).toString(16);ob.length<2;)ob="0"+ob;ca=fb.substr(1)+ob;$("#"+o+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:B.images.clientPath},color:{active:ca,alphaSupport:true}},function(Wa){fb=Wa.val("hex")?"#"+Wa.val("hex"):"none";Xa=Wa.val("a")!==null?Wa.val("a")/256:1;Pa.setAttribute("fill",fb);Pa.setAttribute("fill-opacity",Xa);ea.setAttribute("stop-color", +fb);ea.setAttribute("stop-opacity",Xa);$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()})});$(W).find("stop").each(function(){var Pa=$(this);if(+this.getAttribute("offset")>la){if(!ca){var Xa=this.getAttribute("stop-color"),fb=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Xa);Ha.setAttribute("fill",Xa);ea.setAttribute("stop-opacity",fb===null?1:fb);Ha.setAttribute("fill-opacity", +fb===null?1:fb)}Pa.before(ea);return false}});O&&b(Ha);return ea}function b(la){jb&&jb.setAttribute("stroke","#000");la.setAttribute("stroke","blue");jb=la;jb.parentNode.appendChild(jb)}function f(){S.unbind("mousemove",k);if(Ea.getAttribute("display")!=="none"){Ea.setAttribute("display","none");var la=$(jb),ca=la.data("stop");la=la.data("bg");$([jb,ca,la]).remove()}Sa=null}function d(){var la=Ta?"rotate("+Ta+","+Fa+","+lb+") ":"";hb===1&&Ma===1?W.removeAttribute("gradientTransform"):W.setAttribute("gradientTransform", +la+"translate("+-Fa*(hb-1)+","+-lb*(Ma-1)+") scale("+hb+","+Ma+")")}function k(la){var ca=la.pageX-wa.left;la=la.pageY-wa.top;ca=ca<10?10:ca>ia+10?ia+10:ca;var ja="translate("+ca+", 26)";if(la<-60||la>130){Ea.setAttribute("display","block");Ea.setAttribute("transform",ja)}else Ea.setAttribute("display","none");Sa.setAttribute("transform",ja);$.data(Sa,"bg").setAttribute("transform",ja);$.data(Sa,"stop").setAttribute("offset",(ca-10)/ia);var O=0;$(W).find("stop").each(function(){var T=this.getAttribute("offset"), +ea=$(this);if(T
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var Y=$(J+"> .jGraduate_colPick"),P=$(J+"> .jGraduate_gradPick");P.html('

    '+B.window.pickerTitle+'


    ');var ia=256,qa=ia-0,ga=ia-0,U,ba,xa,ka={};$(".jGraduate_SliderBar").width(145);var da=$("#"+o+"_jGraduate_GradContainer")[0],W=a("svg",{id:o+"_jgraduate_svg",width:ia,height:ia,xmlns:p.svg},da);U=U||q.paint.type;var Z=ba=q.paint[U],oa=q.paint.alpha,pa=U==="solidColor";switch(U){case "solidColor":case "linearGradient":if(!pa){ba.id=o+"_lg_jgraduate_grad"; -Z=ba=W.appendChild(ba)}a("radialGradient",{id:o+"_rg_jgraduate_grad"},W);if(U==="linearGradient")break;case "radialGradient":if(!pa){ba.id=o+"_rg_jgraduate_grad";Z=ba=W.appendChild(ba)}a("linearGradient",{id:o+"_lg_jgraduate_grad"},W)}if(pa){Z=ba=$("#"+o+"_lg_jgraduate_grad")[0];J=q.paint[U];s(0,"#"+J,1);var na=typeof B.newstop;if(na==="string")switch(B.newstop){case "same":s(1,"#"+J,1);break;case "inverse":na="";for(var ma=0;ma<6;ma+=2){J.substr(ma,2);var za=(255-parseInt(J.substr(ma,2),16)).toString(16); -if(za.length<2)za=0+za;na+=za}s(1,"#"+na,1);break;case "white":s(1,"#ffffff",1);break;case "black":s(1,"#000000",1)}else if(na==="object")s(1,B.newstop.color||"#"+J,"opac"in B.newstop?B.newstop.opac:1)}J=parseFloat(Z.getAttribute("x1")||0);na=parseFloat(Z.getAttribute("y1")||0);ma=parseFloat(Z.getAttribute("x2")||1);za=parseFloat(Z.getAttribute("y2")||0);var Ha=parseFloat(Z.getAttribute("cx")||0.5),Fa=parseFloat(Z.getAttribute("cy")||0.5),Ia=parseFloat(Z.getAttribute("fx")||Ha),La=parseFloat(Z.getAttribute("fy")|| -Fa);xa=a("rect",{id:o+"_jgraduate_rect",x:0,y:0,width:qa,height:ga,fill:"url(#"+o+"_jgraduate_grad)","fill-opacity":oa/100},W);var Ka=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:na*ia,left:J*ia}).data("coord","start").appendTo(da),Ea=Ka.clone().text(2).css({top:za*ia,left:ma*ia}).attr("title","End stop").data("coord","end").appendTo(da),ya=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Fa*ia,left:Ha* -ia}).data("coord","center").appendTo(da),Ca=ya.clone().text("F").css({top:La*ia,left:Ia*ia,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ca[0].id=o+"_jGraduate_focusCoord";$(K+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ca){var la=ba.getAttribute(ca),N=isNaN(ca[1]);la||(la=N?"0.5":ca==="x2"?"1.0":"0.0");ka[ca]=$("#"+o+"_jGraduate_"+ca).val(la).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(ca[0]==="f"&&!kb))if(N&&U==="radialGradient"||!N&&U==="linearGradient")ba.setAttribute(ca,this.value);var R=N?ca[0]==="c"?ya:Ca:ca[1]==="1"?Ka:Ea,ea=ca.indexOf("x")>=0?"left":"top";R.css(ea,this.value*ia)}).change()});var wa,Va,yb=$("#"+o+"_jGraduate_StopSlider"),ib,Qa,Ya,Aa=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Qa),ua,fb=1,Ma=1,Ta=0,Ba=Ha,jb=Fa;Qa=a("svg",{width:"100%",height:45},yb[0]);da=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Qa);a("image",{width:16,height:16},da).setAttributeNS(p.xlink,"xlink:href",B.images.clientPath+"map-opacity.png");$(Qa).on("click touchstart",function(ja){ua=yb.offset();if(ja.target.tagName!=="path"){var ca=ja.pageX-ua.left-8;ca=ca<10?10:ca>ia+10?ia+10:ca;s(ca/ia,0,0,true);ja.stopPropagation()}});$(Qa).mouseover(function(){Qa.appendChild(Aa)});Va=a("g",{},Qa);a("line",{x1:10,y1:15,x2:ia+10,y2:15,"stroke-width":2,stroke:"#000"},Qa);var sb= -P.find(".jGraduate_spreadMethod").change(function(){ba.setAttribute("spreadMethod",$(this).val())}),Za=null,cb=function(ja){var ca=ja.pageX-lb.left,la=ja.pageY-lb.top;ca=ca<0?0:ca>ia?ia:ca;la=la<0?0:la>ia?ia:la;Za.css("left",ca).css("top",la);ca=ca/qa;la=la/ga;var N=Za.data("coord"),R=ba;switch(N){case "start":ka.x1.val(ca);ka.y1.val(la);R.setAttribute("x1",ca);R.setAttribute("y1",la);break;case "end":ka.x2.val(ca);ka.y2.val(la);R.setAttribute("x2",ca);R.setAttribute("y2",la);break;case "center":ka.cx.val(ca); -ka.cy.val(la);R.setAttribute("cx",ca);R.setAttribute("cy",la);Ba=ca;jb=la;d();break;case "focus":ka.fx.val(ca);ka.fy.val(la);R.setAttribute("fx",ca);R.setAttribute("fy",la);d()}ja.preventDefault()},zb=function(){Za=null;Q.unbind("mousemove",cb).unbind("mouseup",zb)};wa=ba.getElementsByTagNameNS(p.svg,"stop");if(sa<2){for(;sa<2;){ba.appendChild(document.createElementNS(p.svg,"stop"));++sa}wa=ba.getElementsByTagNameNS(p.svg,"stop")}var sa=wa.length;for(ma=0;ma99.5)N=99.5;if(N>0)Ma=1-N/100;else fb=-(N/100)-1;R=145*((N+100)/ -2)/100;ea&&d();break;case "angle":Ta=N;R=Ta/180;R+=0.5;R*=145;ea&&d()}if(R>145)R=145;else if(R<0)R=0;la.css({"margin-left":R-5})}).change()});var tb=function(ja){var ca=ja.pageX-gb.offset.left-parseInt(gb.parent.css("border-left-width"));if(ca>145)ca=145;if(ca<=0)ca=0;var la=ca-5;ca/=145;switch(gb.type){case "radius":ca=Math.pow(ca*2,2.5);if(ca>0.98&&ca<1.02)ca=1;if(ca<=0.01)ca=0.01;ba.setAttribute("r",ca);break;case "opacity":q.paint.alpha=parseInt(ca*100);xa.setAttribute("fill-opacity",ca);break; -case "ellip":Ma=fb=1;if(ca<0.5){ca/=0.5;fb=ca<=0?0.01:ca}else if(ca>0.5){ca/=0.5;ca=2-ca;Ma=ca<=0?0.01:ca}d();ca-=1;if(Ma===ca+1)ca=Math.abs(ca);break;case "angle":ca-=0.5;Ta=ca*=180;d();ca/=100}gb.elem.css({"margin-left":la});ca=Math.round(ca*100);gb.input.val(ca);ja.preventDefault()},pb=function(){Q.unbind("mousemove",tb).unbind("mouseup",pb);gb=null};for(P=(q.paint.alpha*255/100).toString(16);P.length<2;)P="0"+P;P=P.split(".")[0];J=q.paint.solidColor=="none"?"":q.paint.solidColor+P;pa||(J=wa[0].getAttribute("stop-color")); -$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});Y.jPicker({window:{title:B.window.pickerTitle},images:{clientPath:B.images.clientPath},color:{active:J,alphaSupport:true}},function(ja){q.paint.type="solidColor";q.paint.alpha=ja.val("ahex")?Math.round(ja.val("a")/255*100):100;q.paint.solidColor=ja.val("hex")?ja.val("hex"):"none";q.paint.radialGradient=null;S()},null,function(){M()});var Ab=$(K+" .jGraduate_tabs li");Ab.on("click touchstart",function(){Ab.removeClass("jGraduate_tab_current"); -$(this).addClass("jGraduate_tab_current");$(K+" > div").hide();var ja=$(this).attr("data-type");$(K+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+o+"_jgraduate_rect")[0].setAttribute("fill","url(#"+o+"_"+ja+"_jgraduate_grad)");U=ja==="lg"?"linearGradient":"radialGradient";$("#"+o+"_jGraduate_OpacInput").val(q.paint.alpha).change();var ca=$("#"+o+"_"+ja+"_jgraduate_grad")[0];if(ba!==ca){var la= -$(ba).find("stop");$(ca).empty().append(la);ba=ca;ca=sb.val();ba.setAttribute("spreadMethod",ca)}kb=ja==="rg"&&ba.getAttribute("fx")!=null&&!(Ha==Ia&&Fa==La);$("#"+o+"_jGraduate_focusCoord").toggle(kb);if(kb)$("#"+o+"_jGraduate_match_ctr")[0].checked=false}else{$(K+" .jGraduate_gradPick").hide();$(K+" .jGraduate_colPick").show()}});$(K+" > div").hide();Ab.removeClass("jGraduate_tab_current");var Bb;switch(q.paint.type){case "linearGradient":Bb=$(K+" .jGraduate_tab_lingrad");break;case "radialGradient":Bb= -$(K+" .jGraduate_tab_radgrad");break;default:Bb=$(K+" .jGraduate_tab_color")}q.show();setTimeout(function(){Bb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),p=$(document);$.extend($.fn,{contextMenu:function(g,c){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var n=$(this),s=$(n).offset(),b=$("#"+g.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(f){$(this).mouseup(function(d){var m=$(this);m.unbind("mouseup");$(".contextMenu").hide();if(f.button===2||g.allowLeft|| -f.ctrlKey&&svgedit.browser.isMac()){d.stopPropagation();if(n.hasClass("disabled")||f.altKey)return false;var q=d.pageX,B=d.pageY;d=a.width()-b.width();var o=a.height()-b.height();if(q>d-15)q=d-15;if(B>o-30)B=o-30;p.unbind("click");b.css({top:B,left:q}).fadeIn(g.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});p.keypress(function(K){switch(K.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); -b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover");break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:p.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){p.unbind("click").unbind("keypress"); -$(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(m),{x:q-s.left,y:B-s.top,docX:q,docY:B});return false});setTimeout(function(){p.click(function(){p.unbind("click").unbind("keypress");b.fadeOut(g.outSpeed);return false})},0)}})});if($.browser.mozilla)$("#"+g.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+g.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+g.menu).each(function(){$(this).bind("mousedown.disableTextSelect", -function(){return false})});$(n).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var c=g.split(","),n=0;n=0,s=p.indexOf("Gecko/")>=0,b=p.indexOf("MSIE")>=0,f=p.indexOf("Chrome/")>=0,d=p.indexOf("Windows")>=0,m=p.indexOf("Macintosh")>= -0,q="ontouchstart"in window,B=!!g.querySelector,o=!!document.evaluate,K=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,10");var ga=qa.pathSegList;qa=qa.createSVGPathSegLinetoAbs(5,5);try{ga.replaceItem(qa,0);return true}catch(U){}return false}(),S=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,10");var ga=qa.pathSegList;qa=qa.createSVGPathSegLinetoAbs(5,5);try{ga.insertItemBefore(qa, -0);return true}catch(U){}return false}(),M=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","svg"),ga=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(qa);ga.setAttribute("x",5);qa.appendChild(ga);var U=document.createElementNS("http://www.w3.org/2000/svg","text");U.textContent="a";ga.appendChild(U);ga=U.getStartPositionOfChar(0).x;document.documentElement.removeChild(qa);return ga===0}(),J=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(qa);var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M0,0 C0,0 10,10 10,0");qa.appendChild(ga);ga=ga.getBBox();document.documentElement.removeChild(qa);return ga.height>4&&ga.height<5}(),Q=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(qa);var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M0,0 10,0");var U= -document.createElementNS("http://www.w3.org/2000/svg","path");U.setAttribute("d","M5,0 15,0");var ba=document.createElementNS("http://www.w3.org/2000/svg","g");ba.appendChild(ga);ba.appendChild(U);qa.appendChild(ba);ga=ba.getBBox();document.documentElement.removeChild(qa);return ga.width==15}(),Y=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect");qa.setAttribute("x",0.1);(qa=qa.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); -return qa}(),P=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect");qa.setAttribute("style","vector-effect:non-scaling-stroke");return qa.style.vectorEffect==="non-scaling-stroke"}(),ia=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ga=g.createSVGTransform();qa.appendItem(ga);return qa.getItem(0)==ga}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return s}; -svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return q};svgedit.browser.supportsSelectors=function(){return B};svgedit.browser.supportsXpath=function(){return o};svgedit.browser.supportsPathReplaceItem=function(){return K};svgedit.browser.supportsPathInsertItemBefore=function(){return S};svgedit.browser.supportsPathBBox=function(){return J}; -svgedit.browser.supportsHVLineContainerBBox=function(){return Q};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return Y};svgedit.browser.supportsNonScalingStroke=function(){return P};svgedit.browser.supportsNativeTransformLists=function(){return ia}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; -(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),p={};svgedit.transformlist.SVGTransformList=function(g){this._elem=g||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var n=0;n=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,n){var s=null;if(n>=0)if(n=0){this._removeFromOtherLists(c);s=this._xforms[n]=c;this._list._update()}return s};this.removeItem=function(c){if(c=0){for(var n=this._xforms[c],s=Array(this.numberOfItems- -1),b=0;b
    ');var ia=256,qa=ia-0,ga=ia-0,ba,W,ta,ka={};$(".jGraduate_SliderBar").width(145);var da=$("#"+o+"_jGraduate_GradContainer")[0],X=a("svg",{id:o+"_jgraduate_svg",width:ia,height:ia,xmlns:p.svg},da);ba=ba||q.paint.type;var Z=W=q.paint[ba],oa=q.paint.alpha,ra=ba==="solidColor";switch(ba){case "solidColor":case "linearGradient":if(!ra){W.id=o+"_lg_jgraduate_grad"; +Z=W=X.appendChild(W)}a("radialGradient",{id:o+"_rg_jgraduate_grad"},X);if(ba==="linearGradient")break;case "radialGradient":if(!ra){W.id=o+"_rg_jgraduate_grad";Z=W=X.appendChild(W)}a("linearGradient",{id:o+"_lg_jgraduate_grad"},X)}if(ra){Z=W=$("#"+o+"_lg_jgraduate_grad")[0];I=q.paint[ba];s(0,"#"+I,1);var ma=typeof B.newstop;if(ma==="string")switch(B.newstop){case "same":s(1,"#"+I,1);break;case "inverse":ma="";for(var na=0;na<6;na+=2){I.substr(na,2);var Ca=(255-parseInt(I.substr(na,2),16)).toString(16); +if(Ca.length<2)Ca=0+Ca;ma+=Ca}s(1,"#"+ma,1);break;case "white":s(1,"#ffffff",1);break;case "black":s(1,"#000000",1)}else if(ma==="object")s(1,B.newstop.color||"#"+I,"opac"in B.newstop?B.newstop.opac:1)}I=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);na=parseFloat(Z.getAttribute("x2")||1);Ca=parseFloat(Z.getAttribute("y2")||0);var Ga=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Da=parseFloat(Z.getAttribute("fx")||Ga),La=parseFloat(Z.getAttribute("fy")|| +Ja);ta=a("rect",{id:o+"_jgraduate_rect",x:0,y:0,width:qa,height:ga,fill:"url(#"+o+"_jgraduate_grad)","fill-opacity":oa/100},X);var Oa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ia,left:I*ia}).data("coord","start").appendTo(da),Ba=Oa.clone().text(2).css({top:Ca*ia,left:na*ia}).attr("title","End stop").data("coord","end").appendTo(da),za=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ia,left:Ga* +ia}).data("coord","center").appendTo(da),Ia=za.clone().text("F").css({top:La*ia,left:Da*ia,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ia[0].id=o+"_jGraduate_focusCoord";$(J+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(la,ca){var ja=W.getAttribute(ca),O=isNaN(ca[1]);ja||(ja=O?"0.5":ca==="x2"?"1.0":"0.0");ka[ca]=$("#"+o+"_jGraduate_"+ca).val(ja).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> +1)this.value=1;if(!(ca[0]==="f"&&!kb))if(O&&ba==="radialGradient"||!O&&ba==="linearGradient")W.setAttribute(ca,this.value);var T=O?ca[0]==="c"?za:Ia:ca[1]==="1"?Oa:Ba,ea=ca.indexOf("x")>=0?"left":"top";T.css(ea,this.value*ia)}).change()});var xa,rb,$a=$("#"+o+"_jGraduate_StopSlider"),jb,Ua,Sa,Ea=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Ua),wa,hb=1,Ma=1,Ta=0,Fa=Ga,lb=Ja;Ua=a("svg",{width:"100%",height:45},$a[0]);da=a("pattern",{width:16, +height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ua);a("image",{width:16,height:16},da).setAttributeNS(p.xlink,"xlink:href",B.images.clientPath+"map-opacity.png");$(Ua).on("click touchstart",function(la){wa=$a.offset();if(la.target.tagName!=="path"){var ca=la.pageX-wa.left-8;ca=ca<10?10:ca>ia+10?ia+10:ca;s(ca/ia,0,0,true);la.stopPropagation()}});$(Ua).mouseover(function(){Ua.appendChild(Ea)});rb=a("g",{},Ua);a("line",{x1:10,y1:15,x2:ia+10,y2:15,"stroke-width":2,stroke:"#000"},Ua);var tb= +P.find(".jGraduate_spreadMethod").change(function(){W.setAttribute("spreadMethod",$(this).val())}),Ya=null,bb=function(la){var ca=la.pageX-nb.left,ja=la.pageY-nb.top;ca=ca<0?0:ca>ia?ia:ca;ja=ja<0?0:ja>ia?ia:ja;Ya.css("left",ca).css("top",ja);ca=ca/qa;ja=ja/ga;var O=Ya.data("coord"),T=W;switch(O){case "start":ka.x1.val(ca);ka.y1.val(ja);T.setAttribute("x1",ca);T.setAttribute("y1",ja);break;case "end":ka.x2.val(ca);ka.y2.val(ja);T.setAttribute("x2",ca);T.setAttribute("y2",ja);break;case "center":ka.cx.val(ca); +ka.cy.val(ja);T.setAttribute("cx",ca);T.setAttribute("cy",ja);Fa=ca;lb=ja;d();break;case "focus":ka.fx.val(ca);ka.fy.val(ja);T.setAttribute("fx",ca);T.setAttribute("fy",ja);d()}la.preventDefault()},Cb=function(){Ya=null;S.unbind("mousemove",bb).unbind("mouseup",Cb)};xa=W.getElementsByTagNameNS(p.svg,"stop");if(ua<2){for(;ua<2;){W.appendChild(document.createElementNS(p.svg,"stop"));++ua}xa=W.getElementsByTagNameNS(p.svg,"stop")}var ua=xa.length;for(na=0;na99.5)O=99.5;if(O>0)Ma=1-O/100;else hb=-(O/100)-1;T=145*((O+100)/ +2)/100;ea&&d();break;case "angle":Ta=O;T=Ta/180;T+=0.5;T*=145;ea&&d()}if(T>145)T=145;else if(T<0)T=0;ja.css({"margin-left":T-5})}).change()});var ub=function(la){var ca=la.pageX-gb.offset.left-parseInt(gb.parent.css("border-left-width"));if(ca>145)ca=145;if(ca<=0)ca=0;var ja=ca-5;ca/=145;switch(gb.type){case "radius":ca=Math.pow(ca*2,2.5);if(ca>0.98&&ca<1.02)ca=1;if(ca<=0.01)ca=0.01;W.setAttribute("r",ca);break;case "opacity":q.paint.alpha=parseInt(ca*100);ta.setAttribute("fill-opacity",ca);break; +case "ellip":Ma=hb=1;if(ca<0.5){ca/=0.5;hb=ca<=0?0.01:ca}else if(ca>0.5){ca/=0.5;ca=2-ca;Ma=ca<=0?0.01:ca}d();ca-=1;if(Ma===ca+1)ca=Math.abs(ca);break;case "angle":ca-=0.5;Ta=ca*=180;d();ca/=100}gb.elem.css({"margin-left":ja});ca=Math.round(ca*100);gb.input.val(ca);la.preventDefault()},vb=function(){S.unbind("mousemove",ub).unbind("mouseup",vb);gb=null};for(P=(q.paint.alpha*255/100).toString(16);P.length<2;)P="0"+P;P=P.split(".")[0];I=q.paint.solidColor=="none"?"":q.paint.solidColor+P;ra||(I=xa[0].getAttribute("stop-color")); +$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});Y.jPicker({window:{title:B.window.pickerTitle},images:{clientPath:B.images.clientPath},color:{active:I,alphaSupport:true}},function(la){q.paint.type="solidColor";q.paint.alpha=la.val("ahex")?Math.round(la.val("a")/255*100):100;q.paint.solidColor=la.val("hex")?la.val("hex"):"none";q.paint.radialGradient=null;U()},null,function(){M()});var xb=$(J+" .jGraduate_tabs li");xb.on("click touchstart",function(){xb.removeClass("jGraduate_tab_current"); +$(this).addClass("jGraduate_tab_current");$(J+" > div").hide();var la=$(this).attr("data-type");$(J+" .jGraduate_gradPick").show();if(la==="rg"||la==="lg"){$(".jGraduate_"+la+"_field").show();$(".jGraduate_"+(la==="lg"?"rg":"lg")+"_field").hide();$("#"+o+"_jgraduate_rect")[0].setAttribute("fill","url(#"+o+"_"+la+"_jgraduate_grad)");ba=la==="lg"?"linearGradient":"radialGradient";$("#"+o+"_jGraduate_OpacInput").val(q.paint.alpha).change();var ca=$("#"+o+"_"+la+"_jgraduate_grad")[0];if(W!==ca){var ja= +$(W).find("stop");$(ca).empty().append(ja);W=ca;ca=tb.val();W.setAttribute("spreadMethod",ca)}kb=la==="rg"&&W.getAttribute("fx")!=null&&!(Ga==Da&&Ja==La);$("#"+o+"_jGraduate_focusCoord").toggle(kb);if(kb)$("#"+o+"_jGraduate_match_ctr")[0].checked=false}else{$(J+" .jGraduate_gradPick").hide();$(J+" .jGraduate_colPick").show()}});$(J+" > div").hide();xb.removeClass("jGraduate_tab_current");var Ab;switch(q.paint.type){case "linearGradient":Ab=$(J+" .jGraduate_tab_lingrad");break;case "radialGradient":Ab= +$(J+" .jGraduate_tab_radgrad");break;default:Ab=$(J+" .jGraduate_tab_color")}q.show();setTimeout(function(){Ab.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),p=$(document);$.extend($.fn,{contextMenu:function(g,c){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var m=$(this),s=$(m).offset(),b=$("#"+g.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(k){var q=$(this);q.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| +g.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(k,d,q)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var k=$(this);k.unbind("mouseup");f(d,d,k)});var f=function(d,k,q){if(typeof k=="undefined")k=d;d.stopPropagation();if(m.hasClass("disabled")||k.altKey)return false;var B=d.pageX,o=d.pageY;if(svgedit.browser.isTouch()){B=d.originalEvent.touches[0].pageX;o=d.originalEvent.touches[0].pageY}d=a.width()-b.width();k=a.height()-b.height();if(B>d-15)B=d-15; +if(o>k-30)o=k-30;if(svgedit.browser.isTouch())o-=b.height()/2;p.unbind("click");b.css({top:o,left:B}).fadeIn(g.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});p.keypress(function(J){switch(J.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover"); +break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:p.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){p.unbind("click").unbind("keypress");$(".contextMenu").hide();c&&c($(this).attr("href").substr(1), +$(q),{x:B-s.left,y:o-s.top,docX:B,docY:o});return false});setTimeout(function(){p.click(function(){p.unbind("click").unbind("keypress");b.fadeOut(g.outSpeed);return false})},0)};if($.browser.mozilla)$("#"+g.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+g.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+g.menu).each(function(){$(this).bind("mousedown.disableTextSelect",function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu", +function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var c=g.split(","),m=0;m=0,s=p.indexOf("Gecko/")>=0,b=p.indexOf("MSIE")>=0,f=p.indexOf("Chrome/")>=0,d=p.indexOf("Windows")>=0,k=p.indexOf("Macintosh")>= +0,q="ontouchstart"in window,B=!!g.querySelector,o=!!document.evaluate,J=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,10");var ga=qa.pathSegList;qa=qa.createSVGPathSegLinetoAbs(5,5);try{ga.replaceItem(qa,0);return true}catch(ba){}return false}(),U=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,10");var ga=qa.pathSegList;qa=qa.createSVGPathSegLinetoAbs(5,5);try{ga.insertItemBefore(qa, +0);return true}catch(ba){}return false}(),M=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","svg"),ga=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(qa);ga.setAttribute("x",5);qa.appendChild(ga);var ba=document.createElementNS("http://www.w3.org/2000/svg","text");ba.textContent="a";ga.appendChild(ba);ga=ba.getStartPositionOfChar(0).x;document.documentElement.removeChild(qa);return ga===0}(),I=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg", +"svg");document.documentElement.appendChild(qa);var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M0,0 C0,0 10,10 10,0");qa.appendChild(ga);ga=ga.getBBox();document.documentElement.removeChild(qa);return ga.height>4&&ga.height<5}(),S=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(qa);var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M0,0 10,0");var ba= +document.createElementNS("http://www.w3.org/2000/svg","path");ba.setAttribute("d","M5,0 15,0");var W=document.createElementNS("http://www.w3.org/2000/svg","g");W.appendChild(ga);W.appendChild(ba);qa.appendChild(W);ga=W.getBBox();document.documentElement.removeChild(qa);return ga.width==15}(),Y=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect");qa.setAttribute("x",0.1);(qa=qa.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); +return qa}(),P=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect");qa.setAttribute("style","vector-effect:non-scaling-stroke");return qa.style.vectorEffect==="non-scaling-stroke"}(),ia=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ga=g.createSVGTransform();qa.appendItem(ga);return qa.getItem(0)==ga}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return s}; +svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return k};svgedit.browser.isTouch=function(){return q};svgedit.browser.supportsSelectors=function(){return B};svgedit.browser.supportsXpath=function(){return o};svgedit.browser.supportsPathReplaceItem=function(){return J};svgedit.browser.supportsPathInsertItemBefore=function(){return U};svgedit.browser.supportsPathBBox=function(){return I}; +svgedit.browser.supportsHVLineContainerBBox=function(){return S};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return Y};svgedit.browser.supportsNonScalingStroke=function(){return P};svgedit.browser.supportsNativeTransformLists=function(){return ia}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; +(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),p={};svgedit.transformlist.SVGTransformList=function(g){this._elem=g||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,m){var s=null;if(m>=0)if(m=0){this._removeFromOtherLists(c);s=this._xforms[m]=c;this._list._update()}return s};this.removeItem=function(c){if(c=0){for(var m=this._xforms[c],s=Array(this.numberOfItems- +1),b=0;b1;)c=p[g-1].multiply(c);if(Math.abs(c.a)<1.0E-14)c.a=0;if(Math.abs(c.b)<1.0E-14)c.b=0;if(Math.abs(c.c)<1.0E-14)c.c=0;if(Math.abs(c.d)< -1.0E-14)c.d=0;if(Math.abs(c.e)<1.0E-14)c.e=0;if(Math.abs(c.f)<1.0E-14)c.f=0;return c};svgedit.math.hasMatrixTransform=function(p){if(!p)return false;for(var g=p.numberOfItems;g--;){var c=p.getItem(g);if(c.type==1&&!svgedit.math.isIdentity(c.matrix))return true}return false};svgedit.math.transformBox=function(p,g,c,n,s){var b={x:p,y:g},f={x:p+c,y:g};c={x:p+c,y:g+n};p={x:p,y:g+n};g=svgedit.math.transformPoint;b=g(b.x,b.y,s);var d=n=b.x,m=b.y,q=b.y;f=g(f.x,f.y,s);n=Math.min(n,f.x);d=Math.max(d,f.x); -m=Math.min(m,f.y);q=Math.max(q,f.y);p=g(p.x,p.y,s);n=Math.min(n,p.x);d=Math.max(d,p.x);m=Math.min(m,p.y);q=Math.max(q,p.y);c=g(c.x,c.y,s);n=Math.min(n,c.x);d=Math.max(d,c.x);m=Math.min(m,c.y);q=Math.max(q,c.y);return{tl:b,tr:f,bl:p,br:c,aabox:{x:n,y:m,width:d-n,height:q-m}}};svgedit.math.transformListToTransform=function(p,g,c){if(p==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());g=g==undefined?0:g;c=c==undefined?p.numberOfItems-1:c;g=parseInt(g);c=parseInt(c);if(g>c){var n=c;c=g; -g=n}n=a.createSVGMatrix();for(g=g;g<=c;++g){var s=g>=0&&gc){var m=c;c=g; +g=m}m=a.createSVGMatrix();for(g=g;g<=c;++g){var s=g>=0&&gp.x&&g.yp.y}})();svgedit=svgedit||{}; -(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],p=["y","y1","cy","ry","height"],g=$.merge(["r","radius"],a);$.merge(g,p);var c,n={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("width","1em");f.setAttribute("height","1ex");f.setAttribute("x","1in");b.appendChild(f);f=f.getBBox();document.body.removeChild(b); -b=f.x;n.em=f.width;n.ex=f.height;n["in"]=b;n.cm=b/2.54;n.mm=b/25.4;n.pt=b/72;n.pc=b/6;n["%"]=0};svgedit.units.getTypeMap=function(){return n};svgedit.units.shortFloat=function(b){var f=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(f);return parseFloat(b).toFixed(f)-0};svgedit.units.convertUnit=function(b,f){f=f||c.getBaseUnit();return svgedit.unit.shortFloat(b/n[f])};svgedit.units.setUnitAttr=function(b, -f,d){isNaN(d)||b.getAttribute(f);b.setAttribute(f,d)};var s={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var f=b.tagName,d=c.getBaseUnit();if(f=s[f])for(var m=f.length,q=0;q=0?d*m:p.indexOf(b)>=0?d*q:d*Math.sqrt(m*m+q*q)/Math.sqrt(2)}else{m=f.substr(-2);d=f.substr(0,f.length-2);return d*n[m]}};svgedit.units.isValidUnit=function(b,f,d){var m=false;if(g.indexOf(b)>=0)if(isNaN(f)){f=f.toLowerCase();$.each(n,function(o){if(!m)if(RegExp("^-?[\\d\\.]+"+o+"$").test(f))m=true})}else m=true;else if(b=="id"){b=false;try{var q=c.getElement(f); -b=q==null||q===d}catch(B){}return b}else m=true;return m}})();svgedit=svgedit||{}; -(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(f){}var d=$.data(b,"ref"),m=null;if(d){var q=$(d).children().clone().attr("visibility","hidden");$(s).append(q);m=q.filter("line, path")}else m=$(b).find("line, path");var B=false;if(m.length){m.each(function(){var o=this.getBBox();if(!o.width||!o.height)B=true});if(B){b=d?q:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();d&&q.remove();return ret}if(!svgedit.utilities)svgedit.utilities= -{};var p="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,c=null,n=null,s=null;svgedit.utilities.init=function(b){g=b;c=b.getDOMDocument();n=b.getDOMContainer();s=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

    ").text(b).html()};svgedit.utilities.fromXml=function(b){return $("

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); -var f=Array(Math.floor((b.length+2)/3)*4),d,m,q,B,o,K,S=0,M=0;do{d=b.charCodeAt(S++);m=b.charCodeAt(S++);q=b.charCodeAt(S++);B=d>>2;d=(d&3)<<4|m>>4;o=(m&15)<<2|q>>6;K=q&63;if(isNaN(m))o=K=64;else if(isNaN(q))K=64;f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(B);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(o);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(K)}while(S< -b.length);return f.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var f="",d,m,q="",B,o="",K=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++)); -d=d<<2|m>>4;m=(m&15)<<4|B>>2;q=(B&3)<<6|o;f+=String.fromCharCode(d);if(B!=64)f+=String.fromCharCode(m);if(o!=64)f+=String.fromCharCode(q)}while(K127)f+="&#"+m+";"}return f};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var d=window.DOMParser? -new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(m){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(b)?d:false:d.parseFromString(b,"text/xml")}catch(q){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,f){if(b&&b.nodeType==1){f(b);for(var d=b.childNodes.length;d--;)svgedit.utilities.walkTree(b.childNodes.item(d),f)}}; +(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],p=["y","y1","cy","ry","height"],g=$.merge(["r","radius"],a);$.merge(g,p);var c,m={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("width","1em");f.setAttribute("height","1ex");f.setAttribute("x","1in");b.appendChild(f);f=f.getBBox();document.body.removeChild(b); +b=f.x;m.em=f.width;m.ex=f.height;m["in"]=b;m.cm=b/2.54;m.mm=b/25.4;m.pt=b/72;m.pc=b/6;m["%"]=0};svgedit.units.getTypeMap=function(){return m};svgedit.units.shortFloat=function(b){var f=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(f);return parseFloat(b).toFixed(f)-0};svgedit.units.convertUnit=function(b,f){f=f||c.getBaseUnit();return svgedit.unit.shortFloat(b/m[f])};svgedit.units.setUnitAttr=function(b, +f,d){isNaN(d)||b.getAttribute(f);b.setAttribute(f,d)};var s={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var f=b.tagName,d=c.getBaseUnit();if(f=s[f])for(var k=f.length,q=0;q=0?d*k:p.indexOf(b)>=0?d*q:d*Math.sqrt(k*k+q*q)/Math.sqrt(2)}else{k=f.substr(-2);d=f.substr(0,f.length-2);return d*m[k]}};svgedit.units.isValidUnit=function(b,f,d){var k=false;if(g.indexOf(b)>=0)if(isNaN(f)){f=f.toLowerCase();$.each(m,function(o){if(!k)if(RegExp("^-?[\\d\\.]+"+o+"$").test(f))k=true})}else k=true;else if(b=="id"){b=false;try{var q=c.getElement(f); +b=q==null||q===d}catch(B){}return b}else k=true;return k}})();svgedit=svgedit||{}; +(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(f){}var d=$.data(b,"ref"),k=null;if(d){var q=$(d).children().clone().attr("visibility","hidden");$(s).append(q);k=q.filter("line, path")}else k=$(b).find("line, path");var B=false;if(k.length){k.each(function(){var o=this.getBBox();if(!o.width||!o.height)B=true});if(B){b=d?q:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();d&&q.remove();return ret}if(!svgedit.utilities)svgedit.utilities= +{};var p="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,c=null,m=null,s=null;svgedit.utilities.init=function(b){g=b;c=b.getDOMDocument();m=b.getDOMContainer();s=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

    ").text(b).html()};svgedit.utilities.fromXml=function(b){return $("

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); +var f=Array(Math.floor((b.length+2)/3)*4),d,k,q,B,o,J,U=0,M=0;do{d=b.charCodeAt(U++);k=b.charCodeAt(U++);q=b.charCodeAt(U++);B=d>>2;d=(d&3)<<4|k>>4;o=(k&15)<<2|q>>6;J=q&63;if(isNaN(k))o=J=64;else if(isNaN(q))J=64;f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(B);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(o);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(J)}while(U< +b.length);return f.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var f="",d,k,q="",B,o="",J=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(J++));k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(J++));B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(J++));o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(J++)); +d=d<<2|k>>4;k=(k&15)<<4|B>>2;q=(B&3)<<6|o;f+=String.fromCharCode(d);if(B!=64)f+=String.fromCharCode(k);if(o!=64)f+=String.fromCharCode(q)}while(J127)f+="&#"+k+";"}return f};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var d=window.DOMParser? +new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(k){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(b)?d:false:d.parseFromString(b,"text/xml")}catch(q){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,f){if(b&&b.nodeType==1){f(b);for(var d=b.childNodes.length;d--;)svgedit.utilities.walkTree(b.childNodes.item(d),f)}}; svgedit.utilities.walkTreePost=function(b,f){if(b&&b.nodeType==1){for(var d=b.childNodes.length;d--;)svgedit.utilities.walkTree(b.childNodes.item(d),f);f(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){return b.getAttributeNS("http://www.w3.org/1999/xlink", -"href")};svgedit.utilities.setHref=function(b,f){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(b){b=g.getSVGContent().documentElement;var f=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var f=b.pathSegList,d=f.numberOfItems;b=[[],[]];var m=f.getItem(0), -q=[m.x,m.y];for(m=0;m0?f[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var f=b.pathSegList,d=f.numberOfItems;b=[[],[]];var k=f.getItem(0), +q=[k.x,k.y];for(k=0;k= -0){var m=d.split(":");b[m[1]]=p[m[0]]}else b[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[n]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(n){if(n.nodeType==3){n.nodeValue=n.nodeValue.replace(/^\s+|\s+$/g,"");n.nodeValue.length||n.parentNode.removeChild(n)}if(n.nodeType==1){var s=n.parentNode;if(n.ownerDocument&&s){var b=g[n.nodeName],f=c[n.nodeName];if(b!=undefined){for(var d=[],m=n.attributes.length;m--;){var q=n.attributes.item(m),B=q.nodeName, -o=q.localName,K=q.namespaceURI;if(!(f.hasOwnProperty(o)&&K==f[o]&&K!="http://www.w3.org/2000/xmlns/")&&!(K=="http://www.w3.org/2000/xmlns/"&&a[q.nodeValue])){B.indexOf("se:")==0&&d.push([B,q.nodeValue]);n.removeAttributeNS(K,o)}if(svgedit.browser.isGecko())switch(B){case "transform":case "gradientTransform":case "patternTransform":o=q.nodeValue.replace(/(\d)-/g,"$1 -");n.setAttribute(B,o)}if(B=="style"){q=q.nodeValue.split(";");for(B=q.length;B--;){o=q[B].split(":");b.indexOf(o[0])>=0&&n.setAttribute(o[0], -o[1])}n.removeAttribute("style")}}$.each(d,function(S,M){n.setAttributeNS("http://svg-edit.googlecode.com",M[0],M[1])});if((m=svgedit.utilities.getHref(n))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(n.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(n,"");n.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(n.nodeName=="use"&&!svgedit.utilities.getHref(n))s.removeChild(n);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],function(S,M){var J=n.getAttribute(M);if(J)if((J=svgedit.utilities.getUrlFromAttr(J))&&J[0]!=="#"){n.setAttribute(M,"");n.removeAttribute(M)}});for(m=n.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(n.childNodes.item(m))}}else{for(b=[];n.hasChildNodes();)b.push(s.insertBefore(n.firstChild,n));s.removeChild(n);for(m=b.length;m--;)svgedit.sanitize.sanitizeSvg(b[m])}}}}})();svgedit=svgedit||{}; +"height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],semantics:[]},c={};$.each(g,function(m,s){var b={};$.each(s,function(f,d){if(d.indexOf(":")>= +0){var k=d.split(":");b[k[1]]=p[k[0]]}else b[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[m]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(m){if(m.nodeType==3){m.nodeValue=m.nodeValue.replace(/^\s+|\s+$/g,"");m.nodeValue.length||m.parentNode.removeChild(m)}if(m.nodeType==1){var s=m.parentNode;if(m.ownerDocument&&s){var b=g[m.nodeName],f=c[m.nodeName];if(b!=undefined){for(var d=[],k=m.attributes.length;k--;){var q=m.attributes.item(k),B=q.nodeName, +o=q.localName,J=q.namespaceURI;if(!(f.hasOwnProperty(o)&&J==f[o]&&J!="http://www.w3.org/2000/xmlns/")&&!(J=="http://www.w3.org/2000/xmlns/"&&a[q.nodeValue])){B.indexOf("se:")==0&&d.push([B,q.nodeValue]);m.removeAttributeNS(J,o)}if(svgedit.browser.isGecko())switch(B){case "transform":case "gradientTransform":case "patternTransform":o=q.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(B,o)}if(B=="style"){q=q.nodeValue.split(";");for(B=q.length;B--;){o=q[B].split(":");b.indexOf(o[0])>=0&&m.setAttribute(o[0], +o[1])}m.removeAttribute("style")}}$.each(d,function(U,M){m.setAttributeNS("http://svg-edit.googlecode.com",M[0],M[1])});if((k=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(k[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))s.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", +"mask","stroke"],function(U,M){var I=m.getAttribute(M);if(I)if((I=svgedit.utilities.getUrlFromAttr(I))&&I[0]!=="#"){m.setAttribute(M,"");m.removeAttribute(M)}});for(k=m.childNodes.length;k--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(k))}}else{for(b=[];m.hasChildNodes();)b.push(s.insertBefore(m.firstChild,m));s.removeChild(m);for(k=b.length;k--;)svgedit.sanitize.sanitizeSvg(b[k])}}}}})();svgedit=svgedit||{}; (function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,p,g,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=p;this.oldParent=g;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,p){this.elem=a;this.text=p||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= @@ -133,393 +134,394 @@ function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APP this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],p=this.stack.length;p--;)for(var g=this.stack[p].elements(),c=g.length;c--;)a.indexOf(g[c])==-1&&a.push(g[c]);return a};svgedit.history.BatchCommand.prototype.addSubCommand=function(a){this.stack.push(a)};svgedit.history.BatchCommand.prototype.isEmpty=function(){return this.stack.length==0};svgedit.history.UndoManager=function(a){this.handler_=a||null;this.undoStackPointer=0;this.undoStack=[];this.undoChangeStackPointer= -1;this.undoableChangeStack=[]};svgedit.history.UndoManager.prototype.resetUndoStack=function(){this.undoStack=[];this.undoStackPointer=0};svgedit.history.UndoManager.prototype.getUndoStackSize=function(){return this.undoStackPointer};svgedit.history.UndoManager.prototype.getRedoStackSize=function(){return this.undoStack.length-this.undoStackPointer};svgedit.history.UndoManager.prototype.getNextUndoCommandText=function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText(): ""};svgedit.history.UndoManager.prototype.getNextRedoCommandText=function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}; -svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,p){for(var g=++this.undoChangeStackPointer,c=p.length,n=Array(c),s=Array(c);c--;){var b=p[c];if(b!=null){s[c]=b;n[c]=b.getAttribute(a)}}this.undoableChangeStack[g]= -{attrName:a,oldValues:n,elements:s}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,p=this.undoableChangeStack[a],g=p.elements.length,c=p.attrName,n=new svgedit.history.BatchCommand("Change "+c);g--;){var s=p.elements[g];if(s!=null){var b={};b[c]=p.oldValues[g];b[c]!=s.getAttribute(c)&&n.addSubCommand(new svgedit.history.ChangeElementCommand(s,b,c))}}this.undoableChangeStack[a]=null;return n}})();svgedit=svgedit||{}; -(function(){if(!svgedit.select)svgedit.select={};var a,p,g;svgedit.select.Selector=function(c,n){this.id=c;this.selectedElement=n;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity", -0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var n=[];c=Math.round(c/45);if(c<0)c+=8;for(var s in g.selectorGrips)n.push(s);for(;c>0;){n.push(n.shift());c--}c=0;for(s in g.selectorGrips){g.selectorGrips[s].setAttribute("style", -"cursor:"+n[c]+"-resize");c++}};svgedit.select.Selector.prototype.showGrips=function(c){g.selectorGripsGroup.setAttribute("display",c?"inline":"none");var n=this.selectedElement;this.hasGrips=c;if(n&&c){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(n))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,n=g,s=n.selectorGrips,b=this.selectedElement,f=b.getAttribute("stroke-width"),d=a.currentZoom(),m=1/d;if(b.getAttribute("stroke")!== -"none"&&!isNaN(f))m+=f/2;var q=b.tagName;if(q==="text")m+=2/d;f=svgedit.transformlist.getTransformList(b);f=svgedit.math.transformListToTransform(f).matrix;f.e*=d;f.f*=d;var B=svgedit.utilities.getBBox(b);if(q==="g"&&!$.data(b,"gsvg"))if(q=a.getStrokedBBox(b.childNodes))B=q;q=B.x;var o=B.y,K=B.width;B=B.height;m*=d;d=svgedit.math.transformBox(q*d,o*d,K*d,B*d,f);f=d.aabox;q=f.x-m;o=f.y-m;K=f.width+m*2;var S=f.height+m*2;f=q+K/2;B=o+S/2;if(b=svgedit.utilities.getRotationAngle(b)){q=a.svgRoot().createSVGTransform(); -q.setRotate(-b,f,B);q=q.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,q);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,q);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,q);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,q);q=d.tl;K=q.x;S=q.y;var M=q.x,J=q.y;q=Math.min;o=Math.max;K=q(K,q(d.tr.x,q(d.bl.x,d.br.x)))-m;S=q(S,q(d.tr.y,q(d.bl.y,d.br.y)))-m;M=o(M,o(d.tr.x,o(d.bl.x,d.br.x)))+m;J=o(J,o(d.tr.y,o(d.bl.y,d.br.y)))+m;q=K;o=S;K=M-K;S=J-S}m=a.svgRoot().suspendRedraw(100);c.setAttribute("d", -"M"+q+","+o+" L"+(q+K)+","+o+" "+(q+K)+","+(o+S)+" "+q+","+(o+S)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,f,B].join(",")+")":"");if(svgedit.browser.isTouch()){q-=15.75;o-=15.75}else{q-=4;o-=4}this.gripCoords={nw:[q,o].map(Math.round),ne:[q+K,o].map(Math.round),sw:[q,o+S].map(Math.round),se:[q+K,o+S].map(Math.round),n:[q+K/2,o].map(Math.round),w:[q,o+S/2].map(Math.round),e:[q+K,o+S/2].map(Math.round),s:[q+K/2,o+S].map(Math.round)};for(var Q in this.gripCoords){c=this.gripCoords[Q]; -s[Q].setAttribute("x",c[0]);s[Q].setAttribute("y",c[1])}this.rotateCoords={nw:[q,o],ne:[q+K+8,o],sw:[q,o+S+8],se:[q+K+8,o+S+8]};for(Q in this.rotateCoords){c=this.rotateCoords[Q];n.rotateGrips[Q].setAttribute("cx",c[0]);n.rotateGrips[Q].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null}; +svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,p){for(var g=++this.undoChangeStackPointer,c=p.length,m=Array(c),s=Array(c);c--;){var b=p[c];if(b!=null){s[c]=b;m[c]=b.getAttribute(a)}}this.undoableChangeStack[g]= +{attrName:a,oldValues:m,elements:s}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,p=this.undoableChangeStack[a],g=p.elements.length,c=p.attrName,m=new svgedit.history.BatchCommand("Change "+c);g--;){var s=p.elements[g];if(s!=null){var b={};b[c]=p.oldValues[g];b[c]!=s.getAttribute(c)&&m.addSubCommand(new svgedit.history.ChangeElementCommand(s,b,c))}}this.undoableChangeStack[a]=null;return m}})();svgedit=svgedit||{}; +(function(){if(!svgedit.select)svgedit.select={};var a,p,g;svgedit.select.Selector=function(c,m){this.id=c;this.selectedElement=m;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity", +0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var m=[];c=Math.round(c/45);if(c<0)c+=8;for(var s in g.selectorGrips)m.push(s);for(;c>0;){m.push(m.shift());c--}c=0;for(s in g.selectorGrips){g.selectorGrips[s].setAttribute("style", +"cursor:"+m[c]+"-resize");c++}};svgedit.select.Selector.prototype.showGrips=function(c){g.selectorGripsGroup.setAttribute("display",c?"inline":"none");var m=this.selectedElement;this.hasGrips=c;if(m&&c){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(m))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,m=g,s=m.selectorGrips,b=this.selectedElement,f=b.getAttribute("stroke-width"),d=a.currentZoom(),k=1/d;if(b.getAttribute("stroke")!== +"none"&&!isNaN(f))k+=f/2;var q=b.tagName;if(q==="text")k+=2/d;f=svgedit.transformlist.getTransformList(b);f=svgedit.math.transformListToTransform(f).matrix;f.e*=d;f.f*=d;var B=svgedit.utilities.getBBox(b);if(q==="g"&&!$.data(b,"gsvg"))if(q=a.getStrokedBBox(b.childNodes))B=q;q=B.x;var o=B.y,J=B.width;B=B.height;k*=d;d=svgedit.math.transformBox(q*d,o*d,J*d,B*d,f);f=d.aabox;q=f.x-k;o=f.y-k;J=f.width+k*2;var U=f.height+k*2;f=q+J/2;B=o+U/2;if(b=svgedit.utilities.getRotationAngle(b)){q=a.svgRoot().createSVGTransform(); +q.setRotate(-b,f,B);q=q.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,q);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,q);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,q);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,q);q=d.tl;J=q.x;U=q.y;var M=q.x,I=q.y;q=Math.min;o=Math.max;J=q(J,q(d.tr.x,q(d.bl.x,d.br.x)))-k;U=q(U,q(d.tr.y,q(d.bl.y,d.br.y)))-k;M=o(M,o(d.tr.x,o(d.bl.x,d.br.x)))+k;I=o(I,o(d.tr.y,o(d.bl.y,d.br.y)))+k;q=J;o=U;J=M-J;U=I-U}k=a.svgRoot().suspendRedraw(100);c.setAttribute("d", +"M"+q+","+o+" L"+(q+J)+","+o+" "+(q+J)+","+(o+U)+" "+q+","+(o+U)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,f,B].join(",")+")":"");if(svgedit.browser.isTouch()){q-=15.75;o-=15.75}else{q-=4;o-=4}this.gripCoords={nw:[q,o].map(Math.round),ne:[q+J,o].map(Math.round),sw:[q,o+U].map(Math.round),se:[q+J,o+U].map(Math.round),n:[q+J/2,o].map(Math.round),w:[q,o+U/2].map(Math.round),e:[q+J,o+U/2].map(Math.round),s:[q+J/2,o+U].map(Math.round)};for(var S in this.gripCoords){c=this.gripCoords[S]; +s[S].setAttribute("x",c[0]);s[S].setAttribute("y",c[1])}this.rotateCoords={nw:[q,o],ne:[q+J+8,o],sw:[q,o+U+8],se:[q+J+8,o+U+8]};for(S in this.rotateCoords){c=this.rotateCoords[S];m.rotateGrips[S].setAttribute("cx",c[0]);m.rotateGrips[S].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(k)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null}; this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup); -a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var n=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+p.imgPath+"rotate.png) 12 12, auto;"}});$.data(n,"dir",c);$.data(n,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(n)}for(c in this.selectorGrips){n=a.createSVGElement({element:"rect", -attr:{id:"selectorGrip_resize_"+c,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+c+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){n.setAttribute("width",30.5);n.setAttribute("height",30.5);n.setAttribute("fill-opacity",0.3)}$.data(n,"dir",c);$.data(n,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(n)}if(!$("#canvasBackground").length){c=p.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground", -width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});n=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var s=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),b=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),f=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}), -d=a.createSVGElement({element:"rect",attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),m=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});c.appendChild(n);n.appendChild(s);s.appendChild(b);s.appendChild(f);s.appendChild(d);c.appendChild(m);a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var n=this.selectors.length; -if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var s=0;s element";this.svgElem_=c;this.obj_num=0;this.idPrefix=n||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= +a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var m=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+p.imgPath+"rotate.png) 12 12, auto;"}});$.data(m,"dir",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect", +attr:{id:"selectorGrip_resize_"+c,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+c+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){m.setAttribute("width",30.5);m.setAttribute("height",30.5);m.setAttribute("fill-opacity",0.3)}$.data(m,"dir",c);$.data(m,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=p.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground", +width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});m=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var s=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),b=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),f=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}), +d=a.createSVGElement({element:"rect",attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),k=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});c.appendChild(m);m.appendChild(s);s.appendChild(b);s.appendChild(f);s.appendChild(d);c.appendChild(k);a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var m=this.selectors.length; +if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var s=0;s element";this.svgElem_=c;this.obj_num=0;this.idPrefix=m||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= "";var s=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(s&&g!=p.NEVER_RANDOMIZE)this.nonce_=s;else g==p.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(c){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+c):$(this.svgElem_).find("[id="+c+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_}; svgedit.draw.Drawing.prototype.setNonce=function(c){this.svgElem_.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:se","http://svg-edit.googlecode.com");this.svgElem_.setAttributeNS("http://svg-edit.googlecode.com","se:nonce",c);this.nonce_=c};svgedit.draw.Drawing.prototype.clearNonce=function(){this.nonce_=""};svgedit.draw.Drawing.prototype.getId=function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num};svgedit.draw.Drawing.prototype.getNextId=function(){var c= -this.obj_num,n=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();n=true}else this.obj_num++;for(var s=this.getId();this.getElem_(s);){if(n){this.obj_num=c;n=false}this.obj_num++;s=this.getId()}if(n)this.obj_num=c;return s};svgedit.draw.Drawing.prototype.releaseId=function(c){var n=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof c!="string"||c.indexOf(n)!=0)return false;c=parseInt(c.substr(n.length));if(typeof c!="number"||c<=0||this.releasedNums.indexOf(c)!=-1)return false; -this.releasedNums.push(c);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(c){for(var n=0;n=0&&c1){var c=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return c}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var c=this.svgElem_.childNodes.length,n=[],s=[],b=null,f=false,d=0;d0||!f){for(d=1;s.indexOf("Layer "+d)>=0;)d++;s="Layer "+d;b=c.createElementNS("http://www.w3.org/2000/svg","g");f=c.createElementNS("http://www.w3.org/2000/svg","title");f.textContent=s; -b.appendChild(f);for(f=0;f1))for(var s=0;s0){f=S element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f= -this.elem.pathSegList,d=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var m=0;m=d?null:f[m+1],K=m-1<0?null:f[m-1];if(B.type===2){if(K&&K.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip()}q=m}else if(o&&o.type===1){B.next=f[q+1];B.next.prev=B;B.mate=f[q];B.addGrip();if(this.first_seg==null)this.first_seg=B}else if(o){if(B.type!== -1){B.addGrip();if(o&&o.type!==2){B.next=o;B.next.prev=B}}}else if(B.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip();B.addGrip();if(!this.first_seg)this.first_seg=f[q]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var d=this.segs.length,m=0;m0){this.obj_num=this.releasedNums.pop();m=true}else this.obj_num++;for(var s=this.getId();this.getElem_(s);){if(m){this.obj_num=c;m=false}this.obj_num++;s=this.getId()}if(m)this.obj_num=c;return s};svgedit.draw.Drawing.prototype.releaseId=function(c){var m=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof c!="string"||c.indexOf(m)!=0)return false;c=parseInt(c.substr(m.length));if(typeof c!="number"||c<=0||this.releasedNums.indexOf(c)!=-1)return false; +this.releasedNums.push(c);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(c){for(var m=0;m=0&&c1){var c=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return c}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var c=this.svgElem_.childNodes.length,m=[],s=[],b=null,f=false,d=0;d0||!f){for(d=1;s.indexOf("Layer "+d)>=0;)d++;s="Layer "+d;b=c.createElementNS("http://www.w3.org/2000/svg","g");f=c.createElementNS("http://www.w3.org/2000/svg","title");f.textContent=s; +b.appendChild(f);for(f=0;f1))for(var s=0;s0){f=U element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f=this.elem.pathSegList,d=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var k=0;k=d?null:f[k+1],J=k-1<0?null:f[k-1];if(B.type===2){if(J&&J.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip()}q=k}else if(o&&o.type===1){B.next=f[q+1];B.next.prev=B;B.mate=f[q];B.addGrip();if(this.first_seg==null)this.first_seg=B}else if(o){if(B.type!==1){B.addGrip();if(o&&o.type!==2){B.next=o;B.next.prev=B}}}else if(B.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip();B.addGrip();if(!this.first_seg)this.first_seg= +f[q]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var d=this.segs.length,k=0;k').documentElement, -true);a.appendChild(d);var m=f.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;m.firstChild;)m.removeChild(m.firstChild);$(m).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:n.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(e)})();var q="svg_";b.setIdPrefix= -function(e){q=e};b.current_drawing_=new svgedit.draw.Drawing(m,q);var B=b.getCurrentDrawing=function(){return b.current_drawing_},o=1,K=null,S={shape:{fill:(n.initFill.color=="none"?"":"#")+n.initFill.color,fill_paint:null,fill_opacity:n.initFill.opacity,stroke:"#"+n.initStroke.color,stroke_paint:null,stroke_opacity:n.initStroke.opacity,stroke_width:n.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:n.initOpacity}};S.text=$.extend(true,{},S.shape);$.extend(S.text, -{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=S.shape,J=Array(1),Q=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=B().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(c,e.element);if(l)(K||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin, +$.SvgCanvas=function(a,p){function g(e,h){for(var l=svgedit.utilities.getBBox(e),z=0;z<2;z++){var v=z===0?"fill":"stroke",G=e.getAttribute(v);if(G&&G.indexOf("url(")===0){G=T(G);if(G.tagName==="linearGradient"){var A=G.getAttribute("x1")||0,u=G.getAttribute("y1")||0,F=G.getAttribute("x2")||1,H=G.getAttribute("y2")||0;A=l.width*A+l.x;u=l.height*u+l.y;F=l.width*F+l.x;H=l.height*H+l.y;A=P(A,u,h);H=P(F,H,h);F={};F.x1=(A.x-l.x)/l.width;F.y1=(A.y-l.y)/l.height;F.x2=(H.x-l.x)/l.width;F.y2=(H.y-l.y)/l.height; +G=G.cloneNode(true);$(G).attr(F);G.id=ja();mb().appendChild(G);e.setAttribute(v,"url(#"+G.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};p&&$.extend(m,p);var s=m.dimensions,b=this,f=a.ownerDocument,d=f.importNode(svgedit.utilities.text2xml('').documentElement, +true);a.appendChild(d);var k=f.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;k.firstChild;)k.removeChild(k.firstChild);$(k).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:m.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");k.appendChild(e)})();var q="svg_";b.setIdPrefix= +function(e){q=e};b.current_drawing_=new svgedit.draw.Drawing(k,q);var B=b.getCurrentDrawing=function(){return b.current_drawing_},o=1,J=null,U={shape:{fill:(m.initFill.color=="none"?"":"#")+m.initFill.color,fill_paint:null,fill_opacity:m.initFill.opacity,stroke:"#"+m.initStroke.color,stroke_paint:null,stroke_opacity:m.initStroke.opacity,stroke_width:m.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:m.initOpacity}};U.text=$.extend(true,{},U.shape);$.extend(U.text, +{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=U.shape,I=Array(1),S=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=B().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(c,e.element);if(l)(J||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin, "stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},Y=b.getTransformList=svgedit.transformlist.getTransformList,P=svgedit.math.transformPoint,ia=b.matrixMultiply=svgedit.math.matrixMultiply,qa=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ga=b.transformListToTransform=svgedit.math.transformListToTransform, -U=svgedit.math.snapToAngle,ba=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return n.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/o},getWidth:function(){return m.getAttribute("width")/o},getRoundDigits:function(){return fb.round_digits}});var xa=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return J}, -getSVGContent:function(){return m}});var ka=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,da=b.getHref=svgedit.utilities.getHref,W=b.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var oa=b.getRotationAngle=svgedit.utilities.getRotationAngle,pa=b.getElem=svgedit.utilities.getElem,na=b.assignAttributes=svgedit.utilities.assignAttributes,ma=this.cleanupElement=svgedit.utilities.cleanupElement,za=svgedit.sanitize.getNSMap(),Ha=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, -Fa=svgedit.history.MoveElementCommand,Ia=svgedit.history.InsertElementCommand,La=svgedit.history.RemoveElementCommand,Ka=svgedit.history.ChangeElementCommand,Ea=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,h){var l=svgedit.history.HistoryEventTypes;if(e==l.BEFORE_UNAPPLY||e==l.BEFORE_APPLY)b.clearSelection();else if(e==l.AFTER_APPLY||e==l.AFTER_UNAPPLY){var z=h.elements();b.pathActions.clear();N("changed",z);z=h.type();l=e==l.AFTER_APPLY;if(z== -Fa.type()){l=l?h.newParent:h.oldParent;l==m&&b.identifyLayers()}else if(z==Ia.type()||z==La.type()){h.parent==m&&b.identifyLayers();if(z==Ia.type())l&&Qa(h.elem);else l||Qa(h.elem);h.elem.tagName==="use"&&Kb(h.elem)}else if(z==Ka.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==m&&b.identifyLayers();l=l?h.newValues:h.oldValues;l.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,l.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){z=h.elem;if(!z.getAttribute("x")&&!z.getAttribute("y")){l= -z.parentNode;var w=z.nextSibling;l.removeChild(z);l.insertBefore(z,w)}}}}}});var ya=function(e){b.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return b.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return m},currentZoom:function(){return o},getStrokedBBox:function(e){return b.getStrokedBBox([e])}});var Ca=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return o},getSVGRoot:function(){return d}}); -svgedit.utilities.snapToGrid=function(e){var h=n.snappingStep,l=n.baseUnit;if(l!=="px")h*=svgedit.units.getTypeMap()[l];return e=Math.round(e/h)*h};var wa=svgedit.utilities.snapToGrid,Va={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear",exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},yb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ib=$.data, -Qa=function(e){var h=$(e).attr(yb),l;for(l in h){var z=h[l];if(z&&z.indexOf("url(")===0){z=ka(z).substr(1);if(!pa(z)){mb().appendChild(vb[z]);delete vb[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(l=e.length;h=0)D=G=b.convertToPath(I,true);else if(I.tagName=="rect"){var L=I.getAttribute("rx"),k=I.getAttribute("ry");if(L||k)D=G=b.convertToPath(I,true)}if(!G){var u=I.cloneNode(true),C=document.createElementNS(c,"g"),F=I.parentNode;F.appendChild(C);C.appendChild(u);D=svgedit.utilities.bboxToObj(C.getBBox());F.removeChild(C)}}return D}catch(O){console.log(I,O);return null}},l;$.each(e,function(){if(!l)if(this.parentNode)l=h(this)}); -if(l==null)return null;var z=l.x+l.width,w=l.y+l.height,H=l.x,A=l.y,v=function(I){var D=I.getAttribute("stroke-width"),G=0;if(I.getAttribute("stroke")!="none"&&!isNaN(D))G+=D/2;return G},E=[];$.each(e,function(I,D){var G=h(D);if(G){var L=v(D);H=Math.min(H,G.x-L);A=Math.min(A,G.y-L);E.push(G)}});l.x=H;l.y=A;$.each(e,function(I,D){var G=E[I];if(G&&D.nodeType==1){var L=v(D);z=Math.max(z,G.x+G.width+L);w=Math.max(w,G.y+G.height+L)}});l.width=z-H;l.height=w-A;return l};var pb=this.getVisibleElements=function(e){e|| -(e=$(m).children());e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(l,z){try{z.getBBox()&&h.push(z)}catch(w){}});return h.reverse()},Ab=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(m).children());var h=[];$(e).children().each(function(l,z){try{z.getBBox()&&h.push({elem:z,bbox:getStrokedBBox([z])})}catch(w){}});return h.reverse()},Bb=this.groupSvgElem=function(e){var h=document.createElementNS(c,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg", -e)[0].id=la()},ja=function(e){var h=document.createElementNS(e.namespaceURI,e.nodeName);h.removeAttribute("id");$.each(e.attributes,function(z,w){w.localName!="-moz-math-font-style"&&h.setAttributeNS(w.namespaceURI,w.nodeName,w.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var l=Ja.convertPath(e);h.setAttribute("d",l)}$.each(e.childNodes,function(z,w){switch(w.nodeType){case 1:h.appendChild(ja(w));break;case 3:h.textContent=w.nodeValue}});if($(e).data("gsvg"))$(h).data("gsvg",h.firstChild); -else if($(e).data("symbol")){e=$(e).data("symbol");$(h).data("ref",e).data("symbol",e)}else h.tagName=="image"&&Ib(h);h.id=la();return h},ca,la,N;(function(e){var h={};ca=e.getId=function(){return B().getId()};la=e.getNextId=function(){return B().getNextId()};N=e.call=function(l,z){if(h[l])return h[l](this,z)};e.bind=function(l,z){var w=h[l];h[l]=z;return w}})(b);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(c,"path");for(var h=0,l=e.length;h -0&&w.getItem(0).type==4&&w.removeItem(0);if(e!=0){H=P(H,A,ga(w).matrix);A=d.createSVGTransform();A.setRotate(e,H.x,H.y);w.numberOfItems?w.insertItemBefore(A,0):w.appendItem(A)}else w.numberOfItems==0&&l.removeAttribute("transform");if(!h){w=l.getAttribute("transform");l.setAttribute("transform",z);hb("transform",w,J);N("changed",J)}pa("pathpointgrip_container");l=Ca.requestSelector(J[0]);l.resize();l.updateGripCursors(e)};var Ga=this.recalculateAllSelectedDimensions=function(){for(var e=new Ea(jb== -"none"?"position":"size"),h=J.length;h--;){var l=Wa(J[h]);l&&e.addSubCommand(l)}if(!e.isEmpty()){ya(e);N("changed",J)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Xa=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},bb=this.remapElement=function(e,h,l){var z=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",w=function(){if(z)for(var G in h)h[G]=wa(h[G]);na(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var H=0;H<2;H++){var A=H===0?"fill":"stroke", -v=e.getAttribute(A);if(v&&v.indexOf("url(")===0)if(l.a<0||l.d<0){v=R(v).cloneNode(true);if(l.a<0){var E=v.getAttribute("x1"),I=v.getAttribute("x2");v.setAttribute("x1",-(E-1));v.setAttribute("x2",-(I-1))}if(l.d<0){E=v.getAttribute("y1");I=v.getAttribute("y2");v.setAttribute("y1",-(E-1));v.setAttribute("y2",-(I-1))}v.id=la();mb().appendChild(v);e.setAttribute(A,"url(#"+v.id+")")}}H=e.tagName;if(H==="g"||H==="text"||H==="use")if(l.a==1&&l.b==0&&l.c==0&&l.d==1&&(l.e!=0||l.f!=0)){A=ga(e).matrix;A=ia(A.inverse(), -l,A);h.x=parseFloat(h.x)+A.e;h.y=parseFloat(h.y)+A.f}else{A=Y(e);v=d.createSVGTransform();v.setMatrix(ia(ga(A).matrix,l));A.clear();A.appendItem(v)}switch(H){case "foreignObject":case "rect":case "image":if(H==="image"&&(l.a<0||l.d<0)){A=Y(e);v=d.createSVGTransform();v.setMatrix(ia(ga(A).matrix,l));A.clear();A.appendItem(v)}else{A=P(h.x,h.y,l);h.width=l.a*h.width;h.height=l.d*h.height;h.x=A.x+Math.min(0,h.width);h.y=A.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}w(); -break;case "ellipse":H=P(h.cx,h.cy,l);h.cx=H.x;h.cy=H.y;h.rx=l.a*h.rx;h.ry=l.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);w();break;case "circle":H=P(h.cx,h.cy,l);h.cx=H.x;h.cy=H.y;H=svgedit.math.transformBox(box.x,box.y,box.width,box.height,l);h.r=Math.min((H.tr.x-H.tl.x)/2,(H.bl.y-H.tl.y)/2);if(h.r)h.r=Math.abs(h.r);w();break;case "line":A=P(h.x1,h.y1,l);E=P(h.x2,h.y2,l);h.x1=A.x;h.y1=A.y;h.x2=E.x;h.y2=E.y;case "text":l=e.querySelectorAll("tspan");for(H=l.length;H--;){A=xa("x",e.getAttribute("x")); -v=xa("x",l[H].getAttribute("x"));E=xa("y",e.getAttribute("y"));I=xa("y",l[H].getAttribute("y"));var D={};if(!isNaN(A)&&!isNaN(v)&&A!=0&&v!=0&&h.x)D.x=h.x-(A-v);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&h.y)D.y=h.y-(E-I);if(D.x||D.y)na(l[H],D,1E3,true)}w();break;case "use":w();break;case "g":(w=$(e).data("gsvg"))&&na(w,h,1E3,true);break;case "polyline":case "polygon":w=h.points.length;for(H=0;H0){for(var l=h.numberOfItems;l--;){var z=h.getItem(l);if(z.type===0)h.removeItem(l);else if(z.type=== -1)svgedit.math.isIdentity(z.matrix)&&h.removeItem(l);else z.type===4&&z.angle===0&&h.removeItem(l)}if(h.numberOfItems===1&&oa(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){l=h.numberOfItems;for(var w=[];l--;){z=h.getItem(l);if(z.type===1)w.push([z.matrix,l]);else if(w.length)w=[]}if(w.length===2){l=d.createSVGTransformFromMatrix(ia(w[1][0],w[0][0]));h.removeItem(w[0][1]);h.removeItem(w[1][1]);h.insertItemBefore(l,w[1][1])}l=h.numberOfItems;if(l>=2&&h.getItem(l- -2).type===1&&h.getItem(l-1).type===2){w=d.createSVGTransform();z=ia(h.getItem(l-2).matrix,h.getItem(l-1).matrix);w.setMatrix(z);h.removeItem(l-2);h.removeItem(l-2);h.appendItem(w)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var H=$(e).data("gsvg");l=new Ea("Transform");var A={},v=null;z=[];switch(e.tagName){case "line":z=["x1","y1", -"x2","y2"];break;case "circle":z=["cx","cy","r"];break;case "ellipse":z=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":z=["width","height","x","y"];break;case "use":case "text":case "tspan":z=["x","y"];break;case "polygon":case "polyline":v={};v.points=e.getAttribute("points");w=e.points;var E=w.numberOfItems;A.points=Array(E);for(var I=0;I1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&h.getItem(k-2).type==3&&h.getItem(k-3).type==2&&h.getItem(k-1).type==2){I=3;var C=h.getItem(k-3).matrix,F=h.getItem(k-2).matrix,O=h.getItem(k-1).matrix;E=e.childNodes;for(D=E.length;D--;){var V=E.item(D);z=H=0;if(V.nodeType==1){var T=Y(V);if(T){z=ga(T).matrix;H=oa(V);var X=Ta,aa=[];Ta=V.getAttribute("transform");if(H||qa(T)){var fa= -d.createSVGTransform();fa.setMatrix(ia(C,F,O,z));T.clear();T.appendItem(fa);aa.push(fa)}else{H=ia(z.inverse(),O,z);fa=d.createSVGMatrix();fa.e=-H.e;fa.f=-H.f;z=ia(fa.inverse(),z.inverse(),C,F,O,z,H.inverse());var ra=d.createSVGTransform(),Pa=d.createSVGTransform(),Da=d.createSVGTransform();ra.setTranslate(H.e,H.f);Pa.setScale(z.a,z.d);Da.setTranslate(fa.e,fa.f);T.appendItem(Da);T.appendItem(Pa);T.appendItem(ra);aa.push(Da);aa.push(Pa);aa.push(ra)}l.addSubCommand(Wa(V));Ta=X}}}h.removeItem(k-1);h.removeItem(k- -2);h.removeItem(k-3)}else if(k>=3&&h.getItem(k-1).type==1){I=3;z=ga(h).matrix;fa=d.createSVGTransform();fa.setMatrix(z);h.clear();h.appendItem(fa)}else if((k==1||k>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){I=2;H=ga(h).matrix;h.removeItem(0);z=ga(h).matrix.inverse();z=ia(z,H);H=z.e;z=z.f;if(H!=0||z!=0){E=e.childNodes;D=E.length;for(k=[];D--;){V=E.item(D);if(V.nodeType==1){if(V.getAttribute("clip-path")){X=V.getAttribute("clip-path");if(k.indexOf(X)===-1){rb(X,H,z);k.push(X)}}X=Ta;Ta=V.getAttribute("transform"); -if(T=Y(V)){C=d.createSVGTransform();C.setTranslate(H,z);T.numberOfItems?T.insertItemBefore(C,0):T.appendItem(C);l.addSubCommand(Wa(V));T=e.getElementsByTagNameNS(c,"use");V="#"+V.id;for(C=T.length;C--;){F=T.item(C);if(V==da(F)){O=d.createSVGTransform();O.setTranslate(-H,-z);Y(F).insertItemBefore(O,0);l.addSubCommand(Wa(F))}}Ta=X}}}k=[];Ta=X}}else if(k==1&&h.getItem(0).type==1&&!w){I=1;z=h.getItem(0).matrix;E=e.childNodes;for(D=E.length;D--;){V=E.item(D);if(V.nodeType==1){X=Ta;Ta=V.getAttribute("transform"); -if(T=Y(V)){H=ia(z,ga(T).matrix);k=d.createSVGTransform();k.setMatrix(H);T.clear();T.appendItem(k,0);l.addSubCommand(Wa(V));Ta=X;X=V.getAttribute("stroke-width");V.getAttribute("stroke")!=="none"&&!isNaN(X)&&V.setAttribute("stroke-width",X*((Math.abs(H.a)+Math.abs(H.d))/2))}}}h.clear()}else{if(w){G=d.createSVGTransform();G.setRotate(w,L.x,L.y);h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(w){L={x:G.x+u.e,y:G.y+u.f}; -G=d.createSVGTransform();G.setRotate(w,L.x,L.y);h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}}else if(I==3){z=ga(h).matrix;u=d.createSVGTransform();u.setRotate(w,G.x,G.y);u=u.matrix;G=d.createSVGTransform();G.setRotate(w,L.x,L.y);L=G.matrix.inverse();X=z.inverse();L=ia(X,L,u,z);H=L.e;z=L.f;if(H!=0||z!=0){E=e.childNodes;for(D=E.length;D--;){V=E.item(D);if(V.nodeType==1){X=Ta;Ta=V.getAttribute("transform");T=Y(V);C=d.createSVGTransform();C.setTranslate(H,z);T.numberOfItems?T.insertItemBefore(C, -0):T.appendItem(C);l.addSubCommand(Wa(V));Ta=X}}}if(w)h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}}else{w=svgedit.utilities.getBBox(e);if(!w&&e.tagName!="path")return null;z=d.createSVGMatrix();if(H=oa(e)){G={x:w.x+w.width/2,y:w.y+w.height/2};L=P(w.x+w.width/2,w.y+w.height/2,ga(h).matrix);I=H*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&h.getItem(k-2).type==3&&h.getItem(k-3).type==2&&h.getItem(k-1).type==2){I=3;z=ga(h,k-3,k-1).matrix;h.removeItem(k-1);h.removeItem(k-2);h.removeItem(k-3)}else if(k== -4&&h.getItem(k-1).type==1){I=3;z=ga(h).matrix;fa=d.createSVGTransform();fa.setMatrix(z);h.clear();h.appendItem(fa);z=d.createSVGMatrix()}else if((k==1||k>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){I=2;u=h.getItem(0).matrix;X=ga(h,1).matrix;w=X.inverse();z=ia(w,u,X);h.removeItem(0)}else if(k==1&&h.getItem(0).type==1&&!H){z=ga(h).matrix;switch(e.tagName){case "line":A=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":A.points=e.getAttribute("points");if(A.points){w=e.points;E=w.numberOfItems; -A.points=Array(E);for(I=0;I1&&w.showGrips(false)}}}N("selected",J);h||J.length==1?Ca.requestSelector(J[0]).showGrips(true):Ca.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)}},Cb=this.selectOnly=function(e,h){Ra(true);ub(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 l=0;l=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,m,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ca.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,l=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 E=v.button===2;qb=m.getScreenCTM().inverse();var I=P(v.pageX,v.pageY,qb),D=I.x*o;I=I.y*o;v.preventDefault();if(E)Ba="select";D=D/o;I=I/o;var G=ob(v);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=D,k=w=l=I;if(n.gridSnapping){D=wa(D);I=wa(I);h=wa(h);l=wa(l)}if(G==Ca.selectorParentGroup&&J[0]!=null){G=v.target;var u=ib(G,"type"); -if(u=="rotate"){Ba="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ba="resize";jb=ib(G,"dir")}G=J[0]}Ta=G.getAttribute("transform");u=Y(G);switch(Ba){case "select":Ma=true;jb="none";if(E)Ma=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Ra(true);ub([G]);zb=G;Ja.clear()}if(!E)for(E=0;E1))if(Ma)if(!(v.button===1||b.spaceKey)){var E=J[0],I=P(v.pageX,v.pageY, -qb),D=I.x*o;I=I.y*o;var G=pa(ca()),L=x=D/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ba){case "select":if(J[0]!==null){L=x-h;var u=y-l;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=U(h,l,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k0&&b.removeFromSelection(G);L.length>0&&ub(L); -break;case "resize":G=Y(E);L=(F=qa(G))?H:svgedit.utilities.getBBox(E);C=L.x;k=L.y;var O=L.width,V=L.height;L=x-h;u=y-l;if(n.gridSnapping){L=wa(L);u=wa(u);V=wa(V);O=wa(O)}var T=oa(E);if(T){var X=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-T*Math.PI/180;L=X*Math.cos(u);u=X*Math.sin(u)}if(jb.indexOf("n")==-1&&jb.indexOf("s")==-1)u=0;if(jb.indexOf("e")==-1&&jb.indexOf("w")==-1)L=0;var aa=X=0,fa=V?(V+u)/V:1,ra=O?(O+L)/O:1;if(jb.indexOf("n")>=0){fa=V?(V-u)/V:1;aa=V}if(jb.indexOf("w")>=0){ra=O?(O-L)/O:1;X=O}L= -d.createSVGTransform();u=d.createSVGTransform();O=d.createSVGTransform();if(n.gridSnapping){C=wa(C);X=wa(X);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+X),-(k+aa));if(v.shiftKey)if(ra==1)ra=fa;else fa=ra;u.setScale(ra,fa);O.setTranslate(C+X,k+aa);if(F){F=T?1:0;G.replaceItem(L,2+F);G.replaceItem(u,1+F);G.replaceItem(O,0+F)}else{F=G.numberOfItems;G.replaceItem(O,F-3);G.replaceItem(u,F-2);G.replaceItem(L,F-1)}Ca.requestSelector(E).resize();N("transition",J);break;case "zoom":L*=o;k*=o;na(sa,{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":na(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)}F=x;C=y;if(v.shiftKey){C=U(h,l,F,C);F=C.x;C=C.y}G.setAttributeNS(null,"x2",F);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);F=Math.abs(y-l);if(Ba=="square"||v.shiftKey){L=F=Math.max(L,F);C=hl?l+k:l-k}if(v.altKey){F=h;C=l;k=Math.abs(x-F);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);G.setAttributeNS(null,"cx",F);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,"points",e);break; -case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);l=wa(l)}if(v.shiftKey){if(F=svgedit.path.path){G=F.dragging?F.dragging[0]:h;F=F.dragging?F.dragging[1]:l}else{G=h;F=l}C=U(G,F,x,y);x=C.x;y=C.y}if(sa&&sa.getAttribute("display")!=="none"){L*=o;k*=o;na(sa,{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;eb.mouseMove(D,I);break;case "rotate":L=svgedit.utilities.getBBox(E);F=L.x+L.width/ -2;C=L.y+L.height/2;G=ba(E);G=P(F,C,G);F=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,F-G)*(180/Math.PI)-90)%360;T=(Math.atan2(C-y,F-x)*(180/Math.PI)-90)%360;T+=compensation_angle;if(n.gridSnapping)T=wa(T);if(v.shiftKey)T=Math.round(T/45)*45;b.setRotationAngle(T<-180?360+T:T,true);N("transition",J)}nb("mouseMove",{event:v,mouse_x:D,mouse_y:I, -selected:E})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var E=v.target.parentNode;if(E!==K){var I=ob(v),D=I.tagName;if(D==="text"&&Ba!=="textedit"){v=P(v.pageX,v.pageY,qb);eb.select(I,v.x,v.y)}if((D==="g"||D==="a")&&oa(I)){Lb(I);I=J[0];Ra(true)}K&&Jb();E.tagName!=="g"&&E.tagName!=="a"||E===B().getCurrentLayer()||I===Ca.selectorParentGroup||Rb(I)}}).mouseup(function(v){b.addClone=false;window.removeEventListener("keyup",b.removeClone);if(v.button!==2){var E=zb;zb=null; -if(Ma){var I=P(v.pageX,v.pageY,qb),D=I.x*o;I=I.y*o;var G=D/o,L=I/o,k=pa(ca()),u=false;Ma=false;switch(Ba){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");lb=[]}Ba="select";case "select":if(J[0]!=null){if(J[1]==null){D=J[0];switch(D.tagName){case "g":case "use":case "image":case "foreignObject":break;default:cb.fill=D.getAttribute("fill");cb.fill_opacity=D.getAttribute("fill-opacity");cb.stroke=D.getAttribute("stroke");cb.stroke_opacity=D.getAttribute("stroke-opacity"); -cb.stroke_width=D.getAttribute("stroke-width");cb.stroke_dasharray=D.getAttribute("stroke-dasharray");cb.stroke_linejoin=D.getAttribute("stroke-linejoin");cb.stroke_linecap=D.getAttribute("stroke-linecap")}if(D.tagName=="text"){Za.font_size=D.getAttribute("font-size");Za.font_family=D.getAttribute("font-family")}Ca.requestSelector(D).showGrips(true)}Ga();if(G!=z||L!=w){v=J.length;for(D=0;D=0?E.indexOf(",", -G+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":E=$(k).attr(["x1","x2","y1","y2"]);u=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(k).attr(["width","height"]);u=E.width!=0||E.height!=0||Ba==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":E=$(k).attr(["rx","ry"]);u=E.rx!=null||E.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=Q({element:"ellipse",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()}});N("changed",[k]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=Q({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});N("changed",[k]);u=true}break;case "text":u=true;Cb([k]);eb.start(k);break;case "path":k=null;Ma=true;E=Ja.mouseUp(v,k,D,I);k=E.element;u=E.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v);break;case "textedit":u= -false;k=null;eb.mouseUp(v,D,I);break;case "rotate":u=true;k=null;Ba="select";E=b.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Ga();N("changed",J)}D=nb("mouseUp",{event:v,mouse_x:D,mouse_y:I},true);$.each(D,function(O,V){if(V){u=V.keep||u;k=V.element;Ma=V.started||Ma}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(D=v.target;D.parentNode.parentNode.tagName=="g";)D=D.parentNode;if((Ba!="path"||!drawn_path)&&D.parentNode.id!="selectorParentGroup"&&D.id!="svgcanvas"&& -D.id!="svgroot"){b.setMode("select");Cb([D],true)}}else if(k!=null){b.addedNew=true;v=0.2;var C;if(false.beginElement&&k.getAttribute("opacity")!=M.opacity){C=$(false).clone().attr({to:M.opacity,dur:v}).appendTo(k);try{C[0].beginElement()}catch(F){}}else v=0;setTimeout(function(){C&&C.remove();k.setAttribute("opacity",M.opacity);k.setAttribute("style","pointer-events:inherit");ma(k);if(Ba==="path")Ja.toEditMode(k);else n.selectNew&&Cb([k],true);ya(new Ia(k));N("changed",[k])},v*1E3)}Ta=null}}});$(a).bind("mousewheel DOMMouseScroll", -function(v){if(v.shiftKey){v.preventDefault();qb=m.getScreenCTM().inverse();var E=P(v.pageX,v.pageY,qb);E={x:E.x,y:E.y,width:0,height:0};if(v.wheelDelta)if(v.wheelDelta>=120)E.factor=2;else{if(v.wheelDelta<=-120)E.factor=0.5}else if(v.detail)if(v.detail>0)E.factor=0.5;else if(v.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Ib=function(e){$(e).click(function(h){h.preventDefault()})},eb=b.textActions=function(){function e(T){var X=I.value==="";$(I).focus();if(!arguments.length)if(X)T=0;else{if(I.selectionEnd!== -I.selectionStart)return;T=I.selectionEnd}var aa;aa=k[T];X||I.setSelectionRange(T,T);D=pa("text_cursor");if(!D){D=document.createElementNS(c,"line");na(D,{id:"text_cursor",stroke:"#333","stroke-width":1});D=pa("selectorParentGroup").appendChild(D)}L||(L=setInterval(function(){var fa=D.getAttribute("display")==="none";D.setAttribute("display",fa?"inline":"none")},600));X=H(aa.x,u.y);aa=H(aa.x,u.y+u.height);na(D,{x1:X.x,y1:X.y,x2:aa.x,y2:aa.y,visibility:"visible",display:"inline"});G&&G.setAttribute("d", -"")}function h(T,X,aa){if(T===X)e(X);else{aa||I.setSelectionRange(T,X);G=pa("text_selectblock");if(!G){G=document.createElementNS(c,"path");na(G,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(G)}T=k[T];var fa=k[X];D.setAttribute("visibility","hidden");X=H(T.x,u.y);aa=H(T.x+(fa.x-T.x),u.y);var ra=H(T.x,u.y+u.height);T=H(T.x+(fa.x-T.x),u.y+u.height);na(G,{d:"M"+X.x+","+X.y+" L"+aa.x+","+aa.y+" "+T.x+","+T.y+" "+ra.x+","+ra.y+"z",display:"inline"})}} -function l(T,X){var aa=d.createSVGPoint();aa.x=T;aa.y=X;if(k.length==1)return 0;aa=E.getCharNumAtPosition(aa);if(aa<0){aa=k.length-2;if(T<=k[0].x)aa=0}else if(aa>=k.length-2)aa=k.length-2;var fa=k[aa];T>fa.x+fa.width/2&&aa++;return aa}function z(T,X,aa){var fa=I.selectionStart;T=l(T,X);h(Math.min(fa,T),Math.max(fa,T),!aa)}function w(T,X){var aa={x:T,y:X};aa.x/=o;aa.y/=o;if(C){var fa=P(aa.x,aa.y,C.inverse());aa.x=fa.x;aa.y=fa.y}return aa}function H(T,X){var aa={x:T,y:X};if(C){var fa=P(aa.x,aa.y,C); -aa.x=fa.x;aa.y=fa.y}aa.x*=o;aa.y*=o;return aa}function A(T){h(0,E.textContent.length);$(this).unbind(T)}function v(T){if(V&&E){var X=P(T.pageX,T.pageY,qb);X=w(X.x*o,X.y*o);X=l(X.x,X.y);var aa=E.textContent,fa=aa.substr(0,X).replace(/[a-z0-9]+$/i,"").length;aa=aa.substr(X).match(/^[a-z0-9]+/i);h(fa,(aa?aa[0].length:0)+X);$(T.target).click(A);setTimeout(function(){$(T.target).unbind("click",A)},300)}}var E,I,D,G,L,k=[],u,C,F,O,V;return{select:function(T,X,aa){E=T;eb.toEditMode(X,aa)},start:function(T){E= -T;eb.toEditMode()},mouseDown:function(T,X,aa,fa){T=w(aa,fa);I.focus();e(l(T.x,T.y));F=aa;O=fa},mouseMove:function(T,X){if(!(evt.originalEvent.touches&&evt.originalEvent.touches.length>1)){var aa=w(T,X);z(aa.x,aa.y)}},mouseUp:function(T,X,aa){var fa=w(X,aa);z(fa.x,fa.y,true);T.target!==E&&XF-2&&aaO-2&&eb.toSelectMode(true)},setCursor:e,toEditMode:function(T,X){V=false;Ba="textedit";Ca.requestSelector(E).showGrips(false);Ca.requestSelector(E);eb.init();$(E).css("cursor","text");if(arguments.length){var aa= -w(T,X);e(l(aa.x,aa.y))}else e();setTimeout(function(){V=true},300)},toSelectMode:function(T){Ba="select";clearInterval(L);L=null;G&&$(G).attr("display","none");D&&$(D).attr("visibility","hidden");$(E).css("cursor","move");if(T){Ra();$(E).css("cursor","move");N("selected",[E]);ub([E],true)}E&&!E.textContent.length&&b.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(T){I=T},clear:function(){Ba=="textedit"&&eb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=J[0];Ca.requestSelector(E).showGrips(false)}var T= -E.textContent.length,X=E.getAttribute("transform");u=svgedit.utilities.getBBox(E);C=X?ba(E):null;k=Array(T);I.focus();$(E).unbind("dblclick",v).dblclick(v);if(!T)var aa={x:u.x+u.width/2,width:0};for(X=0;X=0&&this.selected_pts.push(E)}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]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",A)};var w=h=null,H=false;return{mouseDown:function(A,v,E,I){if(Ba==="path"){mouse_x=E;mouse_y=I;I=mouse_x/o;v=mouse_y/o;E=pa("path_stretch_line");l=[I,v];if(n.gridSnapping){I=wa(I);v=wa(v);mouse_x=wa(mouse_x);mouse_y=wa(mouse_y)}if(!E){E=document.createElementNS(c,"path");na(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5", -fill:"none"});E=pa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var D=null;if(w){D=w.pathSegList;for(var G=D.numberOfItems,L=6/o,k=false;G;){G--;var u=D.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=pa(L);C=D.numberOfItems;if(k){if(G<=1&&C>=2){I=D.getItem(0).x;v=D.getItem(0).y;A=E.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();D.appendItem(A);D.appendItem(I)}else if(C<3)return D=false;$(E).remove();element=L;w=null;Ma=false;if(e){svgedit.path.path.matrix&&bb(L,{},svgedit.path.path.matrix.inverse());E=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+E);$(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, -ob(A))){console.log("Clicked outside canvas");return false}D=w.pathSegList.numberOfItems;G=w.pathSegList.getItem(D-1);L=G.x;G=G.y;if(A.shiftKey){A=U(L,G,I,v);I=A.x;v=A.y}A=E.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(gb(I),gb(v)):w.createSVGPathSegCurvetoCubicAbs(gb(I),gb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;E.setAttribute("d",["M",I,v,I,v].join(" "));E=D;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,v)}}else{d_attr= -"M"+I+","+v+" ";w=Q({element:"path",curStyles:true,attr:{d:d_attr,id:la(),opacity:M.opacity/2}});E.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));E=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(E,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=[E,I];D=svgedit.path.path.segs[v];if(A.shiftKey)D.selected?svgedit.path.path.removePtFromSelection(v): -svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!D.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,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(sa==null)sa=Ca.getRubberBandBox();na(sa,{x:E*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,E){if(!(A.originalEvent.touches&& -A.originalEvent.touches.length>1)){H=true;if(Ba==="path"){if(w){var I=w.pathSegList;A=I.numberOfItems-1;if(l){var D=svgedit.path.addCtrlGrip("1c1"),G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");D.setAttribute("cx",v);D.setAttribute("cy",E);D.setAttribute("display","inline");D=l[0];var L=l[1];I.getItem(A);var k=D+(D-v/o),u=L+(L-E/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); -na(G,{x1:v,y1:E,x2:D*o,y2:L*o,display:"inline"});na(C,{x1:k*o,y1:u*o,x2:D*o,y2:L*o,display:"inline"});if(A===0)z=[v,E];else{I=I.getItem(A-1);v=I.x;E=I.y;if(I.pathSegType===6){v+=v-I.x2;E+=E-I.y2}else if(z){v=z[0]/o;E=z[1]/o}svgedit.path.replacePathSeg(6,A,[D,L,v,E,k,u],w)}}else if(D=pa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,E,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,E],D);else z?svgedit.path.replacePathSeg(6,1,[v,E,z[0],z[1],v,E],D):svgedit.path.replacePathSeg(4, -1,[v,E],D)}}}else if(svgedit.path.path.dragging){D=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:E},svgedit.path.path);A=L.x-D.x;D=L.y-D.y;svgedit.path.path.dragging=[v,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,D):svgedit.path.path.movePts(A,D)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var F=sa.getBBox(),O=svgedit.path.getGripPt(this); -F=svgedit.math.rectsIntersect(F,{x:O.x,y:O.y,width:0,height:0});this.select(F);F&&svgedit.path.path.selected_pts.push(this.index)}})}}},mouseUp:function(A,v){if(Ba==="path"){l=null;if(!w){v=pa(ca());Ma=false;z=null}return{keep:true,element:v}}if(svgedit.path.path.dragging){var E=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(E)}else if(sa&& -sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ba="pathedit";Ra();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;Ba="select";svgedit.path.path.show(false); -h=false;Ra();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(v){N("selected",[A]);ub([A],true)}},addSubPath:function(A){if(A){Ba="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ba="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(oa(A)!=0){var v=new Ea("Reorient path"),E={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Ka(A,E));Ra();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix= -null;this.clear();ub([A],true);N("changed",J)}},clear:function(){h=null;if(w){var A=pa(ca());$(pa("path_stretch_line")).remove();$(A).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");w=z=null;Ma=false}else Ba=="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=Y(A),E=ga(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems, -D=0;D0){L=I.getItem(D-1).pathSegType;if(L===2){G(D-1,1);E();break}else if(L===1&&I.numberOfItems-1===D){G(D,1);E();break}}}return false};E();if(svgedit.path.path.elem.pathSegList.numberOfItems<= -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,E=v.numberOfItems;if(E>=4){var I=v.getItem(0),D=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=E-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(D)if((I=svgedit.path.smoothControlPoints(D, -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;D=k}for(A.push("L");G0;);Ja.clear(true);$.each(m.childNodes,function(l,z){l&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&m.insertBefore(z,m.firstChild)});if(K){Jb();Cb([K])}var e= -[];$(m).find("g:data(gsvg)").each(function(){for(var l=this.attributes,z=l.length,w=0;w=0;E--){v=A.item(E);G=z(v.nodeValue);if(!(L.indexOf(v.localName)>=0))if(G!="")if(G.indexOf("pointer-events")!==0)if(!(v.localName==="class"&&G.indexOf("se_")===0)){l.push(" ");if(v.localName==="d")G=Ja.convertPath(e,true);if(isNaN(G)){if(H.test(G))G= -svgedit.units.shortFloat(G)+w}else G=svgedit.units.shortFloat(G);if(fb.apply&&e.nodeName==="image"&&v.localName==="href"&&fb.images&&fb.images==="embed"){var k=Ya[G];if(k)G=k}if(!v.namespaceURI||v.namespaceURI==c||za[v.namespaceURI]){l.push(v.nodeName);l.push('="');l.push(G);l.push('"')}}}}if(e.hasChildNodes()){l.push(">");h++;A=false;for(E=0;E");break;case 8:l.push("\n");l.push(Array(h+1).join(" "));l.push(" @@ -166,12 +167,12 @@ $(function(){

    Canvas

    @@ -207,91 +208,104 @@ $(function(){

    Rectangle

    Path

    -

    Image

    - +

    Ellipse

    -

    Line

    -

    Text

    -
    @@ -511,7 +519,7 @@ $(function(){
    -
    +
    @@ -537,9 +545,26 @@ $(function(){
    -
    diff --git a/method-draw/path.js b/method-draw/path.js index f306f5c..77ccef1 100644 --- a/method-draw/path.js +++ b/method-draw/path.js @@ -147,8 +147,8 @@ svgedit.path.addPointGrip = function(index, x, y) { svgedit.utilities.assignAttributes(pointGrip, { 'id': "pathpointgrip_" + index, 'display': "none", - 'width': 5, - 'height': 5, + 'width': svgeditor.browser.isTouch() ? 30 : 5, + 'height': svgeditor.browser.isTouch() ? 30 : 5, 'fill': "#fff", 'stroke': "#4F80FF", 'shape-rendering': "crispEdges", @@ -167,8 +167,8 @@ svgedit.path.addPointGrip = function(index, x, y) { if(x && y) { // set up the point grip element and display it svgedit.utilities.assignAttributes(pointGrip, { - 'x': x-2.5, - 'y': y-2.5, + 'x': x-(svgeditor.browser.isTouch() ? 15 : 2.5), + 'y': y-(svgeditor.browser.isTouch() ? 15 : 2.5), 'display': "inline" }); } @@ -193,7 +193,7 @@ svgedit.path.addCtrlGrip = function(id) { svgedit.utilities.assignAttributes(pointGrip, { 'id': "ctrlpointgrip_" + id, 'display': "none", - 'r': 3, + 'r': svgeditor.browser.isTouch() ? 15 : 3, 'fill': "#4F80FF", 'cursor': 'move', 'style': 'pointer-events:all', @@ -224,8 +224,8 @@ svgedit.path.getPointGrip = function(seg, update) { if(update) { var pt = svgedit.path.getGripPt(seg); svgedit.utilities.assignAttributes(pointGrip, { - 'x': pt.x-2.5, - 'y': pt.y-2.5, + 'x': pt.x-(svgeditor.browser.isTouch() ? 15 : 2.5), + 'y': pt.y-(svgeditor.browser.isTouch() ? 15 : 2.5), 'display': "inline" }); } @@ -446,7 +446,8 @@ svgedit.path.Segment.prototype.addGrip = function() { svgedit.path.Segment.prototype.update = function(full) { if(this.ptgrip) { var pt = svgedit.path.getGripPt(this); - var properties = (this.ptgrip.nodeName == "rect") ? {'x': pt.x-2.5, 'y': pt.y-2.5} : {'cx': pt.x, 'cy': pt.y}; + var reposition = (svgeditor.browser.isTouch() ? 15 : 2.5) + var properties = (this.ptgrip.nodeName == "rect") ? {'x': pt.x-reposition, 'y': pt.y-reposition} : {'cx': pt.x, 'cy': pt.y}; svgedit.utilities.assignAttributes(this.ptgrip, properties); svgedit.path.getSegSelector(this, true); diff --git a/method-draw/svg-editor.css b/method-draw/svg-editor.css index e863e34..cfa3abb 100644 --- a/method-draw/svg-editor.css +++ b/method-draw/svg-editor.css @@ -509,7 +509,6 @@ html, body { div#palette { float: left; - width: 810px; height: 16px; } @@ -1492,7 +1491,7 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), padding: 5px 0; margin: 0px; display: none; - font: 12px/15px Lucida Sans, Helvetica, Verdana, sans-serif; + font: 12px/15px 'Lucida Sans', 'Lucida Grande', Helvetica, Verdana, sans-serif; border-radius: 5px; -moz-border-radius: 5px; -moz-box-shadow: 2px 5px 10px rgba(0,0,0,.3); @@ -1500,6 +1499,29 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), box-shadow: 2px 5px 10px rgba(0,0,0,.3); } +.touch .contextMenu { + border: solid 5px rgba(0,0,0,.7); + padding: 0; + margin: 0 0 0 20px; + font: 18px/24px sans-serif; + border-radius: 5px; + -webkit-box-shadow: 2px 5px 20px 3px #000; + box-shadow: 2px 5px 20px rgba(0,0,0,0.5); +} + +.touch .contextMenu:after { + content: ''; + width: 0; + height: 0; + border: solid transparent 10px; + border-right-color: rgba(0,0,0,.7); + position: absolute; + top: 50%; + left: -25px; + margin-top: -10px; + z-index: 1000; +} + .contextMenu LI { list-style: none; padding: 0px; @@ -1512,6 +1534,16 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), float:right; } +.touch .contextMenu .shortcut { + display: none; +} + + +.touch .shortcut { + display: none; +} + + .contextMenu A { -moz-user-select: none; -webkit-user-select: none; @@ -1526,6 +1558,16 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), padding: 0px 15px 1px 20px; } +.touch .contextMenu A { + padding: 0 15px; + border-bottom: #; + font-weight: bold; + border-top: solid 1px #E3E3E3; + height: 40px; + line-height: 40px; + min-width: 200px; +} + .contextMenu LI.hover A { background-color: #2e5dea; color: white; @@ -1534,6 +1576,11 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), .contextMenu LI.disabled A { color: #999; + +} + +.touch .contextMenu LI.disabled A { + display: none; } .contextMenu LI.hover.disabled A { @@ -1546,6 +1593,12 @@ box-shadow: inset 0 3px 10px rgba(255, 255, 255, 0.1), margin-top: 5px; } +.touch .contextMenu LI.separator { + border-top: none; + margin: 0; + padding: 0; +} + #menu { display: none; position: absolute; diff --git a/method-draw/svg-editor.js b/method-draw/svg-editor.js index 7fc7a4a..d176234 100644 --- a/method-draw/svg-editor.js +++ b/method-draw/svg-editor.js @@ -361,6 +361,7 @@ Utils = svgedit.utilities, default_img_url = curConfig.imgPath + "placeholder.svg", workarea = $("#workarea"), + canv_menu = $("#cmenu_canvas"), exportWindow = null, tool_scale = 1, ui_context = 'toolbars', @@ -1571,6 +1572,7 @@ } menu_items[(el_name === 'g' ? 'en':'dis') + 'ableContextMenuItems']('#ungroup'); menu_items[((el_name === 'g' || !multiselected) ? 'dis':'en') + 'ableContextMenuItems']('#group'); + } // if (elem != null) else if (multiselected) { $('#multiselected_panel').show(); @@ -1597,6 +1599,14 @@ } svgCanvas.addedNew = false; + + if ( (elem && !is_node) || multiselected) { + // update the selected elements' layer + $('#selLayerNames').removeAttr('disabled').val(currentLayerName); + + // Enable regular menu options + canv_menu.enableContextMenuItems('#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back'); + } }; $('#text').on("focus", function(e){ textBeingEntered = true; } ); @@ -3617,6 +3627,9 @@ ev.preventDefault(); }) + $('#cmenu_canvas li').disableContextMenu(); + canv_menu.enableContextMenuItems('#delete,#cut,#copy'); + window.onbeforeunload = function() { // Suppress warning if page is empty if(undoMgr.getUndoStackSize() === 0) { diff --git a/method-draw/svgedit.compiled.css b/method-draw/svgedit.compiled.css index 1d1cb4f..b0ed85e 100644 --- a/method-draw/svgedit.compiled.css +++ b/method-draw/svgedit.compiled.css @@ -175,7 +175,7 @@ div#palette_holder #palette .palette_item{cursor:pointer} .touch #color_tools #tool_stroke .color_block>div{position:relative} #color_tools .icon_label{padding:0;width:24px;height:100%;cursor:pointer;position:absolute} #linkLabel>svg{height:20px;padding-top:4px} -div#palette{float:left;width:810px;height:16px} +div#palette{float:left;height:16px} div#workarea{display:inline-table-cell;position:absolute;top:30px;left:50px;bottom:40px;right:175px;background-color:#444;overflow:auto;text-align:center} .touch div#workarea{top:40px} div.palette_item{height:16px;width:16px;float:left} @@ -335,14 +335,21 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we .ui-slider-handle:focus{outline:0} #shape_buttons{background:#fff;border-radius:0 3px 3px 0;padding:10px} .tools_flyout .tool_button,.tools_flyout .tool_flyout{background:#fff;width:40px;height:40px;margin:5px;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0;border-width:0} -.contextMenu{position:absolute;z-index:99999;border:solid 1px rgba(0,0,0,.33);background:rgba(255,255,255,.95);padding:5px 0;margin:0;display:none;font:12px/15px Lucida Sans,Helvetica,Verdana,sans-serif;border-radius:5px;-moz-border-radius:5px;-moz-box-shadow:2px 5px 10px rgba(0,0,0,.3);-webkit-box-shadow:2px 5px 10px rgba(0,0,0,.3);box-shadow:2px 5px 10px rgba(0,0,0,.3)} +.contextMenu{position:absolute;z-index:99999;border:solid 1px rgba(0,0,0,.33);background:rgba(255,255,255,.95);padding:5px 0;margin:0;display:none;font:12px/15px 'Lucida Sans','Lucida Grande',Helvetica,Verdana,sans-serif;border-radius:5px;-moz-border-radius:5px;-moz-box-shadow:2px 5px 10px rgba(0,0,0,.3);-webkit-box-shadow:2px 5px 10px rgba(0,0,0,.3);box-shadow:2px 5px 10px rgba(0,0,0,.3)} +.touch .contextMenu{border:solid 5px rgba(0,0,0,.7);padding:0;margin:0 0 0 20px;font:18px/24px sans-serif;border-radius:5px;-webkit-box-shadow:2px 5px 20px 3px #000;box-shadow:2px 5px 20px rgba(0,0,0,0.5)} +.touch .contextMenu:after{content:'';width:0;height:0;border:solid transparent 10px;border-right-color:rgba(0,0,0,.7);position:absolute;top:50%;left:-25px;margin-top:-10px;z-index:1000} .contextMenu LI{list-style:none;padding:0;margin:0} .contextMenu .shortcut{width:115px;text-align:right;float:right} +.touch .contextMenu .shortcut{display:none} +.touch .shortcut{display:none} .contextMenu A{-moz-user-select:none;-webkit-user-select:none;color:#222;text-decoration:none;display:block;line-height:20px;height:20px;background-position:6px center;background-repeat:no-repeat;outline:0;padding:0 15px 1px 20px} +.touch .contextMenu A{padding:0 15px;border-bottom:#;font-weight:bold;border-top:solid 1px #e3e3e3;height:40px;line-height:40px;min-width:200px} .contextMenu LI.hover A{background-color:#2e5dea;color:white;cursor:default} .contextMenu LI.disabled A{color:#999} +.touch .contextMenu LI.disabled A{display:none} .contextMenu LI.hover.disabled A{background-color:transparent} .contextMenu LI.separator{border-top:solid 1px #e3e3e3;padding-top:5px;margin-top:5px} +.touch .contextMenu LI.separator{border-top:0;margin:0;padding:0} #menu{display:none;position:absolute;top:0;left:0;right:0;height:30px;background:#000;z-index:10;color:#fff} #workarea.rect,#workarea.line,#workarea.ellipse,#workarea.path,#workarea.shapelib{cursor:crosshair} #workarea.text{cursor:text} diff --git a/method-draw/svgedit.compiled.js b/method-draw/svgedit.compiled.js index 74023bc..ba308ed 100644 --- a/method-draw/svgedit.compiled.js +++ b/method-draw/svgedit.compiled.js @@ -1,104 +1,105 @@ -function touchHandler(a){var p=a.changedTouches,g=p[0],c="";switch(a.type){case "touchstart":c="mousedown";break;case "touchmove":c="mousemove";break;case "touchend":c="mouseup";break;default:return}var n=document.createEvent("MouseEvent");n.initMouseEvent(c,true,true,window,1,g.screenX,g.screenY,g.clientX,g.clientY,false,false,false,false,0,null);if(p.length<2){g.target.dispatchEvent(n);a.preventDefault()}};(function(a){function p(g){if(typeof g.data==="string"){var c=g.handler,n=g.data.toLowerCase().split(" ");g.handler=function(s){if(!(this!==s.target&&(/textarea|select/i.test(s.target.nodeName)||s.target.type==="text"))){var b=s.type!=="keypress"&&a.hotkeys.specialKeys[s.which],f=String.fromCharCode(s.which).toLowerCase(),d="",m={};if(s.altKey&&b!=="alt")d+="alt+";if(s.ctrlKey&&b!=="ctrl")d+="ctrl+";if(s.metaKey&&!s.ctrlKey&&b!=="meta")d+="meta+";if(s.shiftKey&&b!=="shift")d+="shift+";if(b)m[d+b]= -true;else{m[d+f]=true;m[d+a.hotkeys.shiftNums[f]]=true;if(d==="shift+")m[a.hotkeys.shiftNums[f]]=true}b=0;for(f=n.length;b","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:p}})})(jQuery);(function(a,p){function g(da){return typeof da==="string"}function c(da){var W=d.call(arguments,1);return function(){return da.apply(this,W.concat(d.call(arguments)))}}function n(da,W,Z,oa,pa){var na;if(oa!==f){W=Z.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Z=W[3]||"";if(pa===2&&g(oa))oa=oa.replace(da?ba:U,"");else{na=o(W[2]);oa=g(oa)?o[da?ia:P](oa):oa;oa=pa===2?oa:pa===1?a.extend({},oa,na):a.extend({},na,oa);oa=q(oa);if(da)oa=oa.replace(xa,m)}da=W[1]+(da?"#":oa||!W[1]?"?":"")+oa+Z}else da= -W(Z!==f?Z:p[qa][ga]);return da}function s(da,W,Z){if(W===f||typeof W==="boolean"){Z=W;W=q[da?ia:P]()}else W=g(W)?W.replace(da?ba:U,""):W;return o(W,Z)}function b(da,W,Z,oa){if(!g(Z)&&typeof Z!=="object"){oa=Z;Z=W;W=f}return this.each(function(){var pa=a(this),na=W||Q()[(this.nodeName||"").toLowerCase()]||"",ma=na&&pa.attr(na)||"";pa.attr(na,q[da](ma,Z,oa))})}var f,d=Array.prototype.slice,m=decodeURIComponent,q=a.param,B,o,K,S=a.bbq=a.bbq||{},M,J,Q,Y=a.event.special,P="querystring",ia="fragment",qa= -"location",ga="href",U=/^.*\?|#.*$/g,ba=/^.*\#/,xa,ka={};q[P]=c(n,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});q[ia]=B=c(n,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});B.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);xa=RegExp(da.join("|"),"g")};B.noEscape(",/");a.deparam=o=function(da,W){var Z={},oa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(pa,na){var ma=na.split("="),za=m(ma[0]),Ha=Z,Fa= -0,Ia=za.split("]["),La=Ia.length-1;if(/\[/.test(Ia[0])&&/\]$/.test(Ia[La])){Ia[La]=Ia[La].replace(/\]$/,"");Ia=Ia.shift().split("[").concat(Ia);La=Ia.length-1}else La=0;if(ma.length===2){ma=m(ma[1]);if(W)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:oa[ma]!==f?oa[ma]:ma;if(La)for(;Fa<=La;Fa++){za=Ia[Fa]===""?Ha.length:Ia[Fa];Ha=Ha[za]=Fa').hide().insertAfter("body")[0].contentWindow; -J=function(){return c(S.document[b][f])};M=function(Q,Y){if(Q!==Y){var P=S.document;P.open().close();P[b].hash="#"+Q}};M(c())}}var o={},K,S,M,J;o.start=function(){if(!K){var Q=c();M||B();(function Y(){var P=c(),ia=J(Q);if(P!==Q){M(Q=P,ia);a(p).trigger("hashchange")}else if(ia!==Q)p[b][f]=p[b][f].replace(/#.*/,"")+"#"+ia;K=setTimeout(Y,a.hashchangeDelay)})()}};o.stop=function(){if(!S){K&&clearTimeout(K);K=0}};return o}()})(jQuery,this);(function(a){var p={},g;a.svgIcons=function(c,n){function s(da,W){if(da!=="ajax"){if(Q)return;var Z=(S=ga[0].contentDocument)&&S.getElementById("svg_eof");if(!Z&&!(W&&Z)){Y++;if(Y<50)setTimeout(s,20);else{f();Q=true}return}Q=true}K=a(S.firstChild).children();if(n.no_img)setTimeout(function(){J||b()},500);else{Z=qa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} -function b(da,W){if(!J){if(n.no_img)da=false;if(da){var Z=a(document.createElement("div"));Z.hide().appendTo("body")}if(W){var oa=n.fallback_path?n.fallback_path:"";a.each(W,function(La,Ka){a("#"+La);var Ea=a(new Image).attr({"class":"svg_icon",src:oa+Ka,width:B,height:o,alt:"icon"});ka(Ea,La)})}else for(var pa=K.length,na=0;na0&&!da)ya=g(ya,Ea,true);xa(a(this),ya,Ka)})});if(!W){da&&Z.remove();ga&&ga.remove();M&&M.remove()}n.resize&&a.resizeSvgIcons(n.resize);J=true;n.callback&&n.callback(p)}}function f(){if(c.indexOf(".svgz")!=-1){var da=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,n)}else n.fallback&&b(false,n.fallback)} -function d(da){if(window.btoa)return window.btoa(da);var W=Array(Math.floor((da.length+2)/3)*4),Z,oa,pa,na,ma,za,Ha=0,Fa=0;do{Z=da.charCodeAt(Ha++);oa=da.charCodeAt(Ha++);pa=da.charCodeAt(Ha++);na=Z>>2;Z=(Z&3)<<4|oa>>4;ma=(oa&15)<<2|pa>>6;za=pa&63;if(isNaN(oa))ma=za=64;else if(isNaN(pa))za=64;W[Fa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(na);W[Fa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);W[Fa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); -W[Fa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(za)}while(Ha-1&&P.indexOf("Chrome/");var qa="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var ga=a('').appendTo("body").hide();try{S=ga[0].contentDocument;ga.load(s); -s(0,true)}catch(U){f()}}else{var ba=new DOMParser;a.ajax({url:c,dataType:"string",success:function(da){if(da){S=ba.parseFromString(da,"text/xml");a(function(){s("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){S=ba.parseFromString(da.responseText,"text/xml");S.childNodes.length||a(f);a(function(){s("ajax")})}else a(f)}})}var xa=function(da,W,Z,oa){ia&&W.css("visibility","hidden");if(n.replace){oa&&W.attr("id",Z);(Z=da.attr("class"))&&W.attr("class", -"svg_icon "+Z);da.replaceWith(W)}else da.append(W);ia&&setTimeout(function(){W.removeAttr("style")},1)},ka=function(da,W){if(n.id_match===undefined||n.id_match!==false)xa(holder,da,W,true);p[W]=da};g=function(da,W){var Z=da.find("defs");if(!Z.length)return da;Z=ia?Z.find("*").filter(function(){return!!this.id}):Z.find("[id]");var oa=da[0].getElementsByTagName("*"),pa=oa.length;Z.each(function(na){var ma=this.id;a(S).find("#"+ma);this.id=na="x"+ma+W+na;ma="url(#"+ma+")";var za="url(#"+na+")";for(na= -0;na","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:p}})})(jQuery);(function(a,p){function g(da){return typeof da==="string"}function c(da){var X=d.call(arguments,1);return function(){return da.apply(this,X.concat(d.call(arguments)))}}function m(da,X,Z,oa,ra){var ma;if(oa!==f){X=Z.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Z=X[3]||"";if(ra===2&&g(oa))oa=oa.replace(da?W:ba,"");else{ma=o(X[2]);oa=g(oa)?o[da?ia:P](oa):oa;oa=ra===2?oa:ra===1?a.extend({},oa,ma):a.extend({},ma,oa);oa=q(oa);if(da)oa=oa.replace(ta,k)}da=X[1]+(da?"#":oa||!X[1]?"?":"")+oa+Z}else da= +X(Z!==f?Z:p[qa][ga]);return da}function s(da,X,Z){if(X===f||typeof X==="boolean"){Z=X;X=q[da?ia:P]()}else X=g(X)?X.replace(da?W:ba,""):X;return o(X,Z)}function b(da,X,Z,oa){if(!g(Z)&&typeof Z!=="object"){oa=Z;Z=X;X=f}return this.each(function(){var ra=a(this),ma=X||S()[(this.nodeName||"").toLowerCase()]||"",na=ma&&ra.attr(ma)||"";ra.attr(ma,q[da](na,Z,oa))})}var f,d=Array.prototype.slice,k=decodeURIComponent,q=a.param,B,o,J,U=a.bbq=a.bbq||{},M,I,S,Y=a.event.special,P="querystring",ia="fragment",qa= +"location",ga="href",ba=/^.*\?|#.*$/g,W=/^.*\#/,ta,ka={};q[P]=c(m,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});q[ia]=B=c(m,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});B.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);ta=RegExp(da.join("|"),"g")};B.noEscape(",/");a.deparam=o=function(da,X){var Z={},oa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(ra,ma){var na=ma.split("="),Ca=k(na[0]),Ga=Z,Ja= +0,Da=Ca.split("]["),La=Da.length-1;if(/\[/.test(Da[0])&&/\]$/.test(Da[La])){Da[La]=Da[La].replace(/\]$/,"");Da=Da.shift().split("[").concat(Da);La=Da.length-1}else La=0;if(na.length===2){na=k(na[1]);if(X)na=na&&!isNaN(na)?+na:na==="undefined"?f:oa[na]!==f?oa[na]:na;if(La)for(;Ja<=La;Ja++){Ca=Da[Ja]===""?Ga.length:Da[Ja];Ga=Ga[Ca]=Ja').hide().insertAfter("body")[0].contentWindow; +I=function(){return c(U.document[b][f])};M=function(S,Y){if(S!==Y){var P=U.document;P.open().close();P[b].hash="#"+S}};M(c())}}var o={},J,U,M,I;o.start=function(){if(!J){var S=c();M||B();(function Y(){var P=c(),ia=I(S);if(P!==S){M(S=P,ia);a(p).trigger("hashchange")}else if(ia!==S)p[b][f]=p[b][f].replace(/#.*/,"")+"#"+ia;J=setTimeout(Y,a.hashchangeDelay)})()}};o.stop=function(){if(!U){J&&clearTimeout(J);J=0}};return o}()})(jQuery,this);(function(a){var p={},g;a.svgIcons=function(c,m){function s(da,X){if(da!=="ajax"){if(S)return;var Z=(U=ga[0].contentDocument)&&U.getElementById("svg_eof");if(!Z&&!(X&&Z)){Y++;if(Y<50)setTimeout(s,20);else{f();S=true}return}S=true}J=a(U.firstChild).children();if(m.no_img)setTimeout(function(){I||b()},500);else{Z=qa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} +function b(da,X){if(!I){if(m.no_img)da=false;if(da){var Z=a(document.createElement("div"));Z.hide().appendTo("body")}if(X){var oa=m.fallback_path?m.fallback_path:"";a.each(X,function(La,Oa){a("#"+La);var Ba=a(new Image).attr({"class":"svg_icon",src:oa+Oa,width:B,height:o,alt:"icon"});ka(Ba,La)})}else for(var ra=J.length,ma=0;ma0&&!da)za=g(za,Ba,true);ta(a(this),za,Oa)})});if(!X){da&&Z.remove();ga&&ga.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);I=true;m.callback&&m.callback(p)}}function f(){if(c.indexOf(".svgz")!=-1){var da=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,m)}else m.fallback&&b(false,m.fallback)} +function d(da){if(window.btoa)return window.btoa(da);var X=Array(Math.floor((da.length+2)/3)*4),Z,oa,ra,ma,na,Ca,Ga=0,Ja=0;do{Z=da.charCodeAt(Ga++);oa=da.charCodeAt(Ga++);ra=da.charCodeAt(Ga++);ma=Z>>2;Z=(Z&3)<<4|oa>>4;na=(oa&15)<<2|ra>>6;Ca=ra&63;if(isNaN(oa))na=Ca=64;else if(isNaN(ra))Ca=64;X[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);X[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);X[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(na); +X[Ja++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ca)}while(Ga-1&&P.indexOf("Chrome/");var qa="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ga=a('').appendTo("body").hide();try{U=ga[0].contentDocument;ga.load(s); +s(0,true)}catch(ba){f()}}else{var W=new DOMParser;a.ajax({url:c,dataType:"string",success:function(da){if(da){U=W.parseFromString(da,"text/xml");a(function(){s("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){U=W.parseFromString(da.responseText,"text/xml");U.childNodes.length||a(f);a(function(){s("ajax")})}else a(f)}})}var ta=function(da,X,Z,oa){ia&&X.css("visibility","hidden");if(m.replace){oa&&X.attr("id",Z);(Z=da.attr("class"))&&X.attr("class", +"svg_icon "+Z);da.replaceWith(X)}else da.append(X);ia&&setTimeout(function(){X.removeAttr("style")},1)},ka=function(da,X){if(m.id_match===undefined||m.id_match!==false)ta(holder,da,X,true);p[X]=da};g=function(da,X){var Z=da.find("defs");if(!Z.length)return da;Z=ia?Z.find("*").filter(function(){return!!this.id}):Z.find("[id]");var oa=da[0].getElementsByTagName("*"),ra=oa.length;Z.each(function(ma){var na=this.id;a(U).find("#"+na);this.id=ma="x"+na+X+ma;na="url(#"+na+")";var Ca="url(#"+ma+")";for(ma= +0;ma=0;jQuery.fn.jGraduate=function(c){var n= -arguments;return this.each(function(){function s(ja,ca,la,N,R){var ea=R||a("stop",{"stop-color":ca,"stop-opacity":la,offset:ja},ba);if(R){ca=R.getAttribute("stop-color");la=R.getAttribute("stop-opacity");ja=R.getAttribute("offset")}else ba.appendChild(ea);if(la===null)la=1;R=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ja*ia)+", 26)"},Va);var Ga= -a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ca,"fill-opacity":la,transform:"translate("+(10+ja*ia)+", 26)",stroke:"#000","stroke-width":1.5},Va);$(Ga).mousedown(function(Oa){b(this);Ya=ib;Q.mousemove(m).mouseup(f);ua=yb.offset();Oa.preventDefault();return false}).data("stop",ea).data("bg",R).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Xa=+ea.getAttribute("stop-opacity")|| -1,bb=ea.getAttribute("stop-color")||1,rb=(parseFloat(Xa)*255).toString(16);rb.length<2;)rb="0"+rb;ca=bb.substr(1)+rb;$("#"+o+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:B.images.clientPath},color:{active:ca,alphaSupport:true}},function(Wa){bb=Wa.val("hex")?"#"+Wa.val("hex"):"none";Xa=Wa.val("a")!==null?Wa.val("a")/256:1;Oa.setAttribute("fill",bb);Oa.setAttribute("fill-opacity",Xa);ea.setAttribute("stop-color", -bb);ea.setAttribute("stop-opacity",Xa);$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()})});$(ba).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ja){if(!ca){var Xa=this.getAttribute("stop-color"),bb=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Xa);Ga.setAttribute("fill",Xa);ea.setAttribute("stop-opacity",bb===null?1:bb);Ga.setAttribute("fill-opacity", -bb===null?1:bb)}Oa.before(ea);return false}});N&&b(Ga);return ea}function b(ja){ib&&ib.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");ib=ja;ib.parentNode.appendChild(ib)}function f(){Q.unbind("mousemove",m);if(Aa.getAttribute("display")!=="none"){Aa.setAttribute("display","none");var ja=$(ib),ca=ja.data("stop");ja=ja.data("bg");$([ib,ca,ja]).remove()}Ya=null}function d(){var ja=Ta?"rotate("+Ta+","+Ba+","+jb+") ":"";fb===1&&Ma===1?ba.removeAttribute("gradientTransform"):ba.setAttribute("gradientTransform", -ja+"translate("+-Ba*(fb-1)+","+-jb*(Ma-1)+") scale("+fb+","+Ma+")")}function m(ja){var ca=ja.pageX-ua.left;ja=ja.pageY-ua.top;ca=ca<10?10:ca>ia+10?ia+10:ca;var la="translate("+ca+", 26)";if(ja<-60||ja>130){Aa.setAttribute("display","block");Aa.setAttribute("transform",la)}else Aa.setAttribute("display","none");Ya.setAttribute("transform",la);$.data(Ya,"bg").setAttribute("transform",la);$.data(Ya,"stop").setAttribute("offset",(ca-10)/ia);var N=0;$(ba).find("stop").each(function(){var R=this.getAttribute("offset"), -ea=$(this);if(R
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var Y=$(K+"> .jGraduate_colPick"),P=$(K+"> .jGraduate_gradPick");P.html('

    '+B.window.pickerTitle+'

    =0;jQuery.fn.jGraduate=function(c){var m= +arguments;return this.each(function(){function s(la,ca,ja,O,T){var ea=T||a("stop",{"stop-color":ca,"stop-opacity":ja,offset:la},W);if(T){ca=T.getAttribute("stop-color");ja=T.getAttribute("stop-opacity");la=T.getAttribute("offset")}else W.appendChild(ea);if(ja===null)ja=1;T=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+la*ia)+", 26)"},rb);var Ha= +a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ca,"fill-opacity":ja,transform:"translate("+(10+la*ia)+", 26)",stroke:"#000","stroke-width":1.5},rb);$(Ha).mousedown(function(Pa){b(this);Sa=jb;S.mousemove(k).mouseup(f);wa=$a.offset();Pa.preventDefault();return false}).data("stop",ea).data("bg",T).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Pa=this,Xa=+ea.getAttribute("stop-opacity")|| +1,fb=ea.getAttribute("stop-color")||1,ob=(parseFloat(Xa)*255).toString(16);ob.length<2;)ob="0"+ob;ca=fb.substr(1)+ob;$("#"+o+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:B.images.clientPath},color:{active:ca,alphaSupport:true}},function(Wa){fb=Wa.val("hex")?"#"+Wa.val("hex"):"none";Xa=Wa.val("a")!==null?Wa.val("a")/256:1;Pa.setAttribute("fill",fb);Pa.setAttribute("fill-opacity",Xa);ea.setAttribute("stop-color", +fb);ea.setAttribute("stop-opacity",Xa);$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+o+"_jGraduate_stopPicker").hide()})});$(W).find("stop").each(function(){var Pa=$(this);if(+this.getAttribute("offset")>la){if(!ca){var Xa=this.getAttribute("stop-color"),fb=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Xa);Ha.setAttribute("fill",Xa);ea.setAttribute("stop-opacity",fb===null?1:fb);Ha.setAttribute("fill-opacity", +fb===null?1:fb)}Pa.before(ea);return false}});O&&b(Ha);return ea}function b(la){jb&&jb.setAttribute("stroke","#000");la.setAttribute("stroke","blue");jb=la;jb.parentNode.appendChild(jb)}function f(){S.unbind("mousemove",k);if(Ea.getAttribute("display")!=="none"){Ea.setAttribute("display","none");var la=$(jb),ca=la.data("stop");la=la.data("bg");$([jb,ca,la]).remove()}Sa=null}function d(){var la=Ta?"rotate("+Ta+","+Fa+","+lb+") ":"";hb===1&&Ma===1?W.removeAttribute("gradientTransform"):W.setAttribute("gradientTransform", +la+"translate("+-Fa*(hb-1)+","+-lb*(Ma-1)+") scale("+hb+","+Ma+")")}function k(la){var ca=la.pageX-wa.left;la=la.pageY-wa.top;ca=ca<10?10:ca>ia+10?ia+10:ca;var ja="translate("+ca+", 26)";if(la<-60||la>130){Ea.setAttribute("display","block");Ea.setAttribute("transform",ja)}else Ea.setAttribute("display","none");Sa.setAttribute("transform",ja);$.data(Sa,"bg").setAttribute("transform",ja);$.data(Sa,"stop").setAttribute("offset",(ca-10)/ia);var O=0;$(W).find("stop").each(function(){var T=this.getAttribute("offset"), +ea=$(this);if(T
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var Y=$(J+"> .jGraduate_colPick"),P=$(J+"> .jGraduate_gradPick");P.html('

    '+B.window.pickerTitle+'


    ');var ia=256,qa=ia-0,ga=ia-0,U,ba,xa,ka={};$(".jGraduate_SliderBar").width(145);var da=$("#"+o+"_jGraduate_GradContainer")[0],W=a("svg",{id:o+"_jgraduate_svg",width:ia,height:ia,xmlns:p.svg},da);U=U||q.paint.type;var Z=ba=q.paint[U],oa=q.paint.alpha,pa=U==="solidColor";switch(U){case "solidColor":case "linearGradient":if(!pa){ba.id=o+"_lg_jgraduate_grad"; -Z=ba=W.appendChild(ba)}a("radialGradient",{id:o+"_rg_jgraduate_grad"},W);if(U==="linearGradient")break;case "radialGradient":if(!pa){ba.id=o+"_rg_jgraduate_grad";Z=ba=W.appendChild(ba)}a("linearGradient",{id:o+"_lg_jgraduate_grad"},W)}if(pa){Z=ba=$("#"+o+"_lg_jgraduate_grad")[0];J=q.paint[U];s(0,"#"+J,1);var na=typeof B.newstop;if(na==="string")switch(B.newstop){case "same":s(1,"#"+J,1);break;case "inverse":na="";for(var ma=0;ma<6;ma+=2){J.substr(ma,2);var za=(255-parseInt(J.substr(ma,2),16)).toString(16); -if(za.length<2)za=0+za;na+=za}s(1,"#"+na,1);break;case "white":s(1,"#ffffff",1);break;case "black":s(1,"#000000",1)}else if(na==="object")s(1,B.newstop.color||"#"+J,"opac"in B.newstop?B.newstop.opac:1)}J=parseFloat(Z.getAttribute("x1")||0);na=parseFloat(Z.getAttribute("y1")||0);ma=parseFloat(Z.getAttribute("x2")||1);za=parseFloat(Z.getAttribute("y2")||0);var Ha=parseFloat(Z.getAttribute("cx")||0.5),Fa=parseFloat(Z.getAttribute("cy")||0.5),Ia=parseFloat(Z.getAttribute("fx")||Ha),La=parseFloat(Z.getAttribute("fy")|| -Fa);xa=a("rect",{id:o+"_jgraduate_rect",x:0,y:0,width:qa,height:ga,fill:"url(#"+o+"_jgraduate_grad)","fill-opacity":oa/100},W);var Ka=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:na*ia,left:J*ia}).data("coord","start").appendTo(da),Ea=Ka.clone().text(2).css({top:za*ia,left:ma*ia}).attr("title","End stop").data("coord","end").appendTo(da),ya=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Fa*ia,left:Ha* -ia}).data("coord","center").appendTo(da),Ca=ya.clone().text("F").css({top:La*ia,left:Ia*ia,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ca[0].id=o+"_jGraduate_focusCoord";$(K+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ca){var la=ba.getAttribute(ca),N=isNaN(ca[1]);la||(la=N?"0.5":ca==="x2"?"1.0":"0.0");ka[ca]=$("#"+o+"_jGraduate_"+ca).val(la).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(ca[0]==="f"&&!kb))if(N&&U==="radialGradient"||!N&&U==="linearGradient")ba.setAttribute(ca,this.value);var R=N?ca[0]==="c"?ya:Ca:ca[1]==="1"?Ka:Ea,ea=ca.indexOf("x")>=0?"left":"top";R.css(ea,this.value*ia)}).change()});var wa,Va,yb=$("#"+o+"_jGraduate_StopSlider"),ib,Qa,Ya,Aa=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Qa),ua,fb=1,Ma=1,Ta=0,Ba=Ha,jb=Fa;Qa=a("svg",{width:"100%",height:45},yb[0]);da=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Qa);a("image",{width:16,height:16},da).setAttributeNS(p.xlink,"xlink:href",B.images.clientPath+"map-opacity.png");$(Qa).on("click touchstart",function(ja){ua=yb.offset();if(ja.target.tagName!=="path"){var ca=ja.pageX-ua.left-8;ca=ca<10?10:ca>ia+10?ia+10:ca;s(ca/ia,0,0,true);ja.stopPropagation()}});$(Qa).mouseover(function(){Qa.appendChild(Aa)});Va=a("g",{},Qa);a("line",{x1:10,y1:15,x2:ia+10,y2:15,"stroke-width":2,stroke:"#000"},Qa);var sb= -P.find(".jGraduate_spreadMethod").change(function(){ba.setAttribute("spreadMethod",$(this).val())}),Za=null,cb=function(ja){var ca=ja.pageX-lb.left,la=ja.pageY-lb.top;ca=ca<0?0:ca>ia?ia:ca;la=la<0?0:la>ia?ia:la;Za.css("left",ca).css("top",la);ca=ca/qa;la=la/ga;var N=Za.data("coord"),R=ba;switch(N){case "start":ka.x1.val(ca);ka.y1.val(la);R.setAttribute("x1",ca);R.setAttribute("y1",la);break;case "end":ka.x2.val(ca);ka.y2.val(la);R.setAttribute("x2",ca);R.setAttribute("y2",la);break;case "center":ka.cx.val(ca); -ka.cy.val(la);R.setAttribute("cx",ca);R.setAttribute("cy",la);Ba=ca;jb=la;d();break;case "focus":ka.fx.val(ca);ka.fy.val(la);R.setAttribute("fx",ca);R.setAttribute("fy",la);d()}ja.preventDefault()},zb=function(){Za=null;Q.unbind("mousemove",cb).unbind("mouseup",zb)};wa=ba.getElementsByTagNameNS(p.svg,"stop");if(sa<2){for(;sa<2;){ba.appendChild(document.createElementNS(p.svg,"stop"));++sa}wa=ba.getElementsByTagNameNS(p.svg,"stop")}var sa=wa.length;for(ma=0;ma99.5)N=99.5;if(N>0)Ma=1-N/100;else fb=-(N/100)-1;R=145*((N+100)/ -2)/100;ea&&d();break;case "angle":Ta=N;R=Ta/180;R+=0.5;R*=145;ea&&d()}if(R>145)R=145;else if(R<0)R=0;la.css({"margin-left":R-5})}).change()});var tb=function(ja){var ca=ja.pageX-gb.offset.left-parseInt(gb.parent.css("border-left-width"));if(ca>145)ca=145;if(ca<=0)ca=0;var la=ca-5;ca/=145;switch(gb.type){case "radius":ca=Math.pow(ca*2,2.5);if(ca>0.98&&ca<1.02)ca=1;if(ca<=0.01)ca=0.01;ba.setAttribute("r",ca);break;case "opacity":q.paint.alpha=parseInt(ca*100);xa.setAttribute("fill-opacity",ca);break; -case "ellip":Ma=fb=1;if(ca<0.5){ca/=0.5;fb=ca<=0?0.01:ca}else if(ca>0.5){ca/=0.5;ca=2-ca;Ma=ca<=0?0.01:ca}d();ca-=1;if(Ma===ca+1)ca=Math.abs(ca);break;case "angle":ca-=0.5;Ta=ca*=180;d();ca/=100}gb.elem.css({"margin-left":la});ca=Math.round(ca*100);gb.input.val(ca);ja.preventDefault()},pb=function(){Q.unbind("mousemove",tb).unbind("mouseup",pb);gb=null};for(P=(q.paint.alpha*255/100).toString(16);P.length<2;)P="0"+P;P=P.split(".")[0];J=q.paint.solidColor=="none"?"":q.paint.solidColor+P;pa||(J=wa[0].getAttribute("stop-color")); -$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});Y.jPicker({window:{title:B.window.pickerTitle},images:{clientPath:B.images.clientPath},color:{active:J,alphaSupport:true}},function(ja){q.paint.type="solidColor";q.paint.alpha=ja.val("ahex")?Math.round(ja.val("a")/255*100):100;q.paint.solidColor=ja.val("hex")?ja.val("hex"):"none";q.paint.radialGradient=null;S()},null,function(){M()});var Ab=$(K+" .jGraduate_tabs li");Ab.on("click touchstart",function(){Ab.removeClass("jGraduate_tab_current"); -$(this).addClass("jGraduate_tab_current");$(K+" > div").hide();var ja=$(this).attr("data-type");$(K+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+o+"_jgraduate_rect")[0].setAttribute("fill","url(#"+o+"_"+ja+"_jgraduate_grad)");U=ja==="lg"?"linearGradient":"radialGradient";$("#"+o+"_jGraduate_OpacInput").val(q.paint.alpha).change();var ca=$("#"+o+"_"+ja+"_jgraduate_grad")[0];if(ba!==ca){var la= -$(ba).find("stop");$(ca).empty().append(la);ba=ca;ca=sb.val();ba.setAttribute("spreadMethod",ca)}kb=ja==="rg"&&ba.getAttribute("fx")!=null&&!(Ha==Ia&&Fa==La);$("#"+o+"_jGraduate_focusCoord").toggle(kb);if(kb)$("#"+o+"_jGraduate_match_ctr")[0].checked=false}else{$(K+" .jGraduate_gradPick").hide();$(K+" .jGraduate_colPick").show()}});$(K+" > div").hide();Ab.removeClass("jGraduate_tab_current");var Bb;switch(q.paint.type){case "linearGradient":Bb=$(K+" .jGraduate_tab_lingrad");break;case "radialGradient":Bb= -$(K+" .jGraduate_tab_radgrad");break;default:Bb=$(K+" .jGraduate_tab_color")}q.show();setTimeout(function(){Bb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),p=$(document);$.extend($.fn,{contextMenu:function(g,c){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var n=$(this),s=$(n).offset(),b=$("#"+g.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(f){$(this).mouseup(function(d){var m=$(this);m.unbind("mouseup");$(".contextMenu").hide();if(f.button===2||g.allowLeft|| -f.ctrlKey&&svgedit.browser.isMac()){d.stopPropagation();if(n.hasClass("disabled")||f.altKey)return false;var q=d.pageX,B=d.pageY;d=a.width()-b.width();var o=a.height()-b.height();if(q>d-15)q=d-15;if(B>o-30)B=o-30;p.unbind("click");b.css({top:B,left:q}).fadeIn(g.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});p.keypress(function(K){switch(K.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); -b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover");break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:p.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){p.unbind("click").unbind("keypress"); -$(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(m),{x:q-s.left,y:B-s.top,docX:q,docY:B});return false});setTimeout(function(){p.click(function(){p.unbind("click").unbind("keypress");b.fadeOut(g.outSpeed);return false})},0)}})});if($.browser.mozilla)$("#"+g.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+g.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+g.menu).each(function(){$(this).bind("mousedown.disableTextSelect", -function(){return false})});$(n).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var c=g.split(","),n=0;n=0,s=p.indexOf("Gecko/")>=0,b=p.indexOf("MSIE")>=0,f=p.indexOf("Chrome/")>=0,d=p.indexOf("Windows")>=0,m=p.indexOf("Macintosh")>= -0,q="ontouchstart"in window,B=!!g.querySelector,o=!!document.evaluate,K=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,10");var ga=qa.pathSegList;qa=qa.createSVGPathSegLinetoAbs(5,5);try{ga.replaceItem(qa,0);return true}catch(U){}return false}(),S=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,10");var ga=qa.pathSegList;qa=qa.createSVGPathSegLinetoAbs(5,5);try{ga.insertItemBefore(qa, -0);return true}catch(U){}return false}(),M=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","svg"),ga=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(qa);ga.setAttribute("x",5);qa.appendChild(ga);var U=document.createElementNS("http://www.w3.org/2000/svg","text");U.textContent="a";ga.appendChild(U);ga=U.getStartPositionOfChar(0).x;document.documentElement.removeChild(qa);return ga===0}(),J=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(qa);var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M0,0 C0,0 10,10 10,0");qa.appendChild(ga);ga=ga.getBBox();document.documentElement.removeChild(qa);return ga.height>4&&ga.height<5}(),Q=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(qa);var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M0,0 10,0");var U= -document.createElementNS("http://www.w3.org/2000/svg","path");U.setAttribute("d","M5,0 15,0");var ba=document.createElementNS("http://www.w3.org/2000/svg","g");ba.appendChild(ga);ba.appendChild(U);qa.appendChild(ba);ga=ba.getBBox();document.documentElement.removeChild(qa);return ga.width==15}(),Y=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect");qa.setAttribute("x",0.1);(qa=qa.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); -return qa}(),P=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect");qa.setAttribute("style","vector-effect:non-scaling-stroke");return qa.style.vectorEffect==="non-scaling-stroke"}(),ia=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ga=g.createSVGTransform();qa.appendItem(ga);return qa.getItem(0)==ga}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return s}; -svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return q};svgedit.browser.supportsSelectors=function(){return B};svgedit.browser.supportsXpath=function(){return o};svgedit.browser.supportsPathReplaceItem=function(){return K};svgedit.browser.supportsPathInsertItemBefore=function(){return S};svgedit.browser.supportsPathBBox=function(){return J}; -svgedit.browser.supportsHVLineContainerBBox=function(){return Q};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return Y};svgedit.browser.supportsNonScalingStroke=function(){return P};svgedit.browser.supportsNativeTransformLists=function(){return ia}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; -(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),p={};svgedit.transformlist.SVGTransformList=function(g){this._elem=g||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var n=0;n=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,n){var s=null;if(n>=0)if(n=0){this._removeFromOtherLists(c);s=this._xforms[n]=c;this._list._update()}return s};this.removeItem=function(c){if(c=0){for(var n=this._xforms[c],s=Array(this.numberOfItems- -1),b=0;b
    ');var ia=256,qa=ia-0,ga=ia-0,ba,W,ta,ka={};$(".jGraduate_SliderBar").width(145);var da=$("#"+o+"_jGraduate_GradContainer")[0],X=a("svg",{id:o+"_jgraduate_svg",width:ia,height:ia,xmlns:p.svg},da);ba=ba||q.paint.type;var Z=W=q.paint[ba],oa=q.paint.alpha,ra=ba==="solidColor";switch(ba){case "solidColor":case "linearGradient":if(!ra){W.id=o+"_lg_jgraduate_grad"; +Z=W=X.appendChild(W)}a("radialGradient",{id:o+"_rg_jgraduate_grad"},X);if(ba==="linearGradient")break;case "radialGradient":if(!ra){W.id=o+"_rg_jgraduate_grad";Z=W=X.appendChild(W)}a("linearGradient",{id:o+"_lg_jgraduate_grad"},X)}if(ra){Z=W=$("#"+o+"_lg_jgraduate_grad")[0];I=q.paint[ba];s(0,"#"+I,1);var ma=typeof B.newstop;if(ma==="string")switch(B.newstop){case "same":s(1,"#"+I,1);break;case "inverse":ma="";for(var na=0;na<6;na+=2){I.substr(na,2);var Ca=(255-parseInt(I.substr(na,2),16)).toString(16); +if(Ca.length<2)Ca=0+Ca;ma+=Ca}s(1,"#"+ma,1);break;case "white":s(1,"#ffffff",1);break;case "black":s(1,"#000000",1)}else if(ma==="object")s(1,B.newstop.color||"#"+I,"opac"in B.newstop?B.newstop.opac:1)}I=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);na=parseFloat(Z.getAttribute("x2")||1);Ca=parseFloat(Z.getAttribute("y2")||0);var Ga=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Da=parseFloat(Z.getAttribute("fx")||Ga),La=parseFloat(Z.getAttribute("fy")|| +Ja);ta=a("rect",{id:o+"_jgraduate_rect",x:0,y:0,width:qa,height:ga,fill:"url(#"+o+"_jgraduate_grad)","fill-opacity":oa/100},X);var Oa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ia,left:I*ia}).data("coord","start").appendTo(da),Ba=Oa.clone().text(2).css({top:Ca*ia,left:na*ia}).attr("title","End stop").data("coord","end").appendTo(da),za=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ia,left:Ga* +ia}).data("coord","center").appendTo(da),Ia=za.clone().text("F").css({top:La*ia,left:Da*ia,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ia[0].id=o+"_jGraduate_focusCoord";$(J+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(la,ca){var ja=W.getAttribute(ca),O=isNaN(ca[1]);ja||(ja=O?"0.5":ca==="x2"?"1.0":"0.0");ka[ca]=$("#"+o+"_jGraduate_"+ca).val(ja).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> +1)this.value=1;if(!(ca[0]==="f"&&!kb))if(O&&ba==="radialGradient"||!O&&ba==="linearGradient")W.setAttribute(ca,this.value);var T=O?ca[0]==="c"?za:Ia:ca[1]==="1"?Oa:Ba,ea=ca.indexOf("x")>=0?"left":"top";T.css(ea,this.value*ia)}).change()});var xa,rb,$a=$("#"+o+"_jGraduate_StopSlider"),jb,Ua,Sa,Ea=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Ua),wa,hb=1,Ma=1,Ta=0,Fa=Ga,lb=Ja;Ua=a("svg",{width:"100%",height:45},$a[0]);da=a("pattern",{width:16, +height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ua);a("image",{width:16,height:16},da).setAttributeNS(p.xlink,"xlink:href",B.images.clientPath+"map-opacity.png");$(Ua).on("click touchstart",function(la){wa=$a.offset();if(la.target.tagName!=="path"){var ca=la.pageX-wa.left-8;ca=ca<10?10:ca>ia+10?ia+10:ca;s(ca/ia,0,0,true);la.stopPropagation()}});$(Ua).mouseover(function(){Ua.appendChild(Ea)});rb=a("g",{},Ua);a("line",{x1:10,y1:15,x2:ia+10,y2:15,"stroke-width":2,stroke:"#000"},Ua);var tb= +P.find(".jGraduate_spreadMethod").change(function(){W.setAttribute("spreadMethod",$(this).val())}),Ya=null,bb=function(la){var ca=la.pageX-nb.left,ja=la.pageY-nb.top;ca=ca<0?0:ca>ia?ia:ca;ja=ja<0?0:ja>ia?ia:ja;Ya.css("left",ca).css("top",ja);ca=ca/qa;ja=ja/ga;var O=Ya.data("coord"),T=W;switch(O){case "start":ka.x1.val(ca);ka.y1.val(ja);T.setAttribute("x1",ca);T.setAttribute("y1",ja);break;case "end":ka.x2.val(ca);ka.y2.val(ja);T.setAttribute("x2",ca);T.setAttribute("y2",ja);break;case "center":ka.cx.val(ca); +ka.cy.val(ja);T.setAttribute("cx",ca);T.setAttribute("cy",ja);Fa=ca;lb=ja;d();break;case "focus":ka.fx.val(ca);ka.fy.val(ja);T.setAttribute("fx",ca);T.setAttribute("fy",ja);d()}la.preventDefault()},Cb=function(){Ya=null;S.unbind("mousemove",bb).unbind("mouseup",Cb)};xa=W.getElementsByTagNameNS(p.svg,"stop");if(ua<2){for(;ua<2;){W.appendChild(document.createElementNS(p.svg,"stop"));++ua}xa=W.getElementsByTagNameNS(p.svg,"stop")}var ua=xa.length;for(na=0;na99.5)O=99.5;if(O>0)Ma=1-O/100;else hb=-(O/100)-1;T=145*((O+100)/ +2)/100;ea&&d();break;case "angle":Ta=O;T=Ta/180;T+=0.5;T*=145;ea&&d()}if(T>145)T=145;else if(T<0)T=0;ja.css({"margin-left":T-5})}).change()});var ub=function(la){var ca=la.pageX-gb.offset.left-parseInt(gb.parent.css("border-left-width"));if(ca>145)ca=145;if(ca<=0)ca=0;var ja=ca-5;ca/=145;switch(gb.type){case "radius":ca=Math.pow(ca*2,2.5);if(ca>0.98&&ca<1.02)ca=1;if(ca<=0.01)ca=0.01;W.setAttribute("r",ca);break;case "opacity":q.paint.alpha=parseInt(ca*100);ta.setAttribute("fill-opacity",ca);break; +case "ellip":Ma=hb=1;if(ca<0.5){ca/=0.5;hb=ca<=0?0.01:ca}else if(ca>0.5){ca/=0.5;ca=2-ca;Ma=ca<=0?0.01:ca}d();ca-=1;if(Ma===ca+1)ca=Math.abs(ca);break;case "angle":ca-=0.5;Ta=ca*=180;d();ca/=100}gb.elem.css({"margin-left":ja});ca=Math.round(ca*100);gb.input.val(ca);la.preventDefault()},vb=function(){S.unbind("mousemove",ub).unbind("mouseup",vb);gb=null};for(P=(q.paint.alpha*255/100).toString(16);P.length<2;)P="0"+P;P=P.split(".")[0];I=q.paint.solidColor=="none"?"":q.paint.solidColor+P;ra||(I=xa[0].getAttribute("stop-color")); +$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});Y.jPicker({window:{title:B.window.pickerTitle},images:{clientPath:B.images.clientPath},color:{active:I,alphaSupport:true}},function(la){q.paint.type="solidColor";q.paint.alpha=la.val("ahex")?Math.round(la.val("a")/255*100):100;q.paint.solidColor=la.val("hex")?la.val("hex"):"none";q.paint.radialGradient=null;U()},null,function(){M()});var xb=$(J+" .jGraduate_tabs li");xb.on("click touchstart",function(){xb.removeClass("jGraduate_tab_current"); +$(this).addClass("jGraduate_tab_current");$(J+" > div").hide();var la=$(this).attr("data-type");$(J+" .jGraduate_gradPick").show();if(la==="rg"||la==="lg"){$(".jGraduate_"+la+"_field").show();$(".jGraduate_"+(la==="lg"?"rg":"lg")+"_field").hide();$("#"+o+"_jgraduate_rect")[0].setAttribute("fill","url(#"+o+"_"+la+"_jgraduate_grad)");ba=la==="lg"?"linearGradient":"radialGradient";$("#"+o+"_jGraduate_OpacInput").val(q.paint.alpha).change();var ca=$("#"+o+"_"+la+"_jgraduate_grad")[0];if(W!==ca){var ja= +$(W).find("stop");$(ca).empty().append(ja);W=ca;ca=tb.val();W.setAttribute("spreadMethod",ca)}kb=la==="rg"&&W.getAttribute("fx")!=null&&!(Ga==Da&&Ja==La);$("#"+o+"_jGraduate_focusCoord").toggle(kb);if(kb)$("#"+o+"_jGraduate_match_ctr")[0].checked=false}else{$(J+" .jGraduate_gradPick").hide();$(J+" .jGraduate_colPick").show()}});$(J+" > div").hide();xb.removeClass("jGraduate_tab_current");var Ab;switch(q.paint.type){case "linearGradient":Ab=$(J+" .jGraduate_tab_lingrad");break;case "radialGradient":Ab= +$(J+" .jGraduate_tab_radgrad");break;default:Ab=$(J+" .jGraduate_tab_color")}q.show();setTimeout(function(){Ab.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),p=$(document);$.extend($.fn,{contextMenu:function(g,c){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var m=$(this),s=$(m).offset(),b=$("#"+g.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(k){var q=$(this);q.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| +g.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(k,d,q)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var k=$(this);k.unbind("mouseup");f(d,d,k)});var f=function(d,k,q){if(typeof k=="undefined")k=d;d.stopPropagation();if(m.hasClass("disabled")||k.altKey)return false;var B=d.pageX,o=d.pageY;if(svgedit.browser.isTouch()){B=d.originalEvent.touches[0].pageX;o=d.originalEvent.touches[0].pageY}d=a.width()-b.width();k=a.height()-b.height();if(B>d-15)B=d-15; +if(o>k-30)o=k-30;if(svgedit.browser.isTouch())o-=b.height()/2;p.unbind("click");b.css({top:o,left:B}).fadeIn(g.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});p.keypress(function(J){switch(J.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover"); +break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:p.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){p.unbind("click").unbind("keypress");$(".contextMenu").hide();c&&c($(this).attr("href").substr(1), +$(q),{x:B-s.left,y:o-s.top,docX:B,docY:o});return false});setTimeout(function(){p.click(function(){p.unbind("click").unbind("keypress");b.fadeOut(g.outSpeed);return false})},0)};if($.browser.mozilla)$("#"+g.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+g.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+g.menu).each(function(){$(this).bind("mousedown.disableTextSelect",function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu", +function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var c=g.split(","),m=0;m=0,s=p.indexOf("Gecko/")>=0,b=p.indexOf("MSIE")>=0,f=p.indexOf("Chrome/")>=0,d=p.indexOf("Windows")>=0,k=p.indexOf("Macintosh")>= +0,q="ontouchstart"in window,B=!!g.querySelector,o=!!document.evaluate,J=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,10");var ga=qa.pathSegList;qa=qa.createSVGPathSegLinetoAbs(5,5);try{ga.replaceItem(qa,0);return true}catch(ba){}return false}(),U=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,10");var ga=qa.pathSegList;qa=qa.createSVGPathSegLinetoAbs(5,5);try{ga.insertItemBefore(qa, +0);return true}catch(ba){}return false}(),M=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","svg"),ga=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(qa);ga.setAttribute("x",5);qa.appendChild(ga);var ba=document.createElementNS("http://www.w3.org/2000/svg","text");ba.textContent="a";ga.appendChild(ba);ga=ba.getStartPositionOfChar(0).x;document.documentElement.removeChild(qa);return ga===0}(),I=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg", +"svg");document.documentElement.appendChild(qa);var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M0,0 C0,0 10,10 10,0");qa.appendChild(ga);ga=ga.getBBox();document.documentElement.removeChild(qa);return ga.height>4&&ga.height<5}(),S=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(qa);var ga=document.createElementNS("http://www.w3.org/2000/svg","path");ga.setAttribute("d","M0,0 10,0");var ba= +document.createElementNS("http://www.w3.org/2000/svg","path");ba.setAttribute("d","M5,0 15,0");var W=document.createElementNS("http://www.w3.org/2000/svg","g");W.appendChild(ga);W.appendChild(ba);qa.appendChild(W);ga=W.getBBox();document.documentElement.removeChild(qa);return ga.width==15}(),Y=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect");qa.setAttribute("x",0.1);(qa=qa.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); +return qa}(),P=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect");qa.setAttribute("style","vector-effect:non-scaling-stroke");return qa.style.vectorEffect==="non-scaling-stroke"}(),ia=function(){var qa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ga=g.createSVGTransform();qa.appendItem(ga);return qa.getItem(0)==ga}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return s}; +svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return k};svgedit.browser.isTouch=function(){return q};svgedit.browser.supportsSelectors=function(){return B};svgedit.browser.supportsXpath=function(){return o};svgedit.browser.supportsPathReplaceItem=function(){return J};svgedit.browser.supportsPathInsertItemBefore=function(){return U};svgedit.browser.supportsPathBBox=function(){return I}; +svgedit.browser.supportsHVLineContainerBBox=function(){return S};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return Y};svgedit.browser.supportsNonScalingStroke=function(){return P};svgedit.browser.supportsNativeTransformLists=function(){return ia}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; +(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),p={};svgedit.transformlist.SVGTransformList=function(g){this._elem=g||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,m){var s=null;if(m>=0)if(m=0){this._removeFromOtherLists(c);s=this._xforms[m]=c;this._list._update()}return s};this.removeItem=function(c){if(c=0){for(var m=this._xforms[c],s=Array(this.numberOfItems- +1),b=0;b1;)c=p[g-1].multiply(c);if(Math.abs(c.a)<1.0E-14)c.a=0;if(Math.abs(c.b)<1.0E-14)c.b=0;if(Math.abs(c.c)<1.0E-14)c.c=0;if(Math.abs(c.d)< -1.0E-14)c.d=0;if(Math.abs(c.e)<1.0E-14)c.e=0;if(Math.abs(c.f)<1.0E-14)c.f=0;return c};svgedit.math.hasMatrixTransform=function(p){if(!p)return false;for(var g=p.numberOfItems;g--;){var c=p.getItem(g);if(c.type==1&&!svgedit.math.isIdentity(c.matrix))return true}return false};svgedit.math.transformBox=function(p,g,c,n,s){var b={x:p,y:g},f={x:p+c,y:g};c={x:p+c,y:g+n};p={x:p,y:g+n};g=svgedit.math.transformPoint;b=g(b.x,b.y,s);var d=n=b.x,m=b.y,q=b.y;f=g(f.x,f.y,s);n=Math.min(n,f.x);d=Math.max(d,f.x); -m=Math.min(m,f.y);q=Math.max(q,f.y);p=g(p.x,p.y,s);n=Math.min(n,p.x);d=Math.max(d,p.x);m=Math.min(m,p.y);q=Math.max(q,p.y);c=g(c.x,c.y,s);n=Math.min(n,c.x);d=Math.max(d,c.x);m=Math.min(m,c.y);q=Math.max(q,c.y);return{tl:b,tr:f,bl:p,br:c,aabox:{x:n,y:m,width:d-n,height:q-m}}};svgedit.math.transformListToTransform=function(p,g,c){if(p==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());g=g==undefined?0:g;c=c==undefined?p.numberOfItems-1:c;g=parseInt(g);c=parseInt(c);if(g>c){var n=c;c=g; -g=n}n=a.createSVGMatrix();for(g=g;g<=c;++g){var s=g>=0&&gc){var m=c;c=g; +g=m}m=a.createSVGMatrix();for(g=g;g<=c;++g){var s=g>=0&&gp.x&&g.yp.y}})();svgedit=svgedit||{}; -(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],p=["y","y1","cy","ry","height"],g=$.merge(["r","radius"],a);$.merge(g,p);var c,n={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("width","1em");f.setAttribute("height","1ex");f.setAttribute("x","1in");b.appendChild(f);f=f.getBBox();document.body.removeChild(b); -b=f.x;n.em=f.width;n.ex=f.height;n["in"]=b;n.cm=b/2.54;n.mm=b/25.4;n.pt=b/72;n.pc=b/6;n["%"]=0};svgedit.units.getTypeMap=function(){return n};svgedit.units.shortFloat=function(b){var f=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(f);return parseFloat(b).toFixed(f)-0};svgedit.units.convertUnit=function(b,f){f=f||c.getBaseUnit();return svgedit.unit.shortFloat(b/n[f])};svgedit.units.setUnitAttr=function(b, -f,d){isNaN(d)||b.getAttribute(f);b.setAttribute(f,d)};var s={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var f=b.tagName,d=c.getBaseUnit();if(f=s[f])for(var m=f.length,q=0;q=0?d*m:p.indexOf(b)>=0?d*q:d*Math.sqrt(m*m+q*q)/Math.sqrt(2)}else{m=f.substr(-2);d=f.substr(0,f.length-2);return d*n[m]}};svgedit.units.isValidUnit=function(b,f,d){var m=false;if(g.indexOf(b)>=0)if(isNaN(f)){f=f.toLowerCase();$.each(n,function(o){if(!m)if(RegExp("^-?[\\d\\.]+"+o+"$").test(f))m=true})}else m=true;else if(b=="id"){b=false;try{var q=c.getElement(f); -b=q==null||q===d}catch(B){}return b}else m=true;return m}})();svgedit=svgedit||{}; -(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(f){}var d=$.data(b,"ref"),m=null;if(d){var q=$(d).children().clone().attr("visibility","hidden");$(s).append(q);m=q.filter("line, path")}else m=$(b).find("line, path");var B=false;if(m.length){m.each(function(){var o=this.getBBox();if(!o.width||!o.height)B=true});if(B){b=d?q:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();d&&q.remove();return ret}if(!svgedit.utilities)svgedit.utilities= -{};var p="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,c=null,n=null,s=null;svgedit.utilities.init=function(b){g=b;c=b.getDOMDocument();n=b.getDOMContainer();s=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

    ").text(b).html()};svgedit.utilities.fromXml=function(b){return $("

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); -var f=Array(Math.floor((b.length+2)/3)*4),d,m,q,B,o,K,S=0,M=0;do{d=b.charCodeAt(S++);m=b.charCodeAt(S++);q=b.charCodeAt(S++);B=d>>2;d=(d&3)<<4|m>>4;o=(m&15)<<2|q>>6;K=q&63;if(isNaN(m))o=K=64;else if(isNaN(q))K=64;f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(B);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(o);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(K)}while(S< -b.length);return f.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var f="",d,m,q="",B,o="",K=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++));o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(K++)); -d=d<<2|m>>4;m=(m&15)<<4|B>>2;q=(B&3)<<6|o;f+=String.fromCharCode(d);if(B!=64)f+=String.fromCharCode(m);if(o!=64)f+=String.fromCharCode(q)}while(K127)f+="&#"+m+";"}return f};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var d=window.DOMParser? -new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(m){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(b)?d:false:d.parseFromString(b,"text/xml")}catch(q){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,f){if(b&&b.nodeType==1){f(b);for(var d=b.childNodes.length;d--;)svgedit.utilities.walkTree(b.childNodes.item(d),f)}}; +(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],p=["y","y1","cy","ry","height"],g=$.merge(["r","radius"],a);$.merge(g,p);var c,m={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("width","1em");f.setAttribute("height","1ex");f.setAttribute("x","1in");b.appendChild(f);f=f.getBBox();document.body.removeChild(b); +b=f.x;m.em=f.width;m.ex=f.height;m["in"]=b;m.cm=b/2.54;m.mm=b/25.4;m.pt=b/72;m.pc=b/6;m["%"]=0};svgedit.units.getTypeMap=function(){return m};svgedit.units.shortFloat=function(b){var f=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(f);return parseFloat(b).toFixed(f)-0};svgedit.units.convertUnit=function(b,f){f=f||c.getBaseUnit();return svgedit.unit.shortFloat(b/m[f])};svgedit.units.setUnitAttr=function(b, +f,d){isNaN(d)||b.getAttribute(f);b.setAttribute(f,d)};var s={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var f=b.tagName,d=c.getBaseUnit();if(f=s[f])for(var k=f.length,q=0;q=0?d*k:p.indexOf(b)>=0?d*q:d*Math.sqrt(k*k+q*q)/Math.sqrt(2)}else{k=f.substr(-2);d=f.substr(0,f.length-2);return d*m[k]}};svgedit.units.isValidUnit=function(b,f,d){var k=false;if(g.indexOf(b)>=0)if(isNaN(f)){f=f.toLowerCase();$.each(m,function(o){if(!k)if(RegExp("^-?[\\d\\.]+"+o+"$").test(f))k=true})}else k=true;else if(b=="id"){b=false;try{var q=c.getElement(f); +b=q==null||q===d}catch(B){}return b}else k=true;return k}})();svgedit=svgedit||{}; +(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(f){}var d=$.data(b,"ref"),k=null;if(d){var q=$(d).children().clone().attr("visibility","hidden");$(s).append(q);k=q.filter("line, path")}else k=$(b).find("line, path");var B=false;if(k.length){k.each(function(){var o=this.getBBox();if(!o.width||!o.height)B=true});if(B){b=d?q:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();d&&q.remove();return ret}if(!svgedit.utilities)svgedit.utilities= +{};var p="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,c=null,m=null,s=null;svgedit.utilities.init=function(b){g=b;c=b.getDOMDocument();m=b.getDOMContainer();s=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

    ").text(b).html()};svgedit.utilities.fromXml=function(b){return $("

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); +var f=Array(Math.floor((b.length+2)/3)*4),d,k,q,B,o,J,U=0,M=0;do{d=b.charCodeAt(U++);k=b.charCodeAt(U++);q=b.charCodeAt(U++);B=d>>2;d=(d&3)<<4|k>>4;o=(k&15)<<2|q>>6;J=q&63;if(isNaN(k))o=J=64;else if(isNaN(q))J=64;f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(B);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(o);f[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(J)}while(U< +b.length);return f.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var f="",d,k,q="",B,o="",J=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(J++));k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(J++));B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(J++));o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(J++)); +d=d<<2|k>>4;k=(k&15)<<4|B>>2;q=(B&3)<<6|o;f+=String.fromCharCode(d);if(B!=64)f+=String.fromCharCode(k);if(o!=64)f+=String.fromCharCode(q)}while(J127)f+="&#"+k+";"}return f};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var d=window.DOMParser? +new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(k){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(b)?d:false:d.parseFromString(b,"text/xml")}catch(q){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,f){if(b&&b.nodeType==1){f(b);for(var d=b.childNodes.length;d--;)svgedit.utilities.walkTree(b.childNodes.item(d),f)}}; svgedit.utilities.walkTreePost=function(b,f){if(b&&b.nodeType==1){for(var d=b.childNodes.length;d--;)svgedit.utilities.walkTree(b.childNodes.item(d),f);f(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){return b.getAttributeNS("http://www.w3.org/1999/xlink", -"href")};svgedit.utilities.setHref=function(b,f){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(b){b=g.getSVGContent().documentElement;var f=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var f=b.pathSegList,d=f.numberOfItems;b=[[],[]];var m=f.getItem(0), -q=[m.x,m.y];for(m=0;m0?f[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var f=b.pathSegList,d=f.numberOfItems;b=[[],[]];var k=f.getItem(0), +q=[k.x,k.y];for(k=0;k= -0){var m=d.split(":");b[m[1]]=p[m[0]]}else b[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[n]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(n){if(n.nodeType==3){n.nodeValue=n.nodeValue.replace(/^\s+|\s+$/g,"");n.nodeValue.length||n.parentNode.removeChild(n)}if(n.nodeType==1){var s=n.parentNode;if(n.ownerDocument&&s){var b=g[n.nodeName],f=c[n.nodeName];if(b!=undefined){for(var d=[],m=n.attributes.length;m--;){var q=n.attributes.item(m),B=q.nodeName, -o=q.localName,K=q.namespaceURI;if(!(f.hasOwnProperty(o)&&K==f[o]&&K!="http://www.w3.org/2000/xmlns/")&&!(K=="http://www.w3.org/2000/xmlns/"&&a[q.nodeValue])){B.indexOf("se:")==0&&d.push([B,q.nodeValue]);n.removeAttributeNS(K,o)}if(svgedit.browser.isGecko())switch(B){case "transform":case "gradientTransform":case "patternTransform":o=q.nodeValue.replace(/(\d)-/g,"$1 -");n.setAttribute(B,o)}if(B=="style"){q=q.nodeValue.split(";");for(B=q.length;B--;){o=q[B].split(":");b.indexOf(o[0])>=0&&n.setAttribute(o[0], -o[1])}n.removeAttribute("style")}}$.each(d,function(S,M){n.setAttributeNS("http://svg-edit.googlecode.com",M[0],M[1])});if((m=svgedit.utilities.getHref(n))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(n.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(n,"");n.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(n.nodeName=="use"&&!svgedit.utilities.getHref(n))s.removeChild(n);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],function(S,M){var J=n.getAttribute(M);if(J)if((J=svgedit.utilities.getUrlFromAttr(J))&&J[0]!=="#"){n.setAttribute(M,"");n.removeAttribute(M)}});for(m=n.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(n.childNodes.item(m))}}else{for(b=[];n.hasChildNodes();)b.push(s.insertBefore(n.firstChild,n));s.removeChild(n);for(m=b.length;m--;)svgedit.sanitize.sanitizeSvg(b[m])}}}}})();svgedit=svgedit||{}; +"height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],semantics:[]},c={};$.each(g,function(m,s){var b={};$.each(s,function(f,d){if(d.indexOf(":")>= +0){var k=d.split(":");b[k[1]]=p[k[0]]}else b[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[m]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(m){if(m.nodeType==3){m.nodeValue=m.nodeValue.replace(/^\s+|\s+$/g,"");m.nodeValue.length||m.parentNode.removeChild(m)}if(m.nodeType==1){var s=m.parentNode;if(m.ownerDocument&&s){var b=g[m.nodeName],f=c[m.nodeName];if(b!=undefined){for(var d=[],k=m.attributes.length;k--;){var q=m.attributes.item(k),B=q.nodeName, +o=q.localName,J=q.namespaceURI;if(!(f.hasOwnProperty(o)&&J==f[o]&&J!="http://www.w3.org/2000/xmlns/")&&!(J=="http://www.w3.org/2000/xmlns/"&&a[q.nodeValue])){B.indexOf("se:")==0&&d.push([B,q.nodeValue]);m.removeAttributeNS(J,o)}if(svgedit.browser.isGecko())switch(B){case "transform":case "gradientTransform":case "patternTransform":o=q.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(B,o)}if(B=="style"){q=q.nodeValue.split(";");for(B=q.length;B--;){o=q[B].split(":");b.indexOf(o[0])>=0&&m.setAttribute(o[0], +o[1])}m.removeAttribute("style")}}$.each(d,function(U,M){m.setAttributeNS("http://svg-edit.googlecode.com",M[0],M[1])});if((k=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(k[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))s.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", +"mask","stroke"],function(U,M){var I=m.getAttribute(M);if(I)if((I=svgedit.utilities.getUrlFromAttr(I))&&I[0]!=="#"){m.setAttribute(M,"");m.removeAttribute(M)}});for(k=m.childNodes.length;k--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(k))}}else{for(b=[];m.hasChildNodes();)b.push(s.insertBefore(m.firstChild,m));s.removeChild(m);for(k=b.length;k--;)svgedit.sanitize.sanitizeSvg(b[k])}}}}})();svgedit=svgedit||{}; (function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,p,g,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=p;this.oldParent=g;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,p){this.elem=a;this.text=p||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= @@ -133,393 +134,394 @@ function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APP this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],p=this.stack.length;p--;)for(var g=this.stack[p].elements(),c=g.length;c--;)a.indexOf(g[c])==-1&&a.push(g[c]);return a};svgedit.history.BatchCommand.prototype.addSubCommand=function(a){this.stack.push(a)};svgedit.history.BatchCommand.prototype.isEmpty=function(){return this.stack.length==0};svgedit.history.UndoManager=function(a){this.handler_=a||null;this.undoStackPointer=0;this.undoStack=[];this.undoChangeStackPointer= -1;this.undoableChangeStack=[]};svgedit.history.UndoManager.prototype.resetUndoStack=function(){this.undoStack=[];this.undoStackPointer=0};svgedit.history.UndoManager.prototype.getUndoStackSize=function(){return this.undoStackPointer};svgedit.history.UndoManager.prototype.getRedoStackSize=function(){return this.undoStack.length-this.undoStackPointer};svgedit.history.UndoManager.prototype.getNextUndoCommandText=function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText(): ""};svgedit.history.UndoManager.prototype.getNextRedoCommandText=function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}; -svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,p){for(var g=++this.undoChangeStackPointer,c=p.length,n=Array(c),s=Array(c);c--;){var b=p[c];if(b!=null){s[c]=b;n[c]=b.getAttribute(a)}}this.undoableChangeStack[g]= -{attrName:a,oldValues:n,elements:s}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,p=this.undoableChangeStack[a],g=p.elements.length,c=p.attrName,n=new svgedit.history.BatchCommand("Change "+c);g--;){var s=p.elements[g];if(s!=null){var b={};b[c]=p.oldValues[g];b[c]!=s.getAttribute(c)&&n.addSubCommand(new svgedit.history.ChangeElementCommand(s,b,c))}}this.undoableChangeStack[a]=null;return n}})();svgedit=svgedit||{}; -(function(){if(!svgedit.select)svgedit.select={};var a,p,g;svgedit.select.Selector=function(c,n){this.id=c;this.selectedElement=n;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity", -0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var n=[];c=Math.round(c/45);if(c<0)c+=8;for(var s in g.selectorGrips)n.push(s);for(;c>0;){n.push(n.shift());c--}c=0;for(s in g.selectorGrips){g.selectorGrips[s].setAttribute("style", -"cursor:"+n[c]+"-resize");c++}};svgedit.select.Selector.prototype.showGrips=function(c){g.selectorGripsGroup.setAttribute("display",c?"inline":"none");var n=this.selectedElement;this.hasGrips=c;if(n&&c){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(n))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,n=g,s=n.selectorGrips,b=this.selectedElement,f=b.getAttribute("stroke-width"),d=a.currentZoom(),m=1/d;if(b.getAttribute("stroke")!== -"none"&&!isNaN(f))m+=f/2;var q=b.tagName;if(q==="text")m+=2/d;f=svgedit.transformlist.getTransformList(b);f=svgedit.math.transformListToTransform(f).matrix;f.e*=d;f.f*=d;var B=svgedit.utilities.getBBox(b);if(q==="g"&&!$.data(b,"gsvg"))if(q=a.getStrokedBBox(b.childNodes))B=q;q=B.x;var o=B.y,K=B.width;B=B.height;m*=d;d=svgedit.math.transformBox(q*d,o*d,K*d,B*d,f);f=d.aabox;q=f.x-m;o=f.y-m;K=f.width+m*2;var S=f.height+m*2;f=q+K/2;B=o+S/2;if(b=svgedit.utilities.getRotationAngle(b)){q=a.svgRoot().createSVGTransform(); -q.setRotate(-b,f,B);q=q.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,q);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,q);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,q);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,q);q=d.tl;K=q.x;S=q.y;var M=q.x,J=q.y;q=Math.min;o=Math.max;K=q(K,q(d.tr.x,q(d.bl.x,d.br.x)))-m;S=q(S,q(d.tr.y,q(d.bl.y,d.br.y)))-m;M=o(M,o(d.tr.x,o(d.bl.x,d.br.x)))+m;J=o(J,o(d.tr.y,o(d.bl.y,d.br.y)))+m;q=K;o=S;K=M-K;S=J-S}m=a.svgRoot().suspendRedraw(100);c.setAttribute("d", -"M"+q+","+o+" L"+(q+K)+","+o+" "+(q+K)+","+(o+S)+" "+q+","+(o+S)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,f,B].join(",")+")":"");if(svgedit.browser.isTouch()){q-=15.75;o-=15.75}else{q-=4;o-=4}this.gripCoords={nw:[q,o].map(Math.round),ne:[q+K,o].map(Math.round),sw:[q,o+S].map(Math.round),se:[q+K,o+S].map(Math.round),n:[q+K/2,o].map(Math.round),w:[q,o+S/2].map(Math.round),e:[q+K,o+S/2].map(Math.round),s:[q+K/2,o+S].map(Math.round)};for(var Q in this.gripCoords){c=this.gripCoords[Q]; -s[Q].setAttribute("x",c[0]);s[Q].setAttribute("y",c[1])}this.rotateCoords={nw:[q,o],ne:[q+K+8,o],sw:[q,o+S+8],se:[q+K+8,o+S+8]};for(Q in this.rotateCoords){c=this.rotateCoords[Q];n.rotateGrips[Q].setAttribute("cx",c[0]);n.rotateGrips[Q].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null}; +svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,p){for(var g=++this.undoChangeStackPointer,c=p.length,m=Array(c),s=Array(c);c--;){var b=p[c];if(b!=null){s[c]=b;m[c]=b.getAttribute(a)}}this.undoableChangeStack[g]= +{attrName:a,oldValues:m,elements:s}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,p=this.undoableChangeStack[a],g=p.elements.length,c=p.attrName,m=new svgedit.history.BatchCommand("Change "+c);g--;){var s=p.elements[g];if(s!=null){var b={};b[c]=p.oldValues[g];b[c]!=s.getAttribute(c)&&m.addSubCommand(new svgedit.history.ChangeElementCommand(s,b,c))}}this.undoableChangeStack[a]=null;return m}})();svgedit=svgedit||{}; +(function(){if(!svgedit.select)svgedit.select={};var a,p,g;svgedit.select.Selector=function(c,m){this.id=c;this.selectedElement=m;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity", +0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var m=[];c=Math.round(c/45);if(c<0)c+=8;for(var s in g.selectorGrips)m.push(s);for(;c>0;){m.push(m.shift());c--}c=0;for(s in g.selectorGrips){g.selectorGrips[s].setAttribute("style", +"cursor:"+m[c]+"-resize");c++}};svgedit.select.Selector.prototype.showGrips=function(c){g.selectorGripsGroup.setAttribute("display",c?"inline":"none");var m=this.selectedElement;this.hasGrips=c;if(m&&c){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(m))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,m=g,s=m.selectorGrips,b=this.selectedElement,f=b.getAttribute("stroke-width"),d=a.currentZoom(),k=1/d;if(b.getAttribute("stroke")!== +"none"&&!isNaN(f))k+=f/2;var q=b.tagName;if(q==="text")k+=2/d;f=svgedit.transformlist.getTransformList(b);f=svgedit.math.transformListToTransform(f).matrix;f.e*=d;f.f*=d;var B=svgedit.utilities.getBBox(b);if(q==="g"&&!$.data(b,"gsvg"))if(q=a.getStrokedBBox(b.childNodes))B=q;q=B.x;var o=B.y,J=B.width;B=B.height;k*=d;d=svgedit.math.transformBox(q*d,o*d,J*d,B*d,f);f=d.aabox;q=f.x-k;o=f.y-k;J=f.width+k*2;var U=f.height+k*2;f=q+J/2;B=o+U/2;if(b=svgedit.utilities.getRotationAngle(b)){q=a.svgRoot().createSVGTransform(); +q.setRotate(-b,f,B);q=q.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,q);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,q);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,q);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,q);q=d.tl;J=q.x;U=q.y;var M=q.x,I=q.y;q=Math.min;o=Math.max;J=q(J,q(d.tr.x,q(d.bl.x,d.br.x)))-k;U=q(U,q(d.tr.y,q(d.bl.y,d.br.y)))-k;M=o(M,o(d.tr.x,o(d.bl.x,d.br.x)))+k;I=o(I,o(d.tr.y,o(d.bl.y,d.br.y)))+k;q=J;o=U;J=M-J;U=I-U}k=a.svgRoot().suspendRedraw(100);c.setAttribute("d", +"M"+q+","+o+" L"+(q+J)+","+o+" "+(q+J)+","+(o+U)+" "+q+","+(o+U)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,f,B].join(",")+")":"");if(svgedit.browser.isTouch()){q-=15.75;o-=15.75}else{q-=4;o-=4}this.gripCoords={nw:[q,o].map(Math.round),ne:[q+J,o].map(Math.round),sw:[q,o+U].map(Math.round),se:[q+J,o+U].map(Math.round),n:[q+J/2,o].map(Math.round),w:[q,o+U/2].map(Math.round),e:[q+J,o+U/2].map(Math.round),s:[q+J/2,o+U].map(Math.round)};for(var S in this.gripCoords){c=this.gripCoords[S]; +s[S].setAttribute("x",c[0]);s[S].setAttribute("y",c[1])}this.rotateCoords={nw:[q,o],ne:[q+J+8,o],sw:[q,o+U+8],se:[q+J+8,o+U+8]};for(S in this.rotateCoords){c=this.rotateCoords[S];m.rotateGrips[S].setAttribute("cx",c[0]);m.rotateGrips[S].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(k)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null}; this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup); -a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var n=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+p.imgPath+"rotate.png) 12 12, auto;"}});$.data(n,"dir",c);$.data(n,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(n)}for(c in this.selectorGrips){n=a.createSVGElement({element:"rect", -attr:{id:"selectorGrip_resize_"+c,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+c+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){n.setAttribute("width",30.5);n.setAttribute("height",30.5);n.setAttribute("fill-opacity",0.3)}$.data(n,"dir",c);$.data(n,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(n)}if(!$("#canvasBackground").length){c=p.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground", -width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});n=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var s=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),b=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),f=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}), -d=a.createSVGElement({element:"rect",attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),m=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});c.appendChild(n);n.appendChild(s);s.appendChild(b);s.appendChild(f);s.appendChild(d);c.appendChild(m);a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var n=this.selectors.length; -if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var s=0;s element";this.svgElem_=c;this.obj_num=0;this.idPrefix=n||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= +a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var m=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+p.imgPath+"rotate.png) 12 12, auto;"}});$.data(m,"dir",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect", +attr:{id:"selectorGrip_resize_"+c,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+c+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){m.setAttribute("width",30.5);m.setAttribute("height",30.5);m.setAttribute("fill-opacity",0.3)}$.data(m,"dir",c);$.data(m,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=p.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground", +width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});m=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var s=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),b=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),f=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}), +d=a.createSVGElement({element:"rect",attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),k=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});c.appendChild(m);m.appendChild(s);s.appendChild(b);s.appendChild(f);s.appendChild(d);c.appendChild(k);a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var m=this.selectors.length; +if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var s=0;s element";this.svgElem_=c;this.obj_num=0;this.idPrefix=m||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= "";var s=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(s&&g!=p.NEVER_RANDOMIZE)this.nonce_=s;else g==p.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(c){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+c):$(this.svgElem_).find("[id="+c+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_}; svgedit.draw.Drawing.prototype.setNonce=function(c){this.svgElem_.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:se","http://svg-edit.googlecode.com");this.svgElem_.setAttributeNS("http://svg-edit.googlecode.com","se:nonce",c);this.nonce_=c};svgedit.draw.Drawing.prototype.clearNonce=function(){this.nonce_=""};svgedit.draw.Drawing.prototype.getId=function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num};svgedit.draw.Drawing.prototype.getNextId=function(){var c= -this.obj_num,n=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();n=true}else this.obj_num++;for(var s=this.getId();this.getElem_(s);){if(n){this.obj_num=c;n=false}this.obj_num++;s=this.getId()}if(n)this.obj_num=c;return s};svgedit.draw.Drawing.prototype.releaseId=function(c){var n=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof c!="string"||c.indexOf(n)!=0)return false;c=parseInt(c.substr(n.length));if(typeof c!="number"||c<=0||this.releasedNums.indexOf(c)!=-1)return false; -this.releasedNums.push(c);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(c){for(var n=0;n=0&&c1){var c=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return c}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var c=this.svgElem_.childNodes.length,n=[],s=[],b=null,f=false,d=0;d0||!f){for(d=1;s.indexOf("Layer "+d)>=0;)d++;s="Layer "+d;b=c.createElementNS("http://www.w3.org/2000/svg","g");f=c.createElementNS("http://www.w3.org/2000/svg","title");f.textContent=s; -b.appendChild(f);for(f=0;f1))for(var s=0;s0){f=S element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f= -this.elem.pathSegList,d=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var m=0;m=d?null:f[m+1],K=m-1<0?null:f[m-1];if(B.type===2){if(K&&K.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip()}q=m}else if(o&&o.type===1){B.next=f[q+1];B.next.prev=B;B.mate=f[q];B.addGrip();if(this.first_seg==null)this.first_seg=B}else if(o){if(B.type!== -1){B.addGrip();if(o&&o.type!==2){B.next=o;B.next.prev=B}}}else if(B.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip();B.addGrip();if(!this.first_seg)this.first_seg=f[q]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var d=this.segs.length,m=0;m0){this.obj_num=this.releasedNums.pop();m=true}else this.obj_num++;for(var s=this.getId();this.getElem_(s);){if(m){this.obj_num=c;m=false}this.obj_num++;s=this.getId()}if(m)this.obj_num=c;return s};svgedit.draw.Drawing.prototype.releaseId=function(c){var m=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof c!="string"||c.indexOf(m)!=0)return false;c=parseInt(c.substr(m.length));if(typeof c!="number"||c<=0||this.releasedNums.indexOf(c)!=-1)return false; +this.releasedNums.push(c);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(c){for(var m=0;m=0&&c1){var c=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return c}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var c=this.svgElem_.childNodes.length,m=[],s=[],b=null,f=false,d=0;d0||!f){for(d=1;s.indexOf("Layer "+d)>=0;)d++;s="Layer "+d;b=c.createElementNS("http://www.w3.org/2000/svg","g");f=c.createElementNS("http://www.w3.org/2000/svg","title");f.textContent=s; +b.appendChild(f);for(f=0;f1))for(var s=0;s0){f=U element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f=this.elem.pathSegList,d=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var k=0;k=d?null:f[k+1],J=k-1<0?null:f[k-1];if(B.type===2){if(J&&J.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip()}q=k}else if(o&&o.type===1){B.next=f[q+1];B.next.prev=B;B.mate=f[q];B.addGrip();if(this.first_seg==null)this.first_seg=B}else if(o){if(B.type!==1){B.addGrip();if(o&&o.type!==2){B.next=o;B.next.prev=B}}}else if(B.type!==1){o=f[q];o.next=f[q+1];o.next.prev=o;o.addGrip();B.addGrip();if(!this.first_seg)this.first_seg= +f[q]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var d=this.segs.length,k=0;k').documentElement, -true);a.appendChild(d);var m=f.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;m.firstChild;)m.removeChild(m.firstChild);$(m).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:n.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(e)})();var q="svg_";b.setIdPrefix= -function(e){q=e};b.current_drawing_=new svgedit.draw.Drawing(m,q);var B=b.getCurrentDrawing=function(){return b.current_drawing_},o=1,K=null,S={shape:{fill:(n.initFill.color=="none"?"":"#")+n.initFill.color,fill_paint:null,fill_opacity:n.initFill.opacity,stroke:"#"+n.initStroke.color,stroke_paint:null,stroke_opacity:n.initStroke.opacity,stroke_width:n.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:n.initOpacity}};S.text=$.extend(true,{},S.shape);$.extend(S.text, -{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=S.shape,J=Array(1),Q=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=B().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(c,e.element);if(l)(K||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin, +$.SvgCanvas=function(a,p){function g(e,h){for(var l=svgedit.utilities.getBBox(e),z=0;z<2;z++){var v=z===0?"fill":"stroke",G=e.getAttribute(v);if(G&&G.indexOf("url(")===0){G=T(G);if(G.tagName==="linearGradient"){var A=G.getAttribute("x1")||0,u=G.getAttribute("y1")||0,F=G.getAttribute("x2")||1,H=G.getAttribute("y2")||0;A=l.width*A+l.x;u=l.height*u+l.y;F=l.width*F+l.x;H=l.height*H+l.y;A=P(A,u,h);H=P(F,H,h);F={};F.x1=(A.x-l.x)/l.width;F.y1=(A.y-l.y)/l.height;F.x2=(H.x-l.x)/l.width;F.y2=(H.y-l.y)/l.height; +G=G.cloneNode(true);$(G).attr(F);G.id=ja();mb().appendChild(G);e.setAttribute(v,"url(#"+G.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};p&&$.extend(m,p);var s=m.dimensions,b=this,f=a.ownerDocument,d=f.importNode(svgedit.utilities.text2xml('').documentElement, +true);a.appendChild(d);var k=f.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;k.firstChild;)k.removeChild(k.firstChild);$(k).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:m.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");k.appendChild(e)})();var q="svg_";b.setIdPrefix= +function(e){q=e};b.current_drawing_=new svgedit.draw.Drawing(k,q);var B=b.getCurrentDrawing=function(){return b.current_drawing_},o=1,J=null,U={shape:{fill:(m.initFill.color=="none"?"":"#")+m.initFill.color,fill_paint:null,fill_opacity:m.initFill.opacity,stroke:"#"+m.initStroke.color,stroke_paint:null,stroke_opacity:m.initStroke.opacity,stroke_width:m.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:m.initOpacity}};U.text=$.extend(true,{},U.shape);$.extend(U.text, +{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=U.shape,I=Array(1),S=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=B().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(c,e.element);if(l)(J||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin, "stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},Y=b.getTransformList=svgedit.transformlist.getTransformList,P=svgedit.math.transformPoint,ia=b.matrixMultiply=svgedit.math.matrixMultiply,qa=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ga=b.transformListToTransform=svgedit.math.transformListToTransform, -U=svgedit.math.snapToAngle,ba=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return n.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/o},getWidth:function(){return m.getAttribute("width")/o},getRoundDigits:function(){return fb.round_digits}});var xa=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return J}, -getSVGContent:function(){return m}});var ka=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,da=b.getHref=svgedit.utilities.getHref,W=b.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var oa=b.getRotationAngle=svgedit.utilities.getRotationAngle,pa=b.getElem=svgedit.utilities.getElem,na=b.assignAttributes=svgedit.utilities.assignAttributes,ma=this.cleanupElement=svgedit.utilities.cleanupElement,za=svgedit.sanitize.getNSMap(),Ha=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, -Fa=svgedit.history.MoveElementCommand,Ia=svgedit.history.InsertElementCommand,La=svgedit.history.RemoveElementCommand,Ka=svgedit.history.ChangeElementCommand,Ea=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,h){var l=svgedit.history.HistoryEventTypes;if(e==l.BEFORE_UNAPPLY||e==l.BEFORE_APPLY)b.clearSelection();else if(e==l.AFTER_APPLY||e==l.AFTER_UNAPPLY){var z=h.elements();b.pathActions.clear();N("changed",z);z=h.type();l=e==l.AFTER_APPLY;if(z== -Fa.type()){l=l?h.newParent:h.oldParent;l==m&&b.identifyLayers()}else if(z==Ia.type()||z==La.type()){h.parent==m&&b.identifyLayers();if(z==Ia.type())l&&Qa(h.elem);else l||Qa(h.elem);h.elem.tagName==="use"&&Kb(h.elem)}else if(z==Ka.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==m&&b.identifyLayers();l=l?h.newValues:h.oldValues;l.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,l.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){z=h.elem;if(!z.getAttribute("x")&&!z.getAttribute("y")){l= -z.parentNode;var w=z.nextSibling;l.removeChild(z);l.insertBefore(z,w)}}}}}});var ya=function(e){b.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return b.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return m},currentZoom:function(){return o},getStrokedBBox:function(e){return b.getStrokedBBox([e])}});var Ca=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return o},getSVGRoot:function(){return d}}); -svgedit.utilities.snapToGrid=function(e){var h=n.snappingStep,l=n.baseUnit;if(l!=="px")h*=svgedit.units.getTypeMap()[l];return e=Math.round(e/h)*h};var wa=svgedit.utilities.snapToGrid,Va={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear",exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},yb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ib=$.data, -Qa=function(e){var h=$(e).attr(yb),l;for(l in h){var z=h[l];if(z&&z.indexOf("url(")===0){z=ka(z).substr(1);if(!pa(z)){mb().appendChild(vb[z]);delete vb[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(l=e.length;h=0)D=G=b.convertToPath(I,true);else if(I.tagName=="rect"){var L=I.getAttribute("rx"),k=I.getAttribute("ry");if(L||k)D=G=b.convertToPath(I,true)}if(!G){var u=I.cloneNode(true),C=document.createElementNS(c,"g"),F=I.parentNode;F.appendChild(C);C.appendChild(u);D=svgedit.utilities.bboxToObj(C.getBBox());F.removeChild(C)}}return D}catch(O){console.log(I,O);return null}},l;$.each(e,function(){if(!l)if(this.parentNode)l=h(this)}); -if(l==null)return null;var z=l.x+l.width,w=l.y+l.height,H=l.x,A=l.y,v=function(I){var D=I.getAttribute("stroke-width"),G=0;if(I.getAttribute("stroke")!="none"&&!isNaN(D))G+=D/2;return G},E=[];$.each(e,function(I,D){var G=h(D);if(G){var L=v(D);H=Math.min(H,G.x-L);A=Math.min(A,G.y-L);E.push(G)}});l.x=H;l.y=A;$.each(e,function(I,D){var G=E[I];if(G&&D.nodeType==1){var L=v(D);z=Math.max(z,G.x+G.width+L);w=Math.max(w,G.y+G.height+L)}});l.width=z-H;l.height=w-A;return l};var pb=this.getVisibleElements=function(e){e|| -(e=$(m).children());e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(l,z){try{z.getBBox()&&h.push(z)}catch(w){}});return h.reverse()},Ab=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(m).children());var h=[];$(e).children().each(function(l,z){try{z.getBBox()&&h.push({elem:z,bbox:getStrokedBBox([z])})}catch(w){}});return h.reverse()},Bb=this.groupSvgElem=function(e){var h=document.createElementNS(c,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg", -e)[0].id=la()},ja=function(e){var h=document.createElementNS(e.namespaceURI,e.nodeName);h.removeAttribute("id");$.each(e.attributes,function(z,w){w.localName!="-moz-math-font-style"&&h.setAttributeNS(w.namespaceURI,w.nodeName,w.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var l=Ja.convertPath(e);h.setAttribute("d",l)}$.each(e.childNodes,function(z,w){switch(w.nodeType){case 1:h.appendChild(ja(w));break;case 3:h.textContent=w.nodeValue}});if($(e).data("gsvg"))$(h).data("gsvg",h.firstChild); -else if($(e).data("symbol")){e=$(e).data("symbol");$(h).data("ref",e).data("symbol",e)}else h.tagName=="image"&&Ib(h);h.id=la();return h},ca,la,N;(function(e){var h={};ca=e.getId=function(){return B().getId()};la=e.getNextId=function(){return B().getNextId()};N=e.call=function(l,z){if(h[l])return h[l](this,z)};e.bind=function(l,z){var w=h[l];h[l]=z;return w}})(b);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(c,"path");for(var h=0,l=e.length;h -0&&w.getItem(0).type==4&&w.removeItem(0);if(e!=0){H=P(H,A,ga(w).matrix);A=d.createSVGTransform();A.setRotate(e,H.x,H.y);w.numberOfItems?w.insertItemBefore(A,0):w.appendItem(A)}else w.numberOfItems==0&&l.removeAttribute("transform");if(!h){w=l.getAttribute("transform");l.setAttribute("transform",z);hb("transform",w,J);N("changed",J)}pa("pathpointgrip_container");l=Ca.requestSelector(J[0]);l.resize();l.updateGripCursors(e)};var Ga=this.recalculateAllSelectedDimensions=function(){for(var e=new Ea(jb== -"none"?"position":"size"),h=J.length;h--;){var l=Wa(J[h]);l&&e.addSubCommand(l)}if(!e.isEmpty()){ya(e);N("changed",J)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Xa=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},bb=this.remapElement=function(e,h,l){var z=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",w=function(){if(z)for(var G in h)h[G]=wa(h[G]);na(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var H=0;H<2;H++){var A=H===0?"fill":"stroke", -v=e.getAttribute(A);if(v&&v.indexOf("url(")===0)if(l.a<0||l.d<0){v=R(v).cloneNode(true);if(l.a<0){var E=v.getAttribute("x1"),I=v.getAttribute("x2");v.setAttribute("x1",-(E-1));v.setAttribute("x2",-(I-1))}if(l.d<0){E=v.getAttribute("y1");I=v.getAttribute("y2");v.setAttribute("y1",-(E-1));v.setAttribute("y2",-(I-1))}v.id=la();mb().appendChild(v);e.setAttribute(A,"url(#"+v.id+")")}}H=e.tagName;if(H==="g"||H==="text"||H==="use")if(l.a==1&&l.b==0&&l.c==0&&l.d==1&&(l.e!=0||l.f!=0)){A=ga(e).matrix;A=ia(A.inverse(), -l,A);h.x=parseFloat(h.x)+A.e;h.y=parseFloat(h.y)+A.f}else{A=Y(e);v=d.createSVGTransform();v.setMatrix(ia(ga(A).matrix,l));A.clear();A.appendItem(v)}switch(H){case "foreignObject":case "rect":case "image":if(H==="image"&&(l.a<0||l.d<0)){A=Y(e);v=d.createSVGTransform();v.setMatrix(ia(ga(A).matrix,l));A.clear();A.appendItem(v)}else{A=P(h.x,h.y,l);h.width=l.a*h.width;h.height=l.d*h.height;h.x=A.x+Math.min(0,h.width);h.y=A.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}w(); -break;case "ellipse":H=P(h.cx,h.cy,l);h.cx=H.x;h.cy=H.y;h.rx=l.a*h.rx;h.ry=l.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);w();break;case "circle":H=P(h.cx,h.cy,l);h.cx=H.x;h.cy=H.y;H=svgedit.math.transformBox(box.x,box.y,box.width,box.height,l);h.r=Math.min((H.tr.x-H.tl.x)/2,(H.bl.y-H.tl.y)/2);if(h.r)h.r=Math.abs(h.r);w();break;case "line":A=P(h.x1,h.y1,l);E=P(h.x2,h.y2,l);h.x1=A.x;h.y1=A.y;h.x2=E.x;h.y2=E.y;case "text":l=e.querySelectorAll("tspan");for(H=l.length;H--;){A=xa("x",e.getAttribute("x")); -v=xa("x",l[H].getAttribute("x"));E=xa("y",e.getAttribute("y"));I=xa("y",l[H].getAttribute("y"));var D={};if(!isNaN(A)&&!isNaN(v)&&A!=0&&v!=0&&h.x)D.x=h.x-(A-v);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&h.y)D.y=h.y-(E-I);if(D.x||D.y)na(l[H],D,1E3,true)}w();break;case "use":w();break;case "g":(w=$(e).data("gsvg"))&&na(w,h,1E3,true);break;case "polyline":case "polygon":w=h.points.length;for(H=0;H0){for(var l=h.numberOfItems;l--;){var z=h.getItem(l);if(z.type===0)h.removeItem(l);else if(z.type=== -1)svgedit.math.isIdentity(z.matrix)&&h.removeItem(l);else z.type===4&&z.angle===0&&h.removeItem(l)}if(h.numberOfItems===1&&oa(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){l=h.numberOfItems;for(var w=[];l--;){z=h.getItem(l);if(z.type===1)w.push([z.matrix,l]);else if(w.length)w=[]}if(w.length===2){l=d.createSVGTransformFromMatrix(ia(w[1][0],w[0][0]));h.removeItem(w[0][1]);h.removeItem(w[1][1]);h.insertItemBefore(l,w[1][1])}l=h.numberOfItems;if(l>=2&&h.getItem(l- -2).type===1&&h.getItem(l-1).type===2){w=d.createSVGTransform();z=ia(h.getItem(l-2).matrix,h.getItem(l-1).matrix);w.setMatrix(z);h.removeItem(l-2);h.removeItem(l-2);h.appendItem(w)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var H=$(e).data("gsvg");l=new Ea("Transform");var A={},v=null;z=[];switch(e.tagName){case "line":z=["x1","y1", -"x2","y2"];break;case "circle":z=["cx","cy","r"];break;case "ellipse":z=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":z=["width","height","x","y"];break;case "use":case "text":case "tspan":z=["x","y"];break;case "polygon":case "polyline":v={};v.points=e.getAttribute("points");w=e.points;var E=w.numberOfItems;A.points=Array(E);for(var I=0;I1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&h.getItem(k-2).type==3&&h.getItem(k-3).type==2&&h.getItem(k-1).type==2){I=3;var C=h.getItem(k-3).matrix,F=h.getItem(k-2).matrix,O=h.getItem(k-1).matrix;E=e.childNodes;for(D=E.length;D--;){var V=E.item(D);z=H=0;if(V.nodeType==1){var T=Y(V);if(T){z=ga(T).matrix;H=oa(V);var X=Ta,aa=[];Ta=V.getAttribute("transform");if(H||qa(T)){var fa= -d.createSVGTransform();fa.setMatrix(ia(C,F,O,z));T.clear();T.appendItem(fa);aa.push(fa)}else{H=ia(z.inverse(),O,z);fa=d.createSVGMatrix();fa.e=-H.e;fa.f=-H.f;z=ia(fa.inverse(),z.inverse(),C,F,O,z,H.inverse());var ra=d.createSVGTransform(),Pa=d.createSVGTransform(),Da=d.createSVGTransform();ra.setTranslate(H.e,H.f);Pa.setScale(z.a,z.d);Da.setTranslate(fa.e,fa.f);T.appendItem(Da);T.appendItem(Pa);T.appendItem(ra);aa.push(Da);aa.push(Pa);aa.push(ra)}l.addSubCommand(Wa(V));Ta=X}}}h.removeItem(k-1);h.removeItem(k- -2);h.removeItem(k-3)}else if(k>=3&&h.getItem(k-1).type==1){I=3;z=ga(h).matrix;fa=d.createSVGTransform();fa.setMatrix(z);h.clear();h.appendItem(fa)}else if((k==1||k>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){I=2;H=ga(h).matrix;h.removeItem(0);z=ga(h).matrix.inverse();z=ia(z,H);H=z.e;z=z.f;if(H!=0||z!=0){E=e.childNodes;D=E.length;for(k=[];D--;){V=E.item(D);if(V.nodeType==1){if(V.getAttribute("clip-path")){X=V.getAttribute("clip-path");if(k.indexOf(X)===-1){rb(X,H,z);k.push(X)}}X=Ta;Ta=V.getAttribute("transform"); -if(T=Y(V)){C=d.createSVGTransform();C.setTranslate(H,z);T.numberOfItems?T.insertItemBefore(C,0):T.appendItem(C);l.addSubCommand(Wa(V));T=e.getElementsByTagNameNS(c,"use");V="#"+V.id;for(C=T.length;C--;){F=T.item(C);if(V==da(F)){O=d.createSVGTransform();O.setTranslate(-H,-z);Y(F).insertItemBefore(O,0);l.addSubCommand(Wa(F))}}Ta=X}}}k=[];Ta=X}}else if(k==1&&h.getItem(0).type==1&&!w){I=1;z=h.getItem(0).matrix;E=e.childNodes;for(D=E.length;D--;){V=E.item(D);if(V.nodeType==1){X=Ta;Ta=V.getAttribute("transform"); -if(T=Y(V)){H=ia(z,ga(T).matrix);k=d.createSVGTransform();k.setMatrix(H);T.clear();T.appendItem(k,0);l.addSubCommand(Wa(V));Ta=X;X=V.getAttribute("stroke-width");V.getAttribute("stroke")!=="none"&&!isNaN(X)&&V.setAttribute("stroke-width",X*((Math.abs(H.a)+Math.abs(H.d))/2))}}}h.clear()}else{if(w){G=d.createSVGTransform();G.setRotate(w,L.x,L.y);h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(w){L={x:G.x+u.e,y:G.y+u.f}; -G=d.createSVGTransform();G.setRotate(w,L.x,L.y);h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}}else if(I==3){z=ga(h).matrix;u=d.createSVGTransform();u.setRotate(w,G.x,G.y);u=u.matrix;G=d.createSVGTransform();G.setRotate(w,L.x,L.y);L=G.matrix.inverse();X=z.inverse();L=ia(X,L,u,z);H=L.e;z=L.f;if(H!=0||z!=0){E=e.childNodes;for(D=E.length;D--;){V=E.item(D);if(V.nodeType==1){X=Ta;Ta=V.getAttribute("transform");T=Y(V);C=d.createSVGTransform();C.setTranslate(H,z);T.numberOfItems?T.insertItemBefore(C, -0):T.appendItem(C);l.addSubCommand(Wa(V));Ta=X}}}if(w)h.numberOfItems?h.insertItemBefore(G,0):h.appendItem(G)}}else{w=svgedit.utilities.getBBox(e);if(!w&&e.tagName!="path")return null;z=d.createSVGMatrix();if(H=oa(e)){G={x:w.x+w.width/2,y:w.y+w.height/2};L=P(w.x+w.width/2,w.y+w.height/2,ga(h).matrix);I=H*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&h.getItem(k-2).type==3&&h.getItem(k-3).type==2&&h.getItem(k-1).type==2){I=3;z=ga(h,k-3,k-1).matrix;h.removeItem(k-1);h.removeItem(k-2);h.removeItem(k-3)}else if(k== -4&&h.getItem(k-1).type==1){I=3;z=ga(h).matrix;fa=d.createSVGTransform();fa.setMatrix(z);h.clear();h.appendItem(fa);z=d.createSVGMatrix()}else if((k==1||k>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){I=2;u=h.getItem(0).matrix;X=ga(h,1).matrix;w=X.inverse();z=ia(w,u,X);h.removeItem(0)}else if(k==1&&h.getItem(0).type==1&&!H){z=ga(h).matrix;switch(e.tagName){case "line":A=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":A.points=e.getAttribute("points");if(A.points){w=e.points;E=w.numberOfItems; -A.points=Array(E);for(I=0;I1&&w.showGrips(false)}}}N("selected",J);h||J.length==1?Ca.requestSelector(J[0]).showGrips(true):Ca.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)}},Cb=this.selectOnly=function(e,h){Ra(true);ub(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 l=0;l=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,m,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ca.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,l=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 E=v.button===2;qb=m.getScreenCTM().inverse();var I=P(v.pageX,v.pageY,qb),D=I.x*o;I=I.y*o;v.preventDefault();if(E)Ba="select";D=D/o;I=I/o;var G=ob(v);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=D,k=w=l=I;if(n.gridSnapping){D=wa(D);I=wa(I);h=wa(h);l=wa(l)}if(G==Ca.selectorParentGroup&&J[0]!=null){G=v.target;var u=ib(G,"type"); -if(u=="rotate"){Ba="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ba="resize";jb=ib(G,"dir")}G=J[0]}Ta=G.getAttribute("transform");u=Y(G);switch(Ba){case "select":Ma=true;jb="none";if(E)Ma=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Ra(true);ub([G]);zb=G;Ja.clear()}if(!E)for(E=0;E1))if(Ma)if(!(v.button===1||b.spaceKey)){var E=J[0],I=P(v.pageX,v.pageY, -qb),D=I.x*o;I=I.y*o;var G=pa(ca()),L=x=D/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ba){case "select":if(J[0]!==null){L=x-h;var u=y-l;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=U(h,l,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k0&&b.removeFromSelection(G);L.length>0&&ub(L); -break;case "resize":G=Y(E);L=(F=qa(G))?H:svgedit.utilities.getBBox(E);C=L.x;k=L.y;var O=L.width,V=L.height;L=x-h;u=y-l;if(n.gridSnapping){L=wa(L);u=wa(u);V=wa(V);O=wa(O)}var T=oa(E);if(T){var X=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-T*Math.PI/180;L=X*Math.cos(u);u=X*Math.sin(u)}if(jb.indexOf("n")==-1&&jb.indexOf("s")==-1)u=0;if(jb.indexOf("e")==-1&&jb.indexOf("w")==-1)L=0;var aa=X=0,fa=V?(V+u)/V:1,ra=O?(O+L)/O:1;if(jb.indexOf("n")>=0){fa=V?(V-u)/V:1;aa=V}if(jb.indexOf("w")>=0){ra=O?(O-L)/O:1;X=O}L= -d.createSVGTransform();u=d.createSVGTransform();O=d.createSVGTransform();if(n.gridSnapping){C=wa(C);X=wa(X);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+X),-(k+aa));if(v.shiftKey)if(ra==1)ra=fa;else fa=ra;u.setScale(ra,fa);O.setTranslate(C+X,k+aa);if(F){F=T?1:0;G.replaceItem(L,2+F);G.replaceItem(u,1+F);G.replaceItem(O,0+F)}else{F=G.numberOfItems;G.replaceItem(O,F-3);G.replaceItem(u,F-2);G.replaceItem(L,F-1)}Ca.requestSelector(E).resize();N("transition",J);break;case "zoom":L*=o;k*=o;na(sa,{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":na(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)}F=x;C=y;if(v.shiftKey){C=U(h,l,F,C);F=C.x;C=C.y}G.setAttributeNS(null,"x2",F);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);F=Math.abs(y-l);if(Ba=="square"||v.shiftKey){L=F=Math.max(L,F);C=hl?l+k:l-k}if(v.altKey){F=h;C=l;k=Math.abs(x-F);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);G.setAttributeNS(null,"cx",F);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,"points",e);break; -case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);l=wa(l)}if(v.shiftKey){if(F=svgedit.path.path){G=F.dragging?F.dragging[0]:h;F=F.dragging?F.dragging[1]:l}else{G=h;F=l}C=U(G,F,x,y);x=C.x;y=C.y}if(sa&&sa.getAttribute("display")!=="none"){L*=o;k*=o;na(sa,{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;eb.mouseMove(D,I);break;case "rotate":L=svgedit.utilities.getBBox(E);F=L.x+L.width/ -2;C=L.y+L.height/2;G=ba(E);G=P(F,C,G);F=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,F-G)*(180/Math.PI)-90)%360;T=(Math.atan2(C-y,F-x)*(180/Math.PI)-90)%360;T+=compensation_angle;if(n.gridSnapping)T=wa(T);if(v.shiftKey)T=Math.round(T/45)*45;b.setRotationAngle(T<-180?360+T:T,true);N("transition",J)}nb("mouseMove",{event:v,mouse_x:D,mouse_y:I, -selected:E})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var E=v.target.parentNode;if(E!==K){var I=ob(v),D=I.tagName;if(D==="text"&&Ba!=="textedit"){v=P(v.pageX,v.pageY,qb);eb.select(I,v.x,v.y)}if((D==="g"||D==="a")&&oa(I)){Lb(I);I=J[0];Ra(true)}K&&Jb();E.tagName!=="g"&&E.tagName!=="a"||E===B().getCurrentLayer()||I===Ca.selectorParentGroup||Rb(I)}}).mouseup(function(v){b.addClone=false;window.removeEventListener("keyup",b.removeClone);if(v.button!==2){var E=zb;zb=null; -if(Ma){var I=P(v.pageX,v.pageY,qb),D=I.x*o;I=I.y*o;var G=D/o,L=I/o,k=pa(ca()),u=false;Ma=false;switch(Ba){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");lb=[]}Ba="select";case "select":if(J[0]!=null){if(J[1]==null){D=J[0];switch(D.tagName){case "g":case "use":case "image":case "foreignObject":break;default:cb.fill=D.getAttribute("fill");cb.fill_opacity=D.getAttribute("fill-opacity");cb.stroke=D.getAttribute("stroke");cb.stroke_opacity=D.getAttribute("stroke-opacity"); -cb.stroke_width=D.getAttribute("stroke-width");cb.stroke_dasharray=D.getAttribute("stroke-dasharray");cb.stroke_linejoin=D.getAttribute("stroke-linejoin");cb.stroke_linecap=D.getAttribute("stroke-linecap")}if(D.tagName=="text"){Za.font_size=D.getAttribute("font-size");Za.font_family=D.getAttribute("font-family")}Ca.requestSelector(D).showGrips(true)}Ga();if(G!=z||L!=w){v=J.length;for(D=0;D=0?E.indexOf(",", -G+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":E=$(k).attr(["x1","x2","y1","y2"]);u=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(k).attr(["width","height"]);u=E.width!=0||E.height!=0||Ba==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":E=$(k).attr(["rx","ry"]);u=E.rx!=null||E.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=Q({element:"ellipse",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()}});N("changed",[k]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=Q({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});N("changed",[k]);u=true}break;case "text":u=true;Cb([k]);eb.start(k);break;case "path":k=null;Ma=true;E=Ja.mouseUp(v,k,D,I);k=E.element;u=E.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v);break;case "textedit":u= -false;k=null;eb.mouseUp(v,D,I);break;case "rotate":u=true;k=null;Ba="select";E=b.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Ga();N("changed",J)}D=nb("mouseUp",{event:v,mouse_x:D,mouse_y:I},true);$.each(D,function(O,V){if(V){u=V.keep||u;k=V.element;Ma=V.started||Ma}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(D=v.target;D.parentNode.parentNode.tagName=="g";)D=D.parentNode;if((Ba!="path"||!drawn_path)&&D.parentNode.id!="selectorParentGroup"&&D.id!="svgcanvas"&& -D.id!="svgroot"){b.setMode("select");Cb([D],true)}}else if(k!=null){b.addedNew=true;v=0.2;var C;if(false.beginElement&&k.getAttribute("opacity")!=M.opacity){C=$(false).clone().attr({to:M.opacity,dur:v}).appendTo(k);try{C[0].beginElement()}catch(F){}}else v=0;setTimeout(function(){C&&C.remove();k.setAttribute("opacity",M.opacity);k.setAttribute("style","pointer-events:inherit");ma(k);if(Ba==="path")Ja.toEditMode(k);else n.selectNew&&Cb([k],true);ya(new Ia(k));N("changed",[k])},v*1E3)}Ta=null}}});$(a).bind("mousewheel DOMMouseScroll", -function(v){if(v.shiftKey){v.preventDefault();qb=m.getScreenCTM().inverse();var E=P(v.pageX,v.pageY,qb);E={x:E.x,y:E.y,width:0,height:0};if(v.wheelDelta)if(v.wheelDelta>=120)E.factor=2;else{if(v.wheelDelta<=-120)E.factor=0.5}else if(v.detail)if(v.detail>0)E.factor=0.5;else if(v.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Ib=function(e){$(e).click(function(h){h.preventDefault()})},eb=b.textActions=function(){function e(T){var X=I.value==="";$(I).focus();if(!arguments.length)if(X)T=0;else{if(I.selectionEnd!== -I.selectionStart)return;T=I.selectionEnd}var aa;aa=k[T];X||I.setSelectionRange(T,T);D=pa("text_cursor");if(!D){D=document.createElementNS(c,"line");na(D,{id:"text_cursor",stroke:"#333","stroke-width":1});D=pa("selectorParentGroup").appendChild(D)}L||(L=setInterval(function(){var fa=D.getAttribute("display")==="none";D.setAttribute("display",fa?"inline":"none")},600));X=H(aa.x,u.y);aa=H(aa.x,u.y+u.height);na(D,{x1:X.x,y1:X.y,x2:aa.x,y2:aa.y,visibility:"visible",display:"inline"});G&&G.setAttribute("d", -"")}function h(T,X,aa){if(T===X)e(X);else{aa||I.setSelectionRange(T,X);G=pa("text_selectblock");if(!G){G=document.createElementNS(c,"path");na(G,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(G)}T=k[T];var fa=k[X];D.setAttribute("visibility","hidden");X=H(T.x,u.y);aa=H(T.x+(fa.x-T.x),u.y);var ra=H(T.x,u.y+u.height);T=H(T.x+(fa.x-T.x),u.y+u.height);na(G,{d:"M"+X.x+","+X.y+" L"+aa.x+","+aa.y+" "+T.x+","+T.y+" "+ra.x+","+ra.y+"z",display:"inline"})}} -function l(T,X){var aa=d.createSVGPoint();aa.x=T;aa.y=X;if(k.length==1)return 0;aa=E.getCharNumAtPosition(aa);if(aa<0){aa=k.length-2;if(T<=k[0].x)aa=0}else if(aa>=k.length-2)aa=k.length-2;var fa=k[aa];T>fa.x+fa.width/2&&aa++;return aa}function z(T,X,aa){var fa=I.selectionStart;T=l(T,X);h(Math.min(fa,T),Math.max(fa,T),!aa)}function w(T,X){var aa={x:T,y:X};aa.x/=o;aa.y/=o;if(C){var fa=P(aa.x,aa.y,C.inverse());aa.x=fa.x;aa.y=fa.y}return aa}function H(T,X){var aa={x:T,y:X};if(C){var fa=P(aa.x,aa.y,C); -aa.x=fa.x;aa.y=fa.y}aa.x*=o;aa.y*=o;return aa}function A(T){h(0,E.textContent.length);$(this).unbind(T)}function v(T){if(V&&E){var X=P(T.pageX,T.pageY,qb);X=w(X.x*o,X.y*o);X=l(X.x,X.y);var aa=E.textContent,fa=aa.substr(0,X).replace(/[a-z0-9]+$/i,"").length;aa=aa.substr(X).match(/^[a-z0-9]+/i);h(fa,(aa?aa[0].length:0)+X);$(T.target).click(A);setTimeout(function(){$(T.target).unbind("click",A)},300)}}var E,I,D,G,L,k=[],u,C,F,O,V;return{select:function(T,X,aa){E=T;eb.toEditMode(X,aa)},start:function(T){E= -T;eb.toEditMode()},mouseDown:function(T,X,aa,fa){T=w(aa,fa);I.focus();e(l(T.x,T.y));F=aa;O=fa},mouseMove:function(T,X){if(!(evt.originalEvent.touches&&evt.originalEvent.touches.length>1)){var aa=w(T,X);z(aa.x,aa.y)}},mouseUp:function(T,X,aa){var fa=w(X,aa);z(fa.x,fa.y,true);T.target!==E&&XF-2&&aaO-2&&eb.toSelectMode(true)},setCursor:e,toEditMode:function(T,X){V=false;Ba="textedit";Ca.requestSelector(E).showGrips(false);Ca.requestSelector(E);eb.init();$(E).css("cursor","text");if(arguments.length){var aa= -w(T,X);e(l(aa.x,aa.y))}else e();setTimeout(function(){V=true},300)},toSelectMode:function(T){Ba="select";clearInterval(L);L=null;G&&$(G).attr("display","none");D&&$(D).attr("visibility","hidden");$(E).css("cursor","move");if(T){Ra();$(E).css("cursor","move");N("selected",[E]);ub([E],true)}E&&!E.textContent.length&&b.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(T){I=T},clear:function(){Ba=="textedit"&&eb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=J[0];Ca.requestSelector(E).showGrips(false)}var T= -E.textContent.length,X=E.getAttribute("transform");u=svgedit.utilities.getBBox(E);C=X?ba(E):null;k=Array(T);I.focus();$(E).unbind("dblclick",v).dblclick(v);if(!T)var aa={x:u.x+u.width/2,width:0};for(X=0;X=0&&this.selected_pts.push(E)}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]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",A)};var w=h=null,H=false;return{mouseDown:function(A,v,E,I){if(Ba==="path"){mouse_x=E;mouse_y=I;I=mouse_x/o;v=mouse_y/o;E=pa("path_stretch_line");l=[I,v];if(n.gridSnapping){I=wa(I);v=wa(v);mouse_x=wa(mouse_x);mouse_y=wa(mouse_y)}if(!E){E=document.createElementNS(c,"path");na(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5", -fill:"none"});E=pa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var D=null;if(w){D=w.pathSegList;for(var G=D.numberOfItems,L=6/o,k=false;G;){G--;var u=D.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=pa(L);C=D.numberOfItems;if(k){if(G<=1&&C>=2){I=D.getItem(0).x;v=D.getItem(0).y;A=E.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();D.appendItem(A);D.appendItem(I)}else if(C<3)return D=false;$(E).remove();element=L;w=null;Ma=false;if(e){svgedit.path.path.matrix&&bb(L,{},svgedit.path.path.matrix.inverse());E=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+E);$(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, -ob(A))){console.log("Clicked outside canvas");return false}D=w.pathSegList.numberOfItems;G=w.pathSegList.getItem(D-1);L=G.x;G=G.y;if(A.shiftKey){A=U(L,G,I,v);I=A.x;v=A.y}A=E.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(gb(I),gb(v)):w.createSVGPathSegCurvetoCubicAbs(gb(I),gb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;E.setAttribute("d",["M",I,v,I,v].join(" "));E=D;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,v)}}else{d_attr= -"M"+I+","+v+" ";w=Q({element:"path",curStyles:true,attr:{d:d_attr,id:la(),opacity:M.opacity/2}});E.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));E=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(E,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=[E,I];D=svgedit.path.path.segs[v];if(A.shiftKey)D.selected?svgedit.path.path.removePtFromSelection(v): -svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!D.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,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(sa==null)sa=Ca.getRubberBandBox();na(sa,{x:E*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,E){if(!(A.originalEvent.touches&& -A.originalEvent.touches.length>1)){H=true;if(Ba==="path"){if(w){var I=w.pathSegList;A=I.numberOfItems-1;if(l){var D=svgedit.path.addCtrlGrip("1c1"),G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");D.setAttribute("cx",v);D.setAttribute("cy",E);D.setAttribute("display","inline");D=l[0];var L=l[1];I.getItem(A);var k=D+(D-v/o),u=L+(L-E/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); -na(G,{x1:v,y1:E,x2:D*o,y2:L*o,display:"inline"});na(C,{x1:k*o,y1:u*o,x2:D*o,y2:L*o,display:"inline"});if(A===0)z=[v,E];else{I=I.getItem(A-1);v=I.x;E=I.y;if(I.pathSegType===6){v+=v-I.x2;E+=E-I.y2}else if(z){v=z[0]/o;E=z[1]/o}svgedit.path.replacePathSeg(6,A,[D,L,v,E,k,u],w)}}else if(D=pa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,E,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,E],D);else z?svgedit.path.replacePathSeg(6,1,[v,E,z[0],z[1],v,E],D):svgedit.path.replacePathSeg(4, -1,[v,E],D)}}}else if(svgedit.path.path.dragging){D=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:E},svgedit.path.path);A=L.x-D.x;D=L.y-D.y;svgedit.path.path.dragging=[v,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,D):svgedit.path.path.movePts(A,D)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var F=sa.getBBox(),O=svgedit.path.getGripPt(this); -F=svgedit.math.rectsIntersect(F,{x:O.x,y:O.y,width:0,height:0});this.select(F);F&&svgedit.path.path.selected_pts.push(this.index)}})}}},mouseUp:function(A,v){if(Ba==="path"){l=null;if(!w){v=pa(ca());Ma=false;z=null}return{keep:true,element:v}}if(svgedit.path.path.dragging){var E=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(E)}else if(sa&& -sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ba="pathedit";Ra();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;Ba="select";svgedit.path.path.show(false); -h=false;Ra();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(v){N("selected",[A]);ub([A],true)}},addSubPath:function(A){if(A){Ba="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ba="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(oa(A)!=0){var v=new Ea("Reorient path"),E={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Ka(A,E));Ra();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix= -null;this.clear();ub([A],true);N("changed",J)}},clear:function(){h=null;if(w){var A=pa(ca());$(pa("path_stretch_line")).remove();$(A).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");w=z=null;Ma=false}else Ba=="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=Y(A),E=ga(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems, -D=0;D0){L=I.getItem(D-1).pathSegType;if(L===2){G(D-1,1);E();break}else if(L===1&&I.numberOfItems-1===D){G(D,1);E();break}}}return false};E();if(svgedit.path.path.elem.pathSegList.numberOfItems<= -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,E=v.numberOfItems;if(E>=4){var I=v.getItem(0),D=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=E-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(D)if((I=svgedit.path.smoothControlPoints(D, -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;D=k}for(A.push("L");G0;);Ja.clear(true);$.each(m.childNodes,function(l,z){l&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&m.insertBefore(z,m.firstChild)});if(K){Jb();Cb([K])}var e= -[];$(m).find("g:data(gsvg)").each(function(){for(var l=this.attributes,z=l.length,w=0;w=0;E--){v=A.item(E);G=z(v.nodeValue);if(!(L.indexOf(v.localName)>=0))if(G!="")if(G.indexOf("pointer-events")!==0)if(!(v.localName==="class"&&G.indexOf("se_")===0)){l.push(" ");if(v.localName==="d")G=Ja.convertPath(e,true);if(isNaN(G)){if(H.test(G))G= -svgedit.units.shortFloat(G)+w}else G=svgedit.units.shortFloat(G);if(fb.apply&&e.nodeName==="image"&&v.localName==="href"&&fb.images&&fb.images==="embed"){var k=Ya[G];if(k)G=k}if(!v.namespaceURI||v.namespaceURI==c||za[v.namespaceURI]){l.push(v.nodeName);l.push('="');l.push(G);l.push('"')}}}}if(e.hasChildNodes()){l.push(">");h++;A=false;for(E=0;E");break;case 8:l.push("\n");l.push(Array(h+1).join(" "));l.push("