~ted/lazr-js/annoying-debug-message

« back to all changes in this revision

Viewing changes to src-js/lazrjs/yui/dd/dd-debug.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2010-09-09 14:20:30 UTC
  • mfrom: (182.1.3 yui-3.2)
  • Revision ID: launchpad@pqm.canonical.com-20100909142030-13w6vo0ixfysxc15
[r=beuno] Update lazr-js to yui-3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.com/yui/license.html
5
 
version: 3.1.2
6
 
build: 56
 
5
version: 3.2.0
 
6
build: 2676
7
7
*/
8
8
YUI.add('dd-ddm-base', function(Y) {
9
9
 
113
113
        * @description The PREFIX to attach to all DD CSS class names
114
114
        * @type {String}
115
115
        */
116
 
        CSS_PREFIX: 'yui3-dd',
 
116
        CSS_PREFIX: Y.ClassNameManager.getClassName('dd'),
117
117
        _activateTargets: function() {},        
118
118
        /**
119
119
        * @private
168
168
        _setupListeners: function() {
169
169
            this._createPG();
170
170
            this._active = true;
171
 
            var doc = Y.one(document);
 
171
 
 
172
            var doc = Y.one(Y.config.doc);
172
173
            doc.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime')));
173
 
            //Y.Event.nativeAdd(document, 'mousemove', Y.bind(this._move, this));
174
174
            doc.on('mouseup', Y.bind(this._end, this));
175
175
        },
176
176
        /**
355
355
 
356
356
 
357
357
 
358
 
}, '3.1.2' ,{requires:['node', 'base', 'yui-throttle'], skinnable:false});
 
358
}, '3.2.0' ,{skinnable:false, requires:['node', 'base', 'yui-throttle', 'classnamemanager']});
359
359
YUI.add('dd-ddm', function(Y) {
360
360
 
361
361
 
385
385
        _activateTargets: function() { },
386
386
        _deactivateTargets: function() {},
387
387
        _startDrag: function() {
388
 
            if (this.activeDrag.get('useShim')) {
 
388
            if (this.activeDrag && this.activeDrag.get('useShim')) {
389
389
                this._pg_activate();
390
390
                this._activateTargets();
391
391
            }
461
461
                width: '5px'
462
462
            });
463
463
            pg.set('id', Y.stamp(pg));
464
 
            pg.addClass('yui3-dd-shim');
465
 
            if (bd.get('firstChild')) {
466
 
                bd.insertBefore(pg, bd.get('firstChild'));
467
 
            } else {
468
 
                bd.appendChild(pg);
469
 
            }
 
464
            pg.addClass(Y.DD.DDM.CSS_PREFIX + '-shim');
 
465
            bd.prepend(pg);
470
466
            this._pg = pg;
 
467
            this._pg.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime')));
471
468
            this._pg.on('mouseup', Y.bind(this._end, this));
472
 
            this._pg.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime')));
473
469
            
474
 
            win = Y.one(window);
 
470
            win = Y.one('win');
475
471
            Y.on('window:resize', Y.bind(this._pg_size, this));
476
472
            win.on('scroll', Y.bind(this._pg_size, this));
477
473
        }   
480
476
 
481
477
 
482
478
 
483
 
}, '3.1.2' ,{requires:['dd-ddm-base', 'event-resize'], skinnable:false});
 
479
}, '3.2.0' ,{skinnable:false, requires:['dd-ddm-base', 'event-resize']});
484
480
YUI.add('dd-ddm-drop', function(Y) {
485
481
 
486
482
 
666
662
                        if (drop && drop.shim) {
667
663
                            if ((dMode == this.INTERSECT) && this._noShim) {
668
664
                                r = ((aRegion) ? aRegion : this.activeDrag.get('node'));
669
 
                                return drop.get('node').intersect(r).inRegion;
 
665
                                return drop.get('node').intersect(r, drop.region).inRegion;
670
666
                            } else {
671
667
                                if (this._noShim) {
672
668
                                    node = drop.get('node');
707
703
            this._noShim = true;
708
704
            this.clearCache();
709
705
            Y.each(this.targets, function(v, k) {
710
 
                v._activateShim.apply(v, []);
 
706
                v._activateShim([]);
711
707
                if (v.get('noShim') == true) {
712
708
                    this._noShim = false;
713
709
                }
784
780
            this.activeDrop = null;
785
781
 
786
782
            Y.each(this.targets, function(v, k) {
787
 
                v._deactivateShim.apply(v, []);
 
783
                v._deactivateShim([]);
788
784
            }, this);
789
785
        },
790
786
        /**
891
887
 
892
888
 
893
889
 
894
 
}, '3.1.2' ,{requires:['dd-ddm'], skinnable:false});
 
890
}, '3.2.0' ,{skinnable:false, requires:['dd-ddm']});
895
891
YUI.add('dd-drag', function(Y) {
896
892
 
897
893
 
914
910
        DRAG_NODE = 'dragNode',
915
911
        OFFSET_HEIGHT = 'offsetHeight',
916
912
        OFFSET_WIDTH = 'offsetWidth',        
917
 
        MOUSE_UP = 'mouseup',
918
 
        MOUSE_DOWN = 'mousedown',
919
 
        DRAG_START = 'dragstart',
920
913
        /**
921
914
        * @event drag:mouseDown
922
915
        * @description Handles the mousedown DOM event, checks to see if you have a valid handle then starts the drag timers.
923
916
        * @preventable _defMouseDownFn
924
 
        * @param {Event.Facade} ev The mousedown event.
 
917
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
918
        * <dl><dt>ev</dt><dd>The original mousedown event.</dd></dl>
925
919
        * @bubbles DDM
926
920
        * @type {Event.Custom}
927
921
        */
929
923
        /**
930
924
        * @event drag:afterMouseDown
931
925
        * @description Fires after the mousedown event has been cleared.
932
 
        * @param {Event.Facade} ev The mousedown event.
 
926
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
927
        * <dl><dt>ev</dt><dd>The original mousedown event.</dd></dl>
933
928
        * @bubbles DDM
934
929
        * @type {Event.Custom}
935
930
        */
937
932
        /**
938
933
        * @event drag:removeHandle
939
934
        * @description Fires after a handle is removed.
 
935
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
936
        * <dl><dt>handle</dt><dd>The handle that was removed.</dd></dl>
940
937
        * @bubbles DDM
941
938
        * @type {Event.Custom}
942
939
        */
944
941
        /**
945
942
        * @event drag:addHandle
946
943
        * @description Fires after a handle is added.
 
944
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
945
        * <dl><dt>handle</dt><dd>The handle that was added.</dd></dl>
947
946
        * @bubbles DDM
948
947
        * @type {Event.Custom}
949
948
        */
951
950
        /**
952
951
        * @event drag:removeInvalid
953
952
        * @description Fires after an invalid selector is removed.
 
953
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
954
        * <dl><dt>handle</dt><dd>The handle that was removed.</dd></dl>
954
955
        * @bubbles DDM
955
956
        * @type {Event.Custom}
956
957
        */
958
959
        /**
959
960
        * @event drag:addInvalid
960
961
        * @description Fires after an invalid selector is added.
 
962
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
963
        * <dl><dt>handle</dt><dd>The handle that was added.</dd></dl>
961
964
        * @bubbles DDM
962
965
        * @type {Event.Custom}
963
966
        */
965
968
        /**
966
969
        * @event drag:start
967
970
        * @description Fires at the start of a drag operation.
 
971
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
972
        * <dl>
 
973
        * <dt>pageX</dt><dd>The original node position X.</dd>
 
974
        * <dt>pageY</dt><dd>The original node position Y.</dd>
 
975
        * <dt>startTime</dt><dd>The startTime of the event. getTime on the current Date object.</dd>
 
976
        * </dl>
968
977
        * @bubbles DDM
969
978
        * @type {Event.Custom}
970
979
        */
972
981
        /**
973
982
        * @event drag:end
974
983
        * @description Fires at the end of a drag operation.
 
984
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
985
        * <dl>
 
986
        * <dt>pageX</dt><dd>The current node position X.</dd>
 
987
        * <dt>pageY</dt><dd>The current node position Y.</dd>
 
988
        * <dt>startTime</dt><dd>The startTime of the event, from the start event.</dd>
 
989
        * <dt>endTime</dt><dd>The endTime of the event. getTime on the current Date object.</dd>
 
990
        * </dl>
975
991
        * @bubbles DDM
976
992
        * @type {Event.Custom}
977
993
        */
979
995
        /**
980
996
        * @event drag:drag
981
997
        * @description Fires every mousemove during a drag operation.
 
998
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
999
        * <dl>
 
1000
        * <dt>pageX</dt><dd>The current node position X.</dd>
 
1001
        * <dt>pageY</dt><dd>The current node position Y.</dd>
 
1002
        * <dt>scroll</dt><dd>Should a scroll action occur.</dd>
 
1003
        * <dt>info</dt><dd>Object hash containing calculated XY arrays: start, xy, delta, offset</dd>
 
1004
        * </dl>
982
1005
        * @bubbles DDM
983
1006
        * @type {Event.Custom}
984
1007
        */
987
1010
        * @event drag:align
988
1011
        * @preventable _defAlignFn
989
1012
        * @description Fires when this node is aligned.
 
1013
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
1014
        * <dl>
 
1015
        * <dt>pageX</dt><dd>The current node position X.</dd>
 
1016
        * <dt>pageY</dt><dd>The current node position Y.</dd>
 
1017
        * </dl>
990
1018
        * @bubbles DDM
991
1019
        * @type {Event.Custom}
992
1020
        */
994
1022
        /**
995
1023
        * @event drag:over
996
1024
        * @description Fires when this node is over a Drop Target. (Fired from dd-drop)
 
1025
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
1026
        * <dl>
 
1027
        * <dt>drop</dt><dd>The drop object at the time of the event.</dd>
 
1028
        * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
 
1029
        * </dl>
997
1030
        * @bubbles DDM
998
1031
        * @type {Event.Custom}
999
1032
        */
1000
1033
        /**
1001
1034
        * @event drag:enter
1002
1035
        * @description Fires when this node enters a Drop Target. (Fired from dd-drop)
 
1036
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
1037
        * <dl>
 
1038
        * <dt>drop</dt><dd>The drop object at the time of the event.</dd>
 
1039
        * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
 
1040
        * </dl>
1003
1041
        * @bubbles DDM
1004
1042
        * @type {Event.Custom}
1005
1043
        */
1006
1044
        /**
1007
1045
        * @event drag:exit
1008
1046
        * @description Fires when this node exits a Drop Target. (Fired from dd-drop)
 
1047
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
1048
        * <dl>
 
1049
        * <dt>drop</dt><dd>The drop object at the time of the event.</dd>
 
1050
        * </dl>
1009
1051
        * @bubbles DDM
1010
1052
        * @type {Event.Custom}
1011
1053
        */
1012
1054
        /**
1013
1055
        * @event drag:drophit
1014
1056
        * @description Fires when this node is dropped on a valid Drop Target. (Fired from dd-ddm-drop)
 
1057
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
1058
        * <dl>
 
1059
        * <dt>drop</dt><dd>The best guess on what was dropped on.</dd>
 
1060
        * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
 
1061
        * <dt>others</dt><dd>An array of all the other drop targets that was dropped on.</dd>
 
1062
        * </dl>
1015
1063
        * @bubbles DDM
1016
1064
        * @type {Event.Custom}
1017
1065
        */
1018
1066
        /**
1019
1067
        * @event drag:dropmiss
1020
1068
        * @description Fires when this node is dropped on an invalid Drop Target. (Fired from dd-ddm-drop)
 
1069
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
1070
        * <dl>
 
1071
        * <dt>pageX</dt><dd>The current node position X.</dd>
 
1072
        * <dt>pageY</dt><dd>The current node position Y.</dd>
 
1073
        * </dl>
1021
1074
        * @bubbles DDM
1022
1075
        * @type {Event.Custom}
1023
1076
        */
1033
1086
    };
1034
1087
 
1035
1088
    Drag.NAME = 'drag';
 
1089
    
 
1090
    /**
 
1091
    * This property defaults to "mousedown", but when drag-gestures is loaded, it is changed to "gesturemovestart"
 
1092
    * @static
 
1093
    * @property START_EVENT
 
1094
    */
 
1095
    Drag.START_EVENT = 'mousedown';
1036
1096
 
1037
1097
    Drag.ATTRS = {
1038
1098
        /**
1247
1307
                this.addTarget(t);
1248
1308
                return t;
1249
1309
            }
 
1310
        },
 
1311
        /**
 
1312
        * @attribute haltDown
 
1313
        * @description Should the mousedown event be halted. Default: true
 
1314
        * @type Boolean
 
1315
        */
 
1316
        haltDown: {
 
1317
            value: true
1250
1318
        }
1251
1319
    };
1252
1320
 
1354
1422
            });
1355
1423
            
1356
1424
            this.publish(EV_END, {
 
1425
                defaultFn: this._defEndFn,
1357
1426
                preventedFn: this._prevEndFn,
1358
1427
                queuable: false,
1359
1428
                emitFacade: true,
1569
1638
        */
1570
1639
        _defMouseDownFn: function(e) {
1571
1640
            var ev = e.ev;
 
1641
 
1572
1642
            this._dragThreshMet = false;
1573
1643
            this._ev_md = ev;
1574
1644
            
1577
1647
            }
1578
1648
            if (this.validClick(ev)) {
1579
1649
                this._fixIEMouseDown();
1580
 
                ev.halt();
 
1650
                if (this.get('haltDown')) {
 
1651
                    Y.log('Halting MouseDown', 'info', 'drag');
 
1652
                    ev.halt();
 
1653
                } else {
 
1654
                    Y.log('Preventing Default on MouseDown', 'info', 'drag');
 
1655
                    ev.preventDefault();
 
1656
                }
 
1657
                
1581
1658
                this._setStartPosition([ev.pageX, ev.pageY]);
1582
1659
 
1583
1660
                DDM.activeDrag = this;
1678
1755
        * @description The method passed to setTimeout to determine if the clickTimeThreshold was met.
1679
1756
        */
1680
1757
        _timeoutCheck: function() {
1681
 
            if (!this.get('lock') && !this._dragThreshMet) {
 
1758
            if (!this.get('lock') && !this._dragThreshMet && this._ev_md) {
1682
1759
                this._fromTimeout = this._dragThreshMet = true;
1683
1760
                this.start();
1684
1761
                this._alignNode([this._ev_md.pageX, this._ev_md.pageY], true);
1789
1866
            this._dragThreshMet = false;
1790
1867
            var node = this.get(NODE);
1791
1868
            node.addClass(DDM.CSS_PREFIX + '-draggable');
1792
 
            node.on(MOUSE_DOWN, Y.bind(this._handleMouseDownEvent, this));
1793
 
            node.on(MOUSE_UP, Y.bind(this._handleMouseUp, this));
1794
 
            node.on(DRAG_START, Y.bind(this._fixDragStart, this));
 
1869
 
 
1870
            node.addClass(DDM.CSS_PREFIX + '-draggable');
 
1871
            node.on(Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this));
 
1872
            node.on('mouseup', Y.bind(this._handleMouseUp, this));
 
1873
            node.on('dragstart', Y.bind(this._fixDragStart, this));
1795
1874
        },
1796
1875
        /**
1797
1876
        * @private
1856
1935
            if (this._clickTimeout) {
1857
1936
                this._clickTimeout.cancel();
1858
1937
            }
1859
 
            this._dragThreshMet = false;
1860
 
            this._fromTimeout = false;
 
1938
            this._dragThreshMet = this._fromTimeout = false;
 
1939
            this._ev_md = null;
 
1940
 
1861
1941
            if (!this.get('lock') && this.get(DRAGGING)) {
1862
1942
                this.fire(EV_END, {
1863
1943
                    pageX: this.lastXY[0],
1874
1954
        },
1875
1955
        /**
1876
1956
        * @private
 
1957
        * @method _defEndFn
 
1958
        * @description Handler for fixing the selection in IE
 
1959
        */
 
1960
        _defEndFn: function(e) {
 
1961
            this._fixIEMouseUp();
 
1962
        },
 
1963
        /**
 
1964
        * @private
1877
1965
        * @method _prevEndFn
1878
1966
        * @description Handler for preventing the drag:end event. It will reset the node back to it's start position
1879
1967
        */
1880
1968
        _prevEndFn: function(e) {
 
1969
            this._fixIEMouseUp();
1881
1970
            //Bug #1852577
1882
1971
            this.get(DRAG_NODE).setXY(this.nodeXY);
1883
1972
        },
2027
2116
 
2028
2117
 
2029
2118
 
2030
 
}, '3.1.2' ,{requires:['dd-ddm-base'], skinnable:false});
 
2119
}, '3.2.0' ,{skinnable:false, requires:['dd-ddm-base']});
2031
2120
YUI.add('dd-proxy', function(Y) {
2032
2121
 
2033
2122
 
2107
2196
        borderStyle: {
2108
2197
            value: '1px solid #808080'
2109
2198
        },
 
2199
        /**
 
2200
        * @attribute cloneNode
 
2201
        * @description Should the node be cloned into the proxy for you. Default: false
 
2202
        * @type Boolean
 
2203
        */
2110
2204
        cloneNode: {
2111
2205
            value: false
2112
2206
        }
2177
2271
            var host = this.get(HOST),
2178
2272
                n = host.get(NODE),
2179
2273
                c = n.cloneNode(true);
2180
 
            c.set('id', '');
 
2274
 
 
2275
            delete c._yuid;
 
2276
            c.setAttribute('id', Y.guid());
2181
2277
            c.setStyle('position', 'absolute');
2182
 
            delete c._yuid;
2183
 
            Y.stamp(c);
2184
2278
            n.get('parentNode').appendChild(c);
2185
2279
            host.set(DRAG_NODE, c);
2186
2280
            return c;
2215
2309
                    left: '-999px'
2216
2310
                });
2217
2311
 
2218
 
                b.insertBefore(p, b.get('firstChild'));
2219
 
                p.set('id', Y.stamp(p));
 
2312
                b.prepend(p);
 
2313
                p.set('id', Y.guid());
2220
2314
                p.addClass(DDM.CSS_PREFIX + '-proxy');
2221
2315
                DDM._proxy = p;
2222
2316
            }
2231
2325
        */
2232
2326
        _setFrame: function(drag) {
2233
2327
            var n = drag.get(NODE), d = drag.get(DRAG_NODE), ah, cur = 'auto';
2234
 
            if (drag.proxy.get('resizeFrame')) {
2235
 
                DDM._proxy.setStyles({
2236
 
                    height: n.get('offsetHeight') + 'px',
2237
 
                    width: n.get('offsetWidth') + 'px'
2238
 
                });
2239
 
            }
2240
2328
            
2241
2329
            ah = DDM.activeDrag.get('activeHandle');
2242
2330
            if (ah) {
2257
2345
                d = drag.proxy.clone();
2258
2346
            }
2259
2347
 
 
2348
            if (drag.proxy.get('resizeFrame')) {
 
2349
                d.setStyles({
 
2350
                    height: n.get('offsetHeight') + 'px',
 
2351
                    width: n.get('offsetWidth') + 'px'
 
2352
                });
 
2353
            }
 
2354
 
2260
2355
            if (drag.proxy.get('positionProxy')) {
2261
2356
                d.setXY(drag.nodeXY);
2262
2357
            }
2269
2364
 
2270
2365
 
2271
2366
 
2272
 
}, '3.1.2' ,{requires:['dd-ddm', 'dd-drag'], skinnable:false});
 
2367
}, '3.2.0' ,{skinnable:false, requires:['dd-ddm', 'dd-drag']});
2273
2368
YUI.add('dd-constrain', function(Y) {
2274
2369
 
2275
2370
 
2490
2585
            if (con) {
2491
2586
                if (con instanceof Y.Node) {
2492
2587
                    if (!this._regionCache) {
2493
 
                        Y.on('resize', Y.bind(this._cacheRegion, this), window);
 
2588
                        Y.on('resize', Y.bind(this._cacheRegion, this), Y.config.win);
2494
2589
                        this._cacheRegion();
2495
2590
                    }
2496
2591
                    region = Y.clone(this._regionCache);
2498
2593
                        this.resetCache();
2499
2594
                    }
2500
2595
                } else if (Y.Lang.isObject(con)) {
2501
 
                    region = con;
 
2596
                    region = Y.clone(con);
2502
2597
                }
2503
2598
            }
2504
2599
            if (!con || !region) {
2590
2685
        */
2591
2686
        align: function() {
2592
2687
            var host = this.get(HOST),
2593
 
                _xy = host.actXY,
 
2688
                _xy = [host.actXY[0], host.actXY[1]],
2594
2689
                r = this.getRegion(true);
2595
2690
 
2596
2691
            if (this.get('stickX')) {
2723
2818
 
2724
2819
 
2725
2820
 
2726
 
}, '3.1.2' ,{requires:['dd-drag'], skinnable:false});
 
2821
}, '3.2.0' ,{skinnable:false, requires:['dd-drag']});
2727
2822
YUI.add('dd-scroll', function(Y) {
2728
2823
 
2729
2824
 
2888
2983
            h.on('drag:align', Y.bind(this.align, this));
2889
2984
 
2890
2985
            //TODO - This doesn't work yet??
2891
 
            Y.one(window).on('scroll', Y.bind(function() {
 
2986
            Y.one('win').on('scroll', Y.bind(function() {
2892
2987
                this._vpRegionCache = null;
2893
2988
            }, this));
2894
2989
        },
3070
3165
            value: true,
3071
3166
            setter: function(scroll) {
3072
3167
                if (scroll) {
3073
 
                    this.set(PARENT_SCROLL, Y.one(window));
 
3168
                    this.set(PARENT_SCROLL, Y.one('win'));
3074
3169
                }
3075
3170
                return scroll;
3076
3171
            }
3150
3245
 
3151
3246
 
3152
3247
 
3153
 
}, '3.1.2' ,{requires:['dd-drag'], optional:['dd-proxy'], skinnable:false});
3154
 
YUI.add('dd-plugin', function(Y) {
3155
 
 
3156
 
 
3157
 
       /**
3158
 
        * Simple Drag plugin that can be attached to a Node via the plug method.
3159
 
        * @module dd
3160
 
        * @submodule dd-plugin
3161
 
        */
3162
 
       /**
3163
 
        * Simple Drag plugin that can be attached to a Node via the plug method.
3164
 
        * @class Drag
3165
 
        * @extends DD.Drag
3166
 
        * @constructor
3167
 
        * @namespace Plugin
3168
 
        */
3169
 
 
3170
 
 
3171
 
        var Drag = function(config) {
3172
 
            config.node = ((Y.Widget && config.host instanceof Y.Widget) ? config.host.get('boundingBox') : config.host);
3173
 
            Drag.superclass.constructor.call(this, config);
3174
 
        };
3175
 
        
3176
 
        /**
3177
 
        * @property NAME
3178
 
        * @description dd-plugin
3179
 
        * @type {String}
3180
 
        */
3181
 
        Drag.NAME = "dd-plugin";
3182
 
 
3183
 
        /**
3184
 
        * @property NS
3185
 
        * @description The Drag instance will be placed on the Node instance under the dd namespace. It can be accessed via Node.dd;
3186
 
        * @type {String}
3187
 
        */
3188
 
        Drag.NS = "dd";
3189
 
 
3190
 
 
3191
 
        Y.extend(Drag, Y.DD.Drag);
3192
 
        Y.namespace('Plugin');
3193
 
        Y.Plugin.Drag = Drag;
3194
 
 
3195
 
 
3196
 
 
3197
 
 
3198
 
 
3199
 
}, '3.1.2' ,{requires:['dd-drag'], optional:['dd-constrain', 'dd-proxy'], skinnable:false});
 
3248
}, '3.2.0' ,{requires:['dd-drag'], skinnable:false, optional:['dd-proxy']});
3200
3249
YUI.add('dd-drop', function(Y) {
3201
3250
 
3202
3251
 
3220
3269
        /**
3221
3270
        * @event drop:over
3222
3271
        * @description Fires when a drag element is over this target.
 
3272
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
3273
        * <dl>
 
3274
        * <dt>drop</dt><dd>The drop object at the time of the event.</dd>
 
3275
        * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
 
3276
        * </dl>        
3223
3277
        * @bubbles DDM
3224
3278
        * @type {Event.Custom}
3225
3279
        */
3227
3281
        /**
3228
3282
        * @event drop:enter
3229
3283
        * @description Fires when a drag element enters this target.
 
3284
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
3285
        * <dl>
 
3286
        * <dt>drop</dt><dd>The drop object at the time of the event.</dd>
 
3287
        * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
 
3288
        * </dl>        
3230
3289
        * @bubbles DDM
3231
3290
        * @type {Event.Custom}
3232
3291
        */
3234
3293
        /**
3235
3294
        * @event drop:exit
3236
3295
        * @description Fires when a drag element exits this target.
 
3296
        * @param {Event.Facade} event An Event Facade object
3237
3297
        * @bubbles DDM
3238
3298
        * @type {Event.Custom}
3239
3299
        */
3242
3302
        /**
3243
3303
        * @event drop:hit
3244
3304
        * @description Fires when a draggable node is dropped on this Drop Target. (Fired from dd-ddm-drop)
 
3305
        * @param {Event.Facade} event An Event Facade object with the following specific property added:
 
3306
        * <dl>
 
3307
        * <dt>drop</dt><dd>The best guess on what was dropped on.</dd>
 
3308
        * <dt>drag</dt><dd>The drag object at the time of the event.</dd>
 
3309
        * <dt>others</dt><dd>An array of all the other drop targets that was dropped on.</dd>
 
3310
        * </dl>        
3245
3311
        * @bubbles DDM
3246
3312
        * @type {Event.Custom}
3247
3313
        */
3481
3547
        */
3482
3548
        destructor: function() {
3483
3549
            DDM._unregTarget(this);
3484
 
            if (this.shim) {
 
3550
            if (this.shim && (this.shim !== this.get(NODE))) {
3485
3551
                this.shim.detachAll();
3486
 
                this.shim.get('parentNode').removeChild(this.shim);
 
3552
                this.shim.remove();
3487
3553
                this.shim = null;
3488
3554
            }
3489
3555
            this.get(NODE).removeClass(DDM.CSS_PREFIX + '-drop');
3534
3600
                node.addClass(DDM.CSS_PREFIX + '-drop-active-valid');
3535
3601
                DDM._addValid(this);
3536
3602
                this.overTarget = false;
3537
 
                if (this.get('useShim')) {
3538
 
                    this.sizeShim();
 
3603
                if (!this.get('useShim')) {
 
3604
                    this.shim = this.get(NODE);
3539
3605
                }
 
3606
                this.sizeShim();
3540
3607
            } else {
3541
3608
                DDM._removeValid(this);
3542
3609
                node.removeClass(DDM.CSS_PREFIX + '-drop-active-valid');
3554
3621
            if (this.get(NODE) === DDM.activeDrag.get(NODE)) {
3555
3622
                return false;
3556
3623
            }
3557
 
            if (this.get('lock') || !this.get('useShim')) {
 
3624
            //if (this.get('lock') || !this.get('useShim')) {
 
3625
            if (this.get('lock')) {
3558
3626
                return false;
3559
3627
            }
3560
3628
            if (!this.shim) {
3589
3657
 
3590
3658
            }
3591
3659
            
3592
 
            //Set the style on the shim
3593
 
            this.shim.setStyles({
3594
 
                height: nh + 'px',
3595
 
                width: nw + 'px',
3596
 
                top: xy[1] + 'px',
3597
 
                left: xy[0] + 'px'
3598
 
            });
3599
 
            
 
3660
            if (this.get('useShim')) {
 
3661
                //Set the style on the shim
 
3662
                this.shim.setStyles({
 
3663
                    height: nh + 'px',
 
3664
                    width: nw + 'px',
 
3665
                    top: xy[1] + 'px',
 
3666
                    left: xy[0] + 'px'
 
3667
                });
 
3668
            }
 
3669
 
3600
3670
            //Create the region to be used by intersect when a drag node is over us.
3601
3671
            this.region = {
3602
3672
                '0': xy[0], 
3724
3794
 
3725
3795
 
3726
3796
 
3727
 
}, '3.1.2' ,{requires:['dd-ddm-drop', 'dd-drag'], skinnable:false});
3728
 
YUI.add('dd-drop-plugin', function(Y) {
3729
 
 
3730
 
 
3731
 
       /**
3732
 
        * Simple Drop plugin that can be attached to a Node via the plug method.
3733
 
        * @module dd
3734
 
        * @submodule dd-drop-plugin
3735
 
        */
3736
 
       /**
3737
 
        * Simple Drop plugin that can be attached to a Node via the plug method.
3738
 
        * @class Drop
3739
 
        * @extends DD.Drop
3740
 
        * @constructor
3741
 
        * @namespace Plugin
3742
 
        */
3743
 
 
3744
 
 
3745
 
        var Drop = function(config) {
3746
 
            config.node = config.host;
3747
 
            Drop.superclass.constructor.apply(this, arguments);
3748
 
        };
3749
 
        
3750
 
        /**
3751
 
        * @property NAME
3752
 
        * @description dd-drop-plugin
3753
 
        * @type {String}
3754
 
        */
3755
 
        Drop.NAME = "dd-drop-plugin";
3756
 
        /**
3757
 
        * @property NS
3758
 
        * @description The Drop instance will be placed on the Node instance under the drop namespace. It can be accessed via Node.drop;
3759
 
        * @type {String}
3760
 
        */
3761
 
        Drop.NS = "drop";
3762
 
 
3763
 
 
3764
 
        Y.extend(Drop, Y.DD.Drop);
3765
 
        Y.namespace('Plugin');
3766
 
        Y.Plugin.Drop = Drop;
3767
 
 
3768
 
 
3769
 
 
3770
 
 
3771
 
 
3772
 
}, '3.1.2' ,{requires:['dd-drop'], skinnable:false});
 
3797
}, '3.2.0' ,{skinnable:false, requires:['dd-ddm-drop', 'dd-drag']});
3773
3798
YUI.add('dd-delegate', function(Y) {
3774
3799
 
3775
3800
 
3815
3840
        _shimState: null,
3816
3841
        /**
3817
3842
        * @private
 
3843
        * @property _handles
 
3844
        * @description Array of event handles to be destroyed
 
3845
        */
 
3846
        _handles: null,
 
3847
        /**
 
3848
        * @private
3818
3849
        * @method _onNodeChange
3819
3850
        * @description Listens to the nodeChange event and sets the dragNode on the temp dd instance.
3820
3851
        * @param {Event} e The Event.
3830
3861
        */
3831
3862
        _afterDragEnd: function(e) {
3832
3863
            Y.DD.DDM._noShim = this._shimState;
 
3864
 
3833
3865
            this.set('lastNode', this.dd.get('node'));
3834
3866
            this.get('lastNode').removeClass(Y.DD.DDM.CSS_PREFIX + '-dragging');
3835
3867
            this.dd._unprep();
3844
3876
        _delMouseDown: function(e) {
3845
3877
            var tar = e.currentTarget,
3846
3878
                dd = this.dd;
 
3879
            
3847
3880
            if (tar.test(this.get(NODES)) && !tar.test(this.get('invalid'))) {
3848
3881
                this._shimState = Y.DD.DDM._noShim;
3849
3882
                Y.DD.DDM._noShim = true;
3855
3888
                    dd.set('dragNode', tar);
3856
3889
                }
3857
3890
                dd._prep();
 
3891
                
3858
3892
                dd.fire('drag:mouseDown', { ev: e });
3859
3893
            }
3860
3894
        },
3877
3911
        _onMouseLeave: function(e) {
3878
3912
            Y.DD.DDM._noShim = this._shimState;
3879
3913
        },
3880
 
        _handles: null,
3881
3914
        initializer: function(cfg) {
3882
3915
            this._handles = [];
3883
3916
            //Create a tmp DD instance under the hood.
3884
 
            var conf = this.get('dragConfig') || {},
 
3917
            var conf = Y.clone(this.get('dragConfig') || {}),
3885
3918
                cont = this.get(CONT);
3886
3919
 
3887
3920
            conf.node = _tmpNode.cloneNode(true);
3898
3931
            this.dd.on('dragNodeChange', Y.bind(this._onNodeChange, this));
3899
3932
 
3900
3933
            //Attach the delegate to the container
3901
 
            this._handles.push(Y.delegate('mousedown', Y.bind(this._delMouseDown, this), cont, this.get(NODES)));
 
3934
            this._handles.push(Y.delegate(Y.DD.Drag.START_EVENT, Y.bind(this._delMouseDown, this), cont, this.get(NODES)));
3902
3935
 
3903
3936
            this._handles.push(Y.on('mouseenter', Y.bind(this._onMouseEnter, this), cont));
3904
3937
 
3990
4023
            * @type String
3991
4024
            */        
3992
4025
            invalid: {
3993
 
                value: ''
 
4026
                value: 'input, select, button, a, textarea'
3994
4027
            },
3995
4028
            /**
3996
4029
            * @attribute lastNode
4091
4124
 
4092
4125
 
4093
4126
 
4094
 
}, '3.1.2' ,{requires:['dd-drag', 'event-mouseenter'], optional:['dd-drop-plugin'], skinnable:false});
4095
 
 
4096
 
 
4097
 
YUI.add('dd', function(Y){}, '3.1.2' ,{skinnable:false, use:['dd-ddm-base', 'dd-ddm', 'dd-ddm-drop', 'dd-drag', 'dd-proxy', 'dd-constrain', 'dd-plugin', 'dd-drop', 'dd-drop-plugin', 'dd-scroll', 'dd-delegate']});
 
4127
}, '3.2.0' ,{requires:['dd-drag', 'event-mouseenter'], skinnable:false, optional:['dd-drop-plugin']});
 
4128
 
 
4129
 
 
4130
YUI.add('dd', function(Y){}, '3.2.0' ,{use:['dd-ddm-base', 'dd-ddm', 'dd-ddm-drop', 'dd-drag', 'dd-proxy', 'dd-constrain', 'dd-drop', 'dd-scroll', 'dd-delegate'], skinnable:false});
4098
4131