YAHOO.ext.LayoutDragDropMgr = function(layout){ this.layout = layout; this.pollId = null; this.pollInterval = 50; this.monitorDelegate = this.monitor.createDelegate(this); this.mouseMoveDelegate = YAHOO.ext.EventManager.wrap(this.onMouseMove, this, true); }; YAHOO.ext.LayoutDragDropMgr.prototype = { startDrag : function(dragRegion){ this.dragOffsets = this.el.getXY() || [0,0]; this.dragRegion = dragRegion; this.layout.getEl().on('mousemove', this.mouseMoveDelegate); this.pollId = setInterval(this.monitorDelegate, this.pollInterval); }, endDragOver : function(dragRegion){ this.dragRegion = null; this.layout.getEl().removeListener('mousemove', this.mouseMoveDelegate); clearInterval(this.pollId); }, onMouseMove : function(e){ var xy = e.getXY(); this.pointX = xy[0] - this.dragOffsets[0]; this.pointY = xy[1] - this.dragOffsets[1]; }, monitor : function(){ var x = this.pointX; var y = this.pointY; var pos = this.dragRegion.position; } };