2
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
3
Code licensed under the BSD License:
4
http://developer.yahoo.net/yui/license.txt
7
YUI.add('dd-ddm', function(Y) {
10
* 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.
11
* It is also required to have Drop Targets enabled, as the viewport shim will contain the shims for the Drop Targets.
20
* @description The shim placed over the screen to track the mousemove event.
26
* @property _debugShim
27
* @description Set this to true to set the shims opacity to .5 for debugging it, default: false.
31
_activateTargets: function() {},
32
_deactivateTargets: function() {},
33
_startDrag: function() {
34
if (this.activeDrag.get('useShim')) {
36
this._activateTargets();
39
_endDrag: function() {
40
this._pg_deactivate();
41
this._deactivateTargets();
45
* @method _pg_deactivate
46
* @description Deactivates the shim
48
_pg_deactivate: function() {
49
this._pg.setStyle('display', 'none');
53
* @method _pg_activate
54
* @description Activates the shim
56
_pg_activate: function() {
62
opacity: ((this._debugShim) ? '.5' : '0')
68
* @description Sizes the shim on: activatation, window:scroll, window:resize
70
_pg_size: function() {
71
if (this.activeDrag) {
72
var b = Y.Node.get('body'),
73
h = b.get('docHeight'),
74
w = b.get('docWidth');
84
* @description Creates the shim and adds it's listeners to it.
86
_createPG: function() {
87
//var pg = Y.Node.create(['div']),
88
var pg = Y.Node.create('<div></div>'),
89
bd = Y.Node.get('body');
97
backgroundColor: 'red',
102
if (bd.get('firstChild')) {
103
bd.insertBefore(pg, bd.get('firstChild'));
108
this._pg.on('mouseup', this._end, this, true);
109
this._pg.on('mousemove', this._move, this, true);
113
Y.Event.addListener(window, 'resize', this._pg_size, this, true);
114
Y.Event.addListener(window, 'scroll', this._pg_size, this, true);
118
Y.DD.DDM._createPG();
122
}, '3.0.0pr1' ,{requires:['dd-ddm-base'], skinnable:false});