//>>built
define("dojox/dnd/BoundingBoxController",["dojo","dojox"],function(a,e){return a.declare("dojox.dnd.BoundingBoxController",null,{_startX:null,_startY:null,_endX:null,_endY:null,constructor:function(b,d){this.events=[a.connect(a.doc,"onmousedown",this,"_onMouseDown"),a.connect(a.doc,"onmouseup",this,"_onMouseUp"),a.connect(a.doc,"onscroll",this,"_finishSelecting")];this.subscriptions=[a.subscribe("/dojox/bounding/cancel",this,"_finishSelecting")];a.forEach(b,function(c){c.selectByBBox&&this.subscriptions.push(a.subscribe("/dojox/dnd/bounding",
c,"selectByBBox"))},this);this.domNode=a.byId(d);a.style(this.domNode,{position:"absolute",display:"none"})},destroy:function(){a.forEach(this.events,a.disconnect);a.forEach(this.subscriptions,a.unsubscribe);this.domNode=null},shouldStartDrawingBox:function(b){return!0},boundingBoxIsViable:function(b){return!0},_onMouseDown:function(b){this.shouldStartDrawingBox(b)&&a.mouseButtons.isLeft(b)&&(null==this._startX&&(this._startX=b.clientX,this._startY=b.clientY),this.events.push(a.connect(a.doc,"onmousemove",
this,"_onMouseMove")))},_onMouseMove:function(b){this._endX=b.clientX;this._endY=b.clientY;this._drawBoundingBox()},_onMouseUp:function(b){null!==this._endX&&this.boundingBoxIsViable(b)&&a.publish("/dojox/dnd/bounding",[this._startX,this._startY,this._endX,this._endY]);this._finishSelecting()},_finishSelecting:function(){null!==this._startX&&(a.disconnect(this.events.pop()),a.style(this.domNode,"display","none"),this._endX=this._startX=null)},_drawBoundingBox:function(){a.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:""})}})});