dd-drag-debug.js revision c03d3f1eafc55ad0233f238f9ba1583c1e47fa96
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater * Provides the ability to drag a Node.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @module dd
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @submodule dd-drag
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * Provides the ability to drag a Node.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @class Drag
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @extends Base
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @constructor
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @namespace DD
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * @event drag:mouseup
0c6ada0a814f3c5417daa1654129bc2af56ed504Automatic Updater * @description Handles the mouseup DOM event, does nothing internally just fires.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:mouseDown
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Handles the mousedown DOM event, checks to see if you have a valid handle then starts the drag timers.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @preventable _defMouseDownFn
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
0c6ada0a814f3c5417daa1654129bc2af56ed504Automatic Updater * <dl><dt>ev</dt><dd>The original mousedown event.</dd></dl>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:afterMouseDown
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Fires after the mousedown event has been cleared.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dl><dt>ev</dt><dd>The original mousedown event.</dd></dl>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:removeHandle
0f52ea95d861c237da324aa0c009638298069ec0Tinderbox User * @description Fires after a handle is removed.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dl><dt>handle</dt><dd>The handle that was removed.</dd></dl>
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:addHandle
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Fires after a handle is added.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dl><dt>handle</dt><dd>The handle that was added.</dd></dl>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrews * @event drag:removeInvalid
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User * @description Fires after an invalid selector is removed.
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User * @param {EventFacade} event An Event Facade object with the following specific property added:
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User * <dl><dt>handle</dt><dd>The handle that was removed.</dd></dl>
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:addInvalid
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Fires after an invalid selector is added.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dl><dt>handle</dt><dd>The handle that was added.</dd></dl>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:start
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Fires at the start of a drag operation.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>pageX</dt><dd>The original node position X.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>pageY</dt><dd>The original node position Y.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>startTime</dt><dd>The startTime of the event. getTime on the current Date object.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:end
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Fires at the end of a drag operation.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>pageX</dt><dd>The current node position X.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>pageY</dt><dd>The current node position Y.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>startTime</dt><dd>The startTime of the event, from the start event.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>endTime</dt><dd>The endTime of the event. getTime on the current Date object.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:drag
1224c3b69b3d18f7127aa042644936af25a2d679Mark Andrews * @description Fires every mousemove during a drag operation.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User * <dt>pageX</dt><dd>The current node position X.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>pageY</dt><dd>The current node position Y.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>scroll</dt><dd>Should a scroll action occur.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>info</dt><dd>Object hash containing calculated XY arrays: start, xy, delta, offset</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
d3ddafd7469d1f3430ccd1b0fe0d13ccbbaf5debTinderbox User * @event drag:align
d3ddafd7469d1f3430ccd1b0fe0d13ccbbaf5debTinderbox User * @preventable _defAlignFn
d3ddafd7469d1f3430ccd1b0fe0d13ccbbaf5debTinderbox User * @description Fires when this node is aligned.
d3ddafd7469d1f3430ccd1b0fe0d13ccbbaf5debTinderbox User * @param {EventFacade} event An Event Facade object with the following specific property added:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>pageX</dt><dd>The current node position X.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>pageY</dt><dd>The current node position Y.</dd>
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:over
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Fires when this node is over a Drop Target. (Fired from dd-drop)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>drop</dt><dd>The drop object at the time of the event.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @bubbles DDM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {CustomEvent}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @event drag:enter
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Fires when this node enters a Drop Target. (Fired from dd-drop)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @param {EventFacade} event An Event Facade object with the following specific property added:
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * <dt>drop</dt><dd>The drop object at the time of the event.</dd>
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @bubbles DDM
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type {CustomEvent}
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @event drag:exit
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Fires when this node exits a Drop Target. (Fired from dd-drop)
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @param {EventFacade} event An Event Facade object with the following specific property added:
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * <dt>drop</dt><dd>The drop object at the time of the event.</dd>
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @bubbles DDM
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type {CustomEvent}
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @event drag:drophit
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Fires when this node is dropped on a valid Drop Target. (Fired from dd-ddm-drop)
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @param {EventFacade} event An Event Facade object with the following specific property added:
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * <dt>drop</dt><dd>The best guess on what was dropped on.</dd>
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User * <dt>others</dt><dd>An array of all the other drop targets that was dropped on.</dd>
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User * @bubbles DDM
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User * @type {CustomEvent}
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User * @event drag:dropmiss
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User * @description Fires when this node is dropped on an invalid Drop Target. (Fired from dd-ddm-drop)
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User * @param {EventFacade} event An Event Facade object with the following specific property added:
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User * <dt>pageX</dt><dd>The current node position X.</dd>
4f9cb7bd58e2c0a7407fee3758ea265aee329ac6Tinderbox User * <dt>pageY</dt><dd>The current node position Y.</dd>
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @bubbles DDM
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type {CustomEvent}
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User Drag = function(o) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User Drag.superclass.constructor.apply(this, arguments);
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User Y.error('Failed to register node, already in use: ' + o.node);
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * This property defaults to "mousedown", but when drag-gestures is loaded, it is changed to "gesturemovestart"
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @property START_EVENT
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute node
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Y.Node instance to use as the element to initiate a drag operation
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User Y.error('DD.Drag: Invalid Node Given: ' + node);
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute dragNode
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Y.Node instance to use as the draggable element, defaults to node
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User Y.error('DD.Drag: Invalid dragNode Given: ' + node);
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute offsetNode
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Offset the drag element by the difference in cursor position: default true
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Boolean
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute startCentered
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Center the dragNode to the mouse position on drag:start: default false
f2016fcecf098726740507a5522dca04c49aeb82Tinderbox User * @type Boolean
f2016fcecf098726740507a5522dca04c49aeb82Tinderbox User * @attribute clickPixelThresh
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description The number of pixels to move to start a drag operation, default is 3.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Number
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute clickTimeThresh
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description The number of milliseconds a mousedown has to pass to start a drag operation, default is 1000.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Number
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute lock
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Set to lock this drag element so that it can't be dragged: default false.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Boolean
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User this.get(NODE).addClass(DDM.CSS_PREFIX + '-locked');
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User this.get(NODE).removeClass(DDM.CSS_PREFIX + '-locked');
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute data
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description A payload holder to store arbitrary data about this drag object, can be used to store any value.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Mixed
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute move
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description If this is false, the drag element will not move with the cursor: default true. Can be used to "resize" the element.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Boolean
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute useShim
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Use the protective shim on all drag operations: default true. Only works with dd-ddm, not dd-ddm-base.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Boolean
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute activeHandle
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description This config option is set by Drag to inform you of which handle fired the drag event (in the case that there are several handles): default false.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute primaryButtonOnly
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description By default a drag operation will only begin if the mousedown occurred with the primary mouse button. Setting this to false will allow for all mousedown events to trigger a drag.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Boolean
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute dragging
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description This attribute is not meant to be used by the implementor, it is meant to be used as an Event tracker so you can listen for it to change.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Boolean
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute target
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description This attribute only works if the dd-drop module has been loaded. It will make this node a drop target as well as draggable.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Boolean
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute dragMode
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description This attribute only works if the dd-drop module is active. It will set the dragMode (point, intersect, strict) of this Drag instance.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type String
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute groups
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Array of groups to add this drag into.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Array
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User getter: function() {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User setter: function(g) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User Y.each(g, function(v, k) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User this._groups[v] = true;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @attribute handles
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Array of valid handles to add. Adding something here will set all handles, even if previously added with addHandle
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type Array
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User setter: function(g) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User Y.each(g, function(v, k) {
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User if (v instanceof Y.Node || v instanceof Y.NodeList) {
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User * @deprecated
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User * @attribute bubbles
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User * @description Controls the default bubble parent for this Drag instance. Default: Y.DD.DDM. Set to false to disable bubbling. Use bubbleTargets in config
6478b87fd23bcd3ab74c25b261021fe19a239c4fTinderbox User * @type Object
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User setter: function(t) {
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User Y.log('bubbles is deprecated use bubbleTargets: HOST', 'warn', 'dd');
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User * @attribute haltDown
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User * @description Should the mousedown event be halted. Default: true
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User * @type Boolean
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User _canDrag: function(n) {
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User if (n && n.setXY && n.getXY && n.test && n.contains) {
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User return false;
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User * @property _bubbleTargets
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User * @description The default bubbleTarget for this object. Default: Y.DD.DDM
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User * @method addToGroup
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User * @description Add this Drag instance to a group, this should be used for on-the-fly group additions.
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User * @param {String} g The group to add this Drag Instance to.
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User * @return {Self}
61ab11c0ec845606f85452b2c9f2e223772aae00Tinderbox User addToGroup: function(g) {
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User this._groups[g] = true;
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User * @method removeFromGroup
f5c27ecceb6dcba6ad8b75172fe5f9823d7a6d42Tinderbox User * @description Remove this Drag instance from a group, this should be used for on-the-fly group removals.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @param {String} g The group to remove this Drag Instance from.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @return {Self}
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User delete this._groups[g];
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @property target
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description This will be a reference to the Drop instance associated with this drag if the target: true config attribute is set..
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type {Object}
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @method _handleTarget
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Attribute handler for the target config attribute.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if (config === false) {
369963ad26cef09c3839d76c74c2d856f91be27aTinderbox User return false;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User config.bubbleTargets = ('bubbleTargets' in config) ? config.bubbleTargets : Y.Object.values(this._yuievt.targets);
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User config.groups = config.groups || this.get('groups');
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User return false;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @property _groups
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description Storage Array for the groups this drag belongs to.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type {Array}
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @method _createEvents
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description This method creates all the events for this Event Target and publishes them so we get Event Bubbling.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User 'drag:drophit',
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User 'drag:dropmiss',
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User 'drag:enter',
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @property _ev_md
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description A private reference to the mousedown DOM event
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type {EventFacade}
3c7b4ac4517ac9d78c9bf3e0e790cedce10ddc18Tinderbox User * @property _startTime
3c7b4ac4517ac9d78c9bf3e0e790cedce10ddc18Tinderbox User * @description The getTime of the mousedown event. Not used, just here in case someone wants/needs to use it.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @property _endTime
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description The getTime of the mouseup event. Not used, just here in case someone wants/needs to use it.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @property _handles
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @description A private hash of the valid drag handles
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User * @type {Object}
eaaf00efc02fdd4965f747afb51f881ac5a389d2Tinderbox User * @property _invalids
eaaf00efc02fdd4965f747afb51f881ac5a389d2Tinderbox User * @description A private hash of the invalid selector strings
eaaf00efc02fdd4965f747afb51f881ac5a389d2Tinderbox User * @type {Object}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @property _invalidsDefault
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description A private hash of the default invalid selector strings: {'textarea': true, 'input': true, 'a': true, 'button': true, 'select': true}
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * @type {Object}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews _invalidsDefault: {'textarea': true, 'input': true, 'a': true, 'button': true, 'select': true },
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @property _dragThreshMet
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Private flag to see if the drag threshhold was met
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {Boolean}
1d216bfaa764f2b40c57cf61987453c5a6fa9b0aMark Andrews * @property _fromTimeout
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description Flag to determine if the drag operation came from a timeout
d71e2e0c61df16ff37c9934c371a4a60c08974f7Mark Andrews * @type {Boolean}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @property _clickTimeout
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * @description Holder for the setTimeout call
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {Boolean}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @property deltaXY
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description The offset of the mouse position to the element's position
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {Array}
cd32f419a8a5432fbb139f56ee73cbf68b9350ccTinderbox User * @property startXY
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description The initial mouse position
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {Array}
0c6ada0a814f3c5417daa1654129bc2af56ed504Automatic Updater * @property nodeXY
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @description The initial element position
4abdfc917e6635a7c81d1f931a0c79227e72d025Mark Andrews * @type {Array}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @property lastXY
30c0c7470d5bfabd8f43c563f4eca636d06cc484Tinderbox User * @description The position of the element as it's moving (for offset calculations)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * @type {Array}
lastXY: null,
* @description The xy that the node will be set to. Changing this will alter the position as it's dragged.
actXY: null,
realXY: null,
mouseXY: null,
region: null,
this._fixIEMouseUp();
* @description The function we use as the ondragstart handler when we start a drag in Internet Explorer. This keeps IE from blowing up on images as drag handles.
_fixDragStart: function(e) {
e.preventDefault();
* @description The function we use as the onselectstart handler when we start a drag in Internet Explorer
_ieSelectFix: function() {
* @description We will hold a copy of the current "onselectstart" method on this property, and reset it after we are done using it.
_ieSelectBack: null,
* @description This method copies the onselectstart listner on the document to the _ieSelectFix property
_fixIEMouseDown: function(e) {
* @description This method copies the _ieSelectFix property back to the onselectstart listner on the document.
_fixIEMouseUp: function() {
_defMouseDownFn: function(e) {
this._dragThreshMet = false;
* @description Method first checks to see if we have handles, if so it validates the click against the handle. Then if it finds a valid handle, it checks it against the invalid handles list. Returns true if a good handle was used, false otherwise.
hTest = null,
els = null,
nlist = null,
set = false;
if (this._handles) {
nlist = i;
hTest = n;
if (this._invalids) {
if (hTest) {
set = false;
set = true;
_timeoutCheck: function() {
this.start();
* @description Add a handle to a drag element. Drag only initiates when a mousedown happens on this element.
if (!this._handles) {
this._handles = {};
* @description Add a selector string to test the handle against. If the test passes the drag operation will not continue.
this.actXY = [];
this._createEvents();
_prep: function() {
this._dragThreshMet = false;
_unprep: function() {
start: function() {
this.region = {
end: function() {
if (this._clickTimeout) {
_defEndFn: function(e) {
this._fixIEMouseUp();
this._ev_md = null;
* @description Handler for preventing the drag:end event. It will reset the node back to it's start position
_prevEndFn: function(e) {
this._fixIEMouseUp();
this._ev_md = null;
this.region = null;
_defAlignFn: function(e) {
this._moveNode();
this.region = {
info: {
_defDragFn: function(e) {
if (e.scroll) {
if (!this._dragThreshMet) {
this._dragThreshMet = true;
this.start();
if (this._clickTimeout) {
* @description Method will forcefully stop a drag operation. For example calling this from inside an ESC keypress handler will stop this drag.
stopDrag: function() {
destructor: function() {
this._unprep();
this.detachAll();
if (this.target) {