diff --git a/dist/all.min-via-goog-cc.js b/dist/all.min-via-goog-cc.js new file mode 100644 index 00000000..32b5b9b9 --- /dev/null +++ b/dist/all.min-via-goog-cc.js @@ -0,0 +1,165 @@ +if(typeof console=="undefined")var console={log:function(){},warn:function(){}};if(!this.JSON)this.JSON={}; +(function(){function e(k){return k<10?"0"+k:k}function f(k){g.lastIndex=0;return g.test(k)?'"'+k.replace(g,function(m){var n=b[m];return typeof n==="string"?n:"\\u"+("0000"+m.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+k+'"'}function a(k,m){var n,o,s,r,u=h,q,p=m[k];if(p&&typeof p==="object"&&typeof p.toJSON==="function")p=p.toJSON(k);if(typeof d==="function")p=d.call(m,k,p);switch(typeof p){case "string":return f(p);case "number":return isFinite(p)?String(p):"null";case "boolean":case "null":return String(p); +case "object":if(!p)return"null";h+=l;q=[];if(Object.prototype.toString.apply(p)==="[object Array]"){r=p.length;for(n=0;n>>0;l=Number(l)||0;l=Math[l<0?"ceil":"floor"](l);if(l<0)l+=b;for(;l>>0;b>>0;d>>0;b>>0;b>>0;k>>0,b=0,d;if(arguments.length>1)d=arguments[1];else{do{if(b in this){d=this[b++];break}if(++b>=l)throw new TypeError;}while(1)}for(;b< +l;b++)if(b in this)d=h.call(null,d,this[b],b,this);return d};c.util.array={invoke:function(h,l){for(var b=g.call(arguments,2),d=[],k=0,m=h.length;k=d)d=h[b][l]}else for(;b--;)if(h[b]>=d)d=h[b];return d}};c.util.object= +{extend:e,clone:function(h){return e({},h)}};if(!String.prototype.trim)String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")};c.util.string={camelize:function(h){return h.replace(/-+(.)?/g,function(l,b){return b?b.toUpperCase():""})},capitalize:function(h){return h.charAt(0).toUpperCase()+h.slice(1).toLowerCase()}};if(!Function.prototype.bind)Function.prototype.bind=function(h){var l=this,b=Array.prototype.slice.call(arguments,1);return function(){return l.apply(h,b.concat(Array.prototype.slice.call(arguments)))}}; +(function(){function h(){}var l;l=function(){for(var b in{toString:1})if(b==="toString")return false;return true}()?function(b,d){if(d.toString!==Object.prototype.toString)b.prototype.toString=d.toString;if(d.valueOf!==Object.prototype.valueOf)b.prototype.valueOf=d.valueOf;for(var k in d)b.prototype[k]=d[k]}:function(b,d){for(var k in d)b.prototype[k]=d[k]};c.util.createClass=function(){function b(){this.initialize.apply(this,arguments)}var d=null,k=g.call(arguments,0);if(typeof k[0]==="function")d= +k.shift();b.superclass=d;b.subclasses=[];if(d){h.prototype=d.prototype;b.prototype=new h;d.subclasses.push(b)}d=0;for(var m=k.length;d=0.9999?"":"alpha(opacity="+m*100+")";n.filter=n.filter.replace(b,m)}else n.filter+=" alpha(opacity="+m*100+")";return k};c.util.setStyle=function(k,m){var n=k.style;if(typeof m==="string"){k.style.cssText+= +";"+m;return m.indexOf("opacity")>-1?d(k,m.match(/opacity:\s*(\d?\.?\d*)/)[1]):k}for(var o in m)if(o==="opacity")d(k,m[o]);else n[o==="float"||o==="cssFloat"?typeof n.styleFloat==="undefined"?"cssFloat":"styleFloat":o]=m[o];return k}})();(function(){var h=document.documentElement.style,l="userSelect"in h?"userSelect":"MozUserSelect"in h?"MozUserSelect":"WebkitUserSelect"in h?"WebkitUserSelect":"KhtmlUserSelect"in h?"KhtmlUserSelect":"";c.util.makeElementUnselectable=function(b){if(typeof b.onselectstart!== +"undefined")b.onselectstart=a;if(l)b.style[l]="none";else if(typeof b.unselectable=="string")b.unselectable="on";return b}})();(function(){function h(b,d){l.load(b);d()}c.util.getScript=function(b,d){var k=document.getElementsByTagName("head")[0],m=document.createElement("script"),n=true;m.type="text/javascript";m.setAttribute("runat","server");m.onload=m.onreadystatechange=function(o){if(n)if(!(typeof this.readyState=="string"&&this.readyState!=="loaded"&&this.readyState!=="complete")){n=false;d(o|| +window.event);m=m.onload=m.onreadystatechange=null}};m.src=b;k.appendChild(m)};var l=this.Jaxer;if(l&&l.load)c.util.getScript=h})();c.util.getById=function(h){return typeof h==="string"?document.getElementById(h):h};c.util.toArray=function(h){for(var l=[],b=h.length;b--;)l[b]=h[b];return l};c.util.makeElement=f;c.util.addClass=function(h,l){if((" "+h.className+" ").indexOf(" "+l+" ")===-1)h.className+=(h.className?" ":"")+l};c.util.wrapElement=function(h,l,b){if(typeof l==="string")l=f(l,b);h.parentNode&& +h.parentNode.replaceChild(l,h);l.appendChild(h);return l};c.util.getElementOffset=function(h){var l=0,b=0;do{l+=h.offsetTop||0;b+=h.offsetLeft||0;h=h.offsetParent}while(h);return{left:b,top:l}};c.util.animate=function(h){h||(h={});var l=+new Date,b=h.duration||500,d=l+b,k,m,n=h.onChange||function(){},o=h.easing||function(p){return-Math.cos(p*Math.PI)/2+0.5},s="startValue"in h?h.startValue:0,r="endValue"in h?h.endValue:100,u=s>r;h.onStart&&h.onStart();var q=setInterval(function(){k=+new Date;m=k>d? +1:(k-l)/b;n(u?s-(s-r)*o(m):s+(r-s)*o(m));if(k>d){clearInterval(q);h.onComplete&&h.onComplete()}},10)};(function(){function h(){}var l=function(){for(var b=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")},function(){return new XMLHttpRequest}],d=b.length;d--;)try{if(b[d]())return b[d]}catch(k){}}();c.util.request=function(b,d){d||(d={});var k=d.method?d.method.toUpperCase():"GET", +m=d.onComplete||function(){},n=l(),o;n.onreadystatechange=function(){if(n.readyState===4){m(n);n.onreadystatechange=h}};if(k==="GET"){o=null;if(typeof d.parameters=="string")b=b+(/\?/.test(b)?"&":"?")+d.parameters}n.open(k,b,true);if(k==="POST"||k==="PUT")n.setRequestHeader("Content-Type","application/x-www-form-urlencoded");n.send(o);return n}})();(function(){var h=Math.PI/180;c.util.removeFromArray=function(l,b){var d=l.indexOf(b);d!==-1&&l.splice(d,1);return l};c.util.degreesToRadians=function(l){return l* +h};c.util.toFixed=function(l,b){return parseFloat(Number(l).toFixed(b))};c.util.getRandomInt=function(l,b){return Math.floor(Math.random()*(b-l+1))+l}})()})(this); +(function(){var e=this.fabric||(this.fabric={}),f={cx:"left",x:"left",cy:"top",y:"top",r:"radius","fill-opacity":"opacity","fill-rule":"fillRule","stroke-width":"strokeWidth",transform:"transformMatrix"};e.parseTransformAttribute=function(){function a(d,k){var m=k[0];d[0]=Math.cos(m);d[1]=Math.sin(m);d[2]=-Math.sin(m);d[3]=Math.cos(m)}function c(d,k){var m=k.length===2?k[1]:k[0];d[0]=k[0];d[3]=m}function g(d,k){d[4]=k[0];if(k.length===2)d[5]=k[1]}var h=[1,0,0,1,0,0],l=RegExp("^\\s*(?:(?:(?:(?:(matrix)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(translate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(scale)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(rotate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(skewX)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(skewY)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\)))(?:(?:\\s+,?\\s*|,\\s*)(?:(?:(matrix)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(translate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(scale)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(rotate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(skewX)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(skewY)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))))*)?)\\s*$"), +b=RegExp("(?:(?:(matrix)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(translate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(scale)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(rotate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(skewX)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(skewY)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\)))"); +return function(d){var k=h.concat();if(!d||d&&!l.test(d))return k;d.replace(b,function(m){var n=RegExp("(?:(?:(matrix)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(translate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(scale)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(rotate)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))(?:\\s+,?\\s*|,\\s*)((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)))?\\s*\\))|(?:(skewX)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\))|(?:(skewY)\\s*\\(\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?))\\s*\\)))").exec(m).filter(function(o){return o!== +""&&o!=null});m=n[1];n=n.slice(2).map(parseFloat);switch(m){case "translate":g(k,n);break;case "rotate":a(k,n);break;case "scale":c(k,n);break;case "skewX":k[2]=n[0];break;case "skewY":k[1]=n[0];break;case "matrix":k=n;break}});return k}}();e.parseSVGDocument=function(){var a=/^(path|circle|polygon|polyline|ellipse|rect|line)$/,c=RegExp("^\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)+)\\s*,?\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)+)\\s*,?\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)+)\\s*,?\\s*((?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)+)\\s*$"); +return function(g,h){if(g){var l=e.util.toArray(g.getElementsByTagName("*")).filter(function(o){var s;if(s=a.test(o.tagName)){a:{for(o=o;o&&(o=o.parentNode);)if(o.nodeName==="pattern"){o=true;break a}o=false}s=!o}return s});if(!(!l||l&&!l.length)){var b=g.getAttribute("viewBox"),d=g.getAttribute("width"),k=g.getAttribute("height"),m=null,n=null;if(b&&(b=b.match(c))){parseInt(b[1],10);parseInt(b[2],10);m=parseInt(b[3],10);n=parseInt(b[4],10)}m=d?parseFloat(d):m;n=k?parseFloat(k):n;b={width:m,height:n}; +l=e.parseElements(l,e.util.object.clone(b));!l||l&&!l.length||h&&h(l,b)}}}}();e.util.object.extend(e,{parseAttributes:function(a,c){if(a){var g,h,l={};if(a.parentNode&&/^g$/i.test(a.parentNode.nodeName))l=e.parseAttributes(a.parentNode,c);var b=c.reduce(function(d,k){g=a.getAttribute(k);h=parseFloat(g);if(g){if((k==="fill"||k==="stroke")&&g==="none")g="";if(k==="fill-rule")g=g==="evenodd"?"destination-over":g;if(k==="transform")g=e.parseTransformAttribute(g);if(k in f)k=f[k];d[k]=isNaN(h)?g:h}return d}, +{});b=e.util.object.extend(e.parseStyleAttribute(a),b);return e.util.object.extend(l,b)}},parseElements:function(a,c){var g=a.map(function(h){var l=e[e.util.string.capitalize(h.tagName)];if(l&&l.fromElement)try{return l.fromElement(h,c)}catch(b){console.log(b.message||b)}});return g=g.filter(function(h){return h!=null})},parseStyleAttribute:function(a){var c={};if(a=a.getAttribute("style"))if(typeof a=="string"){a=a.split(";");a.pop();c=a.reduce(function(h,l){var b=l.split(":"),d=b[0].trim();b=b[1].trim(); +h[d]=b;return h},{})}else for(var g in a)if(typeof a[g]!=="undefined")c[g]=a[g];return c},parsePointsAttribute:function(a){if(!a)return null;a=a.trim().split(/\s+/);a=a.reduce(function(c,g){g=g.split(",");c.push({x:parseFloat(g[0]),y:parseFloat(g[1])});return c},[]);if(a.length%2!==0)return null;return a}})})(); +(function(){function e(a,c){arguments.length>0&&this.init(a,c)}var f=this.fabric||(this.fabric={});if(f.Point)console.warn("fabric.Point is already defined");else{e.prototype={constructor:e,init:function(a,c){this.x=a;this.y=c},add:function(a){return new e(this.x+a.x,this.y+a.y)},addEquals:function(a){this.x+=a.x;this.y+=a.y;return this},scalarAdd:function(a){return new e(this.x+a,this.y+a)},scalarAddEquals:function(a){this.x+=a;this.y+=a;return this},subtract:function(a){return new e(this.x-a.x, +this.y-a.y)},subtractEquals:function(a){this.x-=a.x;this.y-=a.y;return this},scalarSubtract:function(a){return new e(this.x-a,this.y-a)},scalarSubtractEquals:function(a){this.x-=a;this.y-=a;return this},multiply:function(a){return new e(this.x*a,this.y*a)},multiplyEquals:function(a){this.x*=a;this.y*=a;return this},divide:function(a){return new e(this.x/a,this.y/a)},divideEquals:function(a){this.x/=a;this.y/=a;return this},eq:function(a){return this.x==a.x&&this.y==a.y},lt:function(a){return this.x< +a.x&&this.ya.x&&this.y>a.y},gte:function(a){return this.x>=a.x&&this.y>=a.y},lerp:function(a,c){return new e(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c)},distanceFrom:function(a){var c=this.x-a.x;a=this.y-a.y;return Math.sqrt(c*c+a*a)},min:function(a){return new e(Math.min(this.x,a.x),Math.min(this.y,a.y))},max:function(a){return new e(Math.max(this.x,a.x),Math.max(this.y,a.y))},toString:function(){return this.x+ +","+this.y},setXY:function(a,c){this.x=a;this.y=c},setFromPoint:function(a){this.x=a.x;this.y=a.y},swap:function(a){var c=this.x,g=this.y;this.x=a.x;this.y=a.y;a.x=c;a.y=g}};f.Point=e}})(); +(function(){function e(a){arguments.length>0&&this.init(a)}var f=this.fabric||(this.fabric={});if(f.Intersection)console.warn("fabric.Intersection is already defined");else{e.prototype.init=function(a){this.status=a;this.points=[]};e.prototype.appendPoint=function(a){this.points.push(a)};e.prototype.appendPoints=function(a){this.points=this.points.concat(a)};e.intersectLineLine=function(a,c,g,h){var l,b=(h.x-g.x)*(a.y-g.y)-(h.y-g.y)*(a.x-g.x);l=(c.x-a.x)*(a.y-g.y)-(c.y-a.y)*(a.x-g.x);g=(h.y-g.y)* +(c.x-a.x)-(h.x-g.x)*(c.y-a.y);if(g!=0){b=b/g;l=l/g;if(0<=b&&b<=1&&0<=l&&l<=1){l=new e("Intersection");l.points.push(new f.Point(a.x+b*(c.x-a.x),a.y+b*(c.y-a.y)))}else l=new e("No Intersection")}else l=b==0||l==0?new e("Coincident"):new e("Parallel");return l};e.intersectLinePolygon=function(a,c,g){for(var h=new e("No Intersection"),l=g.length,b=0;b0)h.status="Intersection";return h};e.intersectPolygonPolygon= +function(a,c){for(var g=new e("No Intersection"),h=a.length,l=0;l0)g.status="Intersection";return g};e.intersectPolygonRectangle=function(a,c,g){var h=c.min(g),l=c.max(g);g=new f.Point(l.x,h.y);var b=new f.Point(h.x,l.y);c=e.intersectLinePolygon(h,g,a);g=e.intersectLinePolygon(g,l,a);l=e.intersectLinePolygon(l,b,a);a=e.intersectLinePolygon(b,h,a);h=new e("No Intersection");h.appendPoints(c.points); +h.appendPoints(g.points);h.appendPoints(l.points);h.appendPoints(a.points);if(h.points.length>0)h.status="Intersection";return h};f.Intersection=e}})(); +(function(){function e(a){a?this._tryParsingColor(a):this.setSource([0,0,0,1])}var f=this.fabric||(this.fabric={});if(f.Color)console.warn("fabric.Color is already defined.");else{f.Color=e;e.prototype._tryParsingColor=function(a){var c=e.sourceFromHex(a);c||(c=e.sourceFromRgb(a));c&&this.setSource(c)};e.prototype.getSource=function(){return this._source};e.prototype.setSource=function(a){this._source=a};e.prototype.toRgb=function(){var a=this.getSource();return"rgb("+a[0]+","+a[1]+","+a[2]+")"}; +e.prototype.toRgba=function(){var a=this.getSource();return"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")"};e.prototype.toHex=function(){var a=this.getSource(),c=a[0].toString(16);c=c.length==1?"0"+c:c;var g=a[1].toString(16);g=g.length==1?"0"+g:g;a=a[2].toString(16);a=a.length==1?"0"+a:a;return c.toUpperCase()+g.toUpperCase()+a.toUpperCase()};e.prototype.getAlpha=function(){return this.getSource()[3]};e.prototype.setAlpha=function(a){var c=this.getSource();c[3]=a;this.setSource(c);return this};e.prototype.toGrayscale= +function(){var a=this.getSource(),c=parseInt((a[0]*0.3+a[1]*0.59+a[2]*0.11).toFixed(0),10);this.setSource([c,c,c,a[3]]);return this};e.prototype.toBlackWhite=function(a){var c=this.getSource(),g=(c[0]*0.3+c[1]*0.59+c[2]*0.11).toFixed(0);c=c[3];a=a||127;g=Number(g)0?0:-b),this._groupSelector.ey-(d>0?0:-d),k,m);this._oContextTop.lineWidth=this.selectionLineWidth;this._oContextTop.strokeStyle=this.selectionBorderColor;this._oContextTop.strokeRect(this._groupSelector.ex+0.5-(b>0?0:k),this._groupSelector.ey+0.5-(d>0? +0:m),k,m)},_findSelectedObjects:function(){var b=[],d=this._groupSelector.ex,k=this._groupSelector.ey,m=d+this._groupSelector.left,n=k+this._groupSelector.top,o=new fabric.Point(Math.min(d,m),Math.min(k,n));k=new fabric.Point(Math.max(d,m),Math.max(k,n));m=0;for(n=this._aObjects.length;m +1){b=new fabric.Group(b);this.setActiveGroup(b);b.saveCoords();fabric.util.fireEvent("group:selected",{target:b})}this.renderAll()},add:function(){this._aObjects.push.apply(this._aObjects,arguments);this.renderAll();return this},insertAt:function(b,d){this._aObjects.splice(d,0,b);this.renderAll();return this},getObjects:function(){return this._aObjects},getContext:function(){return this._oContextTop},clearContext:function(b){b.clearRect(0,0,this._oConfig.width,this._oConfig.height);return this},clear:function(){this._aObjects.length= +0;this.clearContext(this._oContextTop);this.clearContext(this._oContextContainer);this.renderAll();return this},renderAll:function(b){var d=this._oConfig.width,k=this._oConfig.height,m=b?this._oContextTop:this._oContextContainer;this.clearContext(this._oContextTop);m!==this._oContextTop&&this.clearContext(m);if(b){if(!l&&this.backgroundColor==="transparent")var n=true;if(!n)m.fillStyle=this.backgroundColor;m.fillRect(0,0,d,k)}b=this._aObjects.length;d=this.getActiveGroup();if(b)for(k=0;k1?new fabric.PathGroup(t,r):t[0];t.setSourcePath(p);if(!(t instanceof fabric.PathGroup)){fabric.util.object.extend(t,r);typeof r.angle!=="undefined"&&t.setAngle(r.angle)}k(t,u)})},this)}catch(s){console.log(s.message)}},loadImageFromURL:function(){var b= +{};return function(d,k){function m(){var s=f.getElementById(b[d]);s.width&&s.height?k(new fabric.Image(s)):setTimeout(m,50)}var n=this;if(b[d])m();else{var o=new Image;o.onload=function(){o.onload=null;n._resizeImageToFit(o);var s=new fabric.Image(o);k(s)};o.className="canvas-img-clone";o.src=d;if(this.shouldCacheImages)b[d]=Element.identify(o);f.body.appendChild(o)}}}(),loadSVGFromURL:function(b,d){function k(o){if(o=o.responseXML)(o=o.documentElement)&&fabric.parseSVGDocument(o,function(s,r){n.cache.set(b, +{objects:s.invoke("toObject"),options:r});d(s,r)})}function m(){console.log("ERROR!")}var n=this;b=b.replace(/^\n\s*/,"").replace(/\?.*$/,"").trim();this.cache.has(b,function(o){if(o)n.cache.get(b,function(s){s=n._enlivenCachedObject(s);d(s.objects,s.options)});else new Ajax.Request(b,{method:"get",onComplete:k,onFailure:m})})},_enlivenCachedObject:function(b){var d=b.objects;b=b.options;d=d.map(function(k){return a[k.type.capitalize()].fromObject(k)});return{objects:d,options:b}},remove:function(b){fabric.util.removeFromArray(this._aObjects, +b);this.renderAll();return b},fxRemove:function(b,d){var k=this;b.fxRemove({onChange:this.renderAll.bind(this),onComplete:function(){k.remove(b);typeof d==="function"&&d()}});return this},sendToBack:function(b){fabric.util.removeFromArray(this._aObjects,b);this._aObjects.unshift(b);return this.renderAll()},bringToFront:function(b){fabric.util.removeFromArray(this._aObjects,b);this._aObjects.push(b);return this.renderAll()},sendBackwards:function(b){var d=this._aObjects.indexOf(b),k=d;if(d!==0){for(d= +d-1;d>=0;--d)if(b.intersectsWithObject(this._aObjects[d])){k=d;break}fabric.util.removeFromArray(this._aObjects,b);this._aObjects.splice(k,0,b)}return this.renderAll()},bringForward:function(b){var d=this.getObjects(),k=d.indexOf(b),m=k;if(k!==d.length-1){k=k+1;for(var n=this._aObjects.length;k"};fabric.util.object.extend(fabric.Element,{EMPTY_JSON:'{"objects": [], "background": "white"}',toGrayscale:function(b){var d=b.getContext("2d");b=d.getImageData(0,0,b.width,b.height);var k= +b.data,m=b.width,n=b.height,o,s;for(i=0;i1?c.apply(this,f.call(arguments,1)):c.call(this)},initialize:function(a){this.setOptions(a);this._importProperties();this.originalState= +{};this.setCoords();this.saveState()},setOptions:function(a){this.options=e.util.object.extend(this._getOptions(),a)},_getOptions:function(){return e.util.object.extend(e.util.object.clone(this._getSuperOptions()),this.options)},_getSuperOptions:function(){var a=this.constructor;if(a)if(a=a.superclass)if((a=a.prototype)&&typeof a._getOptions=="function")return a._getOptions();return{}},_importProperties:function(){this.stateProperties.forEach(function(a){a==="angle"?this.setAngle(this.options[a]): +this[a]=this.options[a]},this)},transform:function(a){a.globalAlpha=this.opacity;a.translate(this.left,this.top);a.rotate(this.theta);a.scale(this.scaleX*(this.flipX?-1:1),this.scaleY*(this.flipY?-1:1))},toJSON:function(){return JSON.stringify(this.toObject())},toObject:function(){var a=e.util.toFixed;a={type:this.type,left:a(this.left,this.NUM_FRACTION_DIGITS),top:a(this.top,this.NUM_FRACTION_DIGITS),width:a(this.width,this.NUM_FRACTION_DIGITS),height:a(this.height,this.NUM_FRACTION_DIGITS),fill:this.fill, +overlayFill:this.overlayFill,stroke:this.stroke,strokeWidth:this.strokeWidth,scaleX:a(this.scaleX,this.NUM_FRACTION_DIGITS),scaleY:a(this.scaleY,this.NUM_FRACTION_DIGITS),angle:a(this.getAngle(),this.NUM_FRACTION_DIGITS),flipX:this.flipX,flipY:this.flipY,opacity:a(this.opacity,this.NUM_FRACTION_DIGITS)};this.includeDefaultValues||(a=this._removeDefaultValues(a));return a},toDatalessObject:function(){return this.toObject()},_removeDefaultValues:function(a){var c=e.Object.prototype.options;this.stateProperties.forEach(function(g){a[g]=== +c[g]&&delete a[g]});return a},isActive:function(){return!!this.active},setActive:function(a){this.active=!!a;return this},toString:function(){return"#"},set:function(a,c){if((a==="scaleX"||a==="scaleY")&&ca.x&&l.xa.y&&b.y=c&&b.d.y>=c)){if(b.o.x==b.d.x&&b.o.x>=a)h=b.o.x;else{h=(b.d.y-b.o.y)/(b.d.x-b.o.x);l=c-0*a;b=b.o.y-h*b.o.x;h=-(l-b)/(0-h)}if(h>=a)d+=1;if(d==2)break}}return d},_getImageLines:function(a){return{topline:{o:a.tl,d:a.tr},rightline:{o:a.tr,d:a.br},bottomline:{o:a.br,d:a.bl},leftline:{o:a.bl,d:a.tl}}},_setCornerCoords:function(){var a=this.oCoords, +c=this.theta,g=this.cornersize*Math.cos(c),h=this.cornersize*Math.sin(c);c=this.cornersize/2;var l=c-h;a.tl.x-=l;a.tl.y-=c;a.tl.corner={tl:{x:a.tl.x,y:a.tl.y},tr:{x:a.tl.x+g,y:a.tl.y+h},bl:{x:a.tl.x-h,y:a.tl.y+g}};a.tl.corner.br={x:a.tl.corner.tr.x-h,y:a.tl.corner.tr.y+g};a.tl.x+=l;a.tl.y+=c;a.tr.x+=c;a.tr.y-=c;a.tr.corner={tl:{x:a.tr.x-g,y:a.tr.y-h},tr:{x:a.tr.x,y:a.tr.y},br:{x:a.tr.x-h,y:a.tr.y+g}};a.tr.corner.bl={x:a.tr.corner.tl.x-h,y:a.tr.corner.tl.y+g};a.tr.x-=c;a.tr.y+=c;a.bl.x-=c;a.bl.y+= +c;a.bl.corner={tl:{x:a.bl.x+h,y:a.bl.y-g},bl:{x:a.bl.x,y:a.bl.y},br:{x:a.bl.x+g,y:a.bl.y+h}};a.bl.corner.tr={x:a.bl.corner.br.x+h,y:a.bl.corner.br.y-g};a.bl.x+=c;a.bl.y-=c;a.br.x+=c;a.br.y+=c;a.br.corner={tr:{x:a.br.x+h,y:a.br.y-g},bl:{x:a.br.x-g,y:a.br.y-h},br:{x:a.br.x,y:a.br.y}};a.br.corner.tl={x:a.br.corner.bl.x+h,y:a.br.corner.bl.y-g};a.br.x-=c;a.br.y-=c;a.ml.x-=c;a.ml.y-=c;a.ml.corner={tl:{x:a.ml.x,y:a.ml.y},tr:{x:a.ml.x+g,y:a.ml.y+h},bl:{x:a.ml.x-h,y:a.ml.y+g}};a.ml.corner.br={x:a.ml.corner.tr.x- +h,y:a.ml.corner.tr.y+g};a.ml.x+=c;a.ml.y+=c;a.mt.x-=c;a.mt.y-=c;a.mt.corner={tl:{x:a.mt.x,y:a.mt.y},tr:{x:a.mt.x+g,y:a.mt.y+h},bl:{x:a.mt.x-h,y:a.mt.y+g}};a.mt.corner.br={x:a.mt.corner.tr.x-h,y:a.mt.corner.tr.y+g};a.mt.x+=c;a.mt.y+=c;a.mr.x-=c;a.mr.y-=c;a.mr.corner={tl:{x:a.mr.x,y:a.mr.y},tr:{x:a.mr.x+g,y:a.mr.y+h},bl:{x:a.mr.x-h,y:a.mr.y+g}};a.mr.corner.br={x:a.mr.corner.tr.x-h,y:a.mr.corner.tr.y+g};a.mr.x+=c;a.mr.y+=c;a.mb.x-=c;a.mb.y-=c;a.mb.corner={tl:{x:a.mb.x,y:a.mb.y},tr:{x:a.mb.x+g,y:a.mb.y+ +h},bl:{x:a.mb.x-h,y:a.mb.y+g}};a.mb.corner.br={x:a.mb.corner.tr.x-h,y:a.mb.corner.tr.y+g};a.mb.x+=c;a.mb.y+=c;a=a.mb.corner;a.tl.x-=c;a.tl.y-=c;a.tr.x-=c;a.tr.y-=c;a.br.x-=c;a.br.y-=c;a.bl.x-=c;a.bl.y-=c},toGrayscale:function(){var a=this.get("fill");a&&this.set("overlayFill",(new e.Color(a)).toGrayscale().toRgb());return this},complexity:function(){return 0},getCenter:function(){return{x:this.get("left")+this.width/2,y:this.get("top")+this.height/2}},straighten:function(){this.setAngle(this._getAngleValueForStraighten()); +return this},fxStraighten:function(a){a=a||{};var c=function(){},g=a.onComplete||c,h=a.onChange||c,l=this;e.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(b){l.setAngle(b);h()},onComplete:function(){l.setCoords();g()},onStart:function(){l.setActive(false)}});return this},fxRemove:function(a){a||(a={});var c=function(){},g=a.onComplete||c,h=a.onChange||c,l=this;e.util.animate({startValue:this.get("opacity"),endValue:0, +duration:this.FX_DURATION,onChange:function(b){l.set("opacity",b);h()},onComplete:g,onStart:function(){l.setActive(false)}});return this},_getAngleValueForStraighten:function(){var a=this.get("angle");if(a>-225&&a<=-135)return-180;else if(a>-135&&a<=-45)return-90;else if(a>-45&&a<=45)return 0;else if(a>45&&a<=135)return 90;else if(a>135&&a<=225)return 180;else if(a>225&&a<=315)return 270;else if(a>315)return 360;return 0}});e.Object.prototype.rotate=e.Object.prototype.setAngle}})(); +(function(){var e=this.fabric||(this.fabric={});if(!e.Line){e.Line=e.util.createClass(e.Object,{type:"line",initialize:function(f,a){f||(f=[0,0,0,0]);this.callSuper("initialize",a);this.set("x1",f[0]);this.set("y1",f[1]);this.set("x2",f[2]);this.set("y2",f[3]);this.set("width",this.x2-this.x1);this.set("height",this.y2-this.y1);this.set("left",this.x1+this.width/2);this.set("top",this.y1+this.height/2)},_render:function(f){f.beginPath();f.moveTo(-this.width/2,-this.height/2);f.lineTo(this.width/2, +this.height/2);var a=f.strokeStyle;f.strokeStyle=f.fillStyle;f.stroke();f.strokeStyle=a},complexity:function(){return 1},toObject:function(){return e.util.object.extend(this.callSuper("toObject"),{x1:this.get("x1"),y1:this.get("y1"),x2:this.get("x2"),y2:this.get("y2")})}});e.Element.ATTRIBUTE_NAMES="x1 y1 x2 y2 stroke stroke-width transform".split(" ");e.Line.fromElement=function(f,a){var c=e.parseAttributes(f,e.Element.ATTRIBUTE_NAMES);return new e.Line([c.x1||0,c.y1||0,c.x2||0,c.y2||0],e.util.object.extend(c, +a))};e.Line.fromObject=function(f){return new e.Line([f.x1,f.y1,f.x2,f.y2],f)}}})(); +(function(){var e=this.fabric||(this.fabric={}),f=Math.PI*2;if(e.Circle)console.warn("fabric.Circle is already defined.");else{e.Circle=e.util.createClass(e.Object,{type:"circle",initialize:function(a){a=a||{};this.set("radius",a.radius||0);this.callSuper("initialize",a);a=this.get("radius")*2*this.get("scaleX");this.set("width",a).set("height",a)},toObject:function(){return e.util.object.extend(this.callSuper("toObject"),{radius:this.get("radius")})},_render:function(a){a.beginPath();a.arc(0,0,this.radius, +0,f,false);this.fill&&a.fill();this.stroke&&a.stroke()},complexity:function(){return 1}});e.Circle.ATTRIBUTE_NAMES="cx cy r fill fill-opacity stroke stroke-width transform".split(" ");e.Circle.fromElement=function(a,c){var g=e.parseAttributes(a,e.Circle.ATTRIBUTE_NAMES);if(!("radius"in g&&g.radius>0))throw Error("value of `r` attribute is required and can not be negative");return new e.Circle(e.util.object.extend(g,c))};e.Circle.fromObject=function(a){return new e.Circle(a)}}})(); +(function(){var e=this.fabric||(this.fabric={});if(!e.Triangle){e.Triangle=e.util.createClass(e.Object,{type:"triangle",initialize:function(f){f=f||{};this.callSuper("initialize",f);this.set("width",f.width||100).set("height",f.height||100)},_render:function(f){f.beginPath();f.moveTo(-this.width/2,this.height/2);f.lineTo(0,-this.height/2);f.lineTo(this.width/2,this.height/2);this.fill&&f.fill();this.stroke&&f.stroke()},complexity:function(){return 1}});e.Triangle.fromObject=function(f){return new e.Triangle(f)}}})(); +(function(){var e=this.fabric||(this.fabric={});if(e.Ellipse)console.warn("fabric.Ellipse is already defined.");else{e.Ellipse=e.util.createClass(e.Object,{type:"ellipse",initialize:function(f){f=f||{};this.callSuper("initialize",f);this.set("rx",f.rx||0);this.set("ry",f.ry||0);this.set("width",this.get("rx")*2);this.set("height",this.get("ry")*2)},toObject:function(){return e.util.object.extend(this.callSuper("toObject"),{rx:this.get("rx"),ry:this.get("ry")})},render:function(f,a){if(!(this.rx=== +0||this.ry===0))return this.callSuper("render",f,a)},_render:function(f){f.beginPath();f.save();f.transform(1,0,0,this.ry/this.rx,0,0);f.arc(0,0,this.rx,0,Math.PI*2,false);f.restore();this.stroke&&f.stroke();this.fill&&f.fill()},complexity:function(){return 1}});e.Ellipse.ATTRIBUTE_NAMES="cx cy rx ry fill fill-opacity stroke stroke-width transform".split(" ");e.Ellipse.fromElement=function(f,a){var c=e.parseAttributes(f,e.Ellipse.ATTRIBUTE_NAMES);return new e.Ellipse(e.util.object.extend(c,a))};e.Ellipse.fromObject= +function(f){return new e.Ellipse(f)}}})(); +(function(){var e=this.fabric||(this.fabric={});if(!e.Rect){e.Rect=e.util.createClass(e.Object,{type:"rect",options:{rx:0,ry:0},initialize:function(f){this.callSuper("initialize",f);this._initRxRy()},_initRxRy:function(){if(this.options.rx&&!this.options.ry)this.options.ry=this.options.rx;else if(this.options.ry&&!this.options.rx)this.options.rx=this.options.ry},_render:function(f){var a=this.options.rx||0,c=this.options.ry||0,g=-this.width/2,h=-this.height/2,l=this.width,b=this.height;f.beginPath(); +f.moveTo(g+a,h);f.lineTo(g+l-a,h);f.bezierCurveTo(g+l,h,g+l,h+c,g+l,h+c);f.lineTo(g+l,h+b-c);f.bezierCurveTo(g+l,h+b,g+l-a,h+b,g+l-a,h+b);f.lineTo(g+a,h+b);f.bezierCurveTo(g,h+b,g,h+b-c,g,h+b-c);f.lineTo(g,h+c);f.bezierCurveTo(g,h,g+a,h,g+a,h);f.closePath();this.fill&&f.fill();this.stroke&&f.stroke()},_normalizeLeftTopProperties:function(f){f.left&&this.set("left",f.left+this.getWidth()/2);f.top&&this.set("top",f.top+this.getHeight()/2);return this},complexity:function(){return 1}});e.Rect.ATTRIBUTE_NAMES= +"x y width height rx ry fill fill-opacity stroke stroke-width transform".split(" ");e.Rect.fromElement=function(f,a){if(!f)return null;var c=e.parseAttributes(f,e.Rect.ATTRIBUTE_NAMES);c=c;c.left=c.left||0;c.top=c.top||0;c=c;var g=new e.Rect(e.util.object.extend(a||{},c));g._normalizeLeftTopProperties(c);return g};e.Rect.fromObject=function(f){return new e.Rect(f)}}})(); +(function(){var e=this.fabric||(this.fabric={});if(e.Polyline)console.warn("fabric.Polyline is already defined");else{e.Polyline=e.util.createClass(e.Object,{type:"polyline",initialize:function(a,c){c=c||{};this.set("points",a);this.callSuper("initialize",c);this._calcDimensions()},_calcDimensions:function(){return e.Polygon.prototype._calcDimensions.call(this)},_toOrigin:function(){return e.Polygon.prototype._toOrigin.call(this)},toObject:function(){return e.Polygon.prototype.toObject.call(this)}, +_render:function(a){var c;a.beginPath();for(var g=0,h=this.points.length;g"},toObject:function(){var a=e.util.object.extend(this.callSuper("toObject"),{path:this.path});if(this.sourcePath)a.sourcePath=this.sourcePath;if(this.transformMatrix)a.transformMatrix=this.transformMatrix;return a},toDatalessObject:function(){var a=this.toObject();if(this.sourcePath)a.path=this.sourcePath;delete a.sourcePath;return a},complexity:function(){return this.path.length},set:function(a,c){this.stub&&this.stub.set(a, +c);return this.callSuper("set",a,c)},_parsePath:function(){for(var a=[],c,g,h=0,l=this.path.length;h"}, +isSameColor:function(){var f=this.getObjects()[0].get("fill");return this.getObjects().every(function(a){return a.get("fill")===f})},complexity:function(){return this.paths.reduce(function(f,a){return f+(a&&a.complexity?a.complexity():0)},0)},toGrayscale:function(){for(var f=this.paths.length;f--;)this.paths[f].toGrayscale();return this},getObjects:function(){return this.paths}});e.PathGroup.fromObject=function(f){for(var a=f.paths,c=0,g=a.length;c"},getObjects:function(){return this.objects},add:function(f){this._restoreObjectsState();this.objects.push(f);f.setActive(true);this._calcBounds();this._updateObjectsCoords();return this},remove:function(f){this._restoreObjectsState();e.util.removeFromArray(this.objects,f);f.setActive(false);this._calcBounds(); +this._updateObjectsCoords();return this},size:function(){return this.getObjects().length},set:function(f,a){if(typeof a=="function")this.set(f,a(this[f]));else if(f==="fill"||f==="opacity"){var c=this.objects.length;for(this[f]=a;c--;)this.objects[c].set(f,a)}else this[f]=a;return this},contains:function(f){return this.objects.indexOf(f)>-1},toObject:function(){return e.util.object.extend(this.callSuper("toObject"),{objects:e.util.array.invoke(this.objects,"clone")})},render:function(f){f.save(); +this.transform(f);for(var a=Math.max(this.scaleX,this.scaleY),c=0,g=this.objects.length;cf.x&&h-cf.y},toGrayscale:function(){for(var f=this.objects.length;f--;)this.objects[f].toGrayscale()}});e.Group.fromObject= +function(f){return new e.Group(f.objects,f)}}})(); +(function(){var e=this.fabric||(this.fabric={});if(e.Text)console.warn("fabric.Text is already defined");else if(e.Object){e.Text=e.util.createClass(e.Object,{options:{top:10,left:10,fontsize:20,fontweight:100,fontfamily:"Modernist_One_400",path:null},type:"text",initialize:function(f,a){this.originalState={};this.initStateProperties();this.text=f;this.setOptions(a);e.util.object.extend(this,this.options);this.theta=this.angle*(Math.PI/180);this.width=this.getWidth();this.setCoords()},initStateProperties:function(){var f; +if((f=this.constructor)&&(f=f.superclass)&&(f=f.prototype)&&(f=f.stateProperties)&&f.clone){this.stateProperties=f.clone();this.stateProperties.push("fontfamily","fontweight","path")}},toString:function(){return"#"},_render:function(f){var a=Cufon.textOptions||(Cufon.textOptions={});a.left=this.left;a.top=this.top;a.context=f;a.color=this.fill;var c=this._initDummyElement();this.transform(f);Cufon.replaceElement(c, +{separate:"none",fontFamily:this.fontfamily});this.width=a.width;this.height=a.height},_initDummyElement:function(){var f=document.createElement("div");f.innerHTML=this.text;f.style.fontSize="40px";f.style.fontWeight="400";f.style.fontStyle="normal";f.style.letterSpacing="normal";f.style.color="#000000";f.style.fontWeight="600";f.style.fontFamily="Verdana";return f},render:function(f){f.save();this._render(f);if(this.active){this.drawBorders(f);this.drawCorners(f)}f.restore()},toObject:function(){return e.util.object.extend(this.callSuper("toObject"), +{text:this.text,fontsize:this.fontsize,fontweight:this.fontweight,fontfamily:this.fontfamily,path:this.path})},setColor:function(f){this.set("fill",f);return this},setFontsize:function(f){this.set("fontsize",f);this.setCoords();return this},getText:function(){return this.text},setText:function(f){this.set("text",f);this.setCoords();return this},set:function(f,a){this[f]=a;if(f==="fontfamily")this.path=this.path.replace(/(.*?)([^\/]*)(\.font\.js)/,"$1"+a+"$3");return this}});e.Text.fromObject=function(f){return new e.Text(f.text, +e.util.object.clone(f))};e.Text.fromElement=function(){}}else console.warn("fabric.Text requires fabric.Object")})(); +(function(){if(!this.fabric)this.fabric={};if(this.fabric.Image)console.warn("fabric.Image is already defined.");else if(fabric.Object){fabric.Image=fabric.util.createClass(fabric.Object,{maxwidth:null,maxheight:null,active:false,bordervisibility:false,cornervisibility:false,type:"image",__isGrayscaled:false,initialize:function(e,f){this.callSuper("initialize",f);this._initElement(e);this._initConfig(f||{})},getElement:function(){return this._element},setElement:function(e){this._element=e;return this}, +getNormalizedSize:function(e,f,a){if(a&&f&&e.width>e.height&&e.width/e.heighte.width||e.height>a)){normalizedWidth=Math.floor(e.width*a/e.height);normalizedHeight=a}else if(f&&f'},clone:function(e){this.constructor.fromObject(this.toObject(),e)},toGrayscale:function(e){if(!this.__isGrayscaled){var f=this.getElement(),a=document.createElement("canvas"),c=document.createElement("img"),g=this;a.width=f.width;a.height=f.height;a.getContext("2d").drawImage(f,0,0);fabric.Element.toGrayscale(a);c.onload=function(){g.setElement(c);e&&e();c.onload=a=f=imageData=null};c.width=f.width;c.height=f.height;c.src=a.toDataURL("image/png"); +this.__isGrayscaled=true;return this}},_render:function(e){var f=this.getOriginalSize();e.drawImage(this.getElement(),-f.width/2,-f.height/2,f.width,f.height)},_adjustWidthHeightToBorders:function(e){if(e){this.currentBorder=this.borderwidth;this.width+=2*this.currentBorder;this.height+=2*this.currentBorder}else this.currentBorder=0},_resetWidthHeight:function(){var e=this.getElement();this.set("width",e.width);this.set("height",e.height)},_initElement:function(e){this.setElement(fabric.util.getById(e)); +fabric.util.addClass(this.getElement(),fabric.Image.CSS_CANVAS)},_initConfig:function(e){this.setOptions(e);this._setBorder();this._setWidthHeight(e)},_setBorder:function(){this.currentBorder=this.bordervisibility?this.borderwidth:0},_setWidthHeight:function(){var e=2*this.currentBorder;this.width=(this.getElement().width||0)+e;this.height=(this.getElement().height||0)+e}});fabric.Image.CSS_CANVAS="canvas-img";fabric.Image.fromObject=function(e,f){var a=document.createElement("img"),c=e.src;if(e.width)a.width= +e.width;if(e.height)a.height=e.height;a.onload=function(){f&&f(new fabric.Image(a,e));a=a.onload=null};a.src=c};fabric.Image.fromURL=function(e,f,a){var c=document.createElement("img");c.onload=function(){f&&f(new fabric.Image(c,a));c=c.onload=null};c.src=e}}else console.warn("fabric.Object is required for fabric.Image initialization")})(); diff --git a/dist/all.min-via-goog-cc.js.gz b/dist/all.min-via-goog-cc.js.gz new file mode 100644 index 00000000..85b87ec4 Binary files /dev/null and b/dist/all.min-via-goog-cc.js.gz differ diff --git a/dist/all.min.js.gz b/dist/all.min.js.gz new file mode 100644 index 00000000..fc28b80b Binary files /dev/null and b/dist/all.min.js.gz differ diff --git a/test/benchmark/benchmark.js b/test/benchmark/benchmark.js index 338deb01..0b2ab2cd 100644 --- a/test/benchmark/benchmark.js +++ b/test/benchmark/benchmark.js @@ -35,7 +35,6 @@ radius: getRandomInt(10, 50), fill: '#' + getRandomColor(), opacity: getRandomNum(0.5, 1), - angle: getRandomInt(0, 180), top: getRandomInt(0 + offset, c._oConfig.height - offset), left: getRandomInt(0 + offset, c._oConfig.width - offset) }));