//>>built
define("dojox/geo/charting/MouseInteractionSupport","dojo/_base/lang dojo/_base/declare dojo/_base/event dojo/_base/connect dojo/_base/window dojo/_base/html dojo/dom dojo/_base/sniff".split(" "),function(k,g,d,c,f,l,h,e){return g("dojox.geo.charting.MouseInteractionSupport",null,{_map:null,_mapClickLocation:null,_screenClickLocation:null,_mouseDragListener:null,_mouseUpListener:null,_mouseUpClickListener:null,_mouseDownListener:null,_mouseMoveListener:null,_mouseWheelListener:null,_currentFeature:null,
_cancelMouseClick:null,_zoomEnabled:!1,_panEnabled:!1,_onDragStartListener:null,_onSelectStartListener:null,mouseClickThreshold:2,constructor:function(a,b){this._map=a;this._mapClickLocation={x:0,y:0};this._screenClickLocation={x:0,y:0};this._cancelMouseClick=!1;b&&(this._zoomEnabled=b.enableZoom,this._panEnabled=b.enablePan,b.mouseClickThreshold&&0<b.mouseClickThreshold&&(this.mouseClickThreshold=b.mouseClickThreshold))},setEnableZoom:function(a){if(a&&!this._mouseWheelListener){var b=e("mozilla")?
"DOMMouseScroll":"onmousewheel";this._mouseWheelListener=this._map.surface.connect(b,this,this._mouseWheelHandler)}else!a&&this._mouseWheelListener&&(c.disconnect(this._mouseWheelListener),this._mouseWheelListener=null);this._zoomEnabled=a},setEnablePan:function(a){this._panEnabled=a},connect:function(){this._mouseMoveListener=this._map.surface.connect("onmousemove",this,this._mouseMoveHandler);this._mouseDownListener=this._map.surface.connect("onmousedown",this,this._mouseDownHandler);e("ie")&&(_onDragStartListener=
c.connect(f.doc,"ondragstart",this,d.stop),_onSelectStartListener=c.connect(f.doc,"onselectstart",this,d.stop));this.setEnableZoom(this._zoomEnabled);this.setEnablePan(this._panEnabled)},disconnect:function(){var a=this._zoomEnabled;this.setEnableZoom(!1);this._zoomEnabled=a;this._mouseMoveListener&&(c.disconnect(this._mouseMoveListener),this._mouseMoveListener=null,c.disconnect(this._mouseDownListener),this._mouseDownListener=null);this._onDragStartListener&&(c.disconnect(this._onDragStartListener),
this._onDragStartListener=null,c.disconnect(this._onSelectStartListener),this._onSelectStartListener=null)},_mouseClickHandler:function(a){var b=this._getFeatureFromMouseEvent(a);if(b)b._onclickHandler(a);else{for(var c in this._map.mapObj.features)this._map.mapObj.features[c].select(!1);this._map.onFeatureClick(null)}},_mouseDownHandler:function(a){d.stop(a);this._map.focused=!0;this._cancelMouseClick=!1;this._screenClickLocation.x=a.pageX;this._screenClickLocation.y=a.pageY;var b=this._map._getContainerBounds();
a=this._map.screenCoordsToMapCoords(a.pageX-b.x,a.pageY-b.y);this._mapClickLocation.x=a.x;this._mapClickLocation.y=a.y;e("ie")?(a=h.byId(this._map.container),this._mouseDragListener=c.connect(a,"onmousemove",this,this._mouseDragHandler),this._mouseUpClickListener=this._map.surface.connect("onmouseup",this,this._mouseUpClickHandler),this._mouseUpListener=this._map.surface.connect("onmouseup",this,this._mouseUpHandler),this._map.surface.rawNode.setCapture()):(this._mouseDragListener=c.connect(f.doc,
"onmousemove",this,this._mouseDragHandler),this._mouseUpClickListener=this._map.surface.connect("onmouseup",this,this._mouseUpClickHandler),this._mouseUpListener=c.connect(f.doc,"onmouseup",this,this._mouseUpHandler))},_mouseUpClickHandler:function(a){this._cancelMouseClick||this._mouseClickHandler(a);this._cancelMouseClick=!1},_mouseUpHandler:function(a){d.stop(a);this._map.mapObj.marker._needTooltipRefresh=!0;this._mouseDragListener&&(c.disconnect(this._mouseDragListener),this._mouseDragListener=
null);this._mouseUpClickListener&&(c.disconnect(this._mouseUpClickListener),this._mouseUpClickListener=null);this._mouseUpListener&&(c.disconnect(this._mouseUpListener),this._mouseUpListener=null);e("ie")&&this._map.surface.rawNode.releaseCapture()},_getFeatureFromMouseEvent:function(a){var b=null;a.gfxTarget&&a.gfxTarget.getParent&&(b=this._map.mapObj.features[a.gfxTarget.getParent().id]);return b},_mouseMoveHandler:function(a){if(!this._mouseDragListener||!this._panEnabled){var b=this._getFeatureFromMouseEvent(a);
b!=this._currentFeature&&(this._currentFeature&&this._currentFeature._onmouseoutHandler(),(this._currentFeature=b)&&b._onmouseoverHandler());b&&b._onmousemoveHandler(a)}},_mouseDragHandler:function(a){d.stop(a);var b=Math.abs(a.pageX-this._screenClickLocation.x),c=Math.abs(a.pageY-this._screenClickLocation.y);!this._cancelMouseClick&&(b>this.mouseClickThreshold||c>this.mouseClickThreshold)&&(this._cancelMouseClick=!0,this._panEnabled&&this._map.mapObj.marker.hide());this._panEnabled&&(b=this._map._getContainerBounds(),
b=this._map.screenCoordsToMapCoords(a.pageX-b.x,a.pageY-b.y),a=b.x-this._mapClickLocation.x,b=b.y-this._mapClickLocation.y,c=this._map.getMapCenter(),this._map.setMapCenter(c.x-a,c.y-b))},_mouseWheelHandler:function(a){d.stop(a);this._map.mapObj.marker.hide();var b=this._map._getContainerBounds(),b=this._map.screenCoordsToMapCoords(a.pageX-b.x,a.pageY-b.y);a=a[e("mozilla")?"detail":"wheelDelta"]/(e("mozilla")?-3:120);a=Math.pow(1.2,a);this._map.setMapScaleAt(this._map.getMapScale()*a,b.x,b.y,!1);
this._map.mapObj.marker._needTooltipRefresh=!0}})});