void
addInvalidHandleClass
(
cssClass
)
Lets you specify a css class of elements that will not initiate a drag
- Parameters:
-
cssClass <string>
the class of the elements you wish to ignore
- Returns:
void
void
addInvalidHandleId
(
id
)
Lets you to specify an element id for a child of a drag handle
that should not initiate a drag
- Parameters:
-
id <string>
the element id of the element you wish to ignore
- Returns:
void
void
addInvalidHandleType
(
tagName
)
Allows you to specify a tag name that should not start a drag operation
when clicked. This is designed to facilitate embedding links within a
drag handle that do something other than start the drag.
- Parameters:
-
tagName <string>
the type of element to exclude
- Returns:
void
void
addToGroup
(
sGroup
)
Add this instance to a group of related drag/drop objects. All
instances belong to at least one group, and can belong to as many
groups as needed.
- Parameters:
-
sGroup <string>
the name of the group
- Returns:
void
void
applyConfig
(
)
Applies the configuration parameters that were passed into the constructor.
This is supposed to happen at each level through the inheritance chain. So
a DDProxy implentation will execute apply config on DDProxy, DD, and
DragDrop in order to get all of the parameters that are available in
each object.
private
void
b4Drag
(
)
Code that executes immediately before the onDrag event
private
void
b4DragDrop
(
)
Code that executes immediately before the onDragDrop event
private
void
b4DragOut
(
)
Code that executes immediately before the onDragOut event
private
void
b4DragOver
(
)
Code that executes immediately before the onDragOver event
private
void
b4EndDrag
(
)
Code that executes immediately before the endDrag event
private
void
b4MouseDown
(
e
)
Code executed immediately before the onMouseDown event
- Parameters:
-
e <Event>
the mousedown event
- Returns:
void
private
void
b4StartDrag
(
)
Code that executes immediately before the startDrag event
void
clearConstraints
(
)
Clears any constraints applied to this instance. Also clears ticks
since they can't exist independent of a constraint at this time.
void
clearTicks
(
)
Clears any tick interval defined for this instance
void
endDrag
(
e
)
Fired when we are done dragging the object
- Parameters:
-
e <Event>
the mouseup event
- Returns:
void
HTMLElement
getDragEl
(
)
Returns a reference to the actual element to drag. By default this is
the same as the html element, but it can be assigned to another
element. An example of this can be found in YAHOO.util.DDProxy
- Returns:
HTMLElement
- the html element
HTMLElement
getEl
(
)
Returns a reference to the linked element
- Returns:
HTMLElement
- the html element
private
int
getTick
(
val
,
tickArray
)
Normally the drag element is moved pixel by pixel, but we can specify
that it move a number of pixels at a time. This method resolves the
location when we have it set up like this.
- Parameters:
-
val <int>
where we want to place the object
-
tickArray <int[]>
sorted array of valid points
- Returns:
int
- the closest tick
private
void
handleMouseDown
(
e
,
oDD
)
Fired when this object is clicked
- Parameters:
-
e <Event>
-
oDD <YAHOO.util.DragDrop>
the clicked dd object (this dd obj)
- Returns:
void
private
void
handleOnAvailable
(
)
Executed when the linked element is available
void
init
(
id
,
sGroup
,
config
)
Sets up the DragDrop object. Must be called in the constructor of any
YAHOO.util.DragDrop subclass
- Parameters:
-
id <object>
the id of the linked element
-
sGroup <String>
the group of related items
-
config <object>
configuration attributes
- Returns:
void
void
initTarget
(
id
,
sGroup
,
config
)
Initializes Targeting functionality only... the object does not
get a mousedown handler.
- Parameters:
-
id <object>
the id of the linked element
-
sGroup <String>
the group of related items
-
config <object>
configuration attributes
- Returns:
void
boolean
isLocked
(
)
Returns true if this instance is locked, or the drag drop mgr is locked
(meaning that all drag/drop is disabled on the page.)
- Returns:
boolean
- true if this obj or all drag/drop is locked, else
false
void
isTarget
(
)
By default, all insances can be a drop target. This can be disabled by
setting isTarget to false.
boolean
isValidHandleChild
(
node
)
Checks the tag exclusion list to see if this click should be ignored
- Parameters:
-
node <HTMLElement>
the HTMLElement to evaluate
- Returns:
boolean
- true if this is a valid tag type, false if not
void
lock
(
)
Lock this instance
void
onAvailable
(
)
Override the onAvailable method to do what is needed after the initial
position was determined.
void
onDrag
(
e
)
Abstract method called during the onMouseMove event while dragging an
object.
- Parameters:
-
e <Event>
the mousemove event
- Returns:
void
void
onDragDrop
(
e
,
id
)
Abstract method called when this item is dropped on another DragDrop
obj
- Parameters:
-
e <Event>
the mouseup event
-
id <String|DragDrop[]>
In POINT mode, the element
id this was dropped on. In INTERSECT mode, an array of dd items this
was dropped on.
- Returns:
void
void
onDragEnter
(
e
,
id
)
Abstract method called when this element fist begins hovering over
another DragDrop obj
- Parameters:
-
e <Event>
the mousemove event
-
id <String|DragDrop[]>
In POINT mode, the element
id this is hovering over. In INTERSECT mode, an array of one or more
dragdrop items being hovered over.
- Returns:
void
void
onDragOut
(
e
,
id
)
Abstract method called when we are no longer hovering over an element
- Parameters:
-
e <Event>
the mousemove event
-
id <String|DragDrop[]>
In POINT mode, the element
id this was hovering over. In INTERSECT mode, an array of dd items
that the mouse is no longer over.
- Returns:
void
void
onDragOver
(
e
,
id
)
Abstract method called when this element is hovering over another
DragDrop obj
- Parameters:
-
e <Event>
the mousemove event
-
id <String|DragDrop[]>
In POINT mode, the element
id this is hovering over. In INTERSECT mode, an array of dd items
being hovered over.
- Returns:
void
void
onInvalidDrop
(
e
)
Abstract method called when this item is dropped on an area with no
drop target
- Parameters:
-
e <Event>
the mouseup event
- Returns:
void
void
onMouseDown
(
e
)
Event handler that fires when a drag/drop obj gets a mousedown
- Parameters:
-
e <Event>
the mousedown event
- Returns:
void
void
onMouseUp
(
e
)
Event handler that fires when a drag/drop obj gets a mouseup
- Parameters:
-
e <Event>
the mouseup event
- Returns:
void
void
padding
(
)
The padding configured for this drag and drop object for calculating
the drop zone intersection with this object.
void
removeFromGroup
(
sGroup
)
Remove's this instance from the supplied interaction group
- Parameters:
-
sGroup <string>
The group to drop
- Returns:
void
void
removeInvalidHandleClass
(
cssClass
)
Unsets an invalid css class
- Parameters:
-
cssClass <string>
the class of the element(s) you wish to
re-enable
- Returns:
void
void
removeInvalidHandleId
(
id
)
Unsets an invalid handle id
- Parameters:
-
id <string>
the id of the element to re-enable
- Returns:
void
void
removeInvalidHandleType
(
tagName
)
Unsets an excluded tag name set by addInvalidHandleType
- Parameters:
-
tagName <string>
the type of element to unexclude
- Returns:
void
void
resetConstraints
(
maintainOffset
)
resetConstraints must be called if you manually reposition a dd element.
- Parameters:
-
maintainOffset <boolean>
- Returns:
void
void
setDragElId
(
id
)
Allows you to specify that an element other than the linked element
will be moved with the cursor during a drag
- Parameters:
-
id <string>
the id of the element that will be used to initiate the drag
- Returns:
void
void
setHandleElId
(
id
)
Allows you to specify a child of the linked element that should be
used to initiate the drag operation. An example of this would be if
you have a content div with text and links. Clicking anywhere in the
content area would normally start the drag operation. Use this method
to specify that an element inside of the content div is the element
that starts the drag operation.
- Parameters:
-
id <string>
the id of the element that will be used to
initiate the drag.
- Returns:
void
void
setInitialPosition
(
diffX
,
diffY
)
Stores the initial placement of the linked element.
- Parameters:
-
diffX <int>
the X offset, default 0
-
diffY <int>
the Y offset, default 0
- Returns:
void
void
setOuterHandleElId
(
id
)
Allows you to set an element outside of the linked element as a drag
handle
- Parameters:
-
id <object>
the id of the element that will be used to initiate the drag
- Returns:
void
void
setPadding
(
iTop
,
iRight
,
iBot
,
iLeft
)
Configures the padding for the target zone in px. Effectively expands
(or reduces) the virtual object size for targeting calculations.
Supports css-style shorthand; if only one parameter is passed, all sides
will have that padding, and if only two are passed, the top and bottom
will have the first param, the left and right the second.
- Parameters:
-
iTop <int>
Top pad
-
iRight <int>
Right pad
-
iBot <int>
Bot pad
-
iLeft <int>
Left pad
- Returns:
void
private
void
setStartPosition
(
pos
)
Sets the start position of the element. This is set when the obj
is initialized, the reset when a drag is started.
- Parameters:
-
pos <object>
current position (from previous lookup)
- Returns:
void
void
setXConstraint
(
iLeft
,
iRight
,
iTickSize
)
By default, the element can be dragged any place on the screen. Use
this method to limit the horizontal travel of the element. Pass in
0,0 for the parameters if you want to lock the drag to the y axis.
- Parameters:
-
iLeft <int>
the number of pixels the element can move to the left
-
iRight <int>
the number of pixels the element can move to the
right
-
iTickSize <int>
optional parameter for specifying that the
element
should move iTickSize pixels at a time.
- Returns:
void
private
void
setXTicks
(
)
Create the array of horizontal tick marks if an interval was specified
in setXConstraint().
void
setYConstraint
(
iUp
,
iDown
,
iTickSize
)
By default, the element can be dragged any place on the screen. Set
this to limit the vertical travel of the element. Pass in 0,0 for the
parameters if you want to lock the drag to the x axis.
- Parameters:
-
iUp <int>
the number of pixels the element can move up
-
iDown <int>
the number of pixels the element can move down
-
iTickSize <int>
optional parameter for specifying that the
element should move iTickSize pixels at a time.
- Returns:
void
private
void
setYTicks
(
)
Create the array of vertical tick marks if an interval was specified in
setYConstraint().
void
startDrag
(
X
,
Y
)
Abstract method called after a drag/drop object is clicked
and the drag or mousedown time thresholds have beeen met.
- Parameters:
-
X <int>
click location
-
Y <int>
click location
- Returns:
void
string
toString
(
)
toString method
- Returns:
string
- string representation of the dd obj
void
unlock
(
)
Unlock this instace
void
unreg
(
)
Remove all drag and drop hooks for this element