Two classes constitute the basis for the DragDrop component. YAHOO.util.DragDrop
is the base class for all elements that are to be dragged around. The movement itself is coordinated by YAHOO.util.DragDropMgr
, which takes care of juggling the various DragDrop instances around. You are unlikely to create instances of either. DragDropMgr is a singleton so it makes no sense to do so; there is to be only one manager per page coordinating the motion of the other elements. You would not create instances of DragDrop either because it is what in other languages we would call an abstract class meant to be the model for its subclasses. The first of those subclasses—YAHOO.util.DD
—allows for drag-and-drop at its most basic level. The supplied element will be transformed into an object that can be dragged around the page.
The mechanics of drag-and-drop result in a burden of fairly high processing. The library has to keep track of the mouse pointer while it is moving, the draggable object...