~lutostag/ubuntu/utopic/maas/1.5.2

« back to all changes in this revision

Viewing changes to src/maasserver/static/js/yui/3.4.1/dd-ddm/dd-ddm-debug.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-03-15 18:14:08 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120315181408-zgl94hzo0x4n99an
Tags: 0.1+bzr295+dfsg-0ubuntu2
* debian/patches:
  - 01-fix-database-settings.patch: Update to set PSERV_URL.
  - 02-pserv-config.patch: Set port to 8001.
* debian/maas.postinst: Run maas-import-isos on install.
* debian/control: Depends on rabbitmq-server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('dd-ddm', function(Y) {
8
 
 
9
 
 
10
 
    /**
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.
13
 
     * @module dd
14
 
     * @submodule dd-ddm
15
 
     * @for DDM
16
 
     * @namespace DD
17
 
     */
18
 
    Y.mix(Y.DD.DDM, {
19
 
        /**
20
 
        * @private
21
 
        * @property _pg
22
 
        * @description The shim placed over the screen to track the mousemove event.
23
 
        * @type {Node}
24
 
        */
25
 
        _pg: null,
26
 
        /**
27
 
        * @private
28
 
        * @property _debugShim
29
 
        * @description Set this to true to set the shims opacity to .5 for debugging it, default: false.
30
 
        * @type {Boolean}
31
 
        */
32
 
        _debugShim: false,
33
 
        _activateTargets: function() { },
34
 
        _deactivateTargets: function() {},
35
 
        _startDrag: function() {
36
 
            if (this.activeDrag && this.activeDrag.get('useShim')) {
37
 
                this._pg_activate();
38
 
                this._activateTargets();
39
 
            }
40
 
        },
41
 
        _endDrag: function() {
42
 
            this._pg_deactivate();
43
 
            this._deactivateTargets();
44
 
        },
45
 
        /**
46
 
        * @private
47
 
        * @method _pg_deactivate
48
 
        * @description Deactivates the shim
49
 
        */
50
 
        _pg_deactivate: function() {
51
 
            this._pg.setStyle('display', 'none');
52
 
        },
53
 
        /**
54
 
        * @private
55
 
        * @method _pg_activate
56
 
        * @description Activates the shim
57
 
        */
58
 
        _pg_activate: function() {
59
 
            var ah = this.activeDrag.get('activeHandle'), cur = 'auto';
60
 
            if (ah) {
61
 
                cur = ah.getStyle('cursor');
62
 
            }
63
 
            if (cur == 'auto') {
64
 
                cur = this.get('dragCursor');
65
 
            }
66
 
            
67
 
            this._pg_size();
68
 
            this._pg.setStyles({
69
 
                top: 0,
70
 
                left: 0,
71
 
                display: 'block',
72
 
                opacity: ((this._debugShim) ? '.5' : '0'),
73
 
                cursor: cur
74
 
            });
75
 
        },
76
 
        /**
77
 
        * @private
78
 
        * @method _pg_size
79
 
        * @description Sizes the shim on: activatation, window:scroll, window:resize
80
 
        */
81
 
        _pg_size: function() {
82
 
            if (this.activeDrag) {
83
 
                var b = Y.one('body'),
84
 
                h = b.get('docHeight'),
85
 
                w = b.get('docWidth');
86
 
                this._pg.setStyles({
87
 
                    height: h + 'px',
88
 
                    width: w + 'px'
89
 
                });
90
 
            }
91
 
        },
92
 
        /**
93
 
        * @private
94
 
        * @method _createPG
95
 
        * @description Creates the shim and adds it's listeners to it.
96
 
        */
97
 
        _createPG: function() {
98
 
            var pg = Y.Node.create('<div></div>'),
99
 
            bd = Y.one('body'), win;
100
 
            pg.setStyles({
101
 
                top: '0',
102
 
                left: '0',
103
 
                position: 'absolute',
104
 
                zIndex: '9999',
105
 
                overflow: 'hidden',
106
 
                backgroundColor: 'red',
107
 
                display: 'none',
108
 
                height: '5px',
109
 
                width: '5px'
110
 
            });
111
 
            pg.set('id', Y.stamp(pg));
112
 
            pg.addClass(Y.DD.DDM.CSS_PREFIX + '-shim');
113
 
            bd.prepend(pg);
114
 
            this._pg = pg;
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));
117
 
            
118
 
            win = Y.one('win');
119
 
            Y.on('window:resize', Y.bind(this._pg_size, this));
120
 
            win.on('scroll', Y.bind(this._pg_size, this));
121
 
        }   
122
 
    }, true);
123
 
 
124
 
 
125
 
 
126
 
 
127
 
}, '3.4.1' ,{skinnable:false, requires:['dd-ddm-base', 'event-resize']});