Index: openacs-4/packages/ajaxhelper/www/resources/yui/dragdrop/dragdrop-debug.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/resources/yui/dragdrop/dragdrop-debug.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ajaxhelper/www/resources/yui/dragdrop/dragdrop-debug.js 8 Sep 2007 14:22:04 -0000 1.3 +++ openacs-4/packages/ajaxhelper/www/resources/yui/dragdrop/dragdrop-debug.js 9 Apr 2009 17:03:50 -0000 1.4 @@ -1,8 +1,8 @@ /* -Copyright (c) 2007, Yahoo! Inc. All rights reserved. +Copyright (c) 2009, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 2.3.0 +version: 2.7.0 */ /** * The drag and drop utility provides a framework for building drag and drop @@ -30,11 +30,125 @@ */ YAHOO.util.DragDropMgr = function() { - var Event = YAHOO.util.Event; + var Event = YAHOO.util.Event, + Dom = YAHOO.util.Dom; return { - /** + * This property is used to turn on global use of the shim element on all DragDrop instances, defaults to false for backcompat. (Use: YAHOO.util.DDM.useShim = true) + * @property useShim + * @type Boolean + * @static + */ + useShim: false, + /** + * This property is used to determine if the shim is active over the screen, default false. + * @private + * @property _shimActive + * @type Boolean + * @static + */ + _shimActive: false, + /** + * This property is used when useShim is set on a DragDrop object to store the current state of DDM.useShim so it can be reset when a drag operation is done. + * @private + * @property _shimState + * @type Boolean + * @static + */ + _shimState: false, + /** + * This property is used when useShim is set to true, it will set the opacity on the shim to .5 for debugging. Use: (YAHOO.util.DDM._debugShim = true;) + * @private + * @property _debugShim + * @type Boolean + * @static + */ + _debugShim: false, + /** + * This method will create a shim element (giving it the id of yui-ddm-shim), it also attaches the mousemove and mouseup listeners to it and attaches a scroll listener on the window + * @private + * @method _sizeShim + * @static + */ + _createShim: function() { + YAHOO.log('Creating Shim Element', 'info', 'DragDropMgr'); + var s = document.createElement('div'); + s.id = 'yui-ddm-shim'; + if (document.body.firstChild) { + document.body.insertBefore(s, document.body.firstChild); + } else { + document.body.appendChild(s); + } + s.style.display = 'none'; + s.style.backgroundColor = 'red'; + s.style.position = 'absolute'; + s.style.zIndex = '99999'; + Dom.setStyle(s, 'opacity', '0'); + this._shim = s; + Event.on(s, "mouseup", this.handleMouseUp, this, true); + Event.on(s, "mousemove", this.handleMouseMove, this, true); + Event.on(window, 'scroll', this._sizeShim, this, true); + }, + /** + * This method will size the shim, called from activate and on window scroll event + * @private + * @method _sizeShim + * @static + */ + _sizeShim: function() { + if (this._shimActive) { + YAHOO.log('Sizing Shim', 'info', 'DragDropMgr'); + var s = this._shim; + s.style.height = Dom.getDocumentHeight() + 'px'; + s.style.width = Dom.getDocumentWidth() + 'px'; + s.style.top = '0'; + s.style.left = '0'; + } + }, + /** + * This method will create the shim element if needed, then show the shim element, size the element and set the _shimActive property to true + * @private + * @method _activateShim + * @static + */ + _activateShim: function() { + if (this.useShim) { + YAHOO.log('Activating Shim', 'info', 'DragDropMgr'); + if (!this._shim) { + this._createShim(); + } + this._shimActive = true; + var s = this._shim, + o = '0'; + if (this._debugShim) { + o = '.5'; + } + Dom.setStyle(s, 'opacity', o); + this._sizeShim(); + s.style.display = 'block'; + } + }, + /** + * This method will hide the shim element and set the _shimActive property to false + * @private + * @method _deactivateShim + * @static + */ + _deactivateShim: function() { + YAHOO.log('Deactivating Shim', 'info', 'DragDropMgr'); + this._shim.style.display = 'none'; + this._shimActive = false; + }, + /** + * The HTML element created to use as a shim over the document to track mouse movements + * @private + * @property _shim + * @type HTMLElement + * @static + */ + _shim: null, + /** * Two dimensional Array of registered DragDrop objects. The first * dimension is the DragDrop item group, the second the DragDrop * object. @@ -229,7 +343,6 @@ this.init(); YAHOO.log("DragDropMgr onload", "info", "DragDropMgr"); - Event.on(document, "mouseup", this.handleMouseUp, this, true); Event.on(document, "mousemove", this.handleMouseMove, this, true); Event.on(window, "unload", this._onUnload, this, true); @@ -347,6 +460,16 @@ startY: 0, /** + * Flag to determine if the drag event was fired from the click timeout and + * not the mouse move threshold. + * @property fromTimeout + * @type boolean + * @private + * @static + */ + fromTimeout: false, + + /** * Each DragDrop instance must be registered with the DragDropMgr. * This is executed in DragDrop.init() * @method regDragDrop @@ -390,10 +513,13 @@ */ _remove: function(oDD) { for (var g in oDD.groups) { - if (g && this.ids[g][oDD.id]) { - delete this.ids[g][oDD.id]; - //YAHOO.log("NEW LEN " + this.ids.length, "warn"); + if (g) { + var item = this.ids[g]; + if (item && item[oDD.id]) { + delete item[oDD.id]; + } } + } delete this.handleIds[oDD.id]; }, @@ -439,7 +565,7 @@ getRelated: function(p_oDD, bTargetsOnly) { var oDDs = []; for (var i in p_oDD.groups) { - for (j in this.ids[i]) { + for (var j in this.ids[i]) { var dd = this.ids[i][j]; if (! this.isTypeOfDD(dd)) { continue; @@ -529,6 +655,7 @@ * @static */ handleMouseDown: function(e, oDD) { + //this._activateShim(); this.currentTarget = YAHOO.util.Event.getTarget(e); @@ -548,28 +675,36 @@ this.clickTimeout = setTimeout( function() { var DDM = YAHOO.util.DDM; - DDM.startDrag(DDM.startX, DDM.startY); + DDM.startDrag(DDM.startX, DDM.startY); + DDM.fromTimeout = true; }, this.clickTimeThresh ); }, /** - * Fired when either the drag pixel threshol or the mousedown hold + * Fired when either the drag pixel threshold or the mousedown hold * time threshold has been met. * @method startDrag * @param x {int} the X position of the original mousedown * @param y {int} the Y position of the original mousedown * @static */ startDrag: function(x, y) { + if (this.dragCurrent && this.dragCurrent.useShim) { + this._shimState = this.useShim; + this.useShim = true; + } + this._activateShim(); YAHOO.log("firing drag start events", "info", "DragDropMgr"); clearTimeout(this.clickTimeout); var dc = this.dragCurrent; - if (dc) { + if (dc && dc.events.b4StartDrag) { dc.b4StartDrag(x, y); + dc.fireEvent('b4StartDragEvent', { x: x, y: y }); } - if (dc) { + if (dc && dc.events.startDrag) { dc.startDrag(x, y); + dc.fireEvent('startDragEvent', { x: x, y: y }); } this.dragThreshMet = true; }, @@ -588,6 +723,12 @@ if (this.dragThreshMet) { YAHOO.log("mouseup detected - completing drag", "info", "DragDropMgr"); + if (this.fromTimeout) { + YAHOO.log('fromTimeout is true (mouse didn\'t move), call handleMouseMove so we can get the dragOver event', 'info', 'DragDropMgr'); + this.fromTimeout = false; + this.handleMouseMove(e); + } + this.fromTimeout = false; this.fireEvents(e, true); } else { YAHOO.log("drag threshold not met", "info", "DragDropMgr"); @@ -635,17 +776,33 @@ */ stopDrag: function(e, silent) { // YAHOO.log("mouseup - removing event handlers"); - + var dc = this.dragCurrent; // Fire the drag end event for the item that was dragged - if (this.dragCurrent && !silent) { + if (dc && !silent) { if (this.dragThreshMet) { YAHOO.log("firing endDrag events", "info", "DragDropMgr"); - this.dragCurrent.b4EndDrag(e); - this.dragCurrent.endDrag(e); + if (dc.events.b4EndDrag) { + dc.b4EndDrag(e); + dc.fireEvent('b4EndDragEvent', { e: e }); + } + if (dc.events.endDrag) { + dc.endDrag(e); + dc.fireEvent('endDragEvent', { e: e }); + } } + if (dc.events.mouseUp) { + YAHOO.log("firing dragdrop onMouseUp event", "info", "DragDropMgr"); + dc.onMouseUp(e); + dc.fireEvent('mouseUpEvent', { e: e }); + } + } - YAHOO.log("firing dragdrop onMouseUp event", "info", "DragDropMgr"); - this.dragCurrent.onMouseUp(e); + if (this._shimActive) { + this._deactivateShim(); + if (this.dragCurrent && this.dragCurrent.useShim) { + this.useShim = this._shimState; + this._shimState = false; + } } this.dragCurrent = null; @@ -668,7 +825,7 @@ */ handleMouseMove: function(e) { //YAHOO.log("handlemousemove"); - + var dc = this.dragCurrent; if (dc) { // YAHOO.log("no current drag obj"); @@ -681,6 +838,14 @@ YAHOO.log("button failure", "info", "DragDropMgr"); this.stopEvent(e); return this.handleMouseUp(e); + } else { + if (e.clientX < 0 || e.clientY < 0) { + //This will stop the element from leaving the viewport in FF, Opera & Safari + //Not turned on yet + //YAHOO.log("Either clientX or clientY is negative, stop the event.", "info", "DragDropMgr"); + //this.stopEvent(e); + //return false; + } } if (!this.dragThreshMet) { @@ -695,9 +860,13 @@ } if (this.dragThreshMet) { - dc.b4Drag(e); - if (dc) { + if (dc && dc.events.b4Drag) { + dc.b4Drag(e); + dc.fireEvent('b4DragEvent', { e: e}); + } + if (dc && dc.events.drag) { dc.onDrag(e); + dc.fireEvent('dragEvent', { e: e}); } if (dc) { this.fireEvents(e, false); @@ -707,7 +876,7 @@ this.stopEvent(e); } }, - + /** * Iterates over all of the DragDrop elements to find ones we are * hovering over or dropping on @@ -722,28 +891,33 @@ // If the user did the mouse up outside of the window, we could // get here even though we have ended the drag. - if (!dc || dc.isLocked()) { + // If the config option dragOnly is true, bail out and don't fire the events + if (!dc || dc.isLocked() || dc.dragOnly) { return; } - var x = YAHOO.util.Event.getPageX(e); - var y = YAHOO.util.Event.getPageY(e); - var pt = new YAHOO.util.Point(x,y); - var pos = dc.getTargetCoord(pt.x, pt.y); - var el = dc.getDragEl(); - curRegion = new YAHOO.util.Region( pos.y, + var x = YAHOO.util.Event.getPageX(e), + y = YAHOO.util.Event.getPageY(e), + pt = new YAHOO.util.Point(x,y), + pos = dc.getTargetCoord(pt.x, pt.y), + el = dc.getDragEl(), + events = ['out', 'over', 'drop', 'enter'], + curRegion = new YAHOO.util.Region( pos.y, pos.x + el.offsetWidth, pos.y + el.offsetHeight, - pos.x ); - // cache the previous dragOver array - var oldOvers = []; + pos.x ), + + oldOvers = [], // cache the previous dragOver array + inGroupsObj = {}, + inGroups = [], + data = { + outEvts: [], + overEvts: [], + dropEvts: [], + enterEvts: [] + }; - var outEvts = []; - var overEvts = []; - var dropEvts = []; - var enterEvts = []; - // Check to see if the object(s) we were hovering over is no longer // being hovered over so we can fire the onDragOut event for (var i in this.dragOvers) { @@ -753,9 +927,8 @@ if (! this.isTypeOfDD(ddo)) { continue; } - if (! this.isOverTarget(pt, ddo, this.mode, curRegion)) { - outEvts.push( ddo ); + data.outEvts.push( ddo ); } oldOvers[i] = true; @@ -777,18 +950,19 @@ if (oDD.isTarget && !oDD.isLocked() && oDD != dc) { if (this.isOverTarget(pt, oDD, this.mode, curRegion)) { + inGroupsObj[sGroup] = true; // look for drop interactions if (isDrop) { - dropEvts.push( oDD ); + data.dropEvts.push( oDD ); // look for drag enter and drag over interactions } else { // initial drag over: dragEnter fires if (!oldOvers[oDD.id]) { - enterEvts.push( oDD ); + data.enterEvts.push( oDD ); // subsequent drag overs: dragOver fires } else { - overEvts.push( oDD ); + data.overEvts.push( oDD ); } this.dragOvers[oDD.id] = oDD; @@ -799,106 +973,66 @@ } this.interactionInfo = { - out: outEvts, - enter: enterEvts, - over: overEvts, - drop: dropEvts, + out: data.outEvts, + enter: data.enterEvts, + over: data.overEvts, + drop: data.dropEvts, point: pt, draggedRegion: curRegion, sourceRegion: this.locationCache[dc.id], validDrop: isDrop }; + + for (var inG in inGroupsObj) { + inGroups.push(inG); + } + // notify about a drop that did not find a target - if (isDrop && !dropEvts.length) { + if (isDrop && !data.dropEvts.length) { YAHOO.log(dc.id + " dropped, but not on a target", "info", "DragDropMgr"); this.interactionInfo.validDrop = false; - dc.onInvalidDrop(e); + if (dc.events.invalidDrop) { + dc.onInvalidDrop(e); + dc.fireEvent('invalidDropEvent', { e: e }); + } } - - - if (this.mode) { - if (outEvts.length) { - YAHOO.log(dc.id+" onDragOut: " + outEvts, "info", "DragDropMgr"); - dc.b4DragOut(e, outEvts); - if (dc) { - dc.onDragOut(e, outEvts); - } + for (i = 0; i < events.length; i++) { + var tmp = null; + if (data[events[i] + 'Evts']) { + tmp = data[events[i] + 'Evts']; } - - if (enterEvts.length) { - YAHOO.log(dc.id+" onDragEnter: " + enterEvts, "info", "DragDropMgr"); - if (dc) { - dc.onDragEnter(e, enterEvts); + if (tmp && tmp.length) { + var type = events[i].charAt(0).toUpperCase() + events[i].substr(1), + ev = 'onDrag' + type, + b4 = 'b4Drag' + type, + cev = 'drag' + type + 'Event', + check = 'drag' + type; + if (this.mode) { + YAHOO.log(dc.id + ' ' + ev + ': ' + tmp, "info", "DragDropMgr"); + if (dc.events[b4]) { + dc[b4](e, tmp, inGroups); + dc.fireEvent(b4 + 'Event', { event: e, info: tmp, group: inGroups }); + + } + if (dc.events[check]) { + dc[ev](e, tmp, inGroups); + dc.fireEvent(cev, { event: e, info: tmp, group: inGroups }); + } + } else { + for (var b = 0, len = tmp.length; b < len; ++b) { + YAHOO.log(dc.id + ' ' + ev + ': ' + tmp[b].id, "info", "DragDropMgr"); + if (dc.events[b4]) { + dc[b4](e, tmp[b].id, inGroups[0]); + dc.fireEvent(b4 + 'Event', { event: e, info: tmp[b].id, group: inGroups[0] }); + } + if (dc.events[check]) { + dc[ev](e, tmp[b].id, inGroups[0]); + dc.fireEvent(cev, { event: e, info: tmp[b].id, group: inGroups[0] }); + } + } } } - - if (overEvts.length) { - YAHOO.log(dc.id+" onDragOver: " + overEvts, "info", "DragDropMgr"); - if (dc) { - dc.b4DragOver(e, overEvts); - } - - if (dc) { - dc.onDragOver(e, overEvts); - } - } - - if (dropEvts.length) { - YAHOO.log(dc.id+" onDragDrop: " + dropEvts, "info", "DragDropMgr"); - if (dc) { - dc.b4DragDrop(e, dropEvts); - } - if (dc) { - dc.onDragDrop(e, dropEvts); - } - } - - } else { - // fire dragout events - var len = 0; - for (i=0, len=outEvts.length; iYAHOO.util.EventProvider.subscribe + */ + on: function() { + this.subscribe.apply(this, arguments); + }, + /** * The id of the element associated with this object. This is what we * refer to as the "linked element" because the size and position of * this element is used to determine when the drag and drop objects have @@ -1620,20 +1769,33 @@ /** * By default, all instances can be a drop target. This can be disabled by * setting isTarget to false. - * @method isTarget + * @property isTarget * @type boolean */ isTarget: true, /** * The padding configured for this drag and drop object for calculating * the drop zone intersection with this object. - * @method padding + * @property padding * @type int[] */ padding: null, + /** + * If this flag is true, do not fire drop events. The element is a drag only element (for movement not dropping) + * @property dragOnly + * @type Boolean + */ + dragOnly: false, /** + * If this flag is true, a shim will be placed over the screen/viewable area to track mouse events. Should help with dragging elements over iframes and other controls. + * @property useShim + * @type Boolean + */ + useShim: false, + + /** * Cached reference to the linked element * @property _domRef * @private @@ -1978,7 +2140,12 @@ this.initTarget(id, sGroup, config); Event.on(this._domRef || this.id, "mousedown", this.handleMouseDown, this, true); + // Event.on(this.id, "selectstart", Event.preventDefault); + for (var i in this.events) { + this.createEvent(i + 'Event'); + } + }, /** @@ -1994,6 +2161,8 @@ // configuration attributes this.config = config || {}; + this.events = {}; + // create a local reference to the drag and drop manager this.DDM = YAHOO.util.DDM; @@ -2045,14 +2214,43 @@ * @method applyConfig */ applyConfig: function() { + this.events = { + mouseDown: true, + b4MouseDown: true, + mouseUp: true, + b4StartDrag: true, + startDrag: true, + b4EndDrag: true, + endDrag: true, + drag: true, + b4Drag: true, + invalidDrop: true, + b4DragOut: true, + dragOut: true, + dragEnter: true, + b4DragOver: true, + dragOver: true, + b4DragDrop: true, + dragDrop: true + }; + + if (this.config.events) { + for (var i in this.config.events) { + if (this.config.events[i] === false) { + this.events[i] = false; + } + } + } + // configurable properties: // padding, isTarget, maintainOffset, primaryButtonOnly this.padding = this.config.padding || [0, 0, 0, 0]; this.isTarget = (this.config.isTarget !== false); this.maintainOffset = (this.config.maintainOffset); this.primaryButtonOnly = (this.config.primaryButtonOnly !== false); - + this.dragOnly = ((this.config.dragOnly === true) ? true : false); + this.useShim = ((this.config.useShim === true) ? true : false); }, /** @@ -2101,7 +2299,11 @@ var el = this.getEl(); if (!this.DDM.verifyEl(el)) { - this.logger.log(this.id + " element is broken"); + if (el && el.style && (el.style.display == 'none')) { + this.logger.log(this.id + " can not get initial position, element style is display: none"); + } else { + this.logger.log(this.id + " element is broken"); + } return; } @@ -2264,9 +2466,23 @@ this.logger.log("firing onMouseDown events"); // firing the mousedown events prior to calculating positions - this.b4MouseDown(e); - this.onMouseDown(e); + var b4Return = this.b4MouseDown(e), + b4Return2 = true; + if (this.events.b4MouseDown) { + b4Return2 = this.fireEvent('b4MouseDownEvent', e); + } + var mDownReturn = this.onMouseDown(e), + mDownReturn2 = true; + if (this.events.mouseDown) { + mDownReturn2 = this.fireEvent('mouseDownEvent', e); + } + + if ((b4Return === false) || (mDownReturn === false) || (b4Return2 === false) || (mDownReturn2 === false)) { + this.logger.log('b4MouseDown or onMouseDown returned false, exiting drag'); + return; + } + this.DDM.refreshCache(this.groups); // var self = this; // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0); @@ -2302,8 +2518,14 @@ } }, + /** + * @method clickValidator + * @description Method validates that the clicked element + * was indeed the handle or a valid child of the handle + * @param {Event} e + */ clickValidator: function(e) { - var target = Event.getTarget(e); + var target = YAHOO.util.Event.getTarget(e); return ( this.isValidHandleChild(target) && (this.id == this.handleElId || this.DDM.handleWasClicked(target, this.id)) ); @@ -2669,7 +2891,100 @@ } }; +YAHOO.augment(YAHOO.util.DragDrop, YAHOO.util.EventProvider); +/** +* @event mouseDownEvent +* @description Provides access to the mousedown event. The mousedown does not always result in a drag operation. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event b4MouseDownEvent +* @description Provides access to the mousedown event, before the mouseDownEvent gets fired. Returning false will cancel the drag. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event mouseUpEvent +* @description Fired from inside DragDropMgr when the drag operation is finished. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event b4StartDragEvent +* @description Fires before the startDragEvent, returning false will cancel the startDrag Event. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event startDragEvent +* @description Occurs after a mouse down and the drag threshold has been met. The drag threshold default is either 3 pixels of mouse movement or 1 full second of holding the mousedown. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event b4EndDragEvent +* @description Fires before the endDragEvent. Returning false will cancel. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event endDragEvent +* @description Fires on the mouseup event after a drag has been initiated (startDrag fired). +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event dragEvent +* @description Occurs every mousemove event while dragging. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragEvent +* @description Fires before the dragEvent. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event invalidDropEvent +* @description Fires when the dragged objects is dropped in a location that contains no drop targets. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragOutEvent +* @description Fires before the dragOutEvent +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragOutEvent +* @description Fires when a dragged object is no longer over an object that had the onDragEnter fire. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragEnterEvent +* @description Occurs when the dragged object first interacts with another targettable drag and drop object. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragOverEvent +* @description Fires before the dragOverEvent. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragOverEvent +* @description Fires every mousemove event while over a drag and drop object. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragDropEvent +* @description Fires before the dragDropEvent +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragDropEvent +* @description Fires when the dragged objects is dropped on another. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ })(); /** * A DragDrop implementation where the linked element follows the @@ -2693,7 +3008,7 @@ /** * When set to true, the utility automatically tries to scroll the browser - * window wehn a drag and drop element is dragged near the viewport boundary. + * window when a drag and drop element is dragged near the viewport boundary. * Defaults to true. * @property scroll * @type boolean @@ -2762,6 +3077,7 @@ if (!this.deltaSetXY) { var aCoord = [oCoord.x, oCoord.y]; YAHOO.util.Dom.setXY(el, aCoord); + var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 ); var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 ); @@ -2772,7 +3088,10 @@ } this.cachePosition(oCoord.x, oCoord.y); - this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth); + var self = this; + setTimeout(function() { + self.autoScroll.call(self, oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth); + }, 0); }, /** @@ -2943,6 +3262,98 @@ */ +/** +* @event mouseDownEvent +* @description Provides access to the mousedown event. The mousedown does not always result in a drag operation. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event b4MouseDownEvent +* @description Provides access to the mousedown event, before the mouseDownEvent gets fired. Returning false will cancel the drag. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event mouseUpEvent +* @description Fired from inside DragDropMgr when the drag operation is finished. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event b4StartDragEvent +* @description Fires before the startDragEvent, returning false will cancel the startDrag Event. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event startDragEvent +* @description Occurs after a mouse down and the drag threshold has been met. The drag threshold default is either 3 pixels of mouse movement or 1 full second of holding the mousedown. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event b4EndDragEvent +* @description Fires before the endDragEvent. Returning false will cancel. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event endDragEvent +* @description Fires on the mouseup event after a drag has been initiated (startDrag fired). +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event dragEvent +* @description Occurs every mousemove event while dragging. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragEvent +* @description Fires before the dragEvent. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event invalidDropEvent +* @description Fires when the dragged objects is dropped in a location that contains no drop targets. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragOutEvent +* @description Fires before the dragOutEvent +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragOutEvent +* @description Fires when a dragged object is no longer over an object that had the onDragEnter fire. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragEnterEvent +* @description Occurs when the dragged object first interacts with another targettable drag and drop object. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragOverEvent +* @description Fires before the dragOverEvent. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragOverEvent +* @description Fires every mousemove event while over a drag and drop object. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragDropEvent +* @description Fires before the dragDropEvent +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragDropEvent +* @description Fires when the dragged objects is dropped on another. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ }); /** * A DragDrop implementation that inserts an empty, bordered div into @@ -3175,7 +3586,99 @@ toString: function() { return ("DDProxy " + this.id); } +/** +* @event mouseDownEvent +* @description Provides access to the mousedown event. The mousedown does not always result in a drag operation. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4MouseDownEvent +* @description Provides access to the mousedown event, before the mouseDownEvent gets fired. Returning false will cancel the drag. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event mouseUpEvent +* @description Fired from inside DragDropMgr when the drag operation is finished. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event b4StartDragEvent +* @description Fires before the startDragEvent, returning false will cancel the startDrag Event. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event startDragEvent +* @description Occurs after a mouse down and the drag threshold has been met. The drag threshold default is either 3 pixels of mouse movement or 1 full second of holding the mousedown. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event b4EndDragEvent +* @description Fires before the endDragEvent. Returning false will cancel. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event endDragEvent +* @description Fires on the mouseup event after a drag has been initiated (startDrag fired). +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + +/** +* @event dragEvent +* @description Occurs every mousemove event while dragging. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragEvent +* @description Fires before the dragEvent. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event invalidDropEvent +* @description Fires when the dragged objects is dropped in a location that contains no drop targets. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragOutEvent +* @description Fires before the dragOutEvent +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragOutEvent +* @description Fires when a dragged object is no longer over an object that had the onDragEnter fire. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragEnterEvent +* @description Occurs when the dragged object first interacts with another targettable drag and drop object. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragOverEvent +* @description Fires before the dragOverEvent. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragOverEvent +* @description Fires every mousemove event while over a drag and drop object. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event b4DragDropEvent +* @description Fires before the dragDropEvent +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ +/** +* @event dragDropEvent +* @description Fires when the dragged objects is dropped on another. +* @type YAHOO.util.CustomEvent See Element.addListener for more information on listening for this event. +*/ + }); /** * A DragDrop implementation that does not move, but can be a drop @@ -3204,4 +3707,4 @@ return ("DDTarget " + this.id); } }); -YAHOO.register("dragdrop", YAHOO.util.DragDropMgr, {version: "2.3.0", build: "442"}); +YAHOO.register("dragdrop", YAHOO.util.DragDropMgr, {version: "2.7.0", build: "1799"});