/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */

window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","esri.touchcontainer"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["esri.touchcontainer"]){_4._hasResource["esri.touchcontainer"]=true;_4.provide("esri.touchcontainer");_4.declare("esri._MapContainer",esri._CoreMap,(function(){var _7=_4.connect,_8=_4.disconnect,_9=esri.geometry.Point;var _a=300;return {constructor:function(){this._onTouchStart_connect=_7(this.__container,"ontouchstart",this,this._onTouchStartHandler);this._gestureStartConnect=_7(this.__container,"ongesturestart",this,this._onGestureStartHandler);this._connects.push(_7(this.__container,"onmouseover",this,this._onMouseOverHandler));this._connects.push(_7(this.__container,"onmouseout",this,this._onMouseOutHandler));this._connects.push(_7(this.__container,"onmousedown",this,this._onMouseDownHandler));this._connects.push(_7(this.__container,"onmouseup",this,this._onMouseUpHandler));this._connects.push(_7(this.__container,"onclick",this,this._onClickHandler));this._endX=this._endY=0;this._firstTapOn=false;this._processDoubleTap=false;this._processMultiTouchTap=false;this._doubleTapTimeoutObject=false;this._doubleTapTimeout=_4.hitch(this,this._doubleTapTimeout);},_doubleTapTimeout:function(){this._firstTapOn=false;},_cleanUp:function(){var i;for(i=this._connects.length;i>=0;i--){_8(this._connects[i]);delete this._connects[i];}_8(this._onTouchMoveHandler_connect);_8(this._onTouchEndHandler_connect);_8(this._onTouchCancelHandler_connect);this.inherited("_cleanUp",arguments);},__setClickDuration:function(_b){this._clickDuration=_b;},__resetClickDuration:function(){this._clickDuration=_a;},_processEvent:function(_c){if(_c.type.indexOf("touch")!==-1){if(_c.touches.length===2){_c.screenPoints=[new _9(_c.touches.item(0).pageX-this.position.x,_c.touches.item(0).pageY-this.position.y),new _9(_c.touches.item(1).pageX-this.position.x,_c.touches.item(1).pageY-this.position.y)];return _c;}else{if(_c.type==="touchstart"){_c.screenPoint=new _9(_c.targetTouches.item(0).pageX-this.position.x,_c.targetTouches.item(0).pageY-this.position.y);}else{_c.screenPoint=new _9(_c.changedTouches.item(0).pageX-this.position.x,_c.changedTouches.item(0).pageY-this.position.y);}_c.mapPoint=this.extent?this.toMap(_c.screenPoint):new _9();return _c;}}_c.screenPoint=new _9(_c.pageX-this.position.x,_c.pageY-this.position.y);_c.mapPoint=this.extent?this.toMap(_c.screenPoint):new _9();return _c;},_onClickHandler:function(_d){_d=this._processEvent(_d);var dx=Math.abs(this._endX-_d.screenPoint.x);var dy=Math.abs(this._endY-_d.screenPoint.y);if(esri.isBlackBerry){clearTimeout(this._doubleTapTimeoutObject);this._firstTapOn=false;if(!this._tmoved){this.onClick(_d);}}else{if(dx<=1&&dy<=1){var ts=(new Date()).getTime(),_e=this._clkTS&&((ts-this._clkTS)<=400),_f=_e&&Math.abs(this._lastClickX-_d.pageX),_10=_e&&Math.abs(this._lastClickY-_d.pageY);clearTimeout(this._doubleTapTimeoutObject);this._firstTapOn=false;this.onClick(_d);if(esri.isAndroid&&_e&&_f<=15&&_10<=15){this.onDblClick(_d);this._processDoubleTap=false;}}}},_onMouseOverHandler:function(evt){evt=this._processEvent(evt);this.onMouseOver(evt);},_onMouseOutHandler:function(evt){evt=this._processEvent(evt);this.onMouseOut(evt);},_onMouseDownHandler:function(evt){evt=this._processEvent(evt);this.onMouseDown(evt);},_onMouseUpHandler:function(evt){evt=this._processEvent(evt);this.onMouseUp(evt);},_onTouchStartHandler:function(evt){var _11;if(this._firstTapOn){if(esri.isBlackBerry){if(this._lastTouchEvent==="touchend"){this._processDoubleTap=true;clearTimeout(this._doubleTapTimeoutObject);this._firstTapOn=false;_11=1;}}else{this._processDoubleTap=true;clearTimeout(this._doubleTapTimeoutObject);this._firstTapOn=false;}}else{this._firstTapOn=true;this._doubleTapTimeoutObject=setTimeout(this._doubleTapTimeout,400);}this._lastTouchEvent="touchstart";evt=this._processEvent(evt);this._tmoved=false;_8(this._onTouchMoveHandler_connect);_8(this._onTouchEndHandler_connect);_8(this._onTouchCancelHandler_connect);this._onTouchMoveHandler_connect=_7(this.__container,"ontouchmove",this,this._onTouchMoveHandler);this._onTouchEndHandler_connect=_7(this.__container,"ontouchend",this,this._onTouchEndHandler);this._onTouchCancelHandler_connect=_7(this.__container,"ontouchcancel",this,this._onTouchEndHandler);this.onTouchStart(evt);if(_11){this._onTouchEndHandler(evt);}},_onTouchMoveHandler:function(evt){this._tmoved=true;this.onTouchMove(this._processEvent(evt));},_onTouchEndHandler:function(evt){_8(this._onTouchMoveHandler_connect);_8(this._onTouchEndHandler_connect);_8(this._onTouchCancelHandler_connect);this._lastTouchEvent="touchend";evt=this._processEvent(evt);var dx=Math.abs(this._endX-evt.screenPoint.x),dy=Math.abs(this._endY-evt.screenPoint.y);this._endX=evt.screenPoint.x;this._endY=evt.screenPoint.y;this.onTouchEnd(evt);if(this._processDoubleTap){if(dx<=15&&dy<=15){this.onDblClick(evt);}this._processDoubleTap=false;}},_onGestureStartHandler:function(evt){_8(this._onTouchStart_connect);_8(this._gestureStartConnect);_8(this._onTouchMoveHandler_connect);_8(this._onTouchEndHandler_connect);_8(this._onTouchCancelHandler_connect);this._processMultiTouchTap=true;this._onTouchMoveHandler_connect=_7(this.__container,"ontouchmove",this,this._onGestureTouchMoveHandler);this._onTouchEndHandler_connect=_7(this.__container,"ontouchend",this,this._onGestureTouchEndHandler);this._onTouchCancelHandler_connect=_7(this.__container,"ontouchcancel",this,this._onGestureTouchEndHandler);this.onGestureStart(this._processEvent(evt));},_onGestureTouchMoveHandler:function(evt){this._processMultiTouchTap=false;this.onGestureChange(this._processEvent(evt));},_onGestureTouchEndHandler:function(evt){_8(this._onTouchMoveHandler_connect);_8(this._onTouchEndHandler_connect);_8(this._onTouchCancelHandler_connect);this._onTouchStart_connect=_7(this.__container,"ontouchstart",this,this._onTouchStartHandler);this._gestureStartConnect=_7(this.__container,"ongesturestart",this,this._onGestureStartHandler);if(this._processMultiTouchTap){evt.processMultiTouchTap=true;this._processMultiTouchTap=false;}this.onGestureEnd(this._processEvent(evt));},onClick:function(evt){this._clkTS=(new Date()).getTime();this._lastClickX=evt.pageX;this._lastClickY=evt.pageY;},onMouseOver:function(){},onMouseOut:function(){},onMouseDown:function(){},onMouseUp:function(){},onTouchStart:function(){},onTouchMove:function(){},onTouchEnd:function(){},onGestureStart:function(){},onGestureChange:function(){},onGestureEnd:function(){}};}()));}}};});