+
+
+
+
+
+
+
+
+ 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.
+
+
+
+
+
+
+
+
+
+
+
+
+ Placeholder for all active shims on the page
+
+
+
+
+
+
+
+
+
+
_debugShim
+ - private {Boolean}
+
+
+
+ Set this to true to set the shims opacity to .5 for debugging it, default: false.
+
+
+
+
+
+
+
+
+
+
_drags
+ - private {Array}
+
+
+
+ Holder for all registered drag elements.
+
+
+
+
+
+
+
+
+
+
_noShim
+ - private {Boolean}
+
+
+
+ This flag turns off the use of the mouseover/mouseout shim. It should not be used unless you know what you are doing.
+
+
+
+
+
+
+
+
+
+
_pg
+ - private {Node}
+
+
+
+ The shim placed over the screen to track the mousemove event.
+
+
+
+
+
+
+
+
+
+
+
+
+ A reference to the currently active draggable object.
+
+
+
+
+
+
+
+
+
+
+
+
+ A reference to the active Drop Target
+
+
+
+
+
+
+
+
+
+
+
+
+ The PREFIX to attach to all DD CSS class names
+
+
+
+
+
+
+
+
+
+
INTERSECT
+ - private Number
+
+
+
+ In intersect mode, a Drop is targeted by "part" of the drag node being over the Target
+
+
+
+
+
+
+
+
+
+
mode
+ - private Number
+
+
+
+ The mode that the drag operations will run in 0 for Point, 1 for Intersect, 2 for Strict
+
+
+
+
+
+
+
+
+
+
+
+
+ An object literal of Other Drop Targets that we encountered during this interaction (in the case of overlapping Drop Targets)
+
+
+
+
+
+
+
+
+
+
POINT
+ - private Number
+
+
+
+ In point mode, a Drop is targeted by the cursor being over the Target
+
+
+
+
+
+
+
+
+
+
STRICT
+ - private Number
+
+
+
+ In strict mode, a Drop is targeted by the "entire" drag node being over the Target
+
+
+
+
+
+
+
+
+
+
+
+
+ All of the Targets
+
+
+
+
+
+
+
+
+
+
useHash
+ - {Boolean}
+
+
+
+ Should we only check targets that are in the viewport on drags (for performance), default: true
+
+
+
+
+
+
+
+
+
+
+
+
+ An array of the valid Drop Targets for this interaction.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties inherited from Attribute:
+
+
+
+
+
+
+
+
Properties inherited from Base:
+
+
+
+
+
+
+
+
Methods
+
+
+
+
+
+ private
+
+
+ void
+ _activateTargets
+ (
+ )
+
+
+
+ Clear the cache and activate the shims of all the targets
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _addActiveShim
+ (
+
+
+ d
+
+
+ )
+
+
+
+ Adds a Drop Target to the list of active shims
+
+
+
+
+
+ - Parameters:
+ -
+
d
+ <Object>
+
+ The Drop instance to add to the list.
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ Self
+ _addValid
+ (
+
+
+ drop
+
+
+ )
+
+
+
+ Add a Drop Target to the list of Valid Targets. This list get's regenerated on each new drag operation.
+
+
+
+
+
+ - Parameters:
+ -
+
drop
+ <Object>
+
+
+
+
+
+
+ - Returns:
+
+ Self
+
+
+
+
+
+ Chainable: This method is chainable.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+
+ _calcTickArray
+ (
+
+
+ pos
+
+
+ ,
+ ticks
+
+
+ ,
+ off1
+
+
+ ,
+ off2
+
+
+ )
+
+
+
+ This method is used with the tickXArray and tickYArray config options
+
+
+
+
+
+ - Parameters:
+ -
+
pos
+ <Number>
+
+ The current X or Y position
+
+ -
+
ticks
+ <Number>
+
+ The array containing our custom tick positions.
+
+ -
+
off1
+ <Number>
+
+ The min offset that we can't pass (region)
+
+ -
+
off2
+ <Number>
+
+ The max offset that we can't pass (region)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ Number
+ _calcTicks
+ (
+
+
+ pos
+
+
+ ,
+ start
+
+
+ ,
+ tick
+
+
+ ,
+ off1
+
+
+ ,
+ off2
+
+
+ )
+
+
+
+ Helper method to calculate the tick offsets for a given position
+
+
+
+
+
+ - Parameters:
+ -
+
pos
+ <Number>
+
+ The current X or Y position
+
+ -
+
start
+ <Number>
+
+ The start X or Y position
+
+ -
+
tick
+ <Number>
+
+ The X or Y tick increment
+
+ -
+
off1
+ <Number>
+
+ The min offset that we can't pass (region)
+
+ -
+
off2
+ <Number>
+
+ The max offset that we can't pass (region)
+
+
+
+
+ - Returns:
+
+ Number
+
+ - The new position based on the tick calculation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _createFrame
+ (
+ )
+
+
+
+ Create the proxy element if it doesn't already exist and set the DD.DDM._proxy value
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _createPG
+ (
+ )
+
+
+
+ Creates the shim and adds it's listeners to it.
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _deactivateTargets
+ (
+ )
+
+
+
+ This method fires the drop:hit, drag:drophit, drag:dropmiss methods and deactivates the shims..
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _dropMove
+ (
+ )
+
+
+
+ This method is called when the move method is called on the Drag Object.
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _end
+ (
+ )
+
+
+
+ Internal method used by Drag to signal the end of a drag operation
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _endDrag
+ (
+ )
+
+
+
+ Factory method to be overwritten by other DDM's
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _handleTargetOver
+ (
+ )
+
+
+
+ This method execs _handleTargetOver on all valid Drop Targets
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ Boolean
+ _hasActiveShim
+ (
+ )
+
+
+
+ This method checks the _activeShims Object to see if there is a shim active.
+
+
+
+
+
+
+ - Returns:
+
+ Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ Array
+ _lookup
+ (
+ )
+
+
+
+ Filters the list of Drops down to those in the viewport.
+
+
+
+
+
+
+ - Returns:
+
+ Array
+
+ - The valid Drop Targets that are in the viewport.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _move
+ (
+
+
+ ev
+
+
+ )
+
+
+
+ Internal listener for the mousemove DOM event to pass to the Drag's move method.
+
+
+
+
+
+ - Parameters:
+ -
+
ev
+ <Event.Facade>
+
+ The Dom mousemove Event
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _pg_activate
+ (
+ )
+
+
+
+ Activates the shim
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _pg_deactivate
+ (
+ )
+
+
+
+ Deactivates the shim
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _pg_size
+ (
+ )
+
+
+
+ Sizes the shim on: activatation, window:scroll, window:resize
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _regDrag
+ (
+
+
+ d
+
+
+ )
+
+
+
+ Adds a reference to the drag object to the DDM._drags array, called in the constructor of Drag.
+
+
+
+
+
+ - Parameters:
+ -
+
d
+ <Drag>
+
+ The Drag object
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _regTarget
+ (
+
+
+ t
+
+
+ )
+
+
+
+ Add the passed in Target to the targets collection
+
+
+
+
+
+ - Parameters:
+ -
+
t
+ <Object>
+
+ The Target to add to the targets collection
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _removeActiveShim
+ (
+
+
+ d
+
+
+ )
+
+
+
+ Removes a Drop Target to the list of active shims
+
+
+
+
+
+ - Parameters:
+ -
+
d
+ <Object>
+
+ The Drop instance to remove from the list.
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ Self
+ _removeValid
+ (
+
+
+ drop
+
+
+ )
+
+
+
+ Removes a Drop Target from the list of Valid Targets. This list get's regenerated on each new drag operation.
+
+
+
+
+
+ - Parameters:
+ -
+
drop
+ <Object>
+
+
+
+
+
+
+ - Returns:
+
+ Self
+
+
+
+
+
+ Chainable: This method is chainable.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+
+ _setDragMode
+ (
+
+
+ String/Number
+
+
+ )
+
+
+
+ Handler for dragMode attribute setter.
+
+
+
+
+
+ - Parameters:
+ -
+
String/Number
+ <object>
+
+ The Number value or the String for the DragMode to default all future drag instances to.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _setFrame
+ (
+ )
+
+
+
+ If resizeProxy is set to true (default) it will resize the proxy element to match the size of the Drag Element.
+If positionProxy is set to true (default) it will position the proxy element in the same location as the Drag Element.
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _setupListeners
+ (
+ )
+
+
+
+ Add the document listeners.
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _start
+ (
+
+
+ x
+
+
+ ,
+ y
+
+
+ ,
+ w
+
+
+ ,
+ h
+
+
+ )
+
+
+
+ Internal method used by Drag to signal the start of a drag operation
+
+
+
+
+
+ - Parameters:
+ -
+
x
+ <Number>
+
+ The x position of the drag element
+
+ -
+
y
+ <Number>
+
+ The y position of the drag element
+
+ -
+
w
+ <Number>
+
+ The width of the drag element
+
+ -
+
h
+ <Number>
+
+ The height of the drag element
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _startDrag
+ (
+
+
+ x
+
+
+ ,
+ y
+
+
+ ,
+ w
+
+
+ ,
+ h
+
+
+ )
+
+
+
+ Factory method to be overwritten by other DDM's
+
+
+
+
+
+ - Parameters:
+ -
+
x
+ <Number>
+
+ The x position of the drag element
+
+ -
+
y
+ <Number>
+
+ The y position of the drag element
+
+ -
+
w
+ <Number>
+
+ The width of the drag element
+
+ -
+
h
+ <Number>
+
+ The height of the drag element
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _unregDrag
+ (
+
+
+ d
+
+
+ )
+
+
+
+ Remove this drag object from the DDM._drags array.
+
+
+
+
+
+ - Parameters:
+ -
+
d
+ <Drag>
+
+ The drag object.
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ void
+ _unregTarget
+ (
+
+
+ drop
+
+
+ )
+
+
+
+ Remove the passed in Target from the targets collection
+
+
+
+
+
+ - Parameters:
+ -
+
drop
+ <Object>
+
+ The Target to remove from the targets collection
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ void
+ clearCache
+ (
+ )
+
+
+
+ Clears the cache data used for this interaction.
+
+
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private
+
+
+ Object
+ cssSizestoObject
+ (
+
+
+ gutter
+
+
+ )
+
+
+
+ //TODO Private, rename??...
+
+
+
+
+
+ - Parameters:
+ -
+
gutter
+ <String>
+
+ CSS style string for gutter: '5 0' (sets top and bottom to 5px, left and right to 0px), '1 2 3 4' (top 1px, right 2px, bottom 3px, left 4px)
+
+
+
+
+ - Returns:
+
+ Object
+
+ - The gutter Object Literal.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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.
+
+
+
+
+ - Returns:
+
+ Object or Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+
+
+ - Returns:
+
+ Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+
+
+ - Returns:
+
+ Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+
+
+ - Returns:
+
+ Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Self
+ stopDrag
+ (
+ )
+
+
+
+ Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag.
+
+
+
+
+
+
+ - Returns:
+
+ Self
+
+
+
+
+
+ Chainable: This method is chainable.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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.
+
+
+
+
+ - Returns:
+
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods inherited from EventTarget:
+
+
+
+ _getType,
+
+
+ _parseType,
+
+
+ addTarget,
+
+
+ after,
+
+
+ before,
+
+
+ bubble,
+
+
+ detach,
+
+
+ detachAll,
+
+
+ fire,
+
+
+ getEvent,
+
+
+ on,
+
+
+ publish,
+
+
+ removeTarget,
+
+
+ subscribe,
+
+
+ unsubscribe,
+
+
+ unsubscribeAll
+
+
+
+
+
+
Methods inherited from Attribute:
+
+
+
+ _addAttrs,
+
+
+ _addLazyAttr,
+
+
+ _defAttrChangeFn,
+
+
+ _fireAttrChange,
+
+
+ _getAttrInitVal,
+
+
+ _isLazyAttr,
+
+
+ _set,
+
+
+ _setAttr,
+
+
+ _setAttrVal,
+
+
+ _splitAttrVals,
+
+
+ addAttr,
+
+
+ addAttrs,
+
+
+ attrAdded,
+
+
+ get,
+
+
+ getAttrs,
+
+
+ modifyAttr,
+
+
+ removeAttr,
+
+
+ reset,
+
+
+ set,
+
+
+ setAttrs
+
+
+
+
+
+
+
Methods inherited from Base:
+
+
+
+ _aggregateAttrs,
+
+
+ _defDestroyFn,
+
+
+ _defInitFn,
+
+
+ _destroyHierarchy,
+
+
+ _filterAttrCfs,
+
+
+ _getAttrCfgs,
+
+
+ _getClasses,
+
+
+ _initHierarchy,
+
+
+ _initHierarchyData,
+
+
+ destroy,
+
+
+ init,
+
+
+ toString
+
+
+
+
+
+
+
+
+
+
Events
+
+
+
+
+
+
+
+
+ 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
+
+ (
+
+
+ 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+ (
+
+
+ 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Events inherited from Base:
+
+
+
+
+
+
+
+
Configuration Attributes
+
+
+
+
+
+ The number of pixels to move to start a drag operation, default is 3.
+
+
+
+
+
+
+
+
+
+
+
+ The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000.
+
+
+
+
+
+
+
+
+
+
+
+ The cursor to apply when dragging, if shimmed the shim will get the cursor.
+
+
+
+
+
+
+
+
+
+
+
+ This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of all future Drag instances.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+