2 Copyright (c) 2009, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.net/yui/license.txt
8 YUI.add('dd-ddm', function(Y) {
12 * Extends the dd-ddm-base Class to add support for the viewport shim to allow a draggable node to drag to be dragged over an iframe or any other node that traps mousemove events.
13 * It is also required to have Drop Targets enabled, as the viewport shim will contain the shims for the Drop Targets.
23 * @description The shim placed over the screen to track the mousemove event.
29 * @property _debugShim
30 * @description Set this to true to set the shims opacity to .5 for debugging it, default: false.
34 _activateTargets: function() {},
35 _deactivateTargets: function() {},
36 _startDrag: function() {
37 if (this.activeDrag.get('useShim')) {
39 this._activateTargets();
42 _endDrag: function() {
43 this._pg_deactivate();
44 this._deactivateTargets();
48 * @method _pg_deactivate
49 * @description Deactivates the shim
51 _pg_deactivate: function() {
52 this._pg.setStyle('display', 'none');
56 * @method _pg_activate
57 * @description Activates the shim
59 _pg_activate: function() {
60 var ah = this.activeDrag.get('activeHandle'), cur = 'auto';
62 cur = ah.getStyle('cursor');
65 cur = this.get('dragCursor');
73 opacity: ((this._debugShim) ? '.5' : '0'),
80 * @description Sizes the shim on: activatation, window:scroll, window:resize
82 _pg_size: function() {
83 if (this.activeDrag) {
84 var b = Y.get('body'),
85 h = b.get('docHeight'),
86 w = b.get('docWidth');
96 * @description Creates the shim and adds it's listeners to it.
98 _createPG: function() {
99 var pg = Y.Node.create('<div></div>'),
104 position: 'absolute',
107 backgroundColor: 'red',
112 pg.set('id', Y.stamp(pg));
113 pg.addClass('yui-dd-shim');
114 if (bd.get('firstChild')) {
115 bd.insertBefore(pg, bd.get('firstChild'));
120 this._pg.on('mouseup', Y.bind(this._end, this));
121 this._pg.on('mousemove', Y.bind(this._move, this));
123 var win = Y.get(window);
124 Y.on('window:resize', Y.bind(this._pg_size, this));
125 win.on('scroll', Y.bind(this._pg_size, this));
129 Y.on('domready', Y.bind(Y.DD.DDM._createPG, Y.DD.DDM));
135 }, '3.0.0' ,{requires:['dd-ddm-base', 'event-resize'], skinnable:false});