event-move-min.js revision 7aec7acc84e25b895e5ba085d04ef3176d97f272
YUI.add("event-move",function(B){var F=("ontouchstart" in B.config.win&&!B.UA.chrome)?{start:"touchstart",move:"touchmove",end:"touchend"}:{start:"mousedown",move:"mousemove",end:"mouseup"},N="start",R="move",E="end",Q="_msh",H="_mh",M="_meh",D="_ms",J="_m",P="minTime",K="minDistance",L="ownerDocument",I="nodeType",O={emitFacade:false},G=function(S){return S[3]?B.merge(S.splice(3,1)[0]):{};},C=function(T,S){return S._extra.root||(T.get(I)===9)?T:T.get(L);},A=B.Event.define;A("gesturemovestart",{on:function(T,S,U){S[Q]=T.on(F[N],this._onStart,this,T,S,U);},detach:function(T,S,V){var U=S[Q];if(U){U.detach();S[Q]=null;}},processArgs:function(S){var T=G(S);if(!(P in T)){T[P]=this.MIN_TIME;}if(!(K in T)){T[K]=this.MIN_DISTANCE;}return T;},publishConfig:O,fireFilter:function(T,S){return S[0]._extra===T._extra;},_onStart:function(Y,U,d,T){Y.preventDefault();var Z=Y,V=d._extra,S=true,W=V.minTime,c=V.minDistance,X=V.button,b=C(U,d),a;if(Y.touches){S=(Y.touches.length===1);Y=Y.touches[0];Y.target=Y.target||Z.target;Y.currentTarget=Y.currentTarget||Z.currentTarget;}else{S=(X===undefined)||(X=Y.button);}if(S){if(W===0||c===0){this._start(Y,U,T,V);}else{a=[Y.pageX,Y.pageY];if(W>0){V._ht=B.later(W,this,this._start,[Y,U,T,V]);V._hme=b.on(F[E],B.bind(function(){this._cancel(V);},this));}if(c>0){V._hm=b.on(F[R],B.bind(function(e){if(Math.abs(e.pageX-a[0])>c||Math.abs(e.pageY-a[1])>c){this._start(Y,U,T,V);}},this));}}}},_cancel:function(S){if(S._ht){S._ht.cancel();S._ht=null;}if(S._hme){S._hme.detach();S._hme=null;}if(S._hm){S._hm.detach();S._hm=null;}},_start:function(U,S,T,V){if(V){this._cancel(V);}U.type="gesturemovestart";U._extra=V;S.setData(D,U);T.fire(U);},MIN_TIME:0,MIN_DISTANCE:0});A("gesturemove",{on:function(U,T,W){var S=C(U,T),V=S.on(F[R],this._onMove,this,U,T,W);T[H]=V;},processArgs:G,detach:function(T,S,V){var U=S[H];if(U){U.detach();S[H]=null;}},publishConfig:O,fireFilter:function(T,S){var U=S[0]._extra.node,V=T._extra.standAlone;return V||U.getData(D);},_onMove:function(X,U,T,W){var S=T._extra.standAlone||U.getData(D),V=X;if(S){if(X.touches){S=(X.touches.length===1);X=X.touches[0];X.target=X.target||V.target;X.currentTarget=X.currentTarget||V.currentTarget;}if(S){V.preventDefault();X.type="gesturemove";X._extra={node:U};W.fire(X);}}}});A("gesturemoveend",{on:function(V,U,W){var T=C(V,U),S=T.on(F[E],this._onEnd,this,V,U,W);U[M]=S;},processArgs:G,detach:function(U,T,V){var S=T[M];if(S){S.detach();T[M]=null;}},fireFilter:function(T,S){var U=S[0]._extra.node,V=T._extra.standAlone;return V||U.getData(J)||U.getData(D);},publishConfig:O,_onEnd:function(X,T,S,W){var V=S._extra.standAlone||T.getData(J)||T.getData(D),U=X;if(V){if(X.changedTouches){if(X.changedTouches.length===1){X=X.changedTouches[0];X.target=X.target||U.target;X.currentTarget=X.currentTarget||U.currentTarget;}else{V=false;}}if(V){U.preventDefault();X.type="gesturemoveend";X._extra={node:T};W.fire(X);T.clearData(D);T.clearData(J);}}}});},"@VERSION@",{requires:["node-base","event-touch","event-synthetic"]});