Alloy UI

dd  1.0.1

 
Filters

Class DD.DDM - extends Base

Provides the base Drag Drop Manger required for making a Node draggable.

Constructor

DD.DDM ( )

Properties

_active - {Boolean}

flag set when we activate our first drag, so DDM can start listening for events.

activeDrag - {Drag}

A reference to the currently active draggable object.

activeDrop - {Object}

A reference to the active Drop Target

CSS_PREFIX - {String}

The PREFIX to attach to all DD CSS class names

otherDrops - {Object}

An object literal of Other Drop Targets that we encountered during this interaction (in the case of overlapping Drop Targets)

targets - {Array}

All of the Targets

useHash - {Boolean}

Should we only check targets that are in the viewport on drags (for performance), default: true

validDrops - {Array}

An array of the valid Drop Targets for this interaction.

Properties inherited from Attribute:

Properties inherited from Base:

Configuration Attributes

clickPixelThresh - Number

The number of pixels to move to start a drag operation, default is 3.

clickTimeThresh - Number

The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000.

dragCursor - String

The cursor to apply when dragging, if shimmed the shim will get the cursor.

dragMode - String

This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of all future Drag instances.

throttleTime - Number

The number of milliseconds to throttle the mousemove event. Default: 150

Configuration attributes inherited from Base:

Methods

clearCache

void clearCache ( )
Clears the cache data used for this interaction.

getBestMatch

Object or Array getBestMatch ( drops , all )
This method will gather the area for all potential targets and see which has the hightest covered area and return it.
Parameters:
drops <Array> An Array of drops to scan for the best match.
all <Boolean> If present, it returns an Array. First item is best match, second is an Array of the other items in the original Array.

getDelegate

void getDelegate ( )
Get a delegate instance from a container node

getDrag

Object getDrag ( node )
Get a valid Drag instance back from a Node or a selector string, false otherwise
Parameters:
node <String/Object> The Node instance or Selector string to check for a valid Drag Object

getDrop

Object getDrop ( node )
Get a valid Drop instance back from a Node or a selector string, false otherwise
Parameters:
node <String/Object> The Node instance or Selector string to check for a valid Drop Object

getNode

Node getNode ( n )
Return a node instance from the given node, selector string or Y.Base extended object.
Parameters:
n <Node/Object/String> The node to resolve.

isOverTarget

Boolean isOverTarget ( drop )
Check to see if the Drag element is over the target, method varies on current mode
Parameters:
drop <Object> The drop to check against

regDelegate

void regDelegate ( )
Register a Delegate with the DDM

stopDrag

Self stopDrag ( )
Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag.
Chainable: This method is chainable.

swapNode

Node swapNode ( n1 , n2 )
Swap the position of 2 nodes based on their DOM location.
Parameters:
n1 <Node> The first node to swap
n2 <Node> The first node to swap

swapPosition

Node swapPosition ( n1 , n2 )
Swap the position of 2 nodes based on their CSS positioning.
Parameters:
n1 <Node> The first node to swap
n2 <Node> The first node to swap

syncActiveShims

void syncActiveShims ( force )
This method will sync the position of the shims on the Drop Targets that are currently active.
Parameters:
force <Boolean> Resize/sync all Targets.

Events

clickPixelThreshChange

clickPixelThreshChange ( event )
Fires when the value for the configuration attribute 'clickPixelThresh' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event<Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

clickTimeThreshChange

clickTimeThreshChange ( event )
Fires when the value for the configuration attribute 'clickTimeThresh' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event<Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

ddm:end

ddm:end ( )
Fires from the DDM after the DDM finishes, before the drag end events.

ddm:start

ddm:start ( )
Fires from the DDM before all drag events fire.

dragCursorChange

dragCursorChange ( event )
Fires when the value for the configuration attribute 'dragCursor' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event<Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

dragModeChange

dragModeChange ( event )
Fires when the value for the configuration attribute 'dragMode' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event<Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

throttleTimeChange

throttleTimeChange ( event )
Fires when the value for the configuration attribute 'throttleTime' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event<Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

Events inherited from Base: