| 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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 onEnd_: function(e) { | 674 onEnd_: function(e) { |
| 675 var that = this; | 675 var that = this; |
| 676 assert(this.activeTouch_ !== undefined, 'Expect to already be touching'); | 676 assert(this.activeTouch_ !== undefined, 'Expect to already be touching'); |
| 677 | 677 |
| 678 // If the touch we're tracking isn't changing here, ignore this touch end. | 678 // If the touch we're tracking isn't changing here, ignore this touch end. |
| 679 var touch = this.findActiveTouch_(e.changedTouches); | 679 var touch = this.findActiveTouch_(e.changedTouches); |
| 680 if (!touch) { | 680 if (!touch) { |
| 681 // In most cases, our active touch will be in the 'touches' collection, | 681 // In most cases, our active touch will be in the 'touches' collection, |
| 682 // but we can't assert that because occasionally two touchend events can | 682 // but we can't assert that because occasionally two touchend events can |
| 683 // occur at almost the same time with both having empty 'touches' lists. | 683 // occur at almost the same time with both having empty 'touches' lists. |
| 684 // I.e., 'touches' seems like it can be a bit more up-to-date than the | 684 // I.e., 'touches' seems like it can be a bit more up to date than the |
| 685 // current event. | 685 // current event. |
| 686 return; | 686 return; |
| 687 } | 687 } |
| 688 | 688 |
| 689 // This is touchEnd for the touch we're monitoring | 689 // This is touchEnd for the touch we're monitoring |
| 690 assert(!this.findActiveTouch_(e.touches), | 690 assert(!this.findActiveTouch_(e.touches), |
| 691 'Touch ended also still active'); | 691 'Touch ended also still active'); |
| 692 | 692 |
| 693 // Indicate that touching has finished | 693 // Indicate that touching has finished |
| 694 this.stopTouching_(); | 694 this.stopTouching_(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 | 872 |
| 873 this.element_.dispatchEvent(event); | 873 this.element_.dispatchEvent(event); |
| 874 return event.enableDrag; | 874 return event.enableDrag; |
| 875 } | 875 } |
| 876 }; | 876 }; |
| 877 | 877 |
| 878 return { | 878 return { |
| 879 TouchHandler: TouchHandler | 879 TouchHandler: TouchHandler |
| 880 }; | 880 }; |
| 881 }); | 881 }); |
| OLD | NEW |