diff --git a/jcanvas.js b/jcanvas.js index 85ebcdc..bdcca86 100755 --- a/jcanvas.js +++ b/jcanvas.js @@ -715,6 +715,7 @@ function hideProps(obj) { var i; for (i=0; ib&&(c.now[b]=N(c.now[b]));1!==c.start[3]||1!==c.end[3]?c.now="rgba("+c.now.join(",")+")":(c.now.slice(0,3),c.now="rgb("+c.now.join(",")+")"); -c.elem.style?c.elem.style[c.prop]=c.now:c.elem[c.prop]=c.now}function J(c){A.events[c]=function(a,b){var e="mouseover"===c||"mouseout"===c?"mousemove":c,i=b.event;b[e]||(a.bind(e+".jCanvas",function(b){i.x=b.offsetX;i.y=b.offsetY;i.type=e;a.drawLayers(o);b.preventDefault()}),b[e]=o)}}function G(c,a,b){var c=P(c),e=c.event,a=a.isPointInPath(e.x,e.y);b.mouseX=e.x;b.mouseY=e.y;!a&&(b._hovered&&!b._fired)&&(b._mousedout=o);a&&c.intersects.push(b)}function ha(c,a,b){var e,i=/\b(\d*\.?\d*)\w\w\b/gi;if(R=== -b.text&&S===b.font)b.width=T,b.height=U;else{b.width=a.measureText(b.text).width;a=c.style.fontSize;if(e=b.font.match(i))c.style.fontSize=b.font.match(i)[0];b.height=Z(d.css(c,"fontSize"));c.style.fontSize=a}}var M,$,w=d.extend,N=O.round,z=O.PI,ia=O.sin,V=O.cos,ka=d.event.fix;U=T=S=R=L=K=void 0;var I;d.fn.jCanvas=A;A.version="6.0b";A.events={};M={angle:0,align:"center",autosave:o,baseline:"middle",bringToFront:C,ccw:C,closed:C,compositing:"source-over",cornerRadius:0,cropFromCenter:o,draggable:!1, +"mousemove","mouseup"];for(b=0;bb&&(c.now[b]=N(c.now[b]));1!==c.start[3]||1!==c.end[3]?c.now="rgba("+c.now.join(",")+")":(c.now.slice(0,3),c.now="rgb("+c.now.join(",")+ +")");c.elem.style?c.elem.style[c.prop]=c.now:c.elem[c.prop]=c.now}function J(c){A.events[c]=function(a,b){var e="mouseover"===c||"mouseout"===c?"mousemove":c,i=b.event;b[e]||(a.bind(e+".jCanvas",function(b){i.x=b.offsetX;i.y=b.offsetY;i.type=e;a.drawLayers(o);b.preventDefault()}),b[e]=o)}}function G(c,a,b){var c=P(c),e=c.event,a=a.isPointInPath(e.x,e.y);b.mouseX=e.x;b.mouseY=e.y;!a&&(b._hovered&&!b._fired)&&(b._mousedout=o);a&&c.intersects.push(b)}function ha(c,a,b){var e,i=/\b(\d*\.?\d*)\w\w\b/gi; +if(R===b.text&&S===b.font)b.width=T,b.height=U;else{b.width=a.measureText(b.text).width;a=c.style.fontSize;if(e=b.font.match(i))c.style.fontSize=b.font.match(i)[0];b.height=Z(d.css(c,"fontSize"));c.style.fontSize=a}}var M,$,w=d.extend,N=O.round,z=O.PI,ia=O.sin,V=O.cos,ka=d.event.fix;U=T=S=R=L=K=void 0;var H;d.fn.jCanvas=A;A.version="6.0b";A.events={};M={angle:0,align:"center",autosave:o,baseline:"middle",bringToFront:C,ccw:C,closed:C,compositing:"source-over",cornerRadius:0,cropFromCenter:o,draggable:!1, each:f,end:360,fillStyle:"transparent",font:"12pt sans-serif",fromCenter:o,height:f,inDegrees:o,load:f,mask:C,method:f,miterLimit:10,opacity:1,projection:0,r1:f,r2:f,radius:0,repeat:"repeat",rotate:0,rounded:C,scale:1,scaleX:1,scaleY:1,shadowBlur:0,shadowColor:"transparent",shadowX:0,shadowY:0,sHeight:f,sides:3,source:"",start:0,strokeCap:"butt",strokeJoin:"miter",strokeStyle:"transparent",strokeWidth:1,sWidth:f,sx:f,sy:f,text:"",translate:0,translateX:0,translateY:0,visible:o,width:f,x:0,y:0};A(); A.extend=function(c){M=w(M,c.props);A();c.name&&(d.fn[c.name]=function(a){var b,e,i=w(new x,a);for(b=0;br-n-2*j&&(j=(r-n)/2),0>t-y-2*j&&(j=(t-y)/2),g.moveTo(n+j,y),g.lineTo(r-j,y),g.arc(r-j,y+j,j,3*z/2,2*z,C),g.lineTo(r,t-j),g.arc(r-j,t-j,j,0,z/2,C),g.lineTo(n+j,t),g.arc(n+j,t-j,j,z/2,z,C),g.lineTo(n,y+j),g.arc(n+j,y+j,j,z,3*z/2,C)):g.rect(n,y,d.width,d.height),d._event&&G(this[i],g,e),H(g,d);return this};d.fn.drawArc=function e(d){var g,f,n=w(new x,d);!n.inDegrees&&360===n.end&&(n.end=2*z);for(g=0;gu.width&&(h.sx=u.width-h.sWidth/2),0>h.sx-h.sWidth/2&&(h.sx=h.sWidth/2),0>h.sy-h.sHeight/2&&(h.sy=h.sHeight/2),h.sy+h.sHeight/2>u.height&&(h.sy=u.height-h.sHeight/2),h.width!==f&&h.height===f)?d.height=h.height=h.width/s:h.width===f&&h.height!==f?d.width=h.width=h.height*s:h.width===f&&h.height===f&&(d.width= -h.width=u.width,d.height=h.height=u.height));E(t,k,h,h.width,h.height);k.drawImage(u,h.sx-h.sWidth/2,h.sy-h.sHeight/2,h.sWidth,h.sHeight,h.x-h.width/2,h.y-h.height/2,h.width,h.height);h._event?(k.beginPath(),k.rect(h.x-h.width/2,h.y-h.height/2,h.width,h.height),k.restore(),G(m[t],k,d),k.closePath()):k.restore();h.load&&h.load.call(l,d)}}var m=this,p,q,k,h=w(new x,d),u,o,s;o=h.source.getContext;h.source.src||o?(u=h.source,h.width=u.width,h.height=u.height):h.source&&(u=new Y,u.src=h.source);for(q= -0;qq&&(l[h]=l[k])}else l[k]===f&&(o+=1,l[k]=p+o*((q-p)/u));j.addColorStop(l[k],d["c"+(k+1)])}}else j=f;return j};d.fn.setPixels=function j(d){var f,p,q,k=w(new x,d),h={},u,o,s,z;for(p=0;pr-n-2*j&&(j=(r-n)/2),0>t-y-2*j&&(j=(t-y)/2),g.moveTo(n+j,y),g.lineTo(r-j,y),g.arc(r-j,y+j,j,3*z/2,2*z,C),g.lineTo(r,t-j),g.arc(r-j,t-j,j,0,z/2,C),g.lineTo(n+j,t),g.arc(n+j,t-j,j,z/2,z,C),g.lineTo(n,y+j),g.arc(n+j,y+j,j,z,3*z/2,C)):g.rect(n,y,d.width,d.height),d._event&&G(this[i],g,e),I(g,d);return this};d.fn.drawArc=function e(d){var g,f,n=w(new x,d),d=d||{};!n.inDegrees&&360===n.end&&(d.end=n.end=2*z);for(g=0;gu.width&&(h.sx=u.width-h.sWidth/2),0>h.sx-h.sWidth/2&&(h.sx=h.sWidth/2),0>h.sy-h.sHeight/2&&(h.sy=h.sHeight/2),h.sy+h.sHeight/2>u.height&&(h.sy=u.height-h.sHeight/2),h.width!==f&&h.height===f)?d.height=h.height=h.width/s:h.width===f&&h.height!== +f?d.width=h.width=h.height*s:h.width===f&&h.height===f&&(d.width=h.width=u.width,d.height=h.height=u.height));E(t,k,h,h.width,h.height);k.drawImage(u,h.sx-h.sWidth/2,h.sy-h.sHeight/2,h.sWidth,h.sHeight,h.x-h.width/2,h.y-h.height/2,h.width,h.height);h._event?(k.beginPath(),k.rect(h.x-h.width/2,h.y-h.height/2,h.width,h.height),k.restore(),G(m[t],k,d),k.closePath()):k.restore();h.load&&h.load.call(l,d)}}var m=this,p,q,k,h=w(new x,d),u,o,s;o=h.source.getContext;h.source.src||o?(u=h.source,h.width=u.width, +h.height=u.height):h.source&&(u=new Y,u.src=h.source);for(q=0;qq&&(l[h]=l[k])}else l[k]===f&&(o+=1,l[k]=p+o*((q-p)/u));j.addColorStop(l[k],d["c"+(k+1)])}}else j=f;return j};d.fn.setPixels=function j(d){var f,p,q,k=w(new x,d),h={},u,o,s,z;for(p=0;p