event-gestures-min.js revision c085d8015ca7637ffa99e3bf8c9af0136e593d59
YUI.add("event-flick",function(E){var D="ontouchstart" in E.config.win,H=(D)?{start:"touchstart",end:"touchend"}:{start:"mousedown",end:"mouseup"},I="start",L="end",B="ownerDocument",J="minVelocity",F="minDistance",A="_fs",C="_fsh",G="_feh",K="nodeType";E.Event.define("flick",{init:function(N,M,P){var O=N.on(H[I],E.bind(this._onStart,this),null,N,M,P);N.setData(C,O);},destroy:function(O,N,Q){var P=O.getData(C),M=O.getData(G);if(P){P.detach();O.setData(C,null);}if(M){M.detach();O.setData(G,null);}},processArgs:function(M){var N=(M[3])?M.splice(3,1):{};if(!(J in N)){N.minVelocity=this.MIN_VELOCITY;}if(!(F in N)){N.minDistance=this.MIN_DISTANCE;}return N;},_onStart:function(R,O,N,Q){var S=true,M,P;if(R.touches){S=(R.touches.length===1);R=R.touches[0];}if(S){R.preventDefault();O.setData(A,{time:new Date().getTime(),pageX:R.pageX,pageY:R.pageY,clientX:R.clientX,clientY:R.clientY,_e:R});M=O.getData(G);if(!M){P=O.get(K)===9?O:O.get(B);M=P.on(H[L],E.bind(this._onEnd,this),null,O,N,Q);O.setData(G,M);}}},_onEnd:function(Z,T,a,Q){var Y=new Date().getTime(),M=T.getData(A),O=M,b=Z,P,S,V,X,N,W,U,R;if(M){if(Z.changedTouches){if(Z.changedTouches.length===1&&Z.touches.length===0){b=Z.changedTouches[0];}else{M=false;}}if(M){P=O.time;Y=new Date().getTime();S=Y-P;V=a._extra;X=[b.pageX-O.pageX,b.pageY-O.pageY];R=V.axis||(Math.abs(X[0])>=Math.abs(X[1]))?"x":"y";N=X[(R==="x")?0:1];W=Math.abs(N);U=W/S;if(isFinite(U)&&U>=V.minVelocity&&W>=V.minDistance){Q.fire({distance:N,time:S,velocity:U,axis:R,start:O,end:{time:Y,clientX:b.clientX,clientY:b.clientY,pageX:b.pageX,pageY:b.pageY,_e:Z}});}T.setData(A,null);}}},MIN_VELOCITY:0,MIN_DISTANCE:10});},"@VERSION@",{requires:["node-base","event-touch","event-synthetic"]});YUI.add("event-move",function(D){var C="ontouchstart" in D.config.win,K=(C)?{start:"touchstart",move:"touchmove",end:"touchend"}:{start:"mousedown",move:"mousemove",end:"mouseup"},L="start",F="move",Q="end",N="_msh",E="_mh",I="_meh",M="_ms",P="_m",J="minTime",G="minDistance",A="ownerDocument",O="nodeType",B={emitFacade:false},H=D.Event.define;H("movestart",{init:function(S,R,T){S.setData(N,S.on(K[L],this._onStart,null,S,R,T));},destroy:function(S,R,U){var T=S.getData(N);if(T){T.detach();S.setData(N,null);}},processArgs:function(R){var S=R[3]?R.splice(3,1):{};if(!(J in S)){S[J]=this.MIN_TIME;}if(!(G in S)){S[G]=this.MIN_DISTANCE;}return S;},publishConfig:B,_onStart:function(U,S,R,T){U.preventDefault();var V=true;if(U.touches){V=(U.touches.length===1);U=U.touches[0];}if(V){U.type="movestart";S.setData(M,U);T.fire(U);}},MIN_TIME:0,MIN_DISTANCE:3});H("move",{init:function(S,R,V){var U=S.get(O)===9?S:S.get(A),T=U.on(K[F],D.bind(this._onMove,this),null,S,R,V);S.setData(E,T);},destroy:function(S,R,U){var T=S.getData(E);if(T){T.detach();S.setData(E,null);}},publishConfig:B,_onMove:function(V,T,S,U){var X=T.getData(M),R=!!(X),W;if(R){if(V.touches){R=(V.touches.length===1);W=V;V=V.touches[0];if(!V.target){V.target=W.target;V.currentTarget=W.currentTarget;}}if(R){V.preventDefault();V.type="move";T.setData(P,V);U.fire(V);}}}});H("moveend",{init:function(T,S,V){var U=T.get(O)===9?T:T.get(A),R=U.on(K[Q],D.bind(this._onEnd,this),null,T,S,V);T.setData(I,R);},destroy:function(T,S,U){var R=T.getData(I);if(R){R.detach();T.setData(I,null);}},publishConfig:B,_onEnd:function(V,S,R,U){var T=!!(S.getData(P)||S.getData(M));if(T){if(V.changedTouches){if(V.changedTouches.length===1){V=V.changedTouches[0];}else{T=false;}}if(T){V.preventDefault();V.type="moveend";S.setData(M,null);S.setData(P,null);U.fire(V);}}}});},"@VERSION@",{requires:["node-base","event-touch","event-synthetic"]});YUI.add("event-gestures",function(A){},"@VERSION@",{use:["event-flick","event-move"]});