summaryrefslogtreecommitdiff
path: root/frontend/beta/js/YUI-extensions/dd/DragZone.js
Unidiff
Diffstat (limited to 'frontend/beta/js/YUI-extensions/dd/DragZone.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/YUI-extensions/dd/DragZone.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/frontend/beta/js/YUI-extensions/dd/DragZone.js b/frontend/beta/js/YUI-extensions/dd/DragZone.js
new file mode 100644
index 0000000..7a6edb6
--- a/dev/null
+++ b/frontend/beta/js/YUI-extensions/dd/DragZone.js
@@ -0,0 +1,64 @@
1// kill drag drop dependency
2if(YAHOO.util.DragDrop){
3/**
4 * @class YAHOO.ext.dd.DragZone
5 * @extends YAHOO.ext.dd.Source
6 * This class provides a container DD instance that proxies for multiple child node sources.<br />
7 * By default, this class requires that draggable child nodes are registered with
8 * {@link YAHOO.ext.dd.Registry}.
9 * @cfg {Boolean} containerScroll True to register this container with the Scrollmanager
10 * for auto scrolling during drag operations.
11 * @constructor
12 * @param {String/HTMLElement/Element} el The container element
13 * @param {Object} config
14 */
15YAHOO.ext.dd.DragZone = function(el, config){
16 YAHOO.ext.dd.DragZone.superclass.constructor.call(this, el, config);
17 if(this.containerScroll){
18 YAHOO.ext.dd.ScrollManager.register(this.el);
19 }
20};
21
22YAHOO.extendX(YAHOO.ext.dd.DragZone, YAHOO.ext.dd.DragSource, {
23 /**
24 * Called when a mousedown occurs in this container. Looks in {@link YAHOO.ext.dd.Registry}
25 * for a valid target to drag based on the mouse down. Override this method
26 * to provide your own lookup logic (e.g. finding a child by class name). Make sure your returned
27 * object has a "ddel" attribute (with an HTML Element) for other functions to work.
28 * @param {EventObject} e The mouse down event
29 * @return {Object} The dragData
30 */
31 getDragData : function(e){
32 return YAHOO.ext.dd.Registry.getHandleFromEvent(e);
33 },
34
35 /**
36 * Called once drag threshold has been reached to initialize the proxy element. By default, it clones the
37 * this.dragData.ddel
38 * @param {EventObject} e The current event
39 * @return {Boolean} true to continue the drag, false to cancel
40 */
41 onInitDrag : function(e){
42 this.proxy.update(this.dragData.ddel.cloneNode(true));
43 return true;
44 },
45
46 /**
47 * Called after a repair of an invalid drop. By default, highlights this.dragData.ddel
48 */
49 afterRepair : function(){
50 YAHOO.ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || 'c3daf9');
51 this.dragging = false;
52 },
53
54 /**
55 * Called before a repair of an invalid drop to get the XY to animate to. By default returns
56 * the XY of this.dragData.ddel
57 * @param {EventObject} e The mouse up event
58 * @return {Array} The xy location (e.g. [100, 200])
59 */
60 getRepairXY : function(e){
61 return YAHOO.ext.Element.fly(this.dragData.ddel).getXY();
62 }
63});
64}