OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Touch Handler. Class that handles all touch events and | 6 * @fileoverview Touch Handler. Class that handles all touch events and |
7 * uses them to interpret higher level gestures and behaviors. TouchEvent is a | 7 * uses them to interpret higher level gestures and behaviors. TouchEvent is a |
8 * built in mobile safari type: | 8 * built in mobile safari type: |
9 * http://developer.apple.com/safari/library/documentation/UserExperience/Refere
nce/TouchEventClassReference/TouchEvent/TouchEvent.html. | 9 * http://developer.apple.com/safari/library/documentation/UserExperience/Refere
nce/TouchEventClassReference/TouchEvent/TouchEvent.html. |
10 * This class is intended to work with all webkit browsers, tested on Chrome and | 10 * This class is intended to work with all webkit browsers, tested on Chrome and |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 e.targetTouches[0] = touch; | 407 e.targetTouches[0] = touch; |
408 } | 408 } |
409 callback(e); | 409 callback(e); |
410 }; | 410 }; |
411 }, | 411 }, |
412 | 412 |
413 /** | 413 /** |
414 * Begin tracking the touchable element, it is eligible for dragging. | 414 * Begin tracking the touchable element, it is eligible for dragging. |
415 * @private | 415 * @private |
416 */ | 416 */ |
417 beginTracking_: function() { this.tracking_ = true; }, | 417 beginTracking_: function() { |
| 418 this.tracking_ = true; |
| 419 }, |
418 | 420 |
419 /** | 421 /** |
420 * Stop tracking the touchable element, it is no longer dragging. | 422 * Stop tracking the touchable element, it is no longer dragging. |
421 * @private | 423 * @private |
422 */ | 424 */ |
423 endTracking_: function() { | 425 endTracking_: function() { |
424 this.tracking_ = false; | 426 this.tracking_ = false; |
425 this.dragging_ = false; | 427 this.dragging_ = false; |
426 this.totalMoveY_ = 0; | 428 this.totalMoveY_ = 0; |
427 this.totalMoveX_ = 0; | 429 this.totalMoveX_ = 0; |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 event.dragDeltaY = clientY - this.startTouchY_; | 871 event.dragDeltaY = clientY - this.startTouchY_; |
870 } | 872 } |
871 | 873 |
872 this.element_.dispatchEvent(event); | 874 this.element_.dispatchEvent(event); |
873 return event.enableDrag; | 875 return event.enableDrag; |
874 } | 876 } |
875 }; | 877 }; |
876 | 878 |
877 return {TouchHandler: TouchHandler}; | 879 return {TouchHandler: TouchHandler}; |
878 }); | 880 }); |
OLD | NEW |