transformation bugs
parent
5f712680b7
commit
22e2d89fb3
|
@ -2913,7 +2913,7 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
||||||
ty = snapToGrid(ty);
|
ty = snapToGrid(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
translateOrigin.setTranslate(tox,toy);
|
translateOrigin.setTranslate(-(left+tx),-(top+ty));
|
||||||
if(evt.shiftKey) {
|
if(evt.shiftKey) {
|
||||||
if(sx == 1) sx = sy
|
if(sx == 1) sx = sy
|
||||||
else sy = sx;
|
else sy = sx;
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
(function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]=
|
(function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]=
|
||||||
true;else{l[e+d]=true;l[e+a.hotkeys.shiftNums[d]]=true;if(e==="shift+")l[a.hotkeys.shiftNums[d]]=true}b=0;for(d=m.length;b<d;b++)if(l[m[b]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",
|
true;else{l[e+d]=true;l[e+a.hotkeys.shiftNums[d]]=true;if(e==="shift+")l[a.hotkeys.shiftNums[d]]=true}b=0;for(d=m.length;b<d;b++)if(l[m[b]])return c.apply(this,arguments)}}}}a.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",
|
||||||
106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:n}})})(jQuery);(function(a,n){function f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,ra,la){var ma;if(ra!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(ra))ra=ra.replace(ba?ea:ca,"");else{ma=p(S[2]);ra=f(ra)?p[ba?fa:O](ra):ra;ra=la===2?ra:la===1?a.extend({},ra,ma):a.extend({},ma,ra);ra=u(ra);if(ba)ra=ra.replace(qa,l)}ba=S[1]+(ba?"#":ra||!S[1]?"?":"")+ra+U}else ba=
|
106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:n}})})(jQuery);(function(a,n){function f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,ra,la){var ma;if(ra!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(ra))ra=ra.replace(ba?ea:ca,"");else{ma=p(S[2]);ra=f(ra)?p[ba?fa:O](ra):ra;ra=la===2?ra:la===1?a.extend({},ra,ma):a.extend({},ma,ra);ra=u(ra);if(ba)ra=ra.replace(qa,l)}ba=S[1]+(ba?"#":ra||!S[1]?"?":"")+ra+U}else ba=
|
||||||
S(U!==d?U:n[sa][ia]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?fa:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,ra){if(!f(U)&&typeof U!=="object"){ra=U;U=S;S=d}return this.each(function(){var la=a(this),ma=S||da()[(this.nodeName||"").toLowerCase()]||"",Y=ma&&la.attr(ma)||"";la.attr(ma,u[ba](Y,U,ra))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,z,p,L,T=a.bbq=a.bbq||{},N,K,da,V=a.event.special,O="querystring",fa="fragment",
|
S(U!==d?U:n[sa][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?fa:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,ra){if(!f(U)&&typeof U!=="object"){ra=U;U=S;S=d}return this.each(function(){var la=a(this),ma=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=ma&&la.attr(ma)||"";la.attr(ma,u[ba](Z,U,ra))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,z,p,L,T=a.bbq=a.bbq||{},N,J,da,V=a.event.special,O="querystring",fa="fragment",
|
||||||
sa="location",ia="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,qa,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[fa]=z=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});z.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);qa=RegExp(ba.join("|"),"g")};z.noEscape(",/");a.deparam=p=function(ba,S){var U={},ra={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,ma){var Y=ma.split("="),za=l(Y[0]),Ka=U,
|
sa="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,qa,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[fa]=z=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});z.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);qa=RegExp(ba.join("|"),"g")};z.noEscape(",/");a.deparam=p=function(ba,S){var U={},ra={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,ma){var Z=ma.split("="),za=l(Z[0]),Ka=U,
|
||||||
Qa=0,Ma=za.split("]["),Sa=Ma.length-1;if(/\[/.test(Ma[0])&&/\]$/.test(Ma[Sa])){Ma[Sa]=Ma[Sa].replace(/\]$/,"");Ma=Ma.shift().split("[").concat(Ma);Sa=Ma.length-1}else Sa=0;if(Y.length===2){Y=l(Y[1]);if(S)Y=Y&&!isNaN(Y)?+Y:Y==="undefined"?d:ra[Y]!==d?ra[Y]:Y;if(Sa)for(;Qa<=Sa;Qa++){za=Ma[Qa]===""?Ka.length:Ma[Qa];Ka=Ka[za]=Qa<Sa?Ka[za]||(Ma[Qa+1]&&isNaN(Ma[Qa+1])?{}:[]):Y}else if(a.isArray(U[za]))U[za].push(Y);else U[za]=U[za]!==d?[U[za],Y]:Y}else if(za)U[za]=S?d:""});return U};p[O]=c(o,0);p[fa]=L=
|
Qa=0,Ma=za.split("]["),Sa=Ma.length-1;if(/\[/.test(Ma[0])&&/\]$/.test(Ma[Sa])){Ma[Sa]=Ma[Sa].replace(/\]$/,"");Ma=Ma.shift().split("[").concat(Ma);Sa=Ma.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:ra[Z]!==d?ra[Z]:Z;if(Sa)for(;Qa<=Sa;Qa++){za=Ma[Qa]===""?Ka.length:Ma[Qa];Ka=Ka[za]=Qa<Sa?Ka[za]||(Ma[Qa+1]&&isNaN(Ma[Qa+1])?{}:[]):Z}else if(a.isArray(U[za]))U[za].push(Z);else U[za]=U[za]!==d?[U[za],Z]:Z}else if(za)U[za]=S?d:""});return U};p[O]=c(o,0);p[fa]=L=
|
||||||
c(o,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(pa,ba)})({a:ia,base:ia,iframe:"src",img:"src",input:"src",form:"action",link:ia,script:"src"});da=a.elemUrlAttr;a.fn[O]=c(b,O);a.fn[fa]=c(b,fa);T.pushState=N=function(ba,S){if(f(ba)&&/^#/.test(ba)&&S===d)S=2;var U=ba!==d;U=z(n[sa][ia],U?ba:{},U?S:2);n[sa][ia]=U+(/#/.test(U)?"":"#")};T.getState=K=function(ba,S){return ba===d||typeof ba==="boolean"?L(ba):L(S)[ba]};T.removeState=function(ba){var S={};if(ba!==d){S=K();a.each(a.isArray(ba)?
|
c(o,1);a.elemUrlAttr||(a.elemUrlAttr=function(ba){return a.extend(pa,ba)})({a:ha,base:ha,iframe:"src",img:"src",input:"src",form:"action",link:ha,script:"src"});da=a.elemUrlAttr;a.fn[O]=c(b,O);a.fn[fa]=c(b,fa);T.pushState=N=function(ba,S){if(f(ba)&&/^#/.test(ba)&&S===d)S=2;var U=ba!==d;U=z(n[sa][ha],U?ba:{},U?S:2);n[sa][ha]=U+(/#/.test(U)?"":"#")};T.getState=J=function(ba,S){return ba===d||typeof ba==="boolean"?L(ba):L(S)[ba]};T.removeState=function(ba){var S={};if(ba!==d){S=J();a.each(a.isArray(ba)?
|
||||||
ba:arguments,function(U,ra){delete S[ra]})}N(S,2)};V.hashchange=a.extend(V.hashchange,{add:function(ba){function S(ra){var la=ra[fa]=z();ra.getState=function(ma,Y){return ma===d||typeof ma==="boolean"?p(la,ma):p(la,Y)[ma]};U.apply(this,arguments)}var U;if(a.isFunction(ba)){U=ba;return S}else{U=ba.handler;ba.handler=S}}})})(jQuery,this);
|
ba:arguments,function(U,ra){delete S[ra]})}N(S,2)};V.hashchange=a.extend(V.hashchange,{add:function(ba){function S(ra){var la=ra[fa]=z();ra.getState=function(ma,Z){return ma===d||typeof ma==="boolean"?p(la,ma):p(la,Z)[ma]};U.apply(this,arguments)}var U;if(a.isFunction(ba)){U=ba;return S}else{U=ba.handler;ba.handler=S}}})})(jQuery,this);
|
||||||
(function(a,n,f){function c(z){z=z||n[b][d];return z.replace(/^[^#]*#?(.*)$/,"$1")}var m,o=a.event.special,b="location",d="href",e=document.documentMode,l=a.browser.msie&&(e===f||e<8),u="onhashchange"in n&&!l;a.hashchangeDelay=100;o.hashchange=a.extend(o.hashchange,{setup:function(){if(u)return false;a(m.start)},teardown:function(){if(u)return false;a(m.stop)}});m=function(){function z(){N=K=function(da){return da};if(l){T=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
|
(function(a,n,f){function c(z){z=z||n[b][d];return z.replace(/^[^#]*#?(.*)$/,"$1")}var m,o=a.event.special,b="location",d="href",e=document.documentMode,l=a.browser.msie&&(e===f||e<8),u="onhashchange"in n&&!l;a.hashchangeDelay=100;o.hashchange=a.extend(o.hashchange,{setup:function(){if(u)return false;a(m.start)},teardown:function(){if(u)return false;a(m.stop)}});m=function(){function z(){N=J=function(da){return da};if(l){T=a('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;
|
||||||
K=function(){return c(T.document[b][d])};N=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};N(c())}}var p={},L,T,N,K;p.start=function(){if(!L){var da=c();N||z();(function V(){var O=c(),fa=K(da);if(O!==da){N(da=O,fa);a(n).trigger("hashchange")}else if(fa!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+fa;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ia[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){K||b()},500);else{U=sa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";N=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}}
|
J=function(){return c(T.document[b][d])};N=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};N(c())}}var p={},L,T,N,J;p.start=function(){if(!L){var da=c();N||z();(function V(){var O=c(),fa=J(da);if(O!==da){N(da=O,fa);a(n).trigger("hashchange")}else if(fa!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+fa;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){J||b()},500);else{U=sa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";N=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}}
|
||||||
function b(ba,S){if(!K){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var ra=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Ya){a("#"+Sa);var Na=a(new Image).attr({"class":"svg_icon",src:ra+Ya,width:z,height:p,alt:"icon"});pa(Na,Sa)})}else for(var la=L.length,ma=0;ma<la;ma++){var Y=L[ma],za=Y.id;if(za==="svg_eof")break;a("#"+za);Y=Y.getElementsByTagNameNS(l,"svg")[0];var Ka=document.createElementNS(l,"svg");Ka.setAttributeNS(l,"viewBox",
|
function b(ba,S){if(!J){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var ra=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Ya){a("#"+Sa);var Na=a(new Image).attr({"class":"svg_icon",src:ra+Ya,width:z,height:p,alt:"icon"});pa(Na,Sa)})}else for(var la=L.length,ma=0;ma<la;ma++){var Z=L[ma],za=Z.id;if(za==="svg_eof")break;a("#"+za);Z=Z.getElementsByTagNameNS(l,"svg")[0];var Ka=document.createElementNS(l,"svg");Ka.setAttributeNS(l,"viewBox",
|
||||||
[0,0,z,p].join(" "));var Qa=Y.getAttribute("width"),Ma=Y.getAttribute("height");Y.removeAttribute("width");Y.removeAttribute("height");Y.getAttribute("viewBox")||Y.setAttribute("viewBox",[0,0,Qa,Ma].join(" "));Ka.setAttribute("xmlns",l);Ka.setAttribute("width",z);Ka.setAttribute("height",p);Ka.setAttribute("xmlns:xlink",u);Ka.setAttribute("class","svg_icon");fa||(Y=Y.cloneNode(true));Ka.appendChild(Y);if(ba){fa||Ka.cloneNode(true);U.empty().append(Ka);Y=sa+e(U.html());Y=a(new Image).attr({"class":"svg_icon",
|
[0,0,z,p].join(" "));var Qa=Z.getAttribute("width"),Ma=Z.getAttribute("height");Z.removeAttribute("width");Z.removeAttribute("height");Z.getAttribute("viewBox")||Z.setAttribute("viewBox",[0,0,Qa,Ma].join(" "));Ka.setAttribute("xmlns",l);Ka.setAttribute("width",z);Ka.setAttribute("height",p);Ka.setAttribute("xmlns:xlink",u);Ka.setAttribute("class","svg_icon");fa||(Z=Z.cloneNode(true));Ka.appendChild(Z);if(ba){fa||Ka.cloneNode(true);U.empty().append(Ka);Z=sa+e(U.html());Z=a(new Image).attr({"class":"svg_icon",
|
||||||
src:Y})}else Y=f(a(Ka),ma);pa(Y,za)}m.placement&&a.each(m.placement,function(Sa,Ya){n[Ya]&&a(Sa).each(function(Na){var Ia=n[Ya].clone();if(Na>0&&!ba)Ia=f(Ia,Na,true);qa(a(this),Ia,Ya)})});if(!S){ba&&U.remove();ia&&ia.remove();N&&N.remove()}m.resize&&a.resizeSvgIcons(m.resize);K=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba);
|
src:Z})}else Z=f(a(Ka),ma);pa(Z,za)}m.placement&&a.each(m.placement,function(Sa,Ya){n[Ya]&&a(Sa).each(function(Na){var Ia=n[Ya].clone();if(Na>0&&!ba)Ia=f(Ia,Na,true);qa(a(this),Ia,Ya)})});if(!S){ba&&U.remove();ha&&ha.remove();N&&N.remove()}m.resize&&a.resizeSvgIcons(m.resize);J=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba);
|
||||||
var S=Array(Math.floor((ba.length+2)/3)*4),U,ra,la,ma,Y,za,Ka=0,Qa=0;do{U=ba.charCodeAt(Ka++);ra=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);ma=U>>2;U=(U&3)<<4|ra>>4;Y=(ra&15)<<2|la>>6;za=la&63;if(isNaN(ra))Y=za=64;else if(isNaN(la))za=64;S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);S[Qa++]=
|
var S=Array(Math.floor((ba.length+2)/3)*4),U,ra,la,ma,Z,za,Ka=0,Qa=0;do{U=ba.charCodeAt(Ka++);ra=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);ma=U>>2;U=(U&3)<<4|ra>>4;Z=(ra&15)<<2|la>>6;za=la&63;if(isNaN(ra))Z=za=64;else if(isNaN(la))za=64;S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);S[Qa++]=
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(za)}while(Ka<ba.length);return S.join("")}var l="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",z=m.w?m.w:24,p=m.h?m.h:24,L,T,N,K=false,da=false,V=0,O=navigator.userAgent,fa=!!window.opera;O.indexOf("Safari/")>-1&&O.indexOf("Chrome/");var sa="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ia=a('<object data="'+c+'" type=image/svg+xml>').appendTo("body").hide();try{T=ia[0].contentDocument;ia.load(o);
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(za)}while(Ka<ba.length);return S.join("")}var l="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",z=m.w?m.w:24,p=m.h?m.h:24,L,T,N,J=false,da=false,V=0,O=navigator.userAgent,fa=!!window.opera;O.indexOf("Safari/")>-1&&O.indexOf("Chrome/");var sa="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('<object data="'+c+'" type=image/svg+xml>').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o);
|
||||||
o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var qa=function(ba,S,U,ra){fa&&S.css("visibility","hidden");if(m.replace){ra&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class",
|
o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var qa=function(ba,S,U,ra){fa&&S.css("visibility","hidden");if(m.replace){ra&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class",
|
||||||
"svg_icon "+U);ba.replaceWith(S)}else ba.append(S);fa&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)qa(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=fa?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var ra=ba[0].getElementsByTagName("*"),la=ra.length;U.each(function(ma){var Y=this.id;a(T).find("#"+Y);this.id=ma="x"+Y+S+ma;Y="url(#"+Y+")";var za="url(#"+ma+")";for(ma=0;ma<
|
"svg_icon "+U);ba.replaceWith(S)}else ba.append(S);fa&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)qa(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=fa?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var ra=ba[0].getElementsByTagName("*"),la=ra.length;U.each(function(ma){var Z=this.id;a(T).find("#"+Z);this.id=ma="x"+Z+S+ma;Z="url(#"+Z+")";var za="url(#"+ma+")";for(ma=0;ma<
|
||||||
la;ma++){var Ka=ra[ma];Ka.getAttribute("fill")===Y&&Ka.setAttribute("fill",za);Ka.getAttribute("stroke")===Y&&Ka.setAttribute("stroke",za);Ka.getAttribute("filter")===Y&&Ka.setAttribute("filter",za)}});return ba}};a.getSvgIcon=function(c,m){var o=n[c];if(m&&o)o=f(o,0,true).clone(true);return o};a.resizeSvgIcons=function(c){var m=!a(".svg_icon:first").length;a.each(c,function(o,b){var d=a.isArray(b),e=d?b[0]:b,l=d?b[1]:b;if(m)o=o.replace(/\.svg_icon/g,"svg");a(o).each(function(){this.setAttribute("width",
|
la;ma++){var Ka=ra[ma];Ka.getAttribute("fill")===Z&&Ka.setAttribute("fill",za);Ka.getAttribute("stroke")===Z&&Ka.setAttribute("stroke",za);Ka.getAttribute("filter")===Z&&Ka.setAttribute("filter",za)}});return ba}};a.getSvgIcon=function(c,m){var o=n[c];if(m&&o)o=f(o,0,true).clone(true);return o};a.resizeSvgIcons=function(c){var m=!a(".svg_icon:first").length;a.each(c,function(o,b){var d=a.isArray(b),e=d?b[0]:b,l=d?b[1]:b;if(m)o=o.replace(/\.svg_icon/g,"svg");a(o).each(function(){this.setAttribute("width",
|
||||||
e);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=e+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(c,m,o){c=document.createElementNS(n.svg,c);if(f)for(var b in m)c.setAttribute(b,m[b]);else for(b in m){var d=m[b],e=c[b];if(e&&e.constructor==="SVGLength")e.baseVal.value=d;else c.setAttribute(b,d)}o&&o.appendChild(c);return c}var n={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console)window.console=new function(){this.log=function(){};this.dir=function(){}};$.jGraduate={Paint:function(c){c=c||{};this.alpha=isNaN(c.alpha)?100:c.alpha;if(c.copy){this.type=
|
e);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=e+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(c,m,o){c=document.createElementNS(n.svg,c);if(f)for(var b in m)c.setAttribute(b,m[b]);else for(b in m){var d=m[b],e=c[b];if(e&&e.constructor==="SVGLength")e.baseVal.value=d;else c.setAttribute(b,d)}o&&o.appendChild(c);return c}var n={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console)window.console=new function(){this.log=function(){};this.dir=function(){}};$.jGraduate={Paint:function(c){c=c||{};this.alpha=isNaN(c.alpha)?100:c.alpha;if(c.copy){this.type=
|
||||||
c.copy.type;this.alpha=c.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=c.copy.solidColor;break;case "linearGradient":this.linearGradient=c.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=c.copy.radialGradient.cloneNode(true)}}else if(c.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=c.linearGradient.cloneNode(true)}else if(c.radialGradient){this.type=
|
c.copy.type;this.alpha=c.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=c.copy.solidColor;break;case "linearGradient":this.linearGradient=c.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=c.copy.radialGradient.cloneNode(true)}}else if(c.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=c.linearGradient.cloneNode(true)}else if(c.radialGradient){this.type=
|
||||||
"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=c.radialGradient.cloneNode(true)}else if(c.solidColor){this.type="solidColor";this.solidColor=c.solidColor}else{this.type="none";this.radialGradient=this.linearGradient=this.solidColor=null}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var f=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(c){var m=
|
"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=c.radialGradient.cloneNode(true)}else if(c.solidColor){this.type="solidColor";this.solidColor=c.solidColor}else{this.type="none";this.radialGradient=this.linearGradient=this.solidColor=null}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var f=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(c){var m=
|
||||||
arguments;return this.each(function(){function o(na,aa,ta,M,I){var X=I||a("stop",{"stop-color":aa,"stop-opacity":ta,offset:na},ea);if(I){aa=I.getAttribute("stop-color");ta=I.getAttribute("stop-opacity");na=I.getAttribute("offset")}else ea.appendChild(X);if(ta===null)ta=1;I=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+na*fa)+", 26)"},Gb);var Oa=
|
arguments;return this.each(function(){function o(na,aa,ta,M,I){var Y=I||a("stop",{"stop-color":aa,"stop-opacity":ta,offset:na},ea);if(I){aa=I.getAttribute("stop-color");ta=I.getAttribute("stop-opacity");na=I.getAttribute("offset")}else ea.appendChild(Y);if(ta===null)ta=1;I=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+na*fa)+", 26)"},Gb);var Oa=
|
||||||
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:aa,"fill-opacity":ta,transform:"translate("+(10+na*fa)+", 26)",stroke:"#000","stroke-width":1.5},Gb);$(Oa).mousedown(function(Wa){b(this);Xa=ob;da.mousemove(l).mouseup(d);Fa=Pb.offset();Wa.preventDefault();return false}).data("stop",X).data("bg",I).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Wa=this,fb=+X.getAttribute("stop-opacity")||
|
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:aa,"fill-opacity":ta,transform:"translate("+(10+na*fa)+", 26)",stroke:"#000","stroke-width":1.5},Gb);$(Oa).mousedown(function(Wa){b(this);Xa=nb;da.mousemove(l).mouseup(d);Fa=Pb.offset();Wa.preventDefault();return false}).data("stop",Y).data("bg",I).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Wa=this,fb=+Y.getAttribute("stop-opacity")||
|
||||||
1,tb=X.getAttribute("stop-color")||1,wb=(parseFloat(fb)*255).toString(16);wb.length<2;)wb="0"+wb;aa=tb.substr(1)+wb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:z.images.clientPath},color:{active:aa,alphaSupport:true}},function(Hb){tb=Hb.val("hex")?"#"+Hb.val("hex"):"none";fb=Hb.val("a")!==null?Hb.val("a")/256:1;Wa.setAttribute("fill",tb);Wa.setAttribute("fill-opacity",fb);X.setAttribute("stop-color",
|
1,tb=Y.getAttribute("stop-color")||1,wb=(parseFloat(fb)*255).toString(16);wb.length<2;)wb="0"+wb;aa=tb.substr(1)+wb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:z.images.clientPath},color:{active:aa,alphaSupport:true}},function(Hb){tb=Hb.val("hex")?"#"+Hb.val("hex"):"none";fb=Hb.val("a")!==null?Hb.val("a")/256:1;Wa.setAttribute("fill",tb);Wa.setAttribute("fill-opacity",fb);Y.setAttribute("stop-color",
|
||||||
tb);X.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Wa=$(this);if(+this.getAttribute("offset")>na){if(!aa){var fb=this.getAttribute("stop-color"),tb=this.getAttribute("stop-opacity");X.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);X.setAttribute("stop-opacity",tb===null?1:tb);Oa.setAttribute("fill-opacity",
|
tb);Y.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Wa=$(this);if(+this.getAttribute("offset")>na){if(!aa){var fb=this.getAttribute("stop-color"),tb=this.getAttribute("stop-opacity");Y.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);Y.setAttribute("stop-opacity",tb===null?1:tb);Oa.setAttribute("fill-opacity",
|
||||||
tb===null?1:tb)}Wa.before(X);return false}});M&&b(Oa);return X}function b(na){ob&&ob.setAttribute("stroke","#000");na.setAttribute("stroke","blue");ob=na;ob.parentNode.appendChild(ob)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var na=$(ob),aa=na.data("stop");na=na.data("bg");$([ob,aa,na]).remove()}Xa=null}function e(){var na=$a?"rotate("+$a+","+Ja+","+pb+") ":"";Za===1&&Ra===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform",
|
tb===null?1:tb)}Wa.before(Y);return false}});M&&b(Oa);return Y}function b(na){nb&&nb.setAttribute("stroke","#000");na.setAttribute("stroke","blue");nb=na;nb.parentNode.appendChild(nb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var na=$(nb),aa=na.data("stop");na=na.data("bg");$([nb,aa,na]).remove()}Xa=null}function e(){var na=$a?"rotate("+$a+","+Ja+","+ob+") ":"";Za===1&&Ra===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform",
|
||||||
na+"translate("+-Ja*(Za-1)+","+-pb*(Ra-1)+") scale("+Za+","+Ra+")")}function l(na){var aa=na.pageX-Fa.left;na=na.pageY-Fa.top;aa=aa<10?10:aa>fa+10?fa+10:aa;var ta="translate("+aa+", 26)";if(na<-60||na>130){La.setAttribute("display","block");La.setAttribute("transform",ta)}else La.setAttribute("display","none");Xa.setAttribute("transform",ta);$.data(Xa,"bg").setAttribute("transform",ta);$.data(Xa,"stop").setAttribute("offset",(aa-10)/fa);var M=0;$(ea).find("stop").each(function(){var I=this.getAttribute("offset"),
|
na+"translate("+-Ja*(Za-1)+","+-ob*(Ra-1)+") scale("+Za+","+Ra+")")}function l(na){var aa=na.pageX-Fa.left;na=na.pageY-Fa.top;aa=aa<10?10:aa>fa+10?fa+10:aa;var ta="translate("+aa+", 26)";if(na<-60||na>130){La.setAttribute("display","block");La.setAttribute("transform",ta)}else La.setAttribute("display","none");Xa.setAttribute("transform",ta);$.data(Xa,"bg").setAttribute("transform",ta);$.data(Xa,"stop").setAttribute("offset",(aa-10)/fa);var M=0;$(ea).find("stop").each(function(){var I=this.getAttribute("offset"),
|
||||||
X=$(this);if(I<M){X.prev().before(X);Ga=$(ea).find("stop")}M=I})}var u=$(this),z=$.extend(true,{},jQuery.fn.jGraduateDefaults,c),p=u.attr("id"),L="#"+u.attr("id")+" ";if(L){var T=function(){switch(u.paint.type){case "radialGradient":u.paint.linearGradient=null;break;case "linearGradient":u.paint.radialGradient=null;break;case "solidColor":u.paint.radialGradient=u.paint.linearGradient=null}$.isFunction(u.okCallback)&&u.okCallback(u.paint);u.hide()},N=function(){$.isFunction(u.cancelCallback)&&u.cancelCallback();
|
Y=$(this);if(I<M){Y.prev().before(Y);Ga=$(ea).find("stop")}M=I})}var u=$(this),z=$.extend(true,{},jQuery.fn.jGraduateDefaults,c),p=u.attr("id"),L="#"+u.attr("id")+" ";if(L){var T=function(){switch(u.paint.type){case "radialGradient":u.paint.linearGradient=null;break;case "linearGradient":u.paint.radialGradient=null;break;case "solidColor":u.paint.radialGradient=u.paint.linearGradient=null}$.isFunction(u.okCallback)&&u.okCallback(u.paint);u.hide()},N=function(){$.isFunction(u.cancelCallback)&&u.cancelCallback();
|
||||||
u.hide()};$.extend(true,u,{paint:new $.jGraduate.Paint({copy:z.paint}),okCallback:$.isFunction(m[1])&&m[1]||null,cancelCallback:$.isFunction(m[2])&&m[2]||null});u.position();var K=null,da=$(window);if(u.paint.type=="none")u.paint=$.jGraduate.Paint({solidColor:"ffffff"});u.addClass("jGraduate_Picker");u.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+
|
u.hide()};$.extend(true,u,{paint:new $.jGraduate.Paint({copy:z.paint}),okCallback:$.isFunction(m[1])&&m[1]||null,cancelCallback:$.isFunction(m[2])&&m[2]||null});u.position();var J=null,da=$(window);if(u.paint.type=="none")u.paint=$.jGraduate.Paint({solidColor:"ffffff"});u.addClass("jGraduate_Picker");u.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+
|
||||||
p+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+z.window.pickerTitle+'</h2><div id="'+p+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+p+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+
|
p+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('<div id="'+p+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+z.window.pickerTitle+'</h2><div id="'+p+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+p+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+
|
||||||
p+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+
|
p+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+
|
||||||
p+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+
|
p+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+p+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label> y:</label><input type="text" id="'+p+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+
|
||||||
|
@ -34,23 +34,23 @@ p+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'
|
||||||
p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+z.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+p+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+
|
p+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+p+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+z.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+p+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+
|
||||||
p+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+z.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+p+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+p+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+z.images.clientPath+
|
p+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+z.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+p+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+p+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+z.images.clientPath+
|
||||||
'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+p+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+p+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+z.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+
|
'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_AngleInput" size="3" value="0"/>\u00ba </label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+p+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+p+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+z.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+p+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+
|
||||||
p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var fa=256,sa=fa-0,ia=fa-0,ca,ea,qa,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:fa,height:fa,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],ra=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad";
|
p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+p+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var fa=256,sa=fa-0,ha=fa-0,ca,ea,qa,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:fa,height:fa,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],ra=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad";
|
||||||
U=ea=S.appendChild(ea)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},S);if(ca==="linearGradient")break;case "radialGradient":if(!la){ea.id=p+"_rg_jgraduate_grad";U=ea=S.appendChild(ea)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},S)}if(la){U=ea=$("#"+p+"_lg_jgraduate_grad")[0];K=u.paint[ca];o(0,"#"+K,1);var ma=typeof z.newstop;if(ma==="string")switch(z.newstop){case "same":o(1,"#"+K,1);break;case "inverse":ma="";for(var Y=0;Y<6;Y+=2){K.substr(Y,2);var za=(255-parseInt(K.substr(Y,2),16)).toString(16);
|
U=ea=S.appendChild(ea)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},S);if(ca==="linearGradient")break;case "radialGradient":if(!la){ea.id=p+"_rg_jgraduate_grad";U=ea=S.appendChild(ea)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},S)}if(la){U=ea=$("#"+p+"_lg_jgraduate_grad")[0];J=u.paint[ca];o(0,"#"+J,1);var ma=typeof z.newstop;if(ma==="string")switch(z.newstop){case "same":o(1,"#"+J,1);break;case "inverse":ma="";for(var Z=0;Z<6;Z+=2){J.substr(Z,2);var za=(255-parseInt(J.substr(Z,2),16)).toString(16);
|
||||||
if(za.length<2)za=0+za;ma+=za}o(1,"#"+ma,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(ma==="object")o(1,z.newstop.color||"#"+K,"opac"in z.newstop?z.newstop.opac:1)}K=parseFloat(U.getAttribute("x1")||0);ma=parseFloat(U.getAttribute("y1")||0);Y=parseFloat(U.getAttribute("x2")||1);za=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Qa=parseFloat(U.getAttribute("cy")||0.5),Ma=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")||
|
if(za.length<2)za=0+za;ma+=za}o(1,"#"+ma,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(ma==="object")o(1,z.newstop.color||"#"+J,"opac"in z.newstop?z.newstop.opac:1)}J=parseFloat(U.getAttribute("x1")||0);ma=parseFloat(U.getAttribute("y1")||0);Z=parseFloat(U.getAttribute("x2")||1);za=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Qa=parseFloat(U.getAttribute("cy")||0.5),Ma=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")||
|
||||||
Qa);qa=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:sa,height:ia,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":ra/100},S);var Ya=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*fa,left:K*fa}).data("coord","start").appendTo(ba),Na=Ya.clone().text(2).css({top:za*fa,left:Y*fa}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Qa*fa,left:Ka*
|
Qa);qa=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:sa,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":ra/100},S);var Ya=$("<div/>").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*fa,left:J*fa}).data("coord","start").appendTo(ba),Na=Ya.clone().text(2).css({top:za*fa,left:Z*fa}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("<div/>").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Qa*fa,left:Ka*
|
||||||
fa}).data("coord","center").appendTo(ba),Pa=Ia.clone().text("F").css({top:Sa*fa,left:Ma*fa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Pa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(na,aa){var ta=ea.getAttribute(aa),M=isNaN(aa[1]);ta||(ta=M?"0.5":aa==="x2"?"1.0":"0.0");pa[aa]=$("#"+p+"_jGraduate_"+aa).val(ta).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
|
fa}).data("coord","center").appendTo(ba),Pa=Ia.clone().text("F").css({top:Sa*fa,left:Ma*fa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Pa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(na,aa){var ta=ea.getAttribute(aa),M=isNaN(aa[1]);ta||(ta=M?"0.5":aa==="x2"?"1.0":"0.0");pa[aa]=$("#"+p+"_jGraduate_"+aa).val(ta).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
|
||||||
1)this.value=1;if(!(aa[0]==="f"&&!mb))if(M&&ca==="radialGradient"||!M&&ca==="linearGradient")ea.setAttribute(aa,this.value);var I=M?aa[0]==="c"?Ia:Pa:aa[1]==="1"?Ya:Na,X=aa.indexOf("x")>=0?"left":"top";I.css(X,this.value*fa)}).change()});var Ga,Gb,Pb=$("#"+p+"_jGraduate_StopSlider"),ob,ab,Xa,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Fa,Za=1,Ra=1,$a=0,Ja=Ka,pb=Qa;ab=a("svg",{width:"100%",height:45},Pb[0]);ba=a("pattern",{width:16,
|
1)this.value=1;if(!(aa[0]==="f"&&!mb))if(M&&ca==="radialGradient"||!M&&ca==="linearGradient")ea.setAttribute(aa,this.value);var I=M?aa[0]==="c"?Ia:Pa:aa[1]==="1"?Ya:Na,Y=aa.indexOf("x")>=0?"left":"top";I.css(Y,this.value*fa)}).change()});var Ga,Gb,Pb=$("#"+p+"_jGraduate_StopSlider"),nb,ab,Xa,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Fa,Za=1,Ra=1,$a=0,Ja=Ka,ob=Qa;ab=a("svg",{width:"100%",height:45},Pb[0]);ba=a("pattern",{width:16,
|
||||||
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",z.images.clientPath+"map-opacity.png");$(ab).click(function(na){Fa=Pb.offset();if(na.target.tagName!=="path"){var aa=na.pageX-Fa.left-8;aa=aa<10?10:aa>fa+10?fa+10:aa;o(aa/fa,0,0,true);na.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Gb=a("g",{},ab);a("line",{x1:10,y1:15,x2:fa+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var Cb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",
|
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",z.images.clientPath+"map-opacity.png");$(ab).click(function(na){Fa=Pb.offset();if(na.target.tagName!=="path"){var aa=na.pageX-Fa.left-8;aa=aa<10?10:aa>fa+10?fa+10:aa;o(aa/fa,0,0,true);na.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Gb=a("g",{},ab);a("line",{x1:10,y1:15,x2:fa+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var Cb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",
|
||||||
$(this).val())}),db=null,hb=function(na){var aa=na.pageX-xb.left,ta=na.pageY-xb.top;aa=aa<0?0:aa>fa?fa:aa;ta=ta<0?0:ta>fa?fa:ta;db.css("left",aa).css("top",ta);aa/=sa;ta/=ia;var M=db.data("coord"),I=ea;switch(M){case "start":pa.x1.val(aa);pa.y1.val(ta);I.setAttribute("x1",aa);I.setAttribute("y1",ta);break;case "end":pa.x2.val(aa);pa.y2.val(ta);I.setAttribute("x2",aa);I.setAttribute("y2",ta);break;case "center":pa.cx.val(aa);pa.cy.val(ta);I.setAttribute("cx",aa);I.setAttribute("cy",ta);Ja=aa;pb=ta;
|
$(this).val())}),eb=null,hb=function(na){var aa=na.pageX-xb.left,ta=na.pageY-xb.top;aa=aa<0?0:aa>fa?fa:aa;ta=ta<0?0:ta>fa?fa:ta;eb.css("left",aa).css("top",ta);aa/=sa;ta/=ha;var M=eb.data("coord"),I=ea;switch(M){case "start":pa.x1.val(aa);pa.y1.val(ta);I.setAttribute("x1",aa);I.setAttribute("y1",ta);break;case "end":pa.x2.val(aa);pa.y2.val(ta);I.setAttribute("x2",aa);I.setAttribute("y2",ta);break;case "center":pa.cx.val(aa);pa.cy.val(ta);I.setAttribute("cx",aa);I.setAttribute("cy",ta);Ja=aa;ob=ta;
|
||||||
e();break;case "focus":pa.fx.val(aa);pa.fy.val(ta);I.setAttribute("fx",aa);I.setAttribute("fy",ta);e()}na.preventDefault()},ib=function(){db=null;da.unbind("mousemove",hb).unbind("mouseup",ib)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(Da<2){for(;Da<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++Da}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var Da=Ga.length;for(Y=0;Y<Da;Y++)o(0,0,0,0,Ga[Y]);Cb.val(ea.getAttribute("spreadMethod")||"pad");var xb,mb=false;qa.setAttribute("fill-opacity",
|
e();break;case "focus":pa.fx.val(aa);pa.fy.val(ta);I.setAttribute("fx",aa);I.setAttribute("fy",ta);e()}na.preventDefault()},ib=function(){eb=null;da.unbind("mousemove",hb).unbind("mouseup",ib)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(Da<2){for(;Da<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++Da}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var Da=Ga.length;for(Z=0;Z<Da;Z++)o(0,0,0,0,Ga[Z]);Cb.val(ea.getAttribute("spreadMethod")||"pad");var xb,mb=false;qa.setAttribute("fill-opacity",
|
||||||
ra/100);$("#"+p+" div.grad_coord").mousedown(function(na){na.preventDefault();db=$(this);db.offset();xb=db.parent().offset();da.mousemove(hb).mouseup(ib)});$("#"+p+"_jGraduate_Ok").bind("click",function(){u.paint.type=ca;u.paint[ca]=ea.cloneNode(true);u.paint.solidColor=null;T()});$("#"+p+"_jGraduate_Cancel").bind("click",function(){N()});if(ca==="radialGradient")if(mb)Pa.show();else{Pa.hide();pa.fx.val("");pa.fy.val("")}$("#"+p+"_jGraduate_match_ctr")[0].checked=!mb;var zb,Db;$("#"+p+"_jGraduate_match_ctr").change(function(){mb=
|
ra/100);$("#"+p+" div.grad_coord").mousedown(function(na){na.preventDefault();eb=$(this);eb.offset();xb=eb.parent().offset();da.mousemove(hb).mouseup(ib)});$("#"+p+"_jGraduate_Ok").bind("click",function(){u.paint.type=ca;u.paint[ca]=ea.cloneNode(true);u.paint.solidColor=null;T()});$("#"+p+"_jGraduate_Cancel").bind("click",function(){N()});if(ca==="radialGradient")if(mb)Pa.show();else{Pa.hide();pa.fx.val("");pa.fy.val("")}$("#"+p+"_jGraduate_match_ctr")[0].checked=!mb;var zb,Db;$("#"+p+"_jGraduate_match_ctr").change(function(){mb=
|
||||||
!this.checked;Pa.toggle(mb);pa.fx.val("");pa.fy.val("");var na=ea;if(mb){var aa=zb||0.5,ta=Db||0.5;na.setAttribute("fx",aa);na.setAttribute("fy",ta);pa.fx.val(aa);pa.fy.val(ta)}else{zb=na.getAttribute("fx");Db=na.getAttribute("fy");na.removeAttribute("fx");na.removeAttribute("fy")}});Ga=ea.getElementsByTagNameNS(n.svg,"stop");Da=Ga.length;if(Da<2){for(;Da<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++Da}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var nb;ra=O=0;if(ca==="radialGradient"){S=
|
!this.checked;Pa.toggle(mb);pa.fx.val("");pa.fy.val("");var na=ea;if(mb){var aa=zb||0.5,ta=Db||0.5;na.setAttribute("fx",aa);na.setAttribute("fy",ta);pa.fx.val(aa);pa.fy.val(ta)}else{zb=na.getAttribute("fx");Db=na.getAttribute("fy");na.removeAttribute("fx");na.removeAttribute("fy")}});Ga=ea.getElementsByTagNameNS(n.svg,"stop");Da=Ga.length;if(Da<2){for(;Da<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++Da}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var pb;ra=O=0;if(ca==="radialGradient"){S=
|
||||||
ea.gradientTransform.baseVal;if(S.numberOfItems===2){Da=S.getItem(0);S=S.getItem(1);if(Da.type===2&&S.type===3){Da=S.matrix;if(Da.a!==1)O=Math.round(-(1-Da.a)*100);else if(Da.d!==1)O=Math.round((1-Da.d)*100)}}else if(S.numberOfItems===3){ba=S.getItem(0);Da=S.getItem(1);S=S.getItem(2);if(ba.type===4&&Da.type===2&&S.type===3){ra=Math.round(ba.angle);Da=S.matrix;if(Da.a!==1)O=Math.round(-(1-Da.a)*100);else if(Da.d!==1)O=Math.round((1-Da.d)*100)}}}O={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+
|
ea.gradientTransform.baseVal;if(S.numberOfItems===2){Da=S.getItem(0);S=S.getItem(1);if(Da.type===2&&S.type===3){Da=S.matrix;if(Da.a!==1)O=Math.round(-(1-Da.a)*100);else if(Da.d!==1)O=Math.round((1-Da.d)*100)}}else if(S.numberOfItems===3){ba=S.getItem(0);Da=S.getItem(1);S=S.getItem(2);if(ba.type===4&&Da.type===2&&S.type===3){ra=Math.round(ba.angle);Da=S.matrix;if(Da.a!==1)O=Math.round(-(1-Da.a)*100);else if(Da.d!==1)O=Math.round((1-Da.d)*100)}}}O={radius:{handle:"#"+p+"_jGraduate_RadiusArrows",input:"#"+
|
||||||
p+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:ra}};$.each(O,function(na,aa){var ta=$(aa.handle);ta.mousedown(function(M){var I=ta.parent();nb={type:na,elem:ta,input:$(aa.input),parent:I,offset:I.offset()};
|
p+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||0.5)*100},opacity:{handle:"#"+p+"_jGraduate_OpacArrows",input:"#"+p+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+p+"_jGraduate_EllipArrows",input:"#"+p+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+p+"_jGraduate_AngleArrows",input:"#"+p+"_jGraduate_AngleInput",val:ra}};$.each(O,function(na,aa){var ta=$(aa.handle);ta.mousedown(function(M){var I=ta.parent();pb={type:na,elem:ta,input:$(aa.input),parent:I,offset:I.offset()};
|
||||||
da.mousemove(Eb).mouseup(Kb);M.preventDefault()});$(aa.input).val(aa.val).change(function(){var M=+this.value,I=0,X=ca==="radialGradient";switch(na){case "radius":X&&ea.setAttribute("r",M/100);I=Math.pow(M/100,0.4)/2*145;break;case "opacity":u.paint.alpha=M;qa.setAttribute("fill-opacity",M/100);I=M*1.45;break;case "ellip":Za=Ra=1;if(M===0){I=72.5;break}if(M>99.5)M=99.5;if(M>0)Ra=1-M/100;else Za=-(M/100)-1;I=145*((M+100)/2)/100;X&&e();break;case "angle":$a=M;I=$a/180;I+=0.5;I*=145;X&&e()}if(I>145)I=
|
da.mousemove(Eb).mouseup(Kb);M.preventDefault()});$(aa.input).val(aa.val).change(function(){var M=+this.value,I=0,Y=ca==="radialGradient";switch(na){case "radius":Y&&ea.setAttribute("r",M/100);I=Math.pow(M/100,0.4)/2*145;break;case "opacity":u.paint.alpha=M;qa.setAttribute("fill-opacity",M/100);I=M*1.45;break;case "ellip":Za=Ra=1;if(M===0){I=72.5;break}if(M>99.5)M=99.5;if(M>0)Ra=1-M/100;else Za=-(M/100)-1;I=145*((M+100)/2)/100;Y&&e();break;case "angle":$a=M;I=$a/180;I+=0.5;I*=145;Y&&e()}if(I>145)I=
|
||||||
145;else if(I<0)I=0;ta.css({"margin-left":I-5})}).change()});var Eb=function(na){var aa=na.pageX-nb.offset.left-parseInt(nb.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ta=aa-5;aa/=145;switch(nb.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);qa.setAttribute("fill-opacity",aa);break;case "ellip":Ra=Za=1;if(aa<0.5){aa/=0.5;Za=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5;
|
145;else if(I<0)I=0;ta.css({"margin-left":I-5})}).change()});var Eb=function(na){var aa=na.pageX-pb.offset.left-parseInt(pb.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ta=aa-5;aa/=145;switch(pb.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);qa.setAttribute("fill-opacity",aa);break;case "ellip":Ra=Za=1;if(aa<0.5){aa/=0.5;Za=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5;
|
||||||
aa=2-aa;Ra=aa<=0?0.01:aa}e();aa-=1;if(Ra===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;$a=aa*=180;e();aa/=100}nb.elem.css({"margin-left":ta});aa=Math.round(aa*100);nb.input.val(aa);na.preventDefault()},Kb=function(){da.unbind("mousemove",Eb).unbind("mouseup",Kb);nb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];K=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(K=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,
|
aa=2-aa;Ra=aa<=0?0.01:aa}e();aa-=1;if(Ra===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;$a=aa*=180;e();aa/=100}pb.elem.css({"margin-left":ta});aa=Math.round(aa*100);pb.input.val(aa);na.preventDefault()},Kb=function(){da.unbind("mousemove",Eb).unbind("mouseup",Kb);pb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(J=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,
|
||||||
effects:{type:"show",speed:0}});V.jPicker({window:{title:z.window.pickerTitle},images:{clientPath:z.images.clientPath},color:{active:K,alphaSupport:true}},function(na){u.paint.type="solidColor";u.paint.alpha=na.val("ahex")?Math.round(na.val("a")/255*100):100;u.paint.solidColor=na.val("hex")?na.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){N()});var Ib=$(L+" .jGraduate_tabs li");Ib.click(function(){Ib.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");
|
effects:{type:"show",speed:0}});V.jPicker({window:{title:z.window.pickerTitle},images:{clientPath:z.images.clientPath},color:{active:J,alphaSupport:true}},function(na){u.paint.type="solidColor";u.paint.alpha=na.val("ahex")?Math.round(na.val("a")/255*100):100;u.paint.solidColor=na.val("hex")?na.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){N()});var Ib=$(L+" .jGraduate_tabs li");Ib.click(function(){Ib.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");
|
||||||
$(L+" > div").hide();var na=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(na==="rg"||na==="lg"){$(".jGraduate_"+na+"_field").show();$(".jGraduate_"+(na==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+na+"_jgraduate_grad)");ca=na==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+p+"_"+na+"_jgraduate_grad")[0];if(ea!==aa){var ta=$(ea).find("stop");$(aa).empty().append(ta);
|
$(L+" > div").hide();var na=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(na==="rg"||na==="lg"){$(".jGraduate_"+na+"_field").show();$(".jGraduate_"+(na==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+na+"_jgraduate_grad)");ca=na==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+p+"_"+na+"_jgraduate_grad")[0];if(ea!==aa){var ta=$(ea).find("stop");$(aa).empty().append(ta);
|
||||||
ea=aa;aa=Cb.val();ea.setAttribute("spreadMethod",aa)}mb=na==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Ma&&Qa==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(mb);if(mb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Ib.removeClass("jGraduate_tab_current");var Qb;switch(u.paint.type){case "linearGradient":Qb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Qb=$(L+" .jGraduate_tab_radgrad");break;
|
ea=aa;aa=Cb.val();ea.setAttribute("spreadMethod",aa)}mb=na==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Ma&&Qa==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(mb);if(mb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Ib.removeClass("jGraduate_tab_current");var Qb;switch(u.paint.type){case "linearGradient":Qb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Qb=$(L+" .jGraduate_tab_radgrad");break;
|
||||||
default:Qb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Qb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass?
|
default:Qb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Qb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass?
|
||||||
|
@ -66,12 +66,12 @@ $(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:u-o.left,y:
|
||||||
function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(f){if(f==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(f!=undefined)for(var c=f.split(","),m=0;m<c.length;m++)$(this).find('A[href="'+c[m]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(f){if(f==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(f!=
|
function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(f){if(f==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(f!=undefined)for(var c=f.split(","),m=0;m<c.length;m++)$(this).find('A[href="'+c[m]+'"]').parent().addClass("disabled")});return $(this)},enableContextMenuItems:function(f){if(f==undefined){$(this).find("LI.disabled").removeClass("disabled");return $(this)}$(this).each(function(){if(f!=
|
||||||
undefined)for(var c=f.split(","),m=0;m<c.length;m++)$(this).find('A[href="'+c[m]+'"]').parent().removeClass("disabled")});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})}(jQuery);var svgedit=svgedit||{};
|
undefined)for(var c=f.split(","),m=0;m<c.length;m++)$(this).find('A[href="'+c[m]+'"]').parent().removeClass("disabled")});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})}(jQuery);var svgedit=svgedit||{};
|
||||||
(function(){if(!svgedit.browser)svgedit.browser={};var a=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;svgedit.browser.supportsSvg=function(){return a};if(svgedit.browser.supportsSvg()){var n=navigator.userAgent,f=document.createElementNS("http://www.w3.org/2000/svg","svg"),c=!!window.opera,m=n.indexOf("AppleWebKit")>=0,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>=
|
(function(){if(!svgedit.browser)svgedit.browser={};var a=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;svgedit.browser.supportsSvg=function(){return a};if(svgedit.browser.supportsSvg()){var n=navigator.userAgent,f=document.createElementNS("http://www.w3.org/2000/svg","svg"),c=!!window.opera,m=n.indexOf("AppleWebKit")>=0,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>=
|
||||||
0,u="ontouchstart"in window,z=!!f.querySelector,p=!!document.evaluate,L=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","path");sa.setAttribute("d","M0,0 10,10");var ia=sa.pathSegList;sa=sa.createSVGPathSegLinetoAbs(5,5);try{ia.replaceItem(sa,0);return true}catch(ca){}return false}(),T=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","path");sa.setAttribute("d","M0,0 10,10");var ia=sa.pathSegList;sa=sa.createSVGPathSegLinetoAbs(5,5);try{ia.insertItemBefore(sa,
|
0,u="ontouchstart"in window,z=!!f.querySelector,p=!!document.evaluate,L=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","path");sa.setAttribute("d","M0,0 10,10");var ha=sa.pathSegList;sa=sa.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(sa,0);return true}catch(ca){}return false}(),T=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","path");sa.setAttribute("d","M0,0 10,10");var ha=sa.pathSegList;sa=sa.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(sa,
|
||||||
0);return true}catch(ca){}return false}(),N=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","svg"),ia=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(sa);ia.setAttribute("x",5);sa.appendChild(ia);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ia.appendChild(ca);ia=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(sa);return ia===0}(),K=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg",
|
0);return true}catch(ca){}return false}(),N=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(sa);ha.setAttribute("x",5);sa.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(sa);return ha===0}(),J=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg",
|
||||||
"svg");document.documentElement.appendChild(sa);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 C0,0 10,10 10,0");sa.appendChild(ia);ia=ia.getBBox();document.documentElement.removeChild(sa);return ia.height>4&&ia.height<5}(),da=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(sa);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 10,0");var ca=
|
"svg");document.documentElement.appendChild(sa);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");sa.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(sa);return ha.height>4&&ha.height<5}(),da=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(sa);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca=
|
||||||
document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ia);ea.appendChild(ca);sa.appendChild(ea);ia=ea.getBBox();document.documentElement.removeChild(sa);return ia.width==15}(),V=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect");sa.setAttribute("x",0.1);(sa=sa.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 <a href='http://opera.com'>latest version</a> in which the problems have been fixed.");
|
document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);sa.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(sa);return ha.width==15}(),V=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect");sa.setAttribute("x",0.1);(sa=sa.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 <a href='http://opera.com'>latest version</a> in which the problems have been fixed.");
|
||||||
return sa}(),O=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect");sa.setAttribute("style","vector-effect:non-scaling-stroke");return sa.style.vectorEffect==="non-scaling-stroke"}(),fa=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ia=f.createSVGTransform();sa.appendItem(ia);return sa.getItem(0)==ia}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o};
|
return sa}(),O=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect");sa.setAttribute("style","vector-effect:non-scaling-stroke");return sa.style.vectorEffect==="non-scaling-stroke"}(),fa=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();sa.appendItem(ha);return sa.getItem(0)==ha}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o};
|
||||||
svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return z};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return K};
|
svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return z};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return J};
|
||||||
svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return N};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return fa}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{};
|
svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return N};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return fa}}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"),n={};svgedit.transformlist.SVGTransformList=function(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m<this.numberOfItems;++m){var o=this._list.getItem(m);c=c;o=o;var b=o.matrix,d="";switch(o.type){case 1:d="matrix("+[b.a,b.b,b.c,b.d,b.e,b.f].join(",")+")";break;case 2:d="translate("+b.e+","+b.f+")";break;case 3:d=
|
(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),n={};svgedit.transformlist.SVGTransformList=function(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m<this.numberOfItems;++m){var o=this._list.getItem(m);c=c;o=o;var b=o.matrix,d="";switch(o.type){case 1:d="matrix("+[b.a,b.b,b.c,b.d,b.e,b.f].join(",")+")";break;case 2:d="translate("+b.e+","+b.f+")";break;case 3:d=
|
||||||
b.a==b.d?"scale("+b.a+")":"scale("+b.a+","+b.d+")";break;case 4:var e=0;d=0;if(o.angle!=0){e=1-b.a;d=(e*b.f+b.b*b.e)/(e*e+b.b*b.b);e=(b.e-b.b*d)/e}d="rotate("+o.angle+" "+e+","+d+")"}c=c+(d+" ")}this._elem.setAttribute("transform",c)};this._list=this;this._init=function(){var c=this._elem.getAttribute("transform");if(c)for(var m=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,o=true;o;){o=c.match(m);c=c.replace(m,"");if(o&&o[1]){var b=o[1].split(/\s*\(/),d=b[0];b=b[1].match(/\s*(.*?)\s*\)/);
|
b.a==b.d?"scale("+b.a+")":"scale("+b.a+","+b.d+")";break;case 4:var e=0;d=0;if(o.angle!=0){e=1-b.a;d=(e*b.f+b.b*b.e)/(e*e+b.b*b.b);e=(b.e-b.b*d)/e}d="rotate("+o.angle+" "+e+","+d+")"}c=c+(d+" ")}this._elem.setAttribute("transform",c)};this._list=this;this._init=function(){var c=this._elem.getAttribute("transform");if(c)for(var m=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,o=true;o;){o=c.match(m);c=c.replace(m,"");if(o&&o[1]){var b=o[1].split(/\s*\(/),d=b[0];b=b[1].match(/\s*(.*?)\s*\)/);
|
||||||
|
@ -98,8 +98,8 @@ e=e<<2|l>>4;l=(l&15)<<4|z>>2;u=(z&3)<<6|p;d+=String.fromCharCode(e);if(z!=64)d+=
|
||||||
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(u){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}};
|
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(u){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}};
|
||||||
svgedit.utilities.walkTreePost=function(b,d){if(b&&b.nodeType==1){for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d);d(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",
|
svgedit.utilities.walkTreePost=function(b,d){if(b&&b.nodeType==1){for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d);d(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,d){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d)};svgedit.utilities.findDefs=function(b){b=f.getSVGContent().documentElement;var d=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return d=d.length>0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var l=d.getItem(0),
|
"href")};svgedit.utilities.setHref=function(b,d){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d)};svgedit.utilities.findDefs=function(b){b=f.getSVGContent().documentElement;var d=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return d=d.length>0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var l=d.getItem(0),
|
||||||
u=[l.x,l.y];for(l=0;l<e;l++){var z=d.getItem(l);if(typeof z.x!="undefined"){b[0].push(u[0]);b[1].push(u[1]);if(z.x1){for(var p=[z.x1,z.y1],L=[z.x2,z.y2],T=[z.x,z.y],N=0;N<2;N++){z=function(fa){return Math.pow(1-fa,3)*u[N]+3*Math.pow(1-fa,2)*fa*p[N]+3*(1-fa)*Math.pow(fa,2)*L[N]+Math.pow(fa,3)*T[N]};var K=6*u[N]-12*p[N]+6*L[N],da=-3*u[N]+9*p[N]-9*L[N]+3*T[N],V=3*p[N]-3*u[N];if(da==0){if(K!=0){K=-V/K;0<K&&K<1&&b[N].push(z(K))}}else{V=Math.pow(K,2)-4*V*da;if(!(V<0)){var O=(-K+Math.sqrt(V))/(2*da);0<O&&
|
u=[l.x,l.y];for(l=0;l<e;l++){var z=d.getItem(l);if(typeof z.x!="undefined"){b[0].push(u[0]);b[1].push(u[1]);if(z.x1){for(var p=[z.x1,z.y1],L=[z.x2,z.y2],T=[z.x,z.y],N=0;N<2;N++){z=function(fa){return Math.pow(1-fa,3)*u[N]+3*Math.pow(1-fa,2)*fa*p[N]+3*(1-fa)*Math.pow(fa,2)*L[N]+Math.pow(fa,3)*T[N]};var J=6*u[N]-12*p[N]+6*L[N],da=-3*u[N]+9*p[N]-9*L[N]+3*T[N],V=3*p[N]-3*u[N];if(da==0){if(J!=0){J=-V/J;0<J&&J<1&&b[N].push(z(J))}}else{V=Math.pow(J,2)-4*V*da;if(!(V<0)){var O=(-J+Math.sqrt(V))/(2*da);0<O&&
|
||||||
O<1&&b[N].push(z(O));K=(-K-Math.sqrt(V))/(2*da);0<K&&K<1&&b[N].push(z(K))}}}u=T}else{b[0].push(z.x);b[1].push(z.y)}}}d=Math.min.apply(null,b[0]);e=Math.max.apply(null,b[0])-d;l=Math.min.apply(null,b[1]);b=Math.max.apply(null,b[1])-l;return{x:d,y:l,width:e,height:b}};svgedit.utilities.getBBox=function(b){var d=b||f.geSelectedElements()[0];if(b.nodeType!=1)return null;b=null;var e=d.nodeName;switch(e){case "text":if(d.textContent===""){d.textContent="a";b=d.getBBox();d.textContent=""}else try{b=d.getBBox()}catch(l){}break;
|
O<1&&b[N].push(z(O));J=(-J-Math.sqrt(V))/(2*da);0<J&&J<1&&b[N].push(z(J))}}}u=T}else{b[0].push(z.x);b[1].push(z.y)}}}d=Math.min.apply(null,b[0]);e=Math.max.apply(null,b[0])-d;l=Math.min.apply(null,b[1]);b=Math.max.apply(null,b[1])-l;return{x:d,y:l,width:e,height:b}};svgedit.utilities.getBBox=function(b){var d=b||f.geSelectedElements()[0];if(b.nodeType!=1)return null;b=null;var e=d.nodeName;switch(e){case "text":if(d.textContent===""){d.textContent="a";b=d.getBBox();d.textContent=""}else try{b=d.getBBox()}catch(l){}break;
|
||||||
case "path":if(svgedit.browser.supportsPathBBox())try{b=d.getBBox()}catch(u){}else b=svgedit.utilities.getPathBBox(d);break;case "g":case "a":b=a(d);break;default:if(e==="use")b=a(d,true);if(e==="use"){b||(b=d.getBBox());if(!svgedit.browser.isWebkit()){e={};e.width=b.width;e.height=b.height;e.x=b.x+parseFloat(d.getAttribute("x")||0);e.y=b.y+parseFloat(d.getAttribute("y")||0);b=e}}else if(~n.indexOf(e))try{b=d.getBBox()}catch(z){d=$(d).closest("foreignObject");if(d.length)try{b=d[0].getBBox()}catch(p){b=
|
case "path":if(svgedit.browser.supportsPathBBox())try{b=d.getBBox()}catch(u){}else b=svgedit.utilities.getPathBBox(d);break;case "g":case "a":b=a(d);break;default:if(e==="use")b=a(d,true);if(e==="use"){b||(b=d.getBBox());if(!svgedit.browser.isWebkit()){e={};e.width=b.width;e.height=b.height;e.x=b.x+parseFloat(d.getAttribute("x")||0);e.y=b.y+parseFloat(d.getAttribute("y")||0);b=e}}else if(~n.indexOf(e))try{b=d.getBBox()}catch(z){d=$(d).closest("foreignObject");if(d.length)try{b=d[0].getBBox()}catch(p){b=
|
||||||
null}else b=null}}if(b)b=svgedit.utilities.bboxToObj(b);return b};svgedit.utilities.getRotationAngle=function(b,d){var e=b||f.getSelectedElements()[0];e=svgedit.transformlist.getTransformList(e);if(!e)return 0;for(var l=e.numberOfItems,u=0;u<l;++u){var z=e.getItem(u);if(z.type==4)return d?z.angle*Math.PI/180:z.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(b){return o.querySelector("#"+b)}:svgedit.browser.supportsXpath()?function(b){return c.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
|
null}else b=null}}if(b)b=svgedit.utilities.bboxToObj(b);return b};svgedit.utilities.getRotationAngle=function(b,d){var e=b||f.getSelectedElements()[0];e=svgedit.transformlist.getTransformList(e);if(!e)return 0;for(var l=e.numberOfItems,u=0;u<l;++u){var z=e.getItem(u);if(z.type==4)return d?z.angle*Math.PI/180:z.angle}return 0};svgedit.utilities.getElem=svgedit.browser.supportsSelectors()?function(b){return o.querySelector("#"+b)}:svgedit.browser.supportsXpath()?function(b){return c.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+
|
||||||
b+'"]',m,function(){return"http://www.w3.org/2000/svg"},9,null).singleNodeValue}:function(b){return $(o).find("[id="+b+"]")[0]};svgedit.utilities.assignAttributes=function(b,d,e,l){e||(e=0);svgedit.browser.isOpera()||o.suspendRedraw(e);for(var u in d)if(e=u.substr(0,4)==="xml:"?"http://www.w3.org/XML/1998/namespace":u.substr(0,6)==="xlink:"?"http://www.w3.org/1999/xlink":null)b.setAttributeNS(e,u,d[u]);else l?svgedit.units.setUnitAttr(b,u,d[u]):b.setAttribute(u,d[u]);svgedit.browser.isOpera()||o.unsuspendRedraw(null)};
|
b+'"]',m,function(){return"http://www.w3.org/2000/svg"},9,null).singleNodeValue}:function(b){return $(o).find("[id="+b+"]")[0]};svgedit.utilities.assignAttributes=function(b,d,e,l){e||(e=0);svgedit.browser.isOpera()||o.suspendRedraw(e);for(var u in d)if(e=u.substr(0,4)==="xml:"?"http://www.w3.org/XML/1998/namespace":u.substr(0,6)==="xlink:"?"http://www.w3.org/1999/xlink":null)b.setAttributeNS(e,u,d[u]);else l?svgedit.units.setUnitAttr(b,u,d[u]):b.setAttribute(u,d[u]);svgedit.browser.isOpera()||o.unsuspendRedraw(null)};
|
||||||
|
@ -122,7 +122,7 @@ symbol:["class","fill","fill-opacity","fill-rule","filter","font-family","font-s
|
||||||
0){var l=e.split(":");b[l[1]]=n[l[0]]}else b[e]=e=="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 o=m.parentNode;if(m.ownerDocument&&o){var b=f[m.nodeName],d=c[m.nodeName];if(b!=undefined){for(var e=[],l=m.attributes.length;l--;){var u=m.attributes.item(l),z=u.nodeName,
|
0){var l=e.split(":");b[l[1]]=n[l[0]]}else b[e]=e=="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 o=m.parentNode;if(m.ownerDocument&&o){var b=f[m.nodeName],d=c[m.nodeName];if(b!=undefined){for(var e=[],l=m.attributes.length;l--;){var u=m.attributes.item(l),z=u.nodeName,
|
||||||
p=u.localName,L=u.namespaceURI;if(!(d.hasOwnProperty(p)&&L==d[p]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){z.indexOf("se:")==0&&e.push([z,u.nodeValue]);m.removeAttributeNS(L,p)}if(svgedit.browser.isGecko())switch(z){case "transform":case "gradientTransform":case "patternTransform":p=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(z,p)}if(z=="style"){u=u.nodeValue.split(";");for(z=u.length;z--;){p=u[z].split(":");b.indexOf(p[0])>=0&&m.setAttribute(p[0],
|
p=u.localName,L=u.namespaceURI;if(!(d.hasOwnProperty(p)&&L==d[p]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){z.indexOf("se:")==0&&e.push([z,u.nodeValue]);m.removeAttributeNS(L,p)}if(svgedit.browser.isGecko())switch(z){case "transform":case "gradientTransform":case "patternTransform":p=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(z,p)}if(z=="style"){u=u.nodeValue.split(";");for(z=u.length;z--;){p=u[z].split(":");b.indexOf(p[0])>=0&&m.setAttribute(p[0],
|
||||||
p[1])}m.removeAttribute("style")}}$.each(e,function(T,N){m.setAttributeNS("http://svg-edit.googlecode.com",N[0],N[1])});if((l=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start",
|
p[1])}m.removeAttribute("style")}}$.each(e,function(T,N){m.setAttributeNS("http://svg-edit.googlecode.com",N[0],N[1])});if((l=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start",
|
||||||
"mask","stroke"],function(T,N){var K=m.getAttribute(N);if(K)if((K=svgedit.utilities.getUrlFromAttr(K))&&K[0]!=="#"){m.setAttribute(N,"");m.removeAttribute(N)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();svgedit=svgedit||{};
|
"mask","stroke"],function(T,N){var J=m.getAttribute(N);if(J)if((J=svgedit.utilities.getUrlFromAttr(J))&&J[0]!=="#"){m.setAttribute(N,"");m.removeAttribute(N)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();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,n,f,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=n;this.oldParent=f;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type=
|
(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,n,f,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=n;this.oldParent=f;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,
|
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,n){this.elem=a;this.text=n||"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=
|
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,n){this.elem=a;this.text=n||"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=
|
||||||
|
@ -145,7 +145,7 @@ svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.un
|
||||||
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 o in f.selectorGrips)m.push(o);for(;c>0;){m.push(m.shift());c--}c=0;for(o in f.selectorGrips){f.selectorGrips[o].setAttribute("style","cursor:"+m[c]+"-resize");c++}};
|
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 o in f.selectorGrips)m.push(o);for(;c>0;){m.push(m.shift());c--}c=0;for(o in f.selectorGrips){f.selectorGrips[o].setAttribute("style","cursor:"+m[c]+"-resize");c++}};
|
||||||
svgedit.select.Selector.prototype.showGrips=function(c){f.selectorGripsGroup.setAttribute("display",c?"inline":"none");var m=this.selectedElement;this.hasGrips=c;if(m&&c){this.selectorGroup.appendChild(f.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(m))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,m=f,o=m.selectorGrips,b=this.selectedElement,d=b.getAttribute("stroke-width"),e=a.currentZoom(),l=1/e;if(b.getAttribute("stroke")!=="none"&&
|
svgedit.select.Selector.prototype.showGrips=function(c){f.selectorGripsGroup.setAttribute("display",c?"inline":"none");var m=this.selectedElement;this.hasGrips=c;if(m&&c){this.selectorGroup.appendChild(f.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(m))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,m=f,o=m.selectorGrips,b=this.selectedElement,d=b.getAttribute("stroke-width"),e=a.currentZoom(),l=1/e;if(b.getAttribute("stroke")!=="none"&&
|
||||||
!isNaN(d))l+=d/2;var u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var z=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))z=u;u=z.x;var p=z.y,L=z.width;z=z.height;l*=e;e=svgedit.math.transformBox(u*e,p*e,L*e,z*e,d);d=e.aabox;u=d.x-l;p=d.y-l;L=d.width+l*2;var T=d.height+l*2;d=u+L/2;z=p+T/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform();
|
!isNaN(d))l+=d/2;var u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var z=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))z=u;u=z.x;var p=z.y,L=z.width;z=z.height;l*=e;e=svgedit.math.transformBox(u*e,p*e,L*e,z*e,d);d=e.aabox;u=d.x-l;p=d.y-l;L=d.width+l*2;var T=d.height+l*2;d=u+L/2;z=p+T/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform();
|
||||||
u.setRotate(-b,d,z);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;L=u.x;T=u.y;var N=u.x,K=u.y;u=Math.min;p=Math.max;L=u(L,u(e.tr.x,u(e.bl.x,e.br.x)))-l;T=u(T,u(e.tr.y,u(e.bl.y,e.br.y)))-l;N=p(N,p(e.tr.x,p(e.bl.x,e.br.x)))+l;K=p(K,p(e.tr.y,p(e.bl.y,e.br.y)))+l;u=L;p=T;L=N-L;T=K-T}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d",
|
u.setRotate(-b,d,z);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;L=u.x;T=u.y;var N=u.x,J=u.y;u=Math.min;p=Math.max;L=u(L,u(e.tr.x,u(e.bl.x,e.br.x)))-l;T=u(T,u(e.tr.y,u(e.bl.y,e.br.y)))-l;N=p(N,p(e.tr.x,p(e.bl.x,e.br.x)))+l;J=p(J,p(e.tr.y,p(e.bl.y,e.br.y)))+l;u=L;p=T;L=N-L;T=J-T}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d",
|
||||||
"M"+u+","+p+" L"+(u+L)+","+p+" "+(u+L)+","+(p+T)+" "+u+","+(p+T)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,z].join(",")+")":"");u-=3.5;p-=3.5;this.gripCoords={nw:[u,p],ne:[u+L,p],sw:[u,p+T],se:[u+L,p+T],n:[u+L/2,p],w:[u,p+T/2],e:[u+L,p+T/2],s:[u+L/2,p+T]};for(var da in this.gripCoords){c=this.gripCoords[da];o[da].setAttribute("x",c[0]);o[da].setAttribute("y",c[1])}this.rotateCoords={nw:[u,p],ne:[u+L+8,p],sw:[u,p+T+8],se:[u+L+8,p+T+8]};for(da in this.rotateCoords){c=this.rotateCoords[da];
|
"M"+u+","+p+" L"+(u+L)+","+p+" "+(u+L)+","+(p+T)+" "+u+","+(p+T)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,z].join(",")+")":"");u-=3.5;p-=3.5;this.gripCoords={nw:[u,p],ne:[u+L,p],sw:[u,p+T],se:[u+L,p+T],n:[u+L/2,p],w:[u,p+T/2],e:[u+L,p+T/2],s:[u+L/2,p+T]};for(var da in this.gripCoords){c=this.gripCoords[da];o[da].setAttribute("x",c[0]);o[da].setAttribute("y",c[1])}this.rotateCoords={nw:[u,p],ne:[u+L+8,p],sw:[u,p+T+8],se:[u+L+8,p+T+8]};for(da in this.rotateCoords){c=this.rotateCoords[da];
|
||||||
m.rotateGrips[da].setAttribute("cx",c[0]);m.rotateGrips[da].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(l)};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&&
|
m.rotateGrips[da].setAttribute("cx",c[0]);m.rotateGrips[da].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(l)};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 m=a.createSVGElement({element:"circle",
|
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 m=a.createSVGElement({element:"circle",
|
||||||
|
@ -174,7 +174,7 @@ return l};svgedit.path.addPointGrip=function(d,e,l){var u=svgedit.path.getGripCo
|
||||||
svgedit.path.path.setSegType()})}e&&l&&svgedit.utilities.assignAttributes(z,{x:e-2.5,y:l-2.5,display:"inline"});return z};svgedit.path.getGripContainer=function(){var d=svgedit.utilities.getElem("pathpointgrip_container");if(!d){d=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));d.id="pathpointgrip_container"}return d};svgedit.path.addCtrlGrip=function(d){var e=svgedit.utilities.getElem("ctrlpointgrip_"+d);if(e)return e;e=document.createElementNS("http://www.w3.org/2000/svg",
|
svgedit.path.path.setSegType()})}e&&l&&svgedit.utilities.assignAttributes(z,{x:e-2.5,y:l-2.5,display:"inline"});return z};svgedit.path.getGripContainer=function(){var d=svgedit.utilities.getElem("pathpointgrip_container");if(!d){d=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));d.id="pathpointgrip_container"}return d};svgedit.path.addCtrlGrip=function(d){var e=svgedit.utilities.getElem("ctrlpointgrip_"+d);if(e)return e;e=document.createElementNS("http://www.w3.org/2000/svg",
|
||||||
"circle");svgedit.utilities.assignAttributes(e,{id:"ctrlpointgrip_"+d,display:"none",r:3,fill:"#4F80FF",cursor:"move",style:"pointer-events:all","xlink:title":a.pathCtrlPtTooltip});svgedit.path.getGripContainer().appendChild(e);return e};svgedit.path.getCtrlLine=function(d){var e=svgedit.utilities.getElem("ctrlLine_"+d);if(e)return e;e=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(e,{id:"ctrlLine_"+d,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});
|
"circle");svgedit.utilities.assignAttributes(e,{id:"ctrlpointgrip_"+d,display:"none",r:3,fill:"#4F80FF",cursor:"move",style:"pointer-events:all","xlink:title":a.pathCtrlPtTooltip});svgedit.path.getGripContainer().appendChild(e);return e};svgedit.path.getCtrlLine=function(d){var e=svgedit.utilities.getElem("ctrlLine_"+d);if(e)return e;e=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(e,{id:"ctrlLine_"+d,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});
|
||||||
svgedit.path.getGripContainer().appendChild(e);return e};svgedit.path.getPointGrip=function(d,e){var l=svgedit.path.addPointGrip(d.index);if(e){var u=svgedit.path.getGripPt(d);svgedit.utilities.assignAttributes(l,{x:u.x-2.5,y:u.y-2.5,display:"inline"})}return l};svgedit.path.getControlPoints=function(d){var e=d.item,l=d.index;if(!("x1"in e)||!("x2"in e))return null;var u={};svgedit.path.getGripContainer();for(var z=[svgedit.path.path.segs[l-1].item,e],p=1;p<3;p++){var L=l+"c"+p,T=u["c"+p+"_line"]=
|
svgedit.path.getGripContainer().appendChild(e);return e};svgedit.path.getPointGrip=function(d,e){var l=svgedit.path.addPointGrip(d.index);if(e){var u=svgedit.path.getGripPt(d);svgedit.utilities.assignAttributes(l,{x:u.x-2.5,y:u.y-2.5,display:"inline"})}return l};svgedit.path.getControlPoints=function(d){var e=d.item,l=d.index;if(!("x1"in e)||!("x2"in e))return null;var u={};svgedit.path.getGripContainer();for(var z=[svgedit.path.path.segs[l-1].item,e],p=1;p<3;p++){var L=l+"c"+p,T=u["c"+p+"_line"]=
|
||||||
svgedit.path.getCtrlLine(L),N=svgedit.path.getGripPt(d,{x:e["x"+p],y:e["y"+p]}),K=svgedit.path.getGripPt(d,{x:z[p-1].x,y:z[p-1].y});svgedit.utilities.assignAttributes(T,{x1:N.x,y1:N.y,x2:K.x,y2:K.y,display:"inline"});u["c"+p+"_line"]=T;pointGrip=u["c"+p]=svgedit.path.addCtrlGrip(L);svgedit.utilities.assignAttributes(pointGrip,{cx:N.x,cy:N.y,display:"inline"});u["c"+p]=pointGrip}return u};svgedit.path.replacePathSeg=function(d,e,l,u){u=u||svgedit.path.path.elem;d=u["createSVGPathSeg"+f[d]].apply(u,
|
svgedit.path.getCtrlLine(L),N=svgedit.path.getGripPt(d,{x:e["x"+p],y:e["y"+p]}),J=svgedit.path.getGripPt(d,{x:z[p-1].x,y:z[p-1].y});svgedit.utilities.assignAttributes(T,{x1:N.x,y1:N.y,x2:J.x,y2:J.y,display:"inline"});u["c"+p+"_line"]=T;pointGrip=u["c"+p]=svgedit.path.addCtrlGrip(L);svgedit.utilities.assignAttributes(pointGrip,{cx:N.x,cy:N.y,display:"inline"});u["c"+p]=pointGrip}return u};svgedit.path.replacePathSeg=function(d,e,l,u){u=u||svgedit.path.path.elem;d=u["createSVGPathSeg"+f[d]].apply(u,
|
||||||
l);if(svgedit.browser.supportsPathReplaceItem())u.pathSegList.replaceItem(d,e);else{l=u.pathSegList;u=l.numberOfItems;for(var z=[],p=0;p<u;p++){var L=l.getItem(p);z.push(L)}l.clear();for(p=0;p<u;p++)p==e?l.appendItem(d):l.appendItem(z[p])}};svgedit.path.getSegSelector=function(d,e){var l=d.index,u=svgedit.utilities.getElem("segline_"+l);if(!u){var z=svgedit.path.getGripContainer();u=document.createElementNS("http://www.w3.org/2000/svg","path");svgedit.utilities.assignAttributes(u,{id:"segline_"+l,
|
l);if(svgedit.browser.supportsPathReplaceItem())u.pathSegList.replaceItem(d,e);else{l=u.pathSegList;u=l.numberOfItems;for(var z=[],p=0;p<u;p++){var L=l.getItem(p);z.push(L)}l.clear();for(p=0;p<u;p++)p==e?l.appendItem(d):l.appendItem(z[p])}};svgedit.path.getSegSelector=function(d,e){var l=d.index,u=svgedit.utilities.getElem("segline_"+l);if(!u){var z=svgedit.path.getGripContainer();u=document.createElementNS("http://www.w3.org/2000/svg","path");svgedit.utilities.assignAttributes(u,{id:"segline_"+l,
|
||||||
display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"});z.appendChild(u)}if(e){l=d.prev;if(!l){u.setAttribute("display","none");return u}l=svgedit.path.getGripPt(l);svgedit.path.replacePathSeg(2,0,[l.x,l.y],u);z=svgedit.path.ptObjToArr(d.type,d.item,true);for(var p=0;p<z.length;p+=2){l=svgedit.path.getGripPt(d,{x:z[p],y:z[p+1]});z[p]=l.x;z[p+1]=l.y}svgedit.path.replacePathSeg(d.type,1,z,u)}return u};svgedit.path.smoothControlPoints=this.smoothControlPoints=
|
display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"});z.appendChild(u)}if(e){l=d.prev;if(!l){u.setAttribute("display","none");return u}l=svgedit.path.getGripPt(l);svgedit.path.replacePathSeg(2,0,[l.x,l.y],u);z=svgedit.path.ptObjToArr(d.type,d.item,true);for(var p=0;p<z.length;p+=2){l=svgedit.path.getGripPt(d,{x:z[p],y:z[p+1]});z[p]=l.x;z[p+1]=l.y}svgedit.path.replacePathSeg(d.type,1,z,u)}return u};svgedit.path.smoothControlPoints=this.smoothControlPoints=
|
||||||
function(d,e,l){var u=d.x-l.x,z=d.y-l.y,p=e.x-l.x,L=e.y-l.y;if((u!=0||z!=0)&&(p!=0||L!=0)){d=Math.atan2(z,u);e=Math.atan2(L,p);u=Math.sqrt(u*u+z*z);p=Math.sqrt(p*p+L*L);z=o.getSVGRoot().createSVGPoint();L=o.getSVGRoot().createSVGPoint();if(d<0)d+=2*Math.PI;if(e<0)e+=2*Math.PI;var T=Math.abs(d-e),N=Math.abs(Math.PI-T)/2;if(d-e>0){d=T<Math.PI?d+N:d-N;e=T<Math.PI?e-N:e+N}else{d=T<Math.PI?d-N:d+N;e=T<Math.PI?e+N:e-N}z.x=u*Math.cos(d)+l.x;z.y=u*Math.sin(d)+l.y;L.x=p*Math.cos(e)+l.x;L.y=p*Math.sin(e)+l.y;
|
function(d,e,l){var u=d.x-l.x,z=d.y-l.y,p=e.x-l.x,L=e.y-l.y;if((u!=0||z!=0)&&(p!=0||L!=0)){d=Math.atan2(z,u);e=Math.atan2(L,p);u=Math.sqrt(u*u+z*z);p=Math.sqrt(p*p+L*L);z=o.getSVGRoot().createSVGPoint();L=o.getSVGRoot().createSVGPoint();if(d<0)d+=2*Math.PI;if(e<0)e+=2*Math.PI;var T=Math.abs(d-e),N=Math.abs(Math.PI-T)/2;if(d-e>0){d=T<Math.PI?d+N:d-N;e=T<Math.PI?e-N:e+N}else{d=T<Math.PI?d-N:d+N;e=T<Math.PI?e+N:e-N}z.x=u*Math.cos(d)+l.x;z.y=u*Math.sin(d)+l.y;L.x=p*Math.cos(e)+l.x;L.y=p*Math.sin(e)+l.y;
|
||||||
|
@ -186,332 +186,332 @@ this.next;if(!e)return;u=this.item}else{l=2;e=this.prev;if(!e)return;u=e.item}va
|
||||||
this.index,e);this.type=d;this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.showCtrlPts(d===6);this.ctrlpts=svgedit.path.getControlPoints(this);this.update(true)};svgedit.path.Path=function(d){if(!d||d.tagName!=="path")throw"svgedit.path.Path constructed without a <path> element";this.elem=d;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 d=
|
this.index,e);this.type=d;this.item=svgedit.path.path.elem.pathSegList.getItem(this.index);this.showCtrlPts(d===6);this.ctrlpts=svgedit.path.getControlPoints(this);this.update(true)};svgedit.path.Path=function(d){if(!d||d.tagName!=="path")throw"svgedit.path.Path constructed without a <path> element";this.elem=d;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 d=
|
||||||
this.elem.pathSegList,e=d.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var l=0;l<e;l++){var u=d.getItem(l);u=new svgedit.path.Segment(l,u);u.path=this;this.segs.push(u)}d=this.segs;u=null;for(l=0;l<e;l++){var z=d[l],p=l+1>=e?null:d[l+1],L=l-1<0?null:d[l-1];if(z.type===2){if(L&&L.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip()}u=l}else if(p&&p.type===1){z.next=d[u+1];z.next.prev=z;z.mate=d[u];z.addGrip();if(this.first_seg==null)this.first_seg=z}else if(p){if(z.type!==
|
this.elem.pathSegList,e=d.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var l=0;l<e;l++){var u=d.getItem(l);u=new svgedit.path.Segment(l,u);u.path=this;this.segs.push(u)}d=this.segs;u=null;for(l=0;l<e;l++){var z=d[l],p=l+1>=e?null:d[l+1],L=l-1<0?null:d[l-1];if(z.type===2){if(L&&L.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip()}u=l}else if(p&&p.type===1){z.next=d[u+1];z.next.prev=z;z.mate=d[u];z.addGrip();if(this.first_seg==null)this.first_seg=z}else if(p){if(z.type!==
|
||||||
1){z.addGrip();if(p&&p.type!==2){z.next=p;z.next.prev=z}}}else if(z.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip();z.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,l=0;l<e;l++)if(d.call(this.segs[l],l)===false)break};svgedit.path.Path.prototype.addSeg=function(d){var e=this.segs[d];if(e.prev){var l=e.prev,u;switch(e.item.pathSegType){case 4:var z=(e.item.x+l.item.x)/2,p=(e.item.y+l.item.y)/2;u=this.elem.createSVGPathSegLinetoAbs(z,
|
1){z.addGrip();if(p&&p.type!==2){z.next=p;z.next.prev=z}}}else if(z.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip();z.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,l=0;l<e;l++)if(d.call(this.segs[l],l)===false)break};svgedit.path.Path.prototype.addSeg=function(d){var e=this.segs[d];if(e.prev){var l=e.prev,u;switch(e.item.pathSegType){case 4:var z=(e.item.x+l.item.x)/2,p=(e.item.y+l.item.y)/2;u=this.elem.createSVGPathSegLinetoAbs(z,
|
||||||
p);break;case 6:u=(l.item.x+e.item.x1)/2;var L=(e.item.x1+e.item.x2)/2,T=(e.item.x2+e.item.x)/2,N=(u+L)/2;L=(L+T)/2;z=(N+L)/2;var K=(l.item.y+e.item.y1)/2,da=(e.item.y1+e.item.y2)/2;l=(e.item.y2+e.item.y)/2;var V=(K+da)/2;da=(da+l)/2;p=(V+da)/2;u=this.elem.createSVGPathSegCurvetoCubicAbs(z,p,u,K,N,V);svgedit.path.replacePathSeg(e.type,d,[e.item.x,e.item.y,L,da,T,l])}svgedit.path.insertItemBefore(this.elem,u,d)}};svgedit.path.Path.prototype.deleteSeg=function(d){var e=this.segs[d],l=this.elem.pathSegList;
|
p);break;case 6:u=(l.item.x+e.item.x1)/2;var L=(e.item.x1+e.item.x2)/2,T=(e.item.x2+e.item.x)/2,N=(u+L)/2;L=(L+T)/2;z=(N+L)/2;var J=(l.item.y+e.item.y1)/2,da=(e.item.y1+e.item.y2)/2;l=(e.item.y2+e.item.y)/2;var V=(J+da)/2;da=(da+l)/2;p=(V+da)/2;u=this.elem.createSVGPathSegCurvetoCubicAbs(z,p,u,J,N,V);svgedit.path.replacePathSeg(e.type,d,[e.item.x,e.item.y,L,da,T,l])}svgedit.path.insertItemBefore(this.elem,u,d)}};svgedit.path.Path.prototype.deleteSeg=function(d){var e=this.segs[d],l=this.elem.pathSegList;
|
||||||
e.show(false);var u=e.next;if(e.mate){var z=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,u.index,z);svgedit.path.replacePathSeg(4,e.index,z);l.removeItem(e.mate.index)}else{if(!e.prev){z=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,e.next.index,z)}l.removeItem(d)}};svgedit.path.Path.prototype.subpathIsClosed=function(d){var e=false;svgedit.path.path.eachSeg(function(l){if(l<=d)return true;if(this.type===2)return false;else if(this.type===1){e=true;return false}});return e};svgedit.path.Path.prototype.removePtFromSelection=
|
e.show(false);var u=e.next;if(e.mate){var z=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,u.index,z);svgedit.path.replacePathSeg(4,e.index,z);l.removeItem(e.mate.index)}else{if(!e.prev){z=[u.item.x,u.item.y];svgedit.path.replacePathSeg(2,e.next.index,z)}l.removeItem(d)}};svgedit.path.Path.prototype.subpathIsClosed=function(d){var e=false;svgedit.path.path.eachSeg(function(l){if(l<=d)return true;if(this.type===2)return false;else if(this.type===1){e=true;return false}});return e};svgedit.path.Path.prototype.removePtFromSelection=
|
||||||
function(d){var e=this.selected_pts.indexOf(d);if(e!=-1){this.segs[d].select(false);this.selected_pts.splice(e,1)}};svgedit.path.Path.prototype.clearSelection=function(){this.eachSeg(function(){this.select(false)});this.selected_pts=[]};svgedit.path.Path.prototype.storeD=function(){this.last_d=this.elem.getAttribute("d")};svgedit.path.Path.prototype.show=function(d){this.eachSeg(function(){this.show(d)});d&&this.selectPt(this.first_seg.index);return this};svgedit.path.Path.prototype.movePts=function(d,
|
function(d){var e=this.selected_pts.indexOf(d);if(e!=-1){this.segs[d].select(false);this.selected_pts.splice(e,1)}};svgedit.path.Path.prototype.clearSelection=function(){this.eachSeg(function(){this.select(false)});this.selected_pts=[]};svgedit.path.Path.prototype.storeD=function(){this.last_d=this.elem.getAttribute("d")};svgedit.path.Path.prototype.show=function(d){this.eachSeg(function(){this.show(d)});d&&this.selectPt(this.first_seg.index);return this};svgedit.path.Path.prototype.movePts=function(d,
|
||||||
e){for(var l=this.selected_pts.length;l--;)this.segs[this.selected_pts[l]].move(d,e)};svgedit.path.Path.prototype.moveCtrl=function(d,e){var l=this.segs[this.selected_pts[0]];l.moveCtrl(this.dragctrl,d,e);c&&l.setLinked(this.dragctrl)};svgedit.path.Path.prototype.setSegType=function(d){this.storeD();for(var e=this.selected_pts.length,l;e--;){var u=this.segs[this.selected_pts[e]],z=u.prev;if(z){if(!d){l="Toggle Path Segment Type";d=u.type==6?4:6}d-=0;var p=u.item.x,L=u.item.y,T=z.item.x;z=z.item.y;
|
e){for(var l=this.selected_pts.length;l--;)this.segs[this.selected_pts[l]].move(d,e)};svgedit.path.Path.prototype.moveCtrl=function(d,e){var l=this.segs[this.selected_pts[0]];l.moveCtrl(this.dragctrl,d,e);c&&l.setLinked(this.dragctrl)};svgedit.path.Path.prototype.setSegType=function(d){this.storeD();for(var e=this.selected_pts.length,l;e--;){var u=this.segs[this.selected_pts[e]],z=u.prev;if(z){if(!d){l="Toggle Path Segment Type";d=u.type==6?4:6}d-=0;var p=u.item.x,L=u.item.y,T=z.item.x;z=z.item.y;
|
||||||
var N;switch(d){case 6:if(u.olditem){T=u.olditem;N=[p,L,T.x1,T.y1,T.x2,T.y2]}else{N=p-T;var K=L-z;N=[p,L,T+N/3,z+K/3,p-N/3,L-K/3]}break;case 4:N=[p,L];u.olditem=u.item}u.setType(d,N)}}svgedit.path.path.endChanges(l)};svgedit.path.Path.prototype.selectPt=function(d,e){this.clearSelection();d==null&&this.eachSeg(function(l){if(this.prev)d=l});this.addPtsToSelection(d);if(e){this.dragctrl=e;c&&this.segs[d].setLinked(e)}};svgedit.path.Path.prototype.update=function(){var d=this.elem;if(svgedit.utilities.getRotationAngle(d)){this.matrix=
|
var N;switch(d){case 6:if(u.olditem){T=u.olditem;N=[p,L,T.x1,T.y1,T.x2,T.y2]}else{N=p-T;var J=L-z;N=[p,L,T+N/3,z+J/3,p-N/3,L-J/3]}break;case 4:N=[p,L];u.olditem=u.item}u.setType(d,N)}}svgedit.path.path.endChanges(l)};svgedit.path.Path.prototype.selectPt=function(d,e){this.clearSelection();d==null&&this.eachSeg(function(l){if(this.prev)d=l});this.addPtsToSelection(d);if(e){this.dragctrl=e;c&&this.segs[d].setLinked(e)}};svgedit.path.Path.prototype.update=function(){var d=this.elem;if(svgedit.utilities.getRotationAngle(d)){this.matrix=
|
||||||
svgedit.math.getMatrix(d);this.imatrix=this.matrix.inverse()}else this.imatrix=this.matrix=null;this.eachSeg(function(e){this.item=d.pathSegList.getItem(e);this.update()});return this};svgedit.path.getPath_=function(d){var e=m[d.id];e||(e=m[d.id]=new svgedit.path.Path(d));return e};svgedit.path.removePath_=function(d){d in m&&delete m[d]};var b=function(d,e){dx=d-oldcx;dy=e-oldcy;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)+angle;dx=r*Math.cos(theta)+oldcx;dy=r*Math.sin(theta)+oldcy;dx-=newcx;
|
svgedit.math.getMatrix(d);this.imatrix=this.matrix.inverse()}else this.imatrix=this.matrix=null;this.eachSeg(function(e){this.item=d.pathSegList.getItem(e);this.update()});return this};svgedit.path.getPath_=function(d){var e=m[d.id];e||(e=m[d.id]=new svgedit.path.Path(d));return e};svgedit.path.removePath_=function(d){d in m&&delete m[d]};var b=function(d,e){dx=d-oldcx;dy=e-oldcy;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)+angle;dx=r*Math.cos(theta)+oldcx;dy=r*Math.sin(theta)+oldcy;dx-=newcx;
|
||||||
dy-=newcy;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-angle;return{x:(r*Math.cos(theta)+newcx)/1,y:(r*Math.sin(theta)+newcy)/1}};svgedit.path.recalcRotatedPath=function(){var d=svgedit.path.path.elem,e=svgedit.utilities.getRotationAngle(d,true);if(e){var l=svgedit.utilities.getBBox(d),u=svgedit.path.path.oldbbox,z=u.x+u.width/2,p=u.y+u.height/2;u=l.x+l.width/2;l=l.y+l.height/2;u=u-z;var L=l-p;l=Math.sqrt(u*u+L*L);L=Math.atan2(L,u)+e;u=l*Math.cos(L)+z;l=l*Math.sin(L)+p;z=d.pathSegList;for(p=z.numberOfItems;p;){p-=
|
dy-=newcy;r=Math.sqrt(dx*dx+dy*dy);theta=Math.atan2(dy,dx)-angle;return{x:(r*Math.cos(theta)+newcx)/1,y:(r*Math.sin(theta)+newcy)/1}};svgedit.path.recalcRotatedPath=function(){var d=svgedit.path.path.elem,e=svgedit.utilities.getRotationAngle(d,true);if(e){var l=svgedit.utilities.getBBox(d),u=svgedit.path.path.oldbbox,z=u.x+u.width/2,p=u.y+u.height/2;u=l.x+l.width/2;l=l.y+l.height/2;u=u-z;var L=l-p;l=Math.sqrt(u*u+L*L);L=Math.atan2(L,u)+e;u=l*Math.cos(L)+z;l=l*Math.sin(L)+p;z=d.pathSegList;for(p=z.numberOfItems;p;){p-=
|
||||||
1;L=z.getItem(p);var T=L.pathSegType;if(T!=1){var N=b(L.x,L.y);N=[N.x,N.y];if(L.x1!=null&&L.x2!=null){c_vals1=b(L.x1,L.y1);c_vals2=b(L.x2,L.y2);N.splice(N.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(T,p,N)}}svgedit.utilities.getBBox(d);z=svgroot.createSVGTransform();d=svgedit.transformlist.getTransformList(d);z.setRotate(e*180/Math.PI,u,l);d.replaceItem(z,0)}};svgedit.path.clearData=function(){m={}}})();if(!window.console){window.console={};window.console.log=function(){};window.console.dir=function(){}}if(window.opera){window.console.log=function(a){opera.postError(a)};window.console.dir=function(){}}
|
1;L=z.getItem(p);var T=L.pathSegType;if(T!=1){var N=b(L.x,L.y);N=[N.x,N.y];if(L.x1!=null&&L.x2!=null){c_vals1=b(L.x1,L.y1);c_vals2=b(L.x2,L.y2);N.splice(N.length,0,c_vals1.x,c_vals1.y,c_vals2.x,c_vals2.y)}svgedit.path.replacePathSeg(T,p,N)}}svgedit.utilities.getBBox(d);z=svgroot.createSVGTransform();d=svgedit.transformlist.getTransformList(d);z.setRotate(e*180/Math.PI,u,l);d.replaceItem(z,0)}};svgedit.path.clearData=function(){m={}}})();if(!window.console){window.console={};window.console.log=function(){};window.console.dir=function(){}}if(window.opera){window.console.log=function(a){opera.postError(a)};window.console.dir=function(){}}
|
||||||
(function(){var a=jQuery.fn.attr;jQuery.fn.attr=function(n,f){var c=this.length;if(!c)return a.apply(this,arguments);for(var m=0;m<c;m++){var o=this[m];if(o.namespaceURI==="http://www.w3.org/2000/svg")if(f!==undefined)o.setAttribute(n,f);else if($.isArray(n)){c=n.length;for(m={};c--;){var b=n[c],d=o.getAttribute(b);if(d||d==="0")d=isNaN(d)?d:d-0;m[b]=d}return m}else if(typeof n==="object")for(b in n)o.setAttribute(b,n[b]);else{if((d=o.getAttribute(n))||d==="0")d=isNaN(d)?d:d-0;return d}else return a.apply(this,
|
(function(){var a=jQuery.fn.attr;jQuery.fn.attr=function(n,f){var c=this.length;if(!c)return a.apply(this,arguments);for(var m=0;m<c;m++){var o=this[m];if(o.namespaceURI==="http://www.w3.org/2000/svg")if(f!==undefined)o.setAttribute(n,f);else if($.isArray(n)){c=n.length;for(m={};c--;){var b=n[c],d=o.getAttribute(b);if(d||d==="0")d=isNaN(d)?d:d-0;m[b]=d}return m}else if(typeof n==="object")for(b in n)o.setAttribute(b,n[b]);else{if((d=o.getAttribute(n))||d==="0")d=isNaN(d)?d:d-0;return d}else return a.apply(this,
|
||||||
arguments)}return this}})();
|
arguments)}return this}})();
|
||||||
$.SvgCanvas=function(a,n){function f(g,h){for(var k=svgedit.utilities.getBBox(g),v=0;v<2;v++){var t=v===0?"fill":"stroke",E=g.getAttribute(t);if(E&&E.indexOf("url(")===0){E=X(E);if(E.tagName==="linearGradient"){var w=E.getAttribute("x1")||0,s=E.getAttribute("y1")||0,B=E.getAttribute("x2")||1,F=E.getAttribute("y2")||0;w=k.width*w+k.x;s=k.height*s+k.y;B=k.width*B+k.x;F=k.height*F+k.y;w=O(w,s,h);F=O(B,F,h);B={};B.x1=(w.x-k.x)/k.width;B.y1=(w.y-k.y)/k.height;B.x2=(F.x-k.x)/k.width;B.y2=(F.y-k.y)/k.height;
|
$.SvgCanvas=function(a,n){function f(g,h){for(var k=svgedit.utilities.getBBox(g),v=0;v<2;v++){var t=v===0?"fill":"stroke",E=g.getAttribute(t);if(E&&E.indexOf("url(")===0){E=Y(E);if(E.tagName==="linearGradient"){var w=E.getAttribute("x1")||0,s=E.getAttribute("y1")||0,A=E.getAttribute("x2")||1,F=E.getAttribute("y2")||0;w=k.width*w+k.x;s=k.height*s+k.y;A=k.width*A+k.x;F=k.height*F+k.y;w=O(w,s,h);F=O(A,F,h);A={};A.x1=(w.x-k.x)/k.width;A.y1=(w.y-k.y)/k.height;A.x2=(F.x-k.x)/k.width;A.y2=(F.y-k.y)/k.height;
|
||||||
E=E.cloneNode(true);$(E).attr(B);E.id=M();Ab().appendChild(E);g.setAttribute(t,"url(#"+E.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(m,n);var o=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+c+'" xlinkns="http://www.w3.org/1999/xlink" width="'+o[0]+'" height="'+o[1]+'" x="'+o[0]+'" y="'+o[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,
|
E=E.cloneNode(true);$(E).attr(A);E.id=M();Ab().appendChild(E);g.setAttribute(t,"url(#"+E.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(m,n);var o=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('<svg id="svgroot" xmlns="'+c+'" xlinkns="http://www.w3.org/1999/xlink" width="'+o[0]+'" height="'+o[1]+'" x="'+o[0]+'" y="'+o[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,
|
||||||
true);a.appendChild(e);var l=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[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(e);var g=d.createComment(" Created with SVG-edit - http://svg-edit.googlecode.com/ ");l.appendChild(g)})();var u="svg_";b.setIdPrefix=function(g){u=
|
true);a.appendChild(e);var l=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[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(e);var g=d.createComment(" Created with SVG-edit - http://svg-edit.googlecode.com/ ");l.appendChild(g)})();var u="svg_";b.setIdPrefix=function(g){u=
|
||||||
g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var z=b.getCurrentDrawing=function(){return b.current_drawing_},p=1,L=null,T={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}};T.text=$.extend(true,{},T.shape);$.extend(T.text,{fill:"#000000",
|
g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var z=b.getCurrentDrawing=function(){return b.current_drawing_},p=1,L=null,T={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}};T.text=$.extend(true,{},T.shape);$.extend(T.text,{fill:"#000000",
|
||||||
stroke_width:0,font_size:24,font_family:"Junction"});var N=T.shape,K=Array(1),da=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=z().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(L||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:N.fill,stroke:N.stroke,"stroke-width":N.stroke_width,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,
|
stroke_width:0,font_size:24,font_family:"Junction"});var N=T.shape,J=Array(1),da=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=z().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(L||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:N.fill,stroke:N.stroke,"stroke-width":N.stroke_width,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,
|
||||||
"stroke-opacity":N.stroke_opacity,"fill-opacity":N.fill_opacity,opacity:N.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,fa=b.matrixMultiply=svgedit.math.matrixMultiply,sa=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ia=b.transformListToTransform=svgedit.math.transformListToTransform,ca=svgedit.math.snapToAngle,
|
"stroke-opacity":N.stroke_opacity,"fill-opacity":N.fill_opacity,opacity:N.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,fa=b.matrixMultiply=svgedit.math.matrixMultiply,sa=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform,ca=svgedit.math.snapToAngle,
|
||||||
ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return Za.round_digits}});var qa=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return K},
|
ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return Za.round_digits}});var qa=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return J},
|
||||||
getSVGContent:function(){return l}});var pa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var ra=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,ma=b.assignAttributes=svgedit.utilities.assignAttributes,Y=this.cleanupElement=svgedit.utilities.cleanupElement,za=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
|
getSVGContent:function(){return l}});var pa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var ra=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,ma=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,za=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg,
|
||||||
Qa=svgedit.history.MoveElementCommand,Ma=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Ya=svgedit.history.ChangeElementCommand,Na=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var k=svgedit.history.HistoryEventTypes;if(g==k.BEFORE_UNAPPLY||g==k.BEFORE_APPLY)b.clearSelection();else if(g==k.AFTER_APPLY||g==k.AFTER_UNAPPLY){var v=h.elements();b.pathActions.clear();I("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v==
|
Qa=svgedit.history.MoveElementCommand,Ma=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Ya=svgedit.history.ChangeElementCommand,Na=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var k=svgedit.history.HistoryEventTypes;if(g==k.BEFORE_UNAPPLY||g==k.BEFORE_APPLY)b.clearSelection();else if(g==k.AFTER_APPLY||g==k.AFTER_UNAPPLY){var v=h.elements();b.pathActions.clear();I("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v==
|
||||||
Qa.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Ma.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Ma.type())k&&ab(h.elem);else k||ab(h.elem);h.elem.tagName==="use"&&Yb(h.elem)}else if(v==Ya.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k=
|
Qa.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Ma.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Ma.type())k&&ab(h.elem);else k||ab(h.elem);h.elem.tagName==="use"&&Yb(h.elem)}else if(v==Ya.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k=
|
||||||
v.parentNode;var t=v.nextSibling;k.removeChild(v);k.insertBefore(v,t)}}}}}});var Ia=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(m,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Pa=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return e}});
|
v.parentNode;var t=v.nextSibling;k.removeChild(v);k.insertBefore(v,t)}}}}}});var Ia=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(m,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Pa=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return e}});
|
||||||
svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Gb={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"},Pb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ob=$.data,
|
svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Gb={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"},Pb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],nb=$.data,
|
||||||
ab=function(g){var h=$(g).attr(Pb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){Ab().appendChild(Db[v]);delete Db[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h<k;h++)ab(g[h])}},Xa={},La=m.imgPath+"logo.png",Fa=[],Za={round_digits:5},Ra=false,$a=null,Ja="select",pb="none",Cb={},db=T.text,hb=N,ib=null,Da=null,xb=[],mb={},zb=null,Db={};b.clipBoard=[];var nb=this.runExtensions=function(g,h,k){var v=false;if(k)v=[];$.each(mb,function(t,E){if(g in
|
ab=function(g){var h=$(g).attr(Pb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){Ab().appendChild(Db[v]);delete Db[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h<k;h++)ab(g[h])}},Xa={},La=m.imgPath+"logo.png",Fa=[],Za={round_digits:5},Ra=false,$a=null,Ja="select",ob="none",Cb={},eb=T.text,hb=N,ib=null,Da=null,xb=[],mb={},zb=null,Db={};b.clipBoard=[];var pb=this.runExtensions=function(g,h,k){var v=false;if(k)v=[];$.each(mb,function(t,E){if(g in
|
||||||
E)if(k)v.push(E[g](h));else v=E[g](h)});return v};this.addExtension=function(g,h){if(g in mb)console.log('Cannot add extension "'+g+'", an extension by that name already exists"');else{var k=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:e,svgcontent:l,nonce:z().getNonce(),selectorManager:Pa})):h;mb[g]=k;I("extension_added",k)}};var Eb=this.round=function(g){return parseInt(g*p)/p},Kb=this.getIntersectionList=function(g){if(Da==null)return null;var h=L||z().getCurrentLayer();xb.length||
|
E)if(k)v.push(E[g](h));else v=E[g](h)});return v};this.addExtension=function(g,h){if(g in mb)console.log('Cannot add extension "'+g+'", an extension by that name already exists"');else{var k=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:e,svgcontent:l,nonce:z().getNonce(),selectorManager:Pa})):h;mb[g]=k;I("extension_added",k)}};var Eb=this.round=function(g){return parseInt(g*p)/p},Kb=this.getIntersectionList=function(g){if(Da==null)return null;var h=L||z().getCurrentLayer();xb.length||
|
||||||
(xb=Qb(h));var k=null;try{k=h.getIntersectionList(g,null)}catch(v){}if(k==null||typeof k.item!="function"){k=[];if(g)g=g;else{g=Da.getBBox();h={};for(var t in g)h[t]=g[t]/p;g=h}for(t=xb.length;t--;)g.width&&g.width&&svgedit.math.rectsIntersect(g,xb[t].bbox)&&k.push(xb[t].elem)}return k};getStrokedBBox=this.getStrokedBBox=function(g){g||(g=Ib());if(!g.length)return false;var h=function(F){try{var C=svgedit.utilities.getBBox(F),D=svgedit.utilities.getRotationAngle(F);if(D&&D%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(F))){D=
|
(xb=Qb(h));var k=null;try{k=h.getIntersectionList(g,null)}catch(v){}if(k==null||typeof k.item!="function"){k=[];if(g)g=g;else{g=Da.getBBox();h={};for(var t in g)h[t]=g[t]/p;g=h}for(t=xb.length;t--;)g.width&&g.width&&svgedit.math.rectsIntersect(g,xb[t].bbox)&&k.push(xb[t].elem)}return k};getStrokedBBox=this.getStrokedBBox=function(g){g||(g=Ib());if(!g.length)return false;var h=function(F){try{var C=svgedit.utilities.getBBox(F),D=svgedit.utilities.getRotationAngle(F);if(D&&D%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(F))){D=
|
||||||
false;if(["ellipse","path","line","polyline","polygon"].indexOf(F.tagName)>=0)C=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var G=F.getAttribute("rx"),H=F.getAttribute("ry");if(G||H)C=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),Q=document.createElementNS(c,"g"),Z=F.parentNode;Z.appendChild(Q);Q.appendChild(P);C=svgedit.utilities.bboxToObj(Q.getBBox());Z.removeChild(Q)}}return C}catch(ua){console.log(F,ua);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});
|
false;if(["ellipse","path","line","polyline","polygon"].indexOf(F.tagName)>=0)C=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var G=F.getAttribute("rx"),H=F.getAttribute("ry");if(G||H)C=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),Q=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(Q);Q.appendChild(P);C=svgedit.utilities.bboxToObj(Q.getBBox());W.removeChild(Q)}}return C}catch(ua){console.log(F,ua);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});
|
||||||
if(k==null)return null;var v=k.x+k.width,t=k.y+k.height,E=k.x,w=k.y,s=function(F){var C=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(C))D+=C/2;return D},B=[];$.each(g,function(F,C){var D=h(C);if(D){var G=s(C);E=Math.min(E,D.x-G);w=Math.min(w,D.y-G);B.push(D)}});k.x=E;k.y=w;$.each(g,function(F,C){var D=B[F];if(D&&C.nodeType==1){var G=s(C);v=Math.max(v,D.x+D.width+G);t=Math.max(t,D.y+D.height+G)}});k.width=v-E;k.height=t-w;return k};var Ib=this.getVisibleElements=function(g){g||
|
if(k==null)return null;var v=k.x+k.width,t=k.y+k.height,E=k.x,w=k.y,s=function(F){var C=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(C))D+=C/2;return D},A=[];$.each(g,function(F,C){var D=h(C);if(D){var G=s(C);E=Math.min(E,D.x-G);w=Math.min(w,D.y-G);A.push(D)}});k.x=E;k.y=w;$.each(g,function(F,C){var D=A[F];if(D&&C.nodeType==1){var G=s(C);v=Math.max(v,D.x+D.width+G);t=Math.max(t,D.y+D.height+G)}});k.width=v-E;k.height=t-w;return k};var Ib=this.getVisibleElements=function(g){g||
|
||||||
(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(t){}});return h.reverse()},Qb=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(t){}});return h.reverse()},na=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=M()},aa=function(g){var h=document.createElementNS(g.namespaceURI,
|
(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(t){}});return h.reverse()},Qb=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(t){}});return h.reverse()},na=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=M()},aa=function(g){var h=document.createElementNS(g.namespaceURI,
|
||||||
g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,t){t.localName!="-moz-math-font-style"&&h.setAttributeNS(t.namespaceURI,t.nodeName,t.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,t){switch(t.nodeType){case 1:h.appendChild(aa(t));break;case 3:h.textContent=t.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref",
|
g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,t){t.localName!="-moz-math-font-style"&&h.setAttributeNS(t.namespaceURI,t.nodeName,t.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,t){switch(t.nodeType){case 1:h.appendChild(aa(t));break;case 3:h.textContent=t.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref",
|
||||||
g).data("symbol",g)}else h.tagName=="image"&&Zb(h);h.id=M();console.log(h);return h},ta,M,I;(function(g){var h={};ta=g.getId=function(){return z().getId()};M=g.getNextId=function(){return z().getNextId()};I=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var t=h[k];h[k]=v;return t}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h<k;++h){var v=g[h];v.setAttribute("d",Ua.convertPath(v));Ua.fixEnd(v)}};
|
g).data("symbol",g)}else h.tagName=="image"&&Zb(h);h.id=M();console.log(h);return h},ta,M,I;(function(g){var h={};ta=g.getId=function(){return z().getId()};M=g.getNextId=function(){return z().getNextId()};I=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var t=h[k];h[k]=v;return t}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h<k;++h){var v=g[h];v.setAttribute("d",Ua.convertPath(v));Ua.fixEnd(v)}};
|
||||||
var X=this.getRefElem=function(g){return la(pa(g).substr(1))},Oa=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);Pa.releaseSelector(g);K[0]=h;Pa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=K[0],v=k.getAttribute("transform"),t=svgedit.utilities.getBBox(k),E=t.x+t.width/2,w=t.y+t.height/2;t=V(k);t.numberOfItems>0&&t.getItem(0).type==4&&t.removeItem(0);if(g!=
|
var Y=this.getRefElem=function(g){return la(pa(g).substr(1))},Oa=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);Pa.releaseSelector(g);J[0]=h;Pa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=J[0],v=k.getAttribute("transform"),t=svgedit.utilities.getBBox(k),E=t.x+t.width/2,w=t.y+t.height/2;t=V(k);t.numberOfItems>0&&t.getItem(0).type==4&&t.removeItem(0);if(g!=
|
||||||
0){E=O(E,w,ia(t).matrix);w=e.createSVGTransform();w.setRotate(g,E.x,E.y);t.numberOfItems?t.insertItemBefore(w,0):t.appendItem(w)}else t.numberOfItems==0&&k.removeAttribute("transform");if(!h){t=k.getAttribute("transform");k.setAttribute("transform",v);qb("transform",t,K);I("changed",K)}la("pathpointgrip_container");k=Pa.requestSelector(K[0]);k.resize();k.updateGripCursors(g)};var Wa=this.recalculateAllSelectedDimensions=function(){for(var g=new Na(pb=="none"?"position":"size"),h=K.length;h--;){var k=
|
0){E=O(E,w,ha(t).matrix);w=e.createSVGTransform();w.setRotate(g,E.x,E.y);t.numberOfItems?t.insertItemBefore(w,0):t.appendItem(w)}else t.numberOfItems==0&&k.removeAttribute("transform");if(!h){t=k.getAttribute("transform");k.setAttribute("transform",v);qb("transform",t,J);I("changed",J)}la("pathpointgrip_container");k=Pa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Wa=this.recalculateAllSelectedDimensions=function(){for(var g=new Na(ob=="none"?"position":"size"),h=J.length;h--;){var k=
|
||||||
rb(K[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g);I("changed",K)}},fb=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],tb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},wb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",t=function(){if(v)for(var D in h)h[D]=Ga(h[D]);ma(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var w=E===0?"fill":"stroke",s=g.getAttribute(w);if(s&&s.indexOf("url(")===
|
rb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g);I("changed",J)}},fb=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],tb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},wb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",t=function(){if(v)for(var D in h)h[D]=Ga(h[D]);ma(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var w=E===0?"fill":"stroke",s=g.getAttribute(w);if(s&&s.indexOf("url(")===
|
||||||
0)if(k.a<0||k.d<0){s=X(s).cloneNode(true);if(k.a<0){var B=s.getAttribute("x1"),F=s.getAttribute("x2");s.setAttribute("x1",-(B-1));s.setAttribute("x2",-(F-1))}if(k.d<0){B=s.getAttribute("y1");F=s.getAttribute("y2");s.setAttribute("y1",-(B-1));s.setAttribute("y2",-(F-1))}s.id=M();Ab().appendChild(s);g.setAttribute(w,"url(#"+s.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){w=ia(g).matrix;w=fa(w.inverse(),k,w);h.x=parseFloat(h.x)+w.e;h.y=parseFloat(h.y)+
|
0)if(k.a<0||k.d<0){s=Y(s).cloneNode(true);if(k.a<0){var A=s.getAttribute("x1"),F=s.getAttribute("x2");s.setAttribute("x1",-(A-1));s.setAttribute("x2",-(F-1))}if(k.d<0){A=s.getAttribute("y1");F=s.getAttribute("y2");s.setAttribute("y1",-(A-1));s.setAttribute("y2",-(F-1))}s.id=M();Ab().appendChild(s);g.setAttribute(w,"url(#"+s.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){w=ha(g).matrix;w=fa(w.inverse(),k,w);h.x=parseFloat(h.x)+w.e;h.y=parseFloat(h.y)+
|
||||||
w.f}else{w=V(g);s=e.createSVGTransform();s.setMatrix(fa(ia(w).matrix,k));w.clear();w.appendItem(s)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){w=V(g);s=e.createSVGTransform();s.setMatrix(fa(ia(w).matrix,k));w.clear();w.appendItem(s)}else{w=O(h.x,h.y,k);h.width=k.a*h.width;h.height=k.d*h.height;h.x=w.x+Math.min(0,h.width);h.y=w.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}t();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;
|
w.f}else{w=V(g);s=e.createSVGTransform();s.setMatrix(fa(ha(w).matrix,k));w.clear();w.appendItem(s)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){w=V(g);s=e.createSVGTransform();s.setMatrix(fa(ha(w).matrix,k));w.clear();w.appendItem(s)}else{w=O(h.x,h.y,k);h.width=k.a*h.width;h.height=k.d*h.height;h.x=w.x+Math.min(0,h.width);h.y=w.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}t();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;
|
||||||
h.cy=E.y;h.rx=k.a*h.rx;h.ry=k.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);t();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);t();break;case "line":w=O(h.x1,h.y1,k);B=O(h.x2,h.y2,k);h.x1=w.x;h.y1=w.y;h.x2=B.x;h.y2=B.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){w=qa("x",g.getAttribute("x"));s=qa("x",k[E].getAttribute("x"));B=qa("y",
|
h.cy=E.y;h.rx=k.a*h.rx;h.ry=k.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);t();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);t();break;case "line":w=O(h.x1,h.y1,k);A=O(h.x2,h.y2,k);h.x1=w.x;h.y1=w.y;h.x2=A.x;h.y2=A.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){w=qa("x",g.getAttribute("x"));s=qa("x",k[E].getAttribute("x"));A=qa("y",
|
||||||
g.getAttribute("y"));F=qa("y",k[E].getAttribute("y"));var C={};if(!isNaN(w)&&!isNaN(s)&&w!=0&&s!=0&&h.x)C.x=h.x-(w-s);if(!isNaN(B)&&!isNaN(F)&&B!=0&&F!=0&&h.y)C.y=h.y-(B-F);if(C.x||C.y)ma(k[E],C,1E3,true)}t();break;case "use":t();break;case "g":(t=$(g).data("gsvg"))&&ma(t,h,1E3,true);break;case "polyline":case "polygon":t=h.points.length;for(E=0;E<t;++E){F=h.points[E];F=O(F.x,F.y,k);h.points[E].x=F.x;h.points[E].y=F.y}t=h.points.length;k="";for(E=0;E<t;++E){F=h.points[E];k+=F.x+","+F.y+" "}g.setAttribute("points",
|
g.getAttribute("y"));F=qa("y",k[E].getAttribute("y"));var C={};if(!isNaN(w)&&!isNaN(s)&&w!=0&&s!=0&&h.x)C.x=h.x-(w-s);if(!isNaN(A)&&!isNaN(F)&&A!=0&&F!=0&&h.y)C.y=h.y-(A-F);if(C.x||C.y)ma(k[E],C,1E3,true)}t();break;case "use":t();break;case "g":(t=$(g).data("gsvg"))&&ma(t,h,1E3,true);break;case "polyline":case "polygon":t=h.points.length;for(E=0;E<t;++E){F=h.points[E];F=O(F.x,F.y,k);h.points[E].x=F.x;h.points[E].y=F.y}t=h.points.length;k="";for(E=0;E<t;++E){F=h.points[E];k+=F.x+","+F.y+" "}g.setAttribute("points",
|
||||||
k);break;case "path":w=g.pathSegList;t=w.numberOfItems;h.d=Array(t);for(E=0;E<t;++E){s=w.getItem(E);h.d[E]={type:s.pathSegType,x:s.x,y:s.y,x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2,r1:s.r1,r2:s.r2,angle:s.angle,largeArcFlag:s.largeArcFlag,sweepFlag:s.sweepFlag}}t=h.d.length;E=h.d[0];C=O(E.x,E.y,k);h.d[0].x=C.x;h.d[0].y=C.y;for(E=1;E<t;++E){s=h.d[E];w=s.type;if(w%2==0){F=O(s.x!=undefined?s.x:C.x,s.y!=undefined?s.y:C.y,k);w=O(s.x1,s.y1,k);B=O(s.x2,s.y2,k);s.x=F.x;s.y=F.y;s.x1=w.x;s.y1=w.y;s.x2=B.x;s.y2=B.y}else{s.x=
|
k);break;case "path":w=g.pathSegList;t=w.numberOfItems;h.d=Array(t);for(E=0;E<t;++E){s=w.getItem(E);h.d[E]={type:s.pathSegType,x:s.x,y:s.y,x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2,r1:s.r1,r2:s.r2,angle:s.angle,largeArcFlag:s.largeArcFlag,sweepFlag:s.sweepFlag}}t=h.d.length;E=h.d[0];C=O(E.x,E.y,k);h.d[0].x=C.x;h.d[0].y=C.y;for(E=1;E<t;++E){s=h.d[E];w=s.type;if(w%2==0){F=O(s.x!=undefined?s.x:C.x,s.y!=undefined?s.y:C.y,k);w=O(s.x1,s.y1,k);A=O(s.x2,s.y2,k);s.x=F.x;s.y=F.y;s.x1=w.x;s.y1=w.y;s.x2=A.x;s.y2=A.y}else{s.x=
|
||||||
k.a*s.x;s.y=k.d*s.y;s.x1=k.a*s.x1;s.y1=k.d*s.y1;s.x2=k.a*s.x2;s.y2=k.d*s.y2}s.r1=k.a*s.r1;s.r2=k.d*s.r2}k="";t=h.d.length;for(E=0;E<t;++E){s=h.d[E];w=s.type;k+=fb[w];switch(w){case 13:case 12:k+=s.x+" ";break;case 15:case 14:k+=s.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:k+=s.x+","+s.y+" ";break;case 7:case 6:k+=s.x1+","+s.y1+" "+s.x2+","+s.y2+" "+s.x+","+s.y+" ";break;case 9:case 8:k+=s.x1+","+s.y1+" "+s.x+","+s.y+" ";break;case 11:case 10:k+=s.r1+","+s.r2+" "+s.angle+" "+ +s.largeArcFlag+
|
k.a*s.x;s.y=k.d*s.y;s.x1=k.a*s.x1;s.y1=k.d*s.y1;s.x2=k.a*s.x2;s.y2=k.d*s.y2}s.r1=k.a*s.r1;s.r2=k.d*s.r2}k="";t=h.d.length;for(E=0;E<t;++E){s=h.d[E];w=s.type;k+=fb[w];switch(w){case 13:case 12:k+=s.x+" ";break;case 15:case 14:k+=s.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:k+=s.x+","+s.y+" ";break;case 7:case 6:k+=s.x1+","+s.y1+" "+s.x2+","+s.y2+" "+s.x+","+s.y+" ";break;case 9:case 8:k+=s.x1+","+s.y1+" "+s.x+","+s.y+" ";break;case 11:case 10:k+=s.r1+","+s.r2+" "+s.angle+" "+ +s.largeArcFlag+
|
||||||
" "+ +s.sweepFlag+" "+s.x+","+s.y+" ";break;case 17:case 16:k+=s.x2+","+s.y2+" "+s.x+","+s.y+" "}}g.setAttribute("d",k)}},Hb=function(g,h,k){g=X(g).firstChild;var v=V(g),t=e.createSVGTransform();t.setTranslate(h,k);v.appendItem(t);rb(g)},rb=this.recalculateDimensions=function(g){if(g==null)return null;var h=V(g);if(h&&h.numberOfItems>0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type===1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===
|
" "+ +s.sweepFlag+" "+s.x+","+s.y+" ";break;case 17:case 16:k+=s.x2+","+s.y2+" "+s.x+","+s.y+" "}}g.setAttribute("d",k)}},Hb=function(g,h,k){g=Y(g).firstChild;var v=V(g),t=e.createSVGTransform();t.setTranslate(h,k);v.appendItem(t);rb(g)},rb=this.recalculateDimensions=function(g){if(g==null)return null;var h=V(g);if(h&&h.numberOfItems>0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type===1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===
|
||||||
4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&ra(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var t=[];k--;){v=h.getItem(k);if(v.type===1)t.push([v.matrix,k]);else if(t.length)t=[]}if(t.length===2){k=e.createSVGTransformFromMatrix(fa(t[1][0],t[0][0]));h.removeItem(t[0][1]);h.removeItem(t[1][1]);h.insertItemBefore(k,t[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){t=e.createSVGTransform();
|
4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&ra(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var t=[];k--;){v=h.getItem(k);if(v.type===1)t.push([v.matrix,k]);else if(t.length)t=[]}if(t.length===2){k=e.createSVGTransformFromMatrix(fa(t[1][0],t[0][0]));h.removeItem(t[0][1]);h.removeItem(t[1][1]);h.insertItemBefore(k,t[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){t=e.createSVGTransform();
|
||||||
v=fa(h.getItem(k-2).matrix,h.getItem(k-1).matrix);t.setMatrix(v);h.removeItem(k-2);h.removeItem(k-2);h.appendItem(t)}}switch(g.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 E=$(g).data("gsvg");k=new Na("Transform");var w={},s=null;v=[];switch(g.tagName){case "line":v=["x1","y1","x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=
|
v=fa(h.getItem(k-2).matrix,h.getItem(k-1).matrix);t.setMatrix(v);h.removeItem(k-2);h.removeItem(k-2);h.appendItem(t)}}switch(g.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 E=$(g).data("gsvg");k=new Na("Transform");var w={},s=null;v=[];switch(g.tagName){case "line":v=["x1","y1","x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=
|
||||||
["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v=["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":s={};s.points=g.getAttribute("points");t=g.points;var B=t.numberOfItems;w.points=Array(B);for(var F=0;F<B;++F){var C=t.getItem(F);w.points[F]={x:C.x,y:C.y}}break;case "path":s={};s.d=g.getAttribute("d");w.d=g.getAttribute("d")}if(v.length){w=$(g).attr(v);$.each(w,function(gb,Lb){w[gb]=qa(gb,Lb)})}else if(E)w=
|
["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v=["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":s={};s.points=g.getAttribute("points");t=g.points;var A=t.numberOfItems;w.points=Array(A);for(var F=0;F<A;++F){var C=t.getItem(F);w.points[F]={x:C.x,y:C.y}}break;case "path":s={};s.d=g.getAttribute("d");w.d=g.getAttribute("d")}if(v.length){w=$(g).attr(v);$.each(w,function(gb,Lb){w[gb]=qa(gb,Lb)})}else if(E)w=
|
||||||
{x:$(E).attr("x")||0,y:$(E).attr("y")||0};if(s==null){s=$.extend(true,{},w);$.each(s,function(gb,Lb){s[gb]=qa(gb,Lb)})}s.transform=$a?$a:"";if(g.tagName=="g"&&!E||g.tagName=="a"){t=svgedit.utilities.getBBox(g);var D={x:t.x+t.width/2,y:t.y+t.height/2},G=O(t.x+t.width/2,t.y+t.height/2,ia(h).matrix);v=e.createSVGMatrix();if(t=ra(g)){F=t*Math.PI/180;B=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(B*v.e+v.f)/2;D.x=(v.e-B*
|
{x:$(E).attr("x")||0,y:$(E).attr("y")||0};if(s==null){s=$.extend(true,{},w);$.each(s,function(gb,Lb){s[gb]=qa(gb,Lb)})}s.transform=$a?$a:"";if(g.tagName=="g"&&!E||g.tagName=="a"){t=svgedit.utilities.getBBox(g);var D={x:t.x+t.width/2,y:t.y+t.height/2},G=O(t.x+t.width/2,t.y+t.height/2,ha(h).matrix);v=e.createSVGMatrix();if(t=ra(g)){F=t*Math.PI/180;A=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(A*v.e+v.f)/2;D.x=(v.e-A*
|
||||||
v.f)/2;h.removeItem(F);break}}}F=v=E=0;var H=h.numberOfItems;if(H)var P=h.getItem(0).matrix;if(H>=3&&h.getItem(H-2).type==3&&h.getItem(H-3).type==2&&h.getItem(H-1).type==2){F=3;var Q=h.getItem(H-3).matrix,Z=h.getItem(H-2).matrix,ua=h.getItem(H-1).matrix;B=g.childNodes;for(C=B.length;C--;){var wa=B.item(C);v=E=0;if(wa.nodeType==1){var ga=V(wa);if(ga){v=ia(ga).matrix;E=ra(wa);var ka=$a,oa=[];$a=wa.getAttribute("transform");if(E||sa(ga)){var ya=e.createSVGTransform();ya.setMatrix(fa(Q,Z,ua,v));ga.clear();
|
v.f)/2;h.removeItem(F);break}}}F=v=E=0;var H=h.numberOfItems;if(H)var P=h.getItem(0).matrix;if(H>=3&&h.getItem(H-2).type==3&&h.getItem(H-3).type==2&&h.getItem(H-1).type==2){F=3;var Q=h.getItem(H-3).matrix,W=h.getItem(H-2).matrix,ua=h.getItem(H-1).matrix;A=g.childNodes;for(C=A.length;C--;){var wa=A.item(C);v=E=0;if(wa.nodeType==1){var ga=V(wa);if(ga){v=ha(ga).matrix;E=ra(wa);var ka=$a,oa=[];$a=wa.getAttribute("transform");if(E||sa(ga)){var ya=e.createSVGTransform();ya.setMatrix(fa(Q,W,ua,v));ga.clear();
|
||||||
ga.appendItem(ya);oa.push(ya)}else{E=fa(v.inverse(),ua,v);ya=e.createSVGMatrix();ya.e=-E.e;ya.f=-E.f;v=fa(ya.inverse(),v.inverse(),Q,Z,ua,v,E.inverse());var jb=e.createSVGTransform(),ub=e.createSVGTransform(),Mb=e.createSVGTransform();jb.setTranslate(E.e,E.f);ub.setScale(v.a,v.d);Mb.setTranslate(ya.e,ya.f);ga.appendItem(Mb);ga.appendItem(ub);ga.appendItem(jb);oa.push(Mb);oa.push(ub);oa.push(jb)}k.addSubCommand(rb(wa));$a=ka}}}h.removeItem(H-1);h.removeItem(H-2);h.removeItem(H-3)}else if(H>=3&&h.getItem(H-
|
ga.appendItem(ya);oa.push(ya)}else{E=fa(v.inverse(),ua,v);ya=e.createSVGMatrix();ya.e=-E.e;ya.f=-E.f;v=fa(ya.inverse(),v.inverse(),Q,W,ua,v,E.inverse());var jb=e.createSVGTransform(),ub=e.createSVGTransform(),Mb=e.createSVGTransform();jb.setTranslate(E.e,E.f);ub.setScale(v.a,v.d);Mb.setTranslate(ya.e,ya.f);ga.appendItem(Mb);ga.appendItem(ub);ga.appendItem(jb);oa.push(Mb);oa.push(ub);oa.push(jb)}k.addSubCommand(rb(wa));$a=ka}}}h.removeItem(H-1);h.removeItem(H-2);h.removeItem(H-3)}else if(H>=3&&h.getItem(H-
|
||||||
1).type==1){F=3;v=ia(h).matrix;ya=e.createSVGTransform();ya.setMatrix(v);h.clear();h.appendItem(ya)}else if((H==1||H>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ia(h).matrix;h.removeItem(0);v=ia(h).matrix.inverse();v=fa(v,E);E=v.e;v=v.f;if(E!=0||v!=0){B=g.childNodes;C=B.length;for(H=[];C--;){wa=B.item(C);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(H.indexOf(ka)===-1){Hb(ka,E,v);H.push(ka)}}ka=$a;$a=wa.getAttribute("transform");if(ga=V(wa)){Q=e.createSVGTransform();
|
1).type==1){F=3;v=ha(h).matrix;ya=e.createSVGTransform();ya.setMatrix(v);h.clear();h.appendItem(ya)}else if((H==1||H>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=fa(v,E);E=v.e;v=v.f;if(E!=0||v!=0){A=g.childNodes;C=A.length;for(H=[];C--;){wa=A.item(C);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(H.indexOf(ka)===-1){Hb(ka,E,v);H.push(ka)}}ka=$a;$a=wa.getAttribute("transform");if(ga=V(wa)){Q=e.createSVGTransform();
|
||||||
Q.setTranslate(E,v);ga.numberOfItems?ga.insertItemBefore(Q,0):ga.appendItem(Q);k.addSubCommand(rb(wa));ga=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(Q=ga.length;Q--;){Z=ga.item(Q);if(wa==ba(Z)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(Z).insertItemBefore(ua,0);k.addSubCommand(rb(Z))}}$a=ka}}}H=[];$a=ka}}else if(H==1&&h.getItem(0).type==1&&!t){F=1;v=h.getItem(0).matrix;B=g.childNodes;for(C=B.length;C--;){wa=B.item(C);if(wa.nodeType==1){ka=$a;$a=wa.getAttribute("transform");if(ga=
|
Q.setTranslate(E,v);ga.numberOfItems?ga.insertItemBefore(Q,0):ga.appendItem(Q);k.addSubCommand(rb(wa));ga=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(Q=ga.length;Q--;){W=ga.item(Q);if(wa==ba(W)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(W).insertItemBefore(ua,0);k.addSubCommand(rb(W))}}$a=ka}}}H=[];$a=ka}}else if(H==1&&h.getItem(0).type==1&&!t){F=1;v=h.getItem(0).matrix;A=g.childNodes;for(C=A.length;C--;){wa=A.item(C);if(wa.nodeType==1){ka=$a;$a=wa.getAttribute("transform");if(ga=
|
||||||
V(wa)){E=fa(v,ia(ga).matrix);H=e.createSVGTransform();H.setMatrix(E);ga.clear();ga.appendItem(H,0);k.addSubCommand(rb(wa));$a=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(t){D=e.createSVGTransform();D.setRotate(t,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(t){G={x:D.x+P.e,y:D.y+
|
V(wa)){E=fa(v,ha(ga).matrix);H=e.createSVGTransform();H.setMatrix(E);ga.clear();ga.appendItem(H,0);k.addSubCommand(rb(wa));$a=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(t){D=e.createSVGTransform();D.setRotate(t,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(t){G={x:D.x+P.e,y:D.y+
|
||||||
P.f};D=e.createSVGTransform();D.setRotate(t,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ia(h).matrix;P=e.createSVGTransform();P.setRotate(t,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(t,G.x,G.y);G=D.matrix.inverse();ka=v.inverse();G=fa(ka,G,P,v);E=G.e;v=G.f;if(E!=0||v!=0){B=g.childNodes;for(C=B.length;C--;){wa=B.item(C);if(wa.nodeType==1){ka=$a;$a=wa.getAttribute("transform");ga=V(wa);Q=e.createSVGTransform();Q.setTranslate(E,v);ga.numberOfItems?
|
P.f};D=e.createSVGTransform();D.setRotate(t,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(t,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(t,G.x,G.y);G=D.matrix.inverse();ka=v.inverse();G=fa(ka,G,P,v);E=G.e;v=G.f;if(E!=0||v!=0){A=g.childNodes;for(C=A.length;C--;){wa=A.item(C);if(wa.nodeType==1){ka=$a;$a=wa.getAttribute("transform");ga=V(wa);Q=e.createSVGTransform();Q.setTranslate(E,v);ga.numberOfItems?
|
||||||
ga.insertItemBefore(Q,0):ga.appendItem(Q);k.addSubCommand(rb(wa));$a=ka}}}if(t)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{t=svgedit.utilities.getBBox(g);if(!t&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=ra(g)){D={x:t.x+t.width/2,y:t.y+t.height/2};G=O(t.x+t.width/2,t.y+t.height/2,ia(h).matrix);F=E*Math.PI/180;B=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(B*v.e+v.f)/2;D.x=(v.e-B*v.f)/
|
ga.insertItemBefore(Q,0):ga.appendItem(Q);k.addSubCommand(rb(wa));$a=ka}}}if(t)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{t=svgedit.utilities.getBBox(g);if(!t&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=ra(g)){D={x:t.x+t.width/2,y:t.y+t.height/2};G=O(t.x+t.width/2,t.y+t.height/2,ha(h).matrix);F=E*Math.PI/180;A=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F<h.numberOfItems;++F){v=h.getItem(F);if(v.type==4){v=v.matrix;D.y=(A*v.e+v.f)/2;D.x=(v.e-A*v.f)/
|
||||||
2;h.removeItem(F);break}}}F=0;H=h.numberOfItems;if(!svgedit.browser.isWebkit())if((P=g.getAttribute("fill"))&&P.indexOf("url(")===0){P=X(P);ka="pattern";if(P.tagName!==ka)ka="gradient";if(P.getAttribute(ka+"Units")==="userSpaceOnUse"){v=ia(h).matrix;t=V(P);t=ia(t).matrix;v=fa(v,t);t="matrix("+[v.a,v.b,v.c,v.d,v.e,v.f].join(",")+")";P.setAttribute(ka+"Transform",t)}}if(H>=3&&h.getItem(H-2).type==3&&h.getItem(H-3).type==2&&h.getItem(H-1).type==2){F=3;v=ia(h,H-3,H-1).matrix;h.removeItem(H-1);h.removeItem(H-
|
2;h.removeItem(F);break}}}F=0;H=h.numberOfItems;if(!svgedit.browser.isWebkit())if((P=g.getAttribute("fill"))&&P.indexOf("url(")===0){P=Y(P);ka="pattern";if(P.tagName!==ka)ka="gradient";if(P.getAttribute(ka+"Units")==="userSpaceOnUse"){v=ha(h).matrix;t=V(P);t=ha(t).matrix;v=fa(v,t);t="matrix("+[v.a,v.b,v.c,v.d,v.e,v.f].join(",")+")";P.setAttribute(ka+"Transform",t)}}if(H>=3&&h.getItem(H-2).type==3&&h.getItem(H-3).type==2&&h.getItem(H-1).type==2){F=3;v=ha(h,H-3,H-1).matrix;h.removeItem(H-1);h.removeItem(H-
|
||||||
2);h.removeItem(H-3)}else if(H==4&&h.getItem(H-1).type==1){F=3;v=ia(h).matrix;ya=e.createSVGTransform();ya.setMatrix(v);h.clear();h.appendItem(ya);v=e.createSVGMatrix()}else if((H==1||H>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ia(h,1).matrix;t=ka.inverse();v=fa(t,P,ka);h.removeItem(0)}else if(H==1&&h.getItem(0).type==1&&!E){v=ia(h).matrix;switch(g.tagName){case "line":w=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":w.points=g.getAttribute("points");
|
2);h.removeItem(H-3)}else if(H==4&&h.getItem(H-1).type==1){F=3;v=ha(h).matrix;ya=e.createSVGTransform();ya.setMatrix(v);h.clear();h.appendItem(ya);v=e.createSVGMatrix()}else if((H==1||H>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;t=ka.inverse();v=fa(t,P,ka);h.removeItem(0)}else if(H==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":w=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":w.points=g.getAttribute("points");
|
||||||
if(w.points){t=g.points;B=t.numberOfItems;w.points=Array(B);for(F=0;F<B;++F){C=t.getItem(F);w.points[F]={x:C.x,y:C.y}}}case "path":w.d=g.getAttribute("d");F=1;h.clear()}}else{F=4;if(E){D=e.createSVGTransform();D.setRotate(E,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==1||F==2||F==3)wb(g,w,v);if(F==2){if(E){sa(h)||(G={x:D.x+v.e,y:D.y+v.f});D=e.createSVGTransform();D.setRotate(E,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,
|
if(w.points){t=g.points;A=t.numberOfItems;w.points=Array(A);for(F=0;F<A;++F){C=t.getItem(F);w.points[F]={x:C.x,y:C.y}}}case "path":w.d=g.getAttribute("d");F=1;h.clear()}}else{F=4;if(E){D=e.createSVGTransform();D.setRotate(E,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==1||F==2||F==3)wb(g,w,v);if(F==2){if(E){sa(h)||(G={x:D.x+v.e,y:D.y+v.f});D=e.createSVGTransform();D.setRotate(E,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,
|
||||||
0):h.appendItem(D)}}else if(F==3&&E){v=ia(h).matrix;P=e.createSVGTransform();P.setRotate(E,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(E,G.x,G.y);G=D.matrix.inverse();ka=v.inverse();G=fa(ka,G,P,v);wb(g,w,G);if(E)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}h.numberOfItems==0&&g.removeAttribute("transform");k.addSubCommand(new Ya(g,s));return k},Nb=null,bb=this.clearSelection=function(g){if(K[0]!=null)for(var h=K.length,k=0;k<h;++k){var v=K[k];if(v==null)break;Pa.releaseSelector(v);
|
0):h.appendItem(D)}}else if(F==3&&E){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(E,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(E,G.x,G.y);G=D.matrix.inverse();ka=v.inverse();G=fa(ka,G,P,v);wb(g,w,G);if(E)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}h.numberOfItems==0&&g.removeAttribute("transform");k.addSubCommand(new Ya(g,s));return k},Nb=null,bb=this.clearSelection=function(g){if(J[0]!=null)for(var h=J.length,k=0;k<h;++k){var v=J[k];if(v==null)break;Pa.releaseSelector(v);
|
||||||
K[k]=null}g||I("selected",K)},Jb=this.addToSelection=function(g,h){if(g.length!=0){for(var k=0;k<K.length;){if(K[k]==null)break;++k}for(var v=g.length;v--;){var t=g[v];if(t&&svgedit.utilities.getBBox(t)){if(t.tagName==="a"&&t.childNodes.length===1)t=t.firstChild;if(K.indexOf(t)==-1){K[k]=t;k++;t=Pa.requestSelector(t);K.length>1&&t.showGrips(false)}}}I("selected",K);h||K.length==1?Pa.requestSelector(K[0]).showGrips(true):Pa.requestSelector(K[0]).showGrips(false);for(K.sort(function(E,w){if(E&&w&&E.compareDocumentPosition)return 3-
|
J[k]=null}g||I("selected",J)},Jb=this.addToSelection=function(g,h){if(g.length!=0){for(var k=0;k<J.length;){if(J[k]==null)break;++k}for(var v=g.length;v--;){var t=g[v];if(t&&svgedit.utilities.getBBox(t)){if(t.tagName==="a"&&t.childNodes.length===1)t=t.firstChild;if(J.indexOf(t)==-1){J[k]=t;k++;t=Pa.requestSelector(t);J.length>1&&t.showGrips(false)}}}I("selected",J);h||J.length==1?Pa.requestSelector(J[0]).showGrips(true):Pa.requestSelector(J[0]).showGrips(false);for(J.sort(function(E,w){if(E&&w&&E.compareDocumentPosition)return 3-
|
||||||
(w.compareDocumentPosition(E)&6);else if(E==null)return 1});K[0]==null;)K.shift(0)}},vb=this.selectOnly=function(g,h){bb(true);Jb(g,h)};this.removeFromSelection=function(g){if(K[0]!=null)if(g.length!=0){var h=Array(K.length);j=0;len=K.length;for(var k=0;k<len;++k){var v=K[k];if(v)if(g.indexOf(v)==-1){h[j]=v;j++}else Pa.releaseSelector(v)}K=h}};this.selectAllInCurrentLayer=function(){var g=z().getCurrentLayer();if(g){Ja="select";vb($(L||g).children())}};var $b=this.getMouseTarget=function(g){if(g==
|
(w.compareDocumentPosition(E)&6);else if(E==null)return 1});J[0]==null;)J.shift(0)}},vb=this.selectOnly=function(g,h){bb(true);Jb(g,h)};this.removeFromSelection=function(g){if(J[0]!=null)if(g.length!=0){var h=Array(J.length);j=0;len=J.length;for(var k=0;k<len;++k){var v=J[k];if(v)if(g.indexOf(v)==-1){h[j]=v;j++}else Pa.releaseSelector(v)}J=h}};this.selectAllInCurrentLayer=function(){var g=z().getCurrentLayer();if(g){Ja="select";vb($(L||g).children())}};var $b=this.getMouseTarget=function(g){if(g==
|
||||||
null)return null;g=g.target;if(g.correspondingUseElement)g=g.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(g.namespaceURI)>=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=z().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Pa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=
|
null)return null;g=g.target;if(g.correspondingUseElement)g=g.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(g.namespaceURI)>=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=z().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Pa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=
|
||||||
null,t=null,E={},w={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(s){if(!(b.spaceKey||s.button===1)){var B=s.button===2;s.altKey&&svgCanvas.cloneSelectedElements(0,0);Nb=l.getScreenCTM().inverse();var F=O(s.pageX,s.pageY,Nb),C=F.x*p,D=F.y*p;s.preventDefault();if(B){Ja="select";zb=F}F=C/p;D=D/p;var G=$b(s);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;C=v=h=F;var H=t=k=D;if(m.gridSnapping){F=Ga(F);D=Ga(D);h=Ga(h);k=Ga(k)}if(G==Pa.selectorParentGroup&&K[0]!=null){G=s.target;
|
null,t=null,E={},w={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(s){if(!(b.spaceKey||s.button===1)){var A=s.button===2;s.altKey&&svgCanvas.cloneSelectedElements(0,0);Nb=l.getScreenCTM().inverse();var F=O(s.pageX,s.pageY,Nb),C=F.x*p,D=F.y*p;s.preventDefault();if(A){Ja="select";zb=F}F=C/p;D=D/p;var G=$b(s);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;C=v=h=F;var H=t=k=D;if(m.gridSnapping){F=Ga(F);D=Ga(D);h=Ga(h);k=Ga(k)}if(G==Pa.selectorParentGroup&&J[0]!=null){G=s.target;
|
||||||
var P=ob(G,"type");if(P=="rotate"){Ja="rotate";current_rotate_mode=ob(G,"dir")}else if(P=="resize"){Ja="resize";pb=ob(G,"dir")}G=K[0]}$a=G.getAttribute("transform");P=V(G);switch(Ja){case "select":Ra=true;pb="none";if(B)Ra=false;if(G!=e){if(K.indexOf(G)==-1){s.shiftKey||bb(true);Jb([G]);ib=G;Ua.clear()}if(!B)for(B=0;B<K.length;++B)if(K[B]!=null){var Q=V(K[B]);Q.numberOfItems?Q.insertItemBefore(e.createSVGTransform(),0):Q.appendItem(e.createSVGTransform())}}else if(!B){bb();Ja="multiselect";if(Da==
|
var P=nb(G,"type");if(P=="rotate"){Ja="rotate";current_rotate_mode=nb(G,"dir")}else if(P=="resize"){Ja="resize";ob=nb(G,"dir")}G=J[0]}$a=G.getAttribute("transform");P=V(G);switch(Ja){case "select":Ra=true;ob="none";if(A)Ra=false;if(G!=e){if(J.indexOf(G)==-1){s.shiftKey||bb(true);Jb([G]);ib=G;Ua.clear()}if(!A)for(A=0;A<J.length;++A)if(J[A]!=null){var Q=V(J[A]);Q.numberOfItems?Q.insertItemBefore(e.createSVGTransform(),0):Q.appendItem(e.createSVGTransform())}}else if(!A){bb();Ja="multiselect";if(Da==
|
||||||
null)Da=Pa.getRubberBandBox();v*=p;t*=p;ma(Da,{x:v,y:t,width:0,height:0,display:"inline"},100)}break;case "zoom":Ra=true;if(Da==null)Da=Pa.getRubberBandBox();ma(Da,{x:C*p,y:C*p,width:0,height:0,display:"inline"},100);break;case "resize":Ra=true;h=F;k=D;E=svgedit.utilities.getBBox($("#selectedBox0")[0]);var Z={};$.each(E,function(ua,wa){Z[ua]=wa/p});E=Z;B=ra(G)?1:0;if(sa(P)){P.insertItemBefore(e.createSVGTransform(),B);P.insertItemBefore(e.createSVGTransform(),B);P.insertItemBefore(e.createSVGTransform(),
|
null)Da=Pa.getRubberBandBox();v*=p;t*=p;ma(Da,{x:v,y:t,width:0,height:0,display:"inline"},100)}break;case "zoom":Ra=true;if(Da==null)Da=Pa.getRubberBandBox();ma(Da,{x:C*p,y:C*p,width:0,height:0,display:"inline"},100);break;case "resize":Ra=true;h=F;k=D;E=svgedit.utilities.getBBox($("#selectedBox0")[0]);var W={};$.each(E,function(ua,wa){W[ua]=wa/p});E=W;A=ra(G)?1:0;if(sa(P)){P.insertItemBefore(e.createSVGTransform(),A);P.insertItemBefore(e.createSVGTransform(),A);P.insertItemBefore(e.createSVGTransform(),
|
||||||
B)}else{P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(F=svgedit.browser.isChrome())Q=function(ua){var wa=ua.getAttributeNS(null,"stroke");ua.removeAttributeNS(null,"stroke");setTimeout(function(){ua.setAttributeNS(null,"stroke",wa)},1)};G.style.vectorEffect="non-scaling-stroke";F&&Q(G);D=G.getElementsByTagName("*");C=D.length;for(B=0;B<C;B++){D[B].style.vectorEffect="non-scaling-stroke";
|
A)}else{P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());P.appendItem(e.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(F=svgedit.browser.isChrome())Q=function(ua){var wa=ua.getAttributeNS(null,"stroke");ua.removeAttributeNS(null,"stroke");setTimeout(function(){ua.setAttributeNS(null,"stroke",wa)},1)};G.style.vectorEffect="non-scaling-stroke";F&&Q(G);D=G.getElementsByTagName("*");C=D.length;for(A=0;A<C;A++){D[A].style.vectorEffect="non-scaling-stroke";
|
||||||
F&&Q(D[B])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ra=true;g=C+","+H+" ";Q=N.stroke_width==0?1:N.stroke_width;da({element:"polyline",curStyles:true,attr:{points:g,id:M(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});w.minx=C;w.maxx=C;w.miny=H;w.maxy=H;break;case "image":Ra=true;Q=da({element:"image",attr:{x:F,y:D,width:0,height:0,id:M(),opacity:N.opacity/2,style:"pointer-events:inherit"}});S(Q,La);Zb(Q);break;case "square":case "rect":Ra=true;
|
F&&Q(D[A])}}}break;case "fhellipse":case "fhrect":case "fhpath":Ra=true;g=C+","+H+" ";Q=N.stroke_width==0?1:N.stroke_width;da({element:"polyline",curStyles:true,attr:{points:g,id:M(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});w.minx=C;w.maxx=C;w.miny=H;w.maxy=H;break;case "image":Ra=true;Q=da({element:"image",attr:{x:F,y:D,width:0,height:0,id:M(),opacity:N.opacity/2,style:"pointer-events:inherit"}});S(Q,La);Zb(Q);break;case "square":case "rect":Ra=true;
|
||||||
h=F;k=D;da({element:"rect",curStyles:true,attr:{x:F,y:D,width:0,height:0,id:M(),opacity:N.opacity/2}});break;case "line":Ra=true;Q=N.stroke_width==0?1:N.stroke_width;da({element:"line",curStyles:true,attr:{x1:F,y1:D,x2:F,y2:D,id:M(),stroke:N.stroke,"stroke-width":Q,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":Ra=true;da({element:"circle",
|
h=F;k=D;da({element:"rect",curStyles:true,attr:{x:F,y:D,width:0,height:0,id:M(),opacity:N.opacity/2}});break;case "line":Ra=true;Q=N.stroke_width==0?1:N.stroke_width;da({element:"line",curStyles:true,attr:{x1:F,y1:D,x2:F,y2:D,id:M(),stroke:N.stroke,"stroke-width":Q,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":Ra=true;da({element:"circle",
|
||||||
curStyles:true,attr:{cx:F,cy:D,r:0,id:M(),opacity:N.opacity/2}});break;case "ellipse":Ra=true;da({element:"ellipse",curStyles:true,attr:{cx:F,cy:D,rx:0,ry:0,id:M(),opacity:N.opacity/2}});break;case "text":Ra=true;da({element:"text",curStyles:true,attr:{x:F,y:D,id:M(),fill:db.fill,"stroke-width":db.stroke_width,"font-size":db.font_size,"font-family":db.font_family,"text-anchor":"left","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=p;k*=p;Ua.mouseDown(s,G,h,k);Ra=true;
|
curStyles:true,attr:{cx:F,cy:D,r:0,id:M(),opacity:N.opacity/2}});break;case "ellipse":Ra=true;da({element:"ellipse",curStyles:true,attr:{cx:F,cy:D,rx:0,ry:0,id:M(),opacity:N.opacity/2}});break;case "text":Ra=true;da({element:"text",curStyles:true,attr:{x:F,y:D,id:M(),fill:eb.fill,"stroke-width":eb.stroke_width,"font-size":eb.font_size,"font-family":eb.font_family,"text-anchor":"left","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=p;k*=p;Ua.mouseDown(s,G,h,k);Ra=true;
|
||||||
break;case "textedit":h*=p;k*=p;sb.mouseDown(s,G,h,k);Ra=true;break;case "rotate":Ra=true;b.undoMgr.beginUndoableChange("transform",K);document.getElementById("workarea").className="rotate"}Q=nb("mouseDown",{event:s,start_x:h,start_y:k,selectedElements:K},true);$.each(Q,function(ua,wa){if(wa&&wa.started)Ra=true});if(Ja)document.getElementById("workarea").className=Ja=="resize"?s.target.style.cursor:Ja}}).mousemove(function(s){if(Ra)if(!(s.button===1||b.spaceKey)){var B=K[0],F=O(s.pageX,s.pageY,Nb),
|
break;case "textedit":h*=p;k*=p;sb.mouseDown(s,G,h,k);Ra=true;break;case "rotate":Ra=true;b.undoMgr.beginUndoableChange("transform",J);document.getElementById("workarea").className="rotate"}Q=pb("mouseDown",{event:s,start_x:h,start_y:k,selectedElements:J},true);$.each(Q,function(ua,wa){if(wa&&wa.started)Ra=true});if(Ja)document.getElementById("workarea").className=Ja=="resize"?s.target.style.cursor:Ja}}).mousemove(function(s){if(Ra)if(!(s.button===1||b.spaceKey)){var A=J[0],F=O(s.pageX,s.pageY,Nb),
|
||||||
C=F.x*p;F=F.y*p;var D=la(ta()),G=x=C/p,H=y=F/p;if(m.gridSnapping){x=Ga(x);y=Ga(y)}s.preventDefault();switch(Ja){case "select":if(K[0]!==null){G=x-h;var P=y-k;if(m.gridSnapping){G=Ga(G);P=Ga(P)}if(s.shiftKey){var Q=ca(h,k,x,y);x=Q.x;y=Q.y}if(G!=0||P!=0){Q=K.length;for(H=0;H<Q;++H){B=K[H];if(B==null)break;var Z=e.createSVGTransform();D=V(B);Z.setTranslate(G,P);D.numberOfItems?D.replaceItem(Z,0):D.appendItem(Z);Pa.requestSelector(B).resize()}I("transition",K)}}break;case "multiselect":G*=p;H*=p;ma(Da,
|
C=F.x*p;F=F.y*p;var D=la(ta()),G=x=C/p,H=y=F/p;if(m.gridSnapping){x=Ga(x);y=Ga(y)}s.preventDefault();switch(Ja){case "select":if(J[0]!==null){G=x-h;var P=y-k;if(m.gridSnapping){G=Ga(G);P=Ga(P)}if(s.shiftKey){var Q=ca(h,k,x,y);x=Q.x;y=Q.y}if(G!=0||P!=0){Q=J.length;for(H=0;H<Q;++H){A=J[H];if(A==null)break;var W=e.createSVGTransform();D=V(A);W.setTranslate(G,P);D.numberOfItems?D.replaceItem(W,0):D.appendItem(W);Pa.requestSelector(A).resize()}I("transition",J)}}break;case "multiselect":G*=p;H*=p;ma(Da,
|
||||||
{x:Math.min(v,G),y:Math.min(t,H),width:Math.abs(G-v),height:Math.abs(H-t)},100);D=[];G=[];Z=Kb();Q=K.length;for(H=0;H<Q;++H){P=Z.indexOf(K[H]);if(P==-1)D.push(K[H]);else Z[P]=null}Q=Z.length;for(H=0;H<Q;++H)Z[H]&&G.push(Z[H]);D.length>0&&b.removeFromSelection(D);G.length>0&&Jb(G);break;case "resize":D=V(B);G=(Q=sa(D))?E:svgedit.utilities.getBBox(B);H=G.x;Z=G.y;var ua=G.width,wa=G.height;G=x-h;P=y-k;if(m.gridSnapping){G=Ga(G);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var ga=ra(B);if(ga){var ka=Math.sqrt(G*G+P*P);
|
{x:Math.min(v,G),y:Math.min(t,H),width:Math.abs(G-v),height:Math.abs(H-t)},100);D=[];G=[];W=Kb();Q=J.length;for(H=0;H<Q;++H){P=W.indexOf(J[H]);if(P==-1)D.push(J[H]);else W[P]=null}Q=W.length;for(H=0;H<Q;++H)W[H]&&G.push(W[H]);D.length>0&&b.removeFromSelection(D);G.length>0&&Jb(G);break;case "resize":D=V(A);G=(Q=sa(D))?E:svgedit.utilities.getBBox(A);H=G.x;W=G.y;var ua=G.width,wa=G.height;G=x-h;P=y-k;if(m.gridSnapping){G=Ga(G);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var ga=ra(A);if(ga){var ka=Math.sqrt(G*G+P*P);
|
||||||
P=Math.atan2(P,G)-ga*Math.PI/180;G=ka*Math.cos(P);P=ka*Math.sin(P)}if(pb.indexOf("n")==-1&&pb.indexOf("s")==-1)P=0;if(pb.indexOf("e")==-1&&pb.indexOf("w")==-1)G=0;var oa=ka=0,ya=wa?(wa+P)/wa:1,jb=ua?(ua+G)/ua:1;if(pb.indexOf("n")>=0){ya=wa?(wa-P)/wa:1;oa=wa}if(pb.indexOf("w")>=0){jb=ua?(ua-G)/ua:1;ka=ua}G=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){H=Ga(H);ka=Ga(ka);Z=Ga(Z);oa=Ga(oa)}G.setTranslate(-(H+ka),-(Z+oa));if(s.shiftKey)if(jb==1)jb=ya;else ya=
|
P=Math.atan2(P,G)-ga*Math.PI/180;G=ka*Math.cos(P);P=ka*Math.sin(P)}if(ob.indexOf("n")==-1&&ob.indexOf("s")==-1)P=0;if(ob.indexOf("e")==-1&&ob.indexOf("w")==-1)G=0;var oa=ka=0,ya=wa?(wa+P)/wa:1,jb=ua?(ua+G)/ua:1;if(ob.indexOf("n")>=0){ya=wa?(wa-P)/wa:1;oa=wa}if(ob.indexOf("w")>=0){jb=ua?(ua-G)/ua:1;ka=ua}G=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){H=Ga(H);ka=Ga(ka);W=Ga(W);oa=Ga(oa)}G.setTranslate(-(H+ka),-(W+oa));if(s.shiftKey)if(jb==1)jb=ya;else ya=
|
||||||
jb;P.setScale(jb,ya);ua.setTranslate(H+ka,Z+oa);if(Q){Q=ga?1:0;D.replaceItem(G,2+Q);D.replaceItem(P,1+Q);D.replaceItem(ua,0+Q)}else{Q=D.numberOfItems;D.replaceItem(ua,Q-3);D.replaceItem(P,Q-2);D.replaceItem(G,Q-1)}Pa.requestSelector(B).resize();I("transition",K);break;case "zoom":G*=p;H*=p;ma(Da,{x:Math.min(v*p,G),y:Math.min(t*p,H),width:Math.abs(G-v*p),height:Math.abs(H-t*p)},100);break;case "text":ma(D,{x:x,y:y},1E3);break;case "line":G=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=
|
jb;P.setScale(jb,ya);ua.setTranslate(H+ka,W+oa);if(Q){Q=ga?1:0;D.replaceItem(G,2+Q);D.replaceItem(P,1+Q);D.replaceItem(ua,0+Q)}else{Q=D.numberOfItems;D.replaceItem(ua,Q-3);D.replaceItem(P,Q-2);D.replaceItem(G,Q-1)}Pa.requestSelector(A).resize();I("transition",J);break;case "zoom":G*=p;H*=p;ma(Da,{x:Math.min(v*p,G),y:Math.min(t*p,H),width:Math.abs(G-v*p),height:Math.abs(H-t*p)},100);break;case "text":ma(D,{x:x,y:y},1E3);break;case "line":G=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=
|
||||||
Ga(x);y=Ga(y)}H=x;Q=y;if(s.shiftKey){Q=ca(h,k,H,Q);H=Q.x;Q=Q.y}D.setAttributeNS(null,"x2",H);D.setAttributeNS(null,"y2",Q);window.opera||e.unsuspendRedraw(G);break;case "foreignObject":case "square":case "rect":case "image":G=Math.abs(x-h);Q=Math.abs(y-k);if(Ja=="square"||s.shiftKey){G=Q=Math.max(G,Q);H=h<x?h:h-G;Z=k<y?k:k-Q}else{H=Math.min(h,x);Z=Math.min(k,y)}if(m.gridSnapping){G=Ga(G);Q=Ga(Q);H=Ga(H);Z=Ga(Z)}ma(D,{width:G,height:Q,x:H,y:Z},1E3);break;case "circle":G=$(D).attr(["cx","cy"]);Q=G.cx;
|
Ga(x);y=Ga(y)}H=x;Q=y;if(s.shiftKey){Q=ca(h,k,H,Q);H=Q.x;Q=Q.y}D.setAttributeNS(null,"x2",H);D.setAttributeNS(null,"y2",Q);window.opera||e.unsuspendRedraw(G);break;case "foreignObject":case "square":case "rect":case "image":G=Math.abs(x-h);Q=Math.abs(y-k);if(Ja=="square"||s.shiftKey){G=Q=Math.max(G,Q);H=h<x?h:h-G;W=k<y?k:k-Q}else{H=Math.min(h,x);W=Math.min(k,y)}if(s.altKey){G*=2;Q*=2;H=h-G/2;W=k-Q/2}if(m.gridSnapping){G=Ga(G);Q=Ga(Q);H=Ga(H);W=Ga(W)}ma(D,{width:G,height:Q,x:H,y:W},1E3);break;case "circle":G=
|
||||||
H=G.cy;G=Math.sqrt((x-Q)*(x-Q)+(y-H)*(y-H));if(m.gridSnapping)G=Ga(G);D.setAttributeNS(null,"r",G);break;case "ellipse":G=$(D).attr(["cx","cy"]);Q=G.cx;H=G.cy;G=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);Q=Ga(Q);y=Ga(y);H=Ga(H)}D.setAttributeNS(null,"rx",Math.abs(x-Q));D.setAttributeNS(null,"ry",Math.abs(s.shiftKey?x-Q:y-H));window.opera||e.unsuspendRedraw(G);break;case "fhellipse":case "fhrect":w.minx=Math.min(G,w.minx);w.maxx=Math.max(G,w.maxx);w.miny=Math.min(H,w.miny);
|
$(D).attr(["cx","cy"]);Q=G.cx;H=G.cy;G=Math.sqrt((x-Q)*(x-Q)+(y-H)*(y-H));if(m.gridSnapping)G=Ga(G);D.setAttributeNS(null,"r",G);break;case "ellipse":$(D).attr(["cx","cy"]);Q=Math.abs(h+(x-h)/2);H=Math.abs(k+(y-k)/2);G=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);Q=Ga(Q);y=Ga(y);H=Ga(H)}W=Math.abs(h-Q);P=Math.abs(k-H);if(s.shiftKey){P=W;H=y>k?k+W:k-W}if(s.altKey){Q=h;H=k;W=Math.abs(x-Q);P=s.shiftKey?W:Math.abs(y-H)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P);
|
||||||
w.maxy=Math.max(H,w.maxy);case "fhpath":g+=+G+","+H+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(s.shiftKey){if(Q=svgedit.path.path){D=Q.dragging?Q.dragging[0]:h;Q=Q.dragging?Q.dragging[1]:k}else{D=h;Q=k}Q=ca(D,Q,x,y);x=Q.x;y=Q.y}if(Da&&Da.getAttribute("display")!=="none"){G*=p;H*=p;ma(Da,{x:Math.min(v*p,G),y:Math.min(t*p,H),width:Math.abs(G-v*p),height:Math.abs(H-t*p)},100)}Ua.mouseMove(s,x,y);break;case "textedit":x*=
|
D.setAttributeNS(null,"cx",Q);D.setAttributeNS(null,"cy",H);window.opera||e.unsuspendRedraw(G);break;case "fhellipse":case "fhrect":w.minx=Math.min(G,w.minx);w.maxx=Math.max(G,w.maxx);w.miny=Math.min(H,w.miny);w.maxy=Math.max(H,w.maxy);case "fhpath":g+=+G+","+H+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(s.shiftKey){if(Q=svgedit.path.path){D=Q.dragging?Q.dragging[0]:h;Q=Q.dragging?Q.dragging[1]:k}else{D=h;
|
||||||
p;y*=p;sb.mouseMove(C,F);break;case "rotate":G=svgedit.utilities.getBBox(B);Q=G.x+G.width/2;H=G.y+G.height/2;D=ea(B);D=O(Q,H,D);Q=D.x;H=D.y;D=G.x;Z=G.y;if(current_rotate_mode=="nw")D=G.x+G.width;if(current_rotate_mode=="se")Z=G.y+G.height;if(current_rotate_mode=="sw"){D=G.x+G.width;Z=G.y+G.height}compensation_angle=(Math.atan2(H-Z,Q-D)*(180/Math.PI)-90)%360;ga=(Math.atan2(H-y,Q-x)*(180/Math.PI)-90)%360;ga+=compensation_angle;if(m.gridSnapping)ga=Ga(ga);if(s.shiftKey)ga=Math.round(ga/45)*45;b.setRotationAngle(ga<
|
Q=k}Q=ca(D,Q,x,y);x=Q.x;y=Q.y}if(Da&&Da.getAttribute("display")!=="none"){G*=p;H*=p;ma(Da,{x:Math.min(v*p,G),y:Math.min(t*p,H),width:Math.abs(G-v*p),height:Math.abs(H-t*p)},100)}Ua.mouseMove(s,x,y);break;case "textedit":x*=p;y*=p;sb.mouseMove(C,F);break;case "rotate":G=svgedit.utilities.getBBox(A);Q=G.x+G.width/2;H=G.y+G.height/2;D=ea(A);D=O(Q,H,D);Q=D.x;H=D.y;D=G.x;W=G.y;if(current_rotate_mode=="nw")D=G.x+G.width;if(current_rotate_mode=="se")W=G.y+G.height;if(current_rotate_mode=="sw"){D=G.x+G.width;
|
||||||
-180?360+ga:ga,true);I("transition",K)}nb("mouseMove",{event:s,mouse_x:C,mouse_y:F,selected:B})}}).click(function(s){s.preventDefault();return false}).dblclick(function(s){var B=s.target.parentNode;if(B!==L){var F=$b(s),C=F.tagName;if(C==="text"&&Ja!=="textedit"){s=O(s.pageX,s.pageY,Nb);sb.select(F,s.x,s.y)}if((C==="g"||C==="a")&&ra(F)){ec(F);F=K[0];bb(true)}L&&ac();B.tagName!=="g"&&B.tagName!=="a"||B===z().getCurrentLayer()||F===Pa.selectorParentGroup||nc(F)}}).mouseup(function(s){if(s.button!==
|
W=G.y+G.height}compensation_angle=(Math.atan2(H-W,Q-D)*(180/Math.PI)-90)%360;ga=(Math.atan2(H-y,Q-x)*(180/Math.PI)-90)%360;ga+=compensation_angle;if(m.gridSnapping)ga=Ga(ga);if(s.shiftKey)ga=Math.round(ga/45)*45;b.setRotationAngle(ga<-180?360+ga:ga,true);I("transition",J)}pb("mouseMove",{event:s,mouse_x:C,mouse_y:F,selected:A})}}).click(function(s){s.preventDefault();return false}).dblclick(function(s){var A=s.target.parentNode;if(A!==L){var F=$b(s),C=F.tagName;if(C==="text"&&Ja!=="textedit"){s=O(s.pageX,
|
||||||
2){var B=ib;ib=null;if(Ra){var F=O(s.pageX,s.pageY,Nb),C=F.x*p;F=F.y*p;var D=C/p,G=F/p,H=la(ta()),P=false;Ra=false;switch(Ja){case "resize":case "multiselect":if(Da!=null){Da.setAttribute("display","none");xb=[]}Ja="select";case "select":if(K[0]!=null){if(K[1]==null){C=K[0];switch(C.tagName){case "g":case "use":case "image":case "foreignObject":break;default:hb.fill=C.getAttribute("fill");hb.fill_opacity=C.getAttribute("fill-opacity");hb.stroke=C.getAttribute("stroke");hb.stroke_opacity=C.getAttribute("stroke-opacity");
|
s.pageY,Nb);sb.select(F,s.x,s.y)}if((C==="g"||C==="a")&&ra(F)){ec(F);F=J[0];bb(true)}L&&ac();A.tagName!=="g"&&A.tagName!=="a"||A===z().getCurrentLayer()||F===Pa.selectorParentGroup||mc(F)}}).mouseup(function(s){if(s.button!==2){var A=ib;ib=null;if(Ra){var F=O(s.pageX,s.pageY,Nb),C=F.x*p;F=F.y*p;var D=C/p,G=F/p,H=la(ta()),P=false;Ra=false;switch(Ja){case "resize":case "multiselect":if(Da!=null){Da.setAttribute("display","none");xb=[]}Ja="select";case "select":if(J[0]!=null){if(J[1]==null){C=J[0];switch(C.tagName){case "g":case "use":case "image":case "foreignObject":break;
|
||||||
hb.stroke_width=C.getAttribute("stroke-width");hb.stroke_dasharray=C.getAttribute("stroke-dasharray");hb.stroke_linejoin=C.getAttribute("stroke-linejoin");hb.stroke_linecap=C.getAttribute("stroke-linecap")}if(C.tagName=="text"){db.font_size=C.getAttribute("font-size");db.font_family=C.getAttribute("font-family")}Pa.requestSelector(C).showGrips(true)}Wa();if(D!=v||G!=t){s=K.length;for(C=0;C<s;++C){if(K[C]==null)break;K[C].firstChild||Pa.requestSelector(K[C]).resize()}}else{C=s.target;if(K[0].nodeName===
|
default:hb.fill=C.getAttribute("fill");hb.fill_opacity=C.getAttribute("fill-opacity");hb.stroke=C.getAttribute("stroke");hb.stroke_opacity=C.getAttribute("stroke-opacity");hb.stroke_width=C.getAttribute("stroke-width");hb.stroke_dasharray=C.getAttribute("stroke-dasharray");hb.stroke_linejoin=C.getAttribute("stroke-linejoin");hb.stroke_linecap=C.getAttribute("stroke-linecap")}if(C.tagName=="text"){eb.font_size=C.getAttribute("font-size");eb.font_family=C.getAttribute("font-family")}Pa.requestSelector(C).showGrips(true)}Wa();
|
||||||
"path"&&K[1]==null)Ua.select(K[0]);else s.shiftKey&&B!=C&&b.removeFromSelection([C])}if(svgedit.browser.supportsNonScalingStroke())if(s=K[0]){s.removeAttribute("style");svgedit.utilities.walkTree(s,function(ua){ua.removeAttribute("style")})}}return;case "zoom":Da!=null&&Da.setAttribute("display","none");I("zoomed",{x:Math.min(v,D),y:Math.min(t,G),width:Math.abs(D-v),height:Math.abs(G-t),factor:s.altKey?0.5:2});return;case "fhpath":B=H.getAttribute("points");D=B.indexOf(",");if(P=D>=0?B.indexOf(",",
|
if(D!=v||G!=t){s=J.length;for(C=0;C<s;++C){if(J[C]==null)break;J[C].firstChild||Pa.requestSelector(J[C]).resize()}}else{C=s.target;if(J[0].nodeName==="path"&&J[1]==null)Ua.select(J[0]);else s.shiftKey&&A!=C&&b.removeFromSelection([C])}if(svgedit.browser.supportsNonScalingStroke())if(s=J[0]){s.removeAttribute("style");svgedit.utilities.walkTree(s,function(ua){ua.removeAttribute("style")})}}return;case "zoom":Da!=null&&Da.setAttribute("display","none");I("zoomed",{x:Math.min(v,D),y:Math.min(t,G),width:Math.abs(D-
|
||||||
D+1)>=0:B.indexOf(" ",B.indexOf(" ")+1)>=0)H=Ua.smoothPolylineIntoPath(H);break;case "line":B=$(H).attr(["x1","x2","y1","y2"]);P=B.x1!=B.x2||B.y1!=B.y2;break;case "foreignObject":case "square":case "rect":case "image":B=$(H).attr(["width","height"]);P=B.width!=0||B.height!=0||Ja==="image";break;case "circle":P=H.getAttribute("r")!=0;break;case "ellipse":B=$(H).attr(["rx","ry"]);P=B.rx!=null||B.ry!=null;break;case "fhellipse":if(w.maxx-w.minx>0&&w.maxy-w.miny>0){H=da({element:"ellipse",curStyles:true,
|
v),height:Math.abs(G-t),factor:s.altKey?0.5:2});return;case "fhpath":A=H.getAttribute("points");D=A.indexOf(",");if(P=D>=0?A.indexOf(",",D+1)>=0:A.indexOf(" ",A.indexOf(" ")+1)>=0)H=Ua.smoothPolylineIntoPath(H);break;case "line":A=$(H).attr(["x1","x2","y1","y2"]);P=A.x1!=A.x2||A.y1!=A.y2;break;case "foreignObject":case "square":case "rect":case "image":A=$(H).attr(["width","height"]);P=A.width!=0||A.height!=0||Ja==="image";break;case "circle":P=H.getAttribute("r")!=0;break;case "ellipse":A=$(H).attr(["rx",
|
||||||
attr:{cx:(w.minx+w.maxx)/2,cy:(w.miny+w.maxy)/2,rx:(w.maxx-w.minx)/2,ry:(w.maxy-w.miny)/2,id:ta()}});I("changed",[H]);P=true}break;case "fhrect":if(w.maxx-w.minx>0&&w.maxy-w.miny>0){H=da({element:"rect",curStyles:true,attr:{x:w.minx,y:w.miny,width:w.maxx-w.minx,height:w.maxy-w.miny,id:ta()}});I("changed",[H]);P=true}break;case "text":P=true;vb([H]);sb.start(H);break;case "path":H=null;Ra=true;B=Ua.mouseUp(s,H,C,F);H=B.element;P=B.keep;break;case "pathedit":P=true;H=null;Ua.mouseUp(s);break;case "textedit":P=
|
"ry"]);P=A.rx!=null||A.ry!=null;break;case "fhellipse":if(w.maxx-w.minx>0&&w.maxy-w.miny>0){H=da({element:"ellipse",curStyles:true,attr:{cx:(w.minx+w.maxx)/2,cy:(w.miny+w.maxy)/2,rx:(w.maxx-w.minx)/2,ry:(w.maxy-w.miny)/2,id:ta()}});I("changed",[H]);P=true}break;case "fhrect":if(w.maxx-w.minx>0&&w.maxy-w.miny>0){H=da({element:"rect",curStyles:true,attr:{x:w.minx,y:w.miny,width:w.maxx-w.minx,height:w.maxy-w.miny,id:ta()}});I("changed",[H]);P=true}break;case "text":P=true;vb([H]);sb.start(H);break;case "path":H=
|
||||||
false;H=null;sb.mouseUp(s,C,F);break;case "rotate":P=true;H=null;Ja="select";B=b.undoMgr.finishUndoableChange();B.isEmpty()||Ia(B);Wa();I("changed",K)}C=nb("mouseUp",{event:s,mouse_x:C,mouse_y:F},true);$.each(C,function(ua,wa){if(wa){P=wa.keep||P;H=wa.element;Ra=wa.started||Ra}});if(!P&&H!=null){z().releaseId(ta());H.parentNode.removeChild(H);H=null;for(C=s.target;C.parentNode.parentNode.tagName=="g";)C=C.parentNode;if((Ja!="path"||!drawn_path)&&C.parentNode.id!="selectorParentGroup"&&C.id!="svgcanvas"&&
|
null;Ra=true;A=Ua.mouseUp(s,H,C,F);H=A.element;P=A.keep;break;case "pathedit":P=true;H=null;Ua.mouseUp(s);break;case "textedit":P=false;H=null;sb.mouseUp(s,C,F);break;case "rotate":P=true;H=null;Ja="select";A=b.undoMgr.finishUndoableChange();A.isEmpty()||Ia(A);Wa();I("changed",J)}C=pb("mouseUp",{event:s,mouse_x:C,mouse_y:F},true);$.each(C,function(ua,wa){if(wa){P=wa.keep||P;H=wa.element;Ra=wa.started||Ra}});if(!P&&H!=null){z().releaseId(ta());H.parentNode.removeChild(H);H=null;for(C=s.target;C.parentNode.parentNode.tagName==
|
||||||
C.id!="svgroot"){b.setMode("select");vb([C],true)}}else if(H!=null){b.addedNew=true;s=0.2;var Q;if(false.beginElement&&H.getAttribute("opacity")!=N.opacity){Q=$(false).clone().attr({to:N.opacity,dur:s}).appendTo(H);try{Q[0].beginElement()}catch(Z){}}else s=0;setTimeout(function(){Q&&Q.remove();H.setAttribute("opacity",N.opacity);H.setAttribute("style","pointer-events:inherit");Y(H);if(Ja==="path")Ua.toEditMode(H);else m.selectNew&&vb([H],true);Ia(new Ma(H));I("changed",[H])},s*1E3)}$a=null}}});$(a).bind("mousewheel DOMMouseScroll",
|
"g";)C=C.parentNode;if((Ja!="path"||!drawn_path)&&C.parentNode.id!="selectorParentGroup"&&C.id!="svgcanvas"&&C.id!="svgroot"){b.setMode("select");vb([C],true)}}else if(H!=null){b.addedNew=true;s=0.2;var Q;if(false.beginElement&&H.getAttribute("opacity")!=N.opacity){Q=$(false).clone().attr({to:N.opacity,dur:s}).appendTo(H);try{Q[0].beginElement()}catch(W){}}else s=0;setTimeout(function(){Q&&Q.remove();H.setAttribute("opacity",N.opacity);H.setAttribute("style","pointer-events:inherit");Z(H);if(Ja===
|
||||||
function(s){if(s.shiftKey){s.preventDefault();Nb=l.getScreenCTM().inverse();var B=O(s.pageX,s.pageY,Nb);B={x:B.x,y:B.y,width:0,height:0};if(s.wheelDelta)if(s.wheelDelta>=120)B.factor=2;else{if(s.wheelDelta<=-120)B.factor=0.5}else if(s.detail)if(s.detail>0)B.factor=0.5;else if(s.detail<0)B.factor=2;B.factor&&I("zoomed",B)}})})();var Zb=function(g){$(g).click(function(h){h.preventDefault()})},sb=b.textActions=function(){function g(ga){var ka=F.value==="";$(F).focus();if(!arguments.length)if(ka)ga=0;
|
"path")Ua.toEditMode(H);else m.selectNew&&vb([H],true);Ia(new Ma(H));I("changed",[H])},s*1E3)}$a=null}}});$(a).bind("mousewheel DOMMouseScroll",function(s){if(s.shiftKey){s.preventDefault();Nb=l.getScreenCTM().inverse();var A=O(s.pageX,s.pageY,Nb);A={x:A.x,y:A.y,width:0,height:0};if(s.wheelDelta)if(s.wheelDelta>=120)A.factor=2;else{if(s.wheelDelta<=-120)A.factor=0.5}else if(s.detail)if(s.detail>0)A.factor=0.5;else if(s.detail<0)A.factor=2;A.factor&&I("zoomed",A)}})})();var Zb=function(g){$(g).click(function(h){h.preventDefault()})},
|
||||||
else{if(F.selectionEnd!==F.selectionStart)return;ga=F.selectionEnd}var oa;oa=H[ga];ka||F.setSelectionRange(ga,ga);C=la("text_cursor");if(!C){C=document.createElementNS(c,"line");ma(C,{id:"text_cursor",stroke:"#333","stroke-width":1});C=la("selectorParentGroup").appendChild(C)}G||(G=setInterval(function(){var ya=C.getAttribute("display")==="none";C.setAttribute("display",ya?"inline":"none")},600));ka=E(oa.x,P.y);oa=E(oa.x,P.y+P.height);ma(C,{x1:ka.x,y1:ka.y,x2:oa.x,y2:oa.y,visibility:"visible",display:"inline"});
|
sb=b.textActions=function(){function g(ga){var ka=F.value==="";$(F).focus();if(!arguments.length)if(ka)ga=0;else{if(F.selectionEnd!==F.selectionStart)return;ga=F.selectionEnd}var oa;oa=H[ga];ka||F.setSelectionRange(ga,ga);C=la("text_cursor");if(!C){C=document.createElementNS(c,"line");ma(C,{id:"text_cursor",stroke:"#333","stroke-width":1});C=la("selectorParentGroup").appendChild(C)}G||(G=setInterval(function(){var ya=C.getAttribute("display")==="none";C.setAttribute("display",ya?"inline":"none")},
|
||||||
D&&D.setAttribute("d","")}function h(ga,ka,oa){if(ga===ka)g(ka);else{oa||F.setSelectionRange(ga,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");ma(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}ga=H[ga];var ya=H[ka];C.setAttribute("visibility","hidden");ka=E(ga.x,P.y);oa=E(ga.x+(ya.x-ga.x),P.y);var jb=E(ga.x,P.y+P.height);ga=E(ga.x+(ya.x-ga.x),P.y+P.height);ma(D,{d:"M"+ka.x+","+ka.y+" L"+oa.x+","+oa.y+
|
600));ka=E(oa.x,P.y);oa=E(oa.x,P.y+P.height);ma(C,{x1:ka.x,y1:ka.y,x2:oa.x,y2:oa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(ga,ka,oa){if(ga===ka)g(ka);else{oa||F.setSelectionRange(ga,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");ma(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}ga=H[ga];var ya=H[ka];C.setAttribute("visibility","hidden");ka=E(ga.x,P.y);oa=E(ga.x+
|
||||||
" "+ga.x+","+ga.y+" "+jb.x+","+jb.y+"z",display:"inline"})}}function k(ga,ka){var oa=e.createSVGPoint();oa.x=ga;oa.y=ka;if(H.length==1)return 0;oa=B.getCharNumAtPosition(oa);if(oa<0){oa=H.length-2;if(ga<=H[0].x)oa=0}else if(oa>=H.length-2)oa=H.length-2;var ya=H[oa];ga>ya.x+ya.width/2&&oa++;return oa}function v(ga,ka,oa){var ya=F.selectionStart;ga=k(ga,ka);h(Math.min(ya,ga),Math.max(ya,ga),!oa)}function t(ga,ka){var oa={x:ga,y:ka};oa.x/=p;oa.y/=p;if(Q){var ya=O(oa.x,oa.y,Q.inverse());oa.x=ya.x;oa.y=
|
(ya.x-ga.x),P.y);var jb=E(ga.x,P.y+P.height);ga=E(ga.x+(ya.x-ga.x),P.y+P.height);ma(D,{d:"M"+ka.x+","+ka.y+" L"+oa.x+","+oa.y+" "+ga.x+","+ga.y+" "+jb.x+","+jb.y+"z",display:"inline"})}}function k(ga,ka){var oa=e.createSVGPoint();oa.x=ga;oa.y=ka;if(H.length==1)return 0;oa=A.getCharNumAtPosition(oa);if(oa<0){oa=H.length-2;if(ga<=H[0].x)oa=0}else if(oa>=H.length-2)oa=H.length-2;var ya=H[oa];ga>ya.x+ya.width/2&&oa++;return oa}function v(ga,ka,oa){var ya=F.selectionStart;ga=k(ga,ka);h(Math.min(ya,ga),
|
||||||
ya.y}return oa}function E(ga,ka){var oa={x:ga,y:ka};if(Q){var ya=O(oa.x,oa.y,Q);oa.x=ya.x;oa.y=ya.y}oa.x*=p;oa.y*=p;return oa}function w(ga){h(0,B.textContent.length);$(this).unbind(ga)}function s(ga){if(wa&&B){var ka=O(ga.pageX,ga.pageY,Nb);ka=t(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var oa=B.textContent,ya=oa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;oa=oa.substr(ka).match(/^[a-z0-9]+/i);h(ya,(oa?oa[0].length:0)+ka);$(ga.target).click(w);setTimeout(function(){$(ga.target).unbind("click",w)},300)}}var B,
|
Math.max(ya,ga),!oa)}function t(ga,ka){var oa={x:ga,y:ka};oa.x/=p;oa.y/=p;if(Q){var ya=O(oa.x,oa.y,Q.inverse());oa.x=ya.x;oa.y=ya.y}return oa}function E(ga,ka){var oa={x:ga,y:ka};if(Q){var ya=O(oa.x,oa.y,Q);oa.x=ya.x;oa.y=ya.y}oa.x*=p;oa.y*=p;return oa}function w(ga){h(0,A.textContent.length);$(this).unbind(ga)}function s(ga){if(wa&&A){var ka=O(ga.pageX,ga.pageY,Nb);ka=t(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var oa=A.textContent,ya=oa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;oa=oa.substr(ka).match(/^[a-z0-9]+/i);
|
||||||
F,C,D,G,H=[],P,Q,Z,ua,wa;return{select:function(ga,ka,oa){B=ga;sb.toEditMode(ka,oa)},start:function(ga){B=ga;sb.toEditMode()},mouseDown:function(ga,ka,oa,ya){ga=t(oa,ya);F.focus();g(k(ga.x,ga.y));Z=oa;ua=ya},mouseMove:function(ga,ka){var oa=t(ga,ka);v(oa.x,oa.y)},mouseUp:function(ga,ka,oa){var ya=t(ka,oa);v(ya.x,ya.y,true);ga.target!==B&&ka<Z+2&&ka>Z-2&&oa<ua+2&&oa>ua-2&&sb.toSelectMode(true)},setCursor:g,toEditMode:function(ga,ka){wa=false;Ja="textedit";Pa.requestSelector(B).showGrips(false);Pa.requestSelector(B);
|
h(ya,(oa?oa[0].length:0)+ka);$(ga.target).click(w);setTimeout(function(){$(ga.target).unbind("click",w)},300)}}var A,F,C,D,G,H=[],P,Q,W,ua,wa;return{select:function(ga,ka,oa){A=ga;sb.toEditMode(ka,oa)},start:function(ga){A=ga;sb.toEditMode()},mouseDown:function(ga,ka,oa,ya){ga=t(oa,ya);F.focus();g(k(ga.x,ga.y));W=oa;ua=ya},mouseMove:function(ga,ka){var oa=t(ga,ka);v(oa.x,oa.y)},mouseUp:function(ga,ka,oa){var ya=t(ka,oa);v(ya.x,ya.y,true);ga.target!==A&&ka<W+2&&ka>W-2&&oa<ua+2&&oa>ua-2&&sb.toSelectMode(true)},
|
||||||
sb.init();$(B).css("cursor","text");if(arguments.length){var oa=t(ga,ka);g(k(oa.x,oa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(ga){Ja="select";clearInterval(G);G=null;D&&$(D).attr("display","none");C&&$(C).attr("visibility","hidden");$(B).css("cursor","move");if(ga){bb();$(B).css("cursor","move");I("selected",[B]);Jb([B],true)}B&&!B.textContent.length&&b.deleteSelectedElements();$(F).blur();B=false},setInputElem:function(ga){F=ga},clear:function(){Ja=="textedit"&&sb.toSelectMode()},
|
setCursor:g,toEditMode:function(ga,ka){wa=false;Ja="textedit";Pa.requestSelector(A).showGrips(false);Pa.requestSelector(A);sb.init();$(A).css("cursor","text");if(arguments.length){var oa=t(ga,ka);g(k(oa.x,oa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(ga){Ja="select";clearInterval(G);G=null;D&&$(D).attr("display","none");C&&$(C).attr("visibility","hidden");$(A).css("cursor","move");if(ga){bb();$(A).css("cursor","move");I("selected",[A]);Jb([A],true)}A&&!A.textContent.length&&
|
||||||
init:function(){if(B){if(!B.parentNode){B=K[0];Pa.requestSelector(B).showGrips(false)}var ga=B.textContent.length,ka=B.getAttribute("transform");P=svgedit.utilities.getBBox(B);Q=ka?ea(B):null;H=Array(ga);F.focus();$(B).unbind("dblclick",s).dblclick(s);if(!ga)var oa={x:P.x+P.width/2,width:0};for(ka=0;ka<ga;ka++){var ya=B.getStartPositionOfChar(ka);oa=B.getEndPositionOfChar(ka);if(!svgedit.browser.supportsGoodTextCharPos()){var jb=b.contentW*p;ya.x-=jb;oa.x-=jb;ya.x/=p;oa.x/=p}H[ka]={x:ya.x,y:P.y,width:oa.x-
|
b.deleteSelectedElements();$(F).blur();A=false},setInputElem:function(ga){F=ga},clear:function(){Ja=="textedit"&&sb.toSelectMode()},init:function(){if(A){if(!A.parentNode){A=J[0];Pa.requestSelector(A).showGrips(false)}var ga=A.textContent.length,ka=A.getAttribute("transform");P=svgedit.utilities.getBBox(A);Q=ka?ea(A):null;H=Array(ga);F.focus();$(A).unbind("dblclick",s).dblclick(s);if(!ga)var oa={x:P.x+P.width/2,width:0};for(ka=0;ka<ga;ka++){var ya=A.getStartPositionOfChar(ka);oa=A.getEndPositionOfChar(ka);
|
||||||
ya.x,height:P.height}}H.push({x:oa.x,width:0});h(F.selectionStart,F.selectionEnd,true)}}}}(),Ua=b.pathActions=function(){var g=false,h,k,v;svgedit.path.Path.prototype.endChanges=function(w){if(svgedit.browser.isWebkit()){var s=this.elem;s.setAttribute("d",Ua.convertPath(s))}w=new Ya(this.elem,{d:this.last_d},w);Ia(w);I("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=function(w){$.isArray(w)||(w=[w]);for(var s=0;s<w.length;s++){var B=w[s],F=this.segs[B];F.ptgrip&&this.selected_pts.indexOf(B)==
|
if(!svgedit.browser.supportsGoodTextCharPos()){var jb=b.contentW*p;ya.x-=jb;oa.x-=jb;ya.x/=p;oa.x/=p}H[ka]={x:ya.x,y:P.y,width:oa.x-ya.x,height:P.height}}H.push({x:oa.x,width:0});h(F.selectionStart,F.selectionEnd,true)}}}}(),Ua=b.pathActions=function(){var g=false,h,k,v;svgedit.path.Path.prototype.endChanges=function(w){if(svgedit.browser.isWebkit()){var s=this.elem;s.setAttribute("d",Ua.convertPath(s))}w=new Ya(this.elem,{d:this.last_d},w);Ia(w);I("changed",[this.elem])};svgedit.path.Path.prototype.addPtsToSelection=
|
||||||
-1&&B>=0&&this.selected_pts.push(B)}this.selected_pts.sort();s=this.selected_pts.length;for(w=Array(s);s--;){F=this.segs[this.selected_pts[s]];F.select(true);w[s]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);I("selected",w)};var t=h=null,E=false;return{mouseDown:function(w,s,B,F){if(Ja==="path"){mouse_x=B;mouse_y=F;F=mouse_x/p;s=mouse_y/p;B=la("path_stretch_line");k=[F,s];if(m.gridSnapping){F=Ga(F);s=Ga(s);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!B){B=
|
function(w){$.isArray(w)||(w=[w]);for(var s=0;s<w.length;s++){var A=w[s],F=this.segs[A];F.ptgrip&&this.selected_pts.indexOf(A)==-1&&A>=0&&this.selected_pts.push(A)}this.selected_pts.sort();s=this.selected_pts.length;for(w=Array(s);s--;){F=this.segs[this.selected_pts[s]];F.select(true);w[s]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);I("selected",w)};var t=h=null,E=false;return{mouseDown:function(w,s,A,F){if(Ja==="path"){mouse_x=A;mouse_y=F;F=mouse_x/
|
||||||
document.createElementNS(c,"path");ma(B,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});B=la("selectorParentGroup").appendChild(B)}B.setAttribute("display","inline");var C=null;if(t){C=t.pathSegList;for(var D=C.numberOfItems,G=6/p,H=false;D;){D--;var P=C.getItem(D),Q=P.x;P=P.y;if(F>=Q-G&&F<=Q+G&&s>=P-G&&s<=P+G){H=true;break}}G=ta();svgedit.path.removePath_(G);G=la(G);Q=C.numberOfItems;if(H){if(D<=1&&Q>=2){F=C.getItem(0).x;s=C.getItem(0).y;w=B.pathSegList.getItem(1);w=w.pathSegType===
|
p;s=mouse_y/p;A=la("path_stretch_line");k=[F,s];if(m.gridSnapping){F=Ga(F);s=Ga(s);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!A){A=document.createElementNS(c,"path");ma(A,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});A=la("selectorParentGroup").appendChild(A)}A.setAttribute("display","inline");var C=null;if(t){C=t.pathSegList;for(var D=C.numberOfItems,G=6/p,H=false;D;){D--;var P=C.getItem(D),Q=P.x;P=P.y;if(F>=Q-G&&F<=Q+G&&s>=P-G&&s<=P+G){H=true;break}}G=ta();svgedit.path.removePath_(G);
|
||||||
4?t.createSVGPathSegLinetoAbs(F,s):t.createSVGPathSegCurvetoCubicAbs(F,s,w.x1/p,w.y1/p,F,s);F=t.createSVGPathSegClosePath();C.appendItem(w);C.appendItem(F)}else if(Q<3)return C=false;$(B).remove();element=G;t=null;Ra=false;if(g){svgedit.path.path.matrix&&wb(G,{},svgedit.path.path.matrix.inverse());B=G.getAttribute("d");w=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",w+B);$(G).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);
|
G=la(G);Q=C.numberOfItems;if(H){if(D<=1&&Q>=2){F=C.getItem(0).x;s=C.getItem(0).y;w=A.pathSegList.getItem(1);w=w.pathSegType===4?t.createSVGPathSegLinetoAbs(F,s):t.createSVGPathSegCurvetoCubicAbs(F,s,w.x1/p,w.y1/p,F,s);F=t.createSVGPathSegClosePath();C.appendItem(w);C.appendItem(F)}else if(Q<3)return C=false;$(A).remove();element=G;t=null;Ra=false;if(g){svgedit.path.path.matrix&&wb(G,{},svgedit.path.path.matrix.inverse());A=G.getAttribute("d");w=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",
|
||||||
svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,$b(w))){console.log("Clicked outside canvas");return false}C=t.pathSegList.numberOfItems;D=t.pathSegList.getItem(C-1);G=D.x;D=D.y;if(w.shiftKey){w=ca(G,D,F,s);F=w.x;s=w.y}w=B.pathSegList.getItem(1);w=w.pathSegType===4?t.createSVGPathSegLinetoAbs(Eb(F),Eb(s)):t.createSVGPathSegCurvetoCubicAbs(Eb(F),Eb(s),w.x1/p,w.y1/p,w.x2/p,w.y2/p);t.pathSegList.appendItem(w);F*=p;s*=p;B.setAttribute("d",["M",F,s,F,s].join(" "));B=C;if(g)B+=svgedit.path.path.segs.length;
|
w+A);$(G).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,$b(w))){console.log("Clicked outside canvas");return false}C=t.pathSegList.numberOfItems;D=t.pathSegList.getItem(C-1);G=D.x;D=D.y;if(w.shiftKey){w=ca(G,D,F,s);F=w.x;s=w.y}w=A.pathSegList.getItem(1);w=w.pathSegType===4?t.createSVGPathSegLinetoAbs(Eb(F),Eb(s)):t.createSVGPathSegCurvetoCubicAbs(Eb(F),
|
||||||
svgedit.path.addPointGrip(B,F,s)}}else{d_attr="M"+F+","+s+" ";t=da({element:"path",curStyles:true,attr:{d:d_attr,id:M(),opacity:N.opacity/2}});B.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));B=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(B,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();G=w.target.id;if(G.substr(0,14)=="pathpointgrip_"){s=svgedit.path.path.cur_pt=parseInt(G.substr(14));svgedit.path.path.dragging=[B,F];C=svgedit.path.path.segs[s];
|
Eb(s),w.x1/p,w.y1/p,w.x2/p,w.y2/p);t.pathSegList.appendItem(w);F*=p;s*=p;A.setAttribute("d",["M",F,s,F,s].join(" "));A=C;if(g)A+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(A,F,s)}}else{d_attr="M"+F+","+s+" ";t=da({element:"path",curStyles:true,attr:{d:d_attr,id:M(),opacity:N.opacity/2}});A.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));A=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(A,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();
|
||||||
if(w.shiftKey)C.selected?svgedit.path.path.removePtFromSelection(s):svgedit.path.path.addPtsToSelection(s);else{if(svgedit.path.path.selected_pts.length<=1||!C.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(s)}}else if(G.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[B,F];w=G.split("_")[1].split("c");s=w[0]-0;svgedit.path.path.selectPt(s,w[1]-0)}if(!svgedit.path.path.dragging){if(Da==null)Da=Pa.getRubberBandBox();ma(Da,{x:B*p,y:F*p,width:0,height:0,display:"inline"},
|
G=w.target.id;if(G.substr(0,14)=="pathpointgrip_"){s=svgedit.path.path.cur_pt=parseInt(G.substr(14));svgedit.path.path.dragging=[A,F];C=svgedit.path.path.segs[s];if(w.shiftKey)C.selected?svgedit.path.path.removePtFromSelection(s):svgedit.path.path.addPtsToSelection(s);else{if(svgedit.path.path.selected_pts.length<=1||!C.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(s)}}else if(G.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[A,F];w=G.split("_")[1].split("c");
|
||||||
100)}}},mouseMove:function(w,s,B){E=true;if(Ja==="path"){if(t){var F=t.pathSegList;w=F.numberOfItems-1;if(k){var C=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");C.setAttribute("cx",s);C.setAttribute("cy",B);C.setAttribute("display","inline");C=k[0];var G=k[1];F.getItem(w);var H=C+(C-s/p),P=G+(G-B/p);D.setAttribute("cx",H*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var Q=svgedit.path.getCtrlLine(2);
|
s=w[0]-0;svgedit.path.path.selectPt(s,w[1]-0)}if(!svgedit.path.path.dragging){if(Da==null)Da=Pa.getRubberBandBox();ma(Da,{x:A*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(w,s,A){E=true;if(Ja==="path"){if(t){var F=t.pathSegList;w=F.numberOfItems-1;if(k){var C=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");C.setAttribute("cx",s);C.setAttribute("cy",A);C.setAttribute("display","inline");C=k[0];var G=k[1];F.getItem(w);
|
||||||
ma(D,{x1:s,y1:B,x2:C*p,y2:G*p,display:"inline"});ma(Q,{x1:H*p,y1:P*p,x2:C*p,y2:G*p,display:"inline"});if(w===0)v=[s,B];else{F=F.getItem(w-1);s=F.x;B=F.y;if(F.pathSegType===6){s+=s-F.x2;B+=B-F.y2}else if(v){s=v[0]/p;B=v[1]/p}svgedit.path.replacePathSeg(6,w,[C,G,s,B,H,P],t)}}else if(C=la("path_stretch_line")){w=F.getItem(w);if(w.pathSegType===6)svgedit.path.replacePathSeg(6,1,[s,B,(w.x+(w.x-w.x2))*p,(w.y+(w.y-w.y2))*p,s,B],C);else v?svgedit.path.replacePathSeg(6,1,[s,B,v[0],v[1],s,B],C):svgedit.path.replacePathSeg(4,
|
var H=C+(C-s/p),P=G+(G-A/p);D.setAttribute("cx",H*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var Q=svgedit.path.getCtrlLine(2);ma(D,{x1:s,y1:A,x2:C*p,y2:G*p,display:"inline"});ma(Q,{x1:H*p,y1:P*p,x2:C*p,y2:G*p,display:"inline"});if(w===0)v=[s,A];else{F=F.getItem(w-1);s=F.x;A=F.y;if(F.pathSegType===6){s+=s-F.x2;A+=A-F.y2}else if(v){s=v[0]/p;A=v[1]/p}svgedit.path.replacePathSeg(6,w,[C,G,s,A,H,P],t)}}else if(C=la("path_stretch_line")){w=F.getItem(w);
|
||||||
1,[s,B],C)}}}else if(svgedit.path.path.dragging){C=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);G=svgedit.path.getPointFromGrip({x:s,y:B},svgedit.path.path);w=G.x-C.x;C=G.y-C.y;svgedit.path.path.dragging=[s,B];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(w,C):svgedit.path.path.movePts(w,C)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var Z=Da.getBBox(),ua=svgedit.path.getGripPt(this);
|
if(w.pathSegType===6)svgedit.path.replacePathSeg(6,1,[s,A,(w.x+(w.x-w.x2))*p,(w.y+(w.y-w.y2))*p,s,A],C);else v?svgedit.path.replacePathSeg(6,1,[s,A,v[0],v[1],s,A],C):svgedit.path.replacePathSeg(4,1,[s,A],C)}}}else if(svgedit.path.path.dragging){C=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);G=svgedit.path.getPointFromGrip({x:s,y:A},svgedit.path.path);w=G.x-C.x;C=G.y-C.y;svgedit.path.path.dragging=[s,A];svgedit.path.path.dragctrl?
|
||||||
Z=svgedit.math.rectsIntersect(Z,{x:ua.x,y:ua.y,width:0,height:0});this.select(Z);Z&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(w,s){if(Ja==="path"){k=null;if(!t){s=la(ta());Ra=false;v=null}return{keep:true,element:s}}if(svgedit.path.path.dragging){var B=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();E&&svgedit.path.path.endChanges("Move path point(s)");!w.shiftKey&&!E&&svgedit.path.path.selectPt(B)}else if(Da&&
|
svgedit.path.path.moveCtrl(w,C):svgedit.path.path.movePts(w,C)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var W=Da.getBBox(),ua=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ua.x,y:ua.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(w,s){if(Ja==="path"){k=null;if(!t){s=la(ta());Ra=false;v=null}return{keep:true,element:s}}if(svgedit.path.path.dragging){var A=svgedit.path.path.cur_pt;
|
||||||
Da.getAttribute("display")!="none"){Da.setAttribute("display","none");Da.getAttribute("width")<=2&&Da.getAttribute("height")<=2&&Ua.toSelectMode(w.target)}else Ua.toSelectMode(w.target);E=false},toEditMode:function(w){svgedit.path.path=svgedit.path.getPath_(w);Ja="pathedit";bb();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(w){var s=w==svgedit.path.path.elem;Ja="select";svgedit.path.path.show(false);
|
svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();E&&svgedit.path.path.endChanges("Move path point(s)");!w.shiftKey&&!E&&svgedit.path.path.selectPt(A)}else if(Da&&Da.getAttribute("display")!="none"){Da.setAttribute("display","none");Da.getAttribute("width")<=2&&Da.getAttribute("height")<=2&&Ua.toSelectMode(w.target)}else Ua.toSelectMode(w.target);E=false},toEditMode:function(w){svgedit.path.path=svgedit.path.getPath_(w);Ja="pathedit";bb();svgedit.path.path.show(true).update();
|
||||||
h=false;bb();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(s){I("selected",[w]);Jb([w],true)}},addSubPath:function(w){if(w){Ja="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(w){if(h===w){Ua.toEditMode(w);Ja="pathedit"}else h=w},reorient:function(){var w=K[0];if(w)if(ra(w)!=0){var s=new Na("Reorient path"),B={d:w.getAttribute("d"),transform:w.getAttribute("transform")};s.addSubCommand(new Ya(w,B));bb();this.resetOrientation(w);Ia(s);svgedit.path.getPath_(w).show(false).matrix=
|
svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(w){var s=w==svgedit.path.path.elem;Ja="select";svgedit.path.path.show(false);h=false;bb();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(s){I("selected",[w]);Jb([w],true)}},addSubPath:function(w){if(w){Ja="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(w){if(h===w){Ua.toEditMode(w);Ja="pathedit"}else h=w},reorient:function(){var w=J[0];
|
||||||
null;this.clear();Jb([w],true);I("changed",K)}},clear:function(){h=null;if(t){var w=la(ta());$(la("path_stretch_line")).remove();$(w).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");t=v=null;Ra=false}else Ja=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(w){if(w==null||w.nodeName!="path")return false;var s=V(w),B=ia(s).matrix;s.clear();w.removeAttribute("transform");s=w.pathSegList;for(var F=s.numberOfItems,
|
if(w)if(ra(w)!=0){var s=new Na("Reorient path"),A={d:w.getAttribute("d"),transform:w.getAttribute("transform")};s.addSubCommand(new Ya(w,A));bb();this.resetOrientation(w);Ia(s);svgedit.path.getPath_(w).show(false).matrix=null;this.clear();Jb([w],true);I("changed",J)}},clear:function(){h=null;if(t){var w=la(ta());$(la("path_stretch_line")).remove();$(w).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");t=v=null;Ra=false}else Ja=="pathedit"&&this.toSelectMode();svgedit.path.path&&
|
||||||
C=0;C<F;++C){var D=s.getItem(C),G=D.pathSegType;if(G!=1){var H=[];$.each(["",1,2],function(P,Q){var Z=D["x"+Q],ua=D["y"+Q];if(Z!==undefined&&ua!==undefined){Z=O(Z,ua,B);H.splice(H.length,0,Z.x,Z.y)}});svgedit.path.replacePathSeg(G,C,H,w)}}f(w,B)},zoomChange:function(){Ja=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var w=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:w.item.x,y:w.item.y,type:w.type}},linkControlPoints:function(w){svgedit.path.setLinkControlPoints(w)},
|
svgedit.path.path.init().show(false)},resetOrientation:function(w){if(w==null||w.nodeName!="path")return false;var s=V(w),A=ha(s).matrix;s.clear();w.removeAttribute("transform");s=w.pathSegList;for(var F=s.numberOfItems,C=0;C<F;++C){var D=s.getItem(C),G=D.pathSegType;if(G!=1){var H=[];$.each(["",1,2],function(P,Q){var W=D["x"+Q],ua=D["y"+Q];if(W!==undefined&&ua!==undefined){W=O(W,ua,A);H.splice(H.length,0,W.x,W.y)}});svgedit.path.replacePathSeg(G,C,H,w)}}f(w,A)},zoomChange:function(){Ja=="pathedit"&&
|
||||||
clonePathNode:function(){svgedit.path.path.storeD();for(var w=svgedit.path.path.selected_pts,s=w.length,B=[];s--;){var F=w[s];svgedit.path.path.addSeg(F);B.push(F+s);B.push(F+s+1)}svgedit.path.path.init().addPtsToSelection(B);svgedit.path.path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var w=svgedit.path.path.selected_pts;if(w.length===1){var s=svgedit.path.path.elem,B=s.pathSegList,F=w[0],C=null,D=null;svgedit.path.path.eachSeg(function(Q){if(this.type===2&&Q<=F)D=this.item;if(Q<=
|
svgedit.path.path.update()},getNodePoint:function(){var w=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:w.item.x,y:w.item.y,type:w.type}},linkControlPoints:function(w){svgedit.path.setLinkControlPoints(w)},clonePathNode:function(){svgedit.path.path.storeD();for(var w=svgedit.path.path.selected_pts,s=w.length,A=[];s--;){var F=w[s];svgedit.path.path.addSeg(F);A.push(F+s);A.push(F+s+1)}svgedit.path.path.init().addPtsToSelection(A);svgedit.path.path.endChanges("Clone path node(s)")},
|
||||||
F)return true;if(this.type===2){C=Q;return false}else if(this.type===1)return C=false});if(C==null)C=svgedit.path.path.segs.length-1;if(C!==false){var G=s.createSVGPathSegLinetoAbs(D.x,D.y),H=s.createSVGPathSegClosePath();if(C==svgedit.path.path.segs.length-1){B.appendItem(G);B.appendItem(H)}else{svgedit.path.insertItemBefore(s,H,C);svgedit.path.insertItemBefore(s,G,C)}svgedit.path.path.init().selectPt(C+1)}else if(svgedit.path.path.segs[F].mate){B.removeItem(F);B.removeItem(F);svgedit.path.path.init().selectPt(F-
|
opencloseSubPath:function(){var w=svgedit.path.path.selected_pts;if(w.length===1){var s=svgedit.path.path.elem,A=s.pathSegList,F=w[0],C=null,D=null;svgedit.path.path.eachSeg(function(Q){if(this.type===2&&Q<=F)D=this.item;if(Q<=F)return true;if(this.type===2){C=Q;return false}else if(this.type===1)return C=false});if(C==null)C=svgedit.path.path.segs.length-1;if(C!==false){var G=s.createSVGPathSegLinetoAbs(D.x,D.y),H=s.createSVGPathSegClosePath();if(C==svgedit.path.path.segs.length-1){A.appendItem(G);
|
||||||
1)}else{for(w=0;w<B.numberOfItems;w++){var P=B.getItem(w);if(P.pathSegType===2)G=w;else if(w===F)B.removeItem(G);else if(P.pathSegType===1&&F<w){H=w-1;B.removeItem(w);break}}for(w=F-G-1;w--;)svgedit.path.insertItemBefore(s,B.getItem(G),H);s=B.getItem(G);svgedit.path.replacePathSeg(2,G,[s.x,s.y]);w=F;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ua.canDeleteNodes){svgedit.path.path.storeD();for(var w=svgedit.path.path.selected_pts,s=w.length;s--;)svgedit.path.path.deleteSeg(w[s]);
|
A.appendItem(H)}else{svgedit.path.insertItemBefore(s,H,C);svgedit.path.insertItemBefore(s,G,C)}svgedit.path.path.init().selectPt(C+1)}else if(svgedit.path.path.segs[F].mate){A.removeItem(F);A.removeItem(F);svgedit.path.path.init().selectPt(F-1)}else{for(w=0;w<A.numberOfItems;w++){var P=A.getItem(w);if(P.pathSegType===2)G=w;else if(w===F)A.removeItem(G);else if(P.pathSegType===1&&F<w){H=w-1;A.removeItem(w);break}}for(w=F-G-1;w--;)svgedit.path.insertItemBefore(s,A.getItem(G),H);s=A.getItem(G);svgedit.path.replacePathSeg(2,
|
||||||
var B=function(){var F=svgedit.path.path.elem.pathSegList,C=F.numberOfItems,D=function(P,Q){for(;Q--;)F.removeItem(P)};if(C<=1)return true;for(;C--;){var G=F.getItem(C);if(G.pathSegType===1){G=F.getItem(C-1);var H=F.getItem(C-2);if(G.pathSegType===2){D(C-1,2);B();break}else if(H.pathSegType===2){D(C-2,3);B();break}}else if(G.pathSegType===2)if(C>0){G=F.getItem(C-1).pathSegType;if(G===2){D(C-1,1);B();break}else if(G===1&&F.numberOfItems-1===C){D(C,1);B();break}}}return false};B();if(svgedit.path.path.elem.pathSegList.numberOfItems<=
|
G,[s.x,s.y]);w=F;svgedit.path.path.init().selectPt(0)}}},deletePathNode:function(){if(Ua.canDeleteNodes){svgedit.path.path.storeD();for(var w=svgedit.path.path.selected_pts,s=w.length;s--;)svgedit.path.path.deleteSeg(w[s]);var A=function(){var F=svgedit.path.path.elem.pathSegList,C=F.numberOfItems,D=function(P,Q){for(;Q--;)F.removeItem(P)};if(C<=1)return true;for(;C--;){var G=F.getItem(C);if(G.pathSegType===1){G=F.getItem(C-1);var H=F.getItem(C-2);if(G.pathSegType===2){D(C-1,2);A();break}else if(H.pathSegType===
|
||||||
1){Ua.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){w=$(svgedit.path.path.elem);w.attr("d",w.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(w){var s=w.points,B=s.numberOfItems;if(B>=4){var F=s.getItem(0),C=null;w=[];w.push(["M",F.x,",",F.y," C"].join(""));for(var D=1;D<=B-4;D+=3){var G=s.getItem(D),H=s.getItem(D+1),P=s.getItem(D+2);if(C)if((F=svgedit.path.smoothControlPoints(C,
|
2){D(C-2,3);A();break}}else if(G.pathSegType===2)if(C>0){G=F.getItem(C-1).pathSegType;if(G===2){D(C-1,1);A();break}else if(G===1&&F.numberOfItems-1===C){D(C,1);A();break}}}return false};A();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){w=$(svgedit.path.path.elem);w.attr("d",w.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},
|
||||||
G,F))&&F.length==2){G=w[w.length-1].split(",");G[2]=F[0].x;G[3]=F[0].y;w[w.length-1]=G.join(",");G=F[1]}w.push([G.x,G.y,H.x,H.y,P.x,P.y].join(","));F=P;C=H}for(w.push("L");D<B;++D){H=s.getItem(D);w.push([H.x,H.y].join(","))}w=w.join(" ");w=da({element:"path",curStyles:true,attr:{id:ta(),d:w,fill:"none"}})}return w},setSegType:function(w){svgedit.path.path.setSegType(w)},moveNode:function(w,s){var B=svgedit.path.path.selected_pts;if(B.length){svgedit.path.path.storeD();B=svgedit.path.path.segs[B[0]];
|
smoothPolylineIntoPath:function(w){var s=w.points,A=s.numberOfItems;if(A>=4){var F=s.getItem(0),C=null;w=[];w.push(["M",F.x,",",F.y," C"].join(""));for(var D=1;D<=A-4;D+=3){var G=s.getItem(D),H=s.getItem(D+1),P=s.getItem(D+2);if(C)if((F=svgedit.path.smoothControlPoints(C,G,F))&&F.length==2){G=w[w.length-1].split(",");G[2]=F[0].x;G[3]=F[0].y;w[w.length-1]=G.join(",");G=F[1]}w.push([G.x,G.y,H.x,H.y,P.x,P.y].join(","));F=P;C=H}for(w.push("L");D<A;++D){H=s.getItem(D);w.push([H.x,H.y].join(","))}w=w.join(" ");
|
||||||
var F={x:0,y:0};F[w]=s-B.item[w];B.move(F.x,F.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(w){for(var s=w.pathSegList,B=s.numberOfItems,F,C=0;C<B;++C){var D=s.getItem(C);if(D.pathSegType===2)F=D;if(D.pathSegType===1){D=s.getItem(C-1);if(D.x!=F.x||D.y!=F.y){s=w.createSVGPathSegLinetoAbs(F.x,F.y);svgedit.path.insertItemBefore(w,s,C);Ua.fixEnd(w);break}}}svgedit.browser.isWebkit()&&w.setAttribute("d",Ua.convertPath(w))},convertPath:function(w,s){for(var B=w.pathSegList,F=B.numberOfItems,
|
w=da({element:"path",curStyles:true,attr:{id:ta(),d:w,fill:"none"}})}return w},setSegType:function(w){svgedit.path.path.setSegType(w)},moveNode:function(w,s){var A=svgedit.path.path.selected_pts;if(A.length){svgedit.path.path.storeD();A=svgedit.path.path.segs[A[0]];var F={x:0,y:0};F[w]=s-A.item[w];A.move(F.x,F.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(w){for(var s=w.pathSegList,A=s.numberOfItems,F,C=0;C<A;++C){var D=s.getItem(C);if(D.pathSegType===2)F=D;if(D.pathSegType===
|
||||||
C=0,D=0,G="",H=null,P=0;P<F;++P){var Q=B.getItem(P),Z=Q.x||0,ua=Q.y||0,wa=Q.x1||0,ga=Q.y1||0,ka=Q.x2||0,oa=Q.y2||0,ya=Q.pathSegType,jb=fb[ya]["to"+(s?"Lower":"Upper")+"Case"](),ub=function(Mb,gb,Lb){gb=gb?" "+gb.join(" "):"";Lb=Lb?" "+svgedit.units.shortFloat(Lb):"";$.each(Mb,function(hc,ic){Mb[hc]=svgedit.units.shortFloat(ic)});G+=jb+Mb.join(" ")+gb+Lb};switch(ya){case 1:G+="z";break;case 12:Z-=C;case 13:if(s){C+=Z;jb="l"}else{Z+=C;C=Z;jb="L"}ub([[Z,D]]);break;case 14:ua-=D;case 15:if(s){D+=ua;jb=
|
1){D=s.getItem(C-1);if(D.x!=F.x||D.y!=F.y){s=w.createSVGPathSegLinetoAbs(F.x,F.y);svgedit.path.insertItemBefore(w,s,C);Ua.fixEnd(w);break}}}svgedit.browser.isWebkit()&&w.setAttribute("d",Ua.convertPath(w))},convertPath:function(w,s){for(var A=w.pathSegList,F=A.numberOfItems,C=0,D=0,G="",H=null,P=0;P<F;++P){var Q=A.getItem(P),W=Q.x||0,ua=Q.y||0,wa=Q.x1||0,ga=Q.y1||0,ka=Q.x2||0,oa=Q.y2||0,ya=Q.pathSegType,jb=fb[ya]["to"+(s?"Lower":"Upper")+"Case"](),ub=function(Mb,gb,Lb){gb=gb?" "+gb.join(" "):"";Lb=
|
||||||
"l"}else{ua+=D;D=ua;jb="L"}ub([[C,ua]]);break;case 2:case 4:case 18:Z-=C;ua-=D;case 5:case 3:if(H&&B.getItem(P-1).pathSegType===1&&!s){C=H[0];D=H[1]}case 19:if(s){C+=Z;D+=ua}else{Z+=C;ua+=D;C=Z;D=ua}if(ya===3)H=[C,D];ub([[Z,ua]]);break;case 6:Z-=C;wa-=C;ka-=C;ua-=D;ga-=D;oa-=D;case 7:if(s){C+=Z;D+=ua}else{Z+=C;wa+=C;ka+=C;ua+=D;ga+=D;oa+=D;C=Z;D=ua}ub([[wa,ga],[ka,oa],[Z,ua]]);break;case 8:Z-=C;wa-=C;ua-=D;ga-=D;case 9:if(s){C+=Z;D+=ua}else{Z+=C;wa+=C;ua+=D;ga+=D;C=Z;D=ua}ub([[wa,ga],[Z,ua]]);break;
|
Lb?" "+svgedit.units.shortFloat(Lb):"";$.each(Mb,function(hc,ic){Mb[hc]=svgedit.units.shortFloat(ic)});G+=jb+Mb.join(" ")+gb+Lb};switch(ya){case 1:G+="z";break;case 12:W-=C;case 13:if(s){C+=W;jb="l"}else{W+=C;C=W;jb="L"}ub([[W,D]]);break;case 14:ua-=D;case 15:if(s){D+=ua;jb="l"}else{ua+=D;D=ua;jb="L"}ub([[C,ua]]);break;case 2:case 4:case 18:W-=C;ua-=D;case 5:case 3:if(H&&A.getItem(P-1).pathSegType===1&&!s){C=H[0];D=H[1]}case 19:if(s){C+=W;D+=ua}else{W+=C;ua+=D;C=W;D=ua}if(ya===3)H=[C,D];ub([[W,ua]]);
|
||||||
case 10:Z-=C;ua-=D;case 11:if(s){C+=Z;D+=ua}else{Z+=C;ua+=D;C=Z;D=ua}ub([[Q.r1,Q.r2]],[Q.angle,Q.largeArcFlag?1:0,Q.sweepFlag?1:0],[Z,ua]);break;case 16:Z-=C;ka-=C;ua-=D;oa-=D;case 17:if(s){C+=Z;D+=ua}else{Z+=C;ka+=C;ua+=D;oa+=D;C=Z;D=ua}ub([[ka,oa],[Z,ua]])}}return G}}}(),jc=this.removeUnusedDefElems=function(){var g=l.getElementsByTagNameNS(c,"defs");if(!g||!g.length)return 0;for(var h=[],k=0,v=["fill","stroke","filter","marker-start","marker-mid","marker-end"],t=v.length,E=l.getElementsByTagNameNS(c,
|
break;case 6:W-=C;wa-=C;ka-=C;ua-=D;ga-=D;oa-=D;case 7:if(s){C+=W;D+=ua}else{W+=C;wa+=C;ka+=C;ua+=D;ga+=D;oa+=D;C=W;D=ua}ub([[wa,ga],[ka,oa],[W,ua]]);break;case 8:W-=C;wa-=C;ua-=D;ga-=D;case 9:if(s){C+=W;D+=ua}else{W+=C;wa+=C;ua+=D;ga+=D;C=W;D=ua}ub([[wa,ga],[W,ua]]);break;case 10:W-=C;ua-=D;case 11:if(s){C+=W;D+=ua}else{W+=C;ua+=D;C=W;D=ua}ub([[Q.r1,Q.r2]],[Q.angle,Q.largeArcFlag?1:0,Q.sweepFlag?1:0],[W,ua]);break;case 16:W-=C;ka-=C;ua-=D;oa-=D;case 17:if(s){C+=W;D+=ua}else{W+=C;ka+=C;ua+=D;oa+=
|
||||||
"*"),w=E.length,s=0;s<w;s++){for(var B=E[s],F=0;F<t;F++){var C=pa(B.getAttribute(v[F]));C&&h.push(C.substr(1))}(B=ba(B))&&B.indexOf("#")===0&&h.push(B.substr(1))}g=$(g).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(s=g.length;s--;){v=g[s];t=v.id;if(h.indexOf(t)<0){Db[t]=v;v.parentNode.removeChild(v);k++}}return k};this.svgCanvasToString=function(){for(;jc()>0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=
|
D;C=W;D=ua}ub([[ka,oa],[W,ua]])}}return G}}}(),jc=this.removeUnusedDefElems=function(){var g=l.getElementsByTagNameNS(c,"defs");if(!g||!g.length)return 0;for(var h=[],k=0,v=["fill","stroke","filter","marker-start","marker-mid","marker-end"],t=v.length,E=l.getElementsByTagNameNS(c,"*"),w=E.length,s=0;s<w;s++){for(var A=E[s],F=0;F<t;F++){var C=pa(A.getAttribute(v[F]));C&&h.push(C.substr(1))}(A=ba(A))&&A.indexOf("#")===0&&h.push(A.substr(1))}g=$(g).find("linearGradient, radialGradient, filter, marker, svg, symbol");
|
||||||
0&&l.insertBefore(v,l.firstChild)});if(L){ac();vb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,t=0;t<v;t++)if(k[t].nodeName=="id"||k[t].nodeName=="style")v--;if(v<=0){k=this.firstChild;g.push(k);$(this).replaceWith(k)}});var h=this.svgToString(l,0);g.length&&$(g).each(function(){na(this)});return h};this.svgToString=function(g,h){var k=[],v=svgedit.utilities.toXml,t=m.baseUnit,E=RegExp("^-?[\\d\\.]+"+t+"$");if(g){Y(g);var w=g.attributes,s,B,F=g.childNodes;
|
defelem_ids=[];for(s=g.length;s--;){v=g[s];t=v.id;if(h.indexOf(t)<0){Db[t]=v;v.parentNode.removeChild(v);k++}}return k};this.svgCanvasToString=function(){for(;jc()>0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&&l.insertBefore(v,l.firstChild)});if(L){ac();vb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,t=0;t<v;t++)if(k[t].nodeName=="id"||k[t].nodeName=="style")v--;if(v<=0){k=this.firstChild;
|
||||||
for(B=0;B<h;B++)k.push(" ");k.push("<");k.push(g.nodeName);if(g.id==="svgcontent"){B=Tb();if(t!=="px"){B.w=svgedit.units.convertUnit(B.w,t)+t;B.h=svgedit.units.convertUnit(B.h,t)+t}k.push(' width="'+B.w+'" height="'+B.h+'" xmlns="'+c+'"');var C={};$(g).find("*").andSelf().each(function(){$.each(this.attributes,function(P,Q){var Z=Q.namespaceURI;if(Z&&!C[Z]&&za[Z]!=="xmlns"&&za[Z]!=="xml"){C[Z]=true;k.push(" xmlns:"+za[Z]+'="'+Z+'"')}})});B=w.length;for(t=["width","height","xmlns","x","y","viewBox",
|
g.push(k);$(this).replaceWith(k)}});var h=this.svgToString(l,0);g.length&&$(g).each(function(){na(this)});return h};this.svgToString=function(g,h){var k=[],v=svgedit.utilities.toXml,t=m.baseUnit,E=RegExp("^-?[\\d\\.]+"+t+"$");if(g){Z(g);var w=g.attributes,s,A,F=g.childNodes;for(A=0;A<h;A++)k.push(" ");k.push("<");k.push(g.nodeName);if(g.id==="svgcontent"){A=Tb();if(t!=="px"){A.w=svgedit.units.convertUnit(A.w,t)+t;A.h=svgedit.units.convertUnit(A.h,t)+t}k.push(' width="'+A.w+'" height="'+A.h+'" xmlns="'+
|
||||||
"id","overflow"];B--;){s=w.item(B);var D=v(s.nodeValue);if(s.nodeName.indexOf("xmlns:")!==0)if(D!=""&&t.indexOf(s.localName)==-1)if(!s.namespaceURI||za[s.namespaceURI]){k.push(" ");k.push(s.nodeName);k.push('="');k.push(D);k.push('"')}}}else{if(g.nodeName==="defs"&&!g.firstChild)return;var G=["-moz-math-font-style","_moz-math-font-style"];for(B=w.length-1;B>=0;B--){s=w.item(B);D=v(s.nodeValue);if(!(G.indexOf(s.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(s.localName==="class"&&
|
c+'"');var C={};$(g).find("*").andSelf().each(function(){$.each(this.attributes,function(P,Q){var W=Q.namespaceURI;if(W&&!C[W]&&za[W]!=="xmlns"&&za[W]!=="xml"){C[W]=true;k.push(" xmlns:"+za[W]+'="'+W+'"')}})});A=w.length;for(t=["width","height","xmlns","x","y","viewBox","id","overflow"];A--;){s=w.item(A);var D=v(s.nodeValue);if(s.nodeName.indexOf("xmlns:")!==0)if(D!=""&&t.indexOf(s.localName)==-1)if(!s.namespaceURI||za[s.namespaceURI]){k.push(" ");k.push(s.nodeName);k.push('="');k.push(D);k.push('"')}}}else{if(g.nodeName===
|
||||||
D.indexOf("se_")===0)){k.push(" ");if(s.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+t}else D=svgedit.units.shortFloat(D);if(Za.apply&&g.nodeName==="image"&&s.localName==="href"&&Za.images&&Za.images==="embed"){var H=Xa[D];if(H)D=H}if(!s.namespaceURI||s.namespaceURI==c||za[s.namespaceURI]){k.push(s.nodeName);k.push('="');k.push(D);k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;w=false;for(B=0;B<F.length;B++){t=F.item(B);switch(t.nodeType){case 1:k.push("\n");
|
"defs"&&!g.firstChild)return;var G=["-moz-math-font-style","_moz-math-font-style"];for(A=w.length-1;A>=0;A--){s=w.item(A);D=v(s.nodeValue);if(!(G.indexOf(s.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(s.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(s.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+t}else D=svgedit.units.shortFloat(D);if(Za.apply&&g.nodeName==="image"&&s.localName==="href"&&Za.images&&Za.images==="embed"){var H=
|
||||||
k.push(this.svgToString(F.item(B),h));break;case 3:t=t.nodeValue.replace(/^\s+|\s+$/g,"");if(t!=""){w=true;k.push(v(t)+"")}break;case 4:k.push("\n");k.push(Array(h+1).join(" "));k.push("<![CDATA[");k.push(t.nodeValue);k.push("]]\>");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push("<!--");k.push(t.data);k.push("--\>")}}h--;if(!w){k.push("\n");for(B=0;B<h;B++)k.push(" ")}k.push("</");k.push(g.nodeName);k.push(">")}else k.push("/>")}return k.join("")};this.embedImage=function(g,h){$(new Image).load(function(){var k=
|
Xa[D];if(H)D=H}if(!s.namespaceURI||s.namespaceURI==c||za[s.namespaceURI]){k.push(s.nodeName);k.push('="');k.push(D);k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;w=false;for(A=0;A<F.length;A++){t=F.item(A);switch(t.nodeType){case 1:k.push("\n");k.push(this.svgToString(F.item(A),h));break;case 3:t=t.nodeValue.replace(/^\s+|\s+$/g,"");if(t!=""){w=true;k.push(v(t)+"")}break;case 4:k.push("\n");k.push(Array(h+1).join(" "));k.push("<![CDATA[");k.push(t.nodeValue);k.push("]]\>");break;case 8:k.push("\n");
|
||||||
document.createElement("canvas");k.width=this.width;k.height=this.height;k.getContext("2d").drawImage(this,0,0);try{var v=";svgedit_url="+encodeURIComponent(g);v=k.toDataURL().replace(";base64",v+";base64");Xa[g]=v}catch(t){Xa[g]=false}La=g;h&&h(Xa[g])}).attr("src",g)};this.setGoodImage=function(g){La=g};this.open=function(){};this.save=function(g){bb();g&&$.extend(Za,g);Za.apply=true;g=this.svgCanvasToString();I("saved",g)};this.rasterExport=function(){bb();var g=[],h={feGaussianBlur:Gb.exportNoBlur,
|
k.push(Array(h+1).join(" "));k.push("<!--");k.push(t.data);k.push("--\>")}}h--;if(!w){k.push("\n");for(A=0;A<h;A++)k.push(" ")}k.push("</");k.push(g.nodeName);k.push(">")}else k.push("/>")}return k.join("")};this.embedImage=function(g,h){$(new Image).load(function(){var k=document.createElement("canvas");k.width=this.width;k.height=this.height;k.getContext("2d").drawImage(this,0,0);try{var v=";svgedit_url="+encodeURIComponent(g);v=k.toDataURL().replace(";base64",v+";base64");Xa[g]=v}catch(t){Xa[g]=
|
||||||
foreignObject:Gb.exportNoforeignObject,"[stroke-dasharray]":Gb.exportNoDashArray},k=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))h.text=Gb.exportNoText;$.each(h,function(v,t){k.find(v).length&&g.push(t)});h=this.svgCanvasToString();I("exported",{svg:h,issues:g})};this.getSvgString=function(){Za.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,z()):svgedit.draw.randomizeIds(true,z())};var bc=this.uniquifyElems=
|
false}La=g;h&&h(Xa[g])}).attr("src",g)};this.setGoodImage=function(g){La=g};this.open=function(){};this.save=function(g){bb();g&&$.extend(Za,g);Za.apply=true;g=this.svgCanvasToString();I("saved",g)};this.rasterExport=function(){bb();var g=[],h={feGaussianBlur:Gb.exportNoBlur,foreignObject:Gb.exportNoforeignObject,"[stroke-dasharray]":Gb.exportNoDashArray},k=$(l);if(!("font"in $("<canvas>")[0].getContext("2d")))h.text=Gb.exportNoText;$.each(h,function(v,t){k.find(v).length&&g.push(t)});h=this.svgCanvasToString();
|
||||||
function(g){var h={},k=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(g,function(s){if(s.nodeType==1){if(s.id){s.id in h||(h[s.id]={elem:null,attrs:[],hrefs:[]});h[s.id].elem=s}$.each(Pb,function(F,C){var D=s.getAttributeNode(C);if(D){var G=svgedit.utilities.getUrlFromAttr(D.value);if(G=G?G.substr(1):null){G in h||(h[G]={elem:null,attrs:[],hrefs:[]});h[G].attrs.push(D)}}});var B=svgedit.utilities.getHref(s);if(B&&k.indexOf(s.nodeName)>=
|
I("exported",{svg:h,issues:g})};this.getSvgString=function(){Za.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,z()):svgedit.draw.randomizeIds(true,z())};var bc=this.uniquifyElems=function(g){var h={},k=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(g,function(s){if(s.nodeType==1){if(s.id){s.id in h||(h[s.id]={elem:null,attrs:[],hrefs:[]});
|
||||||
0)if(B=B.substr(1)){B in h||(h[B]={elem:null,attrs:[],hrefs:[]});h[B].hrefs.push(s)}}});for(var v in h)if(v){var t=h[v].elem;if(t){g=M();t.id=g;t=h[v].attrs;for(var E=t.length;E--;){var w=t[E];w.ownerElement.setAttribute(w.name,"url(#"+g+")")}t=h[v].hrefs;for(E=t.length;E--;)svgedit.utilities.setHref(t[E],"#"+g)}}},Yb=this.setUseData=function(g){var h=$(g);if(g.tagName!=="use")h=h.find("use");h.each(function(){var k=ba(this).substr(1);if(k=la(k)){$(this).data("ref",k);if(k.tagName=="symbol"||k.tagName==
|
h[s.id].elem=s}$.each(Pb,function(F,C){var D=s.getAttributeNode(C);if(D){var G=svgedit.utilities.getUrlFromAttr(D.value);if(G=G?G.substr(1):null){G in h||(h[G]={elem:null,attrs:[],hrefs:[]});h[G].attrs.push(D)}}});var A=svgedit.utilities.getHref(s);if(A&&k.indexOf(s.nodeName)>=0)if(A=A.substr(1)){A in h||(h[A]={elem:null,attrs:[],hrefs:[]});h[A].hrefs.push(s)}}});for(var v in h)if(v){var t=h[v].elem;if(t){g=M();t.id=g;t=h[v].attrs;for(var E=t.length;E--;){var w=t[E];w.ownerElement.setAttribute(w.name,
|
||||||
"svg")$(this).data("symbol",k).data("ref",k)}})},Ub=this.convertGradients=function(g){var h=$(g).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(g).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var k=$(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(k.length)if(k=svgedit.utilities.getBBox(k[0]))if(this.tagName==="linearGradient"){var v=$(this).attr(["x1",
|
"url(#"+g+")")}t=h[v].hrefs;for(E=t.length;E--;)svgedit.utilities.setHref(t[E],"#"+g)}}},Yb=this.setUseData=function(g){var h=$(g);if(g.tagName!=="use")h=h.find("use");h.each(function(){var k=ba(this).substr(1);if(k=la(k)){$(this).data("ref",k);if(k.tagName=="symbol"||k.tagName=="svg")$(this).data("symbol",k).data("ref",k)}})},Ub=this.convertGradients=function(g){var h=$(g).find("linearGradient, radialGradient");if(!h.length&&svgedit.browser.isWebkit())h=$(g).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=
|
||||||
"y1","x2","y2"]),t=this.gradientTransform.baseVal;if(t&&t.numberOfItems>0){var E=ia(t).matrix;t=O(v.x1,v.y1,E);E=O(v.x2,v.y2,E);v.x1=t.x;v.y1=t.y;v.x2=E.x;v.y2=E.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(v.x1-k.x)/k.width,y1:(v.y1-k.y)/k.height,x2:(v.x2-k.x)/k.width,y2:(v.y2-k.y)/k.height});this.removeAttribute("gradientUnits")}}})},kc=this.convertToGroup=function(g){g||(g=K[0]);var h=$(g),k=new Na,v;if(h.data("gsvg")){k=$(g.firstChild).attr(["x","y"]);$(g.firstChild.firstChild).unwrap();
|
0});h.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var k=$(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(k.length)if(k=svgedit.utilities.getBBox(k[0]))if(this.tagName==="linearGradient"){var v=$(this).attr(["x1","y1","x2","y2"]),t=this.gradientTransform.baseVal;if(t&&t.numberOfItems>0){var E=ha(t).matrix;t=O(v.x1,v.y1,E);E=O(v.x2,v.y2,E);v.x1=t.x;v.y1=t.y;v.x2=E.x;v.y2=E.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(v.x1-k.x)/k.width,
|
||||||
$(g).removeData("gsvg");v=V(g);var t=e.createSVGTransform();t.setTranslate(k.x,k.y);v.appendItem(t);rb(g);I("selected",[g])}else if(h.data("symbol")){g=h.data("symbol");v=h.attr("transform");t=h.attr(["x","y"]);var E=g.getAttribute("viewBox");if(E){E=E.split(" ");t.x-=+E[0];t.y-=+E[1]}v+=" translate("+(t.x||0)+","+(t.y||0)+")";t=h.prev();k.addSubCommand(new Sa(h[0],h[0].nextSibling,h[0].parentNode));h.remove();E=$(l).find("use:data(symbol)").length;h=d.createElementNS(c,"g");for(var w=g.childNodes,
|
y1:(v.y1-k.y)/k.height,x2:(v.x2-k.x)/k.width,y2:(v.y2-k.y)/k.height});this.removeAttribute("gradientUnits")}}})},kc=this.convertToGroup=function(g){g||(g=J[0]);var h=$(g),k=new Na,v;if(h.data("gsvg")){k=$(g.firstChild).attr(["x","y"]);$(g.firstChild.firstChild).unwrap();$(g).removeData("gsvg");v=V(g);var t=e.createSVGTransform();t.setTranslate(k.x,k.y);v.appendItem(t);rb(g);I("selected",[g])}else if(h.data("symbol")){g=h.data("symbol");v=h.attr("transform");t=h.attr(["x","y"]);var E=g.getAttribute("viewBox");
|
||||||
s=0;s<w.length;s++)h.appendChild(w[s].cloneNode(true));if(svgedit.browser.isGecko()){w=$(Ab()).children("linearGradient,radialGradient,pattern").clone();$(h).append(w)}v&&h.setAttribute("transform",v);v=g.parentNode;bc(h);svgedit.browser.isGecko()&&$(Ab()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=M();t.after(h);if(v){if(!E){t=g.nextSibling;v.removeChild(g);k.addSubCommand(new Sa(g,t,v))}k.addSubCommand(new Ma(h))}Yb(h);svgedit.browser.isGecko()?Ub(Ab()):Ub(h);svgedit.utilities.walkTreePost(h,
|
if(E){E=E.split(" ");t.x-=+E[0];t.y-=+E[1]}v+=" translate("+(t.x||0)+","+(t.y||0)+")";t=h.prev();k.addSubCommand(new Sa(h[0],h[0].nextSibling,h[0].parentNode));h.remove();E=$(l).find("use:data(symbol)").length;h=d.createElementNS(c,"g");for(var w=g.childNodes,s=0;s<w.length;s++)h.appendChild(w[s].cloneNode(true));if(svgedit.browser.isGecko()){w=$(Ab()).children("linearGradient,radialGradient,pattern").clone();$(h).append(w)}v&&h.setAttribute("transform",v);v=g.parentNode;bc(h);svgedit.browser.isGecko()&&
|
||||||
function(B){try{rb(B)}catch(F){console.log(F)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=M()});vb([h]);(g=ec(h,true))&&k.addSubCommand(g);Ia(k)}else console.log("Unexpected element to ungroup:",g)};this.setSvgString=function(g){try{var h=svgedit.utilities.text2xml(g);this.prepareSvg(h);var k=new Na("Change Source"),v=l.nextSibling,t=e.removeChild(l);k.addSubCommand(new Sa(t,v,e));l=d.adoptNode?d.adoptNode(h.documentElement):
|
$(Ab()).append($(h).find("linearGradient,radialGradient,pattern"));h.id=M();t.after(h);if(v){if(!E){t=g.nextSibling;v.removeChild(g);k.addSubCommand(new Sa(g,t,v))}k.addSubCommand(new Ma(h))}Yb(h);svgedit.browser.isGecko()?Ub(Ab()):Ub(h);svgedit.utilities.walkTreePost(h,function(A){try{rb(A)}catch(F){console.log(F)}});$(h).find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=M()});vb([h]);(g=ec(h,true))&&k.addSubCommand(g);
|
||||||
d.importNode(h.documentElement,true);e.appendChild(l);var E=$(l);b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=z().getNonce();w?I("setnonce",w):I("unsetnonce");E.find("image").each(function(){var H=this;Zb(H);var P=ba(this);if(P.indexOf("data:")===0){var Q=P.match(/svgedit_url=(.*?);/);if(Q){var Z=decodeURIComponent(Q[1]);$(new Image).load(function(){H.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",Z)}).attr("src",Z)}}b.embedImage(P)});E.find("svg").each(function(){if(!$(this).closest("defs").length){bc(this);
|
Ia(k)}else console.log("Unexpected element to ungroup:",g)};this.setSvgString=function(g){try{var h=svgedit.utilities.text2xml(g);this.prepareSvg(h);var k=new Na("Change Source"),v=l.nextSibling,t=e.removeChild(l);k.addSubCommand(new Sa(t,v,e));l=d.adoptNode?d.adoptNode(h.documentElement):d.importNode(h.documentElement,true);e.appendChild(l);var E=$(l);b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=z().getNonce();w?I("setnonce",w):I("unsetnonce");E.find("image").each(function(){var H=this;
|
||||||
var H=this.parentNode;if(H.childNodes.length===1&&H.nodeName==="g"){$(H).data("gsvg",this);H.id=H.id||M()}else na(this)}});svgedit.browser.isGecko()&&E.find("linearGradient, radialGradient, pattern").appendTo(Ab());Yb(E);Ub(E[0]);svgedit.utilities.walkTreePost(l,function(H){try{rb(H)}catch(P){console.log(P)}});var s={id:"svgcontent",overflow:m.show_outside_canvas?"visible":"hidden"},B=false;if(E.attr("viewBox")){var F=E.attr("viewBox").split(" ");s.width=F[2];s.height=F[3]}else $.each(["width","height"],
|
Zb(H);var P=ba(this);if(P.indexOf("data:")===0){var Q=P.match(/svgedit_url=(.*?);/);if(Q){var W=decodeURIComponent(Q[1]);$(new Image).load(function(){H.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",W)}).attr("src",W)}}b.embedImage(P)});E.find("svg").each(function(){if(!$(this).closest("defs").length){bc(this);var H=this.parentNode;if(H.childNodes.length===1&&H.nodeName==="g"){$(H).data("gsvg",this);H.id=H.id||M()}else na(this)}});svgedit.browser.isGecko()&&E.find("linearGradient, radialGradient, pattern").appendTo(Ab());
|
||||||
function(H,P){var Q=E.attr(P);Q||(Q="100%");if((Q+"").substr(-1)==="%")B=true;else s[P]=qa(P,Q)});Vb();E.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=M()});if(B){var C=getStrokedBBox();s.width=C.width+C.x;s.height=C.height+C.y}if(s.width<=0)s.width=100;if(s.height<=0)s.height=100;E.attr(s);this.contentW=s.width;this.contentH=s.height;k.addSubCommand(new Ma(l));var D=E.attr(["width","height"]);k.addSubCommand(new Ya(e,
|
Yb(E);Ub(E[0]);svgedit.utilities.walkTreePost(l,function(H){try{rb(H)}catch(P){console.log(P)}});var s={id:"svgcontent",overflow:m.show_outside_canvas?"visible":"hidden"},A=false;if(E.attr("viewBox")){var F=E.attr("viewBox").split(" ");s.width=F[2];s.height=F[3]}else $.each(["width","height"],function(H,P){var Q=E.attr(P);Q||(Q="100%");if((Q+"").substr(-1)==="%")A=true;else s[P]=qa(P,Q)});Vb();E.children().find("a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use").each(function(){if(!this.id)this.id=
|
||||||
D));p=1;svgedit.transformlist.resetListMap();bb();svgedit.path.clearData();e.appendChild(Pa.selectorParentGroup);Ia(k);I("changed",[l])}catch(G){console.log(G);return false}return true};this.importSvgString=function(g){try{var h=svgedit.utilities.encode64(g.length+g).substr(0,32),k=false;if(Cb[h])if($(Cb[h].symbol).parents("#svgroot").length)k=true;var v=new Na("Import SVG");if(k)var t=Cb[h].symbol,E=Cb[h].xform;else{var w=svgedit.utilities.text2xml(g);this.prepareSvg(w);var s;s=d.adoptNode?d.adoptNode(w.documentElement):
|
M()});if(A){var C=getStrokedBBox();s.width=C.width+C.x;s.height=C.height+C.y}if(s.width<=0)s.width=100;if(s.height<=0)s.height=100;E.attr(s);this.contentW=s.width;this.contentH=s.height;k.addSubCommand(new Ma(l));var D=E.attr(["width","height"]);k.addSubCommand(new Ya(e,D));p=1;svgedit.transformlist.resetListMap();bb();svgedit.path.clearData();e.appendChild(Pa.selectorParentGroup);Ia(k);I("changed",[l])}catch(G){console.log(G);return false}return true};this.importSvgString=function(g){try{var h=svgedit.utilities.encode64(g.length+
|
||||||
d.importNode(w.documentElement,true);bc(s);var B=qa("width",s.getAttribute("width")),F=qa("height",s.getAttribute("height")),C=s.getAttribute("viewBox"),D=C?C.split(" "):[0,0,B,F];for(g=0;g<4;++g)D[g]=+D[g];l.getAttribute("width");var G=+l.getAttribute("height");E=F>B?"scale("+G/3/D[3]+")":"scale("+G/3/D[2]+")";E="translate(0) "+E+" translate(0)";t=d.createElementNS(c,"symbol");var H=Ab();for(svgedit.browser.isGecko()&&$(s).find("linearGradient, radialGradient, pattern").appendTo(H);s.firstChild;)t.appendChild(s.firstChild);
|
g).substr(0,32),k=false;if(Cb[h])if($(Cb[h].symbol).parents("#svgroot").length)k=true;var v=new Na("Import SVG");if(k)var t=Cb[h].symbol,E=Cb[h].xform;else{var w=svgedit.utilities.text2xml(g);this.prepareSvg(w);var s;s=d.adoptNode?d.adoptNode(w.documentElement):d.importNode(w.documentElement,true);bc(s);var A=qa("width",s.getAttribute("width")),F=qa("height",s.getAttribute("height")),C=s.getAttribute("viewBox"),D=C?C.split(" "):[0,0,A,F];for(g=0;g<4;++g)D[g]=+D[g];l.getAttribute("width");var G=+l.getAttribute("height");
|
||||||
var P=s.attributes;for(s=0;s<P.length;s++){var Q=P[s];t.setAttribute(Q.nodeName,Q.nodeValue)}t.id=M();Cb[h]={symbol:t,xform:E};Ab().appendChild(t);v.addSubCommand(new Ma(t))}var Z=d.createElementNS(c,"use");Z.id=M();S(Z,"#"+t.id);(L||z().getCurrentLayer()).appendChild(Z);v.addSubCommand(new Ma(Z));bb();Z.setAttribute("transform",E);rb(Z);$(Z).data("symbol",t).data("ref",t);Jb([Z]);Ia(v);I("changed",[l])}catch(ua){console.log(ua);return false}return true};var Vb=b.identifyLayers=function(){ac();z().identifyLayers()};
|
E=F>A?"scale("+G/3/D[3]+")":"scale("+G/3/D[2]+")";E="translate(0) "+E+" translate(0)";t=d.createElementNS(c,"symbol");var H=Ab();for(svgedit.browser.isGecko()&&$(s).find("linearGradient, radialGradient, pattern").appendTo(H);s.firstChild;)t.appendChild(s.firstChild);var P=s.attributes;for(s=0;s<P.length;s++){var Q=P[s];t.setAttribute(Q.nodeName,Q.nodeValue)}t.id=M();Cb[h]={symbol:t,xform:E};Ab().appendChild(t);v.addSubCommand(new Ma(t))}var W=d.createElementNS(c,"use");W.id=M();S(W,"#"+t.id);(L||
|
||||||
this.createLayer=function(g){var h=new Na("Create Layer");g=z().createLayer(g);h.addSubCommand(new Ma(g));Ia(h);bb();I("changed",[g])};this.cloneLayer=function(g){var h=new Na("Duplicate Layer"),k=d.createElementNS(c,"g"),v=d.createElementNS(c,"title");v.textContent=g;k.appendChild(v);v=z().getCurrentLayer();$(v).after(k);v=v.childNodes;for(var t=0;t<v.length;t++){var E=v[t];E.localName!="title"&&k.appendChild(aa(E))}bb();Vb();h.addSubCommand(new Ma(k));Ia(h);b.setCurrentLayer(g);I("changed",[k])};
|
z().getCurrentLayer()).appendChild(W);v.addSubCommand(new Ma(W));bb();W.setAttribute("transform",E);rb(W);$(W).data("symbol",t).data("ref",t);Jb([W]);Ia(v);I("changed",[l])}catch(ua){console.log(ua);return false}return true};var Vb=b.identifyLayers=function(){ac();z().identifyLayers()};this.createLayer=function(g){var h=new Na("Create Layer");g=z().createLayer(g);h.addSubCommand(new Ma(g));Ia(h);bb();I("changed",[g])};this.cloneLayer=function(g){var h=new Na("Duplicate Layer"),k=d.createElementNS(c,
|
||||||
this.deleteCurrentLayer=function(){var g=z().getCurrentLayer(),h=g.nextSibling,k=g.parentNode;if(g=z().deleteCurrentLayer()){var v=new Na("Delete Layer");v.addSubCommand(new Sa(g,h,k));Ia(v);bb();I("changed",[k]);return true}return false};this.setCurrentLayer=function(g){(g=z().setCurrentLayer(svgedit.utilities.toXml(g)))&&bb();return g};this.renameCurrentLayer=function(g){var h=z();if(h.current_layer){var k=h.current_layer;if(!b.setCurrentLayer(g)){for(var v=new Na("Rename Layer"),t=0;t<h.getNumLayers();++t)if(h.all_layers[t][1]==
|
"g"),v=d.createElementNS(c,"title");v.textContent=g;k.appendChild(v);v=z().getCurrentLayer();$(v).after(k);v=v.childNodes;for(var t=0;t<v.length;t++){var E=v[t];E.localName!="title"&&k.appendChild(aa(E))}bb();Vb();h.addSubCommand(new Ma(k));Ia(h);b.setCurrentLayer(g);I("changed",[k])};this.deleteCurrentLayer=function(){var g=z().getCurrentLayer(),h=g.nextSibling,k=g.parentNode;if(g=z().deleteCurrentLayer()){var v=new Na("Delete Layer");v.addSubCommand(new Sa(g,h,k));Ia(v);bb();I("changed",[k]);return true}return false};
|
||||||
k)break;var E=h.getLayerName(t);h.all_layers[t][0]=svgedit.utilities.toXml(g);var w=k.childNodes.length;for(t=0;t<w;++t){var s=k.childNodes.item(t);if(s&&s.tagName=="title"){for(;s.firstChild;)s.removeChild(s.firstChild);s.textContent=g;v.addSubCommand(new Ya(s,{"#text":E}));Ia(v);I("changed",[k]);return true}}}h.current_layer=k}return false};this.setCurrentLayerPosition=function(g){var h=z();if(h.current_layer&&g>=0&&g<h.getNumLayers()){for(var k=0;k<h.getNumLayers();++k)if(h.all_layers[k][1]==h.current_layer)break;
|
this.setCurrentLayer=function(g){(g=z().setCurrentLayer(svgedit.utilities.toXml(g)))&&bb();return g};this.renameCurrentLayer=function(g){var h=z();if(h.current_layer){var k=h.current_layer;if(!b.setCurrentLayer(g)){for(var v=new Na("Rename Layer"),t=0;t<h.getNumLayers();++t)if(h.all_layers[t][1]==k)break;var E=h.getLayerName(t);h.all_layers[t][0]=svgedit.utilities.toXml(g);var w=k.childNodes.length;for(t=0;t<w;++t){var s=k.childNodes.item(t);if(s&&s.tagName=="title"){for(;s.firstChild;)s.removeChild(s.firstChild);
|
||||||
if(k==h.getNumLayers())return false;if(k!=g){var v=null,t=h.current_layer.nextSibling;if(g>k){if(g<h.getNumLayers()-1)v=h.all_layers[g+1][1]}else v=h.all_layers[g][1];l.insertBefore(h.current_layer,v);Ia(new Qa(h.current_layer,t,l));Vb();b.setCurrentLayer(h.getLayerName(g));return true}}return false};this.setLayerVisibility=function(g,h){var k=z(),v=k.getLayerVisibility(g),t=k.setLayerVisibility(g,h);if(t)Ia(new Ya(t,{display:v?"inline":"none"},"Layer Visibility"));else return false;if(t==k.getCurrentLayer()){bb();
|
s.textContent=g;v.addSubCommand(new Ya(s,{"#text":E}));Ia(v);I("changed",[k]);return true}}}h.current_layer=k}return false};this.setCurrentLayerPosition=function(g){var h=z();if(h.current_layer&&g>=0&&g<h.getNumLayers()){for(var k=0;k<h.getNumLayers();++k)if(h.all_layers[k][1]==h.current_layer)break;if(k==h.getNumLayers())return false;if(k!=g){var v=null,t=h.current_layer.nextSibling;if(g>k){if(g<h.getNumLayers()-1)v=h.all_layers[g+1][1]}else v=h.all_layers[g][1];l.insertBefore(h.current_layer,v);
|
||||||
Ua.clear()}return true};this.moveSelectedToLayer=function(g){for(var h=null,k=z(),v=0;v<k.getNumLayers();++v)if(k.getLayerName(v)==g){h=k.all_layers[v][1];break}if(!h)return false;g=new Na("Move Elements to Layer");k=K;for(v=k.length;v--;){var t=k[v];if(t){var E=t.nextSibling,w=t.parentNode;h.appendChild(t);g.addSubCommand(new Qa(t,E,w))}}Ia(g);return true};this.mergeLayer=function(g){var h=new Na("Merge Layer"),k=z(),v=$(k.current_layer).prev()[0];if(v){for(h.addSubCommand(new Sa(k.current_layer,
|
Ia(new Qa(h.current_layer,t,l));Vb();b.setCurrentLayer(h.getLayerName(g));return true}}return false};this.setLayerVisibility=function(g,h){var k=z(),v=k.getLayerVisibility(g),t=k.setLayerVisibility(g,h);if(t)Ia(new Ya(t,{display:v?"inline":"none"},"Layer Visibility"));else return false;if(t==k.getCurrentLayer()){bb();Ua.clear()}return true};this.moveSelectedToLayer=function(g){for(var h=null,k=z(),v=0;v<k.getNumLayers();++v)if(k.getLayerName(v)==g){h=k.all_layers[v][1];break}if(!h)return false;g=
|
||||||
k.current_layer.nextSibling,l));k.current_layer.firstChild;){var t=k.current_layer.firstChild;if(t.localName=="title"){h.addSubCommand(new Sa(t,t.nextSibling,k.current_layer));k.current_layer.removeChild(t)}else{var E=t.nextSibling;v.appendChild(t);h.addSubCommand(new Qa(t,E,k.current_layer))}}l.removeChild(k.current_layer);if(!g){bb();Vb();I("changed",[l]);Ia(h)}k.current_layer=v;return h}};this.mergeAllLayers=function(){var g=new Na("Merge all Layers"),h=z();for(h.current_layer=h.all_layers[h.getNumLayers()-
|
new Na("Move Elements to Layer");k=J;for(v=k.length;v--;){var t=k[v];if(t){var E=t.nextSibling,w=t.parentNode;h.appendChild(t);g.addSubCommand(new Qa(t,E,w))}}Ia(g);return true};this.mergeLayer=function(g){var h=new Na("Merge Layer"),k=z(),v=$(k.current_layer).prev()[0];if(v){for(h.addSubCommand(new Sa(k.current_layer,k.current_layer.nextSibling,l));k.current_layer.firstChild;){var t=k.current_layer.firstChild;if(t.localName=="title"){h.addSubCommand(new Sa(t,t.nextSibling,k.current_layer));k.current_layer.removeChild(t)}else{var E=
|
||||||
1][1];$(l).children("g").length>1;)g.addSubCommand(b.mergeLayer(true));bb();Vb();I("changed",[l]);Ia(g)};var ac=this.leaveContext=function(){var g=Fa.length;if(g){for(var h=0;h<g;h++){var k=Fa[h],v=ob(k,"orig_opac");v!==1?k.setAttribute("opacity",v):k.removeAttribute("opacity");k.setAttribute("style","pointer-events: inherit")}Fa=[];bb(true);I("contextset",null)}L=null},nc=this.setContext=function(g){ac();if(typeof g==="string")g=la(g);L=g;$(g).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=
|
t.nextSibling;v.appendChild(t);h.addSubCommand(new Qa(t,E,k.current_layer))}}l.removeChild(k.current_layer);if(!g){bb();Vb();I("changed",[l]);Ia(h)}k.current_layer=v;return h}};this.mergeAllLayers=function(){var g=new Na("Merge all Layers"),h=z();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(l).children("g").length>1;)g.addSubCommand(b.mergeLayer(true));bb();Vb();I("changed",[l]);Ia(g)};var ac=this.leaveContext=function(){var g=Fa.length;if(g){for(var h=0;h<g;h++){var k=Fa[h],v=nb(k,"orig_opac");
|
||||||
this.getAttribute("opacity")||1;ob(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");Fa.push(this)});bb();I("contextset",L)};this.clear=function(){Ua.clear();bb();b.clearSvgContentElement();b.current_drawing_=new svgedit.draw.Drawing(l);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();Pa.initGroup();Da=Pa.getRubberBandBox();I("cleared")};this.linkControlPoints=Ua.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=
|
v!==1?k.setAttribute("opacity",v):k.removeAttribute("opacity");k.setAttribute("style","pointer-events: inherit")}Fa=[];bb(true);I("contextset",null)}L=null},mc=this.setContext=function(g){ac();if(typeof g==="string")g=la(g);L=g;$(g).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;nb(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style","pointer-events: none");Fa.push(this)});bb();I("contextset",L)};this.clear=function(){Ua.clear();
|
||||||
function(){return e};this.getSelectedElems=function(){return K};var Tb=this.getResolution=function(){var g=l.getAttribute("width")/p,h=l.getAttribute("height")/p;return{w:g,h:h,zoom:p}};this.getZoom=function(){return p};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(g){$.extend(Gb,g.notification)};this.setConfig=function(g){$.extend(m,g)};this.getTitle=function(g){if(g=g||K[0]){g=$(g).data("gsvg")||$(g).data("symbol")||g;g=g.childNodes;for(var h=0;h<g.length;h++)if(g[h].nodeName==
|
bb();b.clearSvgContentElement();b.current_drawing_=new svgedit.draw.Drawing(l);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();Pa.initGroup();Da=Pa.getRubberBandBox();I("cleared")};this.linkControlPoints=Ua.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=function(){return e};this.getSelectedElems=function(){return J};var Tb=this.getResolution=function(){var g=l.getAttribute("width")/p,h=l.getAttribute("height")/p;return{w:g,h:h,zoom:p}};this.getZoom=function(){return p};
|
||||||
"title")return g[h].textContent;return""}};this.setGroupTitle=function(g){var h=K[0];h=$(h).data("gsvg")||h;var k=$(h).children("title"),v=new Na("Set Label");if(g.length)if(k.length){k=k[0];v.addSubCommand(new Ya(k,{"#text":k.textContent}));k.textContent=g}else{k=d.createElementNS(c,"title");k.textContent=g;$(h).prepend(k);v.addSubCommand(new Ma(k))}else{v.addSubCommand(new Sa(k[0],k.nextSibling,h));k.remove()}Ia(v)};this.getDocumentTitle=function(){return b.getTitle(l)};this.setDocumentTitle=function(g){for(var h=
|
this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(g){$.extend(Gb,g.notification)};this.setConfig=function(g){$.extend(m,g)};this.getTitle=function(g){if(g=g||J[0]){g=$(g).data("gsvg")||$(g).data("symbol")||g;g=g.childNodes;for(var h=0;h<g.length;h++)if(g[h].nodeName=="title")return g[h].textContent;return""}};this.setGroupTitle=function(g){var h=J[0];h=$(h).data("gsvg")||h;var k=$(h).children("title"),v=new Na("Set Label");if(g.length)if(k.length){k=k[0];v.addSubCommand(new Ya(k,
|
||||||
l.childNodes,k=false,v="",t=new Na("Change Image Title"),E=0;E<h.length;E++)if(h[E].nodeName=="title"){k=h[E];v=k.textContent;break}if(!k){k=d.createElementNS(c,"title");l.insertBefore(k,l.firstChild)}if(g.length)k.textContent=g;else k.parentNode.removeChild(k);t.addSubCommand(new Ya(k,{"#text":v}));Ia(t)};this.getEditorNS=function(g){g&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(g,h){var k=Tb(),v=k.w;k=k.h;var t;
|
{"#text":k.textContent}));k.textContent=g}else{k=d.createElementNS(c,"title");k.textContent=g;$(h).prepend(k);v.addSubCommand(new Ma(k))}else{v.addSubCommand(new Sa(k[0],k.nextSibling,h));k.remove()}Ia(v)};this.getDocumentTitle=function(){return b.getTitle(l)};this.setDocumentTitle=function(g){for(var h=l.childNodes,k=false,v="",t=new Na("Change Image Title"),E=0;E<h.length;E++)if(h[E].nodeName=="title"){k=h[E];v=k.textContent;break}if(!k){k=d.createElementNS(c,"title");l.insertBefore(k,l.firstChild)}if(g.length)k.textContent=
|
||||||
if(g=="fit"){var E=getStrokedBBox();if(E){t=new Na("Fit Canvas to Content");var w=Ib();Jb(w);var s=[],B=[];$.each(w,function(){s.push(E.x*-1);B.push(E.y*-1)});w=b.moveSelectedElements(s,B,true);t.addSubCommand(w);bb();g=Math.round(E.width);h=Math.round(E.height)}else return false}if(g!=v||h!=k){w=e.suspendRedraw(1E3);t||(t=new Na("Change Image Dimensions"));g=qa("width",g);h=qa("height",h);l.setAttribute("width",g);l.setAttribute("height",h);this.contentW=g;this.contentH=h;t.addSubCommand(new Ya(l,
|
g;else k.parentNode.removeChild(k);t.addSubCommand(new Ya(k,{"#text":v}));Ia(t)};this.getEditorNS=function(g){g&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(g,h){var k=Tb(),v=k.w;k=k.h;var t;if(g=="fit"){var E=getStrokedBBox();if(E){t=new Na("Fit Canvas to Content");var w=Ib();Jb(w);var s=[],A=[];$.each(w,function(){s.push(E.x*-1);A.push(E.y*-1)});w=b.moveSelectedElements(s,A,true);t.addSubCommand(w);bb();g=Math.round(E.width);
|
||||||
{width:v,height:k}));l.setAttribute("viewBox",[0,0,g/p,h/p].join(" "));t.addSubCommand(new Ya(l,{viewBox:["0 0",v,k].join(" ")}));Ia(t);e.unsuspendRedraw(w);I("changed",[l])}return true};this.getOffset=function(){return $(l).attr(["x","y"])};this.setBBoxZoom=function(g,h,k){var v=0.85,t=function(E){if(!E)return false;var w=Math.min(Math.round(h/E.width*100*v)/100,Math.round(k/E.height*100*v)/100);b.setZoom(w);return{zoom:w,bbox:E}};if(typeof g=="object"){g=g;if(g.width==0||g.height==0){b.setZoom(g.zoom?
|
h=Math.round(E.height)}else return false}if(g!=v||h!=k){w=e.suspendRedraw(1E3);t||(t=new Na("Change Image Dimensions"));g=qa("width",g);h=qa("height",h);l.setAttribute("width",g);l.setAttribute("height",h);this.contentW=g;this.contentH=h;t.addSubCommand(new Ya(l,{width:v,height:k}));l.setAttribute("viewBox",[0,0,g/p,h/p].join(" "));t.addSubCommand(new Ya(l,{viewBox:["0 0",v,k].join(" ")}));Ia(t);e.unsuspendRedraw(w);I("changed",[l])}return true};this.getOffset=function(){return $(l).attr(["x","y"])};
|
||||||
g.zoom:p*g.factor);return{zoom:p,bbox:g}}return t(g)}switch(g){case "selection":if(!K[0])return;g=$.map(K,function(E){if(E)return E});g=getStrokedBBox(g);break;case "canvas":g=Tb();v=0.95;g={width:g.w,height:g.h,x:0,y:0};break;case "content":g=getStrokedBBox();break;case "layer":g=getStrokedBBox(Ib(z().getCurrentLayer()));break;default:return}return t(g)};this.setZoom=function(g){var h=Tb();l.setAttribute("viewBox","0 0 "+h.w/g+" "+h.h/g);p=g;$.each(K,function(k,v){v&&Pa.requestSelector(v).resize()});
|
this.setBBoxZoom=function(g,h,k){var v=0.85,t=function(E){if(!E)return false;var w=Math.min(Math.round(h/E.width*100*v)/100,Math.round(k/E.height*100*v)/100);b.setZoom(w);return{zoom:w,bbox:E}};if(typeof g=="object"){g=g;if(g.width==0||g.height==0){b.setZoom(g.zoom?g.zoom:p*g.factor);return{zoom:p,bbox:g}}return t(g)}switch(g){case "selection":if(!J[0])return;g=$.map(J,function(E){if(E)return E});g=getStrokedBBox(g);break;case "canvas":g=Tb();v=0.95;g={width:g.w,height:g.h,x:0,y:0};break;case "content":g=
|
||||||
Ua.zoomChange();nb("zoomChanged",g)};this.getMode=function(){return Ja};this.setMode=function(g){Ua.clear(true);sb.clear();$("#workarea").attr("class",g);hb=K[0]&&K[0].nodeName=="text"?db:N;Ja=g};this.getColor=function(g){return hb[g]};this.setColor=function(g,h,k){N[g]=h;hb[g+"_paint"]={type:"solidColor"};for(var v=[],t=K.length;t--;){var E=K[t];if(E)if(E.tagName=="g")svgedit.utilities.walkTree(E,function(w){w.nodeName!="g"&&v.push(w)});else if(g=="fill")E.tagName!="polyline"&&E.tagName!="line"&&
|
getStrokedBBox();break;case "layer":g=getStrokedBBox(Ib(z().getCurrentLayer()));break;default:return}return t(g)};this.setZoom=function(g){var h=Tb();l.setAttribute("viewBox","0 0 "+h.w/g+" "+h.h/g);p=g;$.each(J,function(k,v){v&&Pa.requestSelector(v).resize()});Ua.zoomChange();pb("zoomChanged",g)};this.getMode=function(){return Ja};this.setMode=function(g){Ua.clear(true);sb.clear();$("#workarea").attr("class",g);hb=J[0]&&J[0].nodeName=="text"?eb:N;Ja=g};this.getColor=function(g){return hb[g]};this.setColor=
|
||||||
v.push(E);else v.push(E)}if(v.length>0)if(k)Rb(g,h,v);else{qb(g,h,v);I("changed",v)}};var Ab=function(){var g=l.getElementsByTagNameNS(c,"defs");if(g.length>0)g=g[0];else{g=d.createElementNS(c,"defs");l.firstChild?l.insertBefore(g,l.firstChild.nextSibling):l.appendChild(g)}return g},cc=this.setGradient=function(g){if(!(!hb[g+"_paint"]||hb[g+"_paint"].type=="solidColor")){var h=b[g+"Grad"],k=fc(h),v=Ab();if(k)h=k;else{h=v.appendChild(d.importNode(h,true));h.id=M()}b.setColor(g,"url(#"+h.id+")")}},
|
function(g,h,k){N[g]=h;hb[g+"_paint"]={type:"solidColor"};for(var v=[],t=J.length;t--;){var E=J[t];if(E)if(E.tagName=="g")svgedit.utilities.walkTree(E,function(w){w.nodeName!="g"&&v.push(w)});else if(g=="fill")E.tagName!="polyline"&&E.tagName!="line"&&v.push(E);else v.push(E)}if(v.length>0)if(k)Rb(g,h,v);else{qb(g,h,v);I("changed",v)}};var Ab=function(){var g=l.getElementsByTagNameNS(c,"defs");if(g.length>0)g=g[0];else{g=d.createElementNS(c,"defs");l.firstChild?l.insertBefore(g,l.firstChild.nextSibling):
|
||||||
fc=function(g){var h=Ab();h=$(h).find("linearGradient, radialGradient");for(var k=h.length,v=["r","cx","cy","fx","fy"];k--;){var t=h[k];if(g.tagName=="linearGradient"){if(g.getAttribute("x1")!=t.getAttribute("x1")||g.getAttribute("y1")!=t.getAttribute("y1")||g.getAttribute("x2")!=t.getAttribute("x2")||g.getAttribute("y2")!=t.getAttribute("y2"))continue}else{var E=$(g).attr(v),w=$(t).attr(v),s=false;$.each(v,function(H,P){if(E[P]!=w[P])s=true});if(s)continue}var B=g.getElementsByTagNameNS(c,"stop"),
|
l.appendChild(g)}return g},cc=this.setGradient=function(g){if(!(!hb[g+"_paint"]||hb[g+"_paint"].type=="solidColor")){var h=b[g+"Grad"],k=fc(h),v=Ab();if(k)h=k;else{h=v.appendChild(d.importNode(h,true));h.id=M()}b.setColor(g,"url(#"+h.id+")")}},fc=function(g){var h=Ab();h=$(h).find("linearGradient, radialGradient");for(var k=h.length,v=["r","cx","cy","fx","fy"];k--;){var t=h[k];if(g.tagName=="linearGradient"){if(g.getAttribute("x1")!=t.getAttribute("x1")||g.getAttribute("y1")!=t.getAttribute("y1")||
|
||||||
F=t.getElementsByTagNameNS(c,"stop");if(B.length==F.length){for(var C=B.length;C--;){var D=B[C],G=F[C];if(D.getAttribute("offset")!=G.getAttribute("offset")||D.getAttribute("stop-opacity")!=G.getAttribute("stop-opacity")||D.getAttribute("stop-color")!=G.getAttribute("stop-color"))break}if(C==-1)return t}}return null};this.setPaint=function(g,h){var k=new $.jGraduate.Paint(h);this.setPaintOpacity(g,k.alpha/100,true);hb[g+"_paint"]=k;switch(k.type){case "solidColor":if(k.solidColor!="none")this.setColor(g,
|
g.getAttribute("x2")!=t.getAttribute("x2")||g.getAttribute("y2")!=t.getAttribute("y2"))continue}else{var E=$(g).attr(v),w=$(t).attr(v),s=false;$.each(v,function(H,P){if(E[P]!=w[P])s=true});if(s)continue}var A=g.getElementsByTagNameNS(c,"stop"),F=t.getElementsByTagNameNS(c,"stop");if(A.length==F.length){for(var C=A.length;C--;){var D=A[C],G=F[C];if(D.getAttribute("offset")!=G.getAttribute("offset")||D.getAttribute("stop-opacity")!=G.getAttribute("stop-opacity")||D.getAttribute("stop-color")!=G.getAttribute("stop-color"))break}if(C==
|
||||||
"#"+k.solidColor);else{this.setColor(g,"none");document.querySelector(g=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","transparent")}break;case "linearGradient":case "radialGradient":b[g+"Grad"]=k[k.type];cc(g)}};this.getStrokeWidth=function(){return hb.stroke_width};this.setStrokeWidth=function(g){if(g==0&&["line","path"].indexOf(Ja)>=0)b.setStrokeWidth(1);else{hb.stroke_width=g;for(var h=[],k=K.length;k--;){var v=K[k];if(v)v.tagName=="g"?svgedit.utilities.walkTree(v,function(t){t.nodeName!=
|
-1)return t}}return null};this.setPaint=function(g,h){var k=new $.jGraduate.Paint(h);this.setPaintOpacity(g,k.alpha/100,true);hb[g+"_paint"]=k;switch(k.type){case "solidColor":if(k.solidColor!="none"&&k.solidColor!="#none")this.setColor(g,"#"+k.solidColor);else{this.setColor(g,"none");document.querySelector(g=="fill"?"#fill_color rect":"#stroke_color rect").setAttribute("fill","transparent")}break;case "linearGradient":case "radialGradient":b[g+"Grad"]=k[k.type];cc(g)}};this.getStrokeWidth=function(){return hb.stroke_width};
|
||||||
"g"&&h.push(t)}):h.push(v)}if(h.length>0){qb("stroke-width",g,h);I("changed",K)}}};this.setStrokeAttr=function(g,h){N[g.replace("-","_")]=h;for(var k=[],v=K.length;v--;){var t=K[v];if(t)t.tagName=="g"?svgedit.utilities.walkTree(t,function(E){E.nodeName!="g"&&k.push(E)}):k.push(t)}if(k.length>0){qb(g,h,k);I("changed",K)}};this.getStyle=function(){return N};this.getOpacity=function(){return N.opacity};this.setOpacity=function(g){N.opacity=g;qb("opacity",g)};this.getFillOpacity=function(){return N.fill_opacity};
|
this.setStrokeWidth=function(g){if(g==0&&["line","path"].indexOf(Ja)>=0)b.setStrokeWidth(1);else{hb.stroke_width=g;for(var h=[],k=J.length;k--;){var v=J[k];if(v)v.tagName=="g"?svgedit.utilities.walkTree(v,function(t){t.nodeName!="g"&&h.push(t)}):h.push(v)}if(h.length>0){qb("stroke-width",g,h);I("changed",J)}}};this.setStrokeAttr=function(g,h){N[g.replace("-","_")]=h;for(var k=[],v=J.length;v--;){var t=J[v];if(t)t.tagName=="g"?svgedit.utilities.walkTree(t,function(E){E.nodeName!="g"&&k.push(E)}):k.push(t)}if(k.length>
|
||||||
this.getStrokeOpacity=function(){return N.stroke_opacity};this.setPaintOpacity=function(g,h,k){N[g+"_opacity"]=h;k?Rb(g+"-opacity",h):qb(g+"-opacity",h)};this.getBlur=function(g){var h=0;if(g)if(g.getAttribute("filter"))if(g=la(g.id+"_blur"))h=g.firstChild.getAttribute("stdDeviation");return h};(function(){function g(){var t=b.undoMgr.finishUndoableChange();h.addSubCommand(t);Ia(h);k=h=null}var h=null,k=null,v=false;b.setBlurNoUndo=function(t){if(k)if(t===0){Rb("filter","");v=true}else{var E=K[0];
|
0){qb(g,h,k);I("changed",J)}};this.getStyle=function(){return N};this.getOpacity=function(){return N.opacity};this.setOpacity=function(g){N.opacity=g;qb("opacity",g)};this.getFillOpacity=function(){return N.fill_opacity};this.getStrokeOpacity=function(){return N.stroke_opacity};this.setPaintOpacity=function(g,h,k){N[g+"_opacity"]=h;k?Rb(g+"-opacity",h):qb(g+"-opacity",h)};this.getBlur=function(g){var h=0;if(g)if(g.getAttribute("filter"))if(g=la(g.id+"_blur"))h=g.firstChild.getAttribute("stdDeviation");
|
||||||
v&&Rb("filter","url(#"+E.id+"_blur)");if(svgedit.browser.isWebkit()){E.removeAttribute("filter");E.setAttribute("filter","url(#"+E.id+"_blur)")}Rb("stdDeviation",t,[k.firstChild]);b.setBlurOffsets(k,t)}else b.setBlur(t)};b.setBlurOffsets=function(t,E){if(E>3)ma(t,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){t.removeAttribute("x");t.removeAttribute("y");t.removeAttribute("width");t.removeAttribute("height")}};b.setBlur=function(t,E){if(h)g();else{var w=K[0],
|
return h};(function(){function g(){var t=b.undoMgr.finishUndoableChange();h.addSubCommand(t);Ia(h);k=h=null}var h=null,k=null,v=false;b.setBlurNoUndo=function(t){if(k)if(t===0){Rb("filter","");v=true}else{var E=J[0];v&&Rb("filter","url(#"+E.id+"_blur)");if(svgedit.browser.isWebkit()){E.removeAttribute("filter");E.setAttribute("filter","url(#"+E.id+"_blur)")}Rb("stdDeviation",t,[k.firstChild]);b.setBlurOffsets(k,t)}else b.setBlur(t)};b.setBlurOffsets=function(t,E){if(E>3)ma(t,{x:"-50%",y:"-50%",width:"200%",
|
||||||
s=w.id;k=la(s+"_blur");t-=0;var B=new Na;if(k){if(t===0)k=null}else{var F=da({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:t}});k=da({element:"filter",attr:{id:s+"_blur"}});k.appendChild(F);Ab().appendChild(k);B.addSubCommand(new Ma(k))}F={filter:w.getAttribute("filter")};if(t===0){w.removeAttribute("filter");B.addSubCommand(new Ya(w,F))}else{qb("filter","url(#"+s+"_blur)");B.addSubCommand(new Ya(w,F));b.setBlurOffsets(k,t);h=B;b.undoMgr.beginUndoableChange("stdDeviation",[k?k.firstChild:
|
height:"200%"},100);else if(!svgedit.browser.isWebkit()){t.removeAttribute("x");t.removeAttribute("y");t.removeAttribute("width");t.removeAttribute("height")}};b.setBlur=function(t,E){if(h)g();else{var w=J[0],s=w.id;k=la(s+"_blur");t-=0;var A=new Na;if(k){if(t===0)k=null}else{var F=da({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:t}});k=da({element:"filter",attr:{id:s+"_blur"}});k.appendChild(F);Ab().appendChild(k);A.addSubCommand(new Ma(k))}F={filter:w.getAttribute("filter")};
|
||||||
null]);if(E){b.setBlurNoUndo(t);g()}}}}})();this.getBold=function(){var g=K[0];if(g!=null&&g.tagName=="text"&&K[1]==null)return g.getAttribute("font-weight")=="bold";return false};this.setBold=function(g){var h=K[0];if(h!=null&&h.tagName=="text"&&K[1]==null)qb("font-weight",g?"bold":"normal");K[0].textContent||sb.setCursor()};this.getItalic=function(){var g=K[0];if(g!=null&&g.tagName=="text"&&K[1]==null)return g.getAttribute("font-style")=="italic";return false};this.setItalic=function(g){var h=K[0];
|
if(t===0){w.removeAttribute("filter");A.addSubCommand(new Ya(w,F))}else{qb("filter","url(#"+s+"_blur)");A.addSubCommand(new Ya(w,F));b.setBlurOffsets(k,t);h=A;b.undoMgr.beginUndoableChange("stdDeviation",[k?k.firstChild:null]);if(E){b.setBlurNoUndo(t);g()}}}}})();this.getBold=function(){var g=J[0];if(g!=null&&g.tagName=="text"&&J[1]==null)return g.getAttribute("font-weight")=="bold";return false};this.setBold=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)qb("font-weight",g?"bold":
|
||||||
if(h!=null&&h.tagName=="text"&&K[1]==null)qb("font-style",g?"italic":"normal");K[0].textContent||sb.setCursor()};this.getFontFamily=function(){return db.font_family};this.setFontFamily=function(g){db.font_family=g;qb("font-family",g);K[0]&&!K[0].textContent&&sb.setCursor()};this.setFontColor=function(g){db.fill=g;qb("fill",g)};this.getFontSize=function(){return db.fill};this.getFontSize=function(){return db.font_size};this.setFontSize=function(g){db.font_size=g;qb("font-size",g);K[0].textContent||
|
"normal");J[0].textContent||sb.setCursor()};this.getItalic=function(){var g=J[0];if(g!=null&&g.tagName=="text"&&J[1]==null)return g.getAttribute("font-style")=="italic";return false};this.setItalic=function(g){var h=J[0];if(h!=null&&h.tagName=="text"&&J[1]==null)qb("font-style",g?"italic":"normal");J[0].textContent||sb.setCursor()};this.getFontFamily=function(){return eb.font_family};this.setFontFamily=function(g){eb.font_family=g;qb("font-family",g);J[0]&&!J[0].textContent&&sb.setCursor()};this.setFontColor=
|
||||||
sb.setCursor()};this.getText=function(){var g=K[0];if(g==null)return"";return g.textContent};this.setTextContent=function(g){qb("#text",g);sb.init(g);sb.setCursor()};this.setImageURL=function(g){var h=K[0];if(h){var k=$(h).attr(["width","height"]);k=!k.width||!k.height;var v=ba(h);if(v!==g)k=true;else if(!k)return;var t=new Na("Change Image URL");S(h,g);t.addSubCommand(new Ya(h,{"#href":v}));k?$(new Image).load(function(){var E=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});
|
function(g){eb.fill=g;qb("fill",g)};this.getFontSize=function(){return eb.fill};this.getFontSize=function(){return eb.font_size};this.setFontSize=function(g){eb.font_size=g;qb("font-size",g);J[0].textContent||sb.setCursor()};this.getText=function(){var g=J[0];if(g==null)return"";return g.textContent};this.setTextContent=function(g){qb("#text",g);sb.init(g);sb.setCursor()};this.setImageURL=function(g){var h=J[0];if(h){var k=$(h).attr(["width","height"]);k=!k.width||!k.height;var v=ba(h);if(v!==g)k=
|
||||||
Pa.requestSelector(h).resize();t.addSubCommand(new Ya(h,E));Ia(t);I("changed",[h])}).attr("src",g):Ia(t)}};this.setLinkURL=function(g){var h=K[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var k=ba(h);if(k!==g){var v=new Na("Change Link URL");S(h,g);v.addSubCommand(new Ya(h,{"#href":k}));Ia(v)}}};this.setRectRadius=function(g){var h=K[0];if(h!=null&&h.tagName=="rect"){var k=h.getAttribute("rx");if(k!=g){h.setAttribute("rx",g);h.setAttribute("ry",g);Ia(new Ya(h,{rx:k,
|
true;else if(!k)return;var t=new Na("Change Image URL");S(h,g);t.addSubCommand(new Ya(h,{"#href":v}));k?$(new Image).load(function(){var E=$(h).attr(["width","height"]);$(h).attr({width:this.width,height:this.height});Pa.requestSelector(h).resize();t.addSubCommand(new Ya(h,E));Ia(t);I("changed",[h])}).attr("src",g):Ia(t)}};this.setLinkURL=function(g){var h=J[0];if(h){if(h.tagName!=="a"){h=$(h).parents("a");if(h.length)h=h[0];else return}var k=ba(h);if(k!==g){var v=new Na("Change Link URL");S(h,g);
|
||||||
ry:k},"Radius"));I("changed",[h])}}};this.makeHyperlink=function(g){b.groupSelectedElements("a",g)};this.removeHyperlink=function(){b.ungroupSelectedElement()};this.setSegType=function(g){Ua.setSegType(g)};this.convertToPath=function(g,h){if(g==null)$.each(K,function(wa,ga){ga&&b.convertToPath(ga)});else{if(!h)var k=new Na("Convert element to Path");var v=h?{}:{fill:N.fill,"fill-opacity":N.fill_opacity,stroke:N.stroke,"stroke-width":N.stroke_width,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,
|
v.addSubCommand(new Ya(h,{"#href":k}));Ia(v)}}};this.setRectRadius=function(g){var h=J[0];if(h!=null&&h.tagName=="rect"){var k=h.getAttribute("rx");if(k!=g){h.setAttribute("rx",g);h.setAttribute("ry",g);Ia(new Ya(h,{rx:k,ry:k},"Radius"));I("changed",[h])}}};this.makeHyperlink=function(g){b.groupSelectedElements("a",g)};this.removeHyperlink=function(){b.ungroupSelectedElement()};this.setSegType=function(g){Ua.setSegType(g)};this.convertToPath=function(g,h){if(g==null)$.each(J,function(wa,ga){ga&&b.convertToPath(ga)});
|
||||||
"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,opacity:N.opacity,visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(g.getAttribute(this))v[this]=g.getAttribute(this)});var t=da({element:"path",attr:v}),E=g.getAttribute("transform");E&&t.setAttribute("transform",E);var w=g.id,s=g.parentNode;g.nextSibling?s.insertBefore(t,g):s.appendChild(t);var B="",F=function(wa){$.each(wa,function(ga,ka){var oa=ka[1];B+=ka[0];for(var ya=
|
else{if(!h)var k=new Na("Convert element to Path");var v=h?{}:{fill:N.fill,"fill-opacity":N.fill_opacity,stroke:N.stroke,"stroke-width":N.stroke_width,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,opacity:N.opacity,visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(g.getAttribute(this))v[this]=g.getAttribute(this)});var t=da({element:"path",attr:v}),
|
||||||
0;ya<oa.length;ya+=2)B+=oa[ya]+","+oa[ya+1]+" "})},C=1.81;switch(g.tagName){case "ellipse":case "circle":var D=$(g).attr(["rx","ry","cx","cy"]),G=D.cx,H=D.cy,P=D.rx;D=D.ry;if(g.tagName=="circle")P=D=$(g).attr("r");F([["M",[G-P,H]],["C",[G-P,H-D/C,G-P/C,H-D,G,H-D]],["C",[G+P/C,H-D,G+P,H-D/C,G+P,H]],["C",[G+P,H+D/C,G+P/C,H+D,G,H+D]],["C",[G-P/C,H+D,G-P,H+D/C,G-P,H]],["Z",[]]]);break;case "path":B=g.getAttribute("d");break;case "line":D=$(g).attr(["x1","y1","x2","y2"]);B="M"+D.x1+","+D.y1+"L"+D.x2+","+
|
E=g.getAttribute("transform");E&&t.setAttribute("transform",E);var w=g.id,s=g.parentNode;g.nextSibling?s.insertBefore(t,g):s.appendChild(t);var A="",F=function(wa){$.each(wa,function(ga,ka){var oa=ka[1];A+=ka[0];for(var ya=0;ya<oa.length;ya+=2)A+=oa[ya]+","+oa[ya+1]+" "})},C=1.81;switch(g.tagName){case "ellipse":case "circle":var D=$(g).attr(["rx","ry","cx","cy"]),G=D.cx,H=D.cy,P=D.rx;D=D.ry;if(g.tagName=="circle")P=D=$(g).attr("r");F([["M",[G-P,H]],["C",[G-P,H-D/C,G-P/C,H-D,G,H-D]],["C",[G+P/C,H-
|
||||||
D.y2;break;case "polyline":case "polygon":B="M"+g.getAttribute("points");break;case "rect":D=$(g).attr(["rx","ry"]);P=D.rx;D=D.ry;var Q=g.getBBox();G=Q.x;H=Q.y;var Z=Q.width;Q=Q.height;C=4-C;!P&&!D?F([["M",[G,H]],["L",[G+Z,H]],["L",[G+Z,H+Q]],["L",[G,H+Q]],["L",[G,H]],["Z",[]]]):F([["M",[G,H+D]],["C",[G,H+D/C,G+P/C,H,G+P,H]],["L",[G+Z-P,H]],["C",[G+Z-P/C,H,G+Z,H+D/C,G+Z,H+D]],["L",[G+Z,H+Q-D]],["C",[G+Z,H+Q-D/C,G+Z-P/C,H+Q,G+Z-P,H+Q]],["L",[G+P,H+Q]],["C",[G+P/C,H+Q,G,H+Q-D/C,G,H+Q-D]],["L",[G,H+
|
D,G+P,H-D/C,G+P,H]],["C",[G+P,H+D/C,G+P/C,H+D,G,H+D]],["C",[G-P/C,H+D,G-P,H+D/C,G-P,H]],["Z",[]]]);break;case "path":A=g.getAttribute("d");break;case "line":D=$(g).attr(["x1","y1","x2","y2"]);A="M"+D.x1+","+D.y1+"L"+D.x2+","+D.y2;break;case "polyline":case "polygon":A="M"+g.getAttribute("points");break;case "rect":D=$(g).attr(["rx","ry"]);P=D.rx;D=D.ry;var Q=g.getBBox();G=Q.x;H=Q.y;var W=Q.width;Q=Q.height;C=4-C;!P&&!D?F([["M",[G,H]],["L",[G+W,H]],["L",[G+W,H+Q]],["L",[G,H+Q]],["L",[G,H]],["Z",[]]]):
|
||||||
D]],["Z",[]]]);break;default:t.parentNode.removeChild(t)}B&&t.setAttribute("d",B);if(h){Ua.resetOrientation(t);k=false;try{k=t.getBBox()}catch(ua){}t.parentNode.removeChild(t);return k}else{if(E){E=V(t);sa(E)&&Ua.resetOrientation(t)}k.addSubCommand(new Sa(g,g.nextSibling,s));k.addSubCommand(new Ma(t));bb();g.parentNode.removeChild(g);t.setAttribute("id",w);t.removeAttribute("visibility");Jb([t],true);Ia(k)}}};var Rb=function(g,h,k){var v=e.suspendRedraw(1E3);Ja=="pathedit"&&Ua.moveNode(g,h);k=k||
|
F([["M",[G,H+D]],["C",[G,H+D/C,G+P/C,H,G+P,H]],["L",[G+W-P,H]],["C",[G+W-P/C,H,G+W,H+D/C,G+W,H+D]],["L",[G+W,H+Q-D]],["C",[G+W,H+Q-D/C,G+W-P/C,H+Q,G+W-P,H+Q]],["L",[G+P,H+Q]],["C",[G+P/C,H+Q,G,H+Q-D/C,G,H+Q-D]],["L",[G,H+D]],["Z",[]]]);break;default:t.parentNode.removeChild(t)}A&&t.setAttribute("d",A);if(h){Ua.resetOrientation(t);k=false;try{k=t.getBBox()}catch(ua){}t.parentNode.removeChild(t);return k}else{if(E){E=V(t);sa(E)&&Ua.resetOrientation(t)}k.addSubCommand(new Sa(g,g.nextSibling,s));k.addSubCommand(new Ma(t));
|
||||||
K;for(var t=k.length,E=["g","polyline","path"];t--;){var w=k[t];if(w!=null){Ja==="textedit"&&g!=="#text"&&w.textContent.length&&sb.toSelectMode(w);if((g==="x"||g==="y")&&E.indexOf(w.tagName)>=0){var s=getStrokedBBox([w]);b.moveSelectedElements((g==="x"?h-s.x:0)*p,(g==="y"?h-s.y:0)*p,true)}else{s=g==="#text"?w.textContent:w.getAttribute(g);if(s==null)s="";if(s!==String(h)){if(g=="#text"){svgedit.utilities.getBBox(w);w.textContent=h;if(/rotate/.test(w.getAttribute("transform")))w=Oa(w)}else g=="#href"?
|
bb();g.parentNode.removeChild(g);t.setAttribute("id",w);t.removeAttribute("visibility");Jb([t],true);Ia(k)}}};var Rb=function(g,h,k){var v=e.suspendRedraw(1E3);Ja=="pathedit"&&Ua.moveNode(g,h);k=k||J;for(var t=k.length,E=["g","polyline","path"];t--;){var w=k[t];if(w!=null){Ja==="textedit"&&g!=="#text"&&w.textContent.length&&sb.toSelectMode(w);if((g==="x"||g==="y")&&E.indexOf(w.tagName)>=0){var s=getStrokedBBox([w]);b.moveSelectedElements((g==="x"?h-s.x:0)*p,(g==="y"?h-s.y:0)*p,true)}else{s=g==="#text"?
|
||||||
S(w,h):w.setAttribute(g,h);if(svgedit.browser.isGecko()&&w.nodeName==="text"&&/rotate/.test(w.getAttribute("transform")))if((h+"").indexOf("url")===0||["font-size","font-family","x","y"].indexOf(g)>=0&&w.textContent)w=Oa(w);K.indexOf(w)>=0&&setTimeout(function(){w.parentNode&&Pa.requestSelector(w).resize()},0);s=ra(w);if(s!=0&&g!="transform")for(var B=V(w),F=B.numberOfItems;F--;)if(B.getItem(F).type==4){B.removeItem(F);var C=svgedit.utilities.getBBox(w),D=O(C.x+C.width/2,C.y+C.height/2,ia(B).matrix);
|
w.textContent:w.getAttribute(g);if(s==null)s="";if(s!==String(h)){if(g=="#text"){svgedit.utilities.getBBox(w);w.textContent=h;if(/rotate/.test(w.getAttribute("transform")))w=Oa(w)}else g=="#href"?S(w,h):w.setAttribute(g,h);if(svgedit.browser.isGecko()&&w.nodeName==="text"&&/rotate/.test(w.getAttribute("transform")))if((h+"").indexOf("url")===0||["font-size","font-family","x","y"].indexOf(g)>=0&&w.textContent)w=Oa(w);J.indexOf(w)>=0&&setTimeout(function(){w.parentNode&&Pa.requestSelector(w).resize()},
|
||||||
C=D.x;D=D.y;var G=e.createSVGTransform();G.setRotate(s,C,D);B.insertItemBefore(G,F);break}}}}}e.unsuspendRedraw(v)},qb=this.changeSelectedAttribute=function(g,h,k){k=k||K;b.undoMgr.beginUndoableChange(g,k);Rb(g,h,k);g=b.undoMgr.finishUndoableChange();g.isEmpty()||Ia(g)};this.deleteSelectedElements=function(){for(var g=new Na("Delete Elements"),h=K.length,k=[],v=0;v<h;++v){var t=K[v];if(t==null)break;var E=t.parentNode,w=t;Pa.releaseSelector(w);svgedit.path.removePath_(w.id);if(E.tagName==="a"&&E.childNodes.length===
|
0);s=ra(w);if(s!=0&&g!="transform")for(var A=V(w),F=A.numberOfItems;F--;)if(A.getItem(F).type==4){A.removeItem(F);var C=svgedit.utilities.getBBox(w),D=O(C.x+C.width/2,C.y+C.height/2,ha(A).matrix);C=D.x;D=D.y;var G=e.createSVGTransform();G.setRotate(s,C,D);A.insertItemBefore(G,F);break}}}}}e.unsuspendRedraw(v)},qb=this.changeSelectedAttribute=function(g,h,k){k=k||J;b.undoMgr.beginUndoableChange(g,k);Rb(g,h,k);g=b.undoMgr.finishUndoableChange();g.isEmpty()||Ia(g)};this.deleteSelectedElements=function(){for(var g=
|
||||||
1){w=E;E=E.parentNode}var s=w.nextSibling;w=E.removeChild(w);k.push(t);K[v]=null;g.addSubCommand(new Sa(w,s,E))}g.isEmpty()||Ia(g);I("changed",k);bb()};this.cutSelectedElements=function(){for(var g=new Na("Cut Elements"),h=K.length,k=[],v=0;v<h;++v){var t=K[v];if(t==null)break;var E=t.parentNode,w=t;Pa.releaseSelector(w);svgedit.path.removePath_(w.id);var s=w.nextSibling;w=E.removeChild(w);k.push(t);K[v]=null;g.addSubCommand(new Sa(w,s,E))}g.isEmpty()||Ia(g);I("changed",k);bb();b.clipBoard=k};this.copySelectedElements=
|
new Na("Delete Elements"),h=J.length,k=[],v=0;v<h;++v){var t=J[v];if(t==null)break;var E=t.parentNode,w=t;Pa.releaseSelector(w);svgedit.path.removePath_(w.id);if(E.tagName==="a"&&E.childNodes.length===1){w=E;E=E.parentNode}var s=w.nextSibling;w=E.removeChild(w);k.push(t);J[v]=null;g.addSubCommand(new Sa(w,s,E))}g.isEmpty()||Ia(g);I("changed",k);bb()};this.cutSelectedElements=function(){for(var g=new Na("Cut Elements"),h=J.length,k=[],v=0;v<h;++v){var t=J[v];if(t==null)break;var E=t.parentNode,w=t;
|
||||||
function(){b.clipBoard=$.merge([],K)};this.pasteElements=function(g,h,k){var v=b.clipBoard,t=v.length;if(t){for(var E=[],w=new Na("Paste elements");t--;){var s=v[t];if(s){var B=aa(s);if(!la(s.id))B.id=s.id;E.push(B);(L||z().getCurrentLayer()).appendChild(B);w.addSubCommand(new Ma(B))}}vb(E);if(g!="in_place"){if(zb==null){zb.x=0;zb.y=0}var F,C;if(g){if(g==="point"){F=h;C=k}}else{F=zb.x;C=zb.y}g=getStrokedBBox(E);var D=F-(g.x+g.width/2),G=C-(g.y+g.height/2),H=[],P=[];$.each(E,function(){H.push(D);P.push(G)});
|
Pa.releaseSelector(w);svgedit.path.removePath_(w.id);var s=w.nextSibling;w=E.removeChild(w);k.push(t);J[v]=null;g.addSubCommand(new Sa(w,s,E))}g.isEmpty()||Ia(g);I("changed",k);bb();b.clipBoard=k};this.copySelectedElements=function(){b.clipBoard=$.merge([],J)};this.pasteElements=function(g,h,k){var v=b.clipBoard,t=v.length;if(t){for(var E=[],w=new Na("Paste elements");t--;){var s=v[t];if(s){var A=aa(s);if(!la(s.id))A.id=s.id;E.push(A);(L||z().getCurrentLayer()).appendChild(A);w.addSubCommand(new Ma(A))}}vb(E);
|
||||||
F=b.moveSelectedElements(H,P,false);w.addSubCommand(F)}Ia(w);I("changed",E)}};this.groupSelectedElements=function(g){g||(g="g");var h="";switch(g){case "a":h="Make hyperlink";var k="";if(arguments.length>1)k=arguments[1];break;default:g="g";h="Group Elements"}h=new Na(h);var v=da({element:g,attr:{id:M()}});g==="a"&&S(v,k);h.addSubCommand(new Ma(v));for(k=K.length;k--;){var t=K[k];if(t!=null){if(t.parentNode.tagName==="a"&&t.parentNode.childNodes.length===1)t=t.parentNode;var E=t.nextSibling,w=t.parentNode;
|
if(g!="in_place"){if(zb==null){zb.x=0;zb.y=0}var F,C;if(g){if(g==="point"){F=h;C=k}}else{F=zb.x;C=zb.y}g=getStrokedBBox(E);var D=F-(g.x+g.width/2),G=C-(g.y+g.height/2),H=[],P=[];$.each(E,function(){H.push(D);P.push(G)});F=b.moveSelectedElements(H,P,false);w.addSubCommand(F)}Ia(w);I("changed",E)}};this.groupSelectedElements=function(g){g||(g="g");var h="";switch(g){case "a":h="Make hyperlink";var k="";if(arguments.length>1)k=arguments[1];break;default:g="g";h="Group Elements"}h=new Na(h);var v=da({element:g,
|
||||||
v.appendChild(t);h.addSubCommand(new Qa(t,E,w))}}h.isEmpty()||Ia(h);vb([v],true)};var ec=this.pushGroupProperties=function(g,h){var k=g.childNodes,v=k.length,t=g.getAttribute("transform"),E=V(g),w=ia(E).matrix,s=new Na("Push group properties"),B=0,F=ra(g),C=$(g).attr(["filter","opacity"]),D,G;for(B=0;B<v;B++){var H=k[B];if(H.nodeType===1){if(C.opacity!==null&&C.opacity!==1){H.getAttribute("opacity");var P=Math.round((H.getAttribute("opacity")||1)*C.opacity*100)/100;qb("opacity",P,[H])}if(C.filter){var Q=
|
attr:{id:M()}});g==="a"&&S(v,k);h.addSubCommand(new Ma(v));for(k=J.length;k--;){var t=J[k];if(t!=null){if(t.parentNode.tagName==="a"&&t.parentNode.childNodes.length===1)t=t.parentNode;var E=t.nextSibling,w=t.parentNode;v.appendChild(t);h.addSubCommand(new Qa(t,E,w))}}h.isEmpty()||Ia(h);vb([v],true)};var ec=this.pushGroupProperties=function(g,h){var k=g.childNodes,v=k.length,t=g.getAttribute("transform"),E=V(g),w=ha(E).matrix,s=new Na("Push group properties"),A=0,F=ra(g),C=$(g).attr(["filter","opacity"]),
|
||||||
P=this.getBlur(H);G||(G=this.getBlur(g));if(P)P=G-0+(P-0);else if(P===0)P=G;if(Q)D=X(H.getAttribute("filter"));else if(D){D=aa(D);Ab().appendChild(D)}else D=X(C.filter);D.id=H.id+"_"+(D.firstChild.tagName==="feGaussianBlur"?"blur":"filter");qb("filter","url(#"+D.id+")",[H]);if(P){qb("stdDeviation",P,[D.firstChild]);b.setBlurOffsets(D,P)}}P=V(H);if(~H.tagName.indexOf("Gradient"))P=null;if(P)if(H.tagName!=="defs")if(E.numberOfItems){if(F&&E.numberOfItems==1){var Z=E.getItem(0).matrix,ua=e.createSVGMatrix();
|
D,G;for(A=0;A<v;A++){var H=k[A];if(H.nodeType===1){if(C.opacity!==null&&C.opacity!==1){H.getAttribute("opacity");var P=Math.round((H.getAttribute("opacity")||1)*C.opacity*100)/100;qb("opacity",P,[H])}if(C.filter){var Q=P=this.getBlur(H);G||(G=this.getBlur(g));if(P)P=G-0+(P-0);else if(P===0)P=G;if(Q)D=Y(H.getAttribute("filter"));else if(D){D=aa(D);Ab().appendChild(D)}else D=Y(C.filter);D.id=H.id+"_"+(D.firstChild.tagName==="feGaussianBlur"?"blur":"filter");qb("filter","url(#"+D.id+")",[H]);if(P){qb("stdDeviation",
|
||||||
if(Q=ra(H))ua=P.getItem(0).matrix;var wa=svgedit.utilities.getBBox(H),ga=ia(P).matrix,ka=O(wa.x+wa.width/2,wa.y+wa.height/2,ga);wa=F+Q;ga=e.createSVGTransform();ga.setRotate(wa,ka.x,ka.y);Z=fa(Z,ua,ga.matrix.inverse());Q&&P.removeItem(0);if(wa)P.numberOfItems?P.insertItemBefore(ga,0):P.appendItem(ga);if(Z.e||Z.f){Q=e.createSVGTransform();Q.setTranslate(Z.e,Z.f);P.numberOfItems?P.insertItemBefore(Q,0):P.appendItem(Q)}}else{Q=H.getAttribute("transform");Z={};Z.transform=Q?Q:"";Q=e.createSVGTransform();
|
P,[D.firstChild]);b.setBlurOffsets(D,P)}}P=V(H);if(~H.tagName.indexOf("Gradient"))P=null;if(P)if(H.tagName!=="defs")if(E.numberOfItems){if(F&&E.numberOfItems==1){var W=E.getItem(0).matrix,ua=e.createSVGMatrix();if(Q=ra(H))ua=P.getItem(0).matrix;var wa=svgedit.utilities.getBBox(H),ga=ha(P).matrix,ka=O(wa.x+wa.width/2,wa.y+wa.height/2,ga);wa=F+Q;ga=e.createSVGTransform();ga.setRotate(wa,ka.x,ka.y);W=fa(W,ua,ga.matrix.inverse());Q&&P.removeItem(0);if(wa)P.numberOfItems?P.insertItemBefore(ga,0):P.appendItem(ga);
|
||||||
Z=ia(P).matrix;ua=Z.inverse();Z=fa(ua,w,Z);Q.setMatrix(Z);P.appendItem(Q)}(H=rb(H))&&s.addSubCommand(H)}}}if(t){Z={};Z.transform=t;g.setAttribute("transform","");g.removeAttribute("transform");s.addSubCommand(new Ya(g,Z))}if(h&&!s.isEmpty())return s};this.ungroupSelectedElement=function(){var g=K[0];if($(g).data("gsvg")||$(g).data("symbol"))kc(g);else if(g.tagName==="use"){var h=la(ba(g).substr(1));$(g).data("symbol",h).data("ref",h);kc(g)}else{h=$(g).parents("a");if(h.length)g=h[0];if(g.tagName===
|
if(W.e||W.f){Q=e.createSVGTransform();Q.setTranslate(W.e,W.f);P.numberOfItems?P.insertItemBefore(Q,0):P.appendItem(Q)}}else{Q=H.getAttribute("transform");W={};W.transform=Q?Q:"";Q=e.createSVGTransform();W=ha(P).matrix;ua=W.inverse();W=fa(ua,w,W);Q.setMatrix(W);P.appendItem(Q)}(H=rb(H))&&s.addSubCommand(H)}}}if(t){W={};W.transform=t;g.setAttribute("transform","");g.removeAttribute("transform");s.addSubCommand(new Ya(g,W))}if(h&&!s.isEmpty())return s};this.ungroupSelectedElement=function(){var g=J[0];
|
||||||
"g"||g.tagName==="a"){h=new Na("Ungroup Elements");var k=ec(g,true);k&&h.addSubCommand(k);k=g.parentNode;for(var v=g.nextSibling,t=Array(g.childNodes.length),E=0;g.firstChild;){var w=g.firstChild,s=w.nextSibling,B=w.parentNode;if(w.tagName==="title"){h.addSubCommand(new Sa(w,w.nextSibling,B));B.removeChild(w)}else{t[E++]=w=k.insertBefore(w,v);h.addSubCommand(new Qa(w,s,B))}}bb();v=g.nextSibling;g=k.removeChild(g);h.addSubCommand(new Sa(g,v,k));h.isEmpty()||Ia(h);Jb(t)}}};this.moveToTopSelectedElement=
|
if($(g).data("gsvg")||$(g).data("symbol"))kc(g);else if(g.tagName==="use"){var h=la(ba(g).substr(1));$(g).data("symbol",h).data("ref",h);kc(g)}else{h=$(g).parents("a");if(h.length)g=h[0];if(g.tagName==="g"||g.tagName==="a"){h=new Na("Ungroup Elements");var k=ec(g,true);k&&h.addSubCommand(k);k=g.parentNode;for(var v=g.nextSibling,t=Array(g.childNodes.length),E=0;g.firstChild;){var w=g.firstChild,s=w.nextSibling,A=w.parentNode;if(w.tagName==="title"){h.addSubCommand(new Sa(w,w.nextSibling,A));A.removeChild(w)}else{t[E++]=
|
||||||
function(){var g=K[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling;g=g.parentNode.appendChild(g);if(k!=g.nextSibling){Ia(new Qa(g,k,h,"top"));I("changed",[g])}}};this.moveToBottomSelectedElement=function(){var g=K[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling,v=g.parentNode.firstChild;if(v.tagName=="title")v=v.nextSibling;if(v.tagName=="defs")v=v.nextSibling;g=g.parentNode.insertBefore(g,v);if(k!=g.nextSibling){Ia(new Qa(g,k,h,"bottom"));I("changed",[g])}}};this.moveUpDownSelected=function(g){var h=
|
w=k.insertBefore(w,v);h.addSubCommand(new Qa(w,s,A))}}bb();v=g.nextSibling;g=k.removeChild(g);h.addSubCommand(new Sa(g,v,k));h.isEmpty()||Ia(h);Jb(t)}}};this.moveToTopSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling;g=g.parentNode.appendChild(g);if(k!=g.nextSibling){Ia(new Qa(g,k,h,"top"));I("changed",[g])}}};this.moveToBottomSelectedElement=function(){var g=J[0];if(g!=null){g=g;var h=g.parentNode,k=g.nextSibling,v=g.parentNode.firstChild;if(v.tagName=="title")v=
|
||||||
K[0];if(h){xb=[];var k,v,t=$(Kb(getStrokedBBox([h]))).toArray();g=="Down"&&t.reverse();$.each(t,function(){if(v){k=this;return false}else if(this==h)v=true});if(k){t=h.parentNode;var E=h.nextSibling;$(k)[g=="Down"?"before":"after"](h);if(E!=h.nextSibling){Ia(new Qa(h,E,t,"Move "+g));I("changed",[h])}}}};this.moveSelectedElements=function(g,h,k){if(g.constructor!=Array){g/=p;h/=p}k=k||true;for(var v=new Na("position"),t=K.length;t--;){var E=K[t];if(E!=null){var w=e.createSVGTransform(),s=V(E);g.constructor==
|
v.nextSibling;if(v.tagName=="defs")v=v.nextSibling;g=g.parentNode.insertBefore(g,v);if(k!=g.nextSibling){Ia(new Qa(g,k,h,"bottom"));I("changed",[g])}}};this.moveUpDownSelected=function(g){var h=J[0];if(h){xb=[];var k,v,t=$(Kb(getStrokedBBox([h]))).toArray();g=="Down"&&t.reverse();$.each(t,function(){if(v){k=this;return false}else if(this==h)v=true});if(k){t=h.parentNode;var E=h.nextSibling;$(k)[g=="Down"?"before":"after"](h);if(E!=h.nextSibling){Ia(new Qa(h,E,t,"Move "+g));I("changed",[h])}}}};this.moveSelectedElements=
|
||||||
Array?w.setTranslate(g[t],h[t]):w.setTranslate(g,h);s.numberOfItems?s.insertItemBefore(w,0):s.appendItem(w);(w=rb(E))&&v.addSubCommand(w);Pa.requestSelector(E).resize()}}if(!v.isEmpty()){k&&Ia(v);I("changed",K);return v}};this.cloneSelectedElements=function(g,h){for(var k=new Na("Clone Elements"),v=K.length,t=0;t<v;++t){var E=K[t];if(E==null)break}v=K.slice(0,t);this.clearSelection(true);for(t=v.length;t--;){E=v[t]=aa(v[t]);(L||z().getCurrentLayer()).appendChild(E);k.addSubCommand(new Ma(E))}if(!k.isEmpty()){Jb(v.reverse());
|
function(g,h,k){if(g.constructor!=Array){g/=p;h/=p}k=k||true;for(var v=new Na("position"),t=J.length;t--;){var E=J[t];if(E!=null){var w=e.createSVGTransform(),s=V(E);g.constructor==Array?w.setTranslate(g[t],h[t]):w.setTranslate(g,h);s.numberOfItems?s.insertItemBefore(w,0):s.appendItem(w);(w=rb(E))&&v.addSubCommand(w);Pa.requestSelector(E).resize()}}if(!v.isEmpty()){k&&Ia(v);I("changed",J);return v}};this.cloneSelectedElements=function(g,h){for(var k=new Na("Clone Elements"),v=J.length,t=0;t<v;++t){var E=
|
||||||
this.moveSelectedElements(g,h,false);Ia(k)}};this.alignSelectedElements=function(g,h){var k=[],v=Number.MAX_VALUE,t=Number.MIN_VALUE,E=Number.MAX_VALUE,w=Number.MIN_VALUE,s=Number.MIN_VALUE,B=Number.MIN_VALUE,F=K.length;if(F){for(var C=0;C<F;++C){if(K[C]==null)break;k[C]=getStrokedBBox([K[C]]);switch(h){case "smallest":if((g=="l"||g=="c"||g=="r")&&(s==Number.MIN_VALUE||s>k[C].width)||(g=="t"||g=="m"||g=="b")&&(B==Number.MIN_VALUE||B>k[C].height)){v=k[C].x;E=k[C].y;t=k[C].x+k[C].width;w=k[C].y+k[C].height;
|
J[t];if(E==null)break}v=J.slice(0,t);this.clearSelection(true);for(t=v.length;t--;){E=v[t]=aa(v[t]);(L||z().getCurrentLayer()).appendChild(E);k.addSubCommand(new Ma(E))}if(!k.isEmpty()){Jb(v.reverse());this.moveSelectedElements(g,h,false);Ia(k)}};this.alignSelectedElements=function(g,h){var k=[],v=Number.MAX_VALUE,t=Number.MIN_VALUE,E=Number.MAX_VALUE,w=Number.MIN_VALUE,s=Number.MIN_VALUE,A=Number.MIN_VALUE,F=J.length;if(F){for(var C=0;C<F;++C){if(J[C]==null)break;k[C]=getStrokedBBox([J[C]]);switch(h){case "smallest":if((g==
|
||||||
s=k[C].width;B=k[C].height}break;case "largest":if((g=="l"||g=="c"||g=="r")&&(s==Number.MIN_VALUE||s<k[C].width)||(g=="t"||g=="m"||g=="b")&&(B==Number.MIN_VALUE||B<k[C].height)){v=k[C].x;E=k[C].y;t=k[C].x+k[C].width;w=k[C].y+k[C].height;s=k[C].width;B=k[C].height}break;default:if(k[C].x<v)v=k[C].x;if(k[C].y<E)E=k[C].y;if(k[C].x+k[C].width>t)t=k[C].x+k[C].width;if(k[C].y+k[C].height>w)w=k[C].y+k[C].height}}if(h=="page"){E=v=0;t=b.contentW;w=b.contentH}s=Array(F);B=Array(F);for(C=0;C<F;++C){if(K[C]==
|
"l"||g=="c"||g=="r")&&(s==Number.MIN_VALUE||s>k[C].width)||(g=="t"||g=="m"||g=="b")&&(A==Number.MIN_VALUE||A>k[C].height)){v=k[C].x;E=k[C].y;t=k[C].x+k[C].width;w=k[C].y+k[C].height;s=k[C].width;A=k[C].height}break;case "largest":if((g=="l"||g=="c"||g=="r")&&(s==Number.MIN_VALUE||s<k[C].width)||(g=="t"||g=="m"||g=="b")&&(A==Number.MIN_VALUE||A<k[C].height)){v=k[C].x;E=k[C].y;t=k[C].x+k[C].width;w=k[C].y+k[C].height;s=k[C].width;A=k[C].height}break;default:if(k[C].x<v)v=k[C].x;if(k[C].y<E)E=k[C].y;
|
||||||
null)break;var D=k[C];s[C]=0;B[C]=0;switch(g){case "l":s[C]=v-D.x;break;case "c":s[C]=(v+t)/2-(D.x+D.width/2);break;case "r":s[C]=t-(D.x+D.width);break;case "t":B[C]=E-D.y;break;case "m":B[C]=(E+w)/2-(D.y+D.height/2);break;case "b":B[C]=w-(D.y+D.height)}}this.moveSelectedElements(s,B)}};this.contentW=Tb().w;this.contentH=Tb().h;this.updateCanvas=function(g,h){e.setAttribute("width",g);e.setAttribute("height",h);var k=$("#canvasBackground")[0],v=l.getAttribute("x"),t=l.getAttribute("y"),E=g/2-this.contentW*
|
if(k[C].x+k[C].width>t)t=k[C].x+k[C].width;if(k[C].y+k[C].height>w)w=k[C].y+k[C].height}}if(h=="page"){E=v=0;t=b.contentW;w=b.contentH}s=Array(F);A=Array(F);for(C=0;C<F;++C){if(J[C]==null)break;var D=k[C];s[C]=0;A[C]=0;switch(g){case "l":s[C]=v-D.x;break;case "c":s[C]=(v+t)/2-(D.x+D.width/2);break;case "r":s[C]=t-(D.x+D.width);break;case "t":A[C]=E-D.y;break;case "m":A[C]=(E+w)/2-(D.y+D.height/2);break;case "b":A[C]=w-(D.y+D.height)}}this.moveSelectedElements(s,A)}};this.contentW=Tb().w;this.contentH=
|
||||||
p/2,w=h/2-this.contentH*p/2;ma(l,{width:this.contentW*p,height:this.contentH*p,x:E,y:w,viewBox:"0 0 "+this.contentW+" "+this.contentH});ma(k,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:E,y:w});(k=la("background_image"))&&ma(k,{width:"100%",height:"100%"});Pa.selectorParentGroup.setAttribute("transform","translate("+E+","+w+")");return{x:E,y:w,old_x:v,old_y:t,d_x:E-v,d_y:w-t}};this.setBackground=function(g,h){var k=la("canvasBackground"),v=$(k).find("rect")[0],t=la("background_image");
|
Tb().h;this.updateCanvas=function(g,h){e.setAttribute("width",g);e.setAttribute("height",h);var k=$("#canvasBackground")[0],v=l.getAttribute("x"),t=l.getAttribute("y"),E=g/2-this.contentW*p/2,w=h/2-this.contentH*p/2;ma(l,{width:this.contentW*p,height:this.contentH*p,x:E,y:w,viewBox:"0 0 "+this.contentW+" "+this.contentH});ma(k,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:E,y:w});(k=la("background_image"))&&ma(k,{width:"100%",height:"100%"});Pa.selectorParentGroup.setAttribute("transform",
|
||||||
v.setAttribute("fill",g);if(h){if(!t){t=d.createElementNS(c,"image");ma(t,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}S(t,h);k.appendChild(t)}else t&&t.parentNode.removeChild(t)};this.cycleElement=function(g){var h=K[0],k=false,v=Ib(L||z().getCurrentLayer());if(v.length){if(h==null){g=g?v.length-1:0;k=v[g]}else for(var t=v.length;t--;)if(v[t]==h){g=g?t-1:t+1;if(g>=v.length)g=0;else if(g<0)g=v.length-1;k=v[g];break}vb([k],true);I("selected",
|
"translate("+E+","+w+")");return{x:E,y:w,old_x:v,old_y:t,d_x:E-v,d_y:w-t}};this.setBackground=function(g,h){var k=la("canvasBackground"),v=$(k).find("rect")[0],t=la("background_image");v.setAttribute("fill",g);if(h){if(!t){t=d.createElementNS(c,"image");ma(t,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}S(t,h);k.appendChild(t)}else t&&t.parentNode.removeChild(t)};this.cycleElement=function(g){var h=J[0],k=false,v=Ib(L||z().getCurrentLayer());
|
||||||
K)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:Ia,setGradient:cc,addSvgElementFromJson:da,assignAttributes:ma,BatchCommand:Na,call:I,ChangeElementCommand:Ya,copyElem:aa,ffClone:Oa,findDefs:Ab,findDuplicateGradient:fc,getElem:la,getId:ta,getIntersectionList:Kb,getMouseTarget:$b,getNextId:M,getPathBBox:U,getUrlFromAttr:pa,hasMatrixTransform:sa,identifyLayers:Vb,InsertElementCommand:Ma,isIdentity:svgedit.math.isIdentity,logMatrix:tb,matrixMultiply:fa,MoveElementCommand:Qa,
|
if(v.length){if(h==null){g=g?v.length-1:0;k=v[g]}else for(var t=v.length;t--;)if(v[t]==h){g=g?t-1:t+1;if(g>=v.length)g=0;else if(g<0)g=v.length-1;k=v[g];break}vb([k],true);I("selected",J)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:Ia,setGradient:cc,addSvgElementFromJson:da,assignAttributes:ma,BatchCommand:Na,call:I,ChangeElementCommand:Ya,copyElem:aa,ffClone:Oa,findDefs:Ab,findDuplicateGradient:fc,getElem:la,getId:ta,getIntersectionList:Kb,getMouseTarget:$b,getNextId:M,
|
||||||
preventClickDefault:Zb,recalculateAllSelectedDimensions:Wa,recalculateDimensions:rb,remapElement:wb,RemoveElementCommand:Sa,removeUnusedDefElems:jc,round:Eb,runExtensions:nb,sanitizeSvg:Ka,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ia,transformPoint:O,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function n(z,p){var L=f.setSvgString(z)!==false;p=p||a.noop;L?p(true):a.alert(e.notification.errorLoadingSVG,function(){p(false)})}var f,c={},m=false,o={lang:"en",iconsize:"m",bkgd_color:"FFF",bkgd_url:"",img_save:"embed"},
|
getPathBBox:U,getUrlFromAttr:pa,hasMatrixTransform:sa,identifyLayers:Vb,InsertElementCommand:Ma,isIdentity:svgedit.math.isIdentity,logMatrix:tb,matrixMultiply:fa,MoveElementCommand:Qa,preventClickDefault:Zb,recalculateAllSelectedDimensions:Wa,recalculateDimensions:rb,remapElement:wb,RemoveElementCommand:Sa,removeUnusedDefElems:jc,round:Eb,runExtensions:pb,sanitizeSvg:Ka,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ha,
|
||||||
|
transformPoint:O,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function n(z,p){var L=f.setSvgString(z)!==false;p=p||a.noop;L?p(true):a.alert(e.notification.errorLoadingSVG,function(){p(false)})}var f,c={},m=false,o={lang:"en",iconsize:"m",bkgd_color:"FFF",bkgd_url:"",img_save:"embed"},
|
||||||
b={},d={canvas_expansion:1,dimensions:[640,480],initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",langPath:"locale/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:["ext-markers.js","ext-eyedropper.js","ext-shapes.js","ext-grid.js"],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:true,show_outside_canvas:false,no_save_warning:true},e=c.uiStrings=
|
b={},d={canvas_expansion:1,dimensions:[640,480],initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",langPath:"locale/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:["ext-markers.js","ext-eyedropper.js","ext-shapes.js","ext-grid.js"],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:true,show_outside_canvas:false,no_save_warning:true},e=c.uiStrings=
|
||||||
{common:{ok:"OK",cancel:"Cancel",key_up:"Up",key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},notification:{invalidAttrValGiven:"Invalid value given",noContentToFitTo:"No content to fit to",dupeLayerName:"There is already a layer named that!",enterUniqueLayerName:"Please enter a unique layer name",enterNewLayerName:"Please enter the new layer name",layerHasThatName:"Layer already has that name",QmoveElemsToLayer:'Move selected elements to layer "%s"?',QwantToClear:"Do you want to clear the drawing?\nThis will also erase your undo history!",
|
{common:{ok:"OK",cancel:"Cancel",key_up:"Up",key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},notification:{invalidAttrValGiven:"Invalid value given",noContentToFitTo:"No content to fit to",dupeLayerName:"There is already a layer named that!",enterUniqueLayerName:"Please enter a unique layer name",enterNewLayerName:"Please enter the new layer name",layerHasThatName:"Layer already has that name",QmoveElemsToLayer:'Move selected elements to layer "%s"?',QwantToClear:"Do you want to clear the drawing?\nThis will also erase your undo history!",
|
||||||
QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo history!",QerrorsRevertToSource:"There were parsing errors in your SVG source.\nRevert back to original SVG source?",QignoreSourceChanges:"Ignore changes made to SVG source?",featNotSupported:"Feature not supported",enterNewImgURL:"Enter the new image URL",defsFailOnSave:"NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",loadingImage:"Loading image, please wait...",
|
QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo history!",QerrorsRevertToSource:"There were parsing errors in your SVG source.\nRevert back to original SVG source?",QignoreSourceChanges:"Ignore changes made to SVG source?",featNotSupported:"Feature not supported",enterNewImgURL:"Enter the new image URL",defsFailOnSave:"NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",loadingImage:"Loading image, please wait...",
|
||||||
saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};b={};var l={};c.curConfig=d;c.tool_scale=1;a.pref=function(z,p){if(p)b[z]=p;z="svg-edit-"+z;var L=location.hostname,T=L&&L.indexOf(".")>=0,N=p!=undefined,
|
saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};b={};var l={};c.curConfig=d;c.tool_scale=1;a.pref=function(z,p){if(p)b[z]=p;z="svg-edit-"+z;var L=location.hostname,T=L&&L.indexOf(".")>=0,N=p!=undefined,
|
||||||
K=false;try{if(window.localStorage)K=localStorage}catch(da){}try{if(window.globalStorage&&T)K=globalStorage[L]}catch(V){}if(K)if(N)K.setItem(z,p);else{if(K.getItem(z))return K.getItem(z)+""}else if(window.widget)if(N)widget.setPreferenceForKey(p,z);else return widget.preferenceForKey(z);else if(N){L=new Date;L.setTime(L.getTime()+31536E6);p=encodeURIComponent(p);document.cookie=z+"="+p+"; expires="+L.toUTCString()}else return(L=document.cookie.match(RegExp(z+"=([^;]+)")))?decodeURIComponent(L[1]):
|
J=false;try{if(window.localStorage)J=localStorage}catch(da){}try{if(window.globalStorage&&T)J=globalStorage[L]}catch(V){}if(J)if(N)J.setItem(z,p);else{if(J.getItem(z))return J.getItem(z)+""}else if(window.widget)if(N)widget.setPreferenceForKey(p,z);else return widget.preferenceForKey(z);else if(N){L=new Date;L.setTime(L.getTime()+31536E6);p=encodeURIComponent(p);document.cookie=z+"="+p+"; expires="+L.toUTCString()}else return(L=document.cookie.match(RegExp(z+"=([^;]+)")))?decodeURIComponent(L[1]):
|
||||||
""};c.setConfig=function(z){a.each(z,function(p,L){p in o&&a.pref(p,L)});a.extend(true,d,z);if(z.extensions)d.extensions=z.extensions};c.setCustomHandlers=function(z){c.ready(function(){if(z.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();f.open=z.open}if(z.save){c.show_save_warning=false;f.bind("saved",z.save)}z.pngsave&&f.bind("exported",z.pngsave);l=z})};c.randomizeIds=function(){f.randomizeIds(arguments)};c.init=function(){function z(q,A){var J=q.id,R=J.split("_"),W=
|
""};c.setConfig=function(z){a.each(z,function(p,L){p in o&&a.pref(p,L)});a.extend(true,d,z);if(z.extensions)d.extensions=z.extensions};c.setCustomHandlers=function(z){c.ready(function(){if(z.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();f.open=z.open}if(z.save){c.show_save_warning=false;f.bind("saved",z.save)}z.pngsave&&f.bind("exported",z.pngsave);l=z})};c.randomizeIds=function(){f.randomizeIds(arguments)};c.init=function(){function z(q,B){var K=q.id,R=K.split("_"),X=
|
||||||
R[0];R=R[1];A&&f.setStrokeAttr("stroke-"+W,R);db();Q("#cur_"+W,J,20);a(q).addClass("current").siblings().removeClass("current")}function p(q,A){a.pref("bkgd_color",q);a.pref("bkgd_url",A);f.setBackground(q,A)}function L(){var q=f.getHref(Y);q=q.indexOf("data:")===0?"":q;a.prompt(e.notification.enterNewImgURL,q,function(A){A&&La(A)})}function T(){if(f.deleteCurrentLayer()){Za();Fb();a("#layerlist tr.layer").removeClass("layersel");a("#layerlist tr.layer:first").addClass("layersel")}}function N(){var q=
|
R[0];R=R[1];B&&f.setStrokeAttr("stroke-"+X,R);eb();Q("#cur_"+X,K,20);a(q).addClass("current").siblings().removeClass("current")}function p(q,B){a.pref("bkgd_color",q);a.pref("bkgd_url",B);f.setBackground(q,B)}function L(){var q=f.getHref(Z);q=q.indexOf("data:")===0?"":q;a.prompt(e.notification.enterNewImgURL,q,function(B){B&&La(B)})}function T(){if(f.deleteCurrentLayer()){Za();Fb();a("#layerlist tr.layer").removeClass("layersel");a("#layerlist tr.layer:first").addClass("layersel")}}function N(){var q=
|
||||||
f.getCurrentDrawing().getCurrentLayerName()+" copy";a.prompt(e.notification.enterUniqueLayerName,q,function(A){if(A)if(f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.dupeLayerName);else{f.cloneLayer(A);Za();Fb()}})}function K(q){var A=a("#layerlist tr.layersel").index(),J=f.getCurrentDrawing().getNumLayers();if(A>0||A<J-1){A+=q;f.setCurrentLayerPosition(J-A-1);Fb()}}function da(q,A){var J=document.getElementById("ruler_x_cursor"),R=document.getElementById("ruler_y_cursor"),W=document.getElementById("workarea");
|
f.getCurrentDrawing().getCurrentLayerName()+" copy";a.prompt(e.notification.enterUniqueLayerName,q,function(B){if(B)if(f.getCurrentDrawing().hasLayer(B))a.alert(e.notification.dupeLayerName);else{f.cloneLayer(B);Za();Fb()}})}function J(q){var B=a("#layerlist tr.layersel").index(),K=f.getCurrentDrawing().getNumLayers();if(B>0||B<K-1){B+=q;f.setCurrentLayerPosition(K-B-1);Fb()}}function da(q,B){var K=document.getElementById("ruler_x_cursor"),R=document.getElementById("ruler_y_cursor"),X=document.getElementById("workarea");
|
||||||
document.getElementById("title_show");svgedit.browser.isTouch()||a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(oc){oc.stopPropagation();J.style.left=oc.pageX-66+W.scrollLeft+"px";R.style.top=oc.pageY-48+W.scrollTop+"px"});A||(A=f.getZoom());q||(q=a("#svgcanvas"));for(var ha=f.getContentElem(),va=svgedit.units.getTypeMap()[d.baseUnit],xa=0;xa<2;xa++){var Ca=xa===0,Ba=Ca?"x":"y",Aa=Ca?"width":"height",yb=ha.getAttribute(Ba)-0;Ba=a("#ruler_"+Ba+" canvas:first");$hcanv=Ba.clone();
|
document.getElementById("title_show");svgedit.browser.isTouch()||a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(nc){nc.stopPropagation();K.style.left=nc.pageX-66+X.scrollLeft+"px";R.style.top=nc.pageY-48+X.scrollTop+"px"});B||(B=f.getZoom());q||(q=a("#svgcanvas"));for(var ja=f.getContentElem(),va=svgedit.units.getTypeMap()[d.baseUnit],xa=0;xa<2;xa++){var Ca=xa===0,Ba=Ca?"x":"y",Aa=Ca?"width":"height",yb=ja.getAttribute(Ba)-0;Ba=a("#ruler_"+Ba+" canvas:first");$hcanv=Ba.clone();
|
||||||
Ba.replaceWith($hcanv);var Ta=$hcanv[0];var ja=Ba=q[Aa]()*2;Ta.parentNode.style[Aa]=ja+"px";var Bb=0,cb,Ea=Ta.getContext("2d");Ea.fillStyle="rgb(200,0,0)";Ea.fillRect(0,0,Ta.width,Ta.height);$hcanv.siblings().remove();if(Ba>=3E4){var Va=parseInt(Ba/3E4)+1;cb=Array(Va);cb[0]=Ea;for(var Ha=1;Ha<Va;Ha++){Ta[Aa]=3E4;var kb=Ta.cloneNode(true);Ta.parentNode.appendChild(kb);cb[Ha]=kb.getContext("2d")}kb[Aa]=Ba%3E4;Ba=3E4}Ta[Aa]=Ba;Aa=va*A;var eb=50/Aa;Ta=1;for(Ha=0;Ha<gc.length;Ha++){Ta=Va=gc[Ha];if(eb<=
|
Ba.replaceWith($hcanv);var Ta=$hcanv[0];var ia=Ba=q[Aa]()*2;Ta.parentNode.style[Aa]=ia+"px";var Bb=0,cb,Ea=Ta.getContext("2d");Ea.fillStyle="rgb(200,0,0)";Ea.fillRect(0,0,Ta.width,Ta.height);$hcanv.siblings().remove();if(Ba>=3E4){var Va=parseInt(Ba/3E4)+1;cb=Array(Va);cb[0]=Ea;for(var Ha=1;Ha<Va;Ha++){Ta[Aa]=3E4;var kb=Ta.cloneNode(true);Ta.parentNode.appendChild(kb);cb[Ha]=kb.getContext("2d")}kb[Aa]=Ba%3E4;Ba=3E4}Ta[Aa]=Ba;Aa=va*B;var db=50/Aa;Ta=1;for(Ha=0;Ha<gc.length;Ha++){Ta=Va=gc[Ha];if(db<=
|
||||||
Va)break}eb=Ta*Aa;Ea.font="normal 9px 'Lucida Grande', sans-serif";Ea.fillStyle="#777";for(var lb=yb/Aa%Ta*Aa,Xb=lb-eb;lb<ja;lb+=eb){Xb+=eb;Ha=Math.round(lb)+0.5;if(Ca){Ea.moveTo(Ha,15);Ea.lineTo(Ha,0)}else{Ea.moveTo(15,Ha);Ea.lineTo(0,Ha)}Va=(Xb-yb)/Aa;if(Ta>=1)Ha=Math.round(Va);else{Ha=(Ta+"").split(".")[1].length;Ha=Va.toFixed(Ha)-0}if(Ha!==0&&Ha!==1E3&&Ha%1E3===0)Ha=Ha/1E3+"K";if(Ca){Ea.fillText(Ha,lb+2,8);Ea.fillStyle="#777"}else{Va=(Ha+"").split("");for(Ha=0;Ha<Va.length;Ha++){Ea.fillText(Va[Ha],
|
Va)break}db=Ta*Aa;Ea.font="normal 9px 'Lucida Grande', sans-serif";Ea.fillStyle="#777";for(var lb=yb/Aa%Ta*Aa,Xb=lb-db;lb<ia;lb+=db){Xb+=db;Ha=Math.round(lb)+0.5;if(Ca){Ea.moveTo(Ha,15);Ea.lineTo(Ha,0)}else{Ea.moveTo(15,Ha);Ea.lineTo(0,Ha)}Va=(Xb-yb)/Aa;if(Ta>=1)Ha=Math.round(Va);else{Ha=(Ta+"").split(".")[1].length;Ha=Va.toFixed(Ha)-0}if(Ha!==0&&Ha!==1E3&&Ha%1E3===0)Ha=Ha/1E3+"K";if(Ca){Ea.fillText(Ha,lb+2,8);Ea.fillStyle="#777"}else{Va=(Ha+"").split("");for(Ha=0;Ha<Va.length;Ha++){Ea.fillText(Va[Ha],
|
||||||
1,lb+9+Ha*9);Ea.fillStyle="#777"}}Va=eb/10;for(Ha=1;Ha<10;Ha++){var Ob=Math.round(lb+Va*Ha)+0.5;if(cb&&Ob>Ba){Bb++;Ea.stroke();if(Bb>=cb.length){Ha=10;lb=ja;continue}Ea=cb[Bb];lb-=3E4;Ob=Math.round(lb+Va*Ha)+0.5}var Wb=Ha%2?12:10;if(Ca){Ea.moveTo(Ob,15);Ea.lineTo(Ob,Wb)}else{Ea.moveTo(15,Ob);Ea.lineTo(Wb,Ob)}}}Ea.strokeStyle="#666";Ea.stroke()}}(function(){var q=window.opener;if(q)try{var A=q.document.createEvent("Event");A.initEvent("svgEditorReady",true,true);q.document.documentElement.dispatchEvent(A)}catch(J){}})();
|
1,lb+9+Ha*9);Ea.fillStyle="#777"}}Va=db/10;for(Ha=1;Ha<10;Ha++){var Ob=Math.round(lb+Va*Ha)+0.5;if(cb&&Ob>Ba){Bb++;Ea.stroke();if(Bb>=cb.length){Ha=10;lb=ia;continue}Ea=cb[Bb];lb-=3E4;Ob=Math.round(lb+Va*Ha)+0.5}var Wb=Ha%2?12:10;if(Ca){Ea.moveTo(Ob,15);Ea.lineTo(Ob,Wb)}else{Ea.moveTo(15,Ob);Ea.lineTo(Wb,Ob)}}}Ea.strokeStyle="#666";Ea.stroke()}}(function(){var q=window.opener;if(q)try{var B=q.document.createEvent("Event");B.initEvent("svgEditorReady",true,true);q.document.documentElement.dispatchEvent(B)}catch(K){}})();
|
||||||
(function(){var q=a.deparam.querystring(true);if(!a.isEmptyObject(q)){if(q.dimensions)q.dimensions=q.dimensions.split(",");if(q.extensions)q.extensions=q.extensions.split(",");if(q.bkgd_color)q.bkgd_color="#"+q.bkgd_color;svgEditor.setConfig(q);var A=q.source,J=a.param.querystring();if(!A)if(J.indexOf("source=data:")>=0)A=J.match(/source=(data:[^&]*)/)[1];if(A)if(A.indexOf("data:")===0){A=A.replace(/ /g,"+");c.loadFromDataURI(A)}else c.loadFromString(A);else if(J.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(J.substr(9));
|
(function(){var q=a.deparam.querystring(true);if(!a.isEmptyObject(q)){if(q.dimensions)q.dimensions=q.dimensions.split(",");if(q.extensions)q.extensions=q.extensions.split(",");if(q.bkgd_color)q.bkgd_color="#"+q.bkgd_color;svgEditor.setConfig(q);var B=q.source,K=a.param.querystring();if(!B)if(K.indexOf("source=data:")>=0)B=K.match(/source=(data:[^&]*)/)[1];if(B)if(B.indexOf("data:")===0){B=B.replace(/ /g,"+");c.loadFromDataURI(B)}else c.loadFromString(B);else if(K.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(K.substr(9));
|
||||||
else q.url&&svgEditor.loadFromURL(q.url)}})();var V=function(){a.each(d.extensions,function(){var A=this;a.getScript(d.extPath+A,function(J){if(!J){J=document.createElement("script");J.src=d.extPath+A;document.querySelector("head").appendChild(J)}})});var q=[];a("#lang_select option").each(function(){q.push(this.value)});c.putLocale(null,q)};document.location.protocol==="file:"?setTimeout(V,100):V();a.svgIcons(d.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:false,no_img:!svgedit.browser.isWebkit(),
|
else q.url&&svgEditor.loadFromURL(q.url)}})();var V=function(){a.each(d.extensions,function(){var B=this;a.getScript(d.extPath+B,function(K){if(!K){K=document.createElement("script");K.src=d.extPath+B;document.querySelector("head").appendChild(K)}})});var q=[];a("#lang_select option").each(function(){q.push(this.value)});c.putLocale(null,q)};document.location.protocol==="file:"?setTimeout(V,100):V();a.svgIcons(d.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:false,no_img:!svgedit.browser.isWebkit(),
|
||||||
fallback_path:d.imgPath,fallback:{new_image:"clear.png",save:"save.png",open:"open.png",source:"source.png",docprops:"document-properties.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.png",select:"select.png",select_node:"select_node.png",pencil:"fhpath.png",pen:"line.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png",clone:"clone.png",
|
fallback_path:d.imgPath,fallback:{new_image:"clear.png",save:"save.png",open:"open.png",source:"source.png",docprops:"document-properties.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.png",select:"select.png",select_node:"select_node.png",pencil:"fhpath.png",pen:"line.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png",clone:"clone.png",
|
||||||
node_clone:"node_clone.png","delete":"delete.png",node_delete:"node_delete.png",move_top:"move_top.png",move_bottom:"move_bottom.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.png",align_left:"align-left.png",align_center:"align-center",align_right:"align-right",align_top:"align-top",align_middle:"align-middle",align_bottom:"align-bottom",go_up:"go-up.png",go_down:"go-down.png",ok:"save.png",cancel:"cancel.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},
|
node_clone:"node_clone.png","delete":"delete.png",node_delete:"node_delete.png",move_top:"move_top.png",move_bottom:"move_bottom.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.png",align_left:"align-left.png",align_center:"align-center",align_right:"align-right",align_top:"align-top",align_middle:"align-middle",align_bottom:"align-bottom",go_up:"go-up.png",go_down:"go-down.png",ok:"save.png",cancel:"cancel.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},
|
||||||
placement:{"#tool_docprops > div":"docprops","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_square":"square","#tool_fhrect":"fh_rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_circle":"circle","#tool_fhellipse":"fh_ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path",
|
placement:{"#tool_docprops > div":"docprops","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_square":"square","#tool_fhrect":"fh_rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_circle":"circle","#tool_fhellipse":"fh_ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path",
|
||||||
"#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#linecap_butt,#cur_linecap":"linecap_butt","#linecap_round":"linecap_round","#linecap_square":"linecap_square","#linejoin_miter,#cur_linejoin":"linejoin_miter","#linejoin_round":"linejoin_round",
|
"#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#linecap_butt,#cur_linecap":"linecap_butt","#linecap_round":"linecap_round","#linecap_square":"linecap_square","#linejoin_miter,#cur_linejoin":"linejoin_miter","#linejoin_round":"linejoin_round",
|
||||||
"#linejoin_bevel":"linejoin_bevel","#url_notice":"warning","#layer_up":"go_up","#layer_down":"go_down","#layer_moreopts":"context_menu","#layerlist td.layervis":"eye","#tool_source_save,#tool_docprops_save,#tool_prefs_save":"ok","#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel":"cancel","#rwidthLabel, #iwidthLabel":"width","#rheightLabel, #iheightLabel":"height","#angleLabel":"angle","#linkLabel,#tool_make_link,#tool_make_link_multi":"globe_link","#zoomLabel":"zoom","#blurLabel":"blur",
|
"#linejoin_bevel":"linejoin_bevel","#url_notice":"warning","#layer_up":"go_up","#layer_down":"go_down","#layer_moreopts":"context_menu","#layerlist td.layervis":"eye","#tool_source_save,#tool_docprops_save,#tool_prefs_save":"ok","#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel":"cancel","#rwidthLabel, #iwidthLabel":"width","#rheightLabel, #iheightLabel":"height","#angleLabel":"angle","#linkLabel,#tool_make_link,#tool_make_link_multi":"globe_link","#zoomLabel":"zoom","#blurLabel":"blur",
|
||||||
".flyout_arrow_horiz":"arrow_right","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":32,".flyout_arrow_horiz .svg_icon":5,".layer_button .svg_icon, #layerlist td.layervis .svg_icon":14,"#main_button .dropdown .svg_icon":9,"#fill_bg .svg_icon, #stroke_bg .svg_icon":24,".palette_item:first .svg_icon":16,".toolbar_button button .svg_icon":16,".stroke_tool div div .svg_icon":20,"#tools_bottom label .svg_icon":18,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});
|
".flyout_arrow_horiz":"arrow_right","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":32,".flyout_arrow_horiz .svg_icon":5,".layer_button .svg_icon, #layerlist td.layervis .svg_icon":14,"#main_button .dropdown .svg_icon":9,"#fill_bg .svg_icon, #stroke_bg .svg_icon":24,".palette_item:first .svg_icon":16,".toolbar_button button .svg_icon":16,".stroke_tool div div .svg_icon":20,"#tools_bottom label .svg_icon":18,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});
|
||||||
var q=a("#tools_left");if(q.length!=0){q.offset();q.outerHeight()}a(".tools_flyout").each(function(){var A=a("#"+this.id+"_show"),J=A.attr("data-curopt");if(!A.children("svg, img").length){J=a(J).children().clone();if(J.length){J[0].removeAttribute("style");A.append(J)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});c.canvas=f=new a.SvgCanvas(document.getElementById("svgcanvas"),
|
var q=a("#tools_left");if(q.length!=0){q.offset();q.outerHeight()}a(".tools_flyout").each(function(){var B=a("#"+this.id+"_show"),K=B.attr("data-curopt");if(!B.children("svg, img").length){K=a(K).children().clone();if(K.length){K[0].removeAttribute("style");B.append(K)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});c.canvas=f=new a.SvgCanvas(document.getElementById("svgcanvas"),
|
||||||
d);c.show_save_warning=false;V=navigator.platform.indexOf("Mac")>=0;var O=navigator.userAgent.indexOf("AppleWebKit")>=0,fa=V?"meta+":"ctrl+",sa=f.pathActions,ia=f.undoMgr,ca=svgedit.utilities,ea=d.imgPath+"placeholder.svg",qa=a("#workarea"),pa=a("#cmenu_canvas");a("#cmenu_layers");var ba=null,S=1,U="toolbars",ra="",la={fill:null,stroke:null};(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var q=a("#dialog_box"),A=a("#dialog_buttons"),
|
d);c.show_save_warning=false;V=navigator.platform.indexOf("Mac")>=0;var O=navigator.userAgent.indexOf("AppleWebKit")>=0,fa=V?"meta+":"ctrl+",sa=f.pathActions,ha=f.undoMgr,ca=svgedit.utilities,ea=d.imgPath+"placeholder.svg",qa=a("#workarea"),pa=a("#cmenu_canvas");a("#cmenu_layers");var ba=null,S=1,U="toolbars",ra="",la={fill:null,stroke:null};(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var q=a("#dialog_box"),B=a("#dialog_buttons"),
|
||||||
J=function(R,W,ha,va){a("#dialog_content").html("<p>"+W.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",R=="prompt");A.empty();var xa=a('<input type="button" value="'+e.common.ok+'">').appendTo(A);R!="alert"&&a('<input type="button" value="'+e.common.cancel+'">').appendTo(A).click(function(){q.hide();ha(false)});if(R=="prompt"){var Ca=a('<input type="text">').prependTo(A);Ca.val(va||"");Ca.bind("keydown","return",function(){xa.click()})}R=="process"&&xa.hide();q.show();xa.click(function(){q.hide();
|
K=function(R,X,ja,va){a("#dialog_content").html("<p>"+X.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",R=="prompt");B.empty();var xa=a('<input type="button" value="'+e.common.ok+'">').appendTo(B);R!="alert"&&a('<input type="button" value="'+e.common.cancel+'">').appendTo(B).click(function(){q.hide();ja(false)});if(R=="prompt"){var Ca=a('<input type="text">').prependTo(B);Ca.val(va||"");Ca.bind("keydown","return",function(){xa.click()})}R=="process"&&xa.hide();q.show();xa.click(function(){q.hide();
|
||||||
var Ba=R=="prompt"?Ca.val():true;ha&&ha(Ba)}).focus();R=="prompt"&&Ca.focus()};a.alert=function(R,W){J("alert",R,W)};a.confirm=function(R,W){J("confirm",R,W)};a.process_cancel=function(R,W){J("process",R,W)};a.prompt=function(R,W,ha){J("prompt",R,ha,W)}})();var ma=function(){var q=a(".tool_button_current");if(q.length&&q[0].id!=="tool_select"){q.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")}f.setMode("select")},
|
var Ba=R=="prompt"?Ca.val():true;ja&&ja(Ba)}).focus();R=="prompt"&&Ca.focus()};a.alert=function(R,X){K("alert",R,X)};a.confirm=function(R,X){K("confirm",R,X)};a.process_cancel=function(R,X){K("process",R,X)};a.prompt=function(R,X,ja){K("prompt",R,ja,X)}})();var ma=function(){var q=a(".tool_button_current");if(q.length&&q[0].id!=="tool_select"){q.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}")}f.setMode("select")},
|
||||||
Y=null,za=false,Ka=false,Qa=false,Ma=false,Sa="",Ya=a("title:first").text(),Na=function(q,A,J){f.getResolution();a("#svgcanvas").position();if(A=f.setBBoxZoom(A,qa.width()-15,qa.height()-15)){q=A.zoom;A=A.bbox;if(q<0.0010)Ja({value:0.1});else{a("#zoom").val(q*100);J?Sb():Sb(false,{x:A.x*q+A.width*q/2,y:A.y*q+A.height*q/2});f.getMode()=="zoom"&&A.width&&ma();w()}}};a("#cur_context_panel").delegate("a","click",function(){var q=a(this);q.attr("data-root")?f.leaveContext():f.setContext(q.text());return false});
|
Z=null,za=false,Ka=false,Qa=false,Ma=false,Sa="",Ya=a("title:first").text(),Na=function(q,B,K){f.getResolution();a("#svgcanvas").position();if(B=f.setBBoxZoom(B,qa.width()-15,qa.height()-15)){q=B.zoom;B=B.bbox;if(q<0.0010)Ja({value:0.1});else{a("#zoom").val(q*100);K?Sb():Sb(false,{x:B.x*q+B.width*q/2,y:B.y*q+B.height*q/2});f.getMode()=="zoom"&&B.width&&ma();w()}}};a("#cur_context_panel").delegate("a","click",function(){var q=a(this);q.attr("data-root")?f.leaveContext():f.setContext(q.text());return false});
|
||||||
var Ia={},Pa=function(q){a.each(q,function(A,J){var R=a(A).children(),W=A+"_show",ha=a(W),va=false;R.addClass("tool_button").unbind("click mousedown mouseup").each(function(Ba){var Aa=J[Ba];Ia[Aa.sel]=Aa.fn;if(Aa.isDefault)va=Ba;Ba=function(yb){var Ta=Aa;if(yb.type==="keydown"){var ja=a(Ta.parent+"_show").hasClass("tool_button_current"),Bb=a(Ta.parent+"_show").attr("data-curopt");a.each(q[Aa.parent],function(Ea,Va){if(Va.sel==Bb)Ta=!yb.shiftKey||!ja?Va:q[Aa.parent][Ea+1]||q[Aa.parent][0]})}if(a(this).hasClass("disabled"))return false;
|
var Ia={},Pa=function(q){a.each(q,function(B,K){var R=a(B).children(),X=B+"_show",ja=a(X),va=false;R.addClass("tool_button").unbind("click mousedown mouseup").each(function(Ba){var Aa=K[Ba];Ia[Aa.sel]=Aa.fn;if(Aa.isDefault)va=Ba;Ba=function(yb){var Ta=Aa;if(yb.type==="keydown"){var ia=a(Ta.parent+"_show").hasClass("tool_button_current"),Bb=a(Ta.parent+"_show").attr("data-curopt");a.each(q[Aa.parent],function(Ea,Va){if(Va.sel==Bb)Ta=!yb.shiftKey||!ia?Va:q[Aa.parent][Ea+1]||q[Aa.parent][0]})}if(a(this).hasClass("disabled"))return false;
|
||||||
ib(W)&&Ta.fn();var cb=Ta.icon?a.getSvgIcon(Ta.icon,true):a(Ta.sel).children().eq(0).clone();cb[0].setAttribute("width",ha.width());cb[0].setAttribute("height",ha.height());ha.children(":not(.flyout_arrow_horiz)").remove();ha.append(cb).attr("data-curopt",Ta.sel)};a(this).mouseup(Ba);Aa.key&&a(document).bind("keydown",Aa.key[0]+" shift+"+Aa.key[0],Ba)});if(va)ha.attr("data-curopt",J[va].sel);else ha.attr("data-curopt")||ha.attr("data-curopt",J[0].sel);var xa,Ca=a(W).position();a(A).css({left:Ca.left+
|
ib(X)&&Ta.fn();var cb=Ta.icon?a.getSvgIcon(Ta.icon,true):a(Ta.sel).children().eq(0).clone();cb[0].setAttribute("width",ja.width());cb[0].setAttribute("height",ja.height());ja.children(":not(.flyout_arrow_horiz)").remove();ja.append(cb).attr("data-curopt",Ta.sel)};a(this).mouseup(Ba);Aa.key&&a(document).bind("keydown",Aa.key[0]+" shift+"+Aa.key[0],Ba)});if(va)ja.attr("data-curopt",K[va].sel);else ja.attr("data-curopt")||ja.attr("data-curopt",K[0].sel);var xa,Ca=a(X).position();a(B).css({left:Ca.left+
|
||||||
34,top:Ca.top+77});ha.mousedown(function(Ba){a("#tools_shapelib").is(":visible")&&ib(W,false);if(ha.hasClass("disabled"))return false;var Aa=a(A),yb=Ca.left+34,Ta=Aa.width()*-1,ja=Aa.data("shown_popop")?200:0;xa=setTimeout(function(){ha.data("isLibrary")?Aa.css("left",yb).show():Aa.css("left",Ta).show().animate({left:yb},150);Aa.data("shown_popop",true)},ja);Ba.preventDefault()}).mouseup(function(){clearTimeout(xa);var Ba=a(this).attr("data-curopt");if(ha.data("isLibrary")&&a(W.replace("_show","")).is(":visible"))ib(W,
|
34,top:Ca.top+77});ja.mousedown(function(Ba){a("#tools_shapelib").is(":visible")&&ib(X,false);if(ja.hasClass("disabled"))return false;var Aa=a(B),yb=Ca.left+34,Ta=Aa.width()*-1,ia=Aa.data("shown_popop")?200:0;xa=setTimeout(function(){ja.data("isLibrary")?Aa.css("left",yb).show():Aa.css("left",Ta).show().animate({left:yb},150);Aa.data("shown_popop",true)},ia);Ba.preventDefault()}).mouseup(function(){clearTimeout(xa);var Ba=a(this).attr("data-curopt");if(ja.data("isLibrary")&&a(X.replace("_show","")).is(":visible"))ib(X,
|
||||||
true);else ib(W)&&Ba in Ia&&Ia[Ba]()})});Pb()},Ga=function(q,A){return a("<div>",{"class":"tools_flyout",id:q}).appendTo("#svg_editor").append(A)},Gb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show"),A=q.offset();q=q.outerWidth();a(this).css({left:(A.left+q)*S,top:A.top})})},Pb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show");if(!q.data("isLibrary")){var A=[];a(this).children().each(function(){A.push(this.title)});q[0].title=A.join(" / ")}})},ob,
|
true);else ib(X)&&Ba in Ia&&Ia[Ba]()})});Pb()},Ga=function(q,B){return a("<div>",{"class":"tools_flyout",id:q}).appendTo("#svg_editor").append(B)},Gb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show"),B=q.offset();q=q.outerWidth();a(this).css({left:(B.left+q)*S,top:B.top})})},Pb=function(){a(".tools_flyout").each(function(){var q=a("#"+this.id+"_show");if(!q.data("isLibrary")){var B=[];a(this).children().each(function(){B.push(this.title)});q[0].title=B.join(" / ")}})},nb,
|
||||||
ab=function(q,A,J){var R=null;if(q.indexOf("url(#")===0){q=(q=f.getRefElem(q))?q.cloneNode(true):a("#"+J+"_color defs *")[0];R={alpha:A};R[q.tagName]=q}else R=q.indexOf("#")===0?{alpha:A,solidColor:q.substr(1)}:{alpha:A,solidColor:"none"};return new a.jGraduate.Paint(R)},Xa=f.getResolution();if(d.baseUnit!=="px"){Xa.w=svgedit.units.convertUnit(Xa.w)+d.baseUnit;Xa.h=svgedit.units.convertUnit(Xa.h)+d.baseUnit}a(".canvas_width").val(Xa.w);a(".canvas_height").val(Xa.h);a("#docprops_button").on("click",
|
ab=function(q,B,K){var R=null;if(q.indexOf("url(#")===0){q=(q=f.getRefElem(q))?q.cloneNode(true):a("#"+K+"_color defs *")[0];R={alpha:B};R[q.tagName]=q}else R=q.indexOf("#")===0?{alpha:B,solidColor:q.substr(1)}:{alpha:B,solidColor:"none"};return new a.jGraduate.Paint(R)},Xa=f.getResolution();if(d.baseUnit!=="px"){Xa.w=svgedit.units.convertUnit(Xa.w)+d.baseUnit;Xa.h=svgedit.units.convertUnit(Xa.h)+d.baseUnit}a(".canvas_width").val(Xa.w);a(".canvas_height").val(Xa.h);a("#docprops_button").on("click",
|
||||||
function(){B()});var La=c.setImageURL=function(q){q||(q=ea);f.setImageURL(q);a("#image_url").val(q);if(q.indexOf("data:")===0){a("#image_url").hide();a("#change_image_url").show()}else{f.embedImage(q,function(A){A?a("#url_notice").hide():a("#url_notice").show();ea=q});a("#image_url").show();a("#change_image_url").hide()}},Fa=function(q){var A=Math.min(Math.max(12+q.value.length*6,50),300);a(q).width(A)},Za=function(){var q=Y;if(q!=null&&!q.parentNode)q=null;var A=f.getCurrentDrawing().getCurrentLayerName(),
|
function(){A()});var La=c.setImageURL=function(q){q||(q=ea);f.setImageURL(q);a("#image_url").val(q);if(q.indexOf("data:")===0){a("#image_url").hide();a("#change_image_url").show()}else{f.embedImage(q,function(B){B?a("#url_notice").hide():a("#url_notice").show();ea=q});a("#image_url").show();a("#change_image_url").hide()}},Fa=function(q){var B=Math.min(Math.max(12+q.value.length*6,50),300);a(q).width(B)},Za=function(){var q=Z;if(q!=null&&!q.parentNode)q=null;var B=f.getCurrentDrawing().getCurrentLayerName(),
|
||||||
J=f.getMode(),R=d.baseUnit!=="px"?d.baseUnit:null,W=J=="pathedit",ha=a("#cmenu_canvas li");a("#selected_panel, #multiselected_panel, #g_panel, #path_panel, #rect_panel, #canvas_panel, #circle_panel,\t\t\t\t\t#ellipse_panel, #line_panel, #text_panel, #image_panel, #container_panel, #use_panel, #a_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");!q&&!za&&a("#canvas_panel").show();if(q!=null){var va=q.nodeName,xa=f.getRotationAngle(q);
|
K=f.getMode(),R=d.baseUnit!=="px"?d.baseUnit:null,X=K=="pathedit",ja=a("#cmenu_canvas li");a("#selected_panel, #multiselected_panel, #g_panel, #path_panel, #rect_panel, #canvas_panel, #circle_panel,\t\t\t\t\t#ellipse_panel, #line_panel, #text_panel, #image_panel, #container_panel, #use_panel, #a_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");!q&&!za&&a("#canvas_panel").show();if(q!=null){var va=q.nodeName,xa=f.getRotationAngle(q);
|
||||||
a("#angle").val(Math.round(xa));xa=f.getBlur(q);a("#blur").val(xa);a("#blur_slider").slider("option","value",xa);f.addedNew&&va==="image"&&f.getHref(q).indexOf("data:")!==0&&L();if(!W&&J!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");if(["line","circle","ellipse"].indexOf(va)>=0)a("#xy_panel").hide();else{var Ca,Ba;if(["g","polyline","path"].indexOf(va)>=0){if(J=f.getStrokedBBox([q])){Ca=J.x;Ba=J.y}}else{Ca=q.getAttribute("x");Ba=q.getAttribute("y")}if(R){Ca=
|
a("#angle").val(Math.round(xa));xa=f.getBlur(q);a("#blur").val(xa);a("#blur_slider").slider("option","value",xa);f.addedNew&&va==="image"&&f.getHref(q).indexOf("data:")!==0&&L();if(!X&&K!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");if(["line","circle","ellipse"].indexOf(va)>=0)a("#xy_panel").hide();else{var Ca,Ba;if(["g","polyline","path"].indexOf(va)>=0){if(K=f.getStrokedBBox([q])){Ca=K.x;Ba=K.y}}else{Ca=q.getAttribute("x");Ba=q.getAttribute("y")}if(R){Ca=
|
||||||
svgedit.units.convertUnit(Ca);Ba=svgedit.units.convertUnit(Ba)}a("#selected_x").val(Math.round(Ba)||0);a("#selected_y").val(Math.round(Ca)||0);a("#xy_panel").show()}["image","text","path","g","use"].indexOf(va)==-1&&a(".action_path_convert_selected").removeClass("disabled");va==="path"&&a(".action_path_selected").removeClass("disabled")}else{A=sa.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!sa.canDeleteNodes);
|
svgedit.units.convertUnit(Ca);Ba=svgedit.units.convertUnit(Ba)}a("#selected_x").val(Math.round(Ba)||0);a("#selected_y").val(Math.round(Ca)||0);a("#xy_panel").show()}["image","text","path","g","use"].indexOf(va)==-1&&a(".action_path_convert_selected").removeClass("disabled");va==="path"&&a(".action_path_selected").removeClass("disabled")}else{B=sa.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!sa.canDeleteNodes);
|
||||||
Q("#tool_openclose_path",sa.closed_subpath?"open_path":"close_path");if(A){W=a("#seg_type");if(R){A.x=svgedit.units.convertUnit(A.x);A.y=svgedit.units.convertUnit(A.y)}a("#path_node_x").val(Math.round(A.x));a("#path_node_y").val(Math.round(A.y));A.type?W.val(A.type).removeAttr("disabled"):W.val(4).attr("disabled","disabled")}return}R={g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:[],use:[]};var Aa=
|
Q("#tool_openclose_path",sa.closed_subpath?"open_path":"close_path");if(B){X=a("#seg_type");if(R){B.x=svgedit.units.convertUnit(B.x);B.y=svgedit.units.convertUnit(B.y)}a("#path_node_x").val(Math.round(B.x));a("#path_node_y").val(Math.round(B.y));B.type?X.val(B.type).removeAttr("disabled"):X.val(4).attr("disabled","disabled")}return}R={g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:[],use:[]};var Aa=
|
||||||
q.tagName;a(q).data("gsvg")&&a("#g_panel").show();Aa=="path"&&a("#path_panel").show();if(R[Aa]){R=R[Aa];a("#"+Aa+"_panel").show();a.each(R,function(yb,Ta){var ja=q.getAttribute(Ta);if(d.baseUnit!=="px"&&q[Ta])ja=svgedit.units.convertUnit(q[Ta].baseVal.value);a("#"+Aa+"_"+Ta).val(Math.round(ja)||0)});if(Aa=="text"){a("#text_panel").css("display","inline");f.getItalic()?a("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):a("#tool_italic").removeClass("push_button_pressed").addClass("tool_button");
|
q.tagName;a(q).data("gsvg")&&a("#g_panel").show();Aa=="path"&&a("#path_panel").show();if(R[Aa]){R=R[Aa];a("#"+Aa+"_panel").show();a.each(R,function(yb,Ta){var ia=q.getAttribute(Ta);if(d.baseUnit!=="px"&&q[Ta])ia=svgedit.units.convertUnit(q[Ta].baseVal.value);a("#"+Aa+"_"+Ta).val(Math.round(ia)||0)});if(Aa=="text"){a("#text_panel").css("display","inline");f.getItalic()?a("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):a("#tool_italic").removeClass("push_button_pressed").addClass("tool_button");
|
||||||
f.getBold()?a("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):a("#tool_bold").removeClass("push_button_pressed").addClass("tool_button");a("#font_family").val(q.getAttribute("font-family"));a("#font_size").val(q.getAttribute("font-size"));a("#text").val(q.textContent);f.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(Aa=="image")La(f.getHref(q));else if(Aa==="g"||Aa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");
|
f.getBold()?a("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):a("#tool_bold").removeClass("push_button_pressed").addClass("tool_button");a("#font_family").val(q.getAttribute("font-family"));a("#font_size").val(q.getAttribute("font-size"));a("#text").val(q.textContent);f.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(Aa=="image")La(f.getHref(q));else if(Aa==="g"||Aa==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");
|
||||||
R=f.getTitle();va=a("#g_title")[0];va.value=R;Fa(va);Aa=="use"?va.setAttribute("disabled","disabled"):va.removeAttribute("disabled")}}ha[(Aa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");ha[(Aa==="g"||!za?"dis":"en")+"ableContextMenuItems"]("#group")}else if(za){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");ha.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else ha.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
|
R=f.getTitle();va=a("#g_title")[0];va.value=R;Fa(va);Aa=="use"?va.setAttribute("disabled","disabled"):va.removeAttribute("disabled")}}ja[(Aa==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");ja[(Aa==="g"||!za?"dis":"en")+"ableContextMenuItems"]("#group")}else if(za){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");ja.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else ja.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
|
||||||
ia.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");ia.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");f.addedNew=false;if(q&&!W||za){a("#selLayerNames").removeAttr("disabled").val(A);pa.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}else a("#selLayerNames").attr("disabled","disabled")};a("#text").focus(function(){});a("#text").blur(function(){});f.bind("selected",
|
ha.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");ha.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");f.addedNew=false;if(q&&!X||za){a("#selLayerNames").removeAttr("disabled").val(B);pa.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}else a("#selLayerNames").attr("disabled","disabled")};a("#text").focus(function(){});a("#text").blur(function(){});f.bind("selected",
|
||||||
function(q,A){var J=f.getMode();J==="select"&&ma();J=J=="pathedit";Y=A.length==1||A[1]==null?A[0]:null;za=A.length>=2&&A[1]!=null;if(Y!=null)if(!J){if(Y!=null)switch(Y.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var R=null,W=Y.getElementsByTagName("*"),ha=0,va=W.length;ha<va;ha++){var xa=W[ha].getAttribute("stroke-width");if(ha===0)R=xa;else if(R!==xa)R=null}a("#stroke_width").val(R===null?"":R);la.fill.update(true);la.stroke.update(true);break;default:la.fill.update(true);
|
function(q,B){var K=f.getMode();K==="select"&&ma();K=K=="pathedit";Z=B.length==1||B[1]==null?B[0]:null;za=B.length>=2&&B[1]!=null;if(Z!=null)if(!K){if(Z!=null)switch(Z.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var R=null,X=Z.getElementsByTagName("*"),ja=0,va=X.length;ja<va;ja++){var xa=X[ja].getAttribute("stroke-width");if(ja===0)R=xa;else if(R!==xa)R=null}a("#stroke_width").val(R===null?"":R);la.fill.update(true);la.stroke.update(true);break;default:la.fill.update(true);
|
||||||
la.stroke.update(true);a("#stroke_width").val(Y.getAttribute("stroke-width")||1);a("#stroke_style").val(Y.getAttribute("stroke-dasharray")||"none");R=Y.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+R).length!=0&&z(a("#linejoin_"+R)[0]);R=Y.getAttribute("stroke-linecap")||"butt";a("#linecap_"+R).length!=0&&z(a("#linecap_"+R)[0])}if(Y!=null){R=(Y.getAttribute("opacity")||1)*100;a("#group_opacity").val(R);a("#opac_slider").slider("option","value",R);a("#elem_id").val(Y.id)}lc()}a("#path_node_panel").toggle(J);
|
la.stroke.update(true);a("#stroke_width").val(Z.getAttribute("stroke-width")||1);a("#stroke_style").val(Z.getAttribute("stroke-dasharray")||"none");R=Z.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+R).length!=0&&z(a("#linejoin_"+R)[0]);R=Z.getAttribute("stroke-linecap")||"butt";a("#linecap_"+R).length!=0&&z(a("#linecap_"+R)[0])}if(Z!=null){R=(Z.getAttribute("opacity")||1)*100;a("#group_opacity").val(R);a("#opac_slider").slider("option","value",R);a("#elem_id").val(Z.id)}}a("#path_node_panel").toggle(K);
|
||||||
a("#tools_bottom_2,#tools_bottom_3").toggle(!J);if(J){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");Q("#tool_select","select_node");za=false;if(A.length)Y=A[0]}else Q("#tool_select","select");Za();f.runExtensions("selectedChanged",{elems:A,selectedElement:Y,multiselected:za})});f.bind("transition",function(q,A){var J=f.getMode(),R=A[0];if(R){za=A.length>=2&&A[1]!=null;if(!za)switch(J){case "rotate":J=
|
a("#tools_bottom_2,#tools_bottom_3").toggle(!K);if(K){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");Q("#tool_select","select_node");za=false;if(B.length)Z=B[0]}else Q("#tool_select","select");Za();f.runExtensions("selectedChanged",{elems:B,selectedElement:Z,multiselected:za})});f.bind("transition",function(q,B){var K=f.getMode(),R=B[0];if(R){za=B.length>=2&&B[1]!=null;if(!za)switch(K){case "rotate":K=
|
||||||
f.getRotationAngle(R);a("#angle").val(Math.round(J));a("#tool_reorient").toggleClass("disabled",J==0)}f.runExtensions("elementTransition",{elems:A})}});f.bind("changed",function(q,A){var J=f.getMode();J==="select"&&ma();for(var R=0;R<A.length;++R){var W=A[R];if(W&&W.tagName==="svg"){Fb();Sb()}else if(W&&Y&&Y.parentNode==null)Y=W}c.show_save_warning=true;Za();if(Y&&J==="select"){la.fill.update();la.stroke.update()}f.runExtensions("elementChanged",{elems:A})});f.bind("saved",function(q,A){c.show_save_warning=
|
f.getRotationAngle(R);a("#angle").val(Math.round(K));a("#tool_reorient").toggleClass("disabled",K==0)}f.runExtensions("elementTransition",{elems:B})}});f.bind("changed",function(q,B){var K=f.getMode();K==="select"&&ma();for(var R=0;R<B.length;++R){var X=B[R];if(X&&X.tagName==="svg"){Fb();Sb()}else if(X&&Z&&Z.parentNode==null)Z=X}c.show_save_warning=true;Za();if(Z&&K==="select"){la.fill.update();la.stroke.update()}f.runExtensions("elementChanged",{elems:B})});f.bind("saved",function(q,B){c.show_save_warning=
|
||||||
false;A='<?xml version="1.0"?>\n'+A;var J=navigator.userAgent;if(~J.indexOf("Chrome")&&a.browser.version>=533||~J.indexOf("MSIE"))s(0,true);else{var R=q.open("data:image/svg+xml;base64,"+ca.encode64(A)),W=a.pref("save_notice_done");if(W!=="all"){var ha=e.notification.saveFromBrowser.replace("%s","SVG");if(J.indexOf("Gecko/")!==-1)if(A.indexOf("<defs")!==-1){ha+="\n\n"+e.notification.defsFailOnSave;a.pref("save_notice_done","all");W="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done",
|
false;B='<?xml version="1.0"?>\n'+B;var K=navigator.userAgent;if(~K.indexOf("Chrome")&&a.browser.version>=533||~K.indexOf("MSIE"))s(0,true);else{var R=q.open("data:image/svg+xml;base64,"+ca.encode64(B)),X=a.pref("save_notice_done");if(X!=="all"){var ja=e.notification.saveFromBrowser.replace("%s","SVG");if(K.indexOf("Gecko/")!==-1)if(B.indexOf("<defs")!==-1){ja+="\n\n"+e.notification.defsFailOnSave;a.pref("save_notice_done","all");X="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done",
|
||||||
"all");W!=="part"&&R.alert(ha)}}});f.bind("exported",function(q,A){var J=A.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var R=a("#export_canvas")[0];R.width=f.contentW;R.height=f.contentH;canvg(R,A.svg,{renderCallback:function(){var W=R.toDataURL("image/png");ba.location.href=W;if(a.pref("export_notice_done")!=="all"){W=e.notification.saveFromBrowser.replace("%s","PNG");if(J.length)W+="\n\n"+e.notification.noteTheseIssues+"\n \u2022 "+J.join("\n \u2022 ");
|
"all");X!=="part"&&R.alert(ja)}}});f.bind("exported",function(q,B){var K=B.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var R=a("#export_canvas")[0];R.width=f.contentW;R.height=f.contentH;canvg(R,B.svg,{renderCallback:function(){var X=R.toDataURL("image/png");ba.location.href=X;if(a.pref("export_notice_done")!=="all"){X=e.notification.saveFromBrowser.replace("%s","PNG");if(K.length)X+="\n\n"+e.notification.noteTheseIssues+"\n \u2022 "+K.join("\n \u2022 ");
|
||||||
a.pref("export_notice_done","all");ba.alert(W)}}})});f.bind("zoomed",Na);f.bind("contextset",function(q,A){var J="";if(A){var R="";J='<a href="#" data-root="y">'+f.getCurrentDrawing().getCurrentLayerName()+"</a>";a(A).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){R+=" > "+this.id;J+=this!==A?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Sa=R}else Sa=null;a("#cur_context_panel").toggle(!!A).html(J);G()});f.bind("extension_added",function(q,A){function J(){if(ob){clearTimeout(ob);
|
a.pref("export_notice_done","all");ba.alert(X)}}})});f.bind("zoomed",Na);f.bind("contextset",function(q,B){var K="";if(B){var R="";K='<a href="#" data-root="y">'+f.getCurrentDrawing().getCurrentLayerName()+"</a>";a(B).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){R+=" > "+this.id;K+=this!==B?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Sa=R}else Sa=null;a("#cur_context_panel").toggle(!!B).html(K);G()});f.bind("extension_added",function(q,B){function K(){if(nb){clearTimeout(nb);
|
||||||
ob=null}W||(ob=setTimeout(function(){W=true;wa(b.iconsize)},50))}var R=false,W=false,ha=true,va=function(){if(A.callback&&!R&&ha){R=true;A.callback()}},xa=[];A.context_tools&&a.each(A.context_tools,function(Ta,ja){var Bb=ja.container_id?' id="'+ja.container_id+'"':"",cb=a("#"+ja.panel);cb.length||(cb=a("<div>",{id:ja.panel}).appendTo("#tools_top"));switch(ja.type){case "tool_button":var Ea='<div class="tool_button">'+ja.id+"</div>",Va=a(Ea).appendTo(cb);ja.events&&a.each(ja.events,function(eb,lb){a(Va).bind(eb,
|
nb=null}X||(nb=setTimeout(function(){X=true;wa(b.iconsize)},50))}var R=false,X=false,ja=true,va=function(){if(B.callback&&!R&&ja){R=true;B.callback()}},xa=[];B.context_tools&&a.each(B.context_tools,function(Ta,ia){var Bb=ia.container_id?' id="'+ia.container_id+'"':"",cb=a("#"+ia.panel);cb.length||(cb=a("<div>",{id:ia.panel}).appendTo("#tools_top"));switch(ia.type){case "tool_button":var Ea='<div class="tool_button">'+ia.id+"</div>",Va=a(Ea).appendTo(cb);ia.events&&a.each(ia.events,function(db,lb){a(Va).bind(db,
|
||||||
lb)});break;case "select":Ea="<label"+Bb+'><select id="'+ja.id+'">';a.each(ja.options,function(eb,lb){Ea+='<option value="'+eb+'"'+(eb==ja.defval?" selected":"")+">"+lb+"</option>"});Ea+="</select></label>";var Ha=a(Ea).appendTo(cb).find("select");a.each(ja.events,function(eb,lb){a(Ha).bind(eb,lb)});break;case "button-select":Ea='<div id="'+ja.id+'" class="dropdown toolset" title="'+ja.title+'"><div id="cur_'+ja.id+'" class="icon_label"></div><button></button></div>';Bb=a('<ul id="'+ja.id+'_opts"></ul>').appendTo("#option_lists");
|
lb)});break;case "select":Ea="<label"+Bb+'><select id="'+ia.id+'">';a.each(ia.options,function(db,lb){Ea+='<option value="'+db+'"'+(db==ia.defval?" selected":"")+">"+lb+"</option>"});Ea+="</select></label>";var Ha=a(Ea).appendTo(cb).find("select");a.each(ia.events,function(db,lb){a(Ha).bind(db,lb)});break;case "button-select":Ea='<div id="'+ia.id+'" class="dropdown toolset" title="'+ia.title+'"><div id="cur_'+ia.id+'" class="icon_label"></div><button></button></div>';Bb=a('<ul id="'+ia.id+'_opts"></ul>').appendTo("#option_lists");
|
||||||
ja.colnum&&Bb.addClass("optcols"+ja.colnum);a(Ea).appendTo(cb).children();xa.push({elem:"#"+ja.id,list:"#"+ja.id+"_opts",title:ja.title,callback:ja.events.change,cur:"#cur_"+ja.id});break;case "input":Ea="<label"+Bb+'><span id="'+ja.id+'_label">'+ja.label+':</span><input id="'+ja.id+'" title="'+ja.title+'" size="'+(ja.size||"4")+'" value="'+(ja.defval||"")+'" type="text"/></label>';var kb=a(Ea).appendTo(cb).find("input");ja.spindata&&kb.SpinButton(ja.spindata);ja.events&&a.each(ja.events,function(eb,
|
ia.colnum&&Bb.addClass("optcols"+ia.colnum);a(Ea).appendTo(cb).children();xa.push({elem:"#"+ia.id,list:"#"+ia.id+"_opts",title:ia.title,callback:ia.events.change,cur:"#cur_"+ia.id});break;case "input":Ea="<label"+Bb+'><span id="'+ia.id+'_label">'+ia.label+':</span><input id="'+ia.id+'" title="'+ia.title+'" size="'+(ia.size||"4")+'" value="'+(ia.defval||"")+'" type="text"/></label>';var kb=a(Ea).appendTo(cb).find("input");ia.spindata&&kb.SpinButton(ia.spindata);ia.events&&a.each(ia.events,function(db,
|
||||||
lb){kb.bind(eb,lb)})}});if(A.buttons){var Ca={},Ba={},Aa=A.svgicons,yb={};a.each(A.buttons,function(Ta,ja){for(var Bb,cb=ja.id,Ea=Ta;a("#"+cb).length;)cb=ja.id+"_"+ ++Ea;if(Aa){Ca[cb]=ja.icon;Ea=ja.svgicon?ja.svgicon:ja.id;if(ja.type=="app_menu")Ba["#"+cb+" > div"]=Ea;else Ba["#"+cb]=Ea}else Bb=ja.type=="menu"?"":a('<img src="'+ja.icon+'">');var Va,Ha;switch(ja.type){case "mode_flyout":case "mode":Va="tool_button";if(ja.cls)Va+=" "+ja.cls;Ha="#tools_left";break;case "context":Va="tool_button";Ha=
|
lb){kb.bind(db,lb)})}});if(B.buttons){var Ca={},Ba={},Aa=B.svgicons,yb={};a.each(B.buttons,function(Ta,ia){for(var Bb,cb=ia.id,Ea=Ta;a("#"+cb).length;)cb=ia.id+"_"+ ++Ea;if(Aa){Ca[cb]=ia.icon;Ea=ia.svgicon?ia.svgicon:ia.id;if(ia.type=="app_menu")Ba["#"+cb+" > div"]=Ea;else Ba["#"+cb]=Ea}else Bb=ia.type=="menu"?"":a('<img src="'+ia.icon+'">');var Va,Ha;switch(ia.type){case "mode_flyout":case "mode":Va="tool_button";if(ia.cls)Va+=" "+ia.cls;Ha="#tools_left";break;case "context":Va="tool_button";Ha=
|
||||||
"#"+ja.panel;a(Ha).length||a("<div>",{id:ja.panel}).appendTo("#tools_top");break;case "menu":Va="menu_item tool_button";Ha="#"+(ja.after||ja.panel);break;case "app_menu":Va="";Ha=ja.parent||"#main_menu ul";a(Ha).length||a("<div>",{id:ja.panel}).appendTo("#tools_top")}var kb=a(ja.list||ja.type=="app_menu"?"<li/>":"<div/>").attr("id",cb).attr("title",ja.title).addClass(Va);if(!ja.includeWith&&!ja.list){if("position"in ja)a(Ha).children().eq(ja.position).before(kb);else ja.type!="menu"||!ja.after?kb.appendTo(Ha):
|
"#"+ia.panel;a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top");break;case "menu":Va="menu_item tool_button";Ha="#"+(ia.after||ia.panel);break;case "app_menu":Va="";Ha=ia.parent||"#main_menu ul";a(Ha).length||a("<div>",{id:ia.panel}).appendTo("#tools_top")}var kb=a(ia.list||ia.type=="app_menu"?"<li/>":"<div/>").attr("id",cb).attr("title",ia.title).addClass(Va);if(!ia.includeWith&&!ia.list){if("position"in ia)a(Ha).children().eq(ia.position).before(kb);else ia.type!="menu"||!ia.after?kb.appendTo(Ha):
|
||||||
a(Ha).after(kb);if(ja.type=="mode_flyout"){Ea=a(kb);Va=Ea.parent();if(!Ea.parent().hasClass("tools_flyout")){var eb=Ea[0].id.replace("tool_","tools_"),lb=Ea.clone().attr("id",eb+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Ea.before(lb);Va=Ga(eb,Ea);Va.data("isLibrary",true);lb.data("isLibrary",true)}Ba["#"+eb+"_show"]=ja.id;cb=yb["#"+Va[0].id]=[{sel:"#"+cb,fn:ja.events.click,icon:ja.id,isDefault:true},Xb]}else if(ja.type=="app_menu"||ja.type=="menu")kb.append(ja.title)}else if(ja.list){kb.addClass("push_button");
|
a(Ha).after(kb);if(ia.type=="mode_flyout"){Ea=a(kb);Va=Ea.parent();if(!Ea.parent().hasClass("tools_flyout")){var db=Ea[0].id.replace("tool_","tools_"),lb=Ea.clone().attr("id",db+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Ea.before(lb);Va=Ga(db,Ea);Va.data("isLibrary",true);lb.data("isLibrary",true)}Ba["#"+db+"_show"]=ia.id;cb=yb["#"+Va[0].id]=[{sel:"#"+cb,fn:ia.events.click,icon:ia.id,isDefault:true},Xb]}else if(ia.type=="app_menu"||ia.type=="menu")kb.append(ia.title)}else if(ia.list){kb.addClass("push_button");
|
||||||
a("#"+ja.list+"_opts").append(kb);if(ja.isDefault){a("#cur_"+ja.list).append(kb.children().clone());Ea=ja.svgicon?ja.svgicon:ja.id;Ba["#cur_"+ja.list]=Ea}}else if(ja.includeWith){Ha=ja.includeWith;Ea=a(Ha.button);Va=Ea.parent();if(!Ea.parent().hasClass("tools_flyout")){eb=Ea[0].id.replace("tool_","tools_");lb=Ea.clone().attr("id",eb+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Ea.before(lb);Va=Ga(eb,Ea)}var Xb=pc.getButtonData(Ha.button);if(Ha.isDefault)Ba["#"+eb+"_show"]=ja.id;cb=yb["#"+
|
a("#"+ia.list+"_opts").append(kb);if(ia.isDefault){a("#cur_"+ia.list).append(kb.children().clone());Ea=ia.svgicon?ia.svgicon:ia.id;Ba["#cur_"+ia.list]=Ea}}else if(ia.includeWith){Ha=ia.includeWith;Ea=a(Ha.button);Va=Ea.parent();if(!Ea.parent().hasClass("tools_flyout")){db=Ea[0].id.replace("tool_","tools_");lb=Ea.clone().attr("id",db+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));Ea.before(lb);Va=Ga(db,Ea)}var Xb=oc.getButtonData(Ha.button);if(Ha.isDefault)Ba["#"+db+"_show"]=ia.id;cb=yb["#"+
|
||||||
Va[0].id]=[{sel:"#"+cb,fn:ja.events.click,icon:ja.id,key:ja.key,isDefault:ja.includeWith?ja.includeWith.isDefault:0},Xb];eb="position"in Ha?Ha.position:"last";Xb=Va.children().length;if(!isNaN(eb)&&eb>=0&&eb<Xb)Va.children().eq(eb).before(kb);else{Va.append(kb);cb.reverse()}}Aa||kb.append(Bb);ja.list||a.each(ja.events,function(Ob,Wb){if(Ob=="click")if(ja.type=="mode"){ja.includeWith?kb.bind(Ob,Wb):kb.bind(Ob,function(){ib(kb)&&Wb()});if(ja.key){a(document).bind("keydown",ja.key,Wb);ja.title&&kb.attr("title",
|
Va[0].id]=[{sel:"#"+cb,fn:ia.events.click,icon:ia.id,key:ia.key,isDefault:ia.includeWith?ia.includeWith.isDefault:0},Xb];db="position"in Ha?Ha.position:"last";Xb=Va.children().length;if(!isNaN(db)&&db>=0&&db<Xb)Va.children().eq(db).before(kb);else{Va.append(kb);cb.reverse()}}Aa||kb.append(Bb);ia.list||a.each(ia.events,function(Ob,Wb){if(Ob=="click")if(ia.type=="mode"){ia.includeWith?kb.bind(Ob,Wb):kb.bind(Ob,function(){ib(kb)&&Wb()});if(ia.key){a(document).bind("keydown",ia.key,Wb);ia.title&&kb.attr("title",
|
||||||
ja.title+" ["+ja.key+"]")}}else kb.bind(Ob,Wb);else kb.bind(Ob,Wb)});Pa(yb)});a.each(xa,function(){zb(this.elem,this.list,this.callback,{seticon:true})});if(Aa)ha=false;a.svgIcons(Aa,{w:24,h:24,id_match:false,no_img:!O,fallback:Ca,placement:Ba,callback:function(){b.iconsize&&b.iconsize!="m"&&J();ha=true;va()}})}va()});f.textActions.setInputElem(a("#text")[0]);var Ra='<div class="palette_item" data-rgb="#none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00",
|
ia.title+" ["+ia.key+"]")}}else kb.bind(Ob,Wb);else kb.bind(Ob,Wb)});Pa(yb)});a.each(xa,function(){zb(this.elem,this.list,this.callback,{seticon:true})});if(Aa)ja=false;a.svgIcons(Aa,{w:24,h:24,id_match:false,no_img:!O,fallback:Ca,placement:Ba,callback:function(){b.iconsize&&b.iconsize!="m"&&K();ja=true;va()}})}va()});f.textActions.setInputElem(a("#text")[0]);var Ra='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00",
|
||||||
"#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(q,A){Ra+='<div class="palette_item" style="background-color: '+A+';" data-rgb="'+A+'"></div>'});a("#palette").append(Ra);Ra="";a.each(["#FFF","#888","#000"],function(){Ra+='<div class="color_block" style="background-color:'+
|
"#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(q,B){Ra+='<div class="palette_item" style="background-color: '+B+';" data-rgb="'+B+'"></div>'});a("#palette").append(Ra);Ra="";a.each(["#FFF","#888","#000"],function(){Ra+='<div class="color_block" style="background-color:'+
|
||||||
this+';"></div>'});a("#bg_blocks").append(Ra);var $a=a("#bg_blocks div");$a.each(function(){a(this).click(function(){$a.removeClass("cur_background");a(this).addClass("cur_background")})});if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),a.pref("bkgd_url"));else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));if(a.pref("img_save")){b.img_save=a.pref("img_save");a("#image_save_opts input").val([b.img_save])}var Ja=function(q){var A=q.value/100;if(A<0.0010)q.value=0.1;else{q=f.getZoom();Na(window,
|
this+';"></div>'});a("#bg_blocks").append(Ra);var $a=a("#bg_blocks div");$a.each(function(){a(this).click(function(){$a.removeClass("cur_background");a(this).addClass("cur_background")})});if(a.pref("bkgd_color"))p(a.pref("bkgd_color"),a.pref("bkgd_url"));else a.pref("bkgd_url")&&p(o.bkgd_color,a.pref("bkgd_url"));if(a.pref("img_save")){b.img_save=a.pref("img_save");a("#image_save_opts input").val([b.img_save])}var Ja=function(q){var B=q.value/100;if(B<0.0010)q.value=0.1;else{q=f.getZoom();Na(window,
|
||||||
{width:0,height:0,x:(qa[0].scrollLeft+qa.width()/2)/q,y:(qa[0].scrollTop+qa.height()/2)/q,zoom:A},true)}},pb=function(q,A){if(A==null)A=q.value;a("#group_opacity").val(A);if(!q||!q.handle)a("#opac_slider").slider("option","value",A);f.setOpacity(A/100)},Cb=function(q,A,J){if(A==null)A=q.value;a("#blur").val(A);var R=false;if(!q||!q.handle){a("#blur_slider").slider("option","value",A);R=true}J?f.setBlurNoUndo(A):f.setBlur(A,R)},db=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};
|
{width:0,height:0,x:(qa[0].scrollLeft+qa.width()/2)/q,y:(qa[0].scrollTop+qa.height()/2)/q,zoom:B},true)}},ob=function(q,B){if(B==null)B=q.value;a("#group_opacity").val(B);if(!q||!q.handle)a("#opac_slider").slider("option","value",B);f.setOpacity(B/100)},Cb=function(q,B,K){if(B==null)B=q.value;a("#blur").val(B);var R=false;if(!q||!q.handle){a("#blur_slider").slider("option","value",B);R=true}K?f.setBlurNoUndo(B):f.setBlur(B,R)},eb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};
|
||||||
a("#stroke_style").change(function(){f.setStrokeAttr("stroke-dasharray",a(this).val());db()});a("#stroke_linejoin").change(function(){f.setStrokeAttr("stroke-linejoin",a(this).val());db()});a("select").change(function(){a(this).blur()});var hb=false;a("#selLayerNames").change(function(){var q=this.options[this.selectedIndex].value,A=e.notification.QmoveElemsToLayer.replace("%s",q),J=function(R){if(R){hb=true;f.moveSelectedToLayer(q);f.clearSelection();Fb()}};if(q)hb?J(true):a.confirm(A,J)});a("#font_family").change(function(){f.setFontFamily(this.value)});
|
a("#stroke_style").change(function(){f.setStrokeAttr("stroke-dasharray",a(this).val());eb()});a("#stroke_linejoin").change(function(){f.setStrokeAttr("stroke-linejoin",a(this).val());eb()});a("select").change(function(){a(this).blur()});var hb=false;a("#selLayerNames").change(function(){var q=this.options[this.selectedIndex].value,B=e.notification.QmoveElemsToLayer.replace("%s",q),K=function(R){if(R){hb=true;f.moveSelectedToLayer(q);f.clearSelection();Fb()}};if(q)hb?K(true):a.confirm(B,K)});a("#font_family").change(function(){f.setFontFamily(this.value)});
|
||||||
a("#seg_type").change(function(){f.setSegType(a(this).val())});a("#text").keyup(function(){f.setTextContent(this.value)});a("#image_url").change(function(){La(this.value)});a("#link_url").change(function(){this.value.length?f.setLinkURL(this.value):f.removeHyperlink()});a("#g_title").change(function(){f.setGroupTitle(this.value)});a(".attr_changer").change(function(){var q=this.getAttribute("data-attr"),A=this.value;if(svgedit.units.isValidUnit(q,A,Y))this.blur();else{a.alert(e.notification.invalidAttrValGiven);
|
a("#seg_type").change(function(){f.setSegType(a(this).val())});a("#text").keyup(function(){f.setTextContent(this.value)});a("#image_url").change(function(){La(this.value)});a("#link_url").change(function(){this.value.length?f.setLinkURL(this.value):f.removeHyperlink()});a("#g_title").change(function(){f.setGroupTitle(this.value)});a(".attr_changer").change(function(){var q=this.getAttribute("data-attr"),B=this.value;if(svgedit.units.isValidUnit(q,B,Z))this.blur();else{a.alert(e.notification.invalidAttrValGiven);
|
||||||
this.value=Y.getAttribute(q);return false}if(q!=="id")if(isNaN(A))A=f.convertToNum(q,A);else if(d.baseUnit!=="px"){var J=svgedit.units.getTypeMap();if(Y[q]||f.getMode()==="pathedit"||q==="x"||q==="y")A*=J[d.baseUnit]}if(q==="id"){q=Y;f.clearSelection();q.id=A;f.addToSelection([q],true)}else f.changeSelectedAttribute(q,A);this.blur()});a("#palette").mouseover(function(){var q=a('<input type="hidden">');a(this).append(q);q.focus().remove()});a(".palette_item").mousedown(function(){var q=a("#tool_stroke").hasClass("active"),
|
this.value=Z.getAttribute(q);return false}if(q!=="id")if(isNaN(B))B=f.convertToNum(q,B);else if(d.baseUnit!=="px"){var K=svgedit.units.getTypeMap();if(Z[q]||f.getMode()==="pathedit"||q==="x"||q==="y")B*=K[d.baseUnit]}if(q==="id"){q=Z;f.clearSelection();q.id=B;f.addToSelection([q],true)}else f.changeSelectedAttribute(q,B);this.blur()});a("#palette").mouseover(function(){var q=a('<input type="hidden">');a(this).append(q);q.focus().remove()});a(".palette_item").mousedown(function(){var q=a("#tool_stroke").hasClass("active"),
|
||||||
A=q?"stroke":"fill",J=a(this).attr("data-rgb"),R=null;console.log(J);if(J==="transparent"||J==="initial"||J==="#none"){J="none";R=new a.jGraduate.Paint}else R=new a.jGraduate.Paint({alpha:100,solidColor:J.substr(1)});la[A].setPaint(R);if(q){f.setColor("stroke",J);J!="none"&&f.getStrokeOpacity()!=1&&f.setPaintOpacity("stroke",1)}else{f.setColor("fill",J);J!="none"&&f.getFillOpacity()!=1&&f.setPaintOpacity("fill",1)}lc()}).bind("contextmenu",function(q){q.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
|
B=q?"stroke":"fill",K=a(this).attr("data-rgb"),R=null;console.log(K);if(K==="transparent"||K==="initial"||K==="#none"){K="none";R=new a.jGraduate.Paint}else R=new a.jGraduate.Paint({alpha:100,solidColor:K.substr(1)});la[B].setPaint(R);if(q){f.setColor("stroke",K);K!="none"&&f.getStrokeOpacity()!=1&&f.setPaintOpacity("stroke",1)}else{f.setColor("fill",K);K!="none"&&f.getFillOpacity()!=1&&f.setPaintOpacity("fill",1)}}).bind("contextmenu",function(q){q.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
|
||||||
"table-cell");a(this).addClass("expanded");ub()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");ub()});var ib=function(q,A){if(a(q).hasClass("disabled"))return false;if(a(q).parent().hasClass("tools_flyout"))return true;var J=J||"normal";A||a(".tools_flyout").fadeOut(J);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(q).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var q=
|
"table-cell");a(this).addClass("expanded");ub()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");ub()});var ib=function(q,B){if(a(q).hasClass("disabled"))return false;if(a(q).parent().hasClass("tools_flyout"))return true;var K=K||"normal";B||a(".tools_flyout").fadeOut(K);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(q).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var q=
|
||||||
null,A=null,J=qa[0],R=false,W=false;a("#svgcanvas").bind("mousemove mouseup",function(ha){if(R!==false){J.scrollLeft-=ha.clientX-q;J.scrollTop-=ha.clientY-A;q=ha.clientX;A=ha.clientY;if(ha.type==="mouseup")R=false;return false}}).mousedown(function(ha){if(ha.button===1||W===true){R=true;q=ha.clientX;A=ha.clientY;return false}});a(window).mouseup(function(){R=false});a(document).bind("keydown","space",function(ha){f.spaceKey=W=true;ha.preventDefault()}).bind("keyup","space",function(ha){ha.preventDefault();
|
null,B=null,K=qa[0],R=false,X=false;a("#svgcanvas").bind("mousemove mouseup",function(ja){if(R!==false){K.scrollLeft-=ja.clientX-q;K.scrollTop-=ja.clientY-B;q=ja.clientX;B=ja.clientY;if(ja.type==="mouseup")R=false;return false}}).mousedown(function(ja){if(ja.button===1||X===true){R=true;q=ja.clientX;B=ja.clientY;return false}});a(window).mouseup(function(){R=false});a(document).bind("keydown","space",function(ja){f.spaceKey=X=true;ja.preventDefault()}).bind("keyup","space",function(ja){ja.preventDefault();
|
||||||
f.spaceKey=W=false}).bind("keydown","alt",function(){f.getMode()==="zoom"&&qa.addClass("out")}).bind("keyup","alt",function(){f.getMode()==="zoom"&&qa.removeClass("out")})})();var Da=a(".menu"),xb=function(q){q.target.style.background="#fff";setTimeout(function(){q.target.style.background="#ddd"},50);setTimeout(function(){q.target.style.background="#fff"},150);setTimeout(function(){q.target.style.background="#ddd"},200);setTimeout(function(){q.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},
|
f.spaceKey=X=false}).bind("keydown","alt",function(){f.getMode()==="zoom"&&qa.addClass("out")}).bind("keyup","alt",function(){f.getMode()==="zoom"&&qa.removeClass("out")})})();var Da=a(".menu"),xb=function(q){q.target.style.background="#fff";setTimeout(function(){q.target.style.background="#ddd"},50);setTimeout(function(){q.target.style.background="#fff"},150);setTimeout(function(){q.target.style.background="#ddd"},200);setTimeout(function(){q.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},
|
||||||
220);return false};a(".menu_item").live("click",function(q){xb(q)});a("svg, body").on("click",function(q){top!=self&&!q.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(!a(q.target).hasClass("menu_title")&&a("#menu_bar").hasClass("active"))if(!a(q.target).hasClass("disabled")&&a(q.target).hasClass("menu_item"))xb(q);else{a("#menu_bar").removeClass("active");a(".tools_flyout").hide();a("input").blur()}});var mb=[6,12,16,33,50,66,100,150,200,300,400,600,800,
|
220);return false};a(".menu_item").live("click",function(q){xb(q)});a("svg, body").on("mousedown",function(q){top!=self&&!q.isTrigger&&typeof top.exports.setEditorFocus=="function"&&top.exports.setEditorFocus();if(!a(q.target).hasClass("menu_title"))if(!a(q.target).hasClass("disabled")&&a(q.target).hasClass("menu_item"))xb(q);else{a("#tools_shapelib").is(":visible")&&!a(q.target).parents("#tools_shapelib_show, #tools_shapelib").length&&a("#tools_shapelib").hide();q.target.nodeName.toLowerCase()!=
|
||||||
1200];a("#workarea").on("mousewheel",function(q,A,J,R){if(q.altKey){q.preventDefault();q=f.getZoom()*100;A=mb.length;for(gb=0;gb<A;gb++){J=Math.min(A,gb+1);if(R>0)zoom=mb[gb]<=q?mb[J]:zoom;if(R<0)zoom=mb[gb]<q?mb[gb]:zoom}zoom&&Ja({value:zoom})}});a(".menu_title").on("click",function(){a("#menu_bar").toggleClass("active")});a(".menu_title").on("mouseover",function(){Da.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(q,A,J){if(a(q).length!=0){var R=a(q).find("button"),
|
"input"&&a("input").blur()}});var mb=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(q,B,K,R){if(q.altKey){q.preventDefault();q=f.getZoom()*100;B=mb.length;for(gb=0;gb<B;gb++){K=Math.min(B,gb+1);if(R>0)zoom=mb[gb]<=q?mb[K]:zoom;if(R<0)zoom=mb[gb]<q?mb[gb]:zoom}zoom&&Ja({value:zoom})}});a(".menu_title").on("click",function(){a("#menu_bar").toggleClass("active")});a(".menu_title").on("mouseover",function(){Da.removeClass("open");a(this).parent().addClass("open")});
|
||||||
W=a(q).find("ul").attr("id",a(q)[0].id+"-list");J||a("#option_lists").append(W);var ha=false;J&&a(q).addClass("dropup");W.find("li").bind("mouseup",A);a(window).mouseup(function(){if(!ha){R.removeClass("down");W.hide()}ha=false});R.bind("mousedown",function(){if(R.hasClass("down")){R.removeClass("down");W.hide()}else{R.addClass("down");if(!J){var va=a(q).offset();W.css({top:va.top,left:va.left-110})}W.show();ha=true}}).hover(function(){ha=true}).mouseout(function(){ha=false})}};var zb=function(q,
|
c.addDropDown=function(q,B,K){if(a(q).length!=0){var R=a(q).find("button"),X=a(q).find("ul").attr("id",a(q)[0].id+"-list");K||a("#option_lists").append(X);var ja=false;K&&a(q).addClass("dropup");X.find("li").bind("mouseup",B);a(window).mouseup(function(){if(!ja){R.removeClass("down");X.hide()}ja=false});R.bind("mousedown",function(){if(R.hasClass("down")){R.removeClass("down");X.hide()}else{R.addClass("down");if(!K){var va=a(q).offset();X.css({top:va.top,left:va.left-110})}X.show();ja=true}}).hover(function(){ja=
|
||||||
A,J,R){var W=a(q);A=a(A);var ha=false,va=R.dropUp;va&&a(q).addClass("dropup");A.find("li").bind("mouseup",function(){if(R.seticon){Q("#cur_"+W[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}J.apply(this,arguments)});a(window).mouseup(function(){if(!ha){W.removeClass("down");A.hide();A.css({top:0,left:0})}ha=false});A.height();a(q).bind("mousedown",function(){var xa=a(q).offset();if(va){xa.top-=A.height();xa.left+=8}else xa.top+=a(q).height();a(A).offset(xa);
|
true}).mouseout(function(){ja=false})}};var zb=function(q,B,K,R){var X=a(q);B=a(B);var ja=false,va=R.dropUp;va&&a(q).addClass("dropup");B.find("li").bind("mouseup",function(){if(R.seticon){Q("#cur_"+X[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}K.apply(this,arguments)});a(window).mouseup(function(){if(!ja){X.removeClass("down");B.hide();B.css({top:0,left:0})}ja=false});B.height();a(q).bind("mousedown",function(){var xa=a(q).offset();if(va){xa.top-=B.height();
|
||||||
if(W.hasClass("down")){W.removeClass("down");A.hide();A.css({top:0,left:0})}else{W.addClass("down");A.show();ha=true;return false}}).hover(function(){ha=true}).mouseout(function(){ha=false});R.multiclick&&A.mousedown(function(){ha=true})};c.addDropDown("#font_family_dropdown",function(){a(this).text();a("#font_family").val(a(this).text()).change()});c.addDropDown("#opacity_dropdown",function(){if(!a(this).find("div").length){var q=parseInt(a(this).text().split("%")[0]);pb(false,q)}},false);a("#opac_slider").slider({start:function(){a("#opacity_dropdown li:not(.special)").hide()},
|
xa.left+=8}else xa.top+=a(q).height();a(B).offset(xa);if(X.hasClass("down")){X.removeClass("down");B.hide();B.css({top:0,left:0})}else{X.addClass("down");B.show();ja=true;return false}}).hover(function(){ja=true}).mouseout(function(){ja=false});R.multiclick&&B.mousedown(function(){ja=true})};c.addDropDown("#font_family_dropdown",function(){a(this).text();a("#font_family").val(a(this).text()).change()});c.addDropDown("#opacity_dropdown",function(){if(!a(this).find("div").length){var q=parseInt(a(this).text().split("%")[0]);
|
||||||
stop:function(){a("#opacity_dropdown li").show();a(window).mouseup()},slide:function(q,A){pb(A)}});c.addDropDown("#blur_dropdown",a.noop);var Db=false;a("#blur_slider").slider({max:10,step:0.1,stop:function(q,A){Db=false;Cb(A);a("#blur_dropdown li").show();a(window).mouseup()},start:function(){Db=true},slide:function(q,A){Cb(A,null,Db)}});c.addDropDown("#zoom_dropdown",function(){var q=a(this),A=q.attr("data-val");A?Na(window,A):Ja({value:parseInt(q.text())})},true);zb("#stroke_linecap","#linecap_opts",
|
ob(false,q)}},false);a("#opac_slider").slider({start:function(){a("#opacity_dropdown li:not(.special)").hide()},stop:function(){a("#opacity_dropdown li").show();a(window).mouseup()},slide:function(q,B){ob(B)}});c.addDropDown("#blur_dropdown",a.noop);var Db=false;a("#blur_slider").slider({max:10,step:0.1,stop:function(q,B){Db=false;Cb(B);a("#blur_dropdown li").show();a(window).mouseup()},start:function(){Db=true},slide:function(q,B){Cb(B,null,Db)}});c.addDropDown("#zoom_dropdown",function(){var q=
|
||||||
function(){z(this,true)},{dropUp:true});zb("#stroke_linejoin","#linejoin_opts",function(){z(this,true)},{dropUp:true});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var q=this.id.replace("tool_pos","").charAt(0);f.alignSelectedElements(q,"page")})});(function(){var q,A=function(){a(q).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){q=this;U="toolbars";qa.mousedown(A)}).blur(function(){U="canvas";qa.unbind("mousedown",A);f.getMode()==
|
a(this),B=q.attr("data-val");B?Na(window,B):Ja({value:parseInt(q.text())})},true);zb("#stroke_linecap","#linecap_opts",function(){z(this,true)},{dropUp:true});zb("#stroke_linejoin","#linejoin_opts",function(){z(this,true)},{dropUp:true});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var q=this.id.replace("tool_pos","").charAt(0);f.alignSelectedElements(q,"page")})});(function(){var q,B=function(){a(q).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){q=
|
||||||
"textedit"&&a("#text").focus()})})();var nb=function(){if(ib("#tool_select")){f.setMode("select");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}")}},Eb=function(){ib("#tool_fhpath")&&f.setMode("fhpath")},Kb=function(){ib("#tool_line")&&f.setMode("line")},Ib=function(){ib("#tool_rect")&&f.setMode("rect")},Qb=function(){ib("#tool_ellipse")&&f.setMode("ellipse")},na=function(){ib("#tool_image")&&f.setMode("image")},aa=function(){ib("#tool_zoom")&&
|
this;U="toolbars";qa.mousedown(B)}).blur(function(){U="canvas";qa.unbind("mousedown",B);f.getMode()=="textedit"&&a("#text").focus()})})();var pb=function(){if(ib("#tool_select")){f.setMode("select");a("#styleoverrides").text("#svgcanvas svg *{cursor:move;pointer-events:all}, #svgcanvas svg{cursor:default}")}},Eb=function(){ib("#tool_fhpath")&&f.setMode("fhpath")},Kb=function(){ib("#tool_line")&&f.setMode("line")},Ib=function(){ib("#tool_rect")&&f.setMode("rect")},Qb=function(){ib("#tool_ellipse")&&
|
||||||
f.setMode("zoom")},ta=function(){if(ib("#tool_zoom")){k();ma()}},M=function(){ib("#tool_text")&&f.setMode("text")},I=function(){ib("#tool_path")&&f.setMode("path")},X=function(){if(Y!=null||za)f.deleteSelectedElements()},Oa=function(){if(Y!=null||za)f.cutSelectedElements()},Wa=function(){if(Y!=null||za)f.copySelectedElements()},fb=function(){var q=f.getZoom(),A=(qa[0].scrollLeft+qa.width()/2)/q-f.contentW;q=(qa[0].scrollTop+qa.height()/2)/q-f.contentH;f.pasteElements("point",A,q)},tb=function(){Y!=
|
f.setMode("ellipse")},na=function(){ib("#tool_image")&&f.setMode("image")},aa=function(){ib("#tool_zoom")&&f.setMode("zoom")},ta=function(){if(ib("#tool_zoom")){k();ma()}},M=function(){ib("#tool_text")&&f.setMode("text")},I=function(){ib("#tool_path")&&f.setMode("path")},Y=function(){if(Z!=null||za)f.deleteSelectedElements()},Oa=function(){if(Z!=null||za)f.cutSelectedElements()},Wa=function(){if(Z!=null||za)f.copySelectedElements()},fb=function(){var q=f.getZoom(),B=(qa[0].scrollLeft+qa.width()/2)/
|
||||||
null&&f.moveToTopSelectedElement()},wb=function(){Y!=null&&f.moveToBottomSelectedElement()},Hb=function(){Y!=null&&f.moveUpDownSelected("Up")},rb=function(){Y!=null&&f.moveUpDownSelected("Down")},Nb=function(){Y!=null&&f.convertToPath()},bb=function(){Y!=null&&sa.reorient()},Jb=function(){if(Y!=null||za)a.prompt(e.notification.enterNewLinkURL,"http://",function(q){q&&f.makeHyperlink(q)})},vb=function(q,A){if(Y!=null||za){if(d.gridSnapping){var J=f.getZoom()*d.snappingStep;q*=J;A*=J}f.moveSelectedElements(q,
|
q-f.contentW;q=(qa[0].scrollTop+qa.height()/2)/q-f.contentH;f.pasteElements("point",B,q)},tb=function(){Z!=null&&f.moveToTopSelectedElement()},wb=function(){Z!=null&&f.moveToBottomSelectedElement()},Hb=function(){Z!=null&&f.moveUpDownSelected("Up")},rb=function(){Z!=null&&f.moveUpDownSelected("Down")},Nb=function(){Z!=null&&f.convertToPath()},bb=function(){Z!=null&&sa.reorient()},Jb=function(){if(Z!=null||za)a.prompt(e.notification.enterNewLinkURL,"http://",function(q){q&&f.makeHyperlink(q)})},vb=
|
||||||
A)}},$b=function(){var q=!a("#tool_node_link").hasClass("push_button_pressed");q?a("#tool_node_link").addClass("push_button_pressed").removeClass("tool_button").find("input").attr("checked",true):a("#tool_node_link").removeClass("push_button_pressed").addClass("tool_button").find("input").attr("checked",false);sa.linkControlPoints(q)},Zb=function(){sa.getNodePoint()&&sa.clonePathNode()},sb=function(){sa.getNodePoint()&&sa.deletePathNode()},Ua=function(){var q=a("#tool_add_subpath"),A=!q.hasClass("push_button_pressed");
|
function(q,B){if(Z!=null||za){if(d.gridSnapping){var K=f.getZoom()*d.snappingStep;q*=K;B*=K}f.moveSelectedElements(q,B)}},$b=function(){var q=!a("#tool_node_link").hasClass("push_button_pressed");q?a("#tool_node_link").addClass("push_button_pressed").removeClass("tool_button").find("input").attr("checked",true):a("#tool_node_link").removeClass("push_button_pressed").addClass("tool_button").find("input").attr("checked",false);sa.linkControlPoints(q)},Zb=function(){sa.getNodePoint()&&sa.clonePathNode()},
|
||||||
A?q.addClass("push_button_pressed").removeClass("tool_button"):q.removeClass("push_button_pressed").addClass("tool_button");sa.addSubPath(A)},jc=function(){sa.opencloseSubPath()},bc=function(){f.cycleElement(1)},Yb=function(){f.cycleElement(0)},Ub=function(q,A){if(!(Y==null||za)){q||(A*=-1);var J=a("#angle").val()*1+A;f.setRotationAngle(J);Za()}},kc=function(){var q=d.dimensions;a.confirm(e.notification.QwantToClear,function(A){if(A){ma();f.clear();f.setResolution(q[0],q[1]);Sb(true);k();Fb();Za();
|
sb=function(){sa.getNodePoint()&&sa.deletePathNode()},Ua=function(){var q=a("#tool_add_subpath"),B=!q.hasClass("push_button_pressed");B?q.addClass("push_button_pressed").removeClass("tool_button"):q.removeClass("push_button_pressed").addClass("tool_button");sa.addSubPath(B)},jc=function(){sa.opencloseSubPath()},bc=function(){f.cycleElement(1)},Yb=function(){f.cycleElement(0)},Ub=function(q,B){if(!(Z==null||za)){q||(B*=-1);var K=a("#angle").val()*1+B;f.setRotationAngle(K);Za()}},kc=function(){var q=
|
||||||
la.fill.prep();la.stroke.prep();f.runExtensions("onNewDocument")}})},Vb=function(){f.setBold(!f.getBold());Za();return false},ac=function(){f.setItalic(!f.getItalic());Za();return false},nc=function(){if(!l.pngsave){var q=e.notification.loadingImage;ba=window.open("data:text/html;charset=utf-8,<title>"+q+"</title><h1>"+q+"</h1>")}window.canvg?f.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){f.rasterExport()})})},Tb=function(){f.open()},Ab=function(){},
|
d.dimensions;a.confirm(e.notification.QwantToClear,function(B){if(B){ma();f.clear();f.setResolution(q[0],q[1]);Sb(true);k();Fb();Za();la.fill.prep();la.stroke.prep();f.runExtensions("onNewDocument")}})},Vb=function(){f.setBold(!f.getBold());Za();return false},ac=function(){f.setItalic(!f.getItalic());Za();return false},mc=function(){if(!l.pngsave){var q=e.notification.loadingImage;ba=window.open("data:text/html;charset=utf-8,<title>"+q+"</title><h1>"+q+"</h1>")}window.canvg?f.rasterExport():a.getScript("canvg/rgbcolor.js",
|
||||||
cc=function(q){var A=q.prev();A.css("background","#09f");setTimeout(function(){A.css("background","")},200)},fc=function(){if(ia.getUndoStackSize()>0){window.event.type==="keydown"&&cc(a("#edit_menu"));ia.undo();Fb()}},Rb=function(){if(ia.getRedoStackSize()>0){window.event.type==="keydown"&&cc(a("#edit_menu"));ia.redo();Fb()}},qb=function(){if(za)f.groupSelectedElements();else Y&&f.ungroupSelectedElement()},ec=function(){window.event.type==="keydown"&&cc(a("#edit_menu"));f.cloneSelectedElements(20,
|
function(){a.getScript("canvg/canvg.js",function(){f.rasterExport()})})},Tb=function(){f.open()},Ab=function(){},cc=function(q){var B=q.prev();B.css("background","#09f");setTimeout(function(){B.css("background","")},200)},fc=function(){if(ha.getUndoStackSize()>0){window.event.type==="keydown"&&cc(a("#edit_menu"));ha.undo();Fb()}},Rb=function(){if(ha.getRedoStackSize()>0){window.event.type==="keydown"&&cc(a("#edit_menu"));ha.redo();Fb()}},qb=function(){if(za)f.groupSelectedElements();else Z&&f.ungroupSelectedElement()},
|
||||||
20)},g=function(){var q=this.id.replace("tool_align","").charAt(0);f.alignSelectedElements(q,a("#align_relative_to").val())},h=function(){var q=document.querySelector("#tool_stroke rect"),A=document.querySelector("#tool_fill rect"),J=A.getAttribute("fill"),R=q.getAttribute("fill");q=parseFloat(q.getAttribute("stroke-opacity"));if(isNaN(q))q=100;A=parseFloat(A.getAttribute("fill-opacity"));if(isNaN(A))A=100;R=ab(R,q,"stroke");J=ab(J,A,"fill");la.fill.setPaint(R,true);la.stroke.setPaint(J,true)},k=
|
ec=function(){window.event.type==="keydown"&&cc(a("#edit_menu"));f.cloneSelectedElements(20,20)},g=function(){var q=this.id.replace("tool_align","").charAt(0);f.alignSelectedElements(q,a("#align_relative_to").val())},h=function(){var q=document.querySelector("#tool_stroke rect"),B=document.querySelector("#tool_fill rect"),K=B.getAttribute("fill"),R=q.getAttribute("fill");q=parseFloat(q.getAttribute("stroke-opacity"));if(isNaN(q))q=100;B=parseFloat(B.getAttribute("fill-opacity"));if(isNaN(B))B=100;
|
||||||
function(q){var A=f.getResolution();q=q?A.zoom*q:1;a("#zoom").val(q*100);f.setZoom(q);w();Sb(true)},v=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");qa.toggleClass("wireframe");if(!rc){var q=a("#wireframe_rules");q.length?q.empty():a('<style id="wireframe_rules"></style>').appendTo("head");w()}},t=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},E=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");
|
R=ab(R,q,"stroke");K=ab(K,B,"fill");la.fill.setPaint(R,true);la.stroke.setPaint(K,true)},k=function(q){var B=f.getResolution();q=q?B.zoom*q:1;a("#zoom").val(q*100);f.setZoom(q);w();Sb(true)},v=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");qa.toggleClass("wireframe");if(!qc){var q=a("#wireframe_rules");q.length?q.empty():a('<style id="wireframe_rules"></style>').appendTo("head");
|
||||||
a("#show_rulers").attr("checked",false);d.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);d.showRulers=true}a("#rulers").toggle(!!d.showRulers)},w=function(){if(!rc){var q="#workarea.wireframe #svgcontent * { stroke-width: "+1/f.getZoom()+"px; }";a("#wireframe_rules").text(qa.hasClass("wireframe")?q:"")}},s=function(q,A){if(!Ka){Ka=true;a("#save_output_btns").toggle(!!A);a("#tool_source_back").toggle(!A);var J=ra=f.getSvgString();a("#svg_source_textarea").val(J);
|
w()}},t=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},E=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);d.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);d.showRulers=true}a("#rulers").toggle(!!d.showRulers)},w=function(){if(!qc){var q="#workarea.wireframe #svgcontent * { stroke-width: "+1/f.getZoom()+
|
||||||
a("#svg_source_editor").fadeIn();C();a("#svg_source_textarea").focus()}},B=function(){if(!Qa){Qa=true;a("#image_save_opts input").val([b.img_save]);var q=f.getResolution();if(d.baseUnit!=="px"){q.w=svgedit.units.convertUnit(q.w)+d.baseUnit;q.h=svgedit.units.convertUnit(q.h)+d.baseUnit}a(".canvas_width").val(q.w);a(".canvas_height").val(q.h);a("#canvas_title").val(f.getDocumentTitle());a("#svg_docprops").show()}},F=function(){if(!Ma){Ma=true;var q=a("#bg_blocks div"),A=a.pref("bkgd_color"),J=a.pref("bkgd_url");
|
"px; }";a("#wireframe_rules").text(qa.hasClass("wireframe")?q:"")}},s=function(q,B){if(!Ka){Ka=true;a("#save_output_btns").toggle(!!B);a("#tool_source_back").toggle(!B);var K=ra=f.getSvgString();a("#svg_source_textarea").val(K);a("#svg_source_editor").fadeIn();C();a("#svg_source_textarea").focus()}},A=function(){if(!Qa){Qa=true;a("#image_save_opts input").val([b.img_save]);var q=f.getResolution();if(d.baseUnit!=="px"){q.w=svgedit.units.convertUnit(q.w)+d.baseUnit;q.h=svgedit.units.convertUnit(q.h)+
|
||||||
q.each(function(){var R=a(this),W=R.css("background-color")==A;R.toggleClass("cur_background",W);W&&a("#canvas_bg_url").removeClass("cur_background")});A||q.eq(0).addClass("cur_background");J&&a("#canvas_bg_url").val(J);a("grid_snapping_step").attr("value",d.snappingStep);d.gridSnapping==true?a("#grid_snapping_on").attr("checked","checked"):a("#grid_snapping_on").removeAttr("checked");a("#svg_prefs").show()}},C=function(){var q=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",
|
d.baseUnit}a(".canvas_width").val(q.w);a(".canvas_height").val(q.h);a("#canvas_title").val(f.getDocumentTitle());a("#svg_docprops").show()}},F=function(){if(!Ma){Ma=true;var q=a("#bg_blocks div"),B=a.pref("bkgd_color"),K=a.pref("bkgd_url");q.each(function(){var R=a(this),X=R.css("background-color")==B;R.toggleClass("cur_background",X);X&&a("#canvas_bg_url").removeClass("cur_background")});B||q.eq(0).addClass("cur_background");K&&a("#canvas_bg_url").val(K);a("grid_snapping_step").attr("value",d.snappingStep);
|
||||||
q)},D=function(){if(Ka){var q=function(){f.clearSelection();ka();k();Fb();G();la.fill.prep();la.stroke.prep()};f.setSvgString(a("#svg_source_textarea").val())?q():a.confirm(e.notification.QerrorsRevertToSource,function(A){if(!A)return false;q()});ma()}},G=function(q){q=q||f.getDocumentTitle();q=Ya+(q?": "+q:"");a("title:first").text(q)},H=function(){var q=a("#canvas_width"),A=q.val(),J=a("#canvas_height"),R=J.val();if(A!="fit"&&!svgedit.units.isValidUnit("width",A)){a.alert(e.notification.invalidAttrValGiven);
|
d.gridSnapping==true?a("#grid_snapping_on").attr("checked","checked"):a("#grid_snapping_on").removeAttr("checked");a("#svg_prefs").show()}},C=function(){var q=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",q)},D=function(){if(Ka){var q=function(){f.clearSelection();ka();k();Fb();G();la.fill.prep();la.stroke.prep()};f.setSvgString(a("#svg_source_textarea").val())?q():a.confirm(e.notification.QerrorsRevertToSource,function(B){if(!B)return false;q()});ma()}},G=function(q){q=
|
||||||
q.parent().addClass("error");return false}q.parent().removeClass("error");if(R!="fit"&&!svgedit.units.isValidUnit("height",R)){a.alert(e.notification.invalidAttrValGiven);J.parent().addClass("error");return false}J.parent().removeClass("error");if(!f.setResolution(A,R)){a.alert(e.notification.noContentToFitTo);return false}b.img_save=a("#image_save_opts :checked").val();a.pref("img_save",b.img_save);Sb();oa()},P=function(){var q=a("#bg_blocks div.cur_background").css("background-color")||"#FFF";p(q,
|
q||f.getDocumentTitle();q=Ya+(q?": "+q:"");a("title:first").text(q)},H=function(){var q=a("#canvas_width"),B=q.val(),K=a("#canvas_height"),R=K.val();if(B!="fit"&&!svgedit.units.isValidUnit("width",B)){a.alert(e.notification.invalidAttrValGiven);q.parent().addClass("error");return false}q.parent().removeClass("error");if(R!="fit"&&!svgedit.units.isValidUnit("height",R)){a.alert(e.notification.invalidAttrValGiven);K.parent().addClass("error");return false}K.parent().removeClass("error");if(!f.setResolution(B,
|
||||||
a("#canvas_bg_url").val());q=a("#lang_select").val();q!=b.lang&&c.putLocale(q);wa(a("#iconsize").val());d.gridSnapping=a("#grid_snapping_on")[0].checked;d.snappingStep=a("#grid_snapping_step").val();d.showRulers=a("#show_rulers")[0].checked;a("#rulers").toggle(d.showRulers);d.showRulers&&da();d.baseUnit=a("#base_unit").val();f.setConfig(d);Sb();ya()},Q=c.setIcon=function(q,A){var J=typeof A==="string"?a.getSvgIcon(A,true):A.clone();J?a(q).find("img").replaceWith(J):console.log("NOTE: Icon image missing: "+
|
R)){a.alert(e.notification.noContentToFitTo);return false}b.img_save=a("#image_save_opts :checked").val();a.pref("img_save",b.img_save);Sb();oa()},P=function(){var q=a("#bg_blocks div.cur_background").css("background-color")||"#FFF";p(q,a("#canvas_bg_url").val());q=a("#lang_select").val();q!=b.lang&&c.putLocale(q);wa(a("#iconsize").val());d.gridSnapping=a("#grid_snapping_on")[0].checked;d.snappingStep=a("#grid_snapping_step").val();d.showRulers=a("#show_rulers")[0].checked;a("#rulers").toggle(d.showRulers);
|
||||||
A)},Z;Z=function(){var q=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,A=document.getElementsByTagName("script")[0],J;for(J in A.style)if(q.test(J))return J.match(q)[0];if("WebkitOpacity"in A.style)return"Webkit";if("KhtmlOpacity"in A.style)return"Khtml";return""}();var ua=function(q,A){Z.toLowerCase();var J=["top","left","bottom","right"];q.each(function(){for(var R=a(this),W=R.outerWidth()*(A-1),ha=R.outerHeight()*(A-1),va=0;va<4;va++){var xa=J[va],Ca=R.data("orig_margin-"+xa);if(Ca==null){Ca=parseInt(R.css("margin-"+
|
d.showRulers&&da();d.baseUnit=a("#base_unit").val();f.setConfig(d);Sb();ya()},Q=c.setIcon=function(q,B){var K=typeof B==="string"?a.getSvgIcon(B,true):B.clone();K?a(q).find("img").replaceWith(K):console.log("NOTE: Icon image missing: "+B)},W;W=function(){var q=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,B=document.getElementsByTagName("script")[0],K;for(K in B.style)if(q.test(K))return K.match(q)[0];if("WebkitOpacity"in B.style)return"Webkit";if("KhtmlOpacity"in B.style)return"Khtml";return""}();var ua=
|
||||||
xa));R.data("orig_margin-"+xa,Ca)}Ca=Ca*A;if(xa==="right")Ca+=W;else if(xa==="bottom")Ca+=ha;R.css("margin-"+xa,Ca)}})},wa=c.setIconSize=function(q,A){if(!(q==b.size&&!A)){console.log("size",q);var J=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),R=1;R=typeof q=="number"?q:{s:0.75,m:1,l:1.25,xl:1.5}[q];c.tool_scale=S=R;Gb();var W=J.parents(":hidden");
|
function(q,B){W.toLowerCase();var K=["top","left","bottom","right"];q.each(function(){for(var R=a(this),X=R.outerWidth()*(B-1),ja=R.outerHeight()*(B-1),va=0;va<4;va++){var xa=K[va],Ca=R.data("orig_margin-"+xa);if(Ca==null){Ca=parseInt(R.css("margin-"+xa));R.data("orig_margin-"+xa,Ca)}Ca=Ca*B;if(xa==="right")Ca+=X;else if(xa==="bottom")Ca+=ja;R.css("margin-"+xa,Ca)}})},wa=c.setIconSize=function(q,B){if(!(q==b.size&&!B)){console.log("size",q);var K=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),
|
||||||
W.css("visibility","hidden").show();ua(J,R);W.css("visibility","visible").hide();a.pref("iconsize",q);a("#iconsize").val(q);W={"#tools_top":{left:50,height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}};J=a("#tool_size_rules");if(J.length)J.empty();else J=a('<style id="tool_size_rules"></style>').appendTo("head");if(q!="m"){var ha="";a.each(W,function(va,xa){va="#svg_editor "+va.replace(/,/g,", #svg_editor");ha+=va+"{";a.each(xa,function(Ca,Ba){if(typeof Ba==="number")var Aa=
|
R=1;R=typeof q=="number"?q:{s:0.75,m:1,l:1.25,xl:1.5}[q];c.tool_scale=S=R;Gb();var X=K.parents(":hidden");X.css("visibility","hidden").show();ua(K,R);X.css("visibility","visible").hide();a.pref("iconsize",q);a("#iconsize").val(q);X={"#tools_top":{left:50,height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}};K=a("#tool_size_rules");if(K.length)K.empty();else K=a('<style id="tool_size_rules"></style>').appendTo("head");if(q!="m"){var ja="";a.each(X,function(va,xa){va="#svg_editor "+
|
||||||
Ba*R+"px";else if(Ba[q]||Ba.all)Aa=Ba[q]||Ba.all;ha+=Ca+":"+Aa+";"});ha+="}"});W="-"+Z.toLowerCase()+"-";ha+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+W+"transform: scale("+R+");} #svg_editor div.toolset .toolset {"+W+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+W+"transform: scale("+1/R+");}";J.text(ha)}Gb()}},
|
va.replace(/,/g,", #svg_editor");ja+=va+"{";a.each(xa,function(Ca,Ba){if(typeof Ba==="number")var Aa=Ba*R+"px";else if(Ba[q]||Ba.all)Aa=Ba[q]||Ba.all;ja+=Ca+":"+Aa+";"});ja+="}"});X="-"+W.toLowerCase()+"-";ja+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+X+"transform: scale("+R+");} #svg_editor div.toolset .toolset {"+X+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+
|
||||||
ga=function(){a("#dialog_box").hide();if(!Ka&&!Qa&&!Ma)Sa&&f.leaveContext();else{if(Ka)ra!==a("#svg_source_textarea").val()?a.confirm(e.notification.QignoreSourceChanges,function(q){q&&ka()}):ka();else if(Qa)oa();else Ma&&ya();ub()}},ka=function(){a("#svg_source_editor").hide();Ka=false;a("#svg_source_textarea").blur()},oa=function(){a("#svg_docprops").hide();a("#canvas_width,#canvas_height").removeAttr("disabled");a("#resolution")[0].selectedIndex=0;a("#image_save_opts input").val([b.img_save]);
|
X+"transform: scale("+1/R+");}";K.text(ja)}Gb()}},ga=function(){a("#dialog_box").hide();if(!Ka&&!Qa&&!Ma)Sa&&f.leaveContext();else{if(Ka)ra!==a("#svg_source_textarea").val()?a.confirm(e.notification.QignoreSourceChanges,function(q){q&&ka()}):ka();else if(Qa)oa();else Ma&&ya();ub()}},ka=function(){a("#svg_source_editor").hide();Ka=false;a("#svg_source_textarea").blur()},oa=function(){a("#svg_docprops").hide();a("#canvas_width,#canvas_height").removeAttr("disabled");a("#resolution")[0].selectedIndex=
|
||||||
Qa=false},ya=function(){a("#svg_prefs").hide();Ma=false},jb={width:a(window).width(),height:a(window).height()},ub=a.noop,Mb;svgedit.browser.isIE()&&function(){ub=function(){if(qa[0].scrollLeft===0&&qa[0].scrollTop===0){qa[0].scrollLeft=Mb.left;qa[0].scrollTop=Mb.top}};Mb={left:qa[0].scrollLeft,top:qa[0].scrollTop};a(window).resize(ub);svgEditor.ready(function(){setTimeout(function(){ub()},500)});qa.scroll(function(){Mb={left:qa[0].scrollLeft,top:qa[0].scrollTop}})}();a(window).resize(function(){Ka&&
|
0;a("#image_save_opts input").val([b.img_save]);Qa=false},ya=function(){a("#svg_prefs").hide();Ma=false},jb={width:a(window).width(),height:a(window).height()},ub=a.noop,Mb;svgedit.browser.isIE()&&function(){ub=function(){if(qa[0].scrollLeft===0&&qa[0].scrollTop===0){qa[0].scrollLeft=Mb.left;qa[0].scrollTop=Mb.top}};Mb={left:qa[0].scrollLeft,top:qa[0].scrollTop};a(window).resize(ub);svgEditor.ready(function(){setTimeout(function(){ub()},500)});qa.scroll(function(){Mb={left:qa[0].scrollLeft,top:qa[0].scrollTop}})}();
|
||||||
C();a.each(jb,function(q,A){var J=a(window)[q]();qa[0]["scroll"+(q==="width"?"Left":"Top")]-=(J-A)/2;jb[q]=J})});(function(){qa.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=qa[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=qa[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(L);(function(){var q=["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],
|
a(window).resize(function(){Ka&&C();a.each(jb,function(q,B){var K=a(window)[q]();qa[0]["scroll"+(q==="width"?"Left":"Top")]-=(K-B)/2;jb[q]=K})});(function(){qa.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=qa[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=qa[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(L);(function(){var q=["clear","open","save","source","delete","delete_multi","paste","clone",
|
||||||
A="";a.each(q,function(J,R){A+="#tool_"+R+(J==q.length-1?",":"")});a(A).mousedown(function(){a(this).addClass("tool_button_current")}).bind("mousedown mouseout",function(){a(this).removeClass("tool_button_current")});a("#tool_undo, #tool_redo").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("tool_button_current")}).bind("mousedown mouseout",function(){a(this).removeClass("tool_button_current")})})();if(V&&!window.opera){V=["tool_clear","tool_save","tool_source","tool_undo","tool_redo",
|
"clone_multi","move_top","move_bottom"],B="";a.each(q,function(K,R){B+="#tool_"+R+(K==q.length-1?",":"")});a(B).mousedown(function(){a(this).addClass("tool_button_current")}).bind("mousedown mouseout",function(){a(this).removeClass("tool_button_current")});a("#tool_undo, #tool_redo").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("tool_button_current")}).bind("mousedown mouseout",function(){a(this).removeClass("tool_button_current")})})();if(V&&!window.opera){V=["tool_clear",
|
||||||
"tool_clone"];for(var gb=V.length;gb--;){Xa=document.getElementById(V[gb]);if(Xa!=null){var Lb=Xa.title,hc=Lb.indexOf("Ctrl+");Xa.title=[Lb.substr(0,hc),"Cmd+",Lb.substr(hc+5)].join("")}}}var ic=function(q){var A=q.attr("id")=="stroke_color"?"stroke":"fill",J=la[A].paint,R=A=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";q=q.position();a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(d.colorPickerCSS||
|
"tool_save","tool_source","tool_undo","tool_redo","tool_clone"];for(var gb=V.length;gb--;){Xa=document.getElementById(V[gb]);if(Xa!=null){var Lb=Xa.title,hc=Lb.indexOf("Ctrl+");Xa.title=[Lb.substr(0,hc),"Cmd+",Lb.substr(hc+5)].join("")}}}var ic=function(q){var B=q.attr("id")=="stroke_color"?"stroke":"fill",K=la[B].paint,R=B=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";q=q.position();a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",
|
||||||
{left:q.left,bottom:50-q.top}).jGraduate({paint:J,window:{pickerTitle:R},images:{clientPath:d.jGraduatePath},newstop:"inverse"},function(W){J=new a.jGraduate.Paint(W);la[A].setPaint(J);f.setPaint(A,J);a("#color_picker").hide()},function(){a("#color_picker").hide()})},lc=function(){var q=f.getColor("fill")=="none",A=f.getColor("stroke")=="none",J=["#tool_fhpath","#tool_line"],R=["#tools_rect .tool_button","#tools_ellipse .tool_button","#tool_text","#tool_path"];if(A)for(var W in J){var ha=J[W];a(ha).hasClass("tool_button_current")&&
|
containment:"window"}).css(d.colorPickerCSS||{left:q.left,bottom:50-q.top}).jGraduate({paint:K,window:{pickerTitle:R},images:{clientPath:d.jGraduatePath},newstop:"inverse"},function(X){K=new a.jGraduate.Paint(X);la[B].setPaint(K);f.setPaint(B,K);a("#color_picker").hide()},function(){a("#color_picker").hide()})};V=function(q,B){var K=d[B==="fill"?"initFill":"initStroke"],R=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+K.color+
|
||||||
nb();a(ha).addClass("disabled")}else for(W in J){ha=J[W];a(ha).removeClass("disabled")}if(A&&q)for(W in R){ha=R[W];a(ha).hasClass("tool_button_current")&&nb();a(ha).addClass("disabled")}else for(W in R){ha=R[W];a(ha).removeClass("disabled")}f.runExtensions("toolButtonStateUpdate",{nofill:q,nostroke:A});a(".tools_flyout").each(function(){var va=a("#"+this.id+"_show"),xa=false;a(this).children().each(function(){a(this).hasClass("disabled")||(xa=true)});va.toggleClass("disabled",!xa)});db()};V=function(q,
|
'" opacity="'+K.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;R=a(q)[0].appendChild(document.importNode(R,true));R.setAttribute("width",24.5);this.rect=R.firstChild;this.defs=R.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:K.color});this.type=B;this.setPaint=function(X,ja){this.paint=X;var va="none",xa=X.type,Ca=X.alpha/100;switch(xa){case "solidColor":va=X[xa]=="none"||X[xa]=="one"?
|
||||||
A){var J=d[A==="fill"?"initFill":"initStroke"],R=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+J.color+'" opacity="'+J.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;R=a(q)[0].appendChild(document.importNode(R,true));R.setAttribute("width",24.5);this.rect=R.firstChild;this.defs=R.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:J.color});
|
"none":"#"+X[xa];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(X[xa]);va="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",va);this.rect.setAttribute("opacity",Ca);if(ja){f.setColor(this.type,va,true);f.setPaintOpacity(this.type,Ca,true)}};this.update=function(X){if(Z){var ja=this.type;switch(Z.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var va=null,xa=Z.getElementsByTagName("*"),
|
||||||
this.type=A;this.setPaint=function(W,ha){this.paint=W;var va="none",xa=W.type,Ca=W.alpha/100;switch(xa){case "solidColor":va="#"+W[xa];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(W[xa]);va="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",va);this.rect.setAttribute("opacity",Ca);if(ha){f.setColor(this.type,va,true);f.setPaintOpacity(this.type,Ca,true)}};this.update=function(W){if(Y){var ha=this.type;
|
Ca=0,Ba=xa.length;Ca<Ba;Ca++){var Aa=xa[Ca].getAttribute(ja);if(Ca===0)va=Aa;else if(va!==Aa){va=null;break}}if(va===null){xa=null;return}xa=va;va=1;break;default:va=parseFloat(Z.getAttribute(ja+"-opacity"));if(isNaN(va))va=1;xa=ja==="fill"?"black":"none";xa=Z.getAttribute(ja)||xa}if(X){f.setColor(ja,xa,true);f.setPaintOpacity(ja,va,true)}va*=100;this.setPaint(ab(xa,va,ja))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var X=new a.jGraduate.Paint({copy:this.paint});
|
||||||
switch(Y.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var va=null,xa=Y.getElementsByTagName("*"),Ca=0,Ba=xa.length;Ca<Ba;Ca++){var Aa=xa[Ca].getAttribute(ha);if(Ca===0)va=Aa;else if(va!==Aa){va=null;break}}if(va===null){xa=null;return}xa=va;va=1;break;default:va=parseFloat(Y.getAttribute(ha+"-opacity"));if(isNaN(va))va=1;xa=ha==="fill"?"black":"none";xa=Y.getAttribute(ha)||xa}if(W){f.setColor(ha,xa,true);f.setPaintOpacity(ha,va,true)}va*=100;this.setPaint(ab(xa,
|
f.setPaint(B,X)}}};la.fill=new V("#fill_color","fill");la.stroke=new V("#stroke_color","stroke");a("#stroke_width").val(d.initStroke.width);a("#group_opacity").val(d.initOpacity*100);V=la.fill.rect.cloneNode(false);V.setAttribute("style","vector-effect:non-scaling-stroke");var qc=V.style.vectorEffect==="non-scaling-stroke";V.removeAttribute("style");V=la.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof V.stdDeviationX==="undefined"&&a("#tool_blur").hide();
|
||||||
va,ha))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var W=new a.jGraduate.Paint({copy:this.paint});f.setPaint(A,W)}}};la.fill=new V("#fill_color","fill");la.stroke=new V("#stroke_color","stroke");a("#stroke_width").val(d.initStroke.width);a("#group_opacity").val(d.initOpacity*100);V=la.fill.rect.cloneNode(false);V.setAttribute("style","vector-effect:non-scaling-stroke");var rc=V.style.vectorEffect==="non-scaling-stroke";V.removeAttribute("style");V=la.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
|
a(V).remove();setTimeout(function(){f.embedImage("images/placeholder.svg",function(q){if(!q){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);b.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",e.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))ic(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").click(function(){if(a("#tool_stroke").hasClass("active"))ic(a("#stroke_color"));
|
||||||
"feGaussianBlur");typeof V.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(V).remove();setTimeout(function(){f.embedImage("images/placeholder.svg",function(q){if(!q){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);b.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",e.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active")){ic(a("#fill_color"));lc()}else{a("#tool_fill").addClass("active");
|
else{a("#tool_stroke").addClass("active");console.log(a("#tool_stroke"));a("#tool_fill").removeClass("active")}});a("#group_opacityLabel").click(function(){a("#opacity_dropdown button").mousedown();a(window).mouseup()});a("#zoomLabel").click(function(){a("#zoom_dropdown button").mousedown();a(window).mouseup()});a("#tool_move_top").mousedown(function(q){a("#tools_stacking").show();q.preventDefault()});a(".layer_button").mousedown(function(){a(this).addClass("layer_buttonpressed")}).mouseout(function(){a(this).removeClass("layer_buttonpressed")}).mouseup(function(){a(this).removeClass("layer_buttonpressed")});
|
||||||
a("#tool_stroke").removeClass("active")}});a("#tool_stroke").click(function(){if(a("#tool_stroke").hasClass("active")){ic(a("#stroke_color"));lc()}else{a("#tool_stroke").addClass("active");console.log(a("#tool_stroke"));a("#tool_fill").removeClass("active")}});a("#group_opacityLabel").click(function(){a("#opacity_dropdown button").mousedown();a(window).mouseup()});a("#zoomLabel").click(function(){a("#zoom_dropdown button").mousedown();a(window).mouseup()});a("#tool_move_top").mousedown(function(q){a("#tools_stacking").show();
|
a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a("#layer_new").click(function(){var q=f.getCurrentDrawing().getNumLayers();do var B=e.layers.layer+" "+ ++q;while(f.getCurrentDrawing().hasLayer(B));a.prompt(e.notification.enterUniqueLayerName,
|
||||||
q.preventDefault()});a(".layer_button").mousedown(function(){a(this).addClass("layer_buttonpressed")}).mouseout(function(){a(this).removeClass("layer_buttonpressed")}).mouseup(function(){a(this).removeClass("layer_buttonpressed")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});
|
B,function(K){if(K)if(f.getCurrentDrawing().hasLayer(K))a.alert(e.notification.dupeLayerName);else{f.createLayer(K);Za();Fb()}})});a("#layer_delete").click(T);a("#layer_up").click(function(){J(-1)});a("#layer_down").click(function(){J(1)});a("#layer_rename").click(function(){a("#layerlist tr.layersel").prevAll();var q=a("#layerlist tr.layersel td.layername").text();a.prompt(e.notification.enterNewLayerName,"",function(B){if(B)if(q==B||f.getCurrentDrawing().hasLayer(B))a.alert(e.notification.layerHasThatName);
|
||||||
a("#layer_new").click(function(){var q=f.getCurrentDrawing().getNumLayers();do var A=e.layers.layer+" "+ ++q;while(f.getCurrentDrawing().hasLayer(A));a.prompt(e.notification.enterUniqueLayerName,A,function(J){if(J)if(f.getCurrentDrawing().hasLayer(J))a.alert(e.notification.dupeLayerName);else{f.createLayer(J);Za();Fb()}})});a("#layer_delete").click(T);a("#layer_up").click(function(){K(-1)});a("#layer_down").click(function(){K(1)});a("#layer_rename").click(function(){a("#layerlist tr.layersel").prevAll();
|
else{f.renameCurrentLayer(B);Fb()}})});var dc=-1,lc=false,pc=false,rc=function(q){if(pc)if(dc!=-1){lc=true;q=dc-q.pageX;var B=a("#sidepanels"),K=parseInt(B.css("width"));if(K+q>300)q=300-K;else if(K+q<2)q=2-K;if(q!=0){dc-=q;K=a("#layerpanel");qa.css("right",parseInt(qa.css("right"))+q);B.css("width",parseInt(B.css("width"))+q);K.css("width",parseInt(K.css("width"))+q);B=a("#ruler_x");B.css("right",parseInt(B.css("right"))+q)}}};a("#sidepanel_handle").mousedown(function(q){dc=q.pageX;a(window).mousemove(rc);
|
||||||
var q=a("#layerlist tr.layersel td.layername").text();a.prompt(e.notification.enterNewLayerName,"",function(A){if(A)if(q==A||f.getCurrentDrawing().hasLayer(A))a.alert(e.notification.layerHasThatName);else{f.renameCurrentLayer(A);Fb()}})});var dc=-1,mc=false,qc=false,sc=function(q){if(qc)if(dc!=-1){mc=true;q=dc-q.pageX;var A=a("#sidepanels"),J=parseInt(A.css("width"));if(J+q>300)q=300-J;else if(J+q<2)q=2-J;if(q!=0){dc-=q;J=a("#layerpanel");qa.css("right",parseInt(qa.css("right"))+q);A.css("width",
|
pc=false;setTimeout(function(){pc=true},20)}).mouseup(function(){lc||sc();dc=-1;lc=false});a(window).mouseup(function(){dc=-1;lc=false;a("#svg_editor").unbind("mousemove",rc)});var sc=function(q){var B=parseInt(a("#sidepanels").css("width"));q=(B>2||q?2:150)-B;B=a("#sidepanels");var K=a("#layerpanel"),R=a("#ruler_x");qa.css("right",parseInt(qa.css("right"))+q);B.css("width",parseInt(B.css("width"))+q);K.css("width",parseInt(K.css("width"))+q);R.css("right",parseInt(R.css("right"))+q)},tc=function(q){for(var B=
|
||||||
parseInt(A.css("width"))+q);J.css("width",parseInt(J.css("width"))+q);A=a("#ruler_x");A.css("right",parseInt(A.css("right"))+q)}}};a("#sidepanel_handle").mousedown(function(q){dc=q.pageX;a(window).mousemove(sc);qc=false;setTimeout(function(){qc=true},20)}).mouseup(function(){mc||tc();dc=-1;mc=false});a(window).mouseup(function(){dc=-1;mc=false;a("#svg_editor").unbind("mousemove",sc)});var tc=function(q){var A=parseInt(a("#sidepanels").css("width"));q=(A>2||q?2:150)-A;A=a("#sidepanels");var J=a("#layerpanel"),
|
Array(f.getCurrentDrawing().getNumLayers()),K=0;K<B.length;++K)B[K]=f.getCurrentDrawing().getLayerName(K);if(q)for(K=0;K<B.length;++K)B[K]!=q&&f.getCurrentDrawing().setLayerOpacity(B[K],0.5);else for(K=0;K<B.length;++K)f.getCurrentDrawing().setLayerOpacity(B[K],1)},Fb=function(){var q=a("#layerlist tbody"),B=a("#selLayerNames");q.empty();B.empty();for(var K=f.getCurrentDrawing().getCurrentLayerName(),R=f.getCurrentDrawing().getNumLayers(),X=a.getSvgIcon("eye");R--;){var ja=f.getCurrentDrawing().getLayerName(R),
|
||||||
R=a("#ruler_x");qa.css("right",parseInt(qa.css("right"))+q);A.css("width",parseInt(A.css("width"))+q);J.css("width",parseInt(J.css("width"))+q);R.css("right",parseInt(R.css("right"))+q)},uc=function(q){for(var A=Array(f.getCurrentDrawing().getNumLayers()),J=0;J<A.length;++J)A[J]=f.getCurrentDrawing().getLayerName(J);if(q)for(J=0;J<A.length;++J)A[J]!=q&&f.getCurrentDrawing().setLayerOpacity(A[J],0.5);else for(J=0;J<A.length;++J)f.getCurrentDrawing().setLayerOpacity(A[J],1)},Fb=function(){var q=a("#layerlist tbody"),
|
va='<tr class="layer';if(ja==K)va+=" layersel";va+='">';va+=f.getCurrentDrawing().getLayerVisibility(ja)?'<td class="layervis"/><td class="layername" >'+ja+"</td></tr>":'<td class="layervis layerinvis"/><td class="layername" >'+ja+"</td></tr>";q.append(va);B.append('<option value="'+ja+'">'+ja+"</option>")}if(X!==undefined){X.clone();a("td.layervis",q).append(X.clone());a.resizeSvgIcons({"td.layervis .svg_icon":14})}a("#layerlist td.layername").mouseup(function(xa){a("#layerlist tr.layer").removeClass("layersel");
|
||||||
A=a("#selLayerNames");q.empty();A.empty();for(var J=f.getCurrentDrawing().getCurrentLayerName(),R=f.getCurrentDrawing().getNumLayers(),W=a.getSvgIcon("eye");R--;){var ha=f.getCurrentDrawing().getLayerName(R),va='<tr class="layer';if(ha==J)va+=" layersel";va+='">';va+=f.getCurrentDrawing().getLayerVisibility(ha)?'<td class="layervis"/><td class="layername" >'+ha+"</td></tr>":'<td class="layervis layerinvis"/><td class="layername" >'+ha+"</td></tr>";q.append(va);A.append('<option value="'+ha+'">'+ha+
|
a(this.parentNode).addClass("layersel");f.setCurrentLayer(this.textContent);xa.preventDefault()}).mouseover(function(){a(this).css({"font-style":"italic",color:"blue"});tc(this.textContent)}).mouseout(function(){a(this).css({"font-style":"normal",color:"black"});tc()});a("#layerlist td.layervis").click(function(){var xa=a(this.parentNode).prevAll().length;xa=a("#layerlist tr.layer:eq("+xa+") td.layername").text();var Ca=a(this).hasClass("layerinvis");f.setLayerVisibility(xa,Ca);Ca?a(this).removeClass("layerinvis"):
|
||||||
"</option>")}if(W!==undefined){W.clone();a("td.layervis",q).append(W.clone());a.resizeSvgIcons({"td.layervis .svg_icon":14})}a("#layerlist td.layername").mouseup(function(xa){a("#layerlist tr.layer").removeClass("layersel");a(this.parentNode).addClass("layersel");f.setCurrentLayer(this.textContent);xa.preventDefault()}).mouseover(function(){a(this).css({"font-style":"italic",color:"blue"});uc(this.textContent)}).mouseout(function(){a(this).css({"font-style":"normal",color:"black"});uc()});a("#layerlist td.layervis").click(function(){var xa=
|
a(this).addClass("layerinvis")});for(B=5-a("#layerlist tr.layer").size();B-- >0;)q.append('<tr><td style="color:white">_</td><td/></tr>')};Fb();a(window).bind("load resize",function(){qa.css("line-height",qa.height()+"px")});a("#resolution").change(function(){var q=a("#canvas_width,#canvas_height");if(this.selectedIndex)if(this.value=="content")q.val("fit").attr("disabled","disabled");else{var B=this.value.split("x");a("#canvas_width").val(B[0]);a("#canvas_height").val(B[1]);q.removeAttr("disabled")}else a("#canvas_width").val()==
|
||||||
a(this.parentNode).prevAll().length;xa=a("#layerlist tr.layer:eq("+xa+") td.layername").text();var Ca=a(this).hasClass("layerinvis");f.setLayerVisibility(xa,Ca);Ca?a(this).removeClass("layerinvis"):a(this).addClass("layerinvis")});for(A=5-a("#layerlist tr.layer").size();A-- >0;)q.append('<tr><td style="color:white">_</td><td/></tr>')};Fb();a(window).bind("load resize",function(){qa.css("line-height",qa.height()+"px")});a("#resolution").change(function(){var q=a("#canvas_width,#canvas_height");if(this.selectedIndex)if(this.value==
|
"fit"&&q.removeAttr("disabled").val(100)});a("input,select").attr("autocomplete","off");var oc=function(){var q=[{sel:"#tool_select",fn:pb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Eb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Kb,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ib,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Qb,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:I,evt:"click",key:["P",true]},{sel:"#tool_text",fn:M,evt:"click",key:["T",
|
||||||
"content")q.val("fit").attr("disabled","disabled");else{var A=this.value.split("x");a("#canvas_width").val(A[0]);a("#canvas_height").val(A[1]);q.removeAttr("disabled")}else a("#canvas_width").val()=="fit"&&q.removeAttr("disabled").val(100)});a("input,select").attr("autocomplete","off");var pc=function(){var q=[{sel:"#tool_select",fn:nb,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:Eb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:Kb,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Ib,evt:"click",
|
true]},{sel:"#tool_image",fn:na,evt:"mouseup"},{sel:"#tool_zoom",fn:aa,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:kc,evt:"mouseup",key:[fa+"N",true]},{sel:"#tool_save",fn:function(){Ka?D():f.save({images:b.img_save,round_digits:6})},evt:"mouseup",key:[fa+"S",true]},{sel:"#tool_export",fn:mc,evt:"mouseup"},{sel:"#tool_open",fn:Tb,evt:"mouseup"},{sel:"#tool_import",fn:Ab,evt:"mouseup"},{sel:"#tool_source",fn:s,evt:"click",key:[fa+"U",true]},{sel:"#tool_wireframe",fn:v,evt:"click"},{sel:"#tool_rulers",
|
||||||
key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Qb,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:I,evt:"click",key:["P",true]},{sel:"#tool_text",fn:M,evt:"click",key:["T",true]},{sel:"#tool_image",fn:na,evt:"mouseup"},{sel:"#tool_zoom",fn:aa,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:kc,evt:"mouseup",key:[fa+"N",true]},{sel:"#tool_save",fn:function(){Ka?D():f.save({images:b.img_save,round_digits:6})},evt:"mouseup",key:[fa+"S",true]},{sel:"#tool_export",fn:nc,evt:"mouseup"},
|
fn:E,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:ga,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:D,evt:"click"},{sel:"#tool_docprops_save",fn:H,evt:"click"},{sel:"#tool_docprops",fn:A,evt:"mouseup"},{sel:"#tool_prefs_save",fn:P,evt:"click"},{sel:"#tool_prefs_option",fn:function(){F();return false},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Y,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",
|
||||||
{sel:"#tool_open",fn:Tb,evt:"mouseup"},{sel:"#tool_import",fn:Ab,evt:"mouseup"},{sel:"#tool_source",fn:s,evt:"click",key:[fa+"U",true]},{sel:"#tool_wireframe",fn:v,evt:"click"},{sel:"#tool_rulers",fn:E,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:ga,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:D,evt:"click"},{sel:"#tool_docprops_save",fn:H,evt:"click"},{sel:"#tool_docprops",fn:B,evt:"mouseup"},{sel:"#tool_prefs_save",
|
fn:bb,evt:"click"},{sel:"#tool_node_link",fn:$b,evt:"click"},{sel:"#tool_node_clone",fn:Zb,evt:"click"},{sel:"#tool_node_delete",fn:sb,evt:"click"},{sel:"#tool_openclose_path",fn:jc,evt:"click"},{sel:"#tool_add_subpath",fn:Ua,evt:"click"},{sel:"#tool_move_top",fn:tb,evt:"click",key:fa+"shift+up"},{sel:"#tool_move_bottom",fn:wb,evt:"click",key:fa+"shift+down"},{sel:"#tool_move_up",fn:Hb,evt:"click",key:[fa+"up",true]},{sel:"#tool_move_down",fn:rb,evt:"click",key:[fa+"down",true]},{sel:"#tool_topath",
|
||||||
fn:P,evt:"click"},{sel:"#tool_prefs_option",fn:function(){F();return false},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:X,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:bb,evt:"click"},{sel:"#tool_node_link",fn:$b,evt:"click"},{sel:"#tool_node_clone",fn:Zb,evt:"click"},{sel:"#tool_node_delete",fn:sb,evt:"click"},{sel:"#tool_openclose_path",fn:jc,evt:"click"},{sel:"#tool_add_subpath",fn:Ua,evt:"click"},{sel:"#tool_move_top",fn:tb,evt:"click",key:fa+"shift+up"},{sel:"#tool_move_bottom",
|
fn:Nb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:Jb,evt:"click"},{sel:"#tool_undo",fn:fc,evt:"click"},{sel:"#tool_redo",fn:Rb,evt:"click",key:["Y",true]},{sel:"#tool_clone,#tool_clone_multi",fn:ec,evt:"click",key:[fa+"D",true]},{sel:"#tool_group",fn:qb,evt:"click",key:[fa+"G",true]},{sel:"#tool_ungroup",fn:qb,evt:"click",key:fa+"shift+G"},{sel:"#tool_unlink_use",fn:qb,evt:"click"},{sel:"[id^=tool_align]",fn:g,evt:"click"},{sel:"#tool_switch",fn:h,evt:"click",key:["X",true]},{sel:"#tool_bold",
|
||||||
fn:wb,evt:"click",key:fa+"shift+down"},{sel:"#tool_move_up",fn:Hb,evt:"click",key:[fa+"up",true]},{sel:"#tool_move_down",fn:rb,evt:"click",key:[fa+"down",true]},{sel:"#tool_topath",fn:Nb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:Jb,evt:"click"},{sel:"#tool_undo",fn:fc,evt:"click",key:[fa+"Z",true]},{sel:"#tool_redo",fn:Rb,evt:"click",key:["Y",true]},{sel:"#tool_clone,#tool_clone_multi",fn:ec,evt:"click",key:[fa+"D",true]},{sel:"#tool_group",fn:qb,evt:"click",key:[fa+"G",true]},
|
fn:Vb,evt:"mousedown",key:[fa+"B",true]},{sel:"#tool_italic",fn:ac,evt:"mousedown",key:[fa+"I",true]},{sel:"#copy_save_done",fn:ga,evt:"click"},{key:"ctrl+left",fn:function(){Ub(0,1)}},{key:"ctrl+right",fn:function(){Ub(1,1)}},{key:"ctrl+shift+left",fn:function(){Ub(0,5)}},{key:"ctrl+shift+right",fn:function(){Ub(1,5)}},{key:"shift+O",fn:Yb},{key:"shift+P",fn:bc},{key:[fa+"+",true],fn:function(){k(2)}},{key:[fa+"-",true],fn:function(){k(0.5)}},{key:["up",true],fn:function(){vb(0,-1)}},{key:["down",
|
||||||
{sel:"#tool_ungroup",fn:qb,evt:"click",key:fa+"shift+G"},{sel:"#tool_unlink_use",fn:qb,evt:"click"},{sel:"[id^=tool_align]",fn:g,evt:"click"},{sel:"#tool_switch",fn:h,evt:"click",key:["X",true]},{sel:"#tool_bold",fn:Vb,evt:"mousedown",key:[fa+"B",true]},{sel:"#tool_italic",fn:ac,evt:"mousedown",key:[fa+"I",true]},{sel:"#copy_save_done",fn:ga,evt:"click"},{key:"ctrl+left",fn:function(){Ub(0,1)}},{key:"ctrl+right",fn:function(){Ub(1,1)}},{key:"ctrl+shift+left",fn:function(){Ub(0,5)}},{key:"ctrl+shift+right",
|
true],fn:function(){vb(0,1)}},{key:["left",true],fn:function(){vb(-1,0)}},{key:["right",true],fn:function(){vb(1,0)}},{key:"shift+up",fn:function(){vb(0,-10)}},{key:"shift+down",fn:function(){vb(0,10)}},{key:"shift+left",fn:function(){vb(-10,0)}},{key:"shift+right",fn:function(){vb(10,0)}},{key:["alt+up",true],fn:function(){f.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){f.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){f.cloneSelectedElements(-1,0)}},{key:["alt+right",
|
||||||
fn:function(){Ub(1,5)}},{key:"shift+O",fn:Yb},{key:"shift+P",fn:bc},{key:[fa+"+",true],fn:function(){k(2)}},{key:[fa+"-",true],fn:function(){k(0.5)}},{key:["up",true],fn:function(){vb(0,-1)}},{key:["down",true],fn:function(){vb(0,1)}},{key:["left",true],fn:function(){vb(-1,0)}},{key:["right",true],fn:function(){vb(1,0)}},{key:"shift+up",fn:function(){vb(0,-10)}},{key:"shift+down",fn:function(){vb(0,10)}},{key:"shift+left",fn:function(){vb(-10,0)}},{key:"shift+right",fn:function(){vb(10,0)}},{key:["alt+up",
|
true],fn:function(){f.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){f.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){f.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){f.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){f.cloneSelectedElements(10,0)}},{key:fa+"A",fn:function(){f.selectAllInCurrentLayer()}},{key:fa+"z",fn:fc},{key:fa+"shift+z",fn:Rb},{key:fa+"y",fn:Rb},{key:"esc",fn:t},{key:fa+"x",fn:Oa},
|
||||||
true],fn:function(){f.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){f.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){f.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){f.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){f.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){f.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){f.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",
|
{key:fa+"c",fn:Wa},{key:fa+"v",fn:fb}],B={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var K={};a.each(q,function(R,X){if(X.sel){var ja=a(X.sel);if(ja.length==0)return true;if(X.evt){if(svgedit.browser.isTouch()&&X.evt==="click")X.evt="mousedown";ja[X.evt](X.fn)}if(X.parent&&a(X.parent+"_show").length!=0){var va=a(X.parent);va.length||(va=Ga(X.parent.substr(1)));va.append(ja);a.isArray(K[X.parent])||(K[X.parent]=[]);K[X.parent].push(X)}}if(X.key){var xa=
|
||||||
true],fn:function(){f.cloneSelectedElements(10,0)}},{key:fa+"A",fn:function(){f.selectAllInCurrentLayer()}},{key:fa+"z",fn:fc},{key:fa+"shift+z",fn:Rb},{key:fa+"y",fn:Rb},{key:"esc",fn:t},{key:fa+"x",fn:Oa},{key:fa+"c",fn:Wa},{key:fa+"v",fn:fb}],A={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var J={};a.each(q,function(R,W){if(W.sel){var ha=a(W.sel);if(ha.length==0)return true;if(W.evt){if(svgedit.browser.isTouch()&&W.evt==="click")W.evt="mousedown";ha[W.evt](W.fn)}if(W.parent&&
|
X.fn,Ca=false;if(a.isArray(X.key)){va=X.key[0];if(X.key.length>1)Ca=X.key[1]}else va=X.key;va+="";svgedit.browser.isMac&&va.indexOf("+")!=-1&&va.split("+")[0]=="ctrl"&&va.replace("ctrl","cmd");a.each(va.split("/"),function(Aa,yb){a(document).bind("keydown",yb,function(Ta){xa();Ca&&Ta.preventDefault();return false})});if(X.sel&&!X.hidekey&&ja.attr("title")){var Ba=ja.attr("title").split("[")[0]+" ("+va+")";B[va]=X.sel;ja.parents("#main_menu").length||ja.attr("title",Ba)}}});Pa(K);a(".attr_changer, #image_url").bind("keydown",
|
||||||
a(W.parent+"_show").length!=0){var va=a(W.parent);va.length||(va=Ga(W.parent.substr(1)));va.append(ha);a.isArray(J[W.parent])||(J[W.parent]=[]);J[W.parent].push(W)}}if(W.key){var xa=W.fn,Ca=false;if(a.isArray(W.key)){va=W.key[0];if(W.key.length>1)Ca=W.key[1]}else va=W.key;va+="";svgedit.browser.isMac&&va.indexOf("+")!=-1&&va.split("+")[0]=="ctrl"&&va.replace("ctrl","cmd");a.each(va.split("/"),function(Aa,yb){a(document).bind("keydown",yb,function(Ta){xa();Ca&&Ta.preventDefault();return false})});
|
"return",function(R){a(this).change();R.preventDefault()});a(window).bind("keydown","tab",function(R){if(U==="canvas"){R.preventDefault();bc()}}).bind("keydown","shift+tab",function(R){if(U==="canvas"){R.preventDefault();Yb()}});a("#tool_zoom").dblclick(ta)},setTitles:function(){a.each(B,function(K,R){var X=a(R).parents("#main_menu").length;a(R).each(function(){var ja=X?a(this).text().split(" [")[0]:this.title.split(" [")[0],va="";a.each(K.split("/"),function(xa,Ca){var Ba=Ca.split("+"),Aa="";if(Ba.length>
|
||||||
if(W.sel&&!W.hidekey&&ha.attr("title")){var Ba=ha.attr("title").split("[")[0]+" ("+va+")";A[va]=W.sel;ha.parents("#main_menu").length||ha.attr("title",Ba)}}});Pa(J);a(".attr_changer, #image_url").bind("keydown","return",function(R){a(this).change();R.preventDefault()});a(window).bind("keydown","tab",function(R){if(U==="canvas"){R.preventDefault();bc()}}).bind("keydown","shift+tab",function(R){if(U==="canvas"){R.preventDefault();Yb()}});a("#tool_zoom").dblclick(ta)},setTitles:function(){a.each(A,function(J,
|
1){Aa=Ba[0]+"+";Ca=Ba[1]}va+=(xa?"/":"")+Aa+(e["key_"+Ca]||Ca)});if(X)this.lastChild.textContent=ja+" ["+va+"]";else this.title=ja+" ["+va+"]"})})},getButtonData:function(K){var R;a.each(q,function(X,ja){if(ja.sel===K)R=ja});return R}}}();oc.setAll();c.ready(function(){var q=d.initTool,B=a("#tools_left, #svg_editor .tools_flyout"),K=B.find("#tool_"+q);q=B.find("#"+q);(K.length?K:q.length?q:a("#tool_select")).click().mouseup();d.wireframe&&a("#tool_wireframe").click();d.showlayers&&sc();a("#rulers").toggle(!!d.showRulers);
|
||||||
R){var W=a(R).parents("#main_menu").length;a(R).each(function(){var ha=W?a(this).text().split(" [")[0]:this.title.split(" [")[0],va="";a.each(J.split("/"),function(xa,Ca){var Ba=Ca.split("+"),Aa="";if(Ba.length>1){Aa=Ba[0]+"+";Ca=Ba[1]}va+=(xa?"/":"")+Aa+(e["key_"+Ca]||Ca)});if(W)this.lastChild.textContent=ha+" ["+va+"]";else this.title=ha+" ["+va+"]"})})},getButtonData:function(J){var R;a.each(q,function(W,ha){if(ha.sel===J)R=ha});return R}}}();pc.setAll();c.ready(function(){var q=d.initTool,A=a("#tools_left, #svg_editor .tools_flyout"),
|
if(d.showRulers)a("#show_rulers")[0].checked=true;if(d.gridSnapping)a("#grid_snapping_on")[0].checked=true;d.baseUnit&&a("#base_unit").val(d.baseUnit);d.snappingStep&&a("#grid_snapping_step").val(d.snappingStep)});a("#rect_rx").SpinButton({min:0,max:1E3,step:1,callback:function(q){f.setRectRadius(q.value)}});a("#stroke_width").SpinButton({min:0,max:99,step:1,smallStep:0.1,callback:function(q){var B=q.value;if(B==0&&Z&&["line","polyline"].indexOf(Z.nodeName)>=0)B=q.value=1;f.setStrokeWidth(B)}});a("#angle").SpinButton({min:-180,
|
||||||
J=A.find("#tool_"+q);q=A.find("#"+q);(J.length?J:q.length?q:a("#tool_select")).click().mouseup();d.wireframe&&a("#tool_wireframe").click();d.showlayers&&tc();a("#rulers").toggle(!!d.showRulers);if(d.showRulers)a("#show_rulers")[0].checked=true;if(d.gridSnapping)a("#grid_snapping_on")[0].checked=true;d.baseUnit&&a("#base_unit").val(d.baseUnit);d.snappingStep&&a("#grid_snapping_step").val(d.snappingStep)});a("#rect_rx").SpinButton({min:0,max:1E3,step:1,callback:function(q){f.setRectRadius(q.value)}});
|
max:180,step:5,callback:function(q){f.setRotationAngle(q.value);a("#tool_reorient").toggleClass("disabled",q.value==0)}});a("#font_size").SpinButton({step:1,min:0.0010,stepfunc:function(q,B){var K=q.value-0,R=K+B,X=R>=K;if(B===0)return K;return K>=24?X?Math.round(K*1.1):Math.round(K/1.1):K<=1?X?K*2:K/2:R},callback:function(q){f.setFontSize(q.value)}});a("#group_opacity").SpinButton({step:5,min:0,max:100,callback:ob});a("#blur").SpinButton({step:0.1,min:0,max:10,callback:Cb});a("#zoom").SpinButton({min:0.0010,
|
||||||
a("#stroke_width").SpinButton({min:0,max:99,step:1,smallStep:0.1,callback:function(q){var A=q.value;if(A==0&&Y&&["line","polyline"].indexOf(Y.nodeName)>=0)A=q.value=1;f.setStrokeWidth(A)}});a("#angle").SpinButton({min:-180,max:180,step:5,callback:function(q){f.setRotationAngle(q.value);a("#tool_reorient").toggleClass("disabled",q.value==0)}});a("#font_size").SpinButton({step:1,min:0.0010,stepfunc:function(q,A){var J=q.value-0,R=J+A,W=R>=J;if(A===0)return J;return J>=24?W?Math.round(J*1.1):Math.round(J/
|
max:1E4,step:50,stepfunc:function(q,B){var K=q.value-0;if(K===0)return 100;var R=K+B;if(B===0)return K;return K>=100?R:R>=K?K*2:K/2},callback:Ja}).val(f.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(q){switch(q){case "delete":Y();break;case "cut":Oa();break;case "copy":Wa();break;case "paste":f.pasteElements();break;case "paste_in_place":f.pasteElements("in_place");break;case "group":f.groupSelectedElements();break;case "ungroup":f.ungroupSelectedElement();break;
|
||||||
1.1):J<=1?W?J*2:J/2:R},callback:function(q){f.setFontSize(q.value)}});a("#group_opacity").SpinButton({step:5,min:0,max:100,callback:pb});a("#blur").SpinButton({step:0.1,min:0,max:10,callback:Cb});a("#zoom").SpinButton({min:0.0010,max:1E4,step:50,stepfunc:function(q,A){var J=q.value-0;if(J===0)return 100;var R=J+A;if(A===0)return J;return J>=100?R:R>=J?J*2:J/2},callback:Ja}).val(f.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(q){switch(q){case "delete":X();break;
|
case "move_front":tb();break;case "move_up":Z!=null&&f.moveUpDownSelected("Up");break;case "move_down":Z!=null&&f.moveUpDownSelected("Down");break;case "move_back":wb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(q)&&svgedit.contextmenu.getCustomHandler(q).call()}f.clipBoard.length&&pa.enableContextMenuItems("#paste,#paste_in_place")});V=function(q){switch(q){case "dupe":N();break;case "delete":T();break;case "merge_down":if(a("#layerlist tr.layersel").index()!=f.getCurrentDrawing().getNumLayers()-
|
||||||
case "cut":Oa();break;case "copy":Wa();break;case "paste":f.pasteElements();break;case "paste_in_place":f.pasteElements("in_place");break;case "group":f.groupSelectedElements();break;case "ungroup":f.ungroupSelectedElement();break;case "move_front":tb();break;case "move_up":Y!=null&&f.moveUpDownSelected("Up");break;case "move_down":Y!=null&&f.moveUpDownSelected("Down");break;case "move_back":wb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(q)&&svgedit.contextmenu.getCustomHandler(q).call()}f.clipBoard.length&&
|
1){f.mergeLayer();Za();Fb()}break;case "merge_all":f.mergeAllLayers();Za();Fb()}};a("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},V);a("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:true},V);a(".contextMenu li").mousedown(function(q){q.preventDefault()});a("#cmenu_canvas li").disableContextMenu();pa.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(ha.getUndoStackSize()===0)c.show_save_warning=false;if(!d.no_save_warning&&c.show_save_warning)return e.notification.unsavedChanges};
|
||||||
pa.enableContextMenuItems("#paste,#paste_in_place")});V=function(q){switch(q){case "dupe":N();break;case "delete":T();break;case "merge_down":if(a("#layerlist tr.layersel").index()!=f.getCurrentDrawing().getNumLayers()-1){f.mergeLayer();Za();Fb()}break;case "merge_all":f.mergeAllLayers();Za();Fb()}};a("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},V);a("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:true},V);a(".contextMenu li").mousedown(function(q){q.preventDefault()});
|
c.openPrep=function(q){a("#main_menu").hide();ha.getUndoStackSize()===0?q(true):a.confirm(e.notification.QwantToOpen,q)};if(window.FileReader){V=a('<input type="file">').change(function(){var q=this;c.openPrep(function(B){if(B){f.clear();if(q.files.length==1){B=new FileReader;B.onloadend=function(K){n(K.target.result);Sb()};B.readAsText(q.files[0])}}})});a("#tool_open").show().prepend(V);V=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var q=new FileReader;
|
||||||
a("#cmenu_canvas li").disableContextMenu();pa.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(ia.getUndoStackSize()===0)c.show_save_warning=false;if(!d.no_save_warning&&c.show_save_warning)return e.notification.unsavedChanges};c.openPrep=function(q){a("#main_menu").hide();ia.getUndoStackSize()===0?q(true):a.confirm(e.notification.QwantToOpen,q)};if(window.FileReader){V=a('<input type="file">').change(function(){var q=this;c.openPrep(function(A){if(A){f.clear();if(q.files.length==
|
q.onloadend=function(B){f.importSvgString(B.target.result,true);Sb()};q.readAsText(this.files[0])}});a("#tool_import").show().prepend(V)}var Sb=c.updateCanvas=function(q,B){var K=qa.width(),R=qa.height(),X=K,ja=R,va=f.getZoom(),xa=a("#svgcanvas"),Ca={x:qa[0].scrollLeft+X/2,y:qa[0].scrollTop+ja/2},Ba=d.canvas_expansion;K=Math.max(X,f.contentW*va*Ba);R=Math.max(ja,f.contentH*va*Ba);K==X&&R==ja?qa.css("overflow","hidden"):qa.css("overflow","scroll");Ba=xa.height()/2;var Aa=xa.width()/2;xa.width(K).height(R);
|
||||||
1){A=new FileReader;A.onloadend=function(J){n(J.target.result);Sb()};A.readAsText(q.files[0])}}})});a("#tool_open").show().prepend(V);V=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var q=new FileReader;q.onloadend=function(A){f.importSvgString(A.target.result,true);Sb()};q.readAsText(this.files[0])}});a("#tool_import").show().prepend(V)}var Sb=c.updateCanvas=function(q,A){var J=qa.width(),R=qa.height(),W=J,ha=R,va=f.getZoom(),xa=a("#svgcanvas"),Ca={x:qa[0].scrollLeft+
|
var yb=R/2,Ta=K/2,ia=f.updateCanvas(K,R),Bb=Ta/Aa;K=K/2-X/2;R=R/2-ja/2;if(B){B.x+=ia.x;B.y+=ia.y}else B={x:Ta+(Ca.x-Aa)*Bb,y:yb+(Ca.y-Ba)*Bb};if(q)if(f.contentW>qa.width()){qa[0].scrollLeft=ia.x-10;qa[0].scrollTop=ia.y-10}else{qa[0].scrollLeft=K;qa[0].scrollTop=R}else{qa[0].scrollLeft=B.x-X/2;qa[0].scrollTop=B.y-ja/2}if(d.showRulers){da(xa,va);qa.scroll()}},gc=[];for(gb=0.1;gb<1E5;gb*=10){gc.push(1*gb);gc.push(2*gb);gc.push(5*gb)}Sb(true);try{var uc=function(q){if(window.JSON&&JSON.stringify)return JSON.stringify(q);
|
||||||
W/2,y:qa[0].scrollTop+ha/2},Ba=d.canvas_expansion;J=Math.max(W,f.contentW*va*Ba);R=Math.max(ha,f.contentH*va*Ba);J==W&&R==ha?qa.css("overflow","hidden"):qa.css("overflow","scroll");Ba=xa.height()/2;var Aa=xa.width()/2;xa.width(J).height(R);var yb=R/2,Ta=J/2,ja=f.updateCanvas(J,R),Bb=Ta/Aa;J=J/2-W/2;R=R/2-ha/2;if(A){A.x+=ja.x;A.y+=ja.y}else A={x:Ta+(Ca.x-Aa)*Bb,y:yb+(Ca.y-Ba)*Bb};if(q)if(f.contentW>qa.width()){qa[0].scrollLeft=ja.x-10;qa[0].scrollTop=ja.y-10}else{qa[0].scrollLeft=J;qa[0].scrollTop=
|
var B=arguments.callee;if(typeof q=="boolean"||typeof q=="number")return q+"";else if(typeof q=="string")return'"'+q.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(X){return"\\u"+("0000"+X.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(q.length){for(var K=0;K<q.length;K++)q[K]=B(q[K]);return"["+q.join(",")+"]"}else{K=[];for(var R in q)K.push(B(R)+":"+B(q[R]));return"{"+K.join(",")+"}"}};window.addEventListener("message",
|
||||||
R}else{qa[0].scrollLeft=A.x-W/2;qa[0].scrollTop=A.y-ha/2}if(d.showRulers){da(xa,va);qa.scroll()}},gc=[];for(gb=0.1;gb<1E5;gb*=10){gc.push(1*gb);gc.push(2*gb);gc.push(5*gb)}Sb(true);try{var vc=function(q){if(window.JSON&&JSON.stringify)return JSON.stringify(q);var A=arguments.callee;if(typeof q=="boolean"||typeof q=="number")return q+"";else if(typeof q=="string")return'"'+q.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
function(q){var B=parseInt(q.data.substr(0,q.data.indexOf(";")));try{q.source.postMessage("SVGe"+B+";"+uc(eval(q.data)),"*")}catch(K){q.source.postMessage("SVGe"+B+";error:"+K.message,"*")}},false)}catch(vc){window.embed_error=vc}a(function(){window.svgCanvas=f;f.ready=svgEditor.ready});c.setLang=function(q,B){a.pref("lang",q);a("#lang_select").val(q);if(B){var K=a("#layerlist tr.layersel td.layername").text()==e.common.layer+" 1";a.extend(e,B);f.setUiStrings(B);oc.setTitles();if(K){f.renameCurrentLayer(e.common.layer+
|
||||||
function(W){return"\\u"+("0000"+W.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(q.length){for(var J=0;J<q.length;J++)q[J]=A(q[J]);return"["+q.join(",")+"]"}else{J=[];for(var R in q)J.push(A(R)+":"+A(q[R]));return"{"+J.join(",")+"}"}};window.addEventListener("message",function(q){var A=parseInt(q.data.substr(0,q.data.indexOf(";")));try{q.source.postMessage("SVGe"+A+";"+vc(eval(q.data)),"*")}catch(J){q.source.postMessage("SVGe"+A+";error:"+J.message,"*")}},false)}catch(wc){window.embed_error=
|
" 1");Fb()}f.runExtensions("langChanged",q);Pb();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(R,X){a(X).attr("title",a(R)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var u=[];c.ready=function(z){m?z():u.push(z)};c.runCallbacks=function(){a.each(u,
|
||||||
wc}a(function(){window.svgCanvas=f;f.ready=svgEditor.ready});c.setLang=function(q,A){a.pref("lang",q);a("#lang_select").val(q);if(A){var J=a("#layerlist tr.layersel td.layername").text()==e.common.layer+" 1";a.extend(e,A);f.setUiStrings(A);pc.setTitles();if(J){f.renameCurrentLayer(e.common.layer+" 1");Fb()}f.runExtensions("langChanged",q);Pb();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin",
|
function(){this()});m=true};c.loadFromString=function(z){c.ready(function(){n(z)})};c.disableUI=function(){};c.loadFromURL=function(z,p){p||(p={});var L=p.cache,T=p.callback;c.ready(function(){a.ajax({url:z,dataType:"text",cache:!!L,success:function(N){n(N,T)},error:function(N,J,da){N.status!=404&&N.responseText?n(N.responseText,T):a.alert(e.notification.URLloadFail+": \n"+da+"",T)}})})};c.loadFromDataURI=function(z){c.ready(function(){var p=z.substring(26);n(svgedit.utilities.decode64(p))})};c.addExtension=
|
||||||
"#linecap_butt":"#cur_linecap"},function(R,W){a(W).attr("title",a(R)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};var u=[];c.ready=function(z){m?z():u.push(z)};c.runCallbacks=function(){a.each(u,function(){this()});m=true};c.loadFromString=function(z){c.ready(function(){n(z)})};c.disableUI=function(){};c.loadFromURL=function(z,p){p||(p={});var L=p.cache,T=p.callback;c.ready(function(){a.ajax({url:z,dataType:"text",
|
function(){var z=arguments;a(function(){f&&f.addExtension.apply(this,z)})};return c}(jQuery);$(svgEditor.init)})();svgedit=svgedit||{};
|
||||||
cache:!!L,success:function(N){n(N,T)},error:function(N,K,da){N.status!=404&&N.responseText?n(N.responseText,T):a.alert(e.notification.URLloadFail+": \n"+da+"",T)}})})};c.loadFromDataURI=function(z){c.ready(function(){var p=z.substring(26);n(svgedit.utilities.decode64(p))})};c.addExtension=function(){var z=arguments;a(function(){f&&f.addExtension.apply(this,z)})};return c}(jQuery);$(svgEditor.init)})();svgedit=svgedit||{};
|
|
||||||
(function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var n=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var f=n.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+n.id+"'>"+n.label+"<span class='shortcut'>"+f+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions=
|
(function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var n=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("<li class='separator'>");var f=n.shortcut||"";$("#cmenu_canvas").append("<li class='disabled'><a href='#"+n.id+"'>"+n.label+"<span class='shortcut'>"+f+"</span></a></li>")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions=
|
||||||
{}};svgedit.contextmenu.add=function(n){if(n&&n.id&&n.label&&n.action&&typeof n.action=="function")if(n.id in a.contextMenuExtensions)console.error('Cannot add extension "'+n.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+n.id+", label:"+n.label+"}");a.contextMenuExtensions[n.id]=n}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=
|
{}};svgedit.contextmenu.add=function(n){if(n&&n.id&&n.label&&n.action&&typeof n.action=="function")if(n.id in a.contextMenuExtensions)console.error('Cannot add extension "'+n.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+n.id+", label:"+n.label+"}");a.contextMenuExtensions[n.id]=n}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler=
|
||||||
function(n){return a.contextMenuExtensions[n]&&true};svgedit.contextmenu.getCustomHandler=function(n){return a.contextMenuExtensions[n].action}})();var svgEditor=function(a,n){function f(m,o,b){var d=a("#svg_editor").parent(),e;for(e in o){var l=o[e];l||console.log(e);if(b)e="#"+e;if(d.find(e).length){var u=d.find(e)[0];switch(m){case "content":for(var z=0;z<u.childNodes.length;z++){var p=u.childNodes[z];if(p.nodeType===3&&p.textContent.replace(/\s/g,"")){p.textContent=l;break}}break;case "title":u.title=l}}else console.log("Missing: "+e)}}var c;n.readLang=function(m){var o=n.canvas.runExtensions("addlangData",c,true);a.each(o,function(T,N){if(N.data)m=
|
function(n){return a.contextMenuExtensions[n]&&true};svgedit.contextmenu.getCustomHandler=function(n){return a.contextMenuExtensions[n].action}})();var svgEditor=function(a,n){function f(m,o,b){var d=a("#svg_editor").parent(),e;for(e in o){var l=o[e];l||console.log(e);if(b)e="#"+e;if(d.find(e).length){var u=d.find(e)[0];switch(m){case "content":for(var z=0;z<u.childNodes.length;z++){var p=u.childNodes[z];if(p.nodeType===3&&p.textContent.replace(/\s/g,"")){p.textContent=l;break}}break;case "title":u.title=l}}else console.log("Missing: "+e)}}var c;n.readLang=function(m){var o=n.canvas.runExtensions("addlangData",c,true);a.each(o,function(T,N){if(N.data)m=
|
||||||
|
@ -577,9 +577,9 @@ c.axis!="x")f.overflowOffset.top+f.scrollParent[0].offsetHeight-n.pageY<c.scroll
|
||||||
(f.scrollParent[0].scrollLeft=m=f.scrollParent[0].scrollLeft-c.scrollSpeed)}else{if(!c.axis||c.axis!="x")n.pageY-a(document).scrollTop()<c.scrollSensitivity?m=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(n.pageY-a(document).scrollTop())<c.scrollSensitivity&&(m=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed));if(!c.axis||c.axis!="y")n.pageX-a(document).scrollLeft()<c.scrollSensitivity?m=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):
|
(f.scrollParent[0].scrollLeft=m=f.scrollParent[0].scrollLeft-c.scrollSpeed)}else{if(!c.axis||c.axis!="x")n.pageY-a(document).scrollTop()<c.scrollSensitivity?m=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(n.pageY-a(document).scrollTop())<c.scrollSensitivity&&(m=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed));if(!c.axis||c.axis!="y")n.pageX-a(document).scrollLeft()<c.scrollSensitivity?m=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):
|
||||||
a(window).width()-(n.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(m=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed))}m!==false&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(f,n)}});a.ui.plugin.add("draggable","snap",{start:function(){var n=a(this).data("draggable"),f=n.options;n.snapElements=[];a(f.snap.constructor!=String?f.snap.items||":data(draggable)":f.snap).each(function(){var c=a(this),m=c.offset();this!=n.element[0]&&n.snapElements.push({item:this,
|
a(window).width()-(n.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(m=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed))}m!==false&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(f,n)}});a.ui.plugin.add("draggable","snap",{start:function(){var n=a(this).data("draggable"),f=n.options;n.snapElements=[];a(f.snap.constructor!=String?f.snap.items||":data(draggable)":f.snap).each(function(){var c=a(this),m=c.offset();this!=n.element[0]&&n.snapElements.push({item:this,
|
||||||
width:c.outerWidth(),height:c.outerHeight(),top:m.top,left:m.left})})},drag:function(n,f){for(var c=a(this).data("draggable"),m=c.options,o=m.snapTolerance,b=f.offset.left,d=b+c.helperProportions.width,e=f.offset.top,l=e+c.helperProportions.height,u=c.snapElements.length-1;u>=0;u--){var z=c.snapElements[u].left,p=z+c.snapElements[u].width,L=c.snapElements[u].top,T=L+c.snapElements[u].height;if(z-o<b&&b<p+o&&L-o<e&&e<T+o||z-o<b&&b<p+o&&L-o<l&&l<T+o||z-o<d&&d<p+o&&L-o<e&&e<T+o||z-o<d&&d<p+o&&L-o<l&&
|
width:c.outerWidth(),height:c.outerHeight(),top:m.top,left:m.left})})},drag:function(n,f){for(var c=a(this).data("draggable"),m=c.options,o=m.snapTolerance,b=f.offset.left,d=b+c.helperProportions.width,e=f.offset.top,l=e+c.helperProportions.height,u=c.snapElements.length-1;u>=0;u--){var z=c.snapElements[u].left,p=z+c.snapElements[u].width,L=c.snapElements[u].top,T=L+c.snapElements[u].height;if(z-o<b&&b<p+o&&L-o<e&&e<T+o||z-o<b&&b<p+o&&L-o<l&&l<T+o||z-o<d&&d<p+o&&L-o<e&&e<T+o||z-o<d&&d<p+o&&L-o<l&&
|
||||||
l<T+o){if(m.snapMode!="inner"){var N=Math.abs(L-l)<=o,K=Math.abs(T-e)<=o,da=Math.abs(z-d)<=o,V=Math.abs(p-b)<=o;N&&(f.position.top=c._convertPositionTo("relative",{top:L-c.helperProportions.height,left:0}).top-c.margins.top);K&&(f.position.top=c._convertPositionTo("relative",{top:T,left:0}).top-c.margins.top);da&&(f.position.left=c._convertPositionTo("relative",{top:0,left:z-c.helperProportions.width}).left-c.margins.left);V&&(f.position.left=c._convertPositionTo("relative",{top:0,left:p}).left-c.margins.left)}var O=
|
l<T+o){if(m.snapMode!="inner"){var N=Math.abs(L-l)<=o,J=Math.abs(T-e)<=o,da=Math.abs(z-d)<=o,V=Math.abs(p-b)<=o;N&&(f.position.top=c._convertPositionTo("relative",{top:L-c.helperProportions.height,left:0}).top-c.margins.top);J&&(f.position.top=c._convertPositionTo("relative",{top:T,left:0}).top-c.margins.top);da&&(f.position.left=c._convertPositionTo("relative",{top:0,left:z-c.helperProportions.width}).left-c.margins.left);V&&(f.position.left=c._convertPositionTo("relative",{top:0,left:p}).left-c.margins.left)}var O=
|
||||||
N||K||da||V;if(m.snapMode!="outer"){N=Math.abs(L-e)<=o;K=Math.abs(T-l)<=o;da=Math.abs(z-b)<=o;V=Math.abs(p-d)<=o;N&&(f.position.top=c._convertPositionTo("relative",{top:L,left:0}).top-c.margins.top);K&&(f.position.top=c._convertPositionTo("relative",{top:T-c.helperProportions.height,left:0}).top-c.margins.top);da&&(f.position.left=c._convertPositionTo("relative",{top:0,left:z}).left-c.margins.left);V&&(f.position.left=c._convertPositionTo("relative",{top:0,left:p-c.helperProportions.width}).left-
|
N||J||da||V;if(m.snapMode!="outer"){N=Math.abs(L-e)<=o;J=Math.abs(T-l)<=o;da=Math.abs(z-b)<=o;V=Math.abs(p-d)<=o;N&&(f.position.top=c._convertPositionTo("relative",{top:L,left:0}).top-c.margins.top);J&&(f.position.top=c._convertPositionTo("relative",{top:T-c.helperProportions.height,left:0}).top-c.margins.top);da&&(f.position.left=c._convertPositionTo("relative",{top:0,left:z}).left-c.margins.left);V&&(f.position.left=c._convertPositionTo("relative",{top:0,left:p-c.helperProportions.width}).left-
|
||||||
c.margins.left)}!c.snapElements[u].snapping&&(N||K||da||V||O)&&c.options.snap.snap&&c.options.snap.snap.call(c.element,n,a.extend(c._uiHash(),{snapItem:c.snapElements[u].item}));c.snapElements[u].snapping=N||K||da||V||O}else{c.snapElements[u].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,n,a.extend(c._uiHash(),{snapItem:c.snapElements[u].item}));c.snapElements[u].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var n=a(this).data("draggable").options;
|
c.margins.left)}!c.snapElements[u].snapping&&(N||J||da||V||O)&&c.options.snap.snap&&c.options.snap.snap.call(c.element,n,a.extend(c._uiHash(),{snapItem:c.snapElements[u].item}));c.snapElements[u].snapping=N||J||da||V||O}else{c.snapElements[u].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,n,a.extend(c._uiHash(),{snapItem:c.snapElements[u].item}));c.snapElements[u].snapping=false}}}});a.ui.plugin.add("draggable","stack",{start:function(){var n=a(this).data("draggable").options;
|
||||||
n=a.makeArray(a(n.stack)).sort(function(c,m){return(parseInt(a(c).css("zIndex"),10)||0)-(parseInt(a(m).css("zIndex"),10)||0)});if(n.length){var f=parseInt(n[0].style.zIndex)||0;a(n).each(function(c){this.style.zIndex=f+c});this[0].style.zIndex=f+n.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(n,f){var c=a(f.helper),m=a(this).data("draggable").options;c.css("zIndex")&&(m._zIndex=c.css("zIndex"));c.css("zIndex",m.zIndex)},stop:function(n,f){var c=a(this).data("draggable").options;
|
n=a.makeArray(a(n.stack)).sort(function(c,m){return(parseInt(a(c).css("zIndex"),10)||0)-(parseInt(a(m).css("zIndex"),10)||0)});if(n.length){var f=parseInt(n[0].style.zIndex)||0;a(n).each(function(c){this.style.zIndex=f+c});this[0].style.zIndex=f+n.length}}});a.ui.plugin.add("draggable","zIndex",{start:function(n,f){var c=a(f.helper),m=a(this).data("draggable").options;c.css("zIndex")&&(m._zIndex=c.css("zIndex"));c.css("zIndex",m.zIndex)},stop:function(n,f){var c=a(this).data("draggable").options;
|
||||||
c._zIndex&&a(f.helper).css("zIndex",c._zIndex)}})})(jQuery);
|
c._zIndex&&a(f.helper).css("zIndex",c._zIndex)}})})(jQuery);
|
||||||
(function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var n=this,f=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),m=f.values&&f.values.length||1,o=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
|
(function(a){a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var n=this,f=this.options,c=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),m=f.values&&f.values.length||1,o=[];this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+
|
||||||
|
@ -600,73 +600,73 @@ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui
|
||||||
return f=this._trimAlignValue(f)}f=this.options.values.slice();for(c=0;c<f.length;c+=1)f[c]=this._trimAlignValue(f[c]);return f},_trimAlignValue:function(n){if(n<=this._valueMin())return this._valueMin();if(n>=this._valueMax())return this._valueMax();var f=this.options.step>0?this.options.step:1,c=(n-this._valueMin())%f;n=n-c;Math.abs(c)*2>=f&&(n+=c>0?f:-f);return parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var n=
|
return f=this._trimAlignValue(f)}f=this.options.values.slice();for(c=0;c<f.length;c+=1)f[c]=this._trimAlignValue(f[c]);return f},_trimAlignValue:function(n){if(n<=this._valueMin())return this._valueMin();if(n>=this._valueMax())return this._valueMax();var f=this.options.step>0?this.options.step:1,c=(n-this._valueMin())%f;n=n-c;Math.abs(c)*2>=f&&(n+=c>0?f:-f);return parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var n=
|
||||||
this.options.range,f=this.options,c=this,m=this._animateOff?false:f.animate,o,b={},d,e,l,u;this.options.values&&this.options.values.length?this.handles.each(function(z){o=(c.values(z)-c._valueMin())/(c._valueMax()-c._valueMin())*100;b[c.orientation==="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[m?"animate":"css"](b,f.animate);c.options.range===true&&(c.orientation==="horizontal"?(z===0&&c.range.stop(1,1)[m?"animate":"css"]({left:o+"%"},f.animate),z===1&&c.range[m?"animate":"css"]({width:o-
|
this.options.range,f=this.options,c=this,m=this._animateOff?false:f.animate,o,b={},d,e,l,u;this.options.values&&this.options.values.length?this.handles.each(function(z){o=(c.values(z)-c._valueMin())/(c._valueMax()-c._valueMin())*100;b[c.orientation==="horizontal"?"left":"bottom"]=o+"%";a(this).stop(1,1)[m?"animate":"css"](b,f.animate);c.options.range===true&&(c.orientation==="horizontal"?(z===0&&c.range.stop(1,1)[m?"animate":"css"]({left:o+"%"},f.animate),z===1&&c.range[m?"animate":"css"]({width:o-
|
||||||
d+"%"},{queue:false,duration:f.animate})):(z===0&&c.range.stop(1,1)[m?"animate":"css"]({bottom:o+"%"},f.animate),z===1&&c.range[m?"animate":"css"]({height:o-d+"%"},{queue:false,duration:f.animate})));d=o}):(e=this.value(),l=this._valueMin(),u=this._valueMax(),o=u!==l?(e-l)/(u-l)*100:0,b[c.orientation==="horizontal"?"left":"bottom"]=o+"%",this.handle.stop(1,1)[m?"animate":"css"](b,f.animate),n==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[m?"animate":"css"]({width:o+"%"},f.animate),
|
d+"%"},{queue:false,duration:f.animate})):(z===0&&c.range.stop(1,1)[m?"animate":"css"]({bottom:o+"%"},f.animate),z===1&&c.range[m?"animate":"css"]({height:o-d+"%"},{queue:false,duration:f.animate})));d=o}):(e=this.value(),l=this._valueMin(),u=this._valueMax(),o=u!==l?(e-l)/(u-l)*100:0,b[c.orientation==="horizontal"?"left":"bottom"]=o+"%",this.handle.stop(1,1)[m?"animate":"css"](b,f.animate),n==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[m?"animate":"css"]({width:o+"%"},f.animate),
|
||||||
n==="max"&&this.orientation==="horizontal"&&this.range[m?"animate":"css"]({width:100-o+"%"},{queue:false,duration:f.animate}),n==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[m?"animate":"css"]({height:o+"%"},f.animate),n==="max"&&this.orientation==="vertical"&&this.range[m?"animate":"css"]({height:100-o+"%"},{queue:false,duration:f.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(b,d){if(d===undefined)d=0;return Math.round(b*Math.pow(10,d))/Math.pow(10,d)};var n=function(b,d){var e=this,l=b.find("img:first"),u=0,z=100,p=100,L=0,T=100,N=100,K=0,da=0,V,O,fa=[],sa=function(S){for(var U=0;U<fa.length;U++)fa[U].call(e,e,S)},ia=function(S){var U=b.offset();V={l:U.left|0,t:U.top|0};clearTimeout(O);O=setTimeout(function(){qa.call(e,S)},0);a(document).bind("mousemove",ca).bind("mouseup",ea);S.preventDefault()},ca=function(S){clearTimeout(O);O=setTimeout(function(){qa.call(e,
|
n==="max"&&this.orientation==="horizontal"&&this.range[m?"animate":"css"]({width:100-o+"%"},{queue:false,duration:f.animate}),n==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[m?"animate":"css"]({height:o+"%"},f.animate),n==="max"&&this.orientation==="vertical"&&this.range[m?"animate":"css"]({height:100-o+"%"},{queue:false,duration:f.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(b,d){if(d===undefined)d=0;return Math.round(b*Math.pow(10,d))/Math.pow(10,d)};var n=function(b,d){var e=this,l=b.find("img:first"),u=0,z=100,p=100,L=0,T=100,N=100,J=0,da=0,V,O,fa=[],sa=function(S){for(var U=0;U<fa.length;U++)fa[U].call(e,e,S)},ha=function(S){var U=b.offset();V={l:U.left|0,t:U.top|0};clearTimeout(O);O=setTimeout(function(){qa.call(e,S)},0);a(document).bind("mousemove",ca).bind("mouseup",ea);S.preventDefault()},ca=function(S){clearTimeout(O);O=setTimeout(function(){qa.call(e,
|
||||||
S)},0);S.stopPropagation();S.preventDefault();return false},ea=function(S){a(document).unbind("mouseup",ea).unbind("mousemove",ca);S.stopPropagation();S.preventDefault();return false},qa=function(S){var U=S.pageX-V.l;S=S.pageY-V.t;var ra=b.w,la=b.h;if(U<0)U=0;else if(U>ra)U=ra;if(S<0)S=0;else if(S>la)S=la;pa.call(e,"xy",{x:U/ra*p+u,y:S/la*N+L})},pa=function(S,U,ra){if(U===undefined){if(S===undefined||S==null)S="xy";switch(S.toLowerCase()){case "x":return K;case "y":return da;default:return{x:K,y:da}}}if(!(ra!=
|
S)},0);S.stopPropagation();S.preventDefault();return false},ea=function(S){a(document).unbind("mouseup",ea).unbind("mousemove",ca);S.stopPropagation();S.preventDefault();return false},qa=function(S){var U=S.pageX-V.l;S=S.pageY-V.t;var ra=b.w,la=b.h;if(U<0)U=0;else if(U>ra)U=ra;if(S<0)S=0;else if(S>la)S=la;pa.call(e,"xy",{x:U/ra*p+u,y:S/la*N+L})},pa=function(S,U,ra){if(U===undefined){if(S===undefined||S==null)S="xy";switch(S.toLowerCase()){case "x":return J;case "y":return da;default:return{x:J,y:da}}}if(!(ra!=
|
||||||
null&&ra==e)){var la=false,ma,Y;if(S==null)S="xy";switch(S.toLowerCase()){case "x":ma=U&&(U.x&&U.x|0||U|0)||0;break;case "y":Y=U&&(U.y&&U.y|0||U|0)||0;break;default:ma=U&&U.x&&U.x|0||0;Y=U&&U.y&&U.y|0||0}if(ma!=null){if(ma<u)ma=u;else if(ma>z)ma=z;if(K!=ma){K=ma;la=true}}if(Y!=null){if(Y<L)Y=L;else if(Y>T)Y=T;if(da!=Y){da=Y;la=true}}la&&sa.call(e,ra||e)}},ba=function(S){a.isFunction(S)&&fa.push(S)};a.extend(true,e,{val:pa,range:function(S,U){if(U===undefined){if(S===undefined||S==null)S="all";switch(S.toLowerCase()){case "minx":return u;
|
null&&ra==e)){var la=false,ma,Z;if(S==null)S="xy";switch(S.toLowerCase()){case "x":ma=U&&(U.x&&U.x|0||U|0)||0;break;case "y":Z=U&&(U.y&&U.y|0||U|0)||0;break;default:ma=U&&U.x&&U.x|0||0;Z=U&&U.y&&U.y|0||0}if(ma!=null){if(ma<u)ma=u;else if(ma>z)ma=z;if(J!=ma){J=ma;la=true}}if(Z!=null){if(Z<L)Z=L;else if(Z>T)Z=T;if(da!=Z){da=Z;la=true}}la&&sa.call(e,ra||e)}},ba=function(S){a.isFunction(S)&&fa.push(S)};a.extend(true,e,{val:pa,range:function(S,U){if(U===undefined){if(S===undefined||S==null)S="all";switch(S.toLowerCase()){case "minx":return u;
|
||||||
case "maxx":return z;case "rangex":return{minX:u,maxX:z,rangeX:p};case "miny":return L;case "maxy":return T;case "rangey":return{minY:L,maxY:T,rangeY:N};default:return{minX:u,maxX:z,rangeX:p,minY:L,maxY:T,rangeY:N}}}var ra,la,ma,Y;if(S==null)S="all";switch(S.toLowerCase()){case "minx":ra=U&&(U.minX&&U.minX|0||U|0)||0;break;case "maxx":la=U&&(U.maxX&&U.maxX|0||U|0)||0;break;case "rangex":ra=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;break;case "miny":ma=U&&(U.minY&&U.minY|0||U|0)||0;break;case "maxy":Y=
|
case "maxx":return z;case "rangex":return{minX:u,maxX:z,rangeX:p};case "miny":return L;case "maxy":return T;case "rangey":return{minY:L,maxY:T,rangeY:N};default:return{minX:u,maxX:z,rangeX:p,minY:L,maxY:T,rangeY:N}}}var ra,la,ma,Z;if(S==null)S="all";switch(S.toLowerCase()){case "minx":ra=U&&(U.minX&&U.minX|0||U|0)||0;break;case "maxx":la=U&&(U.maxX&&U.maxX|0||U|0)||0;break;case "rangex":ra=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;break;case "miny":ma=U&&(U.minY&&U.minY|0||U|0)||0;break;case "maxy":Z=
|
||||||
U&&(U.maxY&&U.maxY|0||U|0)||0;break;case "rangey":ma=U&&U.minY&&U.minY|0||0;Y=U&&U.maxY&&U.maxY|0||0;break;default:ra=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;ma=U&&U.minY&&U.minY|0||0;Y=U&&U.maxY&&U.maxY|0||0}if(ra!=null&&u!=ra){u=ra;p=z-u}if(la!=null&&z!=la){z=la;p=z-u}if(ma!=null&&L!=ma){L=ma;N=T-L}if(Y!=null&&T!=Y){T=Y;N=T-L}},bind:ba,unbind:function(S){if(a.isFunction(S))for(var U;(U=a.inArray(S,fa))!=-1;)fa.splice(U,1)},destroy:function(){a(document).unbind("mouseup",ea).unbind("mousemove",
|
U&&(U.maxY&&U.maxY|0||U|0)||0;break;case "rangey":ma=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0;break;default:ra=U&&U.minX&&U.minX|0||0;la=U&&U.maxX&&U.maxX|0||0;ma=U&&U.minY&&U.minY|0||0;Z=U&&U.maxY&&U.maxY|0||0}if(ra!=null&&u!=ra){u=ra;p=z-u}if(la!=null&&z!=la){z=la;p=z-u}if(ma!=null&&L!=ma){L=ma;N=T-L}if(Z!=null&&T!=Z){T=Z;N=T-L}},bind:ba,unbind:function(S){if(a.isFunction(S))for(var U;(U=a.inArray(S,fa))!=-1;)fa.splice(U,1)},destroy:function(){a(document).unbind("mouseup",ea).unbind("mousemove",
|
||||||
ca);b.unbind("mousedown",ia);fa=l=b=null}});l.src=d.arrow&&d.arrow.image;l.w=d.arrow&&d.arrow.width||l.width();l.h=d.arrow&&d.arrow.height||l.height();b.w=d.map&&d.map.width||b.width();b.h=d.map&&d.map.height||b.height();b.bind("mousedown",ia);ba.call(e,function(){var S=0,U=0,ra=b.w,la=b.h,ma=l.w,Y=l.h;setTimeout(function(){if(p>0)S=K==z?ra:K/p*ra|0;if(N>0)U=da==T?la:da/N*la|0;if(ma>=ra)S=(ra>>1)-(ma>>1);else S-=ma>>1;if(Y>=la)U=(la>>1)-(Y>>1);else U-=Y>>1;l.css({left:S+"px",top:U+"px"})},0)})},f=
|
ca);b.unbind("mousedown",ha);fa=l=b=null}});l.src=d.arrow&&d.arrow.image;l.w=d.arrow&&d.arrow.width||l.width();l.h=d.arrow&&d.arrow.height||l.height();b.w=d.map&&d.map.width||b.width();b.h=d.map&&d.map.height||b.height();b.bind("mousedown",ha);ba.call(e,function(){var S=0,U=0,ra=b.w,la=b.h,ma=l.w,Z=l.h;setTimeout(function(){if(p>0)S=J==z?ra:J/p*ra|0;if(N>0)U=da==T?la:da/N*la|0;if(ma>=ra)S=(ra>>1)-(ma>>1);else S-=ma>>1;if(Z>=la)U=(la>>1)-(Z>>1);else U-=Z>>1;l.css({left:S+"px",top:U+"px"})},0)})},f=
|
||||||
function(b,d,e,l){var u=this;b=b.find("td.Text input");var z=b.eq(3),p=b.eq(4),L=b.eq(5),T=b.length>7?b.eq(6):null,N=b.eq(0),K=b.eq(1),da=b.eq(2),V=b.eq(b.length>7?7:6),O=b.length>7?b.eq(8):null,fa=function(pa){if(!(pa.target.value==""&&pa.target!=V.get(0)&&(e!=null&&pa.target!=e.get(0)||e==null))){if(!ca(pa))return pa;switch(pa.target){case z.get(0):switch(pa.keyCode){case 38:z.val(ea.call(u,(z.val()<<0)+1,0,255));d.val("r",z.val(),pa.target);return false;case 40:z.val(ea.call(u,(z.val()<<0)-1,0,
|
function(b,d,e,l){var u=this;b=b.find("td.Text input");var z=b.eq(3),p=b.eq(4),L=b.eq(5),T=b.length>7?b.eq(6):null,N=b.eq(0),J=b.eq(1),da=b.eq(2),V=b.eq(b.length>7?7:6),O=b.length>7?b.eq(8):null,fa=function(pa){if(!(pa.target.value==""&&pa.target!=V.get(0)&&(e!=null&&pa.target!=e.get(0)||e==null))){if(!ca(pa))return pa;switch(pa.target){case z.get(0):switch(pa.keyCode){case 38:z.val(ea.call(u,(z.val()<<0)+1,0,255));d.val("r",z.val(),pa.target);return false;case 40:z.val(ea.call(u,(z.val()<<0)-1,0,
|
||||||
255));d.val("r",z.val(),pa.target);return false}break;case p.get(0):switch(pa.keyCode){case 38:p.val(ea.call(u,(p.val()<<0)+1,0,255));d.val("g",p.val(),pa.target);return false;case 40:p.val(ea.call(u,(p.val()<<0)-1,0,255));d.val("g",p.val(),pa.target);return false}break;case L.get(0):switch(pa.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));d.val("b",L.val(),pa.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));d.val("b",L.val(),pa.target);return false}break;case T&&T.get(0):switch(pa.keyCode){case 38:T.val(ea.call(u,
|
255));d.val("r",z.val(),pa.target);return false}break;case p.get(0):switch(pa.keyCode){case 38:p.val(ea.call(u,(p.val()<<0)+1,0,255));d.val("g",p.val(),pa.target);return false;case 40:p.val(ea.call(u,(p.val()<<0)-1,0,255));d.val("g",p.val(),pa.target);return false}break;case L.get(0):switch(pa.keyCode){case 38:L.val(ea.call(u,(L.val()<<0)+1,0,255));d.val("b",L.val(),pa.target);return false;case 40:L.val(ea.call(u,(L.val()<<0)-1,0,255));d.val("b",L.val(),pa.target);return false}break;case T&&T.get(0):switch(pa.keyCode){case 38:T.val(ea.call(u,
|
||||||
parseFloat(T.val())+1,0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);return false;case 40:T.val(ea.call(u,parseFloat(T.val())-1,0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);return false}break;case N.get(0):switch(pa.keyCode){case 38:N.val(ea.call(u,(N.val()<<0)+1,0,360));d.val("h",N.val(),pa.target);return false;case 40:N.val(ea.call(u,(N.val()<<0)-1,0,360));d.val("h",N.val(),pa.target);return false}break;case K.get(0):switch(pa.keyCode){case 38:K.val(ea.call(u,(K.val()<<
|
parseFloat(T.val())+1,0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);return false;case 40:T.val(ea.call(u,parseFloat(T.val())-1,0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);return false}break;case N.get(0):switch(pa.keyCode){case 38:N.val(ea.call(u,(N.val()<<0)+1,0,360));d.val("h",N.val(),pa.target);return false;case 40:N.val(ea.call(u,(N.val()<<0)-1,0,360));d.val("h",N.val(),pa.target);return false}break;case J.get(0):switch(pa.keyCode){case 38:J.val(ea.call(u,(J.val()<<
|
||||||
0)+1,0,100));d.val("s",K.val(),pa.target);return false;case 40:K.val(ea.call(u,(K.val()<<0)-1,0,100));d.val("s",K.val(),pa.target);return false}break;case da.get(0):switch(pa.keyCode){case 38:da.val(ea.call(u,(da.val()<<0)+1,0,100));d.val("v",da.val(),pa.target);return false;case 40:da.val(ea.call(u,(da.val()<<0)-1,0,100));d.val("v",da.val(),pa.target);return false}}}},sa=function(pa){if(!(pa.target.value==""&&pa.target!=V.get(0)&&(e!=null&&pa.target!=e.get(0)||e==null))){if(!ca(pa))return pa;switch(pa.target){case z.get(0):z.val(ea.call(u,
|
0)+1,0,100));d.val("s",J.val(),pa.target);return false;case 40:J.val(ea.call(u,(J.val()<<0)-1,0,100));d.val("s",J.val(),pa.target);return false}break;case da.get(0):switch(pa.keyCode){case 38:da.val(ea.call(u,(da.val()<<0)+1,0,100));d.val("v",da.val(),pa.target);return false;case 40:da.val(ea.call(u,(da.val()<<0)-1,0,100));d.val("v",da.val(),pa.target);return false}}}},sa=function(pa){if(!(pa.target.value==""&&pa.target!=V.get(0)&&(e!=null&&pa.target!=e.get(0)||e==null))){if(!ca(pa))return pa;switch(pa.target){case z.get(0):z.val(ea.call(u,
|
||||||
z.val(),0,255));d.val("r",z.val(),pa.target);break;case p.get(0):p.val(ea.call(u,p.val(),0,255));d.val("g",p.val(),pa.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));d.val("b",L.val(),pa.target);break;case T&&T.get(0):T.val(ea.call(u,T.val(),0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);break;case N.get(0):N.val(ea.call(u,N.val(),0,360));d.val("h",N.val(),pa.target);break;case K.get(0):K.val(ea.call(u,K.val(),0,100));d.val("s",K.val(),pa.target);break;case da.get(0):da.val(ea.call(u,
|
z.val(),0,255));d.val("r",z.val(),pa.target);break;case p.get(0):p.val(ea.call(u,p.val(),0,255));d.val("g",p.val(),pa.target);break;case L.get(0):L.val(ea.call(u,L.val(),0,255));d.val("b",L.val(),pa.target);break;case T&&T.get(0):T.val(ea.call(u,T.val(),0,100));d.val("a",Math.precision(T.val()*255/100,l),pa.target);break;case N.get(0):N.val(ea.call(u,N.val(),0,360));d.val("h",N.val(),pa.target);break;case J.get(0):J.val(ea.call(u,J.val(),0,100));d.val("s",J.val(),pa.target);break;case da.get(0):da.val(ea.call(u,
|
||||||
da.val(),0,100));d.val("v",da.val(),pa.target);break;case V.get(0):V.val(V.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));e&&e.val(V.val());d.val("hex",V.val()!=""?V.val():null,pa.target);break;case e&&e.get(0):e.val(e.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));V.val(e.val());d.val("hex",e.val()!=""?e.val():null,pa.target);break;case O&&O.get(0):O.val(O.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));d.val("a",O.val()!=null?parseInt(O.val(),16):
|
da.val(),0,100));d.val("v",da.val(),pa.target);break;case V.get(0):V.val(V.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));e&&e.val(V.val());d.val("hex",V.val()!=""?V.val():null,pa.target);break;case e&&e.get(0):e.val(e.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));V.val(e.val());d.val("hex",e.val()!=""?e.val():null,pa.target);break;case O&&O.get(0):O.val(O.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));d.val("a",O.val()!=null?parseInt(O.val(),16):
|
||||||
null,pa.target)}}},ia=function(pa){if(d.val()!=null)switch(pa.target){case z.get(0):z.val(d.val("r"));break;case p.get(0):p.val(d.val("g"));break;case L.get(0):L.val(d.val("b"));break;case T&&T.get(0):T.val(Math.precision(d.val("a")*100/255,l));break;case N.get(0):N.val(d.val("h"));break;case K.get(0):K.val(d.val("s"));break;case da.get(0):da.val(d.val("v"));break;case V.get(0):case e&&e.get(0):V.val(d.val("hex"));e&&e.val(d.val("hex"));break;case O&&O.get(0):O.val(d.val("ahex").substring(6))}},ca=
|
null,pa.target)}}},ha=function(pa){if(d.val()!=null)switch(pa.target){case z.get(0):z.val(d.val("r"));break;case p.get(0):p.val(d.val("g"));break;case L.get(0):L.val(d.val("b"));break;case T&&T.get(0):T.val(Math.precision(d.val("a")*100/255,l));break;case N.get(0):N.val(d.val("h"));break;case J.get(0):J.val(d.val("s"));break;case da.get(0):da.val(d.val("v"));break;case V.get(0):case e&&e.get(0):V.val(d.val("hex"));e&&e.val(d.val("hex"));break;case O&&O.get(0):O.val(d.val("ahex").substring(6))}},ca=
|
||||||
function(pa){switch(pa.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(pa.ctrlKey)return false}return true},ea=function(pa,ba,S){if(pa==""||isNaN(pa))return ba;if(pa>S)return S;if(pa<ba)return ba;return pa},qa=function(pa,ba){var S=pa.val("all");if(ba!=z.get(0))z.val(S!=null?S.r:"");if(ba!=p.get(0))p.val(S!=null?S.g:"");if(ba!=L.get(0))L.val(S!=null?S.b:"");if(T&&ba!=T.get(0))T.val(S!=null?Math.precision(S.a*100/255,l):"");if(ba!=N.get(0))N.val(S!=
|
function(pa){switch(pa.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(pa.ctrlKey)return false}return true},ea=function(pa,ba,S){if(pa==""||isNaN(pa))return ba;if(pa>S)return S;if(pa<ba)return ba;return pa},qa=function(pa,ba){var S=pa.val("all");if(ba!=z.get(0))z.val(S!=null?S.r:"");if(ba!=p.get(0))p.val(S!=null?S.g:"");if(ba!=L.get(0))L.val(S!=null?S.b:"");if(T&&ba!=T.get(0))T.val(S!=null?Math.precision(S.a*100/255,l):"");if(ba!=N.get(0))N.val(S!=
|
||||||
null?S.h:"");if(ba!=K.get(0))K.val(S!=null?S.s:"");if(ba!=da.get(0))da.val(S!=null?S.v:"");if(ba!=V.get(0)&&(e&&ba!=e.get(0)||!e))V.val(S!=null?S.hex:"");if(e&&ba!=e.get(0)&&ba!=V.get(0))e.val(S!=null?S.hex:"");if(O&&ba!=O.get(0))O.val(S!=null?S.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){z.add(p).add(L).add(T).add(N).add(K).add(da).add(V).add(e).add(O).unbind("keyup",sa).unbind("blur",ia);z.add(p).add(L).add(T).add(N).add(K).add(da).unbind("keydown",fa);d.unbind(qa);O=V=da=K=N=T=L=
|
null?S.h:"");if(ba!=J.get(0))J.val(S!=null?S.s:"");if(ba!=da.get(0))da.val(S!=null?S.v:"");if(ba!=V.get(0)&&(e&&ba!=e.get(0)||!e))V.val(S!=null?S.hex:"");if(e&&ba!=e.get(0)&&ba!=V.get(0))e.val(S!=null?S.hex:"");if(O&&ba!=O.get(0))O.val(S!=null?S.ahex.substring(6):"")};a.extend(true,u,{destroy:function(){z.add(p).add(L).add(T).add(N).add(J).add(da).add(V).add(e).add(O).unbind("keyup",sa).unbind("blur",ha);z.add(p).add(L).add(T).add(N).add(J).add(da).unbind("keydown",fa);d.unbind(qa);O=V=da=J=N=T=L=
|
||||||
p=z=null}});z.add(p).add(L).add(T).add(N).add(K).add(da).add(V).add(e).add(O).bind("keyup",sa).bind("blur",ia);z.add(p).add(L).add(T).add(N).add(K).add(da).bind("keydown",fa);d.bind(qa)};a.jPicker={List:[],Color:function(b){var d=this,e,l,u,z,p,L,T,N=[],K=function(V){for(var O=0;O<N.length;O++)N[O].call(d,d,V)},da=function(V,O,fa){if(O===undefined){if(V===undefined||V==null||V=="")V="all";if(e==null)return null;switch(V.toLowerCase()){case "ahex":return o.rgbaToHex({r:e,g:l,b:u,a:z});case "hex":return da("ahex").substring(0,
|
p=z=null}});z.add(p).add(L).add(T).add(N).add(J).add(da).add(V).add(e).add(O).bind("keyup",sa).bind("blur",ha);z.add(p).add(L).add(T).add(N).add(J).add(da).bind("keydown",fa);d.bind(qa)};a.jPicker={List:[],Color:function(b){var d=this,e,l,u,z,p,L,T,N=[],J=function(V){for(var O=0;O<N.length;O++)N[O].call(d,d,V)},da=function(V,O,fa){if(O===undefined){if(V===undefined||V==null||V=="")V="all";if(e==null)return null;switch(V.toLowerCase()){case "ahex":return o.rgbaToHex({r:e,g:l,b:u,a:z});case "hex":return da("ahex").substring(0,
|
||||||
6);case "all":return{r:e,g:l,b:u,a:z,h:p,s:L,v:T,hex:da.call(d,"hex"),ahex:da.call(d,"ahex")};default:O={};for(var sa=0;sa<V.length;sa++)switch(V.charAt(sa)){case "r":if(V.length==1)O=e;else O.r=e;break;case "g":if(V.length==1)O=l;else O.g=l;break;case "b":if(V.length==1)O=u;else O.b=u;break;case "a":if(V.length==1)O=z;else O.a=z;break;case "h":if(V.length==1)O=p;else O.h=p;break;case "s":if(V.length==1)O=L;else O.s=L;break;case "v":if(V.length==1)O=T;else O.v=T}return O=={}?da.call(d,"all"):O}}if(!(fa!=
|
6);case "all":return{r:e,g:l,b:u,a:z,h:p,s:L,v:T,hex:da.call(d,"hex"),ahex:da.call(d,"ahex")};default:O={};for(var sa=0;sa<V.length;sa++)switch(V.charAt(sa)){case "r":if(V.length==1)O=e;else O.r=e;break;case "g":if(V.length==1)O=l;else O.g=l;break;case "b":if(V.length==1)O=u;else O.b=u;break;case "a":if(V.length==1)O=z;else O.a=z;break;case "h":if(V.length==1)O=p;else O.h=p;break;case "s":if(V.length==1)O=L;else O.s=L;break;case "v":if(V.length==1)O=T;else O.v=T}return O=={}?da.call(d,"all"):O}}if(!(fa!=
|
||||||
null&&fa==d)){var ia=false;if(V==null)V="";if(O==null){if(e!=null){e=null;ia=true}if(l!=null){l=null;ia=true}if(u!=null){u=null;ia=true}if(z!=null){z=null;ia=true}if(p!=null){p=null;ia=true}if(L!=null){L=null;ia=true}if(T!=null){T=null;ia=true}ia&&K.call(d,fa||d)}else switch(V.toLowerCase()){case "ahex":case "hex":O=o.hexToRgba(O&&(O.ahex||O.hex)||O||"00000000");da.call(d,"rgba",{r:O.r,g:O.g,b:O.b,a:V=="ahex"?O.a:z!=null?z:255},fa);break;default:if(O&&(O.ahex!=null||O.hex!=null)){da.call(d,"ahex",
|
null&&fa==d)){var ha=false;if(V==null)V="";if(O==null){if(e!=null){e=null;ha=true}if(l!=null){l=null;ha=true}if(u!=null){u=null;ha=true}if(z!=null){z=null;ha=true}if(p!=null){p=null;ha=true}if(L!=null){L=null;ha=true}if(T!=null){T=null;ha=true}ha&&J.call(d,fa||d)}else switch(V.toLowerCase()){case "ahex":case "hex":O=o.hexToRgba(O&&(O.ahex||O.hex)||O||"00000000");da.call(d,"rgba",{r:O.r,g:O.g,b:O.b,a:V=="ahex"?O.a:z!=null?z:255},fa);break;default:if(O&&(O.ahex!=null||O.hex!=null)){da.call(d,"ahex",
|
||||||
O.ahex||O.hex||"00000000",fa);break}var ca={},ea=false,qa=false;if(O.r!==undefined&&!V.indexOf("r")==-1)V+="r";if(O.g!==undefined&&!V.indexOf("g")==-1)V+="g";if(O.b!==undefined&&!V.indexOf("b")==-1)V+="b";if(O.a!==undefined&&!V.indexOf("a")==-1)V+="a";if(O.h!==undefined&&!V.indexOf("h")==-1)V+="h";if(O.s!==undefined&&!V.indexOf("s")==-1)V+="s";if(O.v!==undefined&&!V.indexOf("v")==-1)V+="v";for(sa=0;sa<V.length;sa++)switch(V.charAt(sa)){case "r":if(qa)continue;ea=true;ca.r=O&&O.r&&O.r|0||O&&O|0||0;
|
O.ahex||O.hex||"00000000",fa);break}var ca={},ea=false,qa=false;if(O.r!==undefined&&!V.indexOf("r")==-1)V+="r";if(O.g!==undefined&&!V.indexOf("g")==-1)V+="g";if(O.b!==undefined&&!V.indexOf("b")==-1)V+="b";if(O.a!==undefined&&!V.indexOf("a")==-1)V+="a";if(O.h!==undefined&&!V.indexOf("h")==-1)V+="h";if(O.s!==undefined&&!V.indexOf("s")==-1)V+="s";if(O.v!==undefined&&!V.indexOf("v")==-1)V+="v";for(sa=0;sa<V.length;sa++)switch(V.charAt(sa)){case "r":if(qa)continue;ea=true;ca.r=O&&O.r&&O.r|0||O&&O|0||0;
|
||||||
if(ca.r<0)ca.r=0;else if(ca.r>255)ca.r=255;if(e!=ca.r){e=ca.r;ia=true}break;case "g":if(qa)continue;ea=true;ca.g=O&&O.g&&O.g|0||O&&O|0||0;if(ca.g<0)ca.g=0;else if(ca.g>255)ca.g=255;if(l!=ca.g){l=ca.g;ia=true}break;case "b":if(qa)continue;ea=true;ca.b=O&&O.b&&O.b|0||O&&O|0||0;if(ca.b<0)ca.b=0;else if(ca.b>255)ca.b=255;if(u!=ca.b){u=ca.b;ia=true}break;case "a":ca.a=O&&O.a!=null?O.a|0:O!=null?O|0:255;if(ca.a<0)ca.a=0;else if(ca.a>255)ca.a=255;if(z!=ca.a){z=ca.a;ia=true}break;case "h":if(ea)continue;
|
if(ca.r<0)ca.r=0;else if(ca.r>255)ca.r=255;if(e!=ca.r){e=ca.r;ha=true}break;case "g":if(qa)continue;ea=true;ca.g=O&&O.g&&O.g|0||O&&O|0||0;if(ca.g<0)ca.g=0;else if(ca.g>255)ca.g=255;if(l!=ca.g){l=ca.g;ha=true}break;case "b":if(qa)continue;ea=true;ca.b=O&&O.b&&O.b|0||O&&O|0||0;if(ca.b<0)ca.b=0;else if(ca.b>255)ca.b=255;if(u!=ca.b){u=ca.b;ha=true}break;case "a":ca.a=O&&O.a!=null?O.a|0:O!=null?O|0:255;if(ca.a<0)ca.a=0;else if(ca.a>255)ca.a=255;if(z!=ca.a){z=ca.a;ha=true}break;case "h":if(ea)continue;
|
||||||
qa=true;ca.h=O&&O.h&&O.h|0||O&&O|0||0;if(ca.h<0)ca.h=0;else if(ca.h>360)ca.h=360;if(p!=ca.h){p=ca.h;ia=true}break;case "s":if(ea)continue;qa=true;ca.s=O&&O.s!=null?O.s|0:O!=null?O|0:100;if(ca.s<0)ca.s=0;else if(ca.s>100)ca.s=100;if(L!=ca.s){L=ca.s;ia=true}break;case "v":if(ea)continue;qa=true;ca.v=O&&O.v!=null?O.v|0:O!=null?O|0:100;if(ca.v<0)ca.v=0;else if(ca.v>100)ca.v=100;if(T!=ca.v){T=ca.v;ia=true}}if(ia){if(ea){e=e||0;l=l||0;u=u||0;O=o.rgbToHsv({r:e,g:l,b:u});p=O.h;L=O.s;T=O.v}else if(qa){p=p||
|
qa=true;ca.h=O&&O.h&&O.h|0||O&&O|0||0;if(ca.h<0)ca.h=0;else if(ca.h>360)ca.h=360;if(p!=ca.h){p=ca.h;ha=true}break;case "s":if(ea)continue;qa=true;ca.s=O&&O.s!=null?O.s|0:O!=null?O|0:100;if(ca.s<0)ca.s=0;else if(ca.s>100)ca.s=100;if(L!=ca.s){L=ca.s;ha=true}break;case "v":if(ea)continue;qa=true;ca.v=O&&O.v!=null?O.v|0:O!=null?O|0:100;if(ca.v<0)ca.v=0;else if(ca.v>100)ca.v=100;if(T!=ca.v){T=ca.v;ha=true}}if(ha){if(ea){e=e||0;l=l||0;u=u||0;O=o.rgbToHsv({r:e,g:l,b:u});p=O.h;L=O.s;T=O.v}else if(qa){p=p||
|
||||||
0;L=L!=null?L:100;T=T!=null?T:100;O=o.hsvToRgb({h:p,s:L,v:T});e=O.r;l=O.g;u=O.b}z=z!=null?z:255;K.call(d,fa||d)}}}};a.extend(true,d,{val:da,bind:function(V){a.isFunction(V)&&N.push(V)},unbind:function(V){if(a.isFunction(V))for(var O;(O=a.inArray(V,N))!=-1;)N.splice(O,1)},destroy:function(){N=null}});if(b)if(b.ahex!=null)da("ahex",b);else if(b.hex!=null)da((b.a!=null?"a":"")+"hex",b.a!=null?{ahex:b.hex+o.intToHex(b.a)}:b);else if(b.r!=null&&b.g!=null&&b.b!=null)da("rgb"+(b.a!=null?"a":""),b);else if(b.h!=
|
0;L=L!=null?L:100;T=T!=null?T:100;O=o.hsvToRgb({h:p,s:L,v:T});e=O.r;l=O.g;u=O.b}z=z!=null?z:255;J.call(d,fa||d)}}}};a.extend(true,d,{val:da,bind:function(V){a.isFunction(V)&&N.push(V)},unbind:function(V){if(a.isFunction(V))for(var O;(O=a.inArray(V,N))!=-1;)N.splice(O,1)},destroy:function(){N=null}});if(b)if(b.ahex!=null)da("ahex",b);else if(b.hex!=null)da((b.a!=null?"a":"")+"hex",b.a!=null?{ahex:b.hex+o.intToHex(b.a)}:b);else if(b.r!=null&&b.g!=null&&b.b!=null)da("rgb"+(b.a!=null?"a":""),b);else if(b.h!=
|
||||||
null&&b.s!=null&&b.v!=null)da("hsv"+(b.a!=null?"a":""),b)},ColorMethods:{hexToRgba:function(b){b=this.validateHex(b);if(b=="")return{r:null,g:null,b:null,a:null};var d="00",e="00",l="00",u="255";if(b.length==6)b+="ff";if(b.length>6){d=b.substring(0,2);e=b.substring(2,4);l=b.substring(4,6);u=b.substring(6,b.length)}else{if(b.length>4){d=b.substring(4,b.length);b=b.substring(0,4)}if(b.length>2){e=b.substring(2,b.length);b=b.substring(0,2)}if(b.length>0)l=b.substring(0,b.length)}return{r:this.hexToInt(d),
|
null&&b.s!=null&&b.v!=null)da("hsv"+(b.a!=null?"a":""),b)},ColorMethods:{hexToRgba:function(b){b=this.validateHex(b);if(b=="")return{r:null,g:null,b:null,a:null};var d="00",e="00",l="00",u="255";if(b.length==6)b+="ff";if(b.length>6){d=b.substring(0,2);e=b.substring(2,4);l=b.substring(4,6);u=b.substring(6,b.length)}else{if(b.length>4){d=b.substring(4,b.length);b=b.substring(0,4)}if(b.length>2){e=b.substring(2,b.length);b=b.substring(0,2)}if(b.length>0)l=b.substring(0,b.length)}return{r:this.hexToInt(d),
|
||||||
g:this.hexToInt(e),b:this.hexToInt(l),a:this.hexToInt(u)}},validateHex:function(b){if(typeof b=="object")return"";b=b.toLowerCase().replace(/[^a-f0-9]/g,"");if(b.length>8)b=b.substring(0,8);return b},rgbaToHex:function(b){return this.intToHex(b.r)+this.intToHex(b.g)+this.intToHex(b.b)+this.intToHex(b.a)},intToHex:function(b){b=(b|0).toString(16);if(b.length==1)b="0"+b;return b.toLowerCase()},hexToInt:function(b){return parseInt(b,16)},rgbToHsv:function(b){var d=b.r/255,e=b.g/255;b=b.b/255;var l={h:0,
|
g:this.hexToInt(e),b:this.hexToInt(l),a:this.hexToInt(u)}},validateHex:function(b){if(typeof b=="object")return"";b=b.toLowerCase().replace(/[^a-f0-9]/g,"");if(b.length>8)b=b.substring(0,8);return b},rgbaToHex:function(b){return this.intToHex(b.r)+this.intToHex(b.g)+this.intToHex(b.b)+this.intToHex(b.a)},intToHex:function(b){b=(b|0).toString(16);if(b.length==1)b="0"+b;return b.toLowerCase()},hexToInt:function(b){return parseInt(b,16)},rgbToHsv:function(b){var d=b.r/255,e=b.g/255;b=b.b/255;var l={h:0,
|
||||||
s:0,v:0},u=0,z=0;if(d>=e&&d>=b){z=d;u=e>b?b:e}else if(e>=b&&e>=d){z=e;u=d>b?b:d}else{z=b;u=e>d?d:e}l.v=z;l.s=z?(z-u)/z:0;if(l.s){u=z-u;l.h=d==z?(e-b)/u:e==z?2+(b-d)/u:4+(d-e)/u;l.h=parseInt(l.h*60);if(l.h<0)l.h+=360}else l.h=0;l.s=l.s*100|0;l.v=l.v*100|0;return l},hsvToRgb:function(b){var d={r:0,g:0,b:0,a:100},e=b.h,l=b.s;b=b.v;if(l==0)d.r=b==0?d.g=d.b=0:d.g=d.b=b*255/100|0;else{if(e==360)e=0;e/=60;l/=100;b/=100;var u=e|0,z=e-u;e=b*(1-l);var p=b*(1-l*z);l=b*(1-l*(1-z));switch(u){case 0:d.r=b;d.g=
|
s:0,v:0},u=0,z=0;if(d>=e&&d>=b){z=d;u=e>b?b:e}else if(e>=b&&e>=d){z=e;u=d>b?b:d}else{z=b;u=e>d?d:e}l.v=z;l.s=z?(z-u)/z:0;if(l.s){u=z-u;l.h=d==z?(e-b)/u:e==z?2+(b-d)/u:4+(d-e)/u;l.h=parseInt(l.h*60);if(l.h<0)l.h+=360}else l.h=0;l.s=l.s*100|0;l.v=l.v*100|0;return l},hsvToRgb:function(b){var d={r:0,g:0,b:0,a:100},e=b.h,l=b.s;b=b.v;if(l==0)d.r=b==0?d.g=d.b=0:d.g=d.b=b*255/100|0;else{if(e==360)e=0;e/=60;l/=100;b/=100;var u=e|0,z=e-u;e=b*(1-l);var p=b*(1-l*z);l=b*(1-l*(1-z));switch(u){case 0:d.r=b;d.g=
|
||||||
l;d.b=e;break;case 1:d.r=p;d.g=b;d.b=e;break;case 2:d.r=e;d.g=b;d.b=l;break;case 3:d.r=e;d.g=p;d.b=b;break;case 4:d.r=l;d.g=e;d.b=b;break;case 5:d.r=b;d.g=e;d.b=p}d.r=d.r*255|0;d.g=d.g*255|0;d.b=d.b*255|0}return d}}};var c=a.jPicker.Color,m=a.jPicker.List,o=a.jPicker.ColorMethods;a.fn.jPicker=function(b){var d=arguments;return this.each(function(){var e=this,l=a.extend(true,{},a.fn.jPicker.defaults,b);if(a(e).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,
|
l;d.b=e;break;case 1:d.r=p;d.g=b;d.b=e;break;case 2:d.r=e;d.g=b;d.b=l;break;case 3:d.r=e;d.g=p;d.b=b;break;case 4:d.r=l;d.g=e;d.b=b;break;case 5:d.r=b;d.g=e;d.b=p}d.r=d.r*255|0;d.g=d.g*255|0;d.b=d.b*255|0}return d}}};var c=a.jPicker.Color,m=a.jPicker.List,o=a.jPicker.ColorMethods;a.fn.jPicker=function(b){var d=arguments;return this.each(function(){var e=this,l=a.extend(true,{},a.fn.jPicker.defaults,b);if(a(e).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,
|
||||||
input:a(e)}});if(a(e).val()==""){l.color.active=new c({hex:null});l.color.current=new c({hex:null})}else if(o.validateHex(a(e).val())){l.color.active=new c({hex:a(e).val(),a:l.color.active.val("a")});l.color.current=new c({hex:a(e).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(e).after('<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>');
|
input:a(e)}});if(a(e).val()==""){l.color.active=new c({hex:null});l.color.current=new c({hex:null})}else if(o.validateHex(a(e).val())){l.color.active=new c({hex:a(e).val(),a:l.color.active.val("a")});l.color.current=new c({hex:a(e).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(e).after('<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>');
|
||||||
else l.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,z=null,p=null,L=null,T=null,N=null,K=null,da=null,V=null,O=null,fa=null,sa=null,ia=null,ca=null,ea=null,qa=null,pa=null,ba=null,S=null,U=null,ra=null,la=null,ma=null,Y=null,za=null,Ka=null,Qa=null,Ma=null,Sa=null,Ya=function(M){var I=ta.active,X=I.val("hex"),Oa,Wa;l.color.mode=M;switch(M){case "h":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,0);Fa.call(e,T,100);La.call(e,
|
else l.window.liveUpdate=false;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,z=null,p=null,L=null,T=null,N=null,J=null,da=null,V=null,O=null,fa=null,sa=null,ha=null,ca=null,ea=null,qa=null,pa=null,ba=null,S=null,U=null,ra=null,la=null,ma=null,Z=null,za=null,Ka=null,Qa=null,Ma=null,Sa=null,Ya=function(M){var I=ta.active,Y=I.val("hex"),Oa,Wa;l.color.mode=M;switch(M){case "h":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,0);Fa.call(e,T,100);La.call(e,
|
||||||
N,260);Fa.call(e,N,100);ab.call(e,L,"transparent");La.call(e,da,0);Fa.call(e,da,100);La.call(e,V,260);Fa.call(e,V,100);La.call(e,O,260);Fa.call(e,O,100);La.call(e,fa,260);Fa.call(e,fa,100);La.call(e,ia,260);Fa.call(e,ia,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("s"),y:100-I.val("v")},ca);ea.val("y",360-I.val("h"),ea);break;case "s":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);
|
N,260);Fa.call(e,N,100);ab.call(e,L,"transparent");La.call(e,da,0);Fa.call(e,da,100);La.call(e,V,260);Fa.call(e,V,100);La.call(e,O,260);Fa.call(e,O,100);La.call(e,fa,260);Fa.call(e,fa,100);La.call(e,ha,260);Fa.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:360});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("s"),y:100-I.val("v")},ca);ea.val("y",360-I.val("h"),ea);break;case "s":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);
|
||||||
La.call(e,N,-520);La.call(e,da,-260);La.call(e,V,-520);La.call(e,ia,260);Fa.call(e,ia,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("h"),y:100-I.val("v")},ca);ea.val("y",100-I.val("s"),ea);break;case "v":setTimeout(function(){ab.call(e,p,"000000");La.call(e,T,-780);La.call(e,N,260);ab.call(e,L,X);La.call(e,da,-520);La.call(e,V,260);Fa.call(e,V,100);La.call(e,ia,260);Fa.call(e,ia,100)},0);ca.range("all",
|
La.call(e,N,-520);La.call(e,da,-260);La.call(e,V,-520);La.call(e,ha,260);Fa.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("h"),y:100-I.val("v")},ca);ea.val("y",100-I.val("s"),ea);break;case "v":setTimeout(function(){ab.call(e,p,"000000");La.call(e,T,-780);La.call(e,N,260);ab.call(e,L,Y);La.call(e,da,-520);La.call(e,V,260);Fa.call(e,V,100);La.call(e,ha,260);Fa.call(e,ha,100)},0);ca.range("all",
|
||||||
{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("h"),y:100-I.val("s")},ca);ea.val("y",100-I.val("v"),ea);break;case "r":Oa=-1040;Wa=-780;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("b"),y:255-I.val("g")},ca);ea.val("y",255-I.val("r"),ea);break;case "g":Oa=-1560;Wa=-1820;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",
|
{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:100});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("h"),y:100-I.val("s")},ca);ea.val("y",100-I.val("v"),ea);break;case "r":Oa=-1040;Wa=-780;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("b"),y:255-I.val("g")},ca);ea.val("y",255-I.val("r"),ea);break;case "g":Oa=-1560;Wa=-1820;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",
|
||||||
{minY:0,maxY:255});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("b"),y:255-I.val("r")},ca);ea.val("y",255-I.val("g"),ea);break;case "b":Oa=-2080;Wa=-2860;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("r"),y:255-I.val("g")},ca);ea.val("y",255-I.val("b"),ea);break;case "a":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);La.call(e,N,-520);La.call(e,da,260);La.call(e,V,260);Fa.call(e,V,100);
|
{minY:0,maxY:255});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("b"),y:255-I.val("r")},ca);ea.val("y",255-I.val("g"),ea);break;case "b":Oa=-2080;Wa=-2860;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});ea.range("rangeY",{minY:0,maxY:255});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("r"),y:255-I.val("g")},ca);ea.val("y",255-I.val("b"),ea);break;case "a":setTimeout(function(){ab.call(e,p,"transparent");La.call(e,T,-260);La.call(e,N,-520);La.call(e,da,260);La.call(e,V,260);Fa.call(e,V,100);
|
||||||
La.call(e,ia,0);Fa.call(e,ia,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("h"),y:100-I.val("v")},ca);ea.val("y",255-I.val("a"),ea);break;default:throw"Invalid Mode";}switch(M){case "s":case "v":case "a":setTimeout(function(){Fa.call(e,T,100);Fa.call(e,da,100);La.call(e,O,260);Fa.call(e,O,100);La.call(e,fa,260);Fa.call(e,fa,100)},0);break;case "r":case "g":case "b":setTimeout(function(){ab.call(e,p,
|
La.call(e,ha,0);Fa.call(e,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});ea.range("rangeY",{minY:0,maxY:255});if(I.val("ahex")==null)break;ca.val("xy",{x:I.val("h"),y:100-I.val("v")},ca);ea.val("y",255-I.val("a"),ea);break;default:throw"Invalid Mode";}switch(M){case "s":case "v":case "a":setTimeout(function(){Fa.call(e,T,100);Fa.call(e,da,100);La.call(e,O,260);Fa.call(e,O,100);La.call(e,fa,260);Fa.call(e,fa,100)},0);break;case "r":case "g":case "b":setTimeout(function(){ab.call(e,p,
|
||||||
"transparent");ab.call(e,L,"transparent");Fa.call(e,da,100);Fa.call(e,T,100);La.call(e,T,Oa);La.call(e,N,Oa-260);La.call(e,da,Wa-780);La.call(e,V,Wa-520);La.call(e,O,Wa);La.call(e,fa,Wa-260);La.call(e,ia,260);Fa.call(e,ia,100)},0)}I.val("ahex")!=null&&Na.call(e,I)},Na=function(M,I){if(I==null||I!=ea&&I!=ca)Ga.call(e,M,I);setTimeout(function(){Gb.call(e,M);Pb.call(e,M);ob.call(e,M)},0)},Ia=function(M,I){var X=ta.active;if(!(I!=ca&&X.val()==null)){var Oa=M.val("all");switch(l.color.mode){case "h":X.val("sv",
|
"transparent");ab.call(e,L,"transparent");Fa.call(e,da,100);Fa.call(e,T,100);La.call(e,T,Oa);La.call(e,N,Oa-260);La.call(e,da,Wa-780);La.call(e,V,Wa-520);La.call(e,O,Wa);La.call(e,fa,Wa-260);La.call(e,ha,260);Fa.call(e,ha,100)},0)}I.val("ahex")!=null&&Na.call(e,I)},Na=function(M,I){if(I==null||I!=ea&&I!=ca)Ga.call(e,M,I);setTimeout(function(){Gb.call(e,M);Pb.call(e,M);nb.call(e,M)},0)},Ia=function(M,I){var Y=ta.active;if(!(I!=ca&&Y.val()==null)){var Oa=M.val("all");switch(l.color.mode){case "h":Y.val("sv",
|
||||||
{s:Oa.x,v:100-Oa.y},I);break;case "s":case "a":X.val("hv",{h:Oa.x,v:100-Oa.y},I);break;case "v":X.val("hs",{h:Oa.x,s:100-Oa.y},I);break;case "r":X.val("gb",{g:255-Oa.y,b:Oa.x},I);break;case "g":X.val("rb",{r:255-Oa.y,b:Oa.x},I);break;case "b":X.val("rg",{r:Oa.x,g:255-Oa.y},I)}}},Pa=function(M,I){var X=ta.active;if(!(I!=ea&&X.val()==null))switch(l.color.mode){case "h":X.val("h",{h:360-M.val("y")},I);break;case "s":X.val("s",{s:100-M.val("y")},I);break;case "v":X.val("v",{v:100-M.val("y")},I);break;
|
{s:Oa.x,v:100-Oa.y},I);break;case "s":case "a":Y.val("hv",{h:Oa.x,v:100-Oa.y},I);break;case "v":Y.val("hs",{h:Oa.x,s:100-Oa.y},I);break;case "r":Y.val("gb",{g:255-Oa.y,b:Oa.x},I);break;case "g":Y.val("rb",{r:255-Oa.y,b:Oa.x},I);break;case "b":Y.val("rg",{r:Oa.x,g:255-Oa.y},I)}}},Pa=function(M,I){var Y=ta.active;if(!(I!=ea&&Y.val()==null))switch(l.color.mode){case "h":Y.val("h",{h:360-M.val("y")},I);break;case "s":Y.val("s",{s:100-M.val("y")},I);break;case "v":Y.val("v",{v:100-M.val("y")},I);break;
|
||||||
case "r":X.val("r",{r:255-M.val("y")},I);break;case "g":X.val("g",{g:255-M.val("y")},I);break;case "b":X.val("b",{b:255-M.val("y")},I);break;case "a":X.val("a",255-M.val("y"),I)}},Ga=function(M,I){if(I!=ca)switch(l.color.mode){case "h":var X=M.val("sv");ca.val("xy",{x:X!=null?X.s:100,y:100-(X!=null?X.v:100)},I);break;case "s":case "a":X=M.val("hv");ca.val("xy",{x:X&&X.h||0,y:100-(X!=null?X.v:100)},I);break;case "v":X=M.val("hs");ca.val("xy",{x:X&&X.h||0,y:100-(X!=null?X.s:100)},I);break;case "r":X=
|
case "r":Y.val("r",{r:255-M.val("y")},I);break;case "g":Y.val("g",{g:255-M.val("y")},I);break;case "b":Y.val("b",{b:255-M.val("y")},I);break;case "a":Y.val("a",255-M.val("y"),I)}},Ga=function(M,I){if(I!=ca)switch(l.color.mode){case "h":var Y=M.val("sv");ca.val("xy",{x:Y!=null?Y.s:100,y:100-(Y!=null?Y.v:100)},I);break;case "s":case "a":Y=M.val("hv");ca.val("xy",{x:Y&&Y.h||0,y:100-(Y!=null?Y.v:100)},I);break;case "v":Y=M.val("hs");ca.val("xy",{x:Y&&Y.h||0,y:100-(Y!=null?Y.s:100)},I);break;case "r":Y=
|
||||||
M.val("bg");ca.val("xy",{x:X&&X.b||0,y:255-(X&&X.g||0)},I);break;case "g":X=M.val("br");ca.val("xy",{x:X&&X.b||0,y:255-(X&&X.r||0)},I);break;case "b":X=M.val("rg");ca.val("xy",{x:X&&X.r||0,y:255-(X&&X.g||0)},I)}if(I!=ea)switch(l.color.mode){case "h":ea.val("y",360-(M.val("h")||0),I);break;case "s":X=M.val("s");ea.val("y",100-(X!=null?X:100),I);break;case "v":X=M.val("v");ea.val("y",100-(X!=null?X:100),I);break;case "r":ea.val("y",255-(M.val("r")||0),I);break;case "g":ea.val("y",255-(M.val("g")||0),
|
M.val("bg");ca.val("xy",{x:Y&&Y.b||0,y:255-(Y&&Y.g||0)},I);break;case "g":Y=M.val("br");ca.val("xy",{x:Y&&Y.b||0,y:255-(Y&&Y.r||0)},I);break;case "b":Y=M.val("rg");ca.val("xy",{x:Y&&Y.r||0,y:255-(Y&&Y.g||0)},I)}if(I!=ea)switch(l.color.mode){case "h":ea.val("y",360-(M.val("h")||0),I);break;case "s":Y=M.val("s");ea.val("y",100-(Y!=null?Y:100),I);break;case "v":Y=M.val("v");ea.val("y",100-(Y!=null?Y:100),I);break;case "r":ea.val("y",255-(M.val("r")||0),I);break;case "g":ea.val("y",255-(M.val("g")||0),
|
||||||
I);break;case "b":ea.val("y",255-(M.val("b")||0),I);break;case "a":X=M.val("a");ea.val("y",255-(X!=null?X:255),I)}},Gb=function(M){try{var I=M.val("all");ra.css({backgroundColor:I&&"#"+I.hex||"transparent"});Fa.call(e,ra,I&&Math.precision(I.a*100/255,4)||0)}catch(X){}},Pb=function(M){switch(l.color.mode){case "h":ab.call(e,p,(new c({h:M.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var I=M.val("s");Fa.call(e,N,100-(I!=null?I:100));break;case "v":I=M.val("v");Fa.call(e,T,I!=null?I:
|
I);break;case "b":ea.val("y",255-(M.val("b")||0),I);break;case "a":Y=M.val("a");ea.val("y",255-(Y!=null?Y:255),I)}},Gb=function(M){try{var I=M.val("all");ra.css({backgroundColor:I&&"#"+I.hex||"transparent"});Fa.call(e,ra,I&&Math.precision(I.a*100/255,4)||0)}catch(Y){}},Pb=function(M){switch(l.color.mode){case "h":ab.call(e,p,(new c({h:M.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var I=M.val("s");Fa.call(e,N,100-(I!=null?I:100));break;case "v":I=M.val("v");Fa.call(e,T,I!=null?I:
|
||||||
100);break;case "r":Fa.call(e,N,Math.precision((M.val("r")||0)/255*100,4));break;case "g":Fa.call(e,N,Math.precision((M.val("g")||0)/255*100,4));break;case "b":Fa.call(e,N,Math.precision((M.val("b")||0)/255*100))}M=M.val("a");Fa.call(e,K,Math.precision((255-(M||0))*100/255,4))},ob=function(M){switch(l.color.mode){case "h":var I=M.val("a");Fa.call(e,sa,Math.precision((255-(I||0))*100/255,4));break;case "s":I=M.val("hva");var X=new c({h:I&&I.h||0,s:100,v:I!=null?I.v:100});ab.call(e,L,X.val("hex"));
|
100);break;case "r":Fa.call(e,N,Math.precision((M.val("r")||0)/255*100,4));break;case "g":Fa.call(e,N,Math.precision((M.val("g")||0)/255*100,4));break;case "b":Fa.call(e,N,Math.precision((M.val("b")||0)/255*100))}M=M.val("a");Fa.call(e,J,Math.precision((255-(M||0))*100/255,4))},nb=function(M){switch(l.color.mode){case "h":var I=M.val("a");Fa.call(e,sa,Math.precision((255-(I||0))*100/255,4));break;case "s":I=M.val("hva");var Y=new c({h:I&&I.h||0,s:100,v:I!=null?I.v:100});ab.call(e,L,Y.val("hex"));
|
||||||
Fa.call(e,V,100-(I!=null?I.v:100));Fa.call(e,sa,Math.precision((255-(I&&I.a||0))*100/255,4));break;case "v":I=M.val("hsa");X=new c({h:I&&I.h||0,s:I!=null?I.s:100,v:100});ab.call(e,L,X.val("hex"));Fa.call(e,sa,Math.precision((255-(I&&I.a||0))*100/255,4));break;case "r":case "g":case "b":X=I=0;M=M.val("rgba");if(l.color.mode=="r"){I=M&&M.b||0;X=M&&M.g||0}else if(l.color.mode=="g"){I=M&&M.b||0;X=M&&M.r||0}else if(l.color.mode=="b"){I=M&&M.r||0;X=M&&M.g||0}var Oa=X>I?I:X;Fa.call(e,V,I>X?Math.precision((I-
|
Fa.call(e,V,100-(I!=null?I.v:100));Fa.call(e,sa,Math.precision((255-(I&&I.a||0))*100/255,4));break;case "v":I=M.val("hsa");Y=new c({h:I&&I.h||0,s:I!=null?I.s:100,v:100});ab.call(e,L,Y.val("hex"));Fa.call(e,sa,Math.precision((255-(I&&I.a||0))*100/255,4));break;case "r":case "g":case "b":Y=I=0;M=M.val("rgba");if(l.color.mode=="r"){I=M&&M.b||0;Y=M&&M.g||0}else if(l.color.mode=="g"){I=M&&M.b||0;Y=M&&M.r||0}else if(l.color.mode=="b"){I=M&&M.r||0;Y=M&&M.g||0}var Oa=Y>I?I:Y;Fa.call(e,V,I>Y?Math.precision((I-
|
||||||
X)/(255-X)*100,4):0);Fa.call(e,O,X>I?Math.precision((X-I)/(255-I)*100,4):0);Fa.call(e,fa,Math.precision(Oa/255*100,4));Fa.call(e,sa,Math.precision((255-(M&&M.a||0))*100/255,4));break;case "a":I=M.val("a");ab.call(e,L,M.val("hex")||"000000");Fa.call(e,sa,I!=null?0:100);Fa.call(e,ia,I!=null?100:0)}},ab=function(M,I){M.css({backgroundColor:I&&I.length==6&&"#"+I||"transparent"})},Xa=function(M,I){if(u&&(I.indexOf("AlphaBar.png")!=-1||I.indexOf("Bars.png")!=-1||I.indexOf("Maps.png")!=-1)){M.attr("pngSrc",
|
Y)/(255-Y)*100,4):0);Fa.call(e,O,Y>I?Math.precision((Y-I)/(255-I)*100,4):0);Fa.call(e,fa,Math.precision(Oa/255*100,4));Fa.call(e,sa,Math.precision((255-(M&&M.a||0))*100/255,4));break;case "a":I=M.val("a");ab.call(e,L,M.val("hex")||"000000");Fa.call(e,sa,I!=null?0:100);Fa.call(e,ha,I!=null?100:0)}},ab=function(M,I){M.css({backgroundColor:I&&I.length==6&&"#"+I||"transparent"})},Xa=function(M,I){if(u&&(I.indexOf("AlphaBar.png")!=-1||I.indexOf("Bars.png")!=-1||I.indexOf("Maps.png")!=-1)){M.attr("pngSrc",
|
||||||
I);M.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+I+"', sizingMethod='scale')"})}else M.css({backgroundImage:"url('"+I+"')"})},La=function(M,I){M.css({top:I+"px"})},Fa=function(M,I){M.css({visibility:I>0?"visible":"hidden"});if(I>0&&I<100)if(u){var X=M.attr("pngSrc");X!=null&&(X.indexOf("AlphaBar.png")!=-1||X.indexOf("Bars.png")!=-1||X.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+X+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+
|
I);M.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+I+"', sizingMethod='scale')"})}else M.css({backgroundImage:"url('"+I+"')"})},La=function(M,I){M.css({top:I+"px"})},Fa=function(M,I){M.css({visibility:I>0?"visible":"hidden"});if(I>0&&I<100)if(u){var Y=M.attr("pngSrc");Y!=null&&(Y.indexOf("AlphaBar.png")!=-1||Y.indexOf("Bars.png")!=-1||Y.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Y+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+
|
||||||
I+")"}):M.css({opacity:Math.precision(I/100,4)})}else M.css({opacity:Math.precision(I/100,4)});else if(I==0||I==100)if(u){X=M.attr("pngSrc");X!=null&&(X.indexOf("AlphaBar.png")!=-1||X.indexOf("Bars.png")!=-1||X.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+X+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},Za=function(){ta.active.val("ahex",ta.current.val("ahex"))},Ra=function(){ta.current.val("ahex",ta.active.val("ahex"))},
|
I+")"}):M.css({opacity:Math.precision(I/100,4)})}else M.css({opacity:Math.precision(I/100,4)});else if(I==0||I==100)if(u){Y=M.attr("pngSrc");Y!=null&&(Y.indexOf("AlphaBar.png")!=-1||Y.indexOf("Bars.png")!=-1||Y.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Y+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},Za=function(){ta.active.val("ahex",ta.current.val("ahex"))},Ra=function(){ta.current.val("ahex",ta.active.val("ahex"))},
|
||||||
$a=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+M.target.value+'"]').removeAttr("checked");Ya.call(e,M.target.value)},Ja=function(){Za.call(e)},pb=function(){Za.call(e);l.window.expandable&&Ib.call(e);a.isFunction(Eb)&&Eb.call(e,ta.active,Y)},Cb=function(){Ra.call(e);l.window.expandable&&Ib.call(e);a.isFunction(Db)&&Db.call(e,ta.active,ma)},db=function(){Kb.call(e)},hb=function(M){var I=M.val("hex");la.css({backgroundColor:I&&"#"+I||"transparent"});Fa.call(e,la,Math.precision((M.val("a")||
|
$a=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+M.target.value+'"]').removeAttr("checked");Ya.call(e,M.target.value)},Ja=function(){Za.call(e)},ob=function(){Za.call(e);l.window.expandable&&Ib.call(e);a.isFunction(Eb)&&Eb.call(e,ta.active,Z)},Cb=function(){Ra.call(e);l.window.expandable&&Ib.call(e);a.isFunction(Db)&&Db.call(e,ta.active,ma)},eb=function(){Kb.call(e)},hb=function(M){var I=M.val("hex");la.css({backgroundColor:I&&"#"+I||"transparent"});Fa.call(e,la,Math.precision((M.val("a")||
|
||||||
0)*100/255,4))},ib=function(M){var I=M.val("hex");M=M.val("va");Ka.css({backgroundColor:I&&"#"+I||"transparent"});Fa.call(e,Qa,Math.precision((255-(M&&M.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:I&&"#"+I||"transparent",color:M==null||M.v>75?"#000000":"#ffffff"})},Da=function(M){pa=parseInt(z.css("left"));ba=parseInt(z.css("top"));S=M.pageX;U=M.pageY;a(document).bind("mousemove",xb).bind("mouseup",mb);M.preventDefault()},xb=function(M){z.css({left:pa-
|
0)*100/255,4))},ib=function(M){var I=M.val("hex");M=M.val("va");Ka.css({backgroundColor:I&&"#"+I||"transparent"});Fa.call(e,Qa,Math.precision((255-(M&&M.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:I&&"#"+I||"transparent",color:M==null||M.v>75?"#000000":"#ffffff"})},Da=function(M){pa=parseInt(z.css("left"));ba=parseInt(z.css("top"));S=M.pageX;U=M.pageY;a(document).bind("mousemove",xb).bind("mouseup",mb);M.preventDefault()},xb=function(M){z.css({left:pa-
|
||||||
(S-M.pageX)+"px",top:ba-(U-M.pageY)+"px"});l.window.expandable&&!a.support.boxModel&&z.prev().css({left:z.css("left"),top:z.css("top")});M.stopPropagation();M.preventDefault();return false},mb=function(M){a(document).unbind("mousemove",xb).unbind("mouseup",mb);M.stopPropagation();M.preventDefault();return false},zb=function(M){M.preventDefault();M.stopPropagation();ta.active.val("ahex",a(this).attr("title")||null,M.target);return false},Db=a.isFunction(d[1])&&d[1]||null,nb=a.isFunction(d[2])&&d[2]||
|
(S-M.pageX)+"px",top:ba-(U-M.pageY)+"px"});l.window.expandable&&!a.support.boxModel&&z.prev().css({left:z.css("left"),top:z.css("top")});M.stopPropagation();M.preventDefault();return false},mb=function(M){a(document).unbind("mousemove",xb).unbind("mouseup",mb);M.stopPropagation();M.preventDefault();return false},zb=function(M){M.preventDefault();M.stopPropagation();ta.active.val("ahex",a(this).attr("title")||null,M.target);return false},Db=a.isFunction(d[1])&&d[1]||null,pb=a.isFunction(d[2])&&d[2]||
|
||||||
null,Eb=a.isFunction(d[3])&&d[3]||null,Kb=function(){ta.current.val("ahex",ta.active.val("ahex"));var M=function(){if(!(!l.window.expandable||a.support.boxModel)){var I=z.find("table:first");z.before("<iframe/>");z.prev().css({width:I.width(),height:z.height(),opacity:0,position:"absolute",left:z.css("left"),top:z.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});z.css({zIndex:20})}switch(l.window.effects.type){case "fade":z.fadeIn(l.window.effects.speed.show,
|
null,Eb=a.isFunction(d[3])&&d[3]||null,Kb=function(){ta.current.val("ahex",ta.active.val("ahex"));var M=function(){if(!(!l.window.expandable||a.support.boxModel)){var I=z.find("table:first");z.before("<iframe/>");z.prev().css({width:I.width(),height:z.height(),opacity:0,position:"absolute",left:z.css("left"),top:z.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});z.css({zIndex:20})}switch(l.window.effects.type){case "fade":z.fadeIn(l.window.effects.speed.show,
|
||||||
M);break;case "slide":z.slideDown(l.window.effects.speed.show,M);break;default:z.show(l.window.effects.speed.show,M)}},Ib=function(){var M=function(){l.window.expandable&&z.css({zIndex:10});!l.window.expandable||a.support.boxModel||z.prev().remove()};switch(l.window.effects.type){case "fade":z.fadeOut(l.window.effects.speed.hide,M);break;case "slide":z.slideUp(l.window.effects.speed.hide,M);break;default:z.hide(l.window.effects.speed.hide,M)}},Qb=function(){var M=l.window,I=M.expandable?a(e).next().find(".Container:first"):
|
M);break;case "slide":z.slideDown(l.window.effects.speed.show,M);break;default:z.show(l.window.effects.speed.show,M)}},Ib=function(){var M=function(){l.window.expandable&&z.css({zIndex:10});!l.window.expandable||a.support.boxModel||z.prev().remove()};switch(l.window.effects.type){case "fade":z.fadeOut(l.window.effects.speed.hide,M);break;case "slide":z.slideUp(l.window.effects.speed.hide,M);break;default:z.hide(l.window.effects.speed.hide,M)}},Qb=function(){var M=l.window,I=M.expandable?a(e).next().find(".Container:first"):
|
||||||
null;z=M.expandable?a("<div/>"):a(e);z.addClass("jPicker Container");M.expandable&&z.hide();z.get(0).onselectstart=function(Nb){if(Nb.target.nodeName.toLowerCase()!=="input")return false};var X=ta.active.val("all");if(M.alphaPrecision<0)M.alphaPrecision=0;else if(M.alphaPrecision>2)M.alphaPrecision=2;var Oa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(M.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(M.title||aa.text.title)+
|
null;z=M.expandable?a("<div/>"):a(e);z.addClass("jPicker Container");M.expandable&&z.hide();z.get(0).onselectstart=function(Nb){if(Nb.target.nodeName.toLowerCase()!=="input")return false};var Y=ta.active.val("all");if(M.alphaPrecision<0)M.alphaPrecision=0;else if(M.alphaPrecision>2)M.alphaPrecision=2;var Oa='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody>'+(M.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':"")+'<tr><td rowspan="9"><h2 class="Title">'+(M.title||aa.text.title)+
|
||||||
'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="'+na.clientPath+na.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="'+na.clientPath+na.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+
|
'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="'+na.clientPath+na.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="'+na.clientPath+na.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview"><div class="prev_div">'+
|
||||||
aa.text.newColor+'<div class="color_preview"><span class="Active" title="'+aa.tooltips.colors.newColor+'"> </span><span class="Current" title="'+aa.tooltips.colors.currentColor+'"> </span></div></div>'+aa.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+aa.text.ok+'" title="'+aa.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+aa.text.cancel+'" title="'+aa.tooltips.buttons.cancel+'"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="'+
|
aa.text.newColor+'<div class="color_preview"><span class="Active" title="'+aa.tooltips.colors.newColor+'"> </span><span class="Current" title="'+aa.tooltips.colors.currentColor+'"> </span></div></div>'+aa.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+aa.text.ok+'" title="'+aa.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+aa.text.cancel+'" title="'+aa.tooltips.buttons.cancel+'"/><div class="Grid"> </div></td></tr><tr class="Hue"><td class="Radio"><label title="'+
|
||||||
aa.tooltips.hue.radio+'"><input type="radio" value="h"'+(l.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(X!=null?X.h:"")+'" title="'+aa.tooltips.hue.textbox+'"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+aa.tooltips.saturation.radio+'"><input type="radio" value="s"'+(l.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(X!=
|
aa.tooltips.hue.radio+'"><input type="radio" value="h"'+(l.color.mode=="h"?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(Y!=null?Y.h:"")+'" title="'+aa.tooltips.hue.textbox+'"/> \u00ba</td></tr><tr class="Saturation"><td class="Radio"><label title="'+aa.tooltips.saturation.radio+'"><input type="radio" value="s"'+(l.color.mode=="s"?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(Y!=
|
||||||
null?X.s:"")+'" title="'+aa.tooltips.saturation.textbox+'"/> %</td></tr><tr class="Value"><td class="Radio"><label title="'+aa.tooltips.value.radio+'"><input type="radio" value="v"'+(l.color.mode=="v"?' checked="checked"':"")+'/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(X!=null?X.v:"")+'" title="'+aa.tooltips.value.textbox+'"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+aa.tooltips.red.radio+'"><input type="radio" value="r"'+(l.color.mode==
|
null?Y.s:"")+'" title="'+aa.tooltips.saturation.textbox+'"/> %</td></tr><tr class="Value"><td class="Radio"><label title="'+aa.tooltips.value.radio+'"><input type="radio" value="v"'+(l.color.mode=="v"?' checked="checked"':"")+'/>V:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(Y!=null?Y.v:"")+'" title="'+aa.tooltips.value.textbox+'"/> %<br/><br/></td></tr><tr class="Red"><td class="Radio"><label title="'+aa.tooltips.red.radio+'"><input type="radio" value="r"'+(l.color.mode==
|
||||||
"r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(X!=null?X.r:"")+'" title="'+aa.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+aa.tooltips.green.radio+'"><input type="radio" value="g"'+(l.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(X!=null?X.g:"")+'" title="'+aa.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+
|
"r"?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(Y!=null?Y.r:"")+'" title="'+aa.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label title="'+aa.tooltips.green.radio+'"><input type="radio" value="g"'+(l.color.mode=="g"?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(Y!=null?Y.g:"")+'" title="'+aa.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label title="'+
|
||||||
aa.tooltips.blue.radio+'"><input type="radio" value="b"'+(l.color.mode=="b"?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(X!=null?X.b:"")+'" title="'+aa.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(M.alphaSupport?'<label title="'+aa.tooltips.alpha.radio+'"><input type="radio" value="a"'+(l.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":" ")+'</td><td class="Text">'+(M.alphaSupport?'<input type="text" maxlength="'+
|
aa.tooltips.blue.radio+'"><input type="radio" value="b"'+(l.color.mode=="b"?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(Y!=null?Y.b:"")+'" title="'+aa.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio">'+(M.alphaSupport?'<label title="'+aa.tooltips.alpha.radio+'"><input type="radio" value="a"'+(l.color.mode=="a"?' checked="checked"':"")+"/>A:</label>":" ")+'</td><td class="Text">'+(M.alphaSupport?'<input type="text" maxlength="'+
|
||||||
(3+M.alphaPrecision)+'" value="'+(X!=null?Math.precision(X.a*100/255,M.alphaPrecision):"")+'" title="'+aa.tooltips.alpha.textbox+'"/> %':" ")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+aa.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(X!=null?X.hex:"")+'"/></label>'+(M.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(X!=null?X.ahex.substring(6):"")+'" title="'+aa.tooltips.hex.alpha+'"/></td>':" ")+"</tr></tbody></table>";
|
(3+M.alphaPrecision)+'" value="'+(Y!=null?Math.precision(Y.a*100/255,M.alphaPrecision):"")+'" title="'+aa.tooltips.alpha.textbox+'"/> %':" ")+'</td></tr><tr class="Hex"><td colspan="2" class="Text"><label title="'+aa.tooltips.hex.textbox+'">#:<input type="text" maxlength="6" class="Hex" value="'+(Y!=null?Y.hex:"")+'"/></label>'+(M.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'+(Y!=null?Y.ahex.substring(6):"")+'" title="'+aa.tooltips.hex.alpha+'"/></td>':" ")+"</tr></tbody></table>";
|
||||||
if(M.expandable){z.html(Oa);a(document.body).children("div.jPicker.Container").length==0?a(document.body).prepend(z):a(document.body).children("div.jPicker.Container:last").after(z);z.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});z.css({zIndex:20})});z.css({left:M.position.x=="left"?I.offset().left-530-(M.position.y=="center"?25:0)+"px":M.position.x=="center"?I.offset().left-260+"px":M.position.x=="right"?I.offset().left-10+(M.position.y=="center"?25:0)+
|
if(M.expandable){z.html(Oa);a(document.body).children("div.jPicker.Container").length==0?a(document.body).prepend(z):a(document.body).children("div.jPicker.Container:last").after(z);z.mousedown(function(){a(document.body).children("div.jPicker.Container").css({zIndex:10});z.css({zIndex:20})});z.css({left:M.position.x=="left"?I.offset().left-530-(M.position.y=="center"?25:0)+"px":M.position.x=="center"?I.offset().left-260+"px":M.position.x=="right"?I.offset().left-10+(M.position.y=="center"?25:0)+
|
||||||
"px":M.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":I.offset().left+parseInt(M.position.x)+"px",position:"absolute",top:M.position.y=="top"?I.offset().top-312+"px":M.position.y=="center"?I.offset().top-156+"px":M.position.y=="bottom"?I.offset().top+25+"px":I.offset().top+parseInt(M.position.y)+"px"})}else{z=a(e);z.html(Oa)}Oa=z.find("tbody:first");p=Oa.find("div.Map:first");L=Oa.find("div.Bar:first");var Wa=p.find("span"),fb=L.find("span");T=Wa.filter(".Map1:first");N=Wa.filter(".Map2:first");
|
"px":M.position.x=="screenCenter"?(a(document).width()>>1)-260+"px":I.offset().left+parseInt(M.position.x)+"px",position:"absolute",top:M.position.y=="top"?I.offset().top-312+"px":M.position.y=="center"?I.offset().top-156+"px":M.position.y=="bottom"?I.offset().top+25+"px":I.offset().top+parseInt(M.position.y)+"px"})}else{z=a(e);z.html(Oa)}Oa=z.find("tbody:first");p=Oa.find("div.Map:first");L=Oa.find("div.Bar:first");var Wa=p.find("span"),fb=L.find("span");T=Wa.filter(".Map1:first");N=Wa.filter(".Map2:first");
|
||||||
K=Wa.filter(".Map3:first");da=fb.filter(".Map1:first");V=fb.filter(".Map2:first");O=fb.filter(".Map3:first");fa=fb.filter(".Map4:first");sa=fb.filter(".Map5:first");ia=fb.filter(".Map6:first");ca=new n(p,{map:{width:na.colorMap.width,height:na.colorMap.height},arrow:{image:na.clientPath+na.colorMap.arrow.file,width:na.colorMap.arrow.width,height:na.colorMap.arrow.height}});ca.bind(Ia);ea=new n(L,{map:{width:na.colorBar.width,height:na.colorBar.height},arrow:{image:na.clientPath+na.colorBar.arrow.file,
|
J=Wa.filter(".Map3:first");da=fb.filter(".Map1:first");V=fb.filter(".Map2:first");O=fb.filter(".Map3:first");fa=fb.filter(".Map4:first");sa=fb.filter(".Map5:first");ha=fb.filter(".Map6:first");ca=new n(p,{map:{width:na.colorMap.width,height:na.colorMap.height},arrow:{image:na.clientPath+na.colorMap.arrow.file,width:na.colorMap.arrow.width,height:na.colorMap.arrow.height}});ca.bind(Ia);ea=new n(L,{map:{width:na.colorBar.width,height:na.colorBar.height},arrow:{image:na.clientPath+na.colorBar.arrow.file,
|
||||||
width:na.colorBar.arrow.width,height:na.colorBar.arrow.height}});ea.bind(Pa);qa=new f(Oa,ta.active,M.expandable&&M.bindToInput?M.input:null,M.alphaPrecision);Wa=X!=null?X.hex:null;var tb=Oa.find(".Preview");fb=Oa.find(".Button");ra=tb.find(".Active:first").css({backgroundColor:Wa&&"#"+Wa||"transparent"});la=tb.find(".Current:first").css({backgroundColor:Wa&&"#"+Wa||"transparent"}).bind("click",Ja);Fa.call(e,la,Math.precision(ta.current.val("a")*100)/255,4);ma=fb.find(".Ok:first").bind("click",Cb);
|
width:na.colorBar.arrow.width,height:na.colorBar.arrow.height}});ea.bind(Pa);qa=new f(Oa,ta.active,M.expandable&&M.bindToInput?M.input:null,M.alphaPrecision);Wa=Y!=null?Y.hex:null;var tb=Oa.find(".Preview");fb=Oa.find(".Button");ra=tb.find(".Active:first").css({backgroundColor:Wa&&"#"+Wa||"transparent"});la=tb.find(".Current:first").css({backgroundColor:Wa&&"#"+Wa||"transparent"}).bind("click",Ja);Fa.call(e,la,Math.precision(ta.current.val("a")*100)/255,4);ma=fb.find(".Ok:first").bind("click",Cb);
|
||||||
Y=fb.find(".Cancel:first").bind("click",pb);za=fb.find(".Grid:first");setTimeout(function(){Xa.call(e,T,na.clientPath+"Maps.png");Xa.call(e,N,na.clientPath+"Maps.png");Xa.call(e,K,na.clientPath+"map-opacity.png");Xa.call(e,da,na.clientPath+"Bars.png");Xa.call(e,V,na.clientPath+"Bars.png");Xa.call(e,O,na.clientPath+"Bars.png");Xa.call(e,fa,na.clientPath+"Bars.png");Xa.call(e,sa,na.clientPath+"bar-opacity.png");Xa.call(e,ia,na.clientPath+"AlphaBar.png");Xa.call(e,tb.find("div:last"),na.clientPath+"preview-opacity.png")},
|
Z=fb.find(".Cancel:first").bind("click",ob);za=fb.find(".Grid:first");setTimeout(function(){Xa.call(e,T,na.clientPath+"Maps.png");Xa.call(e,N,na.clientPath+"Maps.png");Xa.call(e,J,na.clientPath+"map-opacity.png");Xa.call(e,da,na.clientPath+"Bars.png");Xa.call(e,V,na.clientPath+"Bars.png");Xa.call(e,O,na.clientPath+"Bars.png");Xa.call(e,fa,na.clientPath+"Bars.png");Xa.call(e,sa,na.clientPath+"bar-opacity.png");Xa.call(e,ha,na.clientPath+"AlphaBar.png");Xa.call(e,tb.find("div:last"),na.clientPath+"preview-opacity.png")},
|
||||||
0);Oa.find("td.Radio input").bind("click",$a);if(ta.quickList&&ta.quickList.length>0){fb="";for(i=0;i<ta.quickList.length;i++){if((typeof ta.quickList[i]).toString().toLowerCase()=="string")ta.quickList[i]=new c({hex:ta.quickList[i]});var wb=ta.quickList[i].val("a"),Hb=ta.quickList[i].val("ahex");if(!M.alphaSupport&&Hb)Hb=Hb.substring(0,6)+"ff";var rb=ta.quickList[i].val("hex");fb+='<span class="QuickColor"'+(Hb&&' title="#'+Hb+'"'||"")+' style="background-color:'+(rb&&"#"+rb||"")+";"+(rb?"":"background-image:url("+
|
0);Oa.find("td.Radio input").bind("click",$a);if(ta.quickList&&ta.quickList.length>0){fb="";for(i=0;i<ta.quickList.length;i++){if((typeof ta.quickList[i]).toString().toLowerCase()=="string")ta.quickList[i]=new c({hex:ta.quickList[i]});var wb=ta.quickList[i].val("a"),Hb=ta.quickList[i].val("ahex");if(!M.alphaSupport&&Hb)Hb=Hb.substring(0,6)+"ff";var rb=ta.quickList[i].val("hex");fb+='<span class="QuickColor"'+(Hb&&' title="#'+Hb+'"'||"")+' style="background-color:'+(rb&&"#"+rb||"")+";"+(rb?"":"background-image:url("+
|
||||||
na.clientPath+"NoColor.png)")+(M.alphaSupport&&wb&&wb<255?";opacity:"+Math.precision(wb/255,4)+";filter:Alpha(opacity="+Math.precision(wb/2.55,4)+")":"")+'"> </span>'}Xa.call(e,za,na.clientPath+"bar-opacity.png");za.html(fb);za.find(".QuickColor").click(zb)}Ya.call(e,l.color.mode);ta.active.bind(Na);a.isFunction(nb)&&ta.active.bind(nb);ta.current.bind(hb);if(M.expandable){e.icon=I.parents(".Icon:first");Ka=e.icon.find(".Color:first").css({backgroundColor:Wa&&"#"+Wa||"transparent"});Qa=e.icon.find(".Alpha:first");
|
na.clientPath+"NoColor.png)")+(M.alphaSupport&&wb&&wb<255?";opacity:"+Math.precision(wb/255,4)+";filter:Alpha(opacity="+Math.precision(wb/2.55,4)+")":"")+'"> </span>'}Xa.call(e,za,na.clientPath+"bar-opacity.png");za.html(fb);za.find(".QuickColor").click(zb)}Ya.call(e,l.color.mode);ta.active.bind(Na);a.isFunction(pb)&&ta.active.bind(pb);ta.current.bind(hb);if(M.expandable){e.icon=I.parents(".Icon:first");Ka=e.icon.find(".Color:first").css({backgroundColor:Wa&&"#"+Wa||"transparent"});Qa=e.icon.find(".Alpha:first");
|
||||||
Xa.call(e,Qa,na.clientPath+"bar-opacity.png");Fa.call(e,Qa,Math.precision((255-(X!=null?X.a:0))*100/255,4));Ma=e.icon.find(".Image:first").css({backgroundImage:"url('"+na.clientPath+na.picker.file+"')"}).bind("click",db);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Wa&&"#"+Wa||"transparent",color:X==null||X.v>75?"#000000":"#ffffff"});Sa=Oa.find(".Move:first").bind("mousedown",Da);ta.active.bind(ib)}else Kb.call(e)},na=l.images,aa=l.localization,ta={active:(typeof l.color.active).toString().toLowerCase()==
|
Xa.call(e,Qa,na.clientPath+"bar-opacity.png");Fa.call(e,Qa,Math.precision((255-(Y!=null?Y.a:0))*100/255,4));Ma=e.icon.find(".Image:first").css({backgroundImage:"url('"+na.clientPath+na.picker.file+"')"}).bind("click",eb);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Wa&&"#"+Wa||"transparent",color:Y==null||Y.v>75?"#000000":"#ffffff"});Sa=Oa.find(".Move:first").bind("mousedown",Da);ta.active.bind(ib)}else Kb.call(e)},na=l.images,aa=l.localization,ta={active:(typeof l.color.active).toString().toLowerCase()==
|
||||||
"string"?new c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,
|
"string"?new c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,
|
||||||
6)+"ff":l.color.active.val("ahex")}),quickList:l.color.quickList};a.extend(true,e,{commitCallback:Db,liveCallback:nb,cancelCallback:Eb,color:ta,show:Kb,hide:Ib,destroy:function(){z.find("td.Radio input").unbind("click",$a);la.unbind("click",Ja);Y.unbind("click",pb);ma.unbind("click",Cb);if(l.window.expandable){Ma.unbind("click",db);Sa.unbind("mousedown",Da);e.icon=null}z.find(".QuickColor").unbind("click",zb);ia=sa=fa=O=V=da=K=N=T=L=p=null;ca.destroy();ca=null;ea.destroy();ea=null;qa.destroy();nb=
|
6)+"ff":l.color.active.val("ahex")}),quickList:l.color.quickList};a.extend(true,e,{commitCallback:Db,liveCallback:pb,cancelCallback:Eb,color:ta,show:Kb,hide:Ib,destroy:function(){z.find("td.Radio input").unbind("click",$a);la.unbind("click",Ja);Z.unbind("click",ob);ma.unbind("click",Cb);if(l.window.expandable){Ma.unbind("click",eb);Sa.unbind("mousedown",Da);e.icon=null}z.find(".QuickColor").unbind("click",zb);ha=sa=fa=O=V=da=J=N=T=L=p=null;ca.destroy();ca=null;ea.destroy();ea=null;qa.destroy();pb=
|
||||||
Eb=Db=za=Y=ma=la=ra=qa=null;z.html("");for(i=0;i<m.length;i++)m[i]==e&&m.splice(i,1)}});m.push(e);setTimeout(function(){Qb.call(e)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new c({ahex:"#ffcc00ff"}),quickList:[new c({h:360,s:33,v:100}),new c({h:360,s:66,v:100}),new c({h:360,s:100,v:100}),
|
Eb=Db=za=Z=ma=la=ra=qa=null;z.html("");for(i=0;i<m.length;i++)m[i]==e&&m.splice(i,1)}});m.push(e);setTimeout(function(){Qb.call(e)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new c({ahex:"#ffcc00ff"}),quickList:[new c({h:360,s:33,v:100}),new c({h:360,s:66,v:100}),new c({h:360,s:100,v:100}),
|
||||||
new c({h:360,s:100,v:75}),new c({h:360,s:100,v:50}),new c({h:180,s:0,v:100}),new c({h:30,s:33,v:100}),new c({h:30,s:66,v:100}),new c({h:30,s:100,v:100}),new c({h:30,s:100,v:75}),new c({h:30,s:100,v:50}),new c({h:180,s:0,v:90}),new c({h:60,s:33,v:100}),new c({h:60,s:66,v:100}),new c({h:60,s:100,v:100}),new c({h:60,s:100,v:75}),new c({h:60,s:100,v:50}),new c({h:180,s:0,v:80}),new c({h:90,s:33,v:100}),new c({h:90,s:66,v:100}),new c({h:90,s:100,v:100}),new c({h:90,s:100,v:75}),new c({h:90,s:100,v:50}),
|
new c({h:360,s:100,v:75}),new c({h:360,s:100,v:50}),new c({h:180,s:0,v:100}),new c({h:30,s:33,v:100}),new c({h:30,s:66,v:100}),new c({h:30,s:100,v:100}),new c({h:30,s:100,v:75}),new c({h:30,s:100,v:50}),new c({h:180,s:0,v:90}),new c({h:60,s:33,v:100}),new c({h:60,s:66,v:100}),new c({h:60,s:100,v:100}),new c({h:60,s:100,v:75}),new c({h:60,s:100,v:50}),new c({h:180,s:0,v:80}),new c({h:90,s:33,v:100}),new c({h:90,s:66,v:100}),new c({h:90,s:100,v:100}),new c({h:90,s:100,v:75}),new c({h:90,s:100,v:50}),
|
||||||
new c({h:180,s:0,v:70}),new c({h:120,s:33,v:100}),new c({h:120,s:66,v:100}),new c({h:120,s:100,v:100}),new c({h:120,s:100,v:75}),new c({h:120,s:100,v:50}),new c({h:180,s:0,v:60}),new c({h:150,s:33,v:100}),new c({h:150,s:66,v:100}),new c({h:150,s:100,v:100}),new c({h:150,s:100,v:75}),new c({h:150,s:100,v:50}),new c({h:180,s:0,v:50}),new c({h:180,s:33,v:100}),new c({h:180,s:66,v:100}),new c({h:180,s:100,v:100}),new c({h:180,s:100,v:75}),new c({h:180,s:100,v:50}),new c({h:180,s:0,v:40}),new c({h:210,
|
new c({h:180,s:0,v:70}),new c({h:120,s:33,v:100}),new c({h:120,s:66,v:100}),new c({h:120,s:100,v:100}),new c({h:120,s:100,v:75}),new c({h:120,s:100,v:50}),new c({h:180,s:0,v:60}),new c({h:150,s:33,v:100}),new c({h:150,s:66,v:100}),new c({h:150,s:100,v:100}),new c({h:150,s:100,v:75}),new c({h:150,s:100,v:50}),new c({h:180,s:0,v:50}),new c({h:180,s:33,v:100}),new c({h:180,s:66,v:100}),new c({h:180,s:100,v:100}),new c({h:180,s:100,v:75}),new c({h:180,s:100,v:50}),new c({h:180,s:0,v:40}),new c({h:210,
|
||||||
s:33,v:100}),new c({h:210,s:66,v:100}),new c({h:210,s:100,v:100}),new c({h:210,s:100,v:75}),new c({h:210,s:100,v:50}),new c({h:180,s:0,v:30}),new c({h:240,s:33,v:100}),new c({h:240,s:66,v:100}),new c({h:240,s:100,v:100}),new c({h:240,s:100,v:75}),new c({h:240,s:100,v:50}),new c({h:180,s:0,v:20}),new c({h:270,s:33,v:100}),new c({h:270,s:66,v:100}),new c({h:270,s:100,v:100}),new c({h:270,s:100,v:75}),new c({h:270,s:100,v:50}),new c({h:180,s:0,v:10}),new c({h:300,s:33,v:100}),new c({h:300,s:66,v:100}),
|
s:33,v:100}),new c({h:210,s:66,v:100}),new c({h:210,s:100,v:100}),new c({h:210,s:100,v:75}),new c({h:210,s:100,v:50}),new c({h:180,s:0,v:30}),new c({h:240,s:33,v:100}),new c({h:240,s:66,v:100}),new c({h:240,s:100,v:100}),new c({h:240,s:100,v:75}),new c({h:240,s:100,v:50}),new c({h:180,s:0,v:20}),new c({h:270,s:33,v:100}),new c({h:270,s:66,v:100}),new c({h:270,s:100,v:100}),new c({h:270,s:100,v:75}),new c({h:270,s:100,v:50}),new c({h:180,s:0,v:10}),new c({h:300,s:33,v:100}),new c({h:300,s:66,v:100}),
|
||||||
|
|
Loading…
Reference in New Issue