Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 (function() { | 4 (function() { |
| 5 'use strict'; | 5 'use strict'; |
| 6 /** | 6 /** |
| 7 * T-Rex runner. | 7 * T-Rex runner. |
| 8 * @param {string} outerContainerId Outer containing element id. | 8 * @param {string} outerContainerId Outer containing element id. |
| 9 * @param {Object} opt_config | 9 * @param {Object} opt_config |
| 10 * @constructor | 10 * @constructor |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 document.removeEventListener(Runner.events.MOUSEUP, this); | 643 document.removeEventListener(Runner.events.MOUSEUP, this); |
| 644 } | 644 } |
| 645 }, | 645 }, |
| 646 | 646 |
| 647 /** | 647 /** |
| 648 * Process keydown. | 648 * Process keydown. |
| 649 * @param {Event} e | 649 * @param {Event} e |
| 650 */ | 650 */ |
| 651 onKeyDown: function(e) { | 651 onKeyDown: function(e) { |
| 652 // Prevent native page scrolling whilst tapping on mobile. | 652 // Prevent native page scrolling whilst tapping on mobile. |
| 653 if (IS_MOBILE) { | 653 if (IS_MOBILE && this.activated) { |
|
mmenke
2016/06/28 13:39:21
If I'm following the code right, this means that y
| |
| 654 e.preventDefault(); | 654 e.preventDefault(); |
| 655 } | 655 } |
| 656 | 656 |
| 657 if (e.target != this.detailsButton) { | 657 if (e.target != this.detailsButton) { |
| 658 if (!this.crashed && (Runner.keycodes.JUMP[e.keyCode] || | 658 if (!this.crashed && (Runner.keycodes.JUMP[e.keyCode] || |
| 659 e.type == Runner.events.TOUCHSTART)) { | 659 e.type == Runner.events.TOUCHSTART)) { |
| 660 if (!this.activated) { | 660 if (!this.activated) { |
| 661 this.loadSounds(); | 661 this.loadSounds(); |
| 662 this.activated = true; | 662 this.activated = true; |
| 663 errorPageController.trackEasterEgg(); | 663 errorPageController.trackEasterEgg(); |
| (...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2680 | 2680 |
| 2681 /** | 2681 /** |
| 2682 * Add a new cloud to the horizon. | 2682 * Add a new cloud to the horizon. |
| 2683 */ | 2683 */ |
| 2684 addCloud: function() { | 2684 addCloud: function() { |
| 2685 this.clouds.push(new Cloud(this.canvas, this.spritePos.CLOUD, | 2685 this.clouds.push(new Cloud(this.canvas, this.spritePos.CLOUD, |
| 2686 this.dimensions.WIDTH)); | 2686 this.dimensions.WIDTH)); |
| 2687 } | 2687 } |
| 2688 }; | 2688 }; |
| 2689 })(); | 2689 })(); |
| OLD | NEW |