Class YAHOO.util.DragDropMgr

Object
   |
   +--YAHOO.util.DragDropMgr

class YAHOO.util.DragDropMgr

Field Summary [top]

int clickPixelThresh
The number of pixels that the mouse needs to move after the mousedown before the drag is initiated. 
int clickTimeThresh
The number of milliseconds after the mousedown event to initiate the drag if we don't get a mouseup event. 
int INTERSECT
In intersect mode, drag and drop interactio nis defined by the overlap of two or more drag and drop objects. 
int mode
The current drag and drop mode. 
int POINT
In point mode, drag and drop interaction is defined by the location of the cursor during the drag/drop 
boolean preventDefault
Flag to determine if we should prevent the default behavior of the events we define. 
boolean stopPropagation
Flag to determine if we should stop the propagation of the events we generate. 
boolean useCache
Set useCache to false if you want to force object the lookup of each drag and drop linked element constantly during a drag. 

Method Summary [top]

ygDragDrop getBestMatch (dds)
Helper function for getting the best match from the list of drag and drop objects returned by the drag and drop events when we are in INTERSECT mode. 
DragDrop getDDById (<String> id)
Returns the DragDrop instance for a given id 
Object getLocation (<ygDragDrop> oDD)
Returns the an array containing the drag and drop element's position and size, including the ygDragDrop.padding configured for it 
Object getRelated (<ygDragDrop> p_oDD, <boolean> bTargetsOnly)
Returns the drag and drop instances that are in all groups the passed in instance belongs to. 
boolean isDragDrop (<String> id)
Utility function to determine if a given element has been registered as a drag drop item. 
boolean isHandle (sDDId, sHandleId)
Utility function to determine if a given element has been registered as a drag drop handle for the given Drag Drop object. 
boolean isLegalTarget (oDD, oTargetDD)
Returns true if the specified dd target is a legal target for the specifice drag obj 
boolean isLocked ()
Is drag and drop locked? 
boolean isTypeOfDD (oDD)
My goal is to be able to transparently determine if an object is typeof ygDragDrop, and the exact subclass of ygDragDrop. 
void lock ()
Lock all drag and drop functionality 
void refreshCache (<Array> aGroups)
Refreshes the cache of the top-left and bottom-right points of the drag and drop objects in the specified groups 
void regDragDrop (<DragDrop> oDD, <String> sGroup)
Each DragDrop instance must be registered with the DragDropMgr. 
void regHandle (<String> sDDId, <String> sHandleId)
Each DragDrop handle element must be registered. 
void unlock ()
Unlock all drag and drop functionality 
boolean verifyEl (<HTMLElement> el)
This checks to make sure an element exists and is in the DOM. 

Field Detail [top]

clickPixelThresh

int   clickPixelThresh
The number of pixels that the mouse needs to move after the mousedown before the drag is initiated. Default=3;

clickTimeThresh

int   clickTimeThresh
The number of milliseconds after the mousedown event to initiate the drag if we don't get a mouseup event. Default=1000

INTERSECT

int   INTERSECT
In intersect mode, drag and drop interactio nis defined by the overlap of two or more drag and drop objects.

mode

int   mode
The current drag and drop mode. Default it point mode

POINT

int   POINT
In point mode, drag and drop interaction is defined by the location of the cursor during the drag/drop

preventDefault

boolean   preventDefault
Flag to determine if we should prevent the default behavior of the events we define. By default this is true, but this can be set to false if you need the default behavior (not recommended)

stopPropagation

boolean   stopPropagation
Flag to determine if we should stop the propagation of the events we generate. This is true by default but you may want to set it to false if the html element contains other features that require the mouse click.

useCache

boolean   useCache
Set useCache to false if you want to force object the lookup of each drag and drop linked element constantly during a drag.

Constructor Detail [top]

YAHOO.util.DragDropMgr

YAHOO.util.DragDropMgr

Method Detail [top]

getBestMatch

ygDragDrop getBestMatch (dds)
Helper function for getting the best match from the list of drag and drop objects returned by the drag and drop events when we are in INTERSECT mode. It returns either the first object that the cursor is over, or the object that has the greatest overlap with the dragged element.
Parameters:
ygDragDrop - []} dds The array of drag and drop objects targeted
Returns:
The best single match

getDDById

DragDrop getDDById (<String> id)
Returns the DragDrop instance for a given id
Parameters:
id - the id of the DragDrop object
Returns:
the drag drop object, null if it is not found

getLocation

Object getLocation (<ygDragDrop> oDD)
Returns the an array containing the drag and drop element's position and size, including the ygDragDrop.padding configured for it
Parameters:
oDD - the drag and drop object to get the location for
Returns:
array containing the top left and bottom right points of the element

getRelated

Object getRelated (<ygDragDrop> p_oDD, <boolean> bTargetsOnly)
Returns the drag and drop instances that are in all groups the passed in instance belongs to.
Parameters:
p_oDD - the obj to get related data for
bTargetsOnly - if true, only return targetable objs
Returns:
{ygDragDrop[]} the related instances

isDragDrop

boolean isDragDrop (<String> id)
Utility function to determine if a given element has been registered as a drag drop item.
Parameters:
id - the element id to check
Returns:
true if this element is a DragDrop item, false otherwise

isHandle

boolean isHandle (sDDId, sHandleId)
Utility function to determine if a given element has been registered as a drag drop handle for the given Drag Drop object.
Parameters:
id - the element id to check
Returns:
true if this element is a DragDrop handle, false otherwise

isLegalTarget

boolean isLegalTarget (oDD, oTargetDD)
Returns true if the specified dd target is a legal target for the specifice drag obj
Parameters:
the - drag obj
ygDragDrop - ) the target
Returns:
true if the target is a legal target for the dd obj

isLocked

boolean isLocked ()
Is drag and drop locked?
Returns:
True if drag and drop is locked, false otherwise.

isTypeOfDD

boolean isTypeOfDD (oDD)
My goal is to be able to transparently determine if an object is typeof ygDragDrop, and the exact subclass of ygDragDrop. typeof returns "object", oDD.constructor.toString() always returns "ygDragDrop" and not the name of the subclass. So for now it just evaluates a well-known variable in ygDragDrop.
Parameters:
the - object to evaluate
Returns:
true if typeof oDD = ygDragDrop

lock

void lock ()
Lock all drag and drop functionality

refreshCache

void refreshCache (<Array> aGroups)
Refreshes the cache of the top-left and bottom-right points of the drag and drop objects in the specified groups
Parameters:
aGroups - an associative array of groups to refresh

regDragDrop

void regDragDrop (<DragDrop> oDD, <String> sGroup)
Each DragDrop instance must be registered with the DragDropMgr. This is executed in ygDragDrop.init()
Parameters:
oDD - the DragDrop object to register
sGroup - the name of the group this element belongs to

regHandle

void regHandle (<String> sDDId, <String> sHandleId)
Each DragDrop handle element must be registered. This is done automatically when executing ygDragDrop.setHandleElId()
Parameters:
sDDId - the DragDrop id this element is a handle for
sHandleId - the id of the element that is the drag handle

unlock

void unlock ()
Unlock all drag and drop functionality

verifyEl

boolean verifyEl (<HTMLElement> el)
This checks to make sure an element exists and is in the DOM. The main purpose is to handle cases where innerHTML is used to remove drag and drop objects from the DOM. IE provides an 'unspecified error' when trying to access the offsetParent of such an element
Parameters:
el - the element to check
Returns:
true if the element looks usable