Yahoo! UI Library

Drag and Drop  2.5.2

Yahoo! UI Library > dragdrop > YAHOO.util.DD

Show Private Show Protected

Class YAHOO.util.DD - extends YAHOO.util.DragDrop

Known Subclasses:
YAHOO.util.DDProxy YAHOO.widget.SliderThumb
A DragDrop implementation where the linked element follows the mouse cursor during a drag.

Constructor

YAHOO.util.DD ( id , sGroup , config )
Parameters:
id <String> the id of the linked element
sGroup <String> the group of related DragDrop items
config <object> an object containing configurable attributes Valid properties for DD: scroll

Properties

scroll - boolean

When set to true, the utility automatically tries to scroll the browser window when a drag and drop element is dragged near the viewport boundary. Defaults to true.

Methods

alignElWithMouse

void alignElWithMouse ( el , iPageX , iPageY )
Sets the element to the location of the mousedown or click event, maintaining the cursor location relative to the location on the element that was clicked. Override this if you want to place the element in a location other than where the cursor is.
Parameters:
el <HTMLElement> the element to move
iPageX <int> the X coordinate of the mousedown or drag event
iPageY <int> the Y coordinate of the mousedown or drag event
Returns: void

autoOffset

void autoOffset ( iPageX , iPageY )
Sets the pointer offset to the distance between the linked element's top left corner and the location the element was clicked
Parameters:
iPageX <int> the X coordinate of the click
iPageY <int> the Y coordinate of the click
Returns: void

autoScroll

private void autoScroll ( x , y , h , w )
Auto-scroll the window if the dragged object has been moved beyond the visible window boundary.
Parameters:
x <int> the drag element's x position
y <int> the drag element's y position
h <int> the height of the drag element
w <int> the width of the drag element
Returns: void

cachePosition

void cachePosition ( iPageX , iPageY )
Saves the most recent position so that we can reset the constraints and tick marks on-demand. We need to know this so that we can calculate the number of pixels the element is offset from its original position.
Parameters:
iPageX <object> the current x position (optional, this just makes it so we don't have to look it up again)
iPageY <object> the current y position (optional, this just makes it so we don't have to look it up again)
Returns: void

setDelta

void setDelta ( iDeltaX , iDeltaY )
Sets the pointer offset. You can call this directly to force the offset to be in a particular location (e.g., pass in 0,0 to set it to the center of the object, as done in YAHOO.widget.Slider)
Parameters:
iDeltaX <int> the distance from the left
iDeltaY <int> the distance from the top
Returns: void

setDragElPos

void setDragElPos ( iPageX , iPageY )
Sets the drag element to the location of the mousedown or click event, maintaining the cursor location relative to the location on the element that was clicked. Override this if you want to place the element in a location other than where the cursor is.
Parameters:
iPageX <int> the X coordinate of the mousedown or drag event
iPageY <int> the Y coordinate of the mousedown or drag event
Returns: void

Events

b4DragDropEvent

b4DragDropEvent ( )
Fires before the dragDropEvent

b4DragEvent

b4DragEvent ( )
Fires before the dragEvent.

b4DragOutEvent

b4DragOutEvent ( )
Fires before the dragOutEvent

b4DragOverEvent

b4DragOverEvent ( )
Fires before the dragOverEvent.

b4EndDragEvent

b4EndDragEvent ( )
Fires before the endDragEvent. Returning false will cancel.

b4MouseDownEvent

b4MouseDownEvent ( )
Provides access to the mousedown event, before the mouseDownEvent gets fired. Returning false will cancel the drag.

b4StartDragEvent

b4StartDragEvent ( )
Fires before the startDragEvent, returning false will cancel the startDrag Event.

dragDropEvent

dragDropEvent ( )
Fires when the dragged objects is dropped on another.

dragEnterEvent

dragEnterEvent ( )
Occurs when the dragged object first interacts with another targettable drag and drop object.

dragEvent

dragEvent ( )
Occurs every mousemove event while dragging.

dragOutEvent

dragOutEvent ( )
Fires when a dragged object is no longer over an object that had the onDragEnter fire.

dragOverEvent

dragOverEvent ( )
Fires every mousemove event while over a drag and drop object.

endDragEvent

endDragEvent ( )
Fires on the mouseup event after a drag has been initiated (startDrag fired).

invalidDropEvent

invalidDropEvent ( )
Fires when the dragged objects is dropped in a location that contains no drop targets.

mouseDownEvent

mouseDownEvent ( )
Provides access to the mousedown event. The mousedown does not always result in a drag operation.

mouseUpEvent

mouseUpEvent ( )
Fired from inside DragDropMgr when the drag operation is finished.

startDragEvent

startDragEvent ( )
Occurs after a mouse down and the drag threshold has been met. The drag threshold default is either 3 pixels of mouse movement or 1 full second of holding the mousedown.


Copyright © 2007 Yahoo! Inc. All rights reserved.