/* The MIT License Copyright (c) 2010-2011-2012 Ibon Tolosana [@hyperandroid] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Version: 0.6 build: 6 Created on: DATE: 2013-07-01 TIME: 04:58:33 */ (function(a,b){function c(b){for(var b=b.split("."),c=a,d=null,e=0;e NOT solved."))},removeDependency:function(a){for(var b=0;b Can't extend non-existant class: "+this.baseClass);return}}else b=f;b.extend(this.extendWith,this.constants,this.name,this.aliases,{decorated:this.decorated});console.log("Created module: "+this.name);this.callback&&this.callback()}};var h=function(a,b){this.path=a;this.module=b;return this};h.prototype={path:null,processed:false,module:null,setProcessed:function(){this.processed=true},isProcessed:function(){return this.processed}};var i=function(){this.nodes=[];this.loadedFiles=[]; this.path={};this.solveListener=[];this.orderedSolvedModules=[];this.readyListener=[];return this};i.baseURL="";i.modulePath={};i.sortedModulePath=[];i.symbol={};i.prototype={nodes:null,loadedFiles:null,solveListener:null,readyListener:null,orderedSolvedModules:null,addSolvedListener:function(a,b){this.solveListener.push({name:a,callback:b})},solved:function(a){var b;for(b=0;b catched "+ d+" on module "+a.defines+" preCreation.")}if(!a.depends)a.depends=[];if((b=a.depends)&&!isArray(b))b=[b],a.depends=b;for(c=0;c=0&&b>0,b[5]>>0);return this},transformRenderingContext_Clamp:function(a){var b=this.matrix;a.transform(b[0],b[3],b[1],b[4],b[2]>>0,b[5]>>0);return this},setModelViewMatrix:function(a,b,c,d,e){var f,g,h,i,j,k;k= this.matrix;d=1;j=g=0;i=1;c=Math.cos(e);e=Math.sin(e);f=d;h=j;d=f*c+g*e;g=-f*e+g*c;j=h*c+i*e;i=-h*e+i*c;d*=this.scaleX;g*=this.scaleY;j*=this.scaleX;i*=this.scaleY;k[0]=d;k[1]=g;k[2]=a;k[3]=j;k[4]=i;k[5]=b}}}}); CAAT.Module({defines:"CAAT.Math.Matrix3",aliases:["CAAT.Matrix3"],extendsWith:function(){return{matrix:null,fmatrix:null,__init:function(){this.matrix=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.fmatrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return this},transformCoord:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.matrix[0][0]+c*this.matrix[0][1]+d*this.matrix[0][2]+this.matrix[0][3];a.y=b*this.matrix[1][0]+c*this.matrix[1][1]+d*this.matrix[1][2]+this.matrix[1][3];a.z=b*this.matrix[2][0]+c*this.matrix[2][1]+ d*this.matrix[2][2]+this.matrix[2][3];return a},initialize:function(a,b,c,d,e,f,g,h,i){this.identity();this.matrix[0][0]=a;this.matrix[0][1]=b;this.matrix[0][2]=c;this.matrix[1][0]=d;this.matrix[1][1]=e;this.matrix[1][2]=f;this.matrix[2][0]=g;this.matrix[2][1]=h;this.matrix[2][2]=i;return this},initWithMatrix:function(a){this.matrix=a;return this},flatten:function(){var a=this.fmatrix,b=this.matrix;a[0]=b[0][0];a[1]=b[1][0];a[2]=b[2][0];a[3]=b[3][0];a[4]=b[0][1];a[5]=b[1][1];a[6]=b[2][1];a[7]=b[2][1]; a[8]=b[0][2];a[9]=b[1][2];a[10]=b[2][2];a[11]=b[3][2];a[12]=b[0][3];a[13]=b[1][3];a[14]=b[2][3];a[15]=b[3][3];return this.fmatrix},identity:function(){for(var a=0;a<4;a++)for(var b=0;b<4;b++)this.matrix[a][b]=a===b?1:0;return this},getMatrix:function(){return this.matrix},rotateXY:function(a){return this.rotate(a,0,0)},rotateXZ:function(a){return this.rotate(0,a,0)},rotateYZ:function(a){return this.rotate(0,0,a)},setRotate:function(a,b,c){this.copy(this.rotate(a,b,c));return this},rotate:function(a, b,c){var d=new CAAT.Math.Matrix3,e,f;a!==0&&(f=new CAAT.Math.Math.Matrix3,e=Math.sin(a),a=Math.cos(a),f.matrix[1][1]=a,f.matrix[1][2]=-e,f.matrix[2][1]=e,f.matrix[2][2]=a,d.multiply(f));b!==0&&(f=new CAAT.Math.Matrix3,e=Math.sin(b),a=Math.cos(b),f.matrix[0][0]=a,f.matrix[0][2]=-e,f.matrix[2][0]=e,f.matrix[2][2]=a,d.multiply(f));c!==0&&(f=new CAAT.Math.Matrix3,e=Math.sin(c),a=Math.cos(c),f.matrix[0][0]=a,f.matrix[0][1]=-e,f.matrix[1][0]=e,f.matrix[1][1]=a,d.multiply(f));return d},getClone:function(){var a= new CAAT.Math.Matrix3;a.copy(this);return a},multiply:function(a){var b=this.getClone().matrix,c=b[0][0],d=b[0][1],e=b[0][2],f=b[0][3],g=b[1][0],h=b[1][1],i=b[1][2],j=b[1][3],k=b[2][0],m=b[2][1],o=b[2][2],b=b[2][3],n=a.matrix,a=n[0][0],p=n[0][1],q=n[0][2],r=n[0][3],u=n[1][0],t=n[1][1],s=n[1][2],w=n[1][3],v=n[2][0],x=n[2][1],y=n[2][2],z=n[2][3],A=n[3][0],B=n[3][1],C=n[3][2],n=n[3][3];this.matrix[0][0]=c*a+d*u+e*v+f*A;this.matrix[0][1]=c*p+d*t+e*x+f*B;this.matrix[0][2]=c*q+d*s+e*y+f*C;this.matrix[0][3]= c*r+d*w+e*z+f*n;this.matrix[1][0]=g*a+h*u+i*v+j*A;this.matrix[1][1]=g*p+h*t+i*x+j*B;this.matrix[1][2]=g*q+h*s+i*y+j*C;this.matrix[1][3]=g*r+h*w+i*z+j*n;this.matrix[2][0]=k*a+m*u+o*v+b*A;this.matrix[2][1]=k*p+m*t+o*x+b*B;this.matrix[2][2]=k*q+m*s+o*y+b*C;this.matrix[2][3]=k*r+m*w+o*z+b*n;return this},premultiply:function(a){var b=this.getClone().matrix,c=b[0][0],d=b[0][1],e=b[0][2],f=b[0][3],g=b[1][0],h=b[1][1],i=b[1][2],j=b[1][3],k=b[2][0],m=b[2][1],o=b[2][2],b=b[2][3],n=a.matrix,a=n[0][0],p=n[0][1], q=n[0][2],r=n[0][3],u=n[1][0],t=n[1][1],s=n[1][2],w=n[1][3],v=n[2][0],x=n[2][1],y=n[2][2],n=n[2][3];this.matrix[0][0]=c*a+d*u+e*v;this.matrix[0][1]=c*p+d*t+e*x;this.matrix[0][2]=c*q+d*s+e*y;this.matrix[0][3]=c*r+d*w+e*n+f;this.matrix[1][0]=g*a+h*u+i*v;this.matrix[1][1]=g*p+h*t+i*x;this.matrix[1][2]=g*q+h*s+i*y;this.matrix[1][3]=g*r+h*w+i*n+j;this.matrix[2][0]=k*a+m*u+o*v;this.matrix[2][1]=k*p+m*t+o*x;this.matrix[2][2]=k*q+m*s+o*y;this.matrix[2][3]=k*r+m*w+o*n+b;return this},setTranslate:function(a, b,c){this.identity();this.matrix[0][3]=a;this.matrix[1][3]=b;this.matrix[2][3]=c;return this},translate:function(a,b,c){var d=new CAAT.Math.Matrix3;d.setTranslate(a,b,c);return d},setScale:function(a,b,c){this.identity();this.matrix[0][0]=a;this.matrix[1][1]=b;this.matrix[2][2]=c;return this},scale:function(a,b,c){var d=new CAAT.Math.Matrix3;d.setScale(a,b,c);return d},rotateModelView:function(a,b,c){var d=Math.sin(a),e=Math.sin(b),f=Math.sin(c),a=Math.cos(a),b=Math.cos(b),c=Math.cos(c);this.matrix[0][0]= b*a;this.matrix[0][1]=-b*d;this.matrix[0][2]=e;this.matrix[0][3]=0;this.matrix[1][0]=f*e*a+d*c;this.matrix[1][1]=c*a-f*e*d;this.matrix[1][2]=-f*b;this.matrix[1][3]=0;this.matrix[2][0]=f*d-c*e*a;this.matrix[2][1]=c*e*d+f*a;this.matrix[2][2]=c*b;this.matrix[2][3]=0;this.matrix[3][0]=0;this.matrix[3][1]=0;this.matrix[3][2]=0;this.matrix[3][3]=1;return this},copy:function(a){for(var b=0;b<4;b++)for(var c=0;c<4;c++)this.matrix[b][c]=a.matrix[b][c];return this},calculateDeterminant:function(){var a=this.matrix, b=a[0][0],c=a[0][1],d=a[0][2],e=a[0][3],f=a[1][0],g=a[1][1],h=a[1][2],i=a[1][3],j=a[2][0],k=a[2][1],m=a[2][2],o=a[2][3],n=a[3][0],p=a[3][1],q=a[3][2],a=a[3][3];return e*g*m*n+c*i*m*n+e*h*j*p+d*i*j*p+d*f*o*p+b*h*o*p+e*f*k*q+b*i*k*q+d*g*j*a+c*h*j*a+c*f*m*a+b*g*m*a+e*h*k*n-d*i*k*n-d*g*o*n-c*h*o*n-e*f*m*p-b*i*m*p-e*g*j*q-c*i*j*q-c*f*o*q-b*g*o*q-d*f*k*a-b*h*k*a},getInverse:function(){var a=this.matrix,b=a[0][0],c=a[0][1],d=a[0][2],e=a[0][3],f=a[1][0],g=a[1][1],h=a[1][2],i=a[1][3],j=a[2][0],k=a[2][1],m= a[2][2],o=a[2][3],n=a[3][0],p=a[3][1],q=a[3][2],a=a[3][3],r=new CAAT.Math.Matrix3;r.matrix[0][0]=h*o*p+i*k*q+g*m*a-i*m*p-g*o*q-h*k*a;r.matrix[0][1]=e*m*p+c*o*q+d*k*a-c*m*a-d*o*p-e*k*q;r.matrix[0][2]=d*i*p+c*h*a+e*g*q-c*i*q-d*g*a-e*h*p;r.matrix[0][3]=e*h*k+c*i*m+d*g*o-d*i*k-e*g*m-c*h*o;r.matrix[1][0]=i*m*n+f*o*q+h*j*a-h*o*n-i*j*q-f*m*a;r.matrix[1][1]=d*o*n+e*j*q+b*m*a-e*m*n-b*o*q-d*j*a;r.matrix[1][2]=e*h*n+b*i*q+d*f*a-d*i*n-e*f*q-b*h*a;r.matrix[1][3]=d*i*j+e*f*m+b*h*o-e*h*j-b*i*m-d*f*o;r.matrix[2][0]= g*o*n+i*j*p+f*k*a-i*k*n-f*o*p-g*j*a;r.matrix[2][1]=e*k*n+b*o*p+c*j*a-b*k*a-c*o*n-e*j*p;r.matrix[2][2]=d*i*n+e*f*p+b*g*a-e*g*n-b*i*p-c*f*a;r.matrix[2][3]=e*g*j+b*i*k+c*f*o-b*g*o-c*i*j-e*f*k;r.matrix[3][0]=h*k*n+f*m*p+g*j*q-g*m*n-h*j*p-f*k*q;r.matrix[3][1]=c*m*n+d*j*p+b*k*q-d*k*n-b*m*p-c*j*q;r.matrix[3][2]=d*g*n+b*h*p+c*f*q-b*g*q-c*h*n-d*f*p;r.matrix[3][3]=c*h*j+d*f*k+b*g*m-d*g*j-b*h*k-c*f*m;return r.multiplyScalar(1/this.calculateDeterminant())},multiplyScalar:function(a){var b,c;for(b=0;b<4;b++)for(c= 0;c<4;c++)this.matrix[b][c]*=a;return this}}}}); CAAT.Module({defines:"CAAT.Math.Point",aliases:["CAAT.Point"],extendsWith:function(){return{x:0,y:0,z:0,__init:function(a,b,c){this.x=a;this.y=b;this.z=c||0;return this},set:function(a,b,c){this.x=a;this.y=b;this.z=c||0;return this},clone:function(){return new CAAT.Math.Point(this.x,this.y,this.z)},translate:function(a,b,c){this.x+=a;this.y+=b;this.z+=c;return this},translatePoint:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},subtract:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z; return this},multiply:function(a){this.x*=a;this.y*=a;this.z*=a;return this},rotate:function(a){var b=this.x,c=this.y;this.x=b*Math.cos(a)-Math.sin(a)*c;this.y=b*Math.sin(a)+Math.cos(a)*c;this.z=0;return this},setAngle:function(a){var b=this.getLength();this.x=Math.cos(a)*b;this.y=Math.sin(a)*b;this.z=0;return this},setLength:function(a){var b=this.getLength();b?this.multiply(a/b):this.x=this.y=this.z=a;return this},normalize:function(){var a=this.getLength();this.x/=a;this.y/=a;this.z/=a;return this}, getAngle:function(){return Math.atan2(this.y,this.x)},limit:function(a){var b=this.getLengthSquared();if(b+0.01>a*a)b=Math.sqrt(b),this.x=this.x/b*a,this.y=this.y/b*a,this.z=this.z/b*a;return this},getLength:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return a<0.0050&&a>-0.0050?1.0E-6:a},getLengthSquared:function(){var a=this.x*this.x+this.y*this.y+this.z*this.z;return a<0.0050&&a>-0.0050?0:a},getDistance:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return Math.sqrt(b* b+c*c+a*a)},getDistanceSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},toString:function(){return"(CAAT.Math.Point) x:"+String(Math.round(Math.floor(this.x*10))/10)+" y:"+String(Math.round(Math.floor(this.y*10))/10)+" z:"+String(Math.round(Math.floor(this.z*10))/10)}}}}); CAAT.Module({defines:"CAAT.Math.Rectangle",aliases:["CAAT.Rectangle"],extendsWith:function(){return{__init:function(a,b,c,d){arguments.length!==4?this.setEmpty():(this.setLocation(a,b),this.setDimension(c,d))},x:0,y:0,x1:0,y1:0,width:-1,height:-1,setEmpty:function(){this.height=this.width=-1;this.y1=this.x1=this.y=this.x=0;return this},setLocation:function(a,b){this.x=a;this.y=b;this.x1=this.x+this.width;this.y1=this.y+this.height;return this},setDimension:function(a,b){this.width=a;this.height=b; this.x1=this.x+this.width;this.y1=this.y+this.height;return this},setBounds:function(a,b,c,d){this.setLocation(a,b);this.setDimension(c,d);return this},contains:function(a,b){return a>=this.x&&a=this.y&&bthis.y1)this.y1= b;if(a>this.x1)this.x1=a;this.width=this.x1-this.x;this.height=this.y1-this.y}},unionRectangle:function(a){this.union(a.x,a.y);this.union(a.x1,a.y);this.union(a.x,a.y1);this.union(a.x1,a.y1);return this},intersects:function(a){return a.isEmpty()||this.isEmpty()?false:a.x1<=this.x?false:a.x>=this.x1?false:a.y1<=this.y?false:a.ythis.x1?false:b+d-1=this.behaviorStartTime&&(a=(a-this.behaviorStartTime)%this.behaviorDuration+this.behaviorStartTime);if(a>this.behaviorStartTime+this.behaviorDuration)return this.status!== e.EXPIRED&&this.setExpired(b,a),false;if(this.status===e.NOT_STARTED)this.status=e.STARTED,this.fireBehaviorStartedEvent(b,a);return this.behaviorStartTime<=a},fireBehaviorStartedEvent:function(a,b){for(var e=0,f=this.lifecycleListenerList.length;e>=0;for(var d= "@-"+a+"-keyframes "+b+" {",a=0;a<=c;a++)b=""+a/c*100+"%{opacity: "+this.calculateKeyFrameData(a/c)+"}",d+=b;d+="}";return d}}}}); CAAT.Module({defines:"CAAT.Behavior.ContainerBehavior",depends:["CAAT.Behavior.BaseBehavior","CAAT.Behavior.GenericBehavior"],aliases:["CAAT.ContainerBehavior"],extendsClass:"CAAT.Behavior.BaseBehavior",extendsWith:function(){return{parse:function(a){if(a.behaviors&&a.behaviors.length)for(var b=0;b=d)){d=(d-c.behaviorStartTime)/c.behaviorDuration; c=c.getKeyFrameDataValues(d);for(var f in c)e[f]=c[f]}return e},calculateKeyFrameData:function(a,b){function c(a){if(f[a])h+=f[a];else if(prevValues&&(i=prevValues[a]))h+=i,f[a]=i}var d,e,f={},g;for(d=0;d=g&&(g=(g-e.behaviorStartTime)/e.behaviorDuration,g=e.calculateKeyFrameData(g), e=e.getPropertyName(b),typeof f[e]==="undefined"&&(f[e]=""),f[e]+=g+" "));var h="",i;c("translate");c("rotate");c("scale");d="";h&&(d="-"+b+"-transform: "+h+";");h="";c("opacity");h&&(d+=" opacity: "+h+";");d+=" -webkit-transform-origin: 0% 0%";return{rules:d,ret:f}},calculateKeyFramesData:function(a,b,c,d,e){if(this.duration===Number.MAX_VALUE)return"";typeof d==="undefined"&&(d=0.5);typeof e==="undefined"&&(e=0.5);typeof c==="undefined"&&(c=100);for(var f="@-"+a+"-keyframes "+b+" {",g,h={},b=0;b<= c;b++){g=this.interpolator.getPosition(b/c).y;g=this.getKeyFrameDataValues(g);var i=""+b/c*100+"%{",j=g,k=void 0;for(k in h)j[k]||(j[k]=h[k]);h="-"+a+"-transform:";if(j.x||j.y)h+="translate("+(j.x||0)+"px,"+(j.y||0)+"px)";j.angle&&(h+=" rotate("+j.angle+"rad)");if(j.scaleX!==1||j.scaleY!==1)h+=" scale("+j.scaleX+","+j.scaleY+")";h+=";";j.alpha&&(h+=" opacity: "+j.alpha+";");if(d!==0.5||e!==0.5)h+=" -"+a+"-transform-origin:"+d*100+"% "+e*100+"%;";f+=i+h+"}\n";h=g}f+="}\n";return f}}}}); CAAT.Module({defines:"CAAT.Behavior.GenericBehavior",depends:["CAAT.Behavior.BaseBehavior"],aliases:["CAAT.GenericBehavior"],extendsClass:"CAAT.Behavior.BaseBehavior",extendsWith:function(){return{start:0,end:0,target:null,property:null,callback:null,setForTime:function(a,b){var c=this.start+a*(this.end-this.start);this.callback&&this.callback(c,this.target,b);this.property&&(this.target[this.property]=c)},setValues:function(a,b,c,d,e){this.start=a;this.end=b;this.target=c;this.property=d;this.callback= e;return this}}}}); CAAT.Module({defines:"CAAT.Behavior.PathBehavior",aliases:["CAAT.PathBehavior"],depends:["CAAT.Behavior.BaseBehavior","CAAT.Foundation.SpriteImage"],constants:{AUTOROTATE:{LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1,FREE:2},autorotate:{LEFT_TO_RIGHT:0,RIGHT_TO_LEFT:1,FREE:2}},extendsClass:"CAAT.Behavior.BaseBehavior",extendsWith:function(){return{parse:function(a){CAAT.Behavior.PathBehavior.superclass.parse.call(this,a);a.SVG&&this.setValues((new CAAT.PathUtil.SVGPath).parsePath(a.SVG));if(a.autoRotate)this.autoRotate=a.autoRotate}, path:null,autoRotate:false,prevX:-1,prevY:-1,autoRotateOp:CAAT.Behavior.PathBehavior.autorotate.FREE,isOpenContour:false,relativeX:0,relativeY:0,setOpenContour:function(a){this.isOpenContour=a;return this},getPropertyName:function(){return"translate"},setRelativeValues:function(a,b){this.relativeX=a;this.relativeY=b;this.isRelative=true;return this},setAutoRotate:function(a,b){this.autoRotate=a;if(b!==void 0)this.autoRotateOp=b;return this},setPath:function(a){this.path=a;return this},setValues:function(a){return this.setPath(a)}, setTranslation:function(){return this},calculateKeyFrameData:function(a){a=this.interpolator.getPosition(a).y;a=this.path.getPosition(a);return"translateX("+a.x+"px) translateY("+a.y+"px)"},getKeyFrameDataValues:function(a){var a=this.interpolator.getPosition(a).y,b=this.path.getPosition(a),c={x:b.x,y:b.y};if(this.autoRotate)a=a===0?b:this.path.getPosition(a-0.0010),b=Math.atan2(b.y-a.y,b.x-a.x),c.angle=b;return c},calculateKeyFramesData:function(a,b,c){typeof c==="undefined"&&(c=100);c>>=0;for(var d, e="@-"+a+"-keyframes "+b+" {",b=0;b<=c;b++)d=""+b/c*100+"%{-"+a+"-transform:"+this.calculateKeyFrameData(b/c)+"}",e+=d;e+="}";return e},setForTime:function(a,b){if(!this.path)return{x:b.x,y:b.y};var c=this.path.getPosition(a,this.isOpenContour,0.0010);this.isRelative&&(c.x+=this.relativeX,c.y+=this.relativeY);if(this.autoRotate){if(-1===this.prevX&&-1===this.prevY)this.prevX=c.x,this.prevY=c.y;var d=c.x-this.prevX,e=c.y-this.prevY;if(d===0&&e===0)return b.setLocation(c.x,c.y),{x:b.x,y:b.y};var f= Math.atan2(e,d),g=CAAT.Foundation.SpriteImage,h=CAAT.Behavior.PathBehavior.AUTOROTATE;this.autoRotateOp===h.LEFT_TO_RIGHT?this.prevX<=c.x?b.setImageTransformation(g.TR_NONE):(b.setImageTransformation(g.TR_FLIP_HORIZONTAL),f+=Math.PI):this.autoRotateOp===h.RIGHT_TO_LEFT&&(this.prevX<=c.x?b.setImageTransformation(g.TR_FLIP_HORIZONTAL):(b.setImageTransformation(g.TR_NONE),f-=Math.PI));b.setRotation(f);this.prevX=c.x;this.prevY=c.y;Math.sqrt(d*d+e*e)}return this.doValueApplication?(b.setLocation(c.x, c.y),{x:b.x,y:b.y}):{x:c.x,y:c.y}},positionOnTime:function(a){return this.isBehaviorInTime(a,null)?(a=this.normalizeTime(a),this.path.getPosition(a)):{x:-1,y:-1}}}}}); CAAT.Module({defines:"CAAT.Behavior.RotateBehavior",extendsClass:"CAAT.Behavior.BaseBehavior",depends:["CAAT.Behavior.BaseBehavior","CAAT.Foundation.Actor"],aliases:["CAAT.RotateBehavior"],extendsWith:function(){return{__init:function(){this.__super();this.anchor=CAAT.Foundation.Actor.ANCHOR_CENTER;return this},parse:function(a){CAAT.Behavior.RotateBehavior.superclass.parse.call(this,a);this.startAngle=a.start||0;this.endAngle=a.end||0;this.anchorX=typeof a.anchorX!=="undefined"?parseInt(a.anchorX): 0.5;this.anchorY=typeof a.anchorY!=="undefined"?parseInt(a.anchorY):0.5},startAngle:0,endAngle:0,anchorX:0.5,anchorY:0.5,rotationRelative:0,setRelativeValues:function(a){this.rotationRelative=a;this.isRelative=true;return this},getPropertyName:function(){return"rotate"},setForTime:function(a,b){var c=this.startAngle+a*(this.endAngle-this.startAngle);this.isRelative&&(c+=this.rotationRelative,c>=Math.PI&&(c-=2*Math.PI),c<-2*Math.PI&&(c+=2*Math.PI));this.doValueApplication&&b.setRotationAnchored(c, this.anchorX,this.anchorY);return c},setValues:function(a,b,c,d){this.startAngle=a;this.endAngle=b;if(typeof c!=="undefined"&&typeof d!=="undefined")this.anchorX=c,this.anchorY=d;return this},setAngles:function(a,b){return this.setValues(a,b)},setAnchor:function(a,b,c){this.anchorX=b/a.width;this.anchorY=c/a.height;return this},calculateKeyFrameData:function(a){a=this.interpolator.getPosition(a).y;return"rotate("+(this.startAngle+a*(this.endAngle-this.startAngle))+"rad)"},getKeyFrameDataValues:function(a){a= this.interpolator.getPosition(a).y;return{angle:this.startAngle+a*(this.endAngle-this.startAngle)}},calculateKeyFramesData:function(a,b,c){typeof c==="undefined"&&(c=100);c>>=0;for(var d,e="@-"+a+"-keyframes "+b+" {",b=0;b<=c;b++)d=""+b/c*100+"%{-"+a+"-transform:"+this.calculateKeyFrameData(b/c)+"; -"+a+"-transform-origin:"+this.anchorX*100+"% "+this.anchorY*100+"% }\n",e+=d;e+="}\n";return e}}}}); CAAT.Module({defines:"CAAT.Behavior.Scale1Behavior",depends:["CAAT.Behavior.BaseBehavior","CAAT.Foundation.Actor"],aliases:["CAAT.Scale1Behavior"],constants:{AXIS:{X:0,Y:1},Axis:{X:0,Y:1}},extendsClass:"CAAT.Behavior.BaseBehavior",extendsWith:function(){return{__init:function(){this.__super();this.anchor=CAAT.Foundation.Actor.ANCHOR_CENTER;return this},startScale:1,endScale:1,anchorX:0.5,anchorY:0.5,applyOnX:true,parse:function(a){CAAT.Behavior.Scale1Behavior.superclass.parse.call(this,a);this.startScale= a.start||0;this.endScale=a.end||0;this.anchorX=typeof a.anchorX!=="undefined"?parseInt(a.anchorX):0.5;this.anchorY=typeof a.anchorY!=="undefined"?parseInt(a.anchorY):0.5;this.applyOnX=a.axis?a.axis.toLowerCase()==="x":true},applyOnAxis:function(a){this.applyOnX=a===CAAT.Behavior.Scale1Behavior.AXIS.X?false:true},getPropertyName:function(){return"scale"},setForTime:function(a,b){var c=this.startScale+a*(this.endScale-this.startScale);0===c&&(c=0.01);this.doValueApplication&&(this.applyOnX?b.setScaleAnchored(c, b.scaleY,this.anchorX,this.anchorY):b.setScaleAnchored(b.scaleX,c,this.anchorX,this.anchorY));return c},setValues:function(a,b,c,d,e){this.startScale=a;this.endScale=b;this.applyOnX=!!c;if(typeof d!=="undefined"&&typeof e!=="undefined")this.anchorX=d,this.anchorY=e;return this},setAnchor:function(a,b,c){this.anchorX=b/a.width;this.anchorY=c/a.height;return this},calculateKeyFrameData:function(a){a=this.interpolator.getPosition(a).y;a=this.startScale+a*(this.endScale-this.startScale);return this.applyOnX? "scaleX("+a+")":"scaleY("+a+")"},getKeyFrameDataValues:function(a){var a=this.interpolator.getPosition(a).y,b={};b[this.applyOnX?"scaleX":"scaleY"]=this.startScale+a*(this.endScale-this.startScale);return b},calculateKeyFramesData:function(a,b,c){typeof c==="undefined"&&(c=100);c>>=0;for(var d,e="@-"+a+"-keyframes "+b+" {",b=0;b<=c;b++)d=""+b/c*100+"%{-"+a+"-transform:"+this.calculateKeyFrameData(b/c)+"; -"+a+"-transform-origin:"+this.anchorX*100+"% "+this.anchorY*100+"% }\n",e+=d;e+="}\n";return e}}}}); CAAT.Module({defines:"CAAT.Behavior.ScaleBehavior",depends:["CAAT.Behavior.BaseBehavior","CAAT.Foundation.Actor"],extendsClass:"CAAT.Behavior.BaseBehavior",aliases:["CAAT.ScaleBehavior"],extendsWith:function(){return{__init:function(){this.__super();this.anchor=CAAT.Foundation.Actor.ANCHOR_CENTER;return this},startScaleX:1,endScaleX:1,startScaleY:1,endScaleY:1,anchorX:0.5,anchorY:0.5,parse:function(a){CAAT.Behavior.ScaleBehavior.superclass.parse.call(this,a);this.startScaleX=a.scaleX&&a.scaleX.start|| 0;this.endScaleX=a.scaleX&&a.scaleX.end||0;this.startScaleY=a.scaleY&&a.scaleY.start||0;this.endScaleY=a.scaleY&&a.scaleY.end||0;this.anchorX=typeof a.anchorX!=="undefined"?parseInt(a.anchorX):0.5;this.anchorY=typeof a.anchorY!=="undefined"?parseInt(a.anchorY):0.5},getPropertyName:function(){return"scale"},setForTime:function(a,b){var c=this.startScaleX+a*(this.endScaleX-this.startScaleX),d=this.startScaleY+a*(this.endScaleY-this.startScaleY);0===c&&(c=0.01);0===d&&(d=0.01);this.doValueApplication&& b.setScaleAnchored(c,d,this.anchorX,this.anchorY);return{scaleX:c,scaleY:d}},setValues:function(a,b,c,d,e,f){this.startScaleX=a;this.endScaleX=b;this.startScaleY=c;this.endScaleY=d;if(typeof e!=="undefined"&&typeof f!=="undefined")this.anchorX=e,this.anchorY=f;return this},setAnchor:function(a,b,c){this.anchorX=b/a.width;this.anchorY=c/a.height;return this},calculateKeyFrameData:function(a){a=this.interpolator.getPosition(a).y;return"scale("+(this.startScaleX+a*(this.endScaleX-this.startScaleX))+ ","+(this.startScaleY+a*(this.endScaleY-this.startScaleY))+")"},getKeyFrameDataValues:function(a){a=this.interpolator.getPosition(a).y;return{scaleX:this.startScaleX+a*(this.endScaleX-this.startScaleX),scaleY:this.startScaleY+a*(this.endScaleY-this.startScaleY)}},calculateKeyFramesData:function(a,b,c){typeof c==="undefined"&&(c=100);c>>=0;for(var d,e="@-"+a+"-keyframes "+b+" {",b=0;b<=c;b++)d=""+b/c*100+"%{-"+a+"-transform:"+this.calculateKeyFrameData(b/c)+"; -"+a+"-transform-origin:"+this.anchorX* 100+"% "+this.anchorY*100+"% }\n",e+=d;e+="}\n";return e}}}}); CAAT.Module({defines:"CAAT.Module.Runtime.BrowserInfo",constants:function(){function a(a){for(var b=0;b0?(a=this.channels.shift(),a.src=b.src,a.volume=b.volume,a.play(),this.workingChannels.push(a)):console.log("Can't play audio: "+a);return b},cancelPlay:function(a){for(var b=0;this.workingChannels.length;b++){var c=this.workingChannels[b];c.caat_id===a&&(c.pause(),this.channels.push(c),this.workingChannels.splice(b,1))}return this},cancelPlayByChannel:function(a){for(var b=0;this.workingChannels.length;b++)if(this.workingChannels[b]=== a){this.channels.push(a);this.workingChannels.splice(b,1);break}return this},loop:function(a){if(!this.musicEnabled)return null;a=this.getAudio(a);if(null!==a){var b=document.createElement("audio");if(null!==b)return b.src=a.src,b.preload="auto",this.isFirefox?b.addEventListener("ended",function(a){a.target.currentTime=0},false):b.loop=true,b.load(),b.play(),this.loopingChannels.push(b),b}return null},endSound:function(){var a;for(a=0;a=g)return{r:d,g:e,b:f};a=a+(d-a)/g*h>>0;b=b+(e-b)/g*h>>0;c=c+(f-c)/g*h>>0;a>255?a=255:a<0&&(a=0);b>255?b=255:b<0&&(b=0);c>255?c=255:c<0&&(c=0);return{r:a,g:b,b:c}},makeRGBColorRamp:function(a,b,c){var d= [],e=a.length-1;b/=e;var f,g,h,i,j,k,m,o,n,p,q,r,u,t;for(f=0;f>24&255;n=(m&16711680)>>16;p=(m&65280)>>8;m&=255;g=a[f+1];q=g>>24&255;r=(g&16711680)>>16;u=(g&65280)>>8;g&=255;q=(q-o)/b;r=(r-n)/b;u=(u-p)/b;t=(g-m)/b;for(g=0;g>0;i=n+r*g>>0;j=p+u*g>>0;k=m+t*g>>0;var s=CAAT.Module.ColorUtil.Color.RampEnumeration;switch(c){case s.RAMP_RGBA:d.push("argb("+h+","+i+","+j+","+k+")");break;case s.RAMP_RGB:d.push("rgb("+i+","+j+","+k+")");break;case s.RAMP_CHANNEL_RGB:d.push(4278190080| i<<16|j<<8|k);break;case s.RAMP_CHANNEL_RGBA:d.push(h<<24|i<<16|j<<8|k);break;case s.RAMP_CHANNEL_RGBA_ARRAY:d.push([i,j,k,h]);break;case s.RAMP_CHANNEL_RGB_ARRAY:d.push([i,j,k])}}}return d},random:function(){for(var a="#",b=0;b<3;b++)a+="0123456789abcdef"[Math.random()*16>>0];return a}},extendsWith:{__init:function(a,b,c){this.r=a||255;this.g=b||255;this.b=c||255;return this},r:255,g:255,b:255,toHex:function(){return("000000"+((this.r<<16)+(this.g<<8)+this.b).toString(16)).slice(-6)}}}); CAAT.Module({defines:"CAAT.Module.Debug.Debug",depends:["CAAT.Event.AnimationLoop"],extendsWith:{width:0,height:0,canvas:null,ctx:null,statistics:null,framerate:null,textContainer:null,textFPS:null,textEntitiesTotal:null,textEntitiesActive:null,textDraws:null,textDrawTime:null,textRAFTime:null,textDirtyRects:null,textDiscardDR:null,frameTimeAcc:0,frameRAFAcc:0,canDebug:false,SCALE:60,debugTpl:'
CAAT Debug panel Performance Controls Draw Time: 5.46 ms. FPS: 48
RAF Time: 20.76 ms. Entities Total: 41 Entities Active: 37 Draws: 0 DirtyRects: 0 Discard DR: 0
Sound
Music
AA Bounding Boxes
Bounding Boxes
Dirty Rects
', setScale:function(a){this.scale=a;return this},initialize:function(a,b){this.width=a=window.innerWidth;this.height=b;this.framerate={refreshInterval:CAAT.FPS_REFRESH||500,frames:0,timeLastRefresh:0,fps:0,prevFps:-1,fpsMin:1E3,fpsMax:0};if(!document.getElementById("caat-debug")){var c=document.createElement("div");c.innerHTML=this.debugTpl;document.body.appendChild(c);eval(' var __x= CAAT; function initCheck( name, bool, callback ) { var elem= document.getElementById(name); if ( elem ) { elem.className= (bool) ? "checkbox_enabled" : "checkbox_disabled"; if ( callback ) { elem.addEventListener( "click", (function(elem, callback) { return function(e) { elem.__value= !elem.__value; elem.className= (elem.__value) ? "checkbox_enabled" : "checkbox_disabled"; callback(e,elem.__value); } })(elem, callback), false ); } elem.__value= bool; } } function setupTabs() { var numTabs=0; var elem; var elemContent; do { elem= document.getElementById("caat-debug-tab"+numTabs); if ( elem ) { elemContent= document.getElementById("caat-debug-tab"+numTabs+"-content"); if ( elemContent ) { elemContent.style.display= numTabs===0 ? \'block\' : \'none\'; elem.className= numTabs===0 ? "debug_tab debug_tab_selected" : "debug_tab debug_tab_not_selected"; elem.addEventListener( "click", (function(tabIndex) { return function(e) { for( var i=0; ithis.framerate.timeLastRefresh+this.framerate.refreshInterval){this.framerate.fps= this.framerate.frames*1E3/(a-this.framerate.timeLastRefresh)|0;this.framerate.fpsMin=this.framerate.frames>0?Math.min(this.framerate.fpsMin,this.framerate.fps):this.framerate.fpsMin;this.framerate.fpsMax=Math.max(this.framerate.fpsMax,this.framerate.fps);this.textFPS.innerHTML=this.framerate.fps;var b=(this.frameTimeAcc*100/this.framerate.frames|0)/100;this.frameTimeAcc=0;this.textDrawTime.innerHTML=b;b=(this.frameRAFAcc*100/this.framerate.frames|0)/100;this.frameRAFAcc=0;this.textRAFTime.innerHTML= b;this.framerate.timeLastRefresh=a;this.framerate.frames=0;this.paint(b)}this.textEntitiesTotal.innerHTML=this.statistics.size_total;this.textEntitiesActive.innerHTML=this.statistics.size_active;this.textDirtyRects.innerHTML=this.statistics.size_dirtyRects;this.textDraws.innerHTML=this.statistics.draws;this.textDiscardDR.innerHTML=this.statistics.size_discarded_by_dirty_rects},paint:function(a){var b=this.ctx,c=0;b.drawImage(this.canvas,1,0,this.width-1,this.height,0,0,this.width-1,this.height);b.strokeStyle= "black";b.beginPath();b.moveTo(this.width-0.5,0);b.lineTo(this.width-0.5,this.height);b.stroke();b.strokeStyle="#a22";b.beginPath();c=this.height-(20/this.SCALE*this.height>>0)-0.5;b.moveTo(0.5,c);b.lineTo(this.width+0.5,c);b.stroke();b.strokeStyle="#aa2";b.beginPath();c=this.height-(30/this.SCALE*this.height>>0)-0.5;b.moveTo(0.5,c);b.lineTo(this.width+0.5,c);b.stroke();c=Math.min(this.height-this.framerate.fps/this.SCALE*this.height,59);if(-1===this.framerate.prevFps)this.framerate.prevFps=c|0;b.strokeStyle= "#0ff";b.beginPath();b.moveTo(this.width,(c|0)-0.5);b.lineTo(this.width,this.framerate.prevFps-0.5);b.stroke();this.framerate.prevFps=c;a=(this.height-a/this.SCALE*this.height>>0)-0.5;b.strokeStyle="#ff0";b.beginPath();b.moveTo(this.width,a);b.lineTo(this.width,a);b.stroke()}}}); CAAT.Module({defines:"CAAT.Module.Font.Font",aliases:"CAAT.Font",depends:["CAAT.Foundation.SpriteImage"],constants:{getFontMetrics:function(a){var b;if(CAAT.CSS_TEXT_METRICS)try{return b=CAAT.Module.Font.Font.getFontMetricsCSS(a)}catch(c){}return CAAT.Module.Font.Font.getFontMetricsNoCSS(a)},getFontMetricsNoCSS:function(a){var a=/(\d+)p[x|t]\s*/i.exec(a),b;b=a?a[1]|0:32;a=b-1;b=b+b*0.2|0;return{height:b,ascent:a,descent:b-a}},getFontMetricsCSS:function(a){function b(a){var b,c,d;d=a&&a.ownerDocument; b=d.documentElement;a=a.getBoundingClientRect();c=document.body;d=d.nodeType===9?d.defaultView||d.parentWindow:false;return{top:a.top+(d.pageYOffset||b.scrollTop)-(b.clientTop||c.clientTop||0),left:a.left+(d.pageXOffset||b.scrollLeft)-(b.clientLeft||c.clientLeft||0)}}try{var c=document.createElement("span");c.style.font=a;c.innerHTML="Hg";var d=document.createElement("div");d.style.display="inline-block";d.style.width="1px";d.style.heigh="0px";var e=document.createElement("div");e.appendChild(c); e.appendChild(d);var f=document.body;f.appendChild(e);try{return a={},d.style.verticalAlign="baseline",a.ascent=b(d).top-b(c).top,d.style.verticalAlign="bottom",a.height=b(d).top-b(c).top,a.ascent=Math.ceil(a.ascent),a.height=Math.ceil(a.height),a.descent=a.height-a.ascent,a}finally{f.removeChild(e)}}catch(g){return null}}},extendsWith:function(){return{fontSize:10,fontSizeUnit:"px",font:"Sans-Serif",fontStyle:"",fillStyle:"#fff",strokeStyle:null,strokeSize:1,padding:0,image:null,charMap:null,height:0, ascent:0,descent:0,setPadding:function(a){this.padding=a;return this},setFontStyle:function(a){this.fontStyle=a;return this},setStrokeSize:function(a){this.strokeSize=a;return this},setFontSize:function(a){this.fontSize=a;this.fontSizeUnit="px";return this},setFont:function(a){this.font=a;return this},setFillStyle:function(a){this.fillStyle=a;return this},setStrokeStyle:function(a){this.strokeStyle=a;return this},createDefault:function(a){for(var b="",c=32;c<128;c++)b+=String.fromCharCode(c);return this.create(b, a)},create:function(a,b){b|=0;this.padding=b;var c=document.createElement("canvas"),d=c.getContext("2d");d.textBaseline="bottom";d.font=this.fontStyle+" "+this.fontSize+""+this.fontSizeUnit+" "+this.font;var e=0,f=[],g,h;for(g=0;g>0)+1)+2*b;f.push(i);e+=i}g=CAAT.Font.getFontMetrics(d.font);d=g.height;this.ascent=g.ascent;this.descent=g.descent;this.height=g.height;i=g.ascent;c.width=e;c.height=d;d=c.getContext("2d");d.textBaseline= "alphabetic";d.font=this.fontStyle+" "+this.fontSize+""+this.fontSizeUnit+" "+this.font;d.fillStyle=this.fillStyle;d.strokeStyle=this.strokeStyle;this.charMap={};for(g=e=0;g0&&g.height>0&&b.drawImage(this.image,g.x,0,h,i,c,d,h,i),c+=h):(b.strokeStyle="#f00",b.strokeRect(c,d,10,i),c+=10)},save:function(){var a=this.image.toDataURL("image/png");document.location.href=a.replace("image/png","image/octet-stream")},drawSpriteText:function(a,b){this.spriteImage.drawSpriteText(a,b)}}}}); CAAT.Module({defines:"CAAT.Module.CircleManager.PackedCircle",depends:["CAAT.Module.CircleManager.PackedCircle","CAAT.Math.Point"],constants:{BOUNDS_RULE_WRAP:1,BOUNDS_RULE_CONSTRAINT:2,BOUNDS_RULE_DESTROY:4,BOUNDS_RULE_IGNORE:8},extendsWith:{__init:function(){this.boundsRule=CAAT.Module.CircleManager.PackedCircle.BOUNDS_RULE_IGNORE;this.position=new CAAT.Math.Point(0,0,0);this.offset=new CAAT.Math.Point(0,0,0);this.targetPosition=new CAAT.Math.Point(0,0,0);return this},id:0,delegate:null,position:null, offset:null,targetPosition:null,targetChaseSpeed:0.02,isFixed:false,boundsRule:0,collisionMask:0,collisionGroup:0,containsPoint:function(a){return this.position.getDistanceSquared(a)this.bounds.right)a.position.x=this.bounds.left+e;else if(b&1&&c+fthis.bounds.bottom)a.position.y=this.bounds.top-e;else if(b&4&&d+f=this.bounds.right)a.position.x=a.position.x=this.bounds.right-e;else if(b&8&&c-ethis.bounds.bottom)a.position.y=this.bounds.bottom-e;else if(b&16&&d-ed?e=-1:c=0;a--)this.allCircles[a]===null&&this.allCircles.splice(a,1)},initialize:function(a){if(a)for(var b in a)this[b]=a[b];return this}}}); CAAT.Module({defines:"CAAT.Module.Preloader.Preloader",extendsWith:function(){var a=function(a,c,d){this.id=a;this.path=c;this.image=new Image;this.loader=d;this.image.onload=this.onload.bind(this);this.image.onerror=this.onerror.bind(this);return this};a.prototype={id:null,path:null,image:null,loader:null,onload:function(){this.loader.__onload(this);this.image.onload=null;this.image.onerror=null},onerror:function(){this.loader.__onerror(this)},load:function(){this.image.src=this.path},clear:function(){this.loader= null}};return{__init:function(){this.elements=[];this.baseURL="";return this},currentGroup:null,elements:null,imageCounter:0,cfinished:null,cloaded:null,cerrored:null,loadedCount:0,baseURL:null,addElement:function(b,c){this.elements.push(new a(b,this.baseURL+c,this));return this},clear:function(){for(var a=0;a>=0;var d=true,e=true,f=true,g=true;if(typeof c!== "undefined"){if(typeof c.top!=="undefined")d=c.top;if(typeof c.bottom!=="undefined")e=c.bottom;if(typeof c.left!=="undefined")f=c.left;if(typeof c.right!=="undefined")g=c.right}c=document.createElement("canvas");c.width=a.width;c.height=a.height;var h=c.getContext("2d");h.fillStyle="rgba(0,0,0,0)";h.fillRect(0,0,a.width,a.height);h.drawImage(a,0,0);var i=h.getImageData(0,0,a.width,a.height).data,j,a=0,k=c.height-1,m=0,o=c.width-1,n=false;if(d){for(d=0;db){n=true;break}if(n)break}a=d}if(e){n=false;for(d=c.height-1;d>=a;d--){for(j=0;jb){n=true;break}if(n)break}k=d}if(f){n=false;for(j=0;jb){n=true;break}if(n)break}m=j}if(g){n=false;for(j=c.width-1;j>=m;j--){for(d=a;d<=k;d++)if(i[d*c.width*4+3+j*4]>b){n=true;break}if(n)break}o=j}if(0===m&&0===a&&c.width-1===o&&c.height-1===k)return c;b=o-m+1;e=k-a+1;f=h.getImageData(m,a,b,e);c.width=b;c.height= e;h=c.getContext("2d");h.putImageData(f,0,0);return c},createThumb:function(a,b,c,d){var b=b||24,c=c||24,e=document.createElement("canvas");e.width=b;e.height=c;var f=e.getContext("2d");if(d){var g=Math.max(a.width,a.height),d=a.width/g*b,g=a.height/g*c;f.drawImage(a,(b-d)/2,(c-g)/2,d,g)}else f.drawImage(a,0,0,b,c);return e}}}); CAAT.Module({defines:"CAAT.Module.Collision.QuadTree",depends:["CAAT.Math.Rectangle"],extendsClass:"CAAT.Math.Rectangle",extendsWith:function(){return{bgActors:null,quadData:null,create:function(a,b,c,d,e,f,g){typeof f==="undefined"&&(f=32);typeof g==="undefined"&&(g=1);var h=(a+c)/2,i=(b+d)/2;this.x=a;this.y=b;this.x1=c;this.y1=d;this.width=c-a;this.height=d-b;this.bgActors=this.__getOverlappingActorList(e);if(this.bgActors.length<=g||this.width<=f)return this;this.quadData=Array(4);this.quadData[0]= (new CAAT.Module.Collision.QuadTree).create(a,b,h,i,this.bgActors);this.quadData[1]=(new CAAT.Module.Collision.QuadTree).create(h,b,c,i,this.bgActors);this.quadData[2]=(new CAAT.Module.Collision.QuadTree).create(a,i,h,d,this.bgActors);this.quadData[3]=(new CAAT.Module.Collision.QuadTree).create(h,i,c,d,this.bgActors);return this},__getOverlappingActorList:function(a){for(var b=[],c=0,d=a.length;c>0);this.ycache=[];for(e=0;e>0);this.xycache=[];for(e=0;e1&&this._solveCollisionCell(c,a)}},_solveCollisionCell:function(a,b){var c,d;for(c=0;c0&&this.freeChunks.splice(c++,0,{position:e,size:f});h>0&&this.freeChunks.splice(c,0,{position:g,size:h});return true}}return false},log:function(a){if(0===this.freeChunks.length)CAAT.log("index "+ a+" empty");else{for(var a="index "+a,b=0;bthis.width||b>this.height)return null;for(var c,d,e=0;e<=this.scanMapHeight-b;){var f=null; for(c=false;e<=this.scanMapHeight-b;e++)if(f=this.scanMap[e].findWhereFits(a),null!==f&&f.length>0){c=true;break}if(c){for(d=0;db.width?-1:0;else if(c.criteria==="height")return a.heightb.height?-1:0;return fg?-1:0});for(b=0;bb&&(g=b),setTimeout(function(){j(a,e,c)},g)):j(a,e,c)}};return g}function j(a,b,c){a.emptyScenes();a.setImagesCache(b);a.setClear(true);c(a);a.setClear(CAAT.Foundation.Director.CLEAR_ALL);a.easeIn(0,CAAT.Foundation.Scene.EASE_SCALE,2E3,false,CAAT.Foundation.Actor.ANCHOR_CENTER,(new CAAT.Behavior.Interpolator).createElasticOutInterpolator(2.5, 0.4))}var c=document.getElementById(c),k;if(CAAT.__CSS__)c&&false===c instanceof HTMLDivElement&&(c=null),c===null&&(c=document.createElement("div"),document.body.appendChild(c));else if(c)if(c instanceof HTMLDivElement){var m=document.createElement("canvas");c.appendChild(m);c=m}else false==c instanceof HTMLCanvasElement&&(m=document.createElement("canvas"),document.body.appendChild(m),c=m);else c=document.createElement("canvas"),document.body.appendChild(c);k=(new CAAT.Foundation.Director).initialize(a|| 800,b||600,c);a=[];g&&a.push({id:"splash",url:g});h&&a.push({id:"spinner",url:h});k.setClear(CAAT.Foundation.Director.CLEAR_DIRTY_RECTS);(new CAAT.Module.Preloader.ImagePreloader).loadImages(a,function(a,b){if(a===b.length){k.setImagesCache(b);var c=i(k,d||5E3,f);CAAT.loop(60);e&&e.length>0?(new CAAT.Module.Preloader.ImagePreloader).loadImages(e,c.loadedImage):c.loadedImage(0,null)}})}}}); (function(){CAAT.CSS={};CAAT.CSS.PREFIX=function(){for(var a="",b=["WebKit","Moz","O"],c=0;c=0;c--)try{for(var d=b[c],e=d.cssRules?d.cssRules:d.rules?d.rules:[],f=e.length-1;f>=0;f--)if((e[f].type===window.CSSRule.WEBKIT_KEYFRAMES_RULE||e[f].type===window.CSSRule.MOZ_KEYFRAMES_RULE)&&e[f].name===a)return{sheetIndex:c,index:f}}catch(g){}return null};CAAT.CSS.getCSSKeyframes= function(a){for(var b=document.styleSheets,c=b.length-1;c>=0;c--)try{for(var d=b[c],e=d.cssRules?d.cssRules:d.rules?d.rules:[],f=e.length-1;f>=0;f--)if((e[f].type===window.CSSRule.WEBKIT_KEYFRAMES_RULE||e[f].type===window.CSSRule.MOZ_KEYFRAMES_RULE)&&e[f].name===a)return e[f]}catch(g){}return null}})(); CAAT.Module({defines:"CAAT.PathUtil.PathSegment",depends:["CAAT.Math.Rectangle","CAAT.Math.Point","CAAT.Math.Matrix","CAAT.Math.Curve"],extendsWith:function(){return{__init:function(){this.bbox=new CAAT.Math.Rectangle;return this},color:"#000",length:0,bbox:null,parent:null,setParent:function(a){this.parent=a;return this},setColor:function(a){if(a)this.color=a;return this},endCurvePosition:function(){},startCurvePosition:function(){},setPoints:function(){},setPoint:function(){},getPosition:function(){}, getLength:function(){return this.length},getBoundingBox:function(){return this.bbox},numControlPoints:function(){},getControlPoint:function(){},endPath:function(){},getContour:function(){},updatePath:function(){},applyAsPath:function(){},transform:function(){},drawHandle:function(a,b,c){a.beginPath();a.arc(b,c,CAAT.Math.Curve.prototype.HANDLE_SIZE/2,0,2*Math.PI,false);a.fill()}}}}); CAAT.Module({defines:"CAAT.PathUtil.ArcPath",depends:["CAAT.PathUtil.PathSegment","CAAT.Math.Point","CAAT.Math.Rectangle"],aliases:["CAAT.ArcPath"],extendsClass:"CAAT.PathUtil.PathSegment",extendsWith:function(){return{__init:function(){this.__super();this.points=[];this.points.push(new CAAT.Math.Point);this.points.push(new CAAT.Math.Point);this.newPosition=new CAAT.Math.Point;return this},points:null,cw:true,newPosition:null,radius:0,startAngle:0,angle:2*Math.PI,arcTo:false,setRadius:function(a){this.radius= a;return this},isArcTo:function(){return this.arcTo},setArcTo:function(a){this.arcTo=a;return this},initialize:function(a,b,c,d){this.setInitialPosition(a,b);this.setFinalPosition(a+c,b);this.angle=d||2*Math.PI;return this},applyAsPath:function(a){a=a.ctx;this.arcTo?a.arcTo(this.points[0].x,this.points[0].y,this.points[1].x,this.points[1].y,this.radius):a.arc(this.points[0].x,this.points[0].y,this.radius,this.startAngle,this.angle+this.startAngle,this.cw);return this},setPoint:function(a,b){b>=0&& b1||a<0)a%=1;a<0&&(a=1+a);-1===this.length?this.newPosition.set(this.points[0].x,this.points[0].y):(a=this.angle*a*(this.cw?1:-1)+this.startAngle,this.newPosition.set(this.points[0].x+this.radius*Math.cos(a),this.points[0].y+this.radius*Math.sin(a)));return this.newPosition},initialPositionX:function(){return this.points[0].x},finalPositionX:function(){return this.points[1].x},paint:function(a,b){var c=a.ctx;c.save(); c.strokeStyle=this.color;c.beginPath();this.arcTo?c.arcTo(this.points[0].x,this.points[0].y,this.points[1].x,this.points[1].y,this.radius):c.arc(this.points[0].x,this.points[0].y,this.radius,this.startAngle,this.startAngle+this.angle,this.cw);c.stroke();if(b){c.globalAlpha=0.5;c.fillStyle="#7f7f00";for(var d=0;d1||a<0)a%=1;a<0&&(a=1+a);this.curve.solve(this.newPosition, a);return this.newPosition},getPositionFromLength:function(a){this.curve.solve(this.newPosition,a/this.length);return this.newPosition},initialPositionX:function(){return this.curve.coordlist[0].x},finalPositionX:function(){return this.curve.coordlist[this.curve.coordlist.length-1].x},paint:function(a,b){this.curve.drawHandles=b;a.ctx.strokeStyle=this.color;this.curve.paint(a,b)},numControlPoints:function(){return this.curve.coordlist.length},getControlPoint:function(a){return this.curve.coordlist[a]}, endCurvePosition:function(){return this.curve.endCurvePosition()},startCurvePosition:function(){return this.curve.startCurvePosition()},getContour:function(a){for(var b=[],c=0;c<=a;c++)b.push({x:c/a,y:this.getPosition(c/a).y});return b}}}}); CAAT.Module({defines:"CAAT.PathUtil.LinearPath",depends:["CAAT.PathUtil.PathSegment","CAAT.Math.Point"],aliases:["CAAT.LinearPath"],extendsClass:"CAAT.PathUtil.PathSegment",extendsWith:function(){return{__init:function(){this.__super();this.points=[];this.points.push(new CAAT.Math.Point);this.points.push(new CAAT.Math.Point);this.newPosition=new CAAT.Math.Point(0,0,0);return this},points:null,newPosition:null,applyAsPath:function(a){a.ctx.lineTo(this.points[1].x,this.points[1].y)},setPoint:function(a, b){b===0?this.points[0]=a:b===1&&(this.points[1]=a)},updatePath:function(){var a=this.points[1].x-this.points[0].x,b=this.points[1].y-this.points[0].y;this.length=Math.sqrt(a*a+b*b);this.bbox.setEmpty();this.bbox.union(this.points[0].x,this.points[0].y);this.bbox.union(this.points[1].x,this.points[1].y);return this},setPoints:function(a){this.points[0]=a[0];this.points[1]=a[1];this.updatePath();return this},setInitialPosition:function(a,b){this.points[0].x=a;this.points[0].y=b;this.newPosition.set(a, b);return this},setFinalPosition:function(a,b){this.points[1].x=a;this.points[1].y=b;return this},endCurvePosition:function(){return this.points[1]},startCurvePosition:function(){return this.points[0]},getPosition:function(a){if(a>1||a<0)a%=1;a<0&&(a=1+a);this.newPosition.set(this.points[0].x+(this.points[1].x-this.points[0].x)*a,this.points[0].y+(this.points[1].y-this.points[0].y)*a);return this.newPosition},getPositionFromLength:function(a){return this.getPosition(a/this.length)},initialPositionX:function(){return this.points[0].x}, finalPositionX:function(){return this.points[1].x},paint:function(a,b){var c=a.ctx;c.save();c.strokeStyle=this.color;c.beginPath();c.moveTo(this.points[0].x,this.points[0].y);c.lineTo(this.points[1].x,this.points[1].y);c.stroke();if(b)c.globalAlpha=0.5,c.fillStyle="#7f7f00",c.beginPath(),this.drawHandle(c,this.points[0].x,this.points[0].y),this.drawHandle(c,this.points[1].x,this.points[1].y);c.restore()},numControlPoints:function(){return 2},getControlPoint:function(a){if(0===a)return this.points[0]; else if(1===a)return this.points[1]},getContour:function(){var a=[];a.push(this.getPosition(0).clone());a.push(this.getPosition(1).clone());return a}}}}); CAAT.Module({defines:"CAAT.PathUtil.RectPath",depends:["CAAT.PathUtil.PathSegment","CAAT.Math.Point","CAAT.Math.Rectangle"],aliases:["CAAT.RectPath","CAAT.ShapePath"],extendsClass:"CAAT.PathUtil.PathSegment",extendsWith:function(){return{__init:function(){this.__super();this.points=[];this.points.push(new CAAT.Math.Point);this.points.push(new CAAT.Math.Point);this.points.push(new CAAT.Math.Point);this.points.push(new CAAT.Math.Point);this.points.push(new CAAT.Math.Point);this.newPosition=new CAAT.Math.Point; return this},points:null,cw:true,newPosition:null,applyAsPath:function(a){a=a.ctx;this.cw?(a.lineTo(this.points[0].x,this.points[0].y),a.lineTo(this.points[1].x,this.points[1].y),a.lineTo(this.points[2].x,this.points[2].y),a.lineTo(this.points[3].x,this.points[3].y),a.lineTo(this.points[4].x,this.points[4].y)):(a.lineTo(this.points[4].x,this.points[4].y),a.lineTo(this.points[3].x,this.points[3].y),a.lineTo(this.points[2].x,this.points[2].y),a.lineTo(this.points[1].x,this.points[1].y),a.lineTo(this.points[0].x, this.points[0].y));return this},setPoint:function(a,b){b>=0&&b1||a<0)a%=1; a<0&&(a=1+a);if(-1===this.length)this.newPosition.set(0,0);else{var b=this.bbox.width/this.length,c=this.bbox.height/this.length,d=0,e,f=0;this.cw?(e=[0,1,2,3,4],b=[b,c,b,c]):(e=[4,3,2,1,0],b=[c,b,c,b]);for(;f=1||a<=0)){var c,d,e;a>=1?(c=this.__getPositionImpl(0.999),d=this.endCurvePosition(),e=Math.atan2(d.y-c.y,d.x-c.x),c=a%1):(c=this.__getPositionImpl(0.0010),d=this.startCurvePosition(),e=Math.atan2(d.y-c.y,d.x-c.x),c=-a);var f=this.newPosition,g=this.getLength(); f.x=d.x+c*g*Math.cos(e);f.y=d.y+c*g*Math.sin(e);return f}return this.__getPositionImpl(a)},__getPositionImpl:function(a){if(a>1||a<0)a%=1;a<0&&(a=1+a);for(var b=this.pathSegments,c=this.pathSegmentStartTime,d=this.pathSegmentDurationTime,e=0,f=b.length,g,h=this.newPosition,i;e!==f;)if(g=(f+e)/2|0,i=c[g],i<=a&&a<=i+d[g])return a=d[g]?(a-i)/d[g]:0,a>1?a=1:a<0&&(a=0),a=b[g].getPosition(a),h.x=a.x,h.y=a.y,h;else a0?this.pathSegmentStartTime[c]=this.pathSegmentStartTime[c-1]+this.pathSegmentDurationTime[c-1]:this.pathSegmentStartTime[0]=0,this.pathSegments[c].endPath();this.extractPathPoints();b&&b(this);return this},press:function(a,b){if(this.interactive){for(var c=CAAT.Math.Curve.prototype.HANDLE_SIZE/2,d=0;d=f.x-c&&b>=f.y-c&&a=0&&b="0"&&a<="9"},__getNumber:function(a,c,d,e){c=this.__skipBlank(a,c);if(c=this.duration?(this.remove=true,this.callback_timeout&&this.callback_timeout(a,b,this)): this.callback_tick&&this.callback_tick(a,b,this);return this},remainingTime:function(){return this.duration-(this.scene.time-this.startTime)},reset:function(a){this.remove=false;this.startTime=a;this.owner.ensureTimerTask(this);return this},cancel:function(){this.remove=true;null!=this.callback_cancel&&this.callback_cancel(this.scene.time,this.scene.time-this.startTime,this);return this},addTime:function(a){this.duration+=a;return this}}}); CAAT.Module({defines:"CAAT.Foundation.Timer.TimerManager",aliases:["CAAT.TimerManager"],depends:["CAAT.Foundation.Timer.TimerTask"],extendsWith:{__init:function(){this.timerList=[];return this},timerList:null,timerSequence:0,checkTimers:function(a){for(var b=this.timerList,c=b.length-1;c>=0;)b[c].remove||b[c].checkTask(a),c--},ensureTimerTask:function(a){this.hasTimer(a)||this.timerList.push(a);return this},hasTimer:function(a){for(var b=this.timerList,c=b.length-1;c>=0;){if(b[c]===a)return true; c--}return false},createTimer:function(a,b,c,d,e,f){a=(new CAAT.Foundation.Timer.TimerTask).create(a,b,c,d,e);a.taskId=this.timerSequence++;a.sceneTime=f.time;a.owner=this;a.scene=f;this.timerList.push(a);return a},removeExpiredTimers:function(){var a,b=this.timerList;for(a=0;a0&&(b+=this.hgap)}switch(this.halign){case CAAT.Foundation.UI.Layout.LayoutManager.ALIGNMENT.LEFT:b=this.padding.left;break;case CAAT.Foundation.UI.Layout.LayoutManager.ALIGNMENT.RIGHT:b=a.width-b-this.padding.right;break;default:b=(a.width-b)/2}for(e=0,f=a.getNumChildren();e0&&(c+=this.vgap)}switch(this.valign){case CAAT.Foundation.UI.Layout.LayoutManager.ALIGNMENT.TOP:b=this.padding.top;break;case CAAT.Foundation.UI.Layout.LayoutManager.ALIGNMENT.BOTTOM:b=a.height-c-this.padding.bottom;break;default:b=(a.height-c)/2}for(d=0,e=a.getNumChildren();d0?g=Math.floor((e+f-1)/f):f=Math.floor((e+g-1)/g);for(var c=(g-1)*this.hgap,d=a.width-(this.padding.left+this.padding.right),e=Math.floor((d-c)/g),h=(f-1)*this.vgap,i=a.height-(this.padding.top+this.padding.bottom),j=Math.floor((i-h)/f),h=Math.floor((i-(j*f+h))/2),i=0,k=this.padding.left+Math.floor((d-(e*g+c))/2);i0?c=Math.ceil((d+b-1)/b):b=Math.ceil((d+c-1)/c);for(g=0;g0?c=Math.ceil((d+b-1)/b):b=Math.ceil((d+c-1)/c);for(g=0;g>0)*e;var k=i+(d/h>>0)*f,m=g+e,o=k+f;g=(new CAAT.Foundation.SpriteImageHelper(g,k,m-g,o-k,j.width,j.height)).setGL(g/j.width,k/j.height,m/j.width,o/j.height);this.mapInfo[d]=g}}else for(d=0;d0&&(f-=d);var g=(this.offsetY-this.ownerActor.y)%e;g>0&&(g-=e);for(var d=((c.width-f)/d>>0)+1,e=((c.height-g)/e>>0)+1,h,i=a.ctx,a=0;a>0,c.y-this.ownerActor.y+g+a*b.height>>0,b.width,b.height)},paintInvertedH:function(a, b,c,d){b=this.mapInfo[this.spriteIndex];a=a.ctx;a.save();a.translate((c|0)+b.width,d|0);a.scale(-1,1);a.drawImage(this.image,b.x,b.y,b.width,b.height,this.offsetX>>0,this.offsetY>>0,b.width,b.height);a.restore();return this},paintInvertedV:function(a,b,c,d){b=this.mapInfo[this.spriteIndex];a=a.ctx;a.save();a.translate(c|0,d+b.height|0);a.scale(1,-1);a.drawImage(this.image,b.x,b.y,b.width,b.height,this.offsetX>>0,this.offsetY>>0,b.width,b.height);a.restore();return this},paintInvertedHV:function(a, b,c,d){b=this.mapInfo[this.spriteIndex];a=a.ctx;a.save();a.translate(c|0,d+b.height|0);a.scale(1,-1);a.translate(b.width,0);a.scale(-1,1);a.drawImage(this.image,b.x,b.y,b.width,b.height,this.offsetX>>0,this.offsetY>>0,b.width,b.height);a.restore();return this},paintN:function(a,b,c,d){b=this.mapInfo[this.spriteIndex];a.ctx.drawImage(this.image,b.x,b.y,b.width,b.height,this.offsetX+c>>0,this.offsetY+d>>0,b.width,b.height);return this},paintAtRect:function(a,b,c,d,e,f){b=this.mapInfo[this.spriteIndex]; a.ctx.drawImage(this.image,b.x,b.y,b.width,b.height,this.offsetX+c>>0,this.offsetY+d>>0,e,f);return this},paintScaledWidth:function(a,b,c,d){b=this.mapInfo[this.spriteIndex];a.ctx.drawImage(this.image,b.x,b.y,b.width,b.height,this.offsetX+c>>0,this.offsetY+d>>0,this.ownerActor.width,b.height);return this},paintChunk:function(a,b,c,d,e,f,g){a.drawImage(this.image,d,e,f,g,b,c,f,g)},paintTile:function(a,b,c,d){b=this.mapInfo[b];a.drawImage(this.image,b.x,b.y,b.width,b.height,this.offsetX+c>>0,this.offsetY+ d>>0,b.width,b.height);return this},paintScaled:function(a,b,c,d){b=this.mapInfo[this.spriteIndex];a.ctx.drawImage(this.image,b.x,b.y,b.width,b.height,this.offsetX+c>>0,this.offsetY+d>>0,this.ownerActor.width,this.ownerActor.height);return this},getCurrentSpriteImageCSSPosition:function(){var a=this.mapInfo[this.spriteIndex];return""+-(a.x+this.parentOffsetX-this.offsetX)+"px "+-(a.y+this.parentOffsetY-this.offsetY)+"px "+(this.ownerActor.transformation===CAAT.Foundation.SpriteImage.TR_TILE?"repeat": "no-repeat")},getNumImages:function(){return this.rows*this.columns},setUV:function(a,b){var c=this.image;if(c.__texturePage){var d=b,e=this.mapInfo[this.spriteIndex],f=e.u,g=e.v,h=e.u1,e=e.v1;if(this.offsetX||this.offsetY)f=c.__texturePage,g=-this.offsetY/f.height,h=(this.ownerActor.width-this.offsetX)/f.width,e=(this.ownerActor.height-this.offsetY)/f.height,f=-this.offsetX/f.width+c.__u,g+=c.__v,h+=c.__u,e+=c.__v;c.inverted?(a[d++]=h,a[d++]=g,a[d++]=h,a[d++]=e,a[d++]=f,a[d++]=e,a[d++]=f,a[d++]= g):(a[d++]=f,a[d++]=g,a[d++]=h,a[d++]=g,a[d++]=h,a[d++]=e,a[d++]=f,a[d++]=e)}},setChangeFPS:function(a){this.changeFPS=a;return this},setSpriteTransformation:function(a){this.transformation=a;var b=CAAT.Foundation.SpriteImage;switch(a){case b.TR_FLIP_HORIZONTAL:this.paint=this.paintInvertedH;break;case b.TR_FLIP_VERTICAL:this.paint=this.paintInvertedV;break;case b.TR_FLIP_ALL:this.paint=this.paintInvertedHV;break;case b.TR_FIXED_TO_SIZE:this.paint=this.paintScaled;break;case b.TR_FIXED_WIDTH_TO_SIZE:this.paint= this.paintScaledWidth;break;case b.TR_TILE:this.paint=this.paintTiled;break;default:this.paint=this.paintN}this.ownerActor.invalidate();return this},resetAnimationTime:function(){this.prevAnimationTime=-1;return this},setAnimationImageIndex:function(a){this.animationImageIndex=a;this.spriteIndex=a[0];this.prevAnimationTime=-1;return this},setSpriteIndex:function(a){this.spriteIndex=a;return this},setSpriteIndexAtTime:function(a){if(this.animationImageIndex.length>1){if(this.prevAnimationTime===-1)this.prevAnimationTime= a,this.spriteIndex=this.animationImageIndex[0],this.prevIndex=0;else{var b=a;b-=this.prevAnimationTime;b/=this.changeFPS;b%=this.animationImageIndex.length;b=Math.floor(b);b>0,f=0;fa&&(a=c)}this.fontHeight=a;return this.fontHeight*this.fontScale},drawText:function(a,b,c,d){var e,f,g;for(e=0;e0&&f.height>0&&b.drawImage(this.image,f.x,f.y,g,f.height,c+f.xoffset*this.fontScale,d+f.yoffset*this.fontScale,g*this.fontScale,f.height*this.fontScale),c+=f.xadvance*this.fontScale}, getFontData:function(){var a=this.stringHeight()*0.8>>0;return{height:this.stringHeight(),ascent:a,descent:this.stringHeight()-a}}}}}); CAAT.Module({defines:"CAAT.Foundation.Actor",aliases:["CAAT.Actor"],depends:"CAAT.Math.Dimension,CAAT.Event.AnimationLoop,CAAT.Foundation.SpriteImage,CAAT.Core.Constants,CAAT.Behavior.PathBehavior,CAAT.Behavior.RotateBehavior,CAAT.Behavior.ScaleBehavior,CAAT.Behavior.Scale1Behavior,CAAT.PathUtil.LinearPath,CAAT.Event.AnimationLoop".split(","),constants:{ANCHOR_CENTER:0,ANCHOR_TOP:1,ANCHOR_BOTTOM:2,ANCHOR_LEFT:3,ANCHOR_RIGHT:4,ANCHOR_TOP_LEFT:5,ANCHOR_TOP_RIGHT:6,ANCHOR_BOTTOM_LEFT:7,ANCHOR_BOTTOM_RIGHT:8, ANCHOR_CUSTOM:9,CACHE_NONE:0,CACHE_SIMPLE:1,CACHE_DEEP:2},extendsWith:function(){var a=0;return{__init:function(){this.behaviorList=[];this.lifecycleListenerList=[];this.AABB=new CAAT.Math.Rectangle;this.viewVertices=[new CAAT.Math.Point(0,0,0),new CAAT.Math.Point(0,0,0),new CAAT.Math.Point(0,0,0),new CAAT.Math.Point(0,0,0)];this.scaleAnchor=CAAT.Foundation.Actor.ANCHOR_CENTER;this.modelViewMatrix=new CAAT.Math.Matrix;this.worldModelViewMatrix=new CAAT.Math.Matrix;this.resetTransform();this.setScale(1, 1);this.setRotation(0);this.id=a++;return this},__super:null,lifecycleListenerList:null,behaviorList:null,parent:null,x:0,y:0,width:0,height:0,preferredSize:null,minimumSize:null,start_time:0,duration:Number.MAX_VALUE,clip:false,clipPath:null,tAnchorX:0,tAnchorY:0,scaleX:1,scaleY:1,scaleTX:0.5,scaleTY:0.5,scaleAnchor:0,rotationAngle:0,rotationY:0.5,rotationX:0.5,alpha:1,isGlobalAlpha:false,frameAlpha:1,expired:false,discardable:false,pointed:false,mouseEnabled:true,visible:true,fillStyle:null,strokeStyle:null, time:0,AABB:null,viewVertices:null,inFrame:false,dirty:true,wdirty:true,oldX:-1,oldY:-1,modelViewMatrix:null,worldModelViewMatrix:null,modelViewMatrixI:null,worldModelViewMatrixI:null,glEnabled:false,backgroundImage:null,id:null,size_active:1,size_total:1,__d_ax:-1,__d_ay:-1,gestureEnabled:false,invalid:true,cached:0,preventLayout:false,isAA:true,isCachedActor:false,setCachedActor:function(a){this.isCachedActor=a;return this},setPreventLayout:function(a){this.preventLayout=a;return this},invalidateLayout:function(){this.parent&& !this.parent.layoutInvalidated&&this.parent.invalidateLayout();return this},__validateLayout:function(){},setPreferredSize:function(a,c){if(!this.preferredSize)this.preferredSize=new CAAT.Math.Dimension;this.preferredSize.width=a;this.preferredSize.height=c;return this},getPreferredSize:function(){return this.preferredSize?this.preferredSize:this.getMinimumSize()},setMinimumSize:function(a,c){if(!this.minimumSize)this.minimumSize=new CAAT.Math.Dimension;this.minimumSize.width=a;this.minimumSize.height= c;return this},getMinimumSize:function(){return this.minimumSize?this.minimumSize:new CAAT.Math.Dimension(this.width,this.height)},create:function(){return this},moveTo:function(a,c,d,e,f,g){if(!(a===this.x&&c===this.y)){var h=this.getBehavior("__moveTo");h||(h=(new CAAT.Behavior.PathBehavior).setId("__moveTo").setValues(new CAAT.PathUtil.LinearPath),this.addBehavior(h));h.path.setInitialPosition(this.x,this.y).setFinalPosition(a,c);h.setDelayTime(e?e:0,d);f&&h.setInterpolator(f);if(g)h.lifecycleListenerList= [],h.addListener({behaviorExpired:function(a,b,c){g(a,b,c)}});return this}},rotateTo:function(a,c,d,e,f,g){if(a!==this.rotationAngle){var h=this.getBehavior("__rotateTo");h||(h=(new CAAT.Behavior.RotateBehavior).setId("__rotateTo").setValues(0,0,0.5,0.5),this.addBehavior(h));h.setValues(this.rotationAngle,a,e,f).setDelayTime(d?d:0,c);g&&h.setInterpolator(g);return this}},scaleTo:function(a,c,d,e,f,g,h){if(!(this.scaleX===a&&this.scaleY===c)){var i=this.getBehavior("__scaleTo");i||(i=(new CAAT.Behavior.ScaleBehavior).setId("__scaleTo").setValues(1, 1,1,1,0.5,0.5),this.addBehavior(i));i.setValues(this.scaleX,a,this.scaleY,c,f,g).setDelayTime(e?e:0,d);h&&i.setInterpolator(h);return this}},scaleXTo:function(a,c,d,e,f,g){return this.__scale1To(CAAT.Behavior.Scale1Behavior.AXIS_X,a,c,d,e,f,g)},scaleYTo:function(a,c,d,e,f,g){return this.__scale1To(CAAT.Behavior.Scale1Behavior.AXIS_Y,a,c,d,e,f,g)},__scale1To:function(a,c,d,e,f,g,h){if(!(a===CAAT.Behavior.Scale1Behavior.AXIS_X&&c===this.scaleX||a===CAAT.Behavior.Scale1Behavior.AXIS_Y&&c===this.scaleY)){var i= this.getBehavior("__scaleXTo");i||(i=(new CAAT.Behavior.Scale1Behavior).setId("__scaleXTo").setValues(1,1,a===CAAT.Behavior.Scale1Behavior.AXIS_X,0.5,0.5),this.addBehavior(i));i.setValues(a?this.scaleX:this.scaleY,c,f,g).setDelayTime(e?e:0,d);h&&i.setInterpolator(h);return this}},touchStart:function(){},touchMove:function(){},touchEnd:function(){},gestureStart:function(){},gestureChange:function(a,c,d){this.gestureEnabled&&(this.setRotation(a),this.setScale(c,d));return this},gestureEnd:function(){}, isVisible:function(){return this.visible},invalidate:function(){this.invalid=true;return this},setGestureEnabled:function(a){this.gestureEnabled=!!a;return this},isGestureEnabled:function(){return this.gestureEnabled},getId:function(){return this.id},setId:function(a){this.id=a;return this},setParent:function(a){this.parent=a;return this},setBackgroundImage:function(a,c){if(a){a=a instanceof CAAT.Foundation.SpriteImage?a.getRef():isString(a)?(new CAAT.Foundation.SpriteImage).initialize(CAAT.currentDirector.getImage(a), 1,1):(new CAAT.Foundation.SpriteImage).initialize(a,1,1);a.setOwner(this);this.backgroundImage=a;if(typeof c==="undefined"||c)this.width=a.getWidth(),this.height=a.getHeight();this.glEnabled=true;this.invalidate()}else this.backgroundImage=null;return this},setSpriteIndex:function(a){this.backgroundImage&&(this.backgroundImage.setSpriteIndex(a),this.invalidate());return this},setBackgroundImageOffset:function(a,c){this.backgroundImage&&this.backgroundImage.setOffset(a,c);return this},setAnimationImageIndex:function(a){this.backgroundImage&& (this.backgroundImage.resetAnimationTime(),this.backgroundImage.setAnimationImageIndex(a),this.invalidate());return this},addAnimation:function(a,c,d,e){this.backgroundImage&&this.backgroundImage.addAnimation(a,c,d,e);return this},playAnimation:function(a){this.backgroundImage&&this.backgroundImage.playAnimation(a);return this},setAnimationEndCallback:function(a){this.backgroundImage&&this.backgroundImage.setAnimationEndCallback(a);return this},resetAnimationTime:function(){this.backgroundImage&& (this.backgroundImage.resetAnimationTime(),this.invalidate());return this},setChangeFPS:function(a){this.backgroundImage&&this.backgroundImage.setChangeFPS(a);return this},setImageTransformation:function(a){this.backgroundImage&&this.backgroundImage.setSpriteTransformation(a);return this},centerOn:function(a,c){this.setPosition(a-this.width/2,c-this.height/2);return this},centerAt:function(a,c){this.setPosition(a-this.width*(0.5-this.tAnchorX),c-this.height*(0.5-this.tAnchorY));return this},getTextureGLPage:function(){return this.backgroundImage.image.__texturePage}, setVisible:function(a){this.invalidate();CAAT.currentDirector&&CAAT.currentDirector.dirtyRectsEnabled&&!a&&this.visible&&CAAT.currentDirector.scheduleDirtyRect(this.AABB);if(a&&!this.visible)this.dirty=true;this.visible=a;return this},setOutOfFrameTime:function(){this.setFrameTime(-1,0);return this},addListener:function(a){this.lifecycleListenerList.push(a);return this},removeListener:function(a){for(var c=this.lifecycleListenerList.length;c--;)if(this.lifecycleListenerList[c]===a){this.lifecycleListenerList.splice(c, 1);break}},setGlobalAlpha:function(a){this.isGlobalAlpha=a;return this},fireEvent:function(a,c){for(var d=0;d=this.start_time+ this.duration?(this.expired||this.setExpired(a),false):this.start_time<=a&&a=0&&c>=0&&af)f=d.x;if(d.yh)h=d.y;d=c[1];if(d.xf)f=d.x;if(d.yh)h=d.y;d=c[2];if(d.xf)f=d.x;if(d.yh)h=d.y;d=c[3];if(d.xf)f=d.x;if(d.yh)h=d.y;a.x=e;a.y=g;a.x1=f;a.y1=h;a.width=f-e;a.height=h-g;return this},paintActor:function(a,c){if(!this.visible||!a.inDirtyRect(this))return true;var d=a.ctx;this.frameAlpha=this.parent?this.parent.frameAlpha*this.alpha: 1;d.globalAlpha=this.frameAlpha;a.modelViewMatrix.transformRenderingContextSet(d);this.worldModelViewMatrix.transformRenderingContext(d);this.clip&&(d.beginPath(),this.clipPath?this.clipPath.applyAsPath(a):d.rect(0,0,this.width,this.height),d.clip());this.paint(a,c);return true},__paintActor:function(a,c){if(!this.visible)return true;var d=a.ctx;this.frameAlpha=this.alpha;var e=this.worldModelViewMatrix.matrix;d.setTransform(e[0],e[3],e[1],e[4],e[2],e[5],this.frameAlpha);this.paint(a,c);return true}, paintActorGL:function(a){this.frameAlpha=this.parent.frameAlpha*this.alpha;if(this.glEnabled&&this.visible)if(this.glNeedsFlush(a)){a.glFlush();this.glSetShader(a);if(!this.__uv)this.__uv=new Float32Array(8);if(!this.__vv)this.__vv=new Float32Array(12);this.setGLCoords(this.__vv,0);this.setUV(this.__uv,0);a.glRender(this.__vv,12,this.__uv)}else{var c=a.coordsIndex;this.setGLCoords(a.coords,c);a.coordsIndex=c+12;this.setUV(a.uv,a.uvIndex);a.uvIndex+=8}},setGLCoords:function(a,c){var d=this.viewVertices; a[c++]=d[0].x;a[c++]=d[0].y;a[c++]=0;a[c++]=d[1].x;a[c++]=d[1].y;a[c++]=0;a[c++]=d[2].x;a[c++]=d[2].y;a[c++]=0;a[c++]=d[3].x;a[c++]=d[3].y;a[c]=0},setUV:function(a,c){this.backgroundImage.setUV(a,c)},glNeedsFlush:function(a){return this.getTextureGLPage()!==a.currentTexturePage?true:this.frameAlpha!==a.currentOpacity?true:false},glSetShader:function(a){var c=this.getTextureGLPage();c!==a.currentTexturePage&&a.setGLTexturePage(c);this.frameAlpha!==a.currentOpacity&&a.setGLCurrentOpacity(this.frameAlpha)}, endAnimate:function(){return this},initialize:function(a){if(a)for(var c in a)this[c]=a[c];return this},setClip:function(a,c){this.clip=a;this.clipPath=c;return this},isCached:function(){return this.cached},stopCacheAsBitmap:function(){if(this.cached)this.backgroundImage=null,this.cached=CAAT.Foundation.Actor.CACHE_NONE},cacheAsBitmap:function(a,c){if(this.width<=0||this.height<=0)return this;var a=a||0,d=document.createElement("canvas");d.width=this.width;d.height=this.height;var e=d.getContext("2d"); CAAT.Foundation.Actor.prototype.animate.call(this,CAAT.currentDirector,a);var e={ctx:e,modelViewMatrix:new CAAT.Math.Matrix,worldModelViewMatrix:new CAAT.Math.Matrix,dirtyRectsEnabled:false,inDirtyRect:function(){return true},AABB:new CAAT.Math.Rectangle(0,0,this.width,this.height)},f=this.modelViewMatrix,g=this.worldModelViewMatrix;this.modelViewMatrix=new CAAT.Math.Matrix;this.worldModelViewMatrix=new CAAT.Math.Matrix;this.cached=CAAT.Foundation.Actor.CACHE_NONE;if(typeof c==="undefined")c=CAAT.Foundation.Actor.CACHE_SIMPLE; c===CAAT.Foundation.Actor.CACHE_DEEP?(this.animate(e,a),this.paintActor(e,a)):this instanceof CAAT.Foundation.ActorContainer||this instanceof CAAT.ActorContainer?CAAT.Foundation.ActorContainer.superclass.paintActor.call(this,e,a):(this.animate(e,a),this.paintActor(e,a));this.setBackgroundImage(d);this.cached=c;this.modelViewMatrix=f;this.worldModelViewMatrix=g;return this},resetAsButton:function(){this.actionPerformed=null;this.mouseEnter=function(){};this.mouseExit=function(){};this.mouseDown=function(){}; this.mouseUp=function(){};this.mouseClick=function(){};this.mouseDrag=function(){};return this},setAsButton:function(a,c,d,e,f,g){this.setBackgroundImage(a,true);this.iNormal=c||0;this.iOver=d||this.iNormal;this.iPress=e||this.iNormal;this.iDisabled=f||this.iNormal;this.fnOnClick=g;this.enabled=true;this.setSpriteIndex(c);this.setEnabled=function(a){this.enabled=a;this.setSpriteIndex(this.enabled?this.iNormal:this.iDisabled);return this};this.actionPerformed=function(){this.enabled&&this.fnOnClick&& this.fnOnClick(this)};this.mouseEnter=function(){this.enabled&&(this.dragging?this.setSpriteIndex(this.iPress):this.setSpriteIndex(this.iOver),CAAT.setCursor("pointer"))};this.mouseExit=function(){this.enabled&&(this.setSpriteIndex(this.iNormal),CAAT.setCursor("default"))};this.mouseDown=function(){this.enabled&&this.setSpriteIndex(this.iPress)};this.mouseUp=function(){if(this.enabled)this.setSpriteIndex(this.iNormal),this.dragging=false};this.mouseClick=function(){};this.mouseDrag=function(){if(this.enabled)this.dragging= true};this.setButtonImageIndex=function(a,b,c,d){this.iNormal=a||0;this.iOver=b||this.iNormal;this.iPress=c||this.iNormal;this.iDisabled=d||this.iNormal;this.setSpriteIndex(this.iNormal);return this};return this},findActorById:function(a){return this.id===a?this:null}}}}); CAAT.Module({defines:"CAAT.Foundation.ActorContainer",aliases:["CAAT.ActorContainer"],depends:["CAAT.Foundation.Actor","CAAT.Math.Point","CAAT.Math.Rectangle"],constants:{ADDHINT:{CONFORM:1},AddHint:{CONFORM:1}},extendsClass:"CAAT.Foundation.Actor",extendsWith:function(){var a=CAAT.Foundation.Actor.CACHE_DEEP,b=CAAT.Foundation.ActorContainer.superclass,c=b.drawScreenBoundingBox,d=b.paintActor,e=b.paintActorGL,f=b.animate,g=b.findActorAtPosition,h=b.destroy;return{__init:function(a){this.__super(); this.childrenList=[];this.activeChildren=[];this.pendingChildrenList=[];if(typeof a!=="undefined")this.addHint=a,this.boundingBox=new CAAT.Math.Rectangle;return this},childrenList:null,activeChildren:null,pendingChildrenList:null,addHint:0,boundingBox:null,runion:new CAAT.Math.Rectangle,layoutManager:null,layoutInvalidated:true,setLayout:function(a){this.layoutManager=a;return this},setBounds:function(a,b,c,d){CAAT.Foundation.ActorContainer.superclass.setBounds.call(this,a,b,c,d);CAAT.currentDirector&& !CAAT.currentDirector.inValidation&&this.invalidateLayout();return this},__validateLayout:function(){this.__validateTree();this.layoutInvalidated=false},__validateTree:function(){if(this.layoutManager&&this.layoutManager.isInvalidated()){CAAT.currentDirector.inValidation=true;this.layoutManager.doLayout(this);for(var a=0;a=this.childrenList.length)b=this.childrenList.length;a.parent=this;a.dirty=true;this.childrenList.splice(b,0,a);this.invalidateLayout();return this},findActorById:function(a){if(CAAT.Foundation.ActorContainer.superclass.findActorById.call(this,a))return this;for(var b=this.childrenList,c=0,d=b.length;c=0&&a=0;b--){var c=this.childrenList[b],d=new CAAT.Math.Point(a.x,a.y,0),c=c.findActorAtPosition(d);if(null!==c)return c}return this}, destroy:function(){for(var a=this.childrenList,b=a.length-1;b>=0;b--)a[b].destroy();h.call(this);return this},getNumChildren:function(){return this.childrenList.length},getNumActiveChildren:function(){return this.activeChildren.length},getChildAt:function(a){return this.childrenList[a]},setZOrder:function(a,b){var c=this.findChild(a);if(-1!==c){var d=this.childrenList;if(b!==c){if(b>=d.length)d.splice(c,1),d.push(a);else{c=d.splice(c,1);if(b<0)b=0;else if(b>d.length)b=d.length;d.splice(b,0,c[0])}this.invalidateLayout()}}}}}}); CAAT.Module({defines:"CAAT.Foundation.Scene",depends:"CAAT.Math.Point,CAAT.Math.Matrix,CAAT.PathUtil.Path,CAAT.Behavior.GenericBehavior,CAAT.Behavior.ContainerBehavior,CAAT.Behavior.ScaleBehavior,CAAT.Behavior.AlphaBehavior,CAAT.Behavior.RotateBehavior,CAAT.Behavior.PathBehavior,CAAT.Foundation.ActorContainer,CAAT.Foundation.Timer.TimerManager".split(","),aliases:["CAAT.Scene"],extendsClass:"CAAT.Foundation.ActorContainer",constants:{EASE_ROTATION:1,EASE_SCALE:2,EASE_TRANSLATE:3},extendsWith:function(){return{__init:function(){this.__super(); this.timerManager=new CAAT.TimerManager;this.fillStyle=null;this.isGlobalAlpha=true;return this},easeContainerBehaviour:null,easeContainerBehaviourListener:null,easeIn:false,paused:false,timerManager:null,isPaused:function(){return this.paused},setPaused:function(a){this.paused=a},createTimer:function(a,b,c,d,e){return this.timerManager.createTimer(a,b,c,d,e,this)},setTimeout:function(a,b,c,d){return this.timerManager.createTimer(this.time,a,b,c,d,this)},createAlphaBehaviour:function(a,b){var c=new CAAT.Behavior.AlphaBehavior; c.setFrameTime(0,a);c.startAlpha=b?0:1;c.endAlpha=b?1:0;this.easeContainerBehaviour.addBehavior(c)},easeTranslationIn:function(a,b,c,d){this.easeTranslation(a,b,c,true,d)},easeTranslationOut:function(a,b,c,d){this.easeTranslation(a,b,c,false,d)},easeTranslation:function(a,b,c,d,e){this.easeContainerBehaviour=new CAAT.Behavior.ContainerBehavior;this.easeIn=d;var f=new CAAT.Behavior.PathBehavior;e&&f.setInterpolator(e);f.setFrameTime(0,a);c<1?c=1:c>4&&(c=4);switch(c){case CAAT.Foundation.Actor.ANCHOR_TOP:d? (f.setPath((new CAAT.PathUtil.Path).setLinear(0,-this.height+1,0,0)),this.setPosition(0,-this.height+1)):(f.setPath((new CAAT.PathUtil.Path).setLinear(0,0,0,-this.height+1)),this.setPosition(0,0));break;case CAAT.Foundation.Actor.ANCHOR_BOTTOM:d?(f.setPath((new CAAT.PathUtil.Path).setLinear(0,this.height-1,0,0)),this.setPosition(0,this.height-1)):(f.setPath((new CAAT.PathUtil.Path).setLinear(0,0,0,this.height-1)),this.setPosition(0,0));break;case CAAT.Foundation.Actor.ANCHOR_LEFT:d?(f.setPath((new CAAT.PathUtil.Path).setLinear(-this.width+ 1,0,0,0)),this.setPosition(-this.width+1,0)):(f.setPath((new CAAT.PathUtil.Path).setLinear(0,0,-this.width+1,0)),this.setPosition(0,0));break;case CAAT.Foundation.Actor.ANCHOR_RIGHT:d?(f.setPath((new CAAT.PathUtil.Path).setLinear(this.width-1,0,0,0)),this.setPosition(this.width-1,0)):(f.setPath((new CAAT.PathUtil.Path).setLinear(0,0,this.width-1,0)),this.setPosition(0,0))}b&&this.createAlphaBehaviour(a,d);this.easeContainerBehaviour.addBehavior(f);this.easeContainerBehaviour.setFrameTime(this.time, a);this.easeContainerBehaviour.addListener(this);this.emptyBehaviorList();CAAT.Foundation.Scene.superclass.addBehavior.call(this,this.easeContainerBehaviour)},easeScaleIn:function(a,b,c,d,e){this.easeScale(a,b,c,d,true,e);this.easeIn=true},easeScaleOut:function(a,b,c,d,e){this.easeScale(a,b,c,d,false,e);this.easeIn=false},easeScale:function(a,b,c,d,e,f){this.easeContainerBehaviour=new CAAT.Behavior.ContainerBehavior;var g=0,h=0,i=0,j=0;switch(d){case CAAT.Foundation.Actor.ANCHOR_TOP_LEFT:case CAAT.Foundation.Actor.ANCHOR_TOP_RIGHT:case CAAT.Foundation.Actor.ANCHOR_BOTTOM_LEFT:case CAAT.Foundation.Actor.ANCHOR_BOTTOM_RIGHT:case CAAT.Foundation.Actor.ANCHOR_CENTER:j= i=1;break;case CAAT.Foundation.Actor.ANCHOR_TOP:case CAAT.Foundation.Actor.ANCHOR_BOTTOM:i=g=1;h=0;j=1;break;case CAAT.Foundation.Actor.ANCHOR_LEFT:case CAAT.Foundation.Actor.ANCHOR_RIGHT:j=h=1;g=0;i=1;break;default:alert("scale anchor ?? "+d)}if(!e){var k;k=g;g=i;i=k;k=h;h=j;j=k}c&&this.createAlphaBehaviour(b,e);c=this.getAnchorPercent(d);a=(new CAAT.Behavior.ScaleBehavior).setFrameTime(a,b).setValues(g,i,h,j,c.x,c.y);f&&a.setInterpolator(f);this.easeContainerBehaviour.addBehavior(a);this.easeContainerBehaviour.setFrameTime(this.time, b);this.easeContainerBehaviour.addListener(this);this.emptyBehaviorList();CAAT.Foundation.Scene.superclass.addBehavior.call(this,this.easeContainerBehaviour)},addBehavior:function(){return this},easeRotationIn:function(a,b,c,d){this.easeRotation(a,b,c,true,d);this.easeIn=true},easeRotationOut:function(a,b,c,d){this.easeRotation(a,b,c,false,d);this.easeIn=false},easeRotation:function(a,b,c,d,e){this.easeContainerBehaviour=new CAAT.Behavior.ContainerBehavior;var f=0,g=0;if(c==CAAT.Foundation.Actor.ANCHOR_CENTER)c= CAAT.Foundation.Actor.ANCHOR_TOP;switch(c){case CAAT.Foundation.Actor.ANCHOR_TOP:case CAAT.Foundation.Actor.ANCHOR_BOTTOM:case CAAT.Foundation.Actor.ANCHOR_LEFT:case CAAT.Foundation.Actor.ANCHOR_RIGHT:f=Math.PI*(Math.random()<0.5?1:-1);break;case CAAT.Foundation.Actor.ANCHOR_TOP_LEFT:case CAAT.Foundation.Actor.ANCHOR_TOP_RIGHT:case CAAT.Foundation.Actor.ANCHOR_BOTTOM_LEFT:case CAAT.Foundation.Actor.ANCHOR_BOTTOM_RIGHT:f=Math.PI/2*(Math.random()<0.5?1:-1);break;default:alert("rot anchor ?? "+c)}if(false=== d)var h=f,f=g,g=h;b&&this.createAlphaBehaviour(a,d);b=this.getAnchorPercent(c);f=(new CAAT.Behavior.RotateBehavior).setFrameTime(0,a).setValues(f,g,b.x,b.y);e&&f.setInterpolator(e);this.easeContainerBehaviour.addBehavior(f);this.easeContainerBehaviour.setFrameTime(this.time,a);this.easeContainerBehaviour.addListener(this);this.emptyBehaviorList();CAAT.Foundation.Scene.superclass.addBehavior.call(this,this.easeContainerBehaviour)},setEaseListener:function(a){this.easeContainerBehaviourListener=a}, behaviorExpired:function(){this.easeContainerBehaviourListener.easeEnd(this,this.easeIn)},activated:function(){},setExpired:function(a){this.expired=a},paint:function(a){if(this.fillStyle)a=a.ctx,a.fillStyle=this.fillStyle,a.fillRect(0,0,this.width,this.height)},findActorAtPosition:function(a){var b,c,d=new CAAT.Math.Point;if(this.inputList){var e=this.inputList;for(b=0;b=this.inputList.length&&(b=this.inputList.length-1);b=this.inputList[b];typeof c==="undefined"||c>=b.length?b.push(a):c<=0?b.unshift(a):b.splice(c,0,a);return this},emptyInputList:function(a){a<0?a=0:a>=this.inputList.length&& (a=this.inputList.length-1);this.inputList[a]=[];return this},removeActorFromInputList:function(a,b){if(typeof b==="undefined"){var c,d;for(c=0;c=this.inputList.length&&(b=this.inputList.length-1);e=this.inputList[b];for(d=0;d=0;b--){var c=this.childrenList[b],d=new CAAT.Math.Point(a.x, a.y,0),c=c.findActorAtPosition(d);if(null!==c)return c}return this},resetStats:function(){this.statistics.size_total=0;this.statistics.size_active=0;this.statistics.draws=0;this.statistics.size_discarded_by_dirty_rects=0},render:function(a){if(!this.currentScene||!this.currentScene.isPaused()){this.time+=a;for(e=0,l=this.childrenList.length;e0&&!navigator.isCocoonJS&&CAAT.DEBUG&&CAAT.DEBUG_DIRTYRECTS){f.beginPath();this.nDirtyRects=0;b=this.cDirtyRects;for(e=0;e=this.dirtyRects.length)for(b=0;b<32;b++)this.dirtyRects.push(new CAAT.Math.Rectangle);b=this.dirtyRects[this.dirtyRectsIndex];b.x=a.x;b.y=a.y;b.x1=a.x1;b.y1=a.y1;b.width=a.width;b.height=a.height; this.cDirtyRects.push(b)}},renderToContext:function(a,b){if(b.isInAnimationFrame(this.time)){a.setTransform(1,0,0,1,0,0);a.globalAlpha=1;a.globalCompositeOperation="source-over";a.clearRect(0,0,this.width,this.height);var c=this.ctx;this.ctx=a;a.save();var d=this.modelViewMatrix,e=this.worldModelViewMatrix;this.modelViewMatrix=this.worldModelViewMatrix=new CAAT.Math.Matrix;this.wdirty=true;b.animate(this,b.time);if(b.onRenderStart)b.onRenderStart(b.time);b.paintActor(this,b.time);if(b.onRenderEnd)b.onRenderEnd(b.time); this.worldModelViewMatrix=e;this.modelViewMatrix=d;a.restore();this.ctx=c}},addScene:function(a){a.setBounds(0,0,this.width,this.height);this.scenes.push(a);a.setEaseListener(this);null===this.currentScene&&this.setScene(0)},getNumScenes:function(){return this.scenes.length},easeInOut:function(a,b,c,d,e,f,g,h,i,j){if(a!==this.getCurrentSceneIndex()){a=this.scenes[a];d=this.scenes[d];if(!CAAT.__CSS__&&CAAT.CACHE_SCENE_ON_CHANGE)this.renderToContext(this.transitionScene.ctx,d),d=this.transitionScene; a.setExpired(false);d.setExpired(false);a.mouseEnabled=false;d.mouseEnabled=false;a.resetTransform();d.resetTransform();a.setLocation(0,0);d.setLocation(0,0);a.alpha=1;d.alpha=1;b===CAAT.Foundation.Scene.EASE_ROTATION?a.easeRotationIn(g,h,c,i):b===CAAT.Foundation.Scene.EASE_SCALE?a.easeScaleIn(0,g,h,c,i):a.easeTranslationIn(g,h,c,i);e===CAAT.Foundation.Scene.EASE_ROTATION?d.easeRotationOut(g,h,f,j):e===CAAT.Foundation.Scene.EASE_SCALE?d.easeScaleOut(0,g,h,f,j):d.easeTranslationOut(g,h,f,j);this.childrenList= [];d.goOut(a);a.getIn(d);this.addChild(d);this.addChild(a)}},easeInOutRandom:function(a,b,c,d){var e=Math.random(),f=Math.random(),g;e<0.33?(e=CAAT.Foundation.Scene.EASE_ROTATION,g=(new CAAT.Behavior.Interpolator).createExponentialInOutInterpolator(4)):e<0.66?(e=CAAT.Foundation.Scene.EASE_SCALE,g=(new CAAT.Behavior.Interpolator).createElasticOutInterpolator(1.1,0.4)):(e=CAAT.Foundation.Scene.EASE_TRANSLATE,g=(new CAAT.Behavior.Interpolator).createBounceOutInterpolator());var h;f<0.33?(f=CAAT.Foundation.Scene.EASE_ROTATION, h=(new CAAT.Behavior.Interpolator).createExponentialInOutInterpolator(4)):f<0.66?(f=CAAT.Foundation.Scene.EASE_SCALE,h=(new CAAT.Behavior.Interpolator).createExponentialOutInterpolator(4)):(f=CAAT.Foundation.Scene.EASE_TRANSLATE,h=(new CAAT.Behavior.Interpolator).createBounceOutInterpolator());this.easeInOut(a,e,Math.random()*8.99>>0,b,f,Math.random()*8.99>>0,c,d,g,h)},easeIn:function(a,b,c,d,e,f){a=this.scenes[a];b===CAAT.Foundation.Scene.EASE_ROTATION?a.easeRotationIn(c,d,e,f):b===CAAT.Foundation.Scene.EASE_SCALE? a.easeScaleIn(0,c,d,e,f):a.easeTranslationIn(c,d,e,f);this.childrenList=[];this.addChild(a);a.resetTransform();a.setLocation(0,0);a.alpha=1;a.mouseEnabled=false;a.setExpired(false)},setScene:function(a){a=this.scenes[a];this.childrenList=[];this.addChild(a);this.currentScene=a;a.setExpired(false);a.mouseEnabled=true;a.resetTransform();a.setLocation(0,0);a.alpha=1;a.getIn();a.activated()},switchToScene:function(a,b,c,d){var e=this.getSceneIndex(this.currentScene);d?this.easeInOutRandom(a,e,b,c):this.setScene(a)}, switchToPrevScene:function(a,b,c){var d=this.getSceneIndex(this.currentScene);this.getNumScenes()<=1||d===0||(c?this.easeInOutRandom(d-1,d,a,b):this.setScene(d-1))},switchToNextScene:function(a,b,c){var d=this.getSceneIndex(this.currentScene);this.getNumScenes()<=1||d===this.getNumScenes()-1||(c?this.easeInOutRandom(d+1,d,a,b):this.setScene(d+1))},mouseEnter:function(){},mouseExit:function(){},mouseMove:function(){},mouseDown:function(){},mouseUp:function(){},mouseDrag:function(){},easeEnd:function(a, b){b?(this.currentScene=a,this.currentScene.activated()):a.setExpired(true);a.mouseEnabled=true;a.emptyBehaviorList()},getSceneIndex:function(a){for(var b=0;b500&&(b=500);if(this.onRenderStart)this.onRenderStart(b);this.render(b);this.debugInfo&&this.debugInfo(this.statistics);this.timeline=a;if(this.onRenderEnd)this.onRenderEnd(b);this.needsRepaint=false}},resetTimeline:function(){this.timeline= (new Date).getTime()},endLoop:function(){},setClear:function(a){this.clear=a;this.dirtyRectsEnabled=this.clear===CAAT.Foundation.Director.CLEAR_DIRTY_RECTS?true:false;return this},getAudioManager:function(){return this.audioManager},cumulateOffset:function(a,b,c){var d=c+"Left";c+="Top";for(var e=0,f=0,g;navigator.browser!=="iOS"&&a&&a.style;)if(g=a.currentStyle?a.currentStyle.position:(g=(a.ownerDocument.defaultView||a.ownerDocument.parentWindow).getComputedStyle(a,null))?g.getPropertyValue("position"): null,/^(fixed)$/.test(g))break;else e+=a[d],f+=a[c],a=a[b];return{x:e,y:f,style:g}},getOffset:function(a){var b=this.cumulateOffset(a,"offsetParent","offset");return b.style==="fixed"?(a=this.cumulateOffset(a,a.parentNode?"parentNode":"parentElement","scroll"),{x:b.x+a.x,y:b.y+a.y}):{x:b.x,y:b.y}},getCanvasCoord:function(a,b){var c=new CAAT.Math.Point,d=0,e=0;if(!b)b=window.event;if(b.pageX||b.pageY)d=b.pageX,e=b.pageY;else if(b.clientX||b.clientY)d=b.clientX+document.body.scrollLeft+document.documentElement.scrollLeft, e=b.clientY+document.body.scrollTop+document.documentElement.scrollTop;var f=this.getOffset(this.canvas);d-=f.x;e-=f.y;d*=this.SCREEN_RATIO;e*=this.SCREEN_RATIO;c.x=d;c.y=e;if(!this.modelViewMatrixI)this.modelViewMatrixI=this.modelViewMatrix.getInverse();this.modelViewMatrixI.transformCoord(c);d=c.x;e=c.y;a.set(d,e);this.screenMousePoint.set(d,e)},__mouseDownHandler:function(a){if(this.dragging&&this.lastSelectedActor)this.__mouseUpHandler(a);else{this.getCanvasCoord(this.mousePoint,a);this.isMouseDown= true;var b=this.findActorAtPosition(this.mousePoint);if(null!==b){var c=b.viewToModel(new CAAT.Math.Point(this.screenMousePoint.x,this.screenMousePoint.y,0));b.mouseDown((new CAAT.Event.MouseEvent).init(c.x,c.y,a,b,new CAAT.Math.Point(this.screenMousePoint.x,this.screenMousePoint.y)))}this.lastSelectedActor=b}},__mouseUpHandler:function(a){this.isMouseDown=false;this.getCanvasCoord(this.mousePoint,a);var b=null,c=this.lastSelectedActor;null!==c&&(b=c.viewToModel(new CAAT.Math.Point(this.screenMousePoint.x, this.screenMousePoint.y,0)),c.actionPerformed&&c.contains(b.x,b.y)&&c.actionPerformed(a),c.mouseUp((new CAAT.Event.MouseEvent).init(b.x,b.y,a,c,this.screenMousePoint,this.currentScene.time)));!this.dragging&&null!==c&&c.contains(b.x,b.y)&&c.mouseClick((new CAAT.Event.MouseEvent).init(b.x,b.y,a,c,this.screenMousePoint,this.currentScene.time));this.in_=this.dragging=false},__mouseMoveHandler:function(a){var b,c,d=this.currentScene?this.currentScene.time:0;if(this.isMouseDown&&null!==this.lastSelectedActor){if(b= this.lastSelectedActor,c=b.viewToModel(new CAAT.Math.Point(this.screenMousePoint.x,this.screenMousePoint.y,0)),this.dragging||!(Math.abs(this.prevMousePoint.x-c.x)=this.width||b.y>=this.height))this.touching=true,this.__mouseDownHandler(a)}},__touchEndHandler:function(a){if(this.touching)a.preventDefault(),a.returnValue=false,a=a.changedTouches[0],this.getCanvasCoord(this.mousePoint,a),this.touching=false,this.__mouseUpHandler(a)},__touchMoveHandler:function(a){if(this.touching&&(a.preventDefault(),a.returnValue=false,!this.gesturing))for(var b=0;b=this.width||f.y>=this.height)){var g=this.findActorAtPosition(f);g!==null&&(f=g.viewToModel(f),this.touches[e]||(this.touches[e]={actor:g,touch:new CAAT.Event.TouchInfo(e,f.x,f.y,g)},c.push(e)))}}e={};for(b=0;b=b.width||d.y>=b.height))b.touching=true,b.__mouseDownHandler(c)}},false);window.addEventListener("mouseover",function(c){if(c.target===a&&!b.dragging){c.preventDefault();c.cancelBubble=true;c.stopPropagation&&c.stopPropagation();var d=b.mousePoint; b.getCanvasCoord(d,c);d.x<0||d.y<0||d.x>=b.width||d.y>=b.height||b.__mouseOverHandler(c)}},false);window.addEventListener("mouseout",function(c){if(c.target===a&&!b.dragging)c.preventDefault(),c.cancelBubble=true,c.stopPropagation&&c.stopPropagation(),b.getCanvasCoord(b.mousePoint,c),b.__mouseOutHandler(c)},false);window.addEventListener("mousemove",function(a){a.preventDefault();a.cancelBubble=true;a.stopPropagation&&a.stopPropagation();var d=b.mousePoint;b.getCanvasCoord(d,a);(b.dragging||!(d.x< 0||d.y<0||d.x>=b.width||d.y>=b.height))&&b.__mouseMoveHandler(a)},false);window.addEventListener("dblclick",function(c){if(c.target===a){c.preventDefault();c.cancelBubble=true;c.stopPropagation&&c.stopPropagation();var d=b.mousePoint;b.getCanvasCoord(d,c);d.x<0||d.y<0||d.x>=b.width||d.y>=b.height||b.__mouseDBLClickHandler(c)}},false);CAAT.TOUCH_BEHAVIOR===CAAT.TOUCH_AS_MOUSE?(a.addEventListener("touchstart",this.__touchStartHandler.bind(this),false),a.addEventListener("touchmove",this.__touchMoveHandler.bind(this), false),a.addEventListener("touchend",this.__touchEndHandler.bind(this),false),a.addEventListener("gesturestart",function(c){if(c.target===a)c.preventDefault(),c.returnValue=false,b.__gestureStart(c.scale,c.rotation)},false),a.addEventListener("gestureend",function(c){if(c.target===a)c.preventDefault(),c.returnValue=false,b.__gestureEnd(c.scale,c.rotation)},false),a.addEventListener("gesturechange",function(c){if(c.target===a)c.preventDefault(),c.returnValue=false,b.__gestureChange(c.scale,c.rotation)}, false)):CAAT.TOUCH_BEHAVIOR===CAAT.TOUCH_AS_MULTITOUCH&&(a.addEventListener("touchstart",this.__touchStartHandlerMT.bind(this),false),a.addEventListener("touchmove",this.__touchMoveHandlerMT.bind(this),false),a.addEventListener("touchend",this.__touchEndHandlerMT.bind(this),false),a.addEventListener("touchcancel",this.__touchCancelHandleMT.bind(this),false),a.addEventListener("gesturestart",this.__touchGestureStartHandleMT.bind(this),false),a.addEventListener("gestureend",this.__touchGestureEndHandleMT.bind(this), false),a.addEventListener("gesturechange",this.__touchGestureChangeHandleMT.bind(this),false))},enableEvents:function(a){CAAT.RegisterDirector(this);this.in_=false;this.createEventHandler(a)},createEventHandler:function(a){this.in_=false;this.addHandlers(a)}}},onCreate:function(){if(typeof CAAT.__CSS__!=="undefined")CAAT.Foundation.Director.prototype.clip=true,CAAT.Foundation.Director.prototype.glEnabled=false,CAAT.Foundation.Director.prototype.getRenderType=function(){return"CSS"},CAAT.Foundation.Director.prototype.setScaleProportional= function(a,b){var c=Math.min(a/this.referenceWidth,b/this.referenceHeight);this.setScaleAnchored(c,c,0,0);this.eventHandler.style.width=""+this.referenceWidth+"px";this.eventHandler.style.height=""+this.referenceHeight+"px"},CAAT.Foundation.Director.prototype.setBounds=function(a,b,c,d){CAAT.Foundation.Director.superclass.setBounds.call(this,a,b,c,d);for(a=0;ad+this.range?this.minSize:a===d?this.maxSize:a>0)+1)*b},setFillStyle:function(a){this.fill=a},setStrokeStyle:function(a){this.stroke= a},setStrokeSize:function(a){this.strokeSize=a},setAlignment:function(a){this.alignment=a},setFontSize:function(a){if(a!==this.fontSize)this.fontSize=a,this.__setFont()}};var b=function(){this.text="";return this};b.prototype={x:0,y:0,width:0,text:null,crcs:null,rcs:null,styles:null,images:null,lines:null,documentHeight:0,anchorStack:null,__nextLine:function(){this.x=0;this.currentLine=new f(CAAT.Module.Font.Font.getFontMetrics(this.crcs.sfont));this.lines.push(this.currentLine)},__image:function(a, b,c){var e;e=typeof b!=="undefined"&&typeof c!=="undefined"?a.getWidth():a instanceof CAAT.Foundation.SpriteImage?a.getWidth():a.getWrappedImageWidth();this.width&&e+this.x>this.width&&this.x>0&&this.__nextLine();this.currentLine.addElementImage(new d(this.x,a,b,c,this.crcs.clone(),this.__getCurrentAnchor()));this.x+=e},__text:function(){if(this.text.length!==0){var a=this.ctx.measureText(this.text).width;this.width&&a+this.x>this.width&&this.x>0&&this.__nextLine();this.currentLine.addElement(new e(this.text, this.x,a,0,this.crcs.clone(),this.__getCurrentAnchor()));this.x+=a;this.text=""}},fchar:function(a){a===" "?(this.__text(),this.x+=this.ctx.measureText(a).width,this.width&&this.x>this.width&&this.__nextLine()):this.text+=a},end:function(){this.text.length>0&&this.__text();for(var a=0,b=0,c=0;c>0);this.lines[c].setY(a)}this.documentHeight=a+b},getDocumentHeight:function(){return this.documentHeight}, __getCurrentAnchor:function(){return this.anchorStack.length?this.anchorStack[this.anchorStack.length-1]:null},__resetAppliedStyles:function(){this.rcs=[];this.__pushDefaultStyles()},__pushDefaultStyles:function(){this.crcs=(new a(this.ctx)).setDefault(this.styles["default"]);this.rcs.push(this.crcs)},__pushStyle:function(b){var c=this.crcs;this.crcs=new a(this.ctx);this.crcs.chain=c;this.crcs.setStyle(b);this.crcs.applyStyle();this.rcs.push(this.crcs)},__popStyle:function(){if(this.rcs.length>1)this.rcs.pop(), this.crcs=this.rcs[this.rcs.length-1],this.crcs.applyStyle()},__popAnchor:function(){this.anchorStack.length>0&&this.anchorStack.pop()},__pushAnchor:function(a){this.anchorStack.push(a)},start:function(a,b,c,d){this.y=this.x=0;this.width=typeof d!=="undefined"?d:0;this.ctx=a;this.lines=[];this.styles=b;this.images=c;this.anchorStack=[];this.__resetAppliedStyles();this.__nextLine()},setTag:function(a){this.__text();a=a.toLowerCase();if(a==="b")this.crcs.setBold(true);else if(a==="/b")this.crcs.setBold(false); else if(a==="i")this.crcs.setItalic(true);else if(a==="/i")this.crcs.setItalic(false);else if(a==="stroked")this.crcs.setStroked(true);else if(a==="/stroked")this.crcs.setStroked(false);else if(a==="filled")this.crcs.setFilled(true);else if(a==="/filled")this.crcs.setFilled(false);else if(a==="tab")this.x=this.crcs.getTabPos(this.x);else if(a==="br")this.__nextLine();else if(a==="/a")this.__popAnchor();else if(a==="/style")this.rcs.length>1&&this.__popStyle();else if(a.indexOf("fillcolor")===0)a= a.split("="),this.crcs.setFillStyle(a[1]);else if(a.indexOf("strokecolor")===0)a=a.split("="),this.crcs.setStrokeStyle(a[1]);else if(a.indexOf("strokesize")===0)a=a.split("="),this.crcs.setStrokeSize(a[1]|0);else if(a.indexOf("fontsize")===0)a=a.split("="),this.crcs.setFontSize(a[1]|0);else if(a.indexOf("style")===0)a=a.split("="),(a=this.styles[a[1]])&&this.__pushStyle(a);else if(a.indexOf("image")===0){var a=a.split("=")[1].split(","),b=a[0];if(this.images[b]){var c=0,d=0;a.length>=3&&(c=a[1]|0, d=a[2]|0);this.__image(this.images[b],c,d)}else CAAT.currentDirector.getImage(b)&&this.__image(CAAT.currentDirector.getImage(b))}else a.indexOf("a=")===0&&(a=a.split("="),this.__pushAnchor(a[1]))}};var c=function(a,b){this.link=a;this.style=b;return this};c.prototype={x:null,y:null,width:null,height:null,style:null,link:null,isLink:function(){return this.link},setLink:function(a){this.link=a;return this},getLink:function(){return this.link},contains:function(){return false}};var d=function(a,b,c, e,f,m){d.superclass.constructor.call(this,m,f);this.x=a;this.image=b;this.row=c;this.column=e;this.width=b.getWidth();this.height=b.getHeight();if(this.image instanceof CAAT.SpriteImage||this.image instanceof CAAT.Foundation.SpriteImage)this.spriteIndex=typeof c==="undefined"||typeof e==="undefined"?0:c*b.columns+e,this.paint=this.paintSI;return this};d.prototype={image:null,row:null,column:null,spriteIndex:null,paint:function(a){this.style.image(a);a.drawImage(this.image,this.x,-this.height+1)}, paintSI:function(a){this.style.image(a);this.image.setSpriteIndex(this.spriteIndex);this.image.paint({ctx:a},0,this.x,-this.height+1)},getHeight:function(){return this.image instanceof CAAT.Foundation.SpriteImage?this.image.getHeight():this.image.height},getFontMetrics:function(){return null},contains:function(a,b){return a>=this.x&&a<=this.x+this.width&&b>=this.y&&b=this.x&&a<=this.x+this.width&&b>=this.y&&b<=this.y+this.height},setYPosition:function(a){this.bl=a;this.y=a-this.fm.ascent}}; extend(d,c);extend(e,c);var f=function(a){this.elements=[];this.defaultFontMetrics=a;return this};f.prototype={elements:null,width:0,height:0,defaultHeight:0,y:0,x:0,alignment:null,baselinePos:0,addElement:function(a){this.width=Math.max(this.width,a.x+a.width);this.height=Math.max(this.height,a.height);this.elements.push(a);this.alignment=a.style.__getProperty("alignment")},addElementImage:function(a){this.width=Math.max(this.width,a.x+a.width);this.height=Math.max(this.height,a.height);this.elements.push(a)}, getHeight:function(){return this.height},setY:function(a){this.y=a},getY:function(){return this.y},paint:function(a){a.save();a.translate(this.x,this.y+this.baselinePos);for(var b=0;b=0.6&&this.elements.length>1){var c=a-this.width,c=c/(this.elements.length- 1)|0;for(b=1;ba.ascent&&(a=e):a=e:b?d.getHeight()>d.getHeight()&&(b=d):b=d}this.baselinePos=Math.max(a?a.ascent:this.defaultFontMetrics.ascent,b?b.getHeight():this.defaultFontMetrics.ascent);this.height= this.baselinePos+(a!=null?a.descent:this.defaultFontMetrics.descent);for(c=0;c", d+1),-1!==o&&(n=f.substr(d+1,o-d-1),n.indexOf("<")!==-1?(this.rc.fchar(p),d+=1):(this.rc.setTag(n),d=o+1))):(this.rc.fchar(p),d+=1);this.rc.end();this.lines=this.rc.lines;this.__calculateDocumentDimension(typeof b==="undefined"?0:b);this.setLinesAlignment();q.restore();this.setPreferredSize(this.documentWidth,this.documentHeight);this.invalidateLayout();this.setDocumentPosition();c&&this.cacheAsBitmap(0,c);if(this.matchTextSize)this.width=this.preferredSize.width,this.height=this.preferredSize.height; return this}},setVerticalAlignment:function(a){this.valignment=a;this.setDocumentPosition();return this},setHorizontalAlignment:function(a){this.halignment=a;this.setDocumentPosition();return this},setDocumentPosition:function(a,b){typeof a!=="undefined"&&this.setHorizontalAlignment(a);typeof b!=="undefined"&&this.setVerticalAlignment(b);var c=0,d=0;this.valignment===CAAT.Foundation.UI.Layout.LayoutManager.ALIGNMENT.CENTER?d=(this.height-this.documentHeight)/2:this.valignment===CAAT.Foundation.UI.Layout.LayoutManager.ALIGNMENT.BOTTOM&& (d=this.height-this.documentHeight);this.halignment===CAAT.Foundation.UI.Layout.LayoutManager.ALIGNMENT.CENTER?c=(this.width-this.documentWidth)/2:this.halignment===CAAT.Foundation.UI.Layout.LayoutManager.ALIGNMENT.RIGHT&&(c=this.width-this.documentWidth);this.documentX=c;this.documentY=d},__calculateDocumentDimension:function(a){var b,c=0;for(b=this.documentHeight=this.documentWidth=0;b=a&&d.y+d.height>=b)return d.__getElementAt(a-d.x,b-d.y)}return null},mouseExit:function(){CAAT.setCursor("default")},mouseMove:function(a){(a=this.__getDocumentElementAt(a.x,a.y))&&a.getLink()?CAAT.setCursor("pointer"):CAAT.setCursor("default")},mouseClick:function(a){this.clickCallback&&(a=this.__getDocumentElementAt(a.x,a.y),a.getLink()&& this.clickCallback(a.getLink()))},setClickCallback:function(a){this.clickCallback=a;return this}}}}); CAAT.Module({defines:"CAAT.Foundation.UI.PathActor",aliases:["CAAT.PathActor"],depends:["CAAT.Foundation.Actor"],extendsClass:"CAAT.Foundation.Actor",extendsWith:{path:null,pathBoundingRectangle:null,bOutline:false,outlineColor:"black",onUpdateCallback:null,interactive:false,getPath:function(){return this.path},setPath:function(a){this.path=a;if(a!=null)this.pathBoundingRectangle=a.getBoundingBox(),this.setInteractive(this.interactive);return this},paint:function(a,b){CAAT.Foundation.UI.PathActor.superclass.paint.call(this, a,b);if(this.path){var c=a.ctx;c.strokeStyle="#000";this.path.paint(a,this.interactive);if(this.bOutline)c.strokeStyle=this.outlineColor,c.strokeRect(this.pathBoundingRectangle.x,this.pathBoundingRectangle.y,this.pathBoundingRectangle.width,this.pathBoundingRectangle.height)}},showBoundingBox:function(a,b){if((this.bOutline=a)&&b)this.outlineColor=b;return this},setInteractive:function(a){this.interactive=a;this.path&&this.path.setInteractive(a);return this},setOnUpdateCallback:function(a){this.onUpdateCallback= a;return this},mouseDrag:function(a){this.path.drag(a.point.x,a.point.y,this.onUpdateCallback)},mouseDown:function(a){this.path.press(a.point.x,a.point.y)},mouseUp:function(){this.path.release()}}}); CAAT.Module({defines:"CAAT.Foundation.UI.ShapeActor",aliases:["CAAT.ShapeActor"],extendsClass:"CAAT.Foundation.ActorContainer",depends:["CAAT.Foundation.ActorContainer"],constants:{SHAPE_CIRCLE:0,SHAPE_RECTANGLE:1},extendsWith:{__init:function(){this.__super();this.compositeOp="source-over";this.setShape(CAAT.Foundation.UI.ShapeActor.SHAPE_CIRCLE);return this},shape:0,compositeOp:null,lineWidth:1,lineCap:null,lineJoin:null,miterLimit:null,setLineWidth:function(a){this.lineWidth=a;return this},setLineCap:function(a){this.lineCap= a;return this},setLineJoin:function(a){this.lineJoin=a;return this},setMiterLimit:function(a){this.miterLimit=a;return this},getLineCap:function(){return this.lineCap},getLineJoin:function(){return this.lineJoin},getMiterLimit:function(){return this.miterLimit},getLineWidth:function(){return this.lineWidth},setShape:function(a){this.shape=a;this.paint=this.shape===CAAT.Foundation.UI.ShapeActor.SHAPE_CIRCLE?this.paintCircle:this.paintRectangle;return this},setCompositeOp:function(a){this.compositeOp= a;return this},paint:function(){},paintCircle:function(a,b){if(this.cached)CAAT.Foundation.ActorContainer.prototype.paint.call(this,a,b);else{var c=a.ctx;c.lineWidth=this.lineWidth;c.globalCompositeOperation=this.compositeOp;if(null!==this.fillStyle)c.fillStyle=this.fillStyle,c.beginPath(),c.arc(this.width/2,this.height/2,Math.min(this.width,this.height)/2-this.lineWidth/2,0,2*Math.PI,false),c.fill();if(null!==this.strokeStyle)c.strokeStyle=this.strokeStyle,c.beginPath(),c.arc(this.width/2,this.height/ 2,Math.min(this.width,this.height)/2-this.lineWidth/2,0,2*Math.PI,false),c.stroke()}},paintRectangle:function(a,b){if(this.cached)CAAT.Foundation.ActorContainer.prototype.paint.call(this,a,b);else{var c=a.ctx;c.lineWidth=this.lineWidth;if(this.lineCap)c.lineCap=this.lineCap;if(this.lineJoin)c.lineJoin=this.lineJoin;if(this.miterLimit)c.miterLimit=this.miterLimit;c.globalCompositeOperation=this.compositeOp;if(null!==this.fillStyle)c.fillStyle=this.fillStyle,c.beginPath(),c.fillRect(0,0,this.width, this.height),c.fill();if(null!==this.strokeStyle)c.strokeStyle=this.strokeStyle,c.beginPath(),c.strokeRect(0,0,this.width,this.height),c.stroke()}}}}); CAAT.Module({defines:"CAAT.Foundation.UI.StarActor",aliases:["CAAT.StarActor"],depends:["CAAT.Foundation.ActorContainer"],extendsClass:"CAAT.Foundation.ActorContainer",extendsWith:{__init:function(){this.__super();this.compositeOp="source-over";return this},nPeaks:0,maxRadius:0,minRadius:0,initialAngle:0,compositeOp:null,lineWidth:1,lineCap:null,lineJoin:null,miterLimit:null,setLineWidth:function(a){this.lineWidth=a;return this},setLineCap:function(a){this.lineCap=a;return this},setLineJoin:function(a){this.lineJoin= a;return this},setMiterLimit:function(a){this.miterLimit=a;return this},getLineCap:function(){return this.lineCap},getLineJoin:function(){return this.lineJoin},getMiterLimit:function(){return this.miterLimit},getLineWidth:function(){return this.lineWidth},setFilled:function(){return this},setOutlined:function(){return this},setCompositeOp:function(a){this.compositeOp=a;return this},setInitialAngle:function(a){this.initialAngle=a;return this},initialize:function(a,b,c){this.setSize(2*b,2*b);this.nPeaks= a;this.maxRadius=b;this.minRadius=c;return this},paint:function(a){var a=a.ctx,b=this.width/2,c=this.height/2,d=this.maxRadius,e=this.minRadius,f=b+d*Math.cos(this.initialAngle),g=c+d*Math.sin(this.initialAngle);a.lineWidth=this.lineWidth;if(this.lineCap)a.lineCap=this.lineCap;if(this.lineJoin)a.lineJoin=this.lineJoin;if(this.miterLimit)a.miterLimit=this.miterLimit;a.globalCompositeOperation=this.compositeOp;a.beginPath();a.moveTo(f,g);for(f=1;f>0,e.y>>0):c.translate(e.x,e.y);c.rotate(f);this.fill&&c.fillText(h,0,0);if(this.outline)c.beginPath(),c.lineWidth=this.lineWidth,c.strokeText(h,0,0);c.restore();d+=i}},drawSpriteText:function(a,b){null===this.path?this.font.drawText(this.text,a.ctx,0,0):this.drawSpriteTextOnPath(a,b)},drawSpriteTextOnPath:function(a,b){for(var c=a.ctx,d=this.sign*this.pathInterpolator.getPosition(b% this.pathDuration/this.pathDuration).y*this.path.getLength(),e=new CAAT.Math.Point(0,0,0),f=new CAAT.Math.Point(0,0,0),g=0;g