AUI.add("aui-drawing-drag",function(C){var G=C.Lang,D=C.config.doc,E=C.Drawing,B=E.Element,I=B.prototype,F={standAlone:true},K={mousedown:"gesturemovestart",mousemove:"gesturemove",mouseup:"gesturemoveend"},H="createTouch" in D;var J=E.Drag={drags:[]};B._getEventType=function(A){return K[A]||A;};B._getEventConfig=function(A,L){return K[L]?F:null;};J.dragMove=function(P){var A=P.clientX;var R=P.clientY;var M;var O=J.drags;var L=O.length;while(L--){M=O[L];if(H){var N=P.touches.length;var Q;while(N--){Q=P.touches[N];if(Q.identifier==M.el._drag.id){A=Q.clientX;R=Q.clientY;(P.originalEvent?P.originalEvent:P).preventDefault();break;}}}else{P.preventDefault();}if(M.move){M.move.call(M.el,A-M.el._drag.x,R-M.el._drag.y,A,R);}}};J.dragUp=function(){J._dragMoveHandle.detach();J._dragUpHandle.detach();var M=J.drags;var L=M.length;var A;while(L--){A=M[L];A.el._drag={};if(A.end){A.end.call(A.el);}}J.drags=[];};I.drag=function(L,N,M){var A=this;A._drag={};A.on("mousedown",function(R){var Q=this;(R.originalEvent||R).preventDefault();Q._drag.x=R.clientX;Q._drag.y=R.clientY;Q._drag.id=R.identifier;if(N){N.call(Q,R.clientX,R.clientY);}if(!J.drags.length){var O=B._getEventType("mousemove");var P=B._getEventType("mouseup");J._dragMoveHandle=C.on(O,J.dragMove,D,B._getEventConfig(O,"mousemove"));J._dragUpHandle=C.on(P,J.dragUp,D,B._getEventConfig(P,"mouseup"));}J.drags.push({el:this,move:L,end:M});});return A;};I.undrag=function(L,P,O){var A=this;var N=J.drags;var M=N.length;while(M--){N[M].el==A&&(N[M].move==L&&N[M].end==O)&&N.splice(M,1);if(!N.length){J._dragMoveHandle.detach();J._dragUpHandle.detach();}}};E.Set.addMethod(["drag","undrag"]);},"1.0.1",{requires:["aui-drawing-base","event-gestures"]});