dojox/dnd/BoundingBoxController (version 1.10)

Summary

Allows the user draw bounding boxes around nodes on the page. Publishes to the "/dojox/dnd/bounding" topic to tell the selector to check to see whether any dnd items fall within the coordinates of the bounding box

Usage

var foo = new BoundingBoxController(sources,domNode);
dojox/dnd/BoundingBoxController
Parameter Type Description
sources dojox/dnd/Selector[]

an array of dojox.dnd.Selectors which need to be aware of the positioning of the bounding box.

domNode String | DomNode

the DOM node or id which represents the bounding box on the page.

Property Summary

Method Summary

  • _drawBoundingBox() draws the bounding box over the document.
  • _finishSelecting() hide the bounding box and reset for the next time around
  • boundingBoxIsViable(evt) Override-able by the client as an extra check to ensure that a bounding box is viable.
  • destroy() prepares this object to be garbage-collected
  • shouldStartDrawingBox(evt) Override-able by the client as an extra check to ensure that a bounding box should begin to be drawn.

Event Summary

  • _onMouseDown(evt) Executed when the user mouses down on the document.
  • _onMouseMove(evt) Executed when the user moves the mouse over the document.
  • _onMouseUp(evt) Executed when the users mouses up on the document.

Properties

_endX
_endY
_startX
_startY

Methods

_drawBoundingBox()

draws the bounding box over the document.

_finishSelecting()

hide the bounding box and reset for the next time around

boundingBoxIsViable(evt)

Override-able by the client as an extra check to ensure that a bounding box is viable. In some instances, it might not make sense that a mouse down -> mouse move -> mouse up interaction represents a bounding box. For example, if a dialog is open the client might want to suppress a bounding box. This function could be used by the client to ensure that a bounding box is only drawn on the document when certain conditions are met.

Parameter Type Description
evt Object

the mouse event which caused this callback to fire.

Returns:boolean
destroy()

prepares this object to be garbage-collected

shouldStartDrawingBox(evt)

Override-able by the client as an extra check to ensure that a bounding box should begin to be drawn. If the client has any preconditions to when a bounding box should be drawn, they should be included in this method.

Parameter Type Description
evt Object

the mouse event which caused this callback to fire.

Returns:boolean

Events

_onMouseDown(evt)

Executed when the user mouses down on the document. Resets the this._startX and this._startY member variables.

Parameter Type Description
evt Object

the mouse event which caused this callback to fire.

_onMouseMove(evt)

Executed when the user moves the mouse over the document. Delegates to this._drawBoundingBox if the user is trying to draw a bounding box. whether the user was drawing a bounding box and publishes to the "/dojox/dnd/bounding" topic if the user is finished drawing their bounding box.

Parameter Type Description
evt Object

the mouse event which caused this callback to fire.

_onMouseUp(evt)

Executed when the users mouses up on the document. Checks to see whether the user was drawing a bounding box and publishes to the "/dojox/dnd/bounding" topic if the user is finished drawing their bounding box.

Parameter Type Description
evt Object

the mouse event which caused this callback to fire.

Error in the documentation? Can’t find what you are looking for? Let us know!