3
Copyright 2011 Yahoo! Inc. All rights reserved.
4
Licensed under the BSD License.
5
http://yuilibrary.com/license/
7
YUI.add('dd-ddm', function(Y) {
11
* 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.
12
* It is also required to have Drop Targets enabled, as the viewport shim will contain the shims for the Drop Targets.
22
* @description The shim placed over the screen to track the mousemove event.
28
* @property _debugShim
29
* @description Set this to true to set the shims opacity to .5 for debugging it, default: false.
33
_activateTargets: function() { },
34
_deactivateTargets: function() {},
35
_startDrag: function() {
36
if (this.activeDrag && this.activeDrag.get('useShim')) {
38
this._activateTargets();
41
_endDrag: function() {
42
this._pg_deactivate();
43
this._deactivateTargets();
47
* @method _pg_deactivate
48
* @description Deactivates the shim
50
_pg_deactivate: function() {
51
this._pg.setStyle('display', 'none');
55
* @method _pg_activate
56
* @description Activates the shim
58
_pg_activate: function() {
59
var ah = this.activeDrag.get('activeHandle'), cur = 'auto';
61
cur = ah.getStyle('cursor');
64
cur = this.get('dragCursor');
72
opacity: ((this._debugShim) ? '.5' : '0'),
79
* @description Sizes the shim on: activatation, window:scroll, window:resize
81
_pg_size: function() {
82
if (this.activeDrag) {
83
var b = Y.one('body'),
84
h = b.get('docHeight'),
85
w = b.get('docWidth');
95
* @description Creates the shim and adds it's listeners to it.
97
_createPG: function() {
98
var pg = Y.Node.create('<div></div>'),
99
bd = Y.one('body'), win;
103
position: 'absolute',
106
backgroundColor: 'red',
111
pg.set('id', Y.stamp(pg));
112
pg.addClass(Y.DD.DDM.CSS_PREFIX + '-shim');
115
this._pg.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime')));
116
this._pg.on('mouseup', Y.bind(this._end, this));
119
Y.on('window:resize', Y.bind(this._pg_size, this));
120
win.on('scroll', Y.bind(this._pg_size, this));
127
}, '3.4.1' ,{skinnable:false, requires:['dd-ddm-base', 'event-resize']});