src/cm/media/js/lib/yui/yui3-3.15.0/build/dd-gestures/dd-gestures-debug.js
changeset 602 e16a97fb364a
equal deleted inserted replaced
601:d334a616c023 602:e16a97fb364a
       
     1 YUI.add('dd-gestures', function (Y, NAME) {
       
     2 
       
     3 
       
     4     /**
       
     5     * This module is the conditional loaded `dd` module to support gesture events
       
     6     * in the event that `dd` is loaded onto a device that support touch based events.
       
     7     *
       
     8     * This module is loaded and over rides 2 key methods on `DD.Drag` and `DD.DDM` to
       
     9     * attach the gesture events. Overrides `DD.Drag._prep` and `DD.DDM._setupListeners`
       
    10     * methods as well as set's the property `DD.Drag.START_EVENT` to `gesturemovestart`
       
    11     * to enable gesture movement instead of mouse based movement.
       
    12     * @module dd
       
    13     * @submodule dd-gestures
       
    14     */
       
    15     Y.log('Drag gesture support loaded', 'info', 'drag-gestures');
       
    16 
       
    17     Y.DD.Drag.START_EVENT = 'gesturemovestart';
       
    18 
       
    19     Y.DD.Drag.prototype._prep = function() {
       
    20         Y.log('Using DD override prep to attach gesture events', 'info', 'drag-gestures');
       
    21         this._dragThreshMet = false;
       
    22         var node = this.get('node'), DDM = Y.DD.DDM;
       
    23 
       
    24         node.addClass(DDM.CSS_PREFIX + '-draggable');
       
    25 
       
    26         node.on(Y.DD.Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this), {
       
    27             minDistance: this.get('clickPixelThresh'),
       
    28             minTime: this.get('clickTimeThresh')
       
    29         });
       
    30 
       
    31         node.on('gesturemoveend', Y.bind(this._handleMouseUp, this), { standAlone: true });
       
    32         node.on('dragstart', Y.bind(this._fixDragStart, this));
       
    33 
       
    34     };
       
    35 
       
    36     var _unprep = Y.DD.Drag.prototype._unprep;
       
    37 
       
    38     Y.DD.Drag.prototype._unprep = function() {
       
    39         var node = this.get('node');
       
    40         _unprep.call(this);
       
    41         node.detachAll('gesturemoveend');
       
    42     };
       
    43 
       
    44     Y.DD.DDM._setupListeners = function() {
       
    45         var DDM = Y.DD.DDM;
       
    46 
       
    47         this._createPG();
       
    48         this._active = true;
       
    49         Y.one(Y.config.doc).on('gesturemove', Y.throttle(Y.bind(DDM._move, DDM), DDM.get('throttleTime')), {
       
    50             standAlone: true,
       
    51             preventDefault: true
       
    52         });
       
    53     };
       
    54 
       
    55 
       
    56 
       
    57 }, '@VERSION@', {"requires": ["dd-drag", "event-synthetic", "event-gestures"]});