event-flick-min.js revision 7aec7acc84e25b895e5ba085d04ef3176d97f272
5f40f927dba3cf399373572f6ed6fe59a376376eTodd KlootsYUI.add("event-flick",function(B){var F=("ontouchstart" in B.config.win&&!B.UA.chrome)?{start:"touchstart",end:"touchend"}:{start:"mousedown",end:"mouseup"},G="start",J="end",A="ownerDocument",H="minVelocity",D="minDistance",C="_fs",E="_fsh",K="_feh",I="nodeType";B.Event.define("flick",{on:function(M,L,O){var N=M.on(F[G],this._onStart,this,M,L,O);L[E]=N;},detach:function(N,M,P){var O=M[E],L=M[K];if(O){O.detach();M[E]=null;}if(L){L.detach();M[K]=null;}},publishConfig:{emitFacade:false},processArgs:function(L){var M=(L[3])?B.merge(L.splice(3,1)[0]):{};if(!(H in M)){M.minVelocity=this.MIN_VELOCITY;}if(!(D in M)){M.minDistance=this.MIN_DISTANCE;}return M;},_onStart:function(R,N,M,Q){var S=true,L,P,O=R;if(R.touches){S=(R.touches.length===1);R=R.touches[0];}if(S){O.preventDefault();R.flick={time:new Date().getTime()};M[C]=R;L=M[K];if(!L){P=(N.get(I)===9)?N:N.get(A);L=P.on(F[J],B.bind(this._onEnd,this),null,N,M,Q);M[K]=L;}}},_onEnd:function(Y,S,Z,P){var X=new Date().getTime(),N=Z[C],L=!!N,a=Y,O,R,U,W,M,V,T,Q;if(L){if(Y.changedTouches){if(Y.changedTouches.length===1&&Y.touches.length===0){a=Y.changedTouches[0];}else{L=false;}}if(L){a.preventDefault();O=N.flick.time;X=new Date().getTime();R=X-O;U=Z._extra;W=[a.pageX-N.pageX,a.pageY-N.pageY];Q=U.axis||(Math.abs(W[0])>=Math.abs(W[1]))?"x":"y";M=W[(Q==="x")?0:1];V=Math.abs(M);T=V/R;if(isFinite(T)&&(V>=U.minDistance)&&(T>=U.minVelocity)){Y.type="flick";Y.flick={time:R,distance:M,direction:M/V,velocity:T,axis:Q,start:N};P.fire(Y);}Z[C]=null;}}},MIN_VELOCITY:0,MIN_DISTANCE:0});},"@VERSION@",{requires:["node-base","event-touch","event-synthetic"]});