/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.dnd.BoundingBoxController"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.dnd.BoundingBoxController"]){_4._hasResource["dojox.dnd.BoundingBoxController"]=true;_4.provide("dojox.dnd.BoundingBoxController");_4.declare("dojox.dnd.BoundingBoxController",null,{_startX:null,_startY:null,_endX:null,_endY:null,constructor:function(_7,_8){this.events=[_4.connect(_4.doc,"onmousedown",this,"_onMouseDown"),_4.connect(_4.doc,"onmouseup",this,"_onMouseUp"),_4.connect(_4.doc,"onscroll",this,"_finishSelecting")];this.subscriptions=[_4.subscribe("/dojox/bounding/cancel",this,"_finishSelecting")];_4.forEach(_7,function(_9){if(_9.selectByBBox){this.subscriptions.push(_4.subscribe("/dojox/dnd/bounding",_9,"selectByBBox"));}},this);this.domNode=_4.byId(_8);_4.style(this.domNode,{position:"absolute",display:"none"});},destroy:function(){_4.forEach(this.events,_4.disconnect);_4.forEach(this.subscriptions,_4.unsubscribe);this.domNode=null;},boundingBoxIsViable:function(){return true;},_onMouseDown:function(_a){if(_4.mouseButtons.isLeft(_a)){if(this._startX===null){this._startX=_a.clientX;this._startY=_a.clientY;}this.events.push(_4.connect(_4.doc,"onmousemove",this,"_onMouseMove"));}},_onMouseMove:function(_b){this._endX=_b.clientX;this._endY=_b.clientY;this._drawBoundingBox();},_onMouseUp:function(_c){if(this._endX!==null&&this.boundingBoxIsViable()){_4.publish("/dojox/dnd/bounding",[this._startX,this._startY,this._endX,this._endY]);}this._finishSelecting();},_finishSelecting:function(){if(this._startX!==null){_4.disconnect(this.events.pop());_4.style(this.domNode,"display","none");this._startX=this._endX=null;}},_drawBoundingBox:function(){_4.style(this.domNode,{left:Math.min(this._startX,this._endX)+"px",top:Math.min(this._startY,this._endY)+"px",width:Math.abs(this._startX-this._endX)+"px",height:Math.abs(this._startY-this._endY)+"px",display:""});}});}}};});