www.gusucode.com > 一个基于extjs的强大聊天插件源码程序 > 一个基于extjs的强大聊天插件/extjame/ext-jame/js/ext2/source/dd/DragZone.js
/* * Ext JS Library 2.0.2 * Copyright(c) 2006-2008, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /** * @class Ext.dd.DragZone * @extends Ext.dd.DragSource * This class provides a container DD instance that proxies for multiple child node sources.<br /> * By default, this class requires that draggable child nodes are registered with {@link Ext.dd.Registry}. * @constructor * @param {Mixed} el The container element * @param {Object} config */ Ext.dd.DragZone = function(el, config){ Ext.dd.DragZone.superclass.constructor.call(this, el, config); if(this.containerScroll){ Ext.dd.ScrollManager.register(this.el); } }; Ext.extend(Ext.dd.DragZone, Ext.dd.DragSource, { /** * @cfg {Boolean} containerScroll True to register this container with the Scrollmanager * for auto scrolling during drag operations. */ /** * @cfg {String} hlColor The color to use when visually highlighting the drag source in the afterRepair * method after a failed drop (defaults to "c3daf9" - light blue) */ /** * Called when a mousedown occurs in this container. Looks in {@link Ext.dd.Registry} * for a valid target to drag based on the mouse down. Override this method * to provide your own lookup logic (e.g. finding a child by class name). Make sure your returned * object has a "ddel" attribute (with an HTML Element) for other functions to work. * @param {EventObject} e The mouse down event * @return {Object} The dragData */ getDragData : function(e){ return Ext.dd.Registry.getHandleFromEvent(e); }, /** * Called once drag threshold has been reached to initialize the proxy element. By default, it clones the * this.dragData.ddel * @param {Number} x The x position of the click on the dragged object * @param {Number} y The y position of the click on the dragged object * @return {Boolean} true to continue the drag, false to cancel */ onInitDrag : function(x, y){ this.proxy.update(this.dragData.ddel.cloneNode(true)); this.onStartDrag(x, y); return true; }, /** * Called after a repair of an invalid drop. By default, highlights this.dragData.ddel */ afterRepair : function(){ if(Ext.enableFx){ Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9"); } this.dragging = false; }, /** * Called before a repair of an invalid drop to get the XY to animate to. By default returns * the XY of this.dragData.ddel * @param {EventObject} e The mouse up event * @return {Array} The xy location (e.g. [100, 200]) */ getRepairXY : function(e){ return Ext.Element.fly(this.dragData.ddel).getXY(); } });