Yahoo! UI Library

Drag and Drop  2.3.0

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 wehn 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


Copyright © 2007 Yahoo! Inc. All rights reserved.