From e70830f7d64a2dda2b08e6768e7869bfba2732ee Mon Sep 17 00:00:00 2001 From: kangax Date: Mon, 11 Oct 2010 14:45:06 -0400 Subject: [PATCH] Introduce `fabric.log` and `fabric.warn` methods, as simple wrappers around `console.log` and `console.warn` (instead of declaring those methods right on `console`). This makes it easier to mock them when testing, and is generally safer due to less tinkering with host objects. --- dist/all.js | 57 +++++++++++++++++++------------- dist/all.min-via-uglify.js | 1 - dist/all.min-via-uglify.js.gz | Bin 22126 -> 0 bytes dist/all.min.js | 52 ++++++++++++++--------------- fabric.js | 21 +++++++++--- src/circle.class.js | 2 +- src/color.class.js | 2 +- src/element.class.js | 6 ++-- src/ellipse.class.js | 2 +- src/image.class.js | 4 +-- src/intersection.class.js | 2 +- src/parser.js | 2 +- src/path.class.js | 4 +-- src/path_group.class.js | 2 +- src/point.class.js | 2 +- src/polygon.class.js | 2 +- src/polyline.class.js | 2 +- src/text.class.js | 4 +-- test/unit/path_group.js | 7 ---- test/unit/text.js | 60 +++++++++++++++------------------- 20 files changed, 121 insertions(+), 113 deletions(-) delete mode 100644 dist/all.min-via-uglify.js delete mode 100644 dist/all.min-via-uglify.js.gz diff --git a/dist/all.js b/dist/all.js index 1a103e89..8660150a 100644 --- a/dist/all.js +++ b/dist/all.js @@ -1,12 +1,23 @@ /*! Fabric.js Copyright 2010, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */ -var console = console || { - log: function() { }, - warn: function() { } -}; - var fabric = fabric || { version: 0.1 }; +fabric.log = function() { }; +fabric.warn = function() { }; + +if (typeof console !== 'undefined') { + if (typeof console.log !== 'undefined' && console.log.apply) { + fabric.log = function() { + return console.log.apply(console, arguments); + }; + } + if (typeof console.warn !== 'undefined' && console.warn.apply) { + fabric.warn = function() { + return console.warn.apply(console, arguments); + }; + } +} + /* http://www.JSON.org/json2.js 2010-03-20 @@ -1497,7 +1508,7 @@ fabric.util.animate = animate; return klass.fromElement(el, options); } catch(e) { - console.log(e.message || e); + fabric.log(e.message || e); } } }); @@ -1598,7 +1609,7 @@ fabric.util.animate = animate; var fabric = this.fabric || (this.fabric = { }); if (fabric.Point) { - console.warn('fabric.Point is already defined'); + fabric.warn('fabric.Point is already defined'); return; } @@ -1724,7 +1735,7 @@ fabric.util.animate = animate; fabric = global.fabric || (global.fabric = { }); if (fabric.Intersection) { - console.warn('fabric.Intersection is already defined'); + fabric.warn('fabric.Intersection is already defined'); return; } @@ -1836,7 +1847,7 @@ fabric.util.animate = animate; var fabric = this.fabric || (this.fabric = { }); if (fabric.Color) { - console.warn('fabric.Color is already defined.'); + fabric.warn('fabric.Color is already defined.'); return; } @@ -2087,7 +2098,7 @@ fabric.util.animate = animate; (function () { if (fabric.Element) { - console.warn('fabric.Element is already defined.'); + fabric.warn('fabric.Element is already defined.'); return; } @@ -3719,7 +3730,7 @@ fabric.util.animate = animate; }, this); } catch(e) { - console.log(e.message); + fabric.log(e.message); } }, @@ -3811,7 +3822,7 @@ fabric.util.animate = animate; } function onFailure() { - console.log('ERROR!'); + fabric.log('ERROR!'); } }, @@ -5548,7 +5559,7 @@ fabric.util.animate = animate; extend = fabric.util.object.extend; if (fabric.Circle) { - console.warn('fabric.Circle is already defined.'); + fabric.warn('fabric.Circle is already defined.'); return; } @@ -5738,7 +5749,7 @@ fabric.util.animate = animate; extend = fabric.util.object.extend; if (fabric.Ellipse) { - console.warn('fabric.Ellipse is already defined.'); + fabric.warn('fabric.Ellipse is already defined.'); return; } @@ -5991,7 +6002,7 @@ fabric.util.animate = animate; var fabric = this.fabric || (this.fabric = { }); if (fabric.Polyline) { - console.warn('fabric.Polyline is already defined'); + fabric.warn('fabric.Polyline is already defined'); return; } @@ -6105,7 +6116,7 @@ fabric.util.animate = animate; max = fabric.util.array.max; if (fabric.Polygon) { - console.warn('fabric.Polygon is already defined'); + fabric.warn('fabric.Polygon is already defined'); return; } @@ -6236,11 +6247,11 @@ fabric.util.animate = animate; extend = fabric.util.object.extend; if (fabric.Path) { - console.warn('fabric.Path is already defined'); + fabric.warn('fabric.Path is already defined'); return; } if (!fabric.Object) { - console.warn('fabric.Path requires fabric.Object'); + fabric.warn('fabric.Path requires fabric.Object'); return; } @@ -6695,7 +6706,7 @@ fabric.util.animate = animate; capitalize = fabric.util.string.capitalize; if (fabric.PathGroup) { - console.warn('fabric.PathGroup is already defined'); + fabric.warn('fabric.PathGroup is already defined'); return; } @@ -7332,11 +7343,11 @@ fabric.util.animate = animate; clone = fabric.util.object.clone; if (fabric.Text) { - console.warn('fabric.Text is already defined'); + fabric.warn('fabric.Text is already defined'); return; } if (!fabric.Object) { - console.warn('fabric.Text requires fabric.Object'); + fabric.warn('fabric.Text requires fabric.Object'); return; } @@ -7522,12 +7533,12 @@ fabric.util.animate = animate; } if (global.fabric.Image) { - console.warn('fabric.Image is already defined.'); + fabric.warn('fabric.Image is already defined.'); return; }; if (!fabric.Object) { - console.warn('fabric.Object is required for fabric.Image initialization'); + fabric.warn('fabric.Object is required for fabric.Image initialization'); return; } diff --git a/dist/all.min-via-uglify.js b/dist/all.min-via-uglify.js deleted file mode 100644 index 2df71489..00000000 --- a/dist/all.min-via-uglify.js +++ /dev/null @@ -1 +0,0 @@ -if(typeof console=="undefined")var console={log:function(){},warn:function(){}};this.JSON||(this.JSON={});(function(){function f(a){return a<10?"0"+a:a}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\"":"\\\"","\\":"\\\\"},rep;function quote(a){escapable.lastIndex=0;return escapable.test(a)?"\""+a.replace(escapable,function(a){var b=meta[a];return typeof b==="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+"\"":"\""+a+"\""}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i==="object"&&typeof i.toJSON==="function"&&(i=i.toJSON(a));typeof rep==="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent;h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c>>0;b=Number(b)||0;b=Math[b<0?"ceil":"floor"](b);b<0&&(b+=c);for(;b>>0;c>>0;d>>0;c>>0;c>>0;e>>0,c=0,d;if(arguments.length>1)d=arguments[1];else do{if(c in this){d=this[c++];break}if(++c>=b)throw new TypeError()}while(true);for(;c=d&&(d=a[c][b]);else while(c--)a[c]>=d&&(d=a[c]);return d}function f(a,b){var c=a.length-1,d=b?a[c][b]:a[c];if(b)while(c--)a[c][b]-1?i(a,b.match(/opacity:\s*(\d?\.?\d*)/)[1]):a}for(var e in b)if(e==="opacity")i(a,b[e]);else{var f=e==="float"||e==="cssFloat"?typeof c.styleFloat==="undefined"?"cssFloat":"styleFloat":e;c[f]=b[e]}return a}var c=document.createElement("div"),d=typeof c.style.opacity==="string",e=typeof c.style.filter==="string",f=document.defaultView,g=f&&typeof f.getComputedStyle!=="undefined",h=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,i=function(a){return a};d?i=function(a,b){a.style.opacity=b;return a}:e&&(i=function(a,b){var c=a.style;a.currentStyle&&!a.currentStyle.hasLayout&&(c.zoom=1);if(h.test(c.filter)){b=b>=0.9999?"":"alpha(opacity="+b*100+")";c.filter=c.filter.replace(h,b)}else c.filter+=" alpha(opacity="+b*100+")";return a});b.util.setStyle=a})();function k(a){return typeof a==="string"?document.getElementById(a):a}function l(a){var b=[],c=a.length;while(c--)b[c]=a[c];return b}function m(a,b){var c=document.createElement(a);for(var d in b)d==="class"?c.className=b[d]:d==="for"?c.htmlFor=b[d]:c.setAttribute(d,b[d]);return c}function n(a,b){(" "+a.className+" ").indexOf(" "+b+" ")===-1&&(a.className+=(a.className?" ":"")+b)}function o(a,b,c){typeof b==="string"&&(b=m(b,c));a.parentNode&&a.parentNode.replaceChild(b,a);b.appendChild(a);return b}function p(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return{left:c,top:b}}(function(){var a=document.documentElement.style,c="userSelect"in a?"userSelect":"MozUserSelect"in a?"MozUserSelect":"WebkitUserSelect"in a?"WebkitUserSelect":"KhtmlUserSelect"in a?"KhtmlUserSelect":"";function d(a){typeof a.onselectstart!=="undefined"&&(a.onselectstart=b.util.falseFunction);c?a.style[c]="none":typeof a.unselectable=="string"&&(a.unselectable="on");return a}b.util.makeElementUnselectable=d})();(function(){function a(a,b){var c=document.getElementsByTagName("head")[0],d=document.createElement("script"),e=true;d.type="text/javascript";d.setAttribute("runat","server");d.onload=d.onreadystatechange=function(a){if(e){if(typeof this.readyState=="string"&&this.readyState!=="loaded"&&this.readyState!=="complete")return;e=false;b(a||window.event);d=d.onload=d.onreadystatechange=null}};d.src=a;c.appendChild(d)}function c(a,b){d.load(a);b()}b.util.getScript=a;var d=this.Jaxer;d&&d.load&&(b.util.getScript=c)})();function q(a){a||(a={});var b=+(new Date()),c=a.duration||500,d=b+c,e,f,g=a.onChange||function(){},h=a.easing||function(a){return-Math.cos(a*Math.PI)/2+0.5},i="startValue"in a?a.startValue:0,j="endValue"in a?a.endValue:100,k=i>j;a.onStart&&a.onStart();var l=setInterval(function(){e=+(new Date());f=e>d?1:(e-b)/c;g(k?i-(i-j)*h(f):i+(j-i)*h(f));if(e>d){clearInterval(l);a.onComplete&&a.onComplete()}},10)}b.util.getById=k;b.util.toArray=l;b.util.makeElement=m;b.util.addClass=n;b.util.wrapElement=o;b.util.getElementOffset=p;b.util.animate=q;(function(){function a(a,b){return a+(/\?/.test(a)?"&":"?")+b}var c=(function(){var a=[function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")},function(){return new XMLHttpRequest()}];for(var b=a.length;b--;)try{var c=a[b]();if(c)return a[b]}catch(a){}})();function d(){}function e(b,e){e||(e={});var f=e.method?e.method.toUpperCase():"GET",g=e.onComplete||function(){},h=c(),i;h.onreadystatechange=function(){if(h.readyState===4){g(h);h.onreadystatechange=d}};if(f==="GET"){i=null;typeof e.parameters=="string"&&(b=a(b,e.parameters))}h.open(f,b,true);(f==="POST"||f==="PUT")&&h.setRequestHeader("Content-Type","application/x-www-form-urlencoded");h.send(i);return h}b.util.request=e})()})(this);(function(){var a=this.fabric||(this.fabric={}),b=a.util.object.extend,c=a.util.string.capitalize,d=a.util.object.clone,e={cx:"left",x:"left",cy:"top",y:"top",r:"radius","fill-opacity":"opacity","fill-rule":"fillRule","stroke-width":"strokeWidth",transform:"transformMatrix"};function f(c,d){if(!c)return;var f,g,h={};c.parentNode&&/^g$/i.test(c.parentNode.nodeName)&&(h=a.parseAttributes(c.parentNode,d));var i=d.reduce(function(b,d){f=c.getAttribute(d);g=parseFloat(f);if(f){(d==="fill"||d==="stroke")&&f==="none"&&(f="");d==="fill-rule"&&(f=f==="evenodd"?"destination-over":f);d==="transform"&&(f=a.parseTransformAttribute(f));d in e&&(d=e[d]);b[d]=isNaN(g)?f:g}return b},{});i=b(a.parseStyleAttribute(c),i);return b(h,i)}a.parseTransformAttribute=(function(){function a(a,b){var c=b[0];a[0]=Math.cos(c);a[1]=Math.sin(c);a[2]=-Math.sin(c);a[3]=Math.cos(c)}function b(a,b){var c=b[0],d=b.length===2?b[1]:b[0];a[0]=c;a[3]=d}function c(a,b){a[2]=b[0]}function d(a,b){a[1]=b[0]}function e(a,b){a[4]=b[0];b.length===2&&(a[5]=b[1])}var f=[1,0,0,1,0,0],g="(?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)",h="(?:\\s+,?\\s*|,\\s*)",i="(?:(skewX)\\s*\\(\\s*("+g+")\\s*\\))",j="(?:(skewY)\\s*\\(\\s*("+g+")\\s*\\))",k="(?:(rotate)\\s*\\(\\s*("+g+")(?:"+h+"("+g+")"+h+"("+g+"))?\\s*\\))",l="(?:(scale)\\s*\\(\\s*("+g+")(?:"+h+"("+g+"))?\\s*\\))",m="(?:(translate)\\s*\\(\\s*("+g+")(?:"+h+"("+g+"))?\\s*\\))",n="(?:(matrix)\\s*\\(\\s*("+g+")"+h+"("+g+")"+h+"("+g+")"+h+"("+g+")"+h+"("+g+")"+h+"("+g+")"+"\\s*\\))",o="(?:"+n+"|"+m+"|"+l+"|"+k+"|"+i+"|"+j+")",p="(?:"+o+"(?:"+h+o+")*"+")",q="^\\s*(?:"+p+"?)\\s*$",r=new RegExp(q),s=new RegExp(o);return function(g){var h=f.concat();if(!g||g&&!r.test(g))return h;g.replace(s,function(f){var g=(new RegExp(o)).exec(f).filter(function(a){return a!==""&&a!=null}),i=g[1],j=g.slice(2).map(parseFloat);switch(i){case"translate":e(h,j);break;case"rotate":a(h,j);break;case"scale":b(h,j);break;case"skewX":c(h,j);break;case"skewY":d(h,j);break;case"matrix":h=j;break}});return h}})();function g(a){if(!a)return null;a=a.trim().split(/\s+/);var b=a.reduce(function(a,b){b=b.split(",");a.push({x:parseFloat(b[0]),y:parseFloat(b[1])});return a},[]);if(b.length%2!==0)return null;return b}function h(a){var b={},c=a.getAttribute("style");if(c)if(typeof c=="string"){c=c.split(";");c.pop();b=c.reduce(function(a,b){var c=b.split(":"),d=c[0].trim(),e=c[1].trim();a[d]=e;return a},{})}else for(var d in c)typeof c[d]!=="undefined"&&(b[d]=c[d]);return b}function i(b,d){var e=b.map(function(b){var e=a[c(b.tagName)];if(e&&e.fromElement)try{return e.fromElement(b,d)}catch(a){console.log(a.message||a)}});e=e.filter(function(a){return a!=null});return e}a.parseSVGDocument=(function(){var b=/^(path|circle|polygon|polyline|ellipse|rect|line)$/,c="(?:[-+]?\\d+(?:\\.\\d+)?(?:e[-+]?\\d+)?)",e=new RegExp("^\\s*("+c+"+)\\s*,?"+"\\s*("+c+"+)\\s*,?"+"\\s*("+c+"+)\\s*,?"+"\\s*("+c+"+)\\s*"+"$");function f(a,b){while(a&&(a=a.parentNode)){if(a.nodeName===b)return true}return false}return function(c,g){if(!c)return;var h=a.util.toArray(c.getElementsByTagName("*")),i=h.filter(function(a){return b.test(a.tagName)&&!f(a,"pattern")});if(!i||i&&!i.length)return;var j=c.getAttribute("viewBox"),k=c.getAttribute("width"),l=c.getAttribute("height"),m=null,n=null,o,p;if(j&&(j=j.match(e))){o=parseInt(j[1],10);p=parseInt(j[2],10);m=parseInt(j[3],10);n=parseInt(j[4],10)}m=k?parseFloat(k):m;n=l?parseFloat(l):n;var q={width:m,height:n},i=a.parseElements(i,d(q));if(!i||i&&!i.length)return;g&&g(i,q)}})();b(a,{parseAttributes:f,parseElements:i,parseStyleAttribute:h,parsePointsAttribute:g})})();(function(){var a=this.fabric||(this.fabric={});if(a.Point){console.warn("fabric.Point is already defined");return}function b(a,b){arguments.length>0&&this.init(a,b)}b.prototype={constructor:b,init:function(a,b){this.x=a;this.y=b},add:function(a){return new b(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 b(this.x+a,this.y+a)},scalarAddEquals:function(a){this.x+=a;this.y+=a;return this},subtract:function(a){return new b(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 b(this.x-a,this.y-a)},scalarSubtractEquals:function(a){this.x-=a;this.y-=a;return this},multiply:function(a){return new b(this.x*a,this.y*a)},multiplyEquals:function(a){this.x*=a;this.y*=a;return this},divide:function(a){return new b(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.xa.x&&this.y>a.y},gte:function(a){return this.x>=a.x&&this.y>=a.y},lerp:function(a,c){return new b(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c)},distanceFrom:function(a){var b=this.x-a.x,c=this.y-a.y;return Math.sqrt(b*b+c*c)},min:function(a){return new b(Math.min(this.x,a.x),Math.min(this.y,a.y))},max:function(a){return new b(Math.max(this.x,a.x),Math.max(this.y,a.y))},toString:function(){return this.x+","+this.y},setXY:function(a,b){this.x=a;this.y=b},setFromPoint:function(a){this.x=a.x;this.y=a.y},swap:function(a){var b=this.x,c=this.y;this.x=a.x;this.y=a.y;a.x=b;a.y=c}};a.Point=b})();(function(){var a=this,b=a.fabric||(a.fabric={});if(b.Intersection){console.warn("fabric.Intersection is already defined");return}function c(a){arguments.length>0&&this.init(a)}c.prototype.init=function(a){this.status=a;this.points=[]};c.prototype.appendPoint=function(a){this.points.push(a)};c.prototype.appendPoints=function(a){this.points=this.points.concat(a)};c.intersectLineLine=function(a,d,e,f){var g,h=(f.x-e.x)*(a.y-e.y)-(f.y-e.y)*(a.x-e.x),i=(d.x-a.x)*(a.y-e.y)-(d.y-a.y)*(a.x-e.x),j=(f.y-e.y)*(d.x-a.x)-(f.x-e.x)*(d.y-a.y);if(j!=0){var k=h/j,l=i/j;if(0<=k&&k<=1&&0<=l&&l<=1){g=new c("Intersection");g.points.push(new b.Point(a.x+k*(d.x-a.x),a.y+k*(d.y-a.y)))}else g=new c("No Intersection")}else h==0||i==0?g=new c("Coincident"):g=new c("Parallel");return g};c.intersectLinePolygon=function(a,b,d){var e=new c("No Intersection"),f=d.length;for(var g=0;g0&&(e.status="Intersection");return e};c.intersectPolygonPolygon=function(a,b){var d=new c("No Intersection"),e=a.length;for(var f=0;f0&&(d.status="Intersection");return d};c.intersectPolygonRectangle=function(a,d,e){var f=d.min(e),g=d.max(e),h=new b.Point(g.x,f.y),i=new b.Point(f.x,g.y),j=c.intersectLinePolygon(f,h,a),k=c.intersectLinePolygon(h,g,a),l=c.intersectLinePolygon(g,i,a),m=c.intersectLinePolygon(i,f,a),n=new c("No Intersection");n.appendPoints(j.points);n.appendPoints(k.points);n.appendPoints(l.points);n.appendPoints(m.points);n.points.length>0&&(n.status="Intersection");return n};b.Intersection=c})();(function(){var a=this.fabric||(this.fabric={});if(a.Color){console.warn("fabric.Color is already defined.");return}a.Color=b;function b(a){a?this._tryParsingColor(a):this.setSource([0,0,0,1])}b.prototype._tryParsingColor=function(a){var c=b.sourceFromHex(a);c||(c=b.sourceFromRgb(a));c&&this.setSource(c)};b.prototype.getSource=function(){return this._source};b.prototype.setSource=function(a){this._source=a};b.prototype.toRgb=function(){var a=this.getSource();return"rgb("+a[0]+","+a[1]+","+a[2]+")"};b.prototype.toRgba=function(){var a=this.getSource();return"rgba("+a[0]+","+a[1]+","+a[2]+","+a[3]+")"};b.prototype.toHex=function(){var a=this.getSource(),b=a[0].toString(16);b=b.length==1?"0"+b:b;var c=a[1].toString(16);c=c.length==1?"0"+c:c;var d=a[2].toString(16);d=d.length==1?"0"+d:d;return b.toUpperCase()+c.toUpperCase()+d.toUpperCase()};b.prototype.getAlpha=function(){return this.getSource()[3]};b.prototype.setAlpha=function(a){var b=this.getSource();b[3]=a;this.setSource(b);return this};b.prototype.toGrayscale=function(){var a=this.getSource(),b=parseInt((a[0]*0.3+a[1]*0.59+a[2]*0.11).toFixed(0),10),c=a[3];this.setSource([b,b,b,c]);return this};b.prototype.toBlackWhite=function(a){var b=this.getSource(),c=(b[0]*0.3+b[1]*0.59+b[2]*0.11).toFixed(0),d=b[3],a=a||127;c=Number(c)0?0:-b),a.ey-(c>0?0:-c),d,e);this.contextTop.lineWidth=this.selectionLineWidth;this.contextTop.strokeStyle=this.selectionBorderColor;this.contextTop.strokeRect(a.ex+y-(b>0?0:d),a.ey+y-(c>0?0:e),d,e)},_findSelectedObjects:function(a){var b,c,d=[],e=this._groupSelector.ex,f=this._groupSelector.ey,h=e+this._groupSelector.left,i=f+this._groupSelector.top,j,k=new fabric.Point(u(e,h),u(f,i)),l=new fabric.Point(v(e,h),v(f,i));for(var m=0,n=this._objects.length;m1){var d=new fabric.Group(d);this.setActiveGroup(d);d.saveCoords();g("group:selected",{target:d})}this.renderAll()},add:function(){this._objects.push.apply(this._objects,arguments);this.renderAll();return this},insertAt:function(a,b){this._objects.splice(b,0,a);this.renderAll();return this},getObjects:function(){return this._objects},getContext:function(){return this.contextTop},clearContext:function(a){a.clearRect(0,0,this._config.width,this._config.height);return this},clear:function(){this._objects.length=0;this.clearContext(this.contextTop);this.clearContext(this.contextContainer);this.renderAll();return this},renderAll:function(a){var b=this._config.width,c=this._config.height,d=a?this.contextTop:this.contextContainer;this.clearContext(this.contextTop);a||this.clearContext(d);if(!B&&this.backgroundColor==="transparent")var e=true;e||(d.fillStyle=this.backgroundColor);d.fillRect(0,0,b,c);var f=this._objects.length,g=this.getActiveGroup(),h=new Date();if(f)for(var i=0;i1)var f=new fabric.PathGroup(b,a);else var f=b[0];f.setSourcePath(j);if(!(f instanceof fabric.PathGroup)){d(f,a);typeof a.angle!=="undefined"&&f.setAngle(a.angle)}g(f,c)})},this)}catch(a){console.log(a.message)}},loadImageFromURL:(function(){var a={};return function(b,d){var e=this;function f(){var e=c.getElementById(a[b]);e.width&&e.height?d(new fabric.Image(e)):setTimeout(f,50)}if(a[b])f();else{var g=new Image();g.onload=function(){g.onload=null;e._resizeImageToFit(g);var a=new fabric.Image(g);d(a)};g.className="canvas-img-clone";g.src=b;this.shouldCacheImages&&(a[b]=Element.identify(g));c.body.appendChild(g)}}})(),loadSVGFromURL:function(a,b){var c=this;a=a.replace(/^\n\s*/,"").replace(/\?.*$/,"").trim();this.cache.has(a,function(f){f?c.cache.get(a,function(a){var d=c._enlivenCachedObject(a);b(d.objects,d.options)}):new Ajax.Request(a,{method:"get",onComplete:d,onFailure:e})});function d(d){var e=d.responseXML;if(!e)return;var f=e.documentElement;if(!f)return;fabric.parseSVGDocument(f,function(d,e){c.cache.set(a,{objects:d.invoke("toObject"),options:e});b(d,e)})}function e(){console.log("ERROR!")}},_enlivenCachedObject:function(a){var b=a.objects,c=a.options;b=b.map(function(a){return fabric[e(a.type)].fromObject(a)});return{objects:b,options:c}},remove:function(a){l(this._objects,a);this.renderAll();return a},fxRemove:function(a,b){var c=this;a.fxRemove({onChange:this.renderAll.bind(this),onComplete:function(){c.remove(a);typeof b==="function"&&b()}});return this},sendToBack:function(a){l(this._objects,a);this._objects.unshift(a);return this.renderAll()},bringToFront:function(a){l(this._objects,a);this._objects.push(a);return this.renderAll()},sendBackwards:function(a){var b=this._objects.indexOf(a),c=b;if(b!==0){for(var d=b-1;d>=0;--d){if(a.intersectsWithObject(this._objects[d])){c=d;break}}l(this._objects,a);this._objects.splice(c,0,a)}return this.renderAll()},bringForward:function(a){var b=this.getObjects(),c=b.indexOf(a),d=c;if(c!==b.length-1){for(var e=c+1,f=this._objects.length;e"};d(fabric.Element,{EMPTY_JSON:"{\"objects\": [], \"background\": \"white\"}",toGrayscale:function(a){var b=a.getContext("2d"),c=b.getImageData(0,0,a.width,a.height),d=c.data,e=c.width,f=c.height,g,h;for(i=0;i1?b.apply(this,h.call(arguments,1)):b.call(this)},initialize:function(a){this.setOptions(a);this._importProperties();this.originalState={};this.setCoords();this.saveState()},setOptions:function(a){this.options=c(this._getOptions(),a)},_getOptions:function(){return c(d(this._getSuperOptions()),this.options)},_getSuperOptions:function(){var a=this.constructor;if(a){var b=a.superclass;if(b){var c=b.prototype;if(c&&typeof c._getOptions=="function")return c._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))},toObject:function(){var a={type:this.type,left:e(this.left,this.NUM_FRACTION_DIGITS),top:e(this.top,this.NUM_FRACTION_DIGITS),width:e(this.width,this.NUM_FRACTION_DIGITS),height:e(this.height,this.NUM_FRACTION_DIGITS),fill:this.fill,overlayFill:this.overlayFill,stroke:this.stroke,strokeWidth:this.strokeWidth,scaleX:e(this.scaleX,this.NUM_FRACTION_DIGITS),scaleY:e(this.scaleY,this.NUM_FRACTION_DIGITS),angle:e(this.getAngle(),this.NUM_FRACTION_DIGITS),flipX:this.flipX,flipY:this.flipY,opacity:e(this.opacity,this.NUM_FRACTION_DIGITS)};this.includeDefaultValues||(a=this._removeDefaultValues(a));return a},toDatalessObject:function(){return this.toObject()},_removeDefaultValues:function(a){var c=b.Object.prototype.options;this.stateProperties.forEach(function(b){a[b]===c[b]&&delete a[b]});return a},isActive:function(){return!(!this.active)},setActive:function(a){this.active=!(!a);return this},toString:function(){return"#"},set:function(a,b){var c=(a==="scaleX"||a==="scaleY")&&ba.x&&f.xa.y&&g.y=b&&k.d.y>=b)continue;if(k.o.x==k.d.x&&k.o.x>=a){h=k.o.x;i=b}else{d=0;e=(k.d.y-k.o.y)/(k.d.x-k.o.x);f=b-d*a;g=k.o.y-e*k.o.x;h=-(f-g)/(d-e);i=f+d*h}h>=a&&(j+=1);if(j==2)break}return j},_getImageLines:function(a,b){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,b=this.theta,c=this.cornersize*Math.cos(b),d=this.cornersize*Math.sin(b),e=this.cornersize/2,f=e-d,g=e,h;a.tl.x-=f;a.tl.y-=g;a.tl.corner={tl:{x:a.tl.x,y:a.tl.y},tr:{x:a.tl.x+c,y:a.tl.y+d},bl:{x:a.tl.x-d,y:a.tl.y+c}};a.tl.corner.br={x:a.tl.corner.tr.x-d,y:a.tl.corner.tr.y+c};a.tl.x+=f;a.tl.y+=g;a.tr.x+=e;a.tr.y-=e;a.tr.corner={tl:{x:a.tr.x-c,y:a.tr.y-d},tr:{x:a.tr.x,y:a.tr.y},br:{x:a.tr.x-d,y:a.tr.y+c}};a.tr.corner.bl={x:a.tr.corner.tl.x-d,y:a.tr.corner.tl.y+c};a.tr.x-=e;a.tr.y+=e;a.bl.x-=e;a.bl.y+=e;a.bl.corner={tl:{x:a.bl.x+d,y:a.bl.y-c},bl:{x:a.bl.x,y:a.bl.y},br:{x:a.bl.x+c,y:a.bl.y+d}};a.bl.corner.tr={x:a.bl.corner.br.x+d,y:a.bl.corner.br.y-c};a.bl.x+=e;a.bl.y-=e;a.br.x+=e;a.br.y+=e;a.br.corner={tr:{x:a.br.x+d,y:a.br.y-c},bl:{x:a.br.x-c,y:a.br.y-d},br:{x:a.br.x,y:a.br.y}};a.br.corner.tl={x:a.br.corner.bl.x+d,y:a.br.corner.bl.y-c};a.br.x-=e;a.br.y-=e;a.ml.x-=e;a.ml.y-=e;a.ml.corner={tl:{x:a.ml.x,y:a.ml.y},tr:{x:a.ml.x+c,y:a.ml.y+d},bl:{x:a.ml.x-d,y:a.ml.y+c}};a.ml.corner.br={x:a.ml.corner.tr.x-d,y:a.ml.corner.tr.y+c};a.ml.x+=e;a.ml.y+=e;a.mt.x-=e;a.mt.y-=e;a.mt.corner={tl:{x:a.mt.x,y:a.mt.y},tr:{x:a.mt.x+c,y:a.mt.y+d},bl:{x:a.mt.x-d,y:a.mt.y+c}};a.mt.corner.br={x:a.mt.corner.tr.x-d,y:a.mt.corner.tr.y+c};a.mt.x+=e;a.mt.y+=e;a.mr.x-=e;a.mr.y-=e;a.mr.corner={tl:{x:a.mr.x,y:a.mr.y},tr:{x:a.mr.x+c,y:a.mr.y+d},bl:{x:a.mr.x-d,y:a.mr.y+c}};a.mr.corner.br={x:a.mr.corner.tr.x-d,y:a.mr.corner.tr.y+c};a.mr.x+=e;a.mr.y+=e;a.mb.x-=e;a.mb.y-=e;a.mb.corner={tl:{x:a.mb.x,y:a.mb.y},tr:{x:a.mb.x+c,y:a.mb.y+d},bl:{x:a.mb.x-d,y:a.mb.y+c}};a.mb.corner.br={x:a.mb.corner.tr.x-d,y:a.mb.corner.tr.y+c};a.mb.x+=e;a.mb.y+=e;h=a.mb.corner;h.tl.x-=e;h.tl.y-=e;h.tr.x-=e;h.tr.y-=e;h.br.x-=e;h.br.y-=e;h.bl.x-=e;h.bl.y-=e},toGrayscale:function(){var a=this.get("fill");a&&this.set("overlayFill",(new b.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(){var a=this._getAngleValueForStraighten();this.setAngle(a);return this},fxStraighten:function(a){a=a||{};var c=function(){},d=a.onComplete||c,e=a.onChange||c,f=this;b.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(a){f.setAngle(a);e()},onComplete:function(){f.setCoords();d()},onStart:function(){f.setActive(false)}});return this},fxRemove:function(a){a||(a={});var c=function(){},d=a.onComplete||c,e=a.onChange||c,f=this;b.util.animate({startValue:this.get("opacity"),endValue:0,duration:this.FX_DURATION,onChange:function(a){f.set("opacity",a);e()},onComplete:d,onStart:function(){f.setActive(false)}});return this},_getAngleValueForStraighten:function(){var a=this.get("angle");{if(a>-225&&a<=-135)return-180;if(a>-135&&a<=-45)return-90;if(a>-45&&a<=45)return 0;if(a>45&&a<=135)return 90;if(a>135&&a<=225)return 180;if(a>225&&a<=315)return 270;if(a>315)return 360}return 0},toJSON:function(){return this.toObject()}});b.Object.prototype.rotate=b.Object.prototype.setAngle})();(function(){var a=this.fabric||(this.fabric={}),b=a.util.object.extend;if(a.Line)return;a.Line=a.util.createClass(a.Object,{type:"line",initialize:function(a,b){a||(a=[0,0,0,0]);this.callSuper("initialize",b);this.set("x1",a[0]);this.set("y1",a[1]);this.set("x2",a[2]);this.set("y2",a[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(a){a.beginPath();a.moveTo(-this.width/2,-this.height/2);a.lineTo(this.width/2,this.height/2);var b=a.strokeStyle;a.strokeStyle=a.fillStyle;a.stroke();a.strokeStyle=b},complexity:function(){return 1},toObject:function(){return b(this.callSuper("toObject"),{x1:this.get("x1"),y1:this.get("y1"),x2:this.get("x2"),y2:this.get("y2")})}});a.Element.ATTRIBUTE_NAMES="x1 y1 x2 y2 stroke stroke-width transform".split(" ");a.Line.fromElement=function(c,d){var e=a.parseAttributes(c,a.Element.ATTRIBUTE_NAMES),f=[e.x1||0,e.y1||0,e.x2||0,e.y2||0];return new a.Line(f,b(e,d))};a.Line.fromObject=function(b){var c=[b.x1,b.y1,b.x2,b.y2];return new a.Line(c,b)}})();(function(){var a=this.fabric||(this.fabric={}),b=Math.PI*2,c=a.util.object.extend;if(a.Circle){console.warn("fabric.Circle is already defined.");return}a.Circle=a.util.createClass(a.Object,{type:"circle",initialize:function(a){a=a||{};this.set("radius",a.radius||0);this.callSuper("initialize",a);var b=this.get("radius")*2*this.get("scaleX");this.set("width",b).set("height",b)},toObject:function(){return c(this.callSuper("toObject"),{radius:this.get("radius")})},_render:function(a){a.beginPath();a.arc(0,0,this.radius,0,b,false);a.closePath();this.fill&&a.fill();this.stroke&&a.stroke()},complexity:function(){return 1}});a.Circle.ATTRIBUTE_NAMES="cx cy r fill fill-opacity stroke stroke-width transform".split(" ");a.Circle.fromElement=function(b,e){var f=a.parseAttributes(b,a.Circle.ATTRIBUTE_NAMES);if(!d(f))throw Error("value of `r` attribute is required and can not be negative");return new a.Circle(c(f,e))};function d(a){return"radius"in a&&a.radius>0}a.Circle.fromObject=function(b){return new a.Circle(b)}})();(function(){var a=this.fabric||(this.fabric={});if(a.Triangle)return;a.Triangle=a.util.createClass(a.Object,{type:"triangle",initialize:function(a){a=a||{};this.callSuper("initialize",a);this.set("width",a.width||100).set("height",a.height||100)},_render:function(a){var b=this.width/2,c=this.height/2;a.beginPath();a.moveTo(-b,c);a.lineTo(0,-c);a.lineTo(b,c);a.closePath();this.fill&&a.fill();this.stroke&&a.stroke()},complexity:function(){return 1}});a.Triangle.fromObject=function(b){return new a.Triangle(b)}})();(function(){var a=this.fabric||(this.fabric={}),b=a.util.object.extend;if(a.Ellipse){console.warn("fabric.Ellipse is already defined.");return}a.Ellipse=a.util.createClass(a.Object,{type:"ellipse",initialize:function(a){a=a||{};this.callSuper("initialize",a);this.set("rx",a.rx||0);this.set("ry",a.ry||0);this.set("width",this.get("rx")*2);this.set("height",this.get("ry")*2)},toObject:function(){return b(this.callSuper("toObject"),{rx:this.get("rx"),ry:this.get("ry")})},render:function(a,b){if(this.rx===0||this.ry===0)return;return this.callSuper("render",a,b)},_render:function(a){a.beginPath();a.save();a.transform(1,0,0,this.ry/this.rx,0,0);a.arc(0,0,this.rx,0,Math.PI*2,false);a.restore();this.stroke&&a.stroke();this.fill&&a.fill()},complexity:function(){return 1}});a.Ellipse.ATTRIBUTE_NAMES="cx cy rx ry fill fill-opacity stroke stroke-width transform".split(" ");a.Ellipse.fromElement=function(c,d){var e=a.parseAttributes(c,a.Ellipse.ATTRIBUTE_NAMES);return new a.Ellipse(b(e,d))};a.Ellipse.fromObject=function(b){return new a.Ellipse(b)}})();(function(){var a=this.fabric||(this.fabric={});if(a.Rect)return;a.Rect=a.util.createClass(a.Object,{type:"rect",options:{rx:0,ry:0},initialize:function(a){this.callSuper("initialize",a);this._initRxRy()},_initRxRy:function(){this.options.rx&&!this.options.ry?this.options.ry=this.options.rx:this.options.ry&&!this.options.rx&&(this.options.rx=this.options.ry)},_render:function(a){var b=this.options.rx||0,c=this.options.ry||0,d=-this.width/2,e=-this.height/2,f=this.width,g=this.height;a.beginPath();a.moveTo(d+b,e);a.lineTo(d+f-b,e);a.bezierCurveTo(d+f,e,d+f,e+c,d+f,e+c);a.lineTo(d+f,e+g-c);a.bezierCurveTo(d+f,e+g,d+f-b,e+g,d+f-b,e+g);a.lineTo(d+b,e+g);a.bezierCurveTo(d,e+g,d,e+g-c,d,e+g-c);a.lineTo(d,e+c);a.bezierCurveTo(d,e,d+b,e,d+b,e);a.closePath();this.fill&&a.fill();this.stroke&&a.stroke()},_normalizeLeftTopProperties:function(a){a.left&&this.set("left",a.left+this.getWidth()/2);a.top&&this.set("top",a.top+this.getHeight()/2);return this},complexity:function(){return 1}});a.Rect.ATTRIBUTE_NAMES="x y width height rx ry fill fill-opacity stroke stroke-width transform".split(" ");function b(a){a.left=a.left||0;a.top=a.top||0;return a}a.Rect.fromElement=function(c,d){if(!c)return null;var e=a.parseAttributes(c,a.Rect.ATTRIBUTE_NAMES);e=b(e);var f=new a.Rect(a.util.object.extend(d||{},e));f._normalizeLeftTopProperties(e);return f};a.Rect.fromObject=function(b){return new a.Rect(b)}})();(function(){var a=this.fabric||(this.fabric={});if(a.Polyline){console.warn("fabric.Polyline is already defined");return}a.Polyline=a.util.createClass(a.Object,{type:"polyline",initialize:function(a,b){b=b||{};this.set("points",a);this.callSuper("initialize",b);this._calcDimensions()},_calcDimensions:function(){return a.Polygon.prototype._calcDimensions.call(this)},_toOrigin:function(){return a.Polygon.prototype._toOrigin.call(this)},toObject:function(){return a.Polygon.prototype.toObject.call(this)},_render:function(a){var b;a.beginPath();for(var c=0,d=this.points.length;c"},toObject:function(){var a=d(this.callSuper("toObject"),{path:this.path});this.sourcePath&&(a.sourcePath=this.sourcePath);this.transformMatrix&&(a.transformMatrix=this.transformMatrix);return a},toDatalessObject:function(){var a=this.toObject();this.sourcePath&&(a.path=this.sourcePath);delete a.sourcePath;return a},complexity:function(){return this.path.length},set:function(a,b){return this.callSuper("set",a,b)},_parsePath:function(){var a=[],b,c;for(var d=0,e=this.path.length;d"},isSameColor:function(){var a=this.getObjects()[0].get("fill");return this.getObjects().every(function(b){return b.get("fill")===a})},complexity:function(){return this.paths.reduce(function(a,b){return a+(b&&b.complexity?b.complexity():0)},0)},toGrayscale:function(){var a=this.paths.length;while(a--)this.paths[a].toGrayscale();return this},getObjects:function(){return this.paths}});function h(b){for(var c=0,d=b.length;c"},getObjects:function(){return this.objects},add:function(a){this._restoreObjectsState();this.objects.push(a);a.setActive(true);this._calcBounds();this._updateObjectsCoords();return this},remove:function(a){this._restoreObjectsState();f(this.objects,a);a.setActive(false);this._calcBounds();this._updateObjectsCoords();return this},size:function(){return this.getObjects().length},set:function(a,b){if(typeof b=="function")this.set(a,b(this[a]));else if(a==="fill"||a==="opacity"){var c=this.objects.length;this[a]=b;while(c--)this.objects[c].set(a,b)}else this[a]=b;return this},contains:function(a){return this.objects.indexOf(a)>-1},toObject:function(){return b(this.callSuper("toObject"),{objects:e(this.objects,"clone")})},render:function(a){a.save();this.transform(a);var b=Math.max(this.scaleX,this.scaleY);for(var c=0,d=this.objects.length,e;e=this.objects[c];c++){var f=e.borderScaleFactor;e.borderScaleFactor=b;e.render(a);e.borderScaleFactor=f}this.hideBorders||this.drawBorders(a);this.hideCorners||this.drawCorners(a);a.restore();this.setCoords()},item:function(a){return this.getObjects()[a]},complexity:function(){return this.getObjects().reduce(function(a,b){a+=typeof b.complexity=="function"?b.complexity():0;return a},0)},_restoreObjectsState:function(){this.objects.forEach(this._restoreObjectState,this);return this},_restoreObjectState:function(a){var b=this.get("left"),c=this.get("top"),d=this.getAngle()*(Math.PI/180),e=a.get("originalLeft"),f=a.get("originalTop"),g=Math.cos(d)*a.get("top")+Math.sin(d)*a.get("left"),h=-Math.sin(d)*a.get("top")+Math.cos(d)*a.get("left");a.setAngle(a.getAngle()+this.getAngle());a.set("left",b+h*this.get("scaleX"));a.set("top",c+g*this.get("scaleY"));a.set("scaleX",a.get("scaleX")*this.get("scaleX"));a.set("scaleY",a.get("scaleY")*this.get("scaleY"));a.setCoords();a.hideCorners=false;a.setActive(false);a.setCoords();return this},destroy:function(){return this._restoreObjectsState()},saveCoords:function(){this._originalLeft=this.get("left");this._originalTop=this.get("top");return this},hasMoved:function(){return this._originalLeft!==this.get("left")||this._originalTop!==this.get("top")},setObjectsCoords:function(){this.forEachObject(function(a){a.setCoords()});return this},activateAllObjects:function(){return this.setActive(true)},setActive:function(a){this.forEachObject(function(b){b.setActive(a)});return this},forEachObject:function(a,b){var c=this.getObjects(),d=c.length;while(d--)a.call(b,c[d],d,c);return this},_setOpacityIfSame:function(){var a=this.getObjects(),b=a[0]?a[0].get("opacity"):1,c=a.every(function(a){return a.get("opacity")===b});c&&(this.opacity=b)},_calcBounds:function(){var a=[],b=[],e,f,g,h,i,j,k,l=0,m=this.objects.length;for(;la.x&&e-ca.y},toGrayscale:function(){var a=this.objects.length;while(a--)this.objects[a].toGrayscale()}});a.Group.fromObject=function(b){return new a.Group(b.objects,b)}})();(function(){var a=this.fabric||(this.fabric={}),b=a.util.object.extend,c=a.util.object.clone;if(a.Text){console.warn("fabric.Text is already defined");return}if(!a.Object){console.warn("fabric.Text requires fabric.Object");return}a.Text=a.util.createClass(a.Object,{options:{top:10,left:10,fontsize:20,fontweight:100,fontfamily:"Modernist_One_400",path:null},type:"text",initialize:function(a,c){this.originalState={};this.initStateProperties();this.text=a;this.setOptions(c);b(this,this.options);this.theta=this.angle*(Math.PI/180);this.width=this.getWidth();this.setCoords()},initStateProperties:function(){var a;if((a=this.constructor)&&(a=a.superclass)&&(a=a.prototype)&&(a=a.stateProperties)&&a.clone){this.stateProperties=a.clone();this.stateProperties.push("fontfamily","fontweight","path")}},toString:function(){return"#"},_render:function(a){var b=Cufon.textOptions||(Cufon.textOptions={});b.left=this.left;b.top=this.top;b.context=a;b.color=this.fill;var c=this._initDummyElement();this.transform(a);Cufon.replaceElement(c,{separate:"none",fontFamily:this.fontfamily});this.width=b.width;this.height=b.height},_initDummyElement:function(){var a=document.createElement("div");a.innerHTML=this.text;a.style.fontSize="40px";a.style.fontWeight="400";a.style.fontStyle="normal";a.style.letterSpacing="normal";a.style.color="#000000";a.style.fontWeight="600";a.style.fontFamily="Verdana";return a},render:function(a){a.save();this._render(a);if(this.active){this.drawBorders(a);this.drawCorners(a)}a.restore()},toObject:function(){return b(this.callSuper("toObject"),{text:this.text,fontsize:this.fontsize,fontweight:this.fontweight,fontfamily:this.fontfamily,path:this.path})},setColor:function(a){this.set("fill",a);return this},setFontsize:function(a){this.set("fontsize",a);this.setCoords();return this},getText:function(){return this.text},setText:function(a){this.set("text",a);this.setCoords();return this},set:function(a,b){this[a]=b;a==="fontfamily"&&(this.path=this.path.replace(/(.*?)([^\\x2f]*)(\.font\.js)/,"$1"+b+"$3"));return this}});a.Text.fromObject=function(b){return new a.Text(b.text,c(b))};a.Text.fromElement=function(a){}})();(function(){var a=this,b=fabric.util.object.extend;a.fabric||(a.fabric={});if(a.fabric.Image){console.warn("fabric.Image is already defined.");return}if(!fabric.Object){console.warn("fabric.Object is required for fabric.Image initialization");return}fabric.Image=fabric.util.createClass(fabric.Object,{maxwidth:null,maxheight:null,active:false,bordervisibility:false,cornervisibility:false,type:"image",__isGrayscaled:false,initialize:function(a,b){this.callSuper("initialize",b);this._initElement(a);this._initConfig(b||{})},getElement:function(){return this._element},setElement:function(a){this._element=a;return this},getNormalizedSize:function(a,b,c){if(c&&b&&(a.width>a.height&&a.width/a.heighta.width||a.height>c)){normalizedWidth=~(~(a.width*c/a.height));normalizedHeight=c}else if(b&&b"},clone:function(a){this.constructor.fromObject(this.toObject(),a)},toGrayscale:function(a){if(this.__isGrayscaled)return;var b=this.getElement(),c=document.createElement("canvas"),d=document.createElement("img"),e=this;c.width=b.width;c.height=b.height;c.getContext("2d").drawImage(b,0,0);fabric.Element.toGrayscale(c);d.onload=function(){e.setElement(d);a&&a();d.onload=c=b=imageData=null};d.width=b.width;d.height=b.height;d.src=c.toDataURL("image/png");this.__isGrayscaled=true;return this},_render:function(a){var b=this.getOriginalSize();a.drawImage(this.getElement(),-b.width/2,-b.height/2,b.width,b.height)},_adjustWidthHeightToBorders:function(a){if(a){this.currentBorder=this.borderwidth;this.width+=2*this.currentBorder;this.height+=2*this.currentBorder}else this.currentBorder=0},_resetWidthHeight:function(){var a=this.getElement();this.set("width",a.width);this.set("height",a.height)},_initElement:function(a){this.setElement(fabric.util.getById(a));fabric.util.addClass(this.getElement(),fabric.Image.CSS_CANVAS)},_initConfig:function(a){this.setOptions(a);this._setBorder();this._setWidthHeight(a)},_setBorder:function(){this.bordervisibility?this.currentBorder=this.borderwidth:this.currentBorder=0},_setWidthHeight:function(a){var b=2*this.currentBorder;this.width=(this.getElement().width||0)+b;this.height=(this.getElement().height||0)+b},complexity:function(){return 1}});fabric.Image.CSS_CANVAS="canvas-img";fabric.Image.fromObject=function(a,b){var c=document.createElement("img"),d=a.src;a.width&&(c.width=a.width);a.height&&(c.height=a.height);c.onload=function(){b&&b(new fabric.Image(c,a));c=c.onload=null};c.src=d};fabric.Image.fromURL=function(a,b,c){var d=document.createElement("img");d.onload=function(){b&&b(new fabric.Image(d,c));d=d.onload=null};d.src=a}})() \ No newline at end of file diff --git a/dist/all.min-via-uglify.js.gz b/dist/all.min-via-uglify.js.gz deleted file mode 100644 index 5a1c43b86ea69533b0d706a1e1536507b7f203ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22126 zcmV(uKidl>(zCe8t70X?kZtosrdci%#y^O%?bxk~g`aNoxXy~);k(AW6=mLQX@Yv0 zRm1;&`}(K--f7F>uHk`W4K&5G)De7F%6ePoXX5F2G+`s=3STr?3)kO7Er*-3s0(Zu z)&;Kk2*5OpFuprECTutC_QLe{@rJ%71ft$vfDbhyg~ z%uOAu@5dsqm(Vdj(T705QZBnX==i?amKF8*hs$O8ww9;+-bz4xqWb=a`8hz<1aIpy z%NNH-{b{?7WO>~FT>+F6`Dfv#kCLV#+TVp2)7f?e|L`jk_aX zBBLVwKzXLhGuC*e+yt!vyx$hUH9&;+?8B9)>Q?~3T{sFfX}V6}mKugnaCKJGmv{i1w+IovOD_u}1SvZ|*WhFbP7z(p zxMp3W;Z|GP&(EDKG(B)i9_Z14i{pXNIE=+=M;d;tz^EamqA*TP7I6{KTU(!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Q-do0r*?*MAeTbEtZR1 zyF_}k$l08ffA0{i>!rr{PKR*<9005F(7+ZO@0!iF(`>u>PINP>(Yt)!Xm?z$8o`34 zdgbC>^$_mLL-YuNf8Q5|DlTe4CbN+ilMHf?V9$MOeL#=CFPPbAHBW)vr&Z@@Um5#< z(oVwIiKZ?3$T8MbHEtMbH>xfb5!?-Fr$>6EbfvoM5t|Mc4G@ku9l4%j$gcabM@l+4?jPDqk6z3ORxhH{2zBU;+4~aJ$5~G$l^${{nccueI|x0RYPid07Ae diff --git a/dist/all.min.js b/dist/all.min.js index 771edf79..77374de8 100644 --- a/dist/all.min.js +++ b/dist/all.min.js @@ -1,4 +1,4 @@ -var console=console||{log:function(){},warn:function(){}},fabric=fabric||{version:0.1};if(!this.JSON)this.JSON={}; +var fabric=fabric||{version:0.1};fabric.log=function(){};fabric.warn=function(){};if(typeof console!=="undefined"){if(typeof console.log!=="undefined"&&console.log.apply)fabric.log=function(){return console.log.apply(console,arguments)};if(typeof console.warn!=="undefined"&&console.warn.apply)fabric.warn=function(){return console.warn.apply(console,arguments)}}if(!this.JSON)this.JSON={}; (function(){function h(g){return g<10?"0"+g:g}function p(g){o.lastIndex=0;return o.test(g)?'"'+g.replace(o,function(m){var q=a[m];return typeof q==="string"?q:"\\u"+("0000"+m.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+g+'"'}function e(g,m){var q,r,u,v,A=d,w,s=m[g];if(s&&typeof s==="object"&&typeof s.toJSON==="function")s=s.toJSON(g);if(typeof b==="function")s=b.call(m,g,s);switch(typeof s){case "string":return p(s);case "number":return isFinite(s)?String(s):"null";case "boolean":case "null":return String(s); case "object":if(!s)return"null";d+=c;w=[];if(Object.prototype.toString.apply(s)==="[object Array]"){v=s.length;for(q=0;q-1;d=d.split(/\s+/);var a=[];if(c){c=0;for(var b=d.length;c0&&this.init(e,l)}var p=this.fabric||(this.fabric={});if(p.Point)console.warn("fabric.Point is already defined");else{h.prototype={constructor:h,init:function(e,l){this.x=e;this.y=l},add:function(e){return new h(this.x+e.x,this.y+e.y)},addEquals:function(e){this.x+=e.x;this.y+=e.y;return this},scalarAdd:function(e){return new h(this.x+e,this.y+e)},scalarAddEquals:function(e){this.x+=e;this.y+=e;return this},subtract:function(e){return new h(this.x-e.x, -this.y-e.y)},subtractEquals:function(e){this.x-=e.x;this.y-=e.y;return this},scalarSubtract:function(e){return new h(this.x-e,this.y-e)},scalarSubtractEquals:function(e){this.x-=e;this.y-=e;return this},multiply:function(e){return new h(this.x*e,this.y*e)},multiplyEquals:function(e){this.x*=e;this.y*=e;return this},divide:function(e){return new h(this.x/e,this.y/e)},divideEquals:function(e){this.x/=e;this.y/=e;return this},eq:function(e){return this.x==e.x&&this.y==e.y},lt:function(e){return this.x< -e.x&&this.ye.x&&this.y>e.y},gte:function(e){return this.x>=e.x&&this.y>=e.y},lerp:function(e,l){return new h(this.x+(e.x-this.x)*l,this.y+(e.y-this.y)*l)},distanceFrom:function(e){var l=this.x-e.x;e=this.y-e.y;return Math.sqrt(l*l+e*e)},min:function(e){return new h(Math.min(this.x,e.x),Math.min(this.y,e.y))},max:function(e){return new h(Math.max(this.x,e.x),Math.max(this.y,e.y))},toString:function(){return this.x+ -","+this.y},setXY:function(e,l){this.x=e;this.y=l},setFromPoint:function(e){this.x=e.x;this.y=e.y},swap:function(e){var l=this.x,o=this.y;this.x=e.x;this.y=e.y;e.x=l;e.y=o}};p.Point=h}})(); -(function(){function h(e){arguments.length>0&&this.init(e)}var p=this.fabric||(this.fabric={});if(p.Intersection)console.warn("fabric.Intersection is already defined");else{h.prototype.init=function(e){this.status=e;this.points=[]};h.prototype.appendPoint=function(e){this.points.push(e)};h.prototype.appendPoints=function(e){this.points=this.points.concat(e)};h.intersectLineLine=function(e,l,o,d){var c,a=(d.x-o.x)*(e.y-o.y)-(d.y-o.y)*(e.x-o.x);c=(l.x-e.x)*(e.y-o.y)-(l.y-e.y)*(e.x-o.x);o=(d.y-o.y)* -(l.x-e.x)-(d.x-o.x)*(l.y-e.y);if(o!=0){a=a/o;c=c/o;if(0<=a&&a<=1&&0<=c&&c<=1){c=new h("Intersection");c.points.push(new p.Point(e.x+a*(l.x-e.x),e.y+a*(l.y-e.y)))}else c=new h("No Intersection")}else c=a==0||c==0?new h("Coincident"):new h("Parallel");return c};h.intersectLinePolygon=function(e,l,o){for(var d=new h("No Intersection"),c=o.length,a=0;a0)d.status="Intersection";return d};h.intersectPolygonPolygon= +(function(){function h(e,l){arguments.length>0&&this.init(e,l)}var p=this.fabric||(this.fabric={});if(p.Point)p.warn("fabric.Point is already defined");else{h.prototype={constructor:h,init:function(e,l){this.x=e;this.y=l},add:function(e){return new h(this.x+e.x,this.y+e.y)},addEquals:function(e){this.x+=e.x;this.y+=e.y;return this},scalarAdd:function(e){return new h(this.x+e,this.y+e)},scalarAddEquals:function(e){this.x+=e;this.y+=e;return this},subtract:function(e){return new h(this.x-e.x,this.y- +e.y)},subtractEquals:function(e){this.x-=e.x;this.y-=e.y;return this},scalarSubtract:function(e){return new h(this.x-e,this.y-e)},scalarSubtractEquals:function(e){this.x-=e;this.y-=e;return this},multiply:function(e){return new h(this.x*e,this.y*e)},multiplyEquals:function(e){this.x*=e;this.y*=e;return this},divide:function(e){return new h(this.x/e,this.y/e)},divideEquals:function(e){this.x/=e;this.y/=e;return this},eq:function(e){return this.x==e.x&&this.y==e.y},lt:function(e){return this.xe.x&&this.y>e.y},gte:function(e){return this.x>=e.x&&this.y>=e.y},lerp:function(e,l){return new h(this.x+(e.x-this.x)*l,this.y+(e.y-this.y)*l)},distanceFrom:function(e){var l=this.x-e.x;e=this.y-e.y;return Math.sqrt(l*l+e*e)},min:function(e){return new h(Math.min(this.x,e.x),Math.min(this.y,e.y))},max:function(e){return new h(Math.max(this.x,e.x),Math.max(this.y,e.y))},toString:function(){return this.x+","+this.y}, +setXY:function(e,l){this.x=e;this.y=l},setFromPoint:function(e){this.x=e.x;this.y=e.y},swap:function(e){var l=this.x,o=this.y;this.x=e.x;this.y=e.y;e.x=l;e.y=o}};p.Point=h}})(); +(function(){function h(e){arguments.length>0&&this.init(e)}var p=this.fabric||(this.fabric={});if(p.Intersection)p.warn("fabric.Intersection is already defined");else{h.prototype.init=function(e){this.status=e;this.points=[]};h.prototype.appendPoint=function(e){this.points.push(e)};h.prototype.appendPoints=function(e){this.points=this.points.concat(e)};h.intersectLineLine=function(e,l,o,d){var c,a=(d.x-o.x)*(e.y-o.y)-(d.y-o.y)*(e.x-o.x);c=(l.x-e.x)*(e.y-o.y)-(l.y-e.y)*(e.x-o.x);o=(d.y-o.y)*(l.x-e.x)- +(d.x-o.x)*(l.y-e.y);if(o!=0){a=a/o;c=c/o;if(0<=a&&a<=1&&0<=c&&c<=1){c=new h("Intersection");c.points.push(new p.Point(e.x+a*(l.x-e.x),e.y+a*(l.y-e.y)))}else c=new h("No Intersection")}else c=a==0||c==0?new h("Coincident"):new h("Parallel");return c};h.intersectLinePolygon=function(e,l,o){for(var d=new h("No Intersection"),c=o.length,a=0;a0)d.status="Intersection";return d};h.intersectPolygonPolygon= function(e,l){for(var o=new h("No Intersection"),d=e.length,c=0;c0)o.status="Intersection";return o};h.intersectPolygonRectangle=function(e,l,o){var d=l.min(o),c=l.max(o);o=new p.Point(c.x,d.y);var a=new p.Point(d.x,c.y);l=h.intersectLinePolygon(d,o,e);o=h.intersectLinePolygon(o,c,e);c=h.intersectLinePolygon(c,a,e);e=h.intersectLinePolygon(a,d,e);d=new h("No Intersection");d.appendPoints(l.points); d.appendPoints(o.points);d.appendPoints(c.points);d.appendPoints(e.points);if(d.points.length>0)d.status="Intersection";return d};p.Intersection=h}})(); -(function(){function h(e){e?this._tryParsingColor(e):this.setSource([0,0,0,1])}var p=this.fabric||(this.fabric={});if(p.Color)console.warn("fabric.Color is already defined.");else{p.Color=h;h.prototype._tryParsingColor=function(e){var l=h.sourceFromHex(e);l||(l=h.sourceFromRgb(e));l&&this.setSource(l)};h.prototype.getSource=function(){return this._source};h.prototype.setSource=function(e){this._source=e};h.prototype.toRgb=function(){var e=this.getSource();return"rgb("+e[0]+","+e[1]+","+e[2]+")"}; -h.prototype.toRgba=function(){var e=this.getSource();return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"};h.prototype.toHex=function(){var e=this.getSource(),l=e[0].toString(16);l=l.length==1?"0"+l:l;var o=e[1].toString(16);o=o.length==1?"0"+o:o;e=e[2].toString(16);e=e.length==1?"0"+e:e;return l.toUpperCase()+o.toUpperCase()+e.toUpperCase()};h.prototype.getAlpha=function(){return this.getSource()[3]};h.prototype.setAlpha=function(e){var l=this.getSource();l[3]=e;this.setSource(l);return this};h.prototype.toGrayscale= +(function(){function h(e){e?this._tryParsingColor(e):this.setSource([0,0,0,1])}var p=this.fabric||(this.fabric={});if(p.Color)p.warn("fabric.Color is already defined.");else{p.Color=h;h.prototype._tryParsingColor=function(e){var l=h.sourceFromHex(e);l||(l=h.sourceFromRgb(e));l&&this.setSource(l)};h.prototype.getSource=function(){return this._source};h.prototype.setSource=function(e){this._source=e};h.prototype.toRgb=function(){var e=this.getSource();return"rgb("+e[0]+","+e[1]+","+e[2]+")"};h.prototype.toRgba= +function(){var e=this.getSource();return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"};h.prototype.toHex=function(){var e=this.getSource(),l=e[0].toString(16);l=l.length==1?"0"+l:l;var o=e[1].toString(16);o=o.length==1?"0"+o:o;e=e[2].toString(16);e=e.length==1?"0"+e:e;return l.toUpperCase()+o.toUpperCase()+e.toUpperCase()};h.prototype.getAlpha=function(){return this.getSource()[3]};h.prototype.setAlpha=function(e){var l=this.getSource();l[3]=e;this.setSource(l);return this};h.prototype.toGrayscale= function(){var e=this.getSource(),l=parseInt((e[0]*0.3+e[1]*0.59+e[2]*0.11).toFixed(0),10);this.setSource([l,l,l,e[3]]);return this};h.prototype.toBlackWhite=function(e){var l=this.getSource(),o=(l[0]*0.3+l[1]*0.59+l[2]*0.11).toFixed(0);l=l[3];e=e||127;o=Number(o)1?new fabric.PathGroup(F,D):F[0];F.setSourcePath(H);if(!(F instanceof fabric.PathGroup)){e(F,D);typeof D.angle!=="undefined"&&F.setAngle(D.angle)}n(F,G)})}, -this)}catch(B){console.log(B.message)}},loadImageFromURL:function(){var f={};return function(k,n){function t(){var B=p.getElementById(f[k]);B.width&&B.height?n(new fabric.Image(B)):setTimeout(t,50)}var x=this;if(f[k])t();else{var y=new Image;y.onload=function(){y.onload=null;x._resizeImageToFit(y);var B=new fabric.Image(y);n(B)};y.className="canvas-img-clone";y.src=k;if(this.shouldCacheImages)f[k]=Element.identify(y);p.body.appendChild(y)}}}(),loadSVGFromURL:function(f,k){function n(y){if(y=y.responseXML)(y= -y.documentElement)&&fabric.parseSVGDocument(y,function(B,D){x.cache.set(f,{objects:B.invoke("toObject"),options:D});k(B,D)})}function t(){console.log("ERROR!")}var x=this;f=f.replace(/^\n\s*/,"").replace(/\?.*$/,"").trim();this.cache.has(f,function(y){if(y)x.cache.get(f,function(B){B=x._enlivenCachedObject(B);k(B.objects,B.options)});else new Ajax.Request(f,{method:"get",onComplete:n,onFailure:t})})},_enlivenCachedObject:function(f){var k=f.objects;f=f.options;k=k.map(function(n){return fabric[l(n.type)].fromObject(n)}); +this)}catch(B){fabric.log(B.message)}},loadImageFromURL:function(){var f={};return function(k,n){function t(){var B=p.getElementById(f[k]);B.width&&B.height?n(new fabric.Image(B)):setTimeout(t,50)}var x=this;if(f[k])t();else{var y=new Image;y.onload=function(){y.onload=null;x._resizeImageToFit(y);var B=new fabric.Image(y);n(B)};y.className="canvas-img-clone";y.src=k;if(this.shouldCacheImages)f[k]=Element.identify(y);p.body.appendChild(y)}}}(),loadSVGFromURL:function(f,k){function n(y){if(y=y.responseXML)(y= +y.documentElement)&&fabric.parseSVGDocument(y,function(B,D){x.cache.set(f,{objects:B.invoke("toObject"),options:D});k(B,D)})}function t(){fabric.log("ERROR!")}var x=this;f=f.replace(/^\n\s*/,"").replace(/\?.*$/,"").trim();this.cache.has(f,function(y){if(y)x.cache.get(f,function(B){B=x._enlivenCachedObject(B);k(B.objects,B.options)});else new Ajax.Request(f,{method:"get",onComplete:n,onFailure:t})})},_enlivenCachedObject:function(f){var k=f.objects;f=f.options;k=k.map(function(n){return fabric[l(n.type)].fromObject(n)}); return{objects:k,options:f}},remove:function(f){b(this._objects,f);this.renderAll();return f},fxRemove:function(f,k){var n=this;f.fxRemove({onChange:this.renderAll.bind(this),onComplete:function(){n.remove(f);typeof k==="function"&&k()}});return this},sendToBack:function(f){b(this._objects,f);this._objects.unshift(f);return this.renderAll()},bringToFront:function(f){b(this._objects,f);this._objects.push(f);return this.renderAll()},sendBackwards:function(f){var k=this._objects.indexOf(f),n=k;if(k!== 0){for(k=k-1;k>=0;--k)if(f.intersectsWithObject(this._objects[k])){n=k;break}b(this._objects,f);this._objects.splice(n,0,f)}return this.renderAll()},bringForward:function(f){var k=this.getObjects(),n=k.indexOf(f),t=n;if(n!==k.length-1){n=n+1;for(var x=this._objects.length;n0))throw Error("value of `r` attribute is required and can not be negative");if("left"in d)d.left-=o.width/2||0;if("top"in d)d.top-=o.height/ -2||0;return new h.Circle(e(d,o))};h.Circle.fromObject=function(l){return new h.Circle(l)}}})(); +(function(){var h=this.fabric||(this.fabric={}),p=Math.PI*2,e=h.util.object.extend;if(h.Circle)h.warn("fabric.Circle is already defined.");else{h.Circle=h.util.createClass(h.Object,{type:"circle",initialize:function(l){l=l||{};this.set("radius",l.radius||0);this.callSuper("initialize",l);l=this.get("radius")*2*this.get("scaleX");this.set("width",l).set("height",l)},toObject:function(){return e(this.callSuper("toObject"),{radius:this.get("radius")})},_render:function(l,o){l.beginPath();l.arc(o?this.left: +0,o?this.top:0,this.radius,0,p,false);l.closePath();this.fill&&l.fill();this.stroke&&l.stroke()},complexity:function(){return 1}});h.Circle.ATTRIBUTE_NAMES="cx cy r fill fill-opacity stroke stroke-width transform".split(" ");h.Circle.fromElement=function(l,o){o||(o={});var d=h.parseAttributes(l,h.Circle.ATTRIBUTE_NAMES);if(!("radius"in d&&d.radius>0))throw Error("value of `r` attribute is required and can not be negative");if("left"in d)d.left-=o.width/2||0;if("top"in d)d.top-=o.height/2||0;return new h.Circle(e(d, +o))};h.Circle.fromObject=function(l){return new h.Circle(l)}}})(); (function(){var h=this.fabric||(this.fabric={});if(!h.Triangle){h.Triangle=h.util.createClass(h.Object,{type:"triangle",initialize:function(p){p=p||{};this.callSuper("initialize",p);this.set("width",p.width||100).set("height",p.height||100)},_render:function(p){var e=this.width/2,l=this.height/2;p.beginPath();p.moveTo(-e,l);p.lineTo(0,-l);p.lineTo(e,l);p.closePath();this.fill&&p.fill();this.stroke&&p.stroke()},complexity:function(){return 1}});h.Triangle.fromObject=function(p){return new h.Triangle(p)}}})(); -(function(){var h=this.fabric||(this.fabric={}),p=Math.PI*2,e=h.util.object.extend;if(h.Ellipse)console.warn("fabric.Ellipse is already defined.");else{h.Ellipse=h.util.createClass(h.Object,{type:"ellipse",initialize:function(l){l=l||{};this.callSuper("initialize",l);this.set("rx",l.rx||0);this.set("ry",l.ry||0);this.set("width",this.get("rx")*2);this.set("height",this.get("ry")*2)},toObject:function(){return e(this.callSuper("toObject"),{rx:this.get("rx"),ry:this.get("ry")})},render:function(l,o){if(!(this.rx=== +(function(){var h=this.fabric||(this.fabric={}),p=Math.PI*2,e=h.util.object.extend;if(h.Ellipse)h.warn("fabric.Ellipse is already defined.");else{h.Ellipse=h.util.createClass(h.Object,{type:"ellipse",initialize:function(l){l=l||{};this.callSuper("initialize",l);this.set("rx",l.rx||0);this.set("ry",l.ry||0);this.set("width",this.get("rx")*2);this.set("height",this.get("ry")*2)},toObject:function(){return e(this.callSuper("toObject"),{rx:this.get("rx"),ry:this.get("ry")})},render:function(l,o){if(!(this.rx=== 0||this.ry===0))return this.callSuper("render",l,o)},_render:function(l,o){l.beginPath();l.save();l.transform(1,0,0,this.ry/this.rx,0,0);l.arc(o?this.left:0,o?this.top:0,this.rx,0,p,false);l.restore();this.stroke&&l.stroke();this.fill&&l.fill()},complexity:function(){return 1}});h.Ellipse.ATTRIBUTE_NAMES="cx cy rx ry fill fill-opacity stroke stroke-width transform".split(" ");h.Ellipse.fromElement=function(l,o){o||(o={});var d=h.parseAttributes(l,h.Ellipse.ATTRIBUTE_NAMES);if("left"in d)d.left-=o.width/ 2||0;if("top"in d)d.top-=o.height/2||0;return new h.Ellipse(e(d,o))};h.Ellipse.fromObject=function(l){return new h.Ellipse(l)}}})(); (function(){var h=this.fabric||(this.fabric={});if(!h.Rect){h.Rect=h.util.createClass(h.Object,{type:"rect",options:{rx:0,ry:0},initialize:function(p){this.callSuper("initialize",p);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(p){var e=this.options.rx||0,l=this.options.ry||0,o=-this.width/2,d=-this.height/2,c=this.width,a=this.height;p.beginPath(); p.moveTo(o+e,d);p.lineTo(o+c-e,d);p.bezierCurveTo(o+c,d,o+c,d+l,o+c,d+l);p.lineTo(o+c,d+a-l);p.bezierCurveTo(o+c,d+a,o+c-e,d+a,o+c-e,d+a);p.lineTo(o+e,d+a);p.bezierCurveTo(o,d+a,o,d+a-l,o,d+a-l);p.lineTo(o,d+l);p.bezierCurveTo(o,d,o+e,d,o+e,d);p.closePath();this.fill&&p.fill();this.stroke&&p.stroke()},_normalizeLeftTopProperties:function(p){p.left&&this.set("left",p.left+this.getWidth()/2);p.top&&this.set("top",p.top+this.getHeight()/2);return this},complexity:function(){return 1}});h.Rect.ATTRIBUTE_NAMES= "x y width height rx ry fill fill-opacity stroke stroke-width transform".split(" ");h.Rect.fromElement=function(p,e){if(!p)return null;var l=h.parseAttributes(p,h.Rect.ATTRIBUTE_NAMES);l=l;l.left=l.left||0;l.top=l.top||0;l=l;var o=new h.Rect(h.util.object.extend(e||{},l));o._normalizeLeftTopProperties(l);return o};h.Rect.fromObject=function(p){return new h.Rect(p)}}})(); -(function(){var h=this.fabric||(this.fabric={});if(h.Polyline)console.warn("fabric.Polyline is already defined");else{h.Polyline=h.util.createClass(h.Object,{type:"polyline",initialize:function(e,l){l=l||{};this.set("points",e);this.callSuper("initialize",l);this._calcDimensions()},_calcDimensions:function(){return h.Polygon.prototype._calcDimensions.call(this)},toObject:function(){return h.Polygon.prototype.toObject.call(this)},_render:function(e){var l;e.beginPath();for(var o=0,d=this.points.length;o< +(function(){var h=this.fabric||(this.fabric={});if(h.Polyline)h.warn("fabric.Polyline is already defined");else{h.Polyline=h.util.createClass(h.Object,{type:"polyline",initialize:function(e,l){l=l||{};this.set("points",e);this.callSuper("initialize",l);this._calcDimensions()},_calcDimensions:function(){return h.Polygon.prototype._calcDimensions.call(this)},toObject:function(){return h.Polygon.prototype.toObject.call(this)},_render:function(e){var l;e.beginPath();for(var o=0,d=this.points.length;o< d;o++){l=this.points[o];e.lineTo(l.x,l.y)}this.fill&&e.fill();this.stroke&&e.stroke()},complexity:function(){return this.get("points").length}});var p="fill fill-opacity stroke stroke-width transform".split(" ");h.Polyline.fromElement=function(e,l){if(!e)return null;l||(l={});for(var o=h.parsePointsAttribute(e.getAttribute("points")),d=h.parseAttributes(e,p),c=0,a=o.length;c"},toObject:function(){var d=l(this.callSuper("toObject"),{path:this.path});if(this.sourcePath)d.sourcePath=this.sourcePath;if(this.transformMatrix)d.transformMatrix=this.transformMatrix;return d},toDatalessObject:function(){var d=this.toObject();if(this.sourcePath)d.path=this.sourcePath;delete d.sourcePath;return d},complexity:function(){return this.path.length},set:function(d,c){return this.callSuper("set",d,c)},_parsePath:function(){for(var d= [],c,a,b=0,g=this.path.length;b"},isSameColor:function(){var a=this.getObjects()[0].get("fill");return this.getObjects().every(function(b){return b.get("fill")===a})},complexity:function(){return this.paths.reduce(function(a,b){return a+(b&&b.complexity?b.complexity():0)},0)},toGrayscale:function(){for(var a=this.paths.length;a--;)this.paths[a].toGrayscale();return this},getObjects:function(){return this.paths}});h.PathGroup.fromObject=function(a){for(var b=a.paths, @@ -153,15 +153,15 @@ this);return this},_restoreObjectState:function(c){var a=this.get("left"),b=this c.hideCorners=false;c.setActive(false);c.setCoords();return this},destroy:function(){return this._restoreObjectsState()},saveCoords:function(){this._originalLeft=this.get("left");this._originalTop=this.get("top");return this},hasMoved:function(){return this._originalLeft!==this.get("left")||this._originalTop!==this.get("top")},setObjectsCoords:function(){this.forEachObject(function(c){c.setCoords()});return this},activateAllObjects:function(){return this.setActive(true)},setActive:function(c){this.forEachObject(function(a){a.setActive(c)}); return this},forEachObject:function(c,a){for(var b=this.getObjects(),g=b.length;g--;)c.call(a,b[g],g,b);return this},_setOpacityIfSame:function(){var c=this.getObjects(),a=c[0]?c[0].get("opacity"):1;if(c.every(function(b){return b.get("opacity")===a}))this.opacity=a},_calcBounds:function(){var c=[],a=[],b,g;g=0;for(var m=this.objects.length;gc.x&&m-bc.y},toGrayscale:function(){for(var c=this.objects.length;c--;)this.objects[c].toGrayscale()}});h.Group.fromObject=function(c){return new h.Group(c.objects,c)}}})(); -(function(){var h=this.fabric||(this.fabric={}),p=h.util.object.extend,e=h.util.object.clone;if(h.Text)console.warn("fabric.Text is already defined");else if(h.Object){h.Text=h.util.createClass(h.Object,{options:{top:10,left:10,fontsize:20,fontweight:100,fontfamily:"Modernist_One_400",path:null},type:"text",initialize:function(l,o){this.originalState={};this.initStateProperties();this.text=l;this.setOptions(o);p(this,this.options);this.theta=this.angle*(Math.PI/180);this.width=this.getWidth();this.setCoords()}, +(function(){var h=this.fabric||(this.fabric={}),p=h.util.object.extend,e=h.util.object.clone;if(h.Text)h.warn("fabric.Text is already defined");else if(h.Object){h.Text=h.util.createClass(h.Object,{options:{top:10,left:10,fontsize:20,fontweight:100,fontfamily:"Modernist_One_400",path:null},type:"text",initialize:function(l,o){this.originalState={};this.initStateProperties();this.text=l;this.setOptions(o);p(this,this.options);this.theta=this.angle*(Math.PI/180);this.width=this.getWidth();this.setCoords()}, initStateProperties:function(){var l;if((l=this.constructor)&&(l=l.superclass)&&(l=l.prototype)&&(l=l.stateProperties)&&l.clone){this.stateProperties=l.clone();this.stateProperties.push("fontfamily","fontweight","path")}},toString:function(){return"#"},_render:function(l){var o=Cufon.textOptions||(Cufon.textOptions={});o.left=this.left;o.top=this.top;o.context=l;o.color=this.fill;var d=this._initDummyElement(); this.transform(l);Cufon.replaceElement(d,{separate:"none",fontFamily:this.fontfamily});this.width=o.width;this.height=o.height},_initDummyElement:function(){var l=document.createElement("div");l.innerHTML=this.text;l.style.fontSize="40px";l.style.fontWeight="400";l.style.fontStyle="normal";l.style.letterSpacing="normal";l.style.color="#000000";l.style.fontWeight="600";l.style.fontFamily="Verdana";return l},render:function(l){l.save();this._render(l);if(this.active){this.drawBorders(l);this.drawCorners(l)}l.restore()}, toObject:function(){return p(this.callSuper("toObject"),{text:this.text,fontsize:this.fontsize,fontweight:this.fontweight,fontfamily:this.fontfamily,path:this.path})},setColor:function(l){this.set("fill",l);return this},setFontsize:function(l){this.set("fontsize",l);this.setCoords();return this},getText:function(){return this.text},setText:function(l){this.set("text",l);this.setCoords();return this},set:function(l,o){this[l]=o;if(l==="fontfamily")this.path=this.path.replace(/(.*?)([^\/]*)(\.font\.js)/, -"$1"+o+"$3");return this}});h.Text.fromObject=function(l){return new h.Text(l.text,e(l))};h.Text.fromElement=function(){}}else console.warn("fabric.Text requires fabric.Object")})(); -(function(){var h=fabric.util.object.extend;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(p,e){this.callSuper("initialize",e);this._initElement(p);this._initConfig(e||{})},getElement:function(){return this._element},setElement:function(p){this._element= +"$1"+o+"$3");return this}});h.Text.fromObject=function(l){return new h.Text(l.text,e(l))};h.Text.fromElement=function(){}}else h.warn("fabric.Text requires fabric.Object")})(); +(function(){var h=fabric.util.object.extend;if(!this.fabric)this.fabric={};if(this.fabric.Image)fabric.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(p,e){this.callSuper("initialize",e);this._initElement(p);this._initConfig(e||{})},getElement:function(){return this._element},setElement:function(p){this._element= p;return this},getNormalizedSize:function(p,e,l){if(l&&e&&p.width>p.height&&p.width/p.heightp.width||p.height>l)){normalizedWidth=~~(p.width*l/p.height);normalizedHeight=l}else if(e&&e'},clone:function(p){this.constructor.fromObject(this.toObject(),p)},toGrayscale:function(p){if(!this.__isGrayscaled){var e=this.getElement(),l=document.createElement("canvas"),o=document.createElement("img"),d=this;l.width=e.width;l.height=e.height;l.getContext("2d").drawImage(e,0,0);fabric.Element.toGrayscale(l);o.onload=function(){d.setElement(o);p&&p();o.onload=l=e=imageData=null};o.width=e.width;o.height=e.height;o.src=l.toDataURL("image/png");this.__isGrayscaled=true;return this}}, _render:function(p){var e=this.getOriginalSize();p.drawImage(this.getElement(),-e.width/2,-e.height/2,e.width,e.height)},_adjustWidthHeightToBorders:function(p){if(p){this.currentBorder=this.borderwidth;this.width+=2*this.currentBorder;this.height+=2*this.currentBorder}else this.currentBorder=0},_resetWidthHeight:function(){var p=this.getElement();this.set("width",p.width);this.set("height",p.height)},_initElement:function(p){this.setElement(fabric.util.getById(p));fabric.util.addClass(this.getElement(), fabric.Image.CSS_CANVAS)},_initConfig:function(p){this.setOptions(p);this._setBorder();this._setWidthHeight(p)},_setBorder:function(){this.currentBorder=this.bordervisibility?this.borderwidth:0},_setWidthHeight:function(){var p=2*this.currentBorder;this.width=(this.getElement().width||0)+p;this.height=(this.getElement().height||0)+p},complexity:function(){return 1}});fabric.Image.CSS_CANVAS="canvas-img";fabric.Image.fromObject=function(p,e){var l=document.createElement("img"),o=p.src;if(p.width)l.width= -p.width;if(p.height)l.height=p.height;l.onload=function(){e&&e(new fabric.Image(l,p));l=l.onload=null};l.src=o};fabric.Image.fromURL=function(p,e,l){var o=document.createElement("img");o.onload=function(){e&&e(new fabric.Image(o,l));o=o.onload=null};o.src=p}}else console.warn("fabric.Object is required for fabric.Image initialization")})(); +p.width;if(p.height)l.height=p.height;l.onload=function(){e&&e(new fabric.Image(l,p));l=l.onload=null};l.src=o};fabric.Image.fromURL=function(p,e,l){var o=document.createElement("img");o.onload=function(){e&&e(new fabric.Image(o,l));o=o.onload=null};o.src=p}}else fabric.warn("fabric.Object is required for fabric.Image initialization")})(); diff --git a/fabric.js b/fabric.js index 92c9ec4d..4dc0d4b8 100644 --- a/fabric.js +++ b/fabric.js @@ -1,12 +1,23 @@ /*! Fabric.js Copyright 2010, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */ -var console = console || { - log: function() { }, - warn: function() { } -}; - var fabric = fabric || { version: 0.1 }; +fabric.log = function() { }; +fabric.warn = function() { }; + +if (typeof console !== 'undefined') { + if (typeof console.log !== 'undefined' && console.log.apply) { + fabric.log = function() { + return console.log.apply(console, arguments); + }; + } + if (typeof console.warn !== 'undefined' && console.warn.apply) { + fabric.warn = function() { + return console.warn.apply(console, arguments); + }; + } +} + //= require "lib/json2" //= require "src/util" diff --git a/src/circle.class.js b/src/circle.class.js index ba480930..6ae61b69 100644 --- a/src/circle.class.js +++ b/src/circle.class.js @@ -7,7 +7,7 @@ extend = fabric.util.object.extend; if (fabric.Circle) { - console.warn('fabric.Circle is already defined.'); + fabric.warn('fabric.Circle is already defined.'); return; } diff --git a/src/color.class.js b/src/color.class.js index 81c2079c..dc0b1252 100644 --- a/src/color.class.js +++ b/src/color.class.js @@ -3,7 +3,7 @@ var fabric = this.fabric || (this.fabric = { }); if (fabric.Color) { - console.warn('fabric.Color is already defined.'); + fabric.warn('fabric.Color is already defined.'); return; } diff --git a/src/element.class.js b/src/element.class.js index 6ab686ce..c26d9880 100644 --- a/src/element.class.js +++ b/src/element.class.js @@ -1,7 +1,7 @@ (function () { if (fabric.Element) { - console.warn('fabric.Element is already defined.'); + fabric.warn('fabric.Element is already defined.'); return; } @@ -1694,7 +1694,7 @@ }, this); } catch(e) { - console.log(e.message); + fabric.log(e.message); } }, @@ -1790,7 +1790,7 @@ } function onFailure() { - console.log('ERROR!'); + fabric.log('ERROR!'); } }, diff --git a/src/ellipse.class.js b/src/ellipse.class.js index ff5bfb78..2eb93b9d 100644 --- a/src/ellipse.class.js +++ b/src/ellipse.class.js @@ -7,7 +7,7 @@ extend = fabric.util.object.extend; if (fabric.Ellipse) { - console.warn('fabric.Ellipse is already defined.'); + fabric.warn('fabric.Ellipse is already defined.'); return; } diff --git a/src/image.class.js b/src/image.class.js index 836e8bd6..ae19acd9 100644 --- a/src/image.class.js +++ b/src/image.class.js @@ -10,12 +10,12 @@ } if (global.fabric.Image) { - console.warn('fabric.Image is already defined.'); + fabric.warn('fabric.Image is already defined.'); return; }; if (!fabric.Object) { - console.warn('fabric.Object is required for fabric.Image initialization'); + fabric.warn('fabric.Object is required for fabric.Image initialization'); return; } diff --git a/src/intersection.class.js b/src/intersection.class.js index 8c33dc47..5931dd6e 100644 --- a/src/intersection.class.js +++ b/src/intersection.class.js @@ -8,7 +8,7 @@ fabric = global.fabric || (global.fabric = { }); if (fabric.Intersection) { - console.warn('fabric.Intersection is already defined'); + fabric.warn('fabric.Intersection is already defined'); return; } diff --git a/src/parser.js b/src/parser.js index 0c74e28b..1703d240 100644 --- a/src/parser.js +++ b/src/parser.js @@ -285,7 +285,7 @@ return klass.fromElement(el, options); } catch(e) { - console.log(e.message || e); + fabric.log(e.message || e); } } }); diff --git a/src/path.class.js b/src/path.class.js index f5f43af8..2f21e378 100644 --- a/src/path.class.js +++ b/src/path.class.js @@ -8,11 +8,11 @@ extend = fabric.util.object.extend; if (fabric.Path) { - console.warn('fabric.Path is already defined'); + fabric.warn('fabric.Path is already defined'); return; } if (!fabric.Object) { - console.warn('fabric.Path requires fabric.Object'); + fabric.warn('fabric.Path requires fabric.Object'); return; } diff --git a/src/path_group.class.js b/src/path_group.class.js index db243e62..a740a72a 100644 --- a/src/path_group.class.js +++ b/src/path_group.class.js @@ -11,7 +11,7 @@ capitalize = fabric.util.string.capitalize; if (fabric.PathGroup) { - console.warn('fabric.PathGroup is already defined'); + fabric.warn('fabric.PathGroup is already defined'); return; } diff --git a/src/point.class.js b/src/point.class.js index dc1190de..558a0904 100644 --- a/src/point.class.js +++ b/src/point.class.js @@ -5,7 +5,7 @@ var fabric = this.fabric || (this.fabric = { }); if (fabric.Point) { - console.warn('fabric.Point is already defined'); + fabric.warn('fabric.Point is already defined'); return; } diff --git a/src/polygon.class.js b/src/polygon.class.js index dd311f73..d5197c65 100644 --- a/src/polygon.class.js +++ b/src/polygon.class.js @@ -8,7 +8,7 @@ max = fabric.util.array.max; if (fabric.Polygon) { - console.warn('fabric.Polygon is already defined'); + fabric.warn('fabric.Polygon is already defined'); return; } diff --git a/src/polyline.class.js b/src/polyline.class.js index f55865e8..7f4a1dd3 100644 --- a/src/polyline.class.js +++ b/src/polyline.class.js @@ -5,7 +5,7 @@ var fabric = this.fabric || (this.fabric = { }); if (fabric.Polyline) { - console.warn('fabric.Polyline is already defined'); + fabric.warn('fabric.Polyline is already defined'); return; } diff --git a/src/text.class.js b/src/text.class.js index b67b5800..624eeda2 100644 --- a/src/text.class.js +++ b/src/text.class.js @@ -7,11 +7,11 @@ clone = fabric.util.object.clone; if (fabric.Text) { - console.warn('fabric.Text is already defined'); + fabric.warn('fabric.Text is already defined'); return; } if (!fabric.Object) { - console.warn('fabric.Text requires fabric.Object'); + fabric.warn('fabric.Text requires fabric.Object'); return; } diff --git a/test/unit/path_group.js b/test/unit/path_group.js index f052b6e6..a13075d6 100644 --- a/test/unit/path_group.js +++ b/test/unit/path_group.js @@ -65,13 +65,6 @@ var pathGroup = getPathGroupObject(); ok(typeof pathGroup.toObject == 'function'); var object = pathGroup.toObject(); - - /*same(fabric.util.object.extend(fabric.util.object.clone(REFERENCE_PATH_GROUP_OBJECT), { - paths: object.paths - }), object); - console.log(fabric.util.object.extend(fabric.util.object.clone(REFERENCE_PATH_GROUP_OBJECT), { - paths: object.paths - }), object);*/ }); test('complexity', function() { diff --git a/test/unit/text.js b/test/unit/text.js index 4c95e791..2775e0ff 100644 --- a/test/unit/text.js +++ b/test/unit/text.js @@ -94,60 +94,54 @@ }); asyncTest('Text already defined', function() { - var warnWasCalled = false; + var warnWasCalled = false, originalWarn = fabric.warn; function warn() { warnWasCalled = true; } - console.warn = warn; + fabric.warn = warn; - if (console.warn === warn) { - // some browsers (e.g. Safari 3.0.4) don't allow to override `console.warn` - var el = document.createElement('script'); - el.src = '../../src/text.class.js'; - document.body.appendChild(el); + var el = document.createElement('script'); + el.src = '../../src/text.class.js'; + document.body.appendChild(el); - setTimeout(function() { - ok(warnWasCalled); - start(); - }, 500); - } - else { + setTimeout(function() { + ok(warnWasCalled); + + fabric.warn = originalWarn; + start(); - } + }, 500); }); asyncTest('Object doesn\'t exist', function() { - var warnWasCalled = false; + var warnWasCalled = false, originalWarn = fabric.warn; function warn() { warnWasCalled = true; } - console.warn = warn; + fabric.warn = warn; - if (console.warn === warn) { - var originalObject = fabric.Object; - var originalText = fabric.Text; + var originalObject = fabric.Object; + var originalText = fabric.Text; - delete fabric.Text; - delete fabric.Object; + delete fabric.Text; + delete fabric.Object; - var el = document.createElement('script'); - el.src = '../../src/text.class.js'; - document.body.appendChild(el); + var el = document.createElement('script'); + el.src = '../../src/text.class.js'; + document.body.appendChild(el); - setTimeout(function() { - ok(warnWasCalled); + setTimeout(function() { + ok(warnWasCalled); - fabric.Object = originalObject; - fabric.Text = originalText; + fabric.Object = originalObject; + fabric.Text = originalText; + + fabric.warn = originalWarn; - start(); - }, 500); - } - else { start(); - } + }, 500); }); })(); \ No newline at end of file