dd-plugin.js revision 99aa7114e025c67d2a08e24768ceb8a7ea6d4afa
/**
* Simple Drag plugin that can be attached to a Node or Widget via the plug method.
* @module dd
* @submodule dd-plugin
*/
/**
* Simple Drag plugin that can be attached to a Node or Widget via the plug method.
* @class Drag
* @extends DD.Drag
* @constructor
* @namespace Plugin
*/
} else {
}
},
EV_START = 'drag:start',
EV_DRAG = 'drag:drag',
EV_DRAG_END = 'drag:end';
/**
* @property NAME
* @description dd-plugin
* @type {String}
*/
/**
* @property NS
* @description The Drag instance will be placed on the Node instance under the dd namespace. It can be accessed via Node.dd;
* @type {String}
*/
_widgetHandles: null,
/**
* refers to a Y.Widget if its the host, otherwise = false.
*
* @attribute _widget
* @private
*/
/**
* refers to the [x,y] coordinate where the drag was stopped last
*
* @attribute _stoppedPosition
* @private
*/
/**
* Returns true if widget uses widgetPosition, otherwise returns false
*
* @method _usesWidgetPosition
* @private
*/
_usesWidgetPosition: function(widget) {
var r = false;
if (widget) {
}
return r;
},
/**
* Attached to the `drag:start` event, it checks if this plugin needs
* to attach or detach listeners for widgets. If `dd-proxy` is plugged
* the default widget positioning should be ignored.
* @method _checkEvents
* @private
*/
_checkEvents: function() {
if (this._widget) {
//It's a widget
if (this.proxy) {
//It's a proxy
//Remove Listeners
this._removeWidgetListeners();
}
} else {
this._attachWidgetListeners();
}
}
}
},
/**
* Remove the attached widget listeners
* @method _removeWidgetListeners
* @private
*/
_removeWidgetListeners: function() {
});
this._widgetHandles = [];
},
/**
* If this is a Widget, then attach the positioning listeners
* @method _attachWidgetListeners
* @private
*/
_attachWidgetListeners: function() {
//if this thing is a widget, and it uses widgetposition...
if (this._usesWidgetPosition(this._widget)) {
//set the x,y on the widget's ATTRS
//store the new position that the widget ends up on
}
},
/**
* Sets up event listeners on drag events if interacting with a widget
*
* @method initializer
* @protected
*/
initializer: function(config) {
this._widgetHandles = [];
this._attachWidgetListeners();
},
/**
* Updates x,y or xy attributes on widget based on where the widget is dragged
*
* @method initializer
* @param {EventFacade} e Event Facade
* @private
*/
_setWidgetCoords: function(e) {
//get the last position where the widget was, or get the starting point
//amount moved = [(x2 - x1) , (y2 - y1)]
//if both have changed..
}
//if only x is 0, set the Y
}
//otherwise, y is 0, so set X
}
},
/**
* Updates the last position where the widget was stopped.
*
* @method _updateStopPosition
* @param {EventFacade} e Event Facade
* @private
*/
_updateStopPosition: function(e) {
}
});
Y.namespace('Plugin');