4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
14 * @class Roo.dd.DragZone
15 * @extends Roo.dd.DragSource
16 * This class provides a container DD instance that proxies for multiple child node sources.<br />
17 * By default, this class requires that draggable child nodes are registered with {@link Roo.dd.Registry}.
19 * @param {String/HTMLElement/Element} el The container element
20 * @param {Object} config
22 Roo.dd.DragZone = function(el, config){
23 Roo.dd.DragZone.superclass.constructor.call(this, el, config);
24 if(this.containerScroll){
25 Roo.dd.ScrollManager.register(this.el);
29 Roo.extend(Roo.dd.DragZone, Roo.dd.DragSource, {
31 * @cfg {Boolean} containerScroll True to register this container with the Scrollmanager
32 * for auto scrolling during drag operations.
35 * @cfg {String} hlColor The color to use when visually highlighting the drag source in the afterRepair
36 * method after a failed drop (defaults to "c3daf9" - light blue)
40 * Called when a mousedown occurs in this container. Looks in {@link Roo.dd.Registry}
41 * for a valid target to drag based on the mouse down. Override this method
42 * to provide your own lookup logic (e.g. finding a child by class name). Make sure your returned
43 * object has a "ddel" attribute (with an HTML Element) for other functions to work.
44 * @param {EventObject} e The mouse down event
45 * @return {Object} The dragData
47 getDragData : function(e){
48 return Roo.dd.Registry.getHandleFromEvent(e);
52 * Called once drag threshold has been reached to initialize the proxy element. By default, it clones the
54 * @param {Number} x The x position of the click on the dragged object
55 * @param {Number} y The y position of the click on the dragged object
56 * @return {Boolean} true to continue the drag, false to cancel
58 onInitDrag : function(x, y){
59 this.proxy.update(this.dragData.ddel.cloneNode(true));
60 this.onStartDrag(x, y);
65 * Called after a repair of an invalid drop. By default, highlights this.dragData.ddel
67 afterRepair : function(){
69 Roo.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");
71 this.dragging = false;
75 * Called before a repair of an invalid drop to get the XY to animate to. By default returns
76 * the XY of this.dragData.ddel
77 * @param {EventObject} e The mouse up event
78 * @return {Array} The xy location (e.g. [100, 200])
80 getRepairXY : function(e){
81 return Roo.Element.fly(this.dragData.ddel).getXY();