3
Copyright 2012 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() {
62
var ah = this.activeDrag.get('activeHandle'), cur = 'auto';
64
cur = ah.getStyle('cursor');
67
cur = this.get('dragCursor');
75
opacity: ((this._debugShim) ? '.5' : '0'),
82
* @description Sizes the shim on: activatation, window:scroll, window:resize
84
_pg_size: function() {
85
if (this.activeDrag) {
86
var b = Y.one('body'),
87
h = b.get('docHeight'),
88
w = b.get('docWidth');
98
* @description Creates the shim and adds it's listeners to it.
100
_createPG: function() {
101
var pg = Y.Node.create('<div></div>'),
102
bd = Y.one('body'), win;
106
position: 'absolute',
109
backgroundColor: 'red',
114
pg.set('id', Y.stamp(pg));
115
pg.addClass(Y.DD.DDM.CSS_PREFIX + '-shim');
118
this._pg.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime')));
119
this._pg.on('mouseup', Y.bind(this._end, this));
122
Y.on('window:resize', Y.bind(this._pg_size, this));
123
win.on('scroll', Y.bind(this._pg_size, this));
130
}, '3.5.1' ,{skinnable:false, requires:['dd-ddm-base', 'event-resize']});