A DragDrop implementation where the linked element follows the
mouse cursor during a drag.
Constructor
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
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.
__ygDragDrop,
_domRef,
available,
config,
constrainX,
constrainY,
cursorIsOver,
deltaX,
deltaY,
dragElId,
dragOnly,
events,
groups,
handleElId,
hasOuterHandles,
id,
invalidHandleClasses,
invalidHandleIds,
invalidHandleTypes,
isTarget,
locked,
maintainOffset,
maxX,
maxY,
minX,
minY,
overlap,
padding,
primaryButtonOnly,
startPageX,
startPageY,
useShim,
xTicks,
yTicks
Methods
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
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
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
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)
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
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
addInvalidHandleClass,
addInvalidHandleId,
addInvalidHandleType,
addToGroup,
applyConfig,
b4Drag,
b4DragDrop,
b4DragOut,
b4DragOver,
b4EndDrag,
b4MouseDown,
b4StartDrag,
clearConstraints,
clearTicks,
clickValidator,
endDrag,
getDragEl,
getEl,
getTargetCoord,
getTick,
handleMouseDown,
handleOnAvailable,
init,
initTarget,
isLocked,
isValidHandleChild,
lock,
on,
onAvailable,
onDrag,
onDragDrop,
onDragEnter,
onDragOut,
onDragOver,
onInvalidDrop,
onMouseDown,
onMouseUp,
removeFromGroup,
removeInvalidHandleClass,
removeInvalidHandleId,
removeInvalidHandleType,
resetConstraints,
setDragElId,
setHandleElId,
setInitialPosition,
setOuterHandleElId,
setPadding,
setStartPosition,
setXConstraint,
setXTicks,
setYConstraint,
setYTicks,
startDrag,
toString,
unlock,
unreg
Events
b4DragDropEvent
(
)
Fires before the dragDropEvent
b4DragEvent
(
)
Fires before the dragEvent.
b4DragOutEvent
(
)
Fires before the dragOutEvent
b4DragOverEvent
(
)
Fires before the dragOverEvent.
b4EndDragEvent
(
)
Fires before the endDragEvent. Returning false will cancel.
b4MouseDownEvent
(
)
Provides access to the mousedown event, before the mouseDownEvent gets fired. Returning false will cancel the drag.
b4StartDragEvent
(
)
Fires before the startDragEvent, returning false will cancel the startDrag Event.
dragDropEvent
(
)
Fires when the dragged objects is dropped on another.
dragEnterEvent
(
)
Occurs when the dragged object first interacts with another targettable drag and drop object.
dragEvent
(
)
Occurs every mousemove event while dragging.
dragOutEvent
(
)
Fires when a dragged object is no longer over an object that had the onDragEnter fire.
dragOverEvent
(
)
Fires every mousemove event while over a drag and drop object.
endDragEvent
(
)
Fires on the mouseup event after a drag has been initiated (startDrag fired).
invalidDropEvent
(
)
Fires when the dragged objects is dropped in a location that contains no drop targets.
mouseDownEvent
(
)
Provides access to the mousedown event. The mousedown does not always result in a drag operation.
mouseUpEvent
(
)
Fired from inside DragDropMgr when the drag operation is finished.
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.
b4DragDropEvent,
b4DragEvent,
b4DragOutEvent,
b4DragOverEvent,
b4EndDragEvent,
b4MouseDownEvent,
b4StartDragEvent,
dragDropEvent,
dragEnterEvent,
dragEvent,
dragOutEvent,
dragOverEvent,
endDragEvent,
invalidDropEvent,
mouseDownEvent,
mouseUpEvent,
startDragEvent,