3 Copyright 2012 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
7 YUI.add('dd-gestures', function (Y, NAME) {
11 * This module is the conditional loaded `dd` module to support gesture events
12 * in the event that `dd` is loaded onto a device that support touch based events.
14 * This module is loaded and over rides 2 key methods on `DD.Drag` and `DD.DDM` to
15 * attach the gesture events. Overrides `DD.Drag._prep` and `DD.DDM._setupListeners`
16 * methods as well as set's the property `DD.Drag.START_EVENT` to `gesturemovestart`
17 * to enable gesture movement instead of mouse based movement.
19 * @submodule dd-gestures
22 Y.DD.Drag.START_EVENT = 'gesturemovestart';
24 Y.DD.Drag.prototype._prep = function() {
25 this._dragThreshMet = false;
26 var node = this.get('node'), DDM = Y.DD.DDM;
28 node.addClass(DDM.CSS_PREFIX + '-draggable');
30 node.on(Y.DD.Drag.START_EVENT, Y.bind(this._handleMouseDownEvent, this), {
35 node.on('gesturemoveend', Y.bind(this._handleMouseUp, this), { standAlone: true });
36 node.on('dragstart', Y.bind(this._fixDragStart, this));
40 Y.DD.DDM._setupListeners = function() {
45 Y.one(Y.config.doc).on('gesturemove', Y.throttle(Y.bind(DDM._move, DDM), DDM.get('throttleTime')), { standAlone: true });
50 }, '3.7.2', {"requires": ["dd-drag", "event-synthetic", "event-gestures"]});