| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Slide mode displays a single image and has a set of controls to navigate | 8 * Slide mode displays a single image and has a set of controls to navigate |
| 9 * between the images and to edit an image. | 9 * between the images and to edit an image. |
| 10 * | 10 * |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 var bubbleClose = util.createChild(this.bubble_, 'close-x'); | 130 var bubbleClose = util.createChild(this.bubble_, 'close-x'); |
| 131 bubbleClose.addEventListener('click', this.onCloseBubble_.bind(this)); | 131 bubbleClose.addEventListener('click', this.onCloseBubble_.bind(this)); |
| 132 | 132 |
| 133 // Video player controls. | 133 // Video player controls. |
| 134 this.mediaSpacer_ = | 134 this.mediaSpacer_ = |
| 135 util.createChild(this.container_, 'video-controls-spacer'); | 135 util.createChild(this.container_, 'video-controls-spacer'); |
| 136 this.mediaToolbar_ = util.createChild(this.mediaSpacer_, 'tool'); | 136 this.mediaToolbar_ = util.createChild(this.mediaSpacer_, 'tool'); |
| 137 this.mediaControls_ = new VideoControls( | 137 this.mediaControls_ = new VideoControls( |
| 138 this.mediaToolbar_, | 138 this.mediaToolbar_, |
| 139 this.showErrorBanner_.bind(this, 'VIDEO_ERROR'), | 139 this.showErrorBanner_.bind(this, 'VIDEO_ERROR'), |
| 140 this.displayStringFunction_.bind(this), |
| 140 this.toggleFullScreen_.bind(this), | 141 this.toggleFullScreen_.bind(this), |
| 141 this.container_); | 142 this.container_); |
| 142 | 143 |
| 143 // Ribbon and related controls. | 144 // Ribbon and related controls. |
| 144 this.arrowBox_ = util.createChild(this.container_, 'arrow-box'); | 145 this.arrowBox_ = util.createChild(this.container_, 'arrow-box'); |
| 145 | 146 |
| 146 this.arrowLeft_ = | 147 this.arrowLeft_ = |
| 147 util.createChild(this.arrowBox_, 'arrow left tool dimmable'); | 148 util.createChild(this.arrowBox_, 'arrow left tool dimmable'); |
| 148 this.arrowLeft_.addEventListener('click', | 149 this.arrowLeft_.addEventListener('click', |
| 149 this.advanceManually.bind(this, -1)); | 150 this.advanceManually.bind(this, -1)); |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 * @return {string} Message to show if there are unsaved changes. | 755 * @return {string} Message to show if there are unsaved changes. |
| 755 */ | 756 */ |
| 756 SlideMode.prototype.onBeforeUnload = function() { | 757 SlideMode.prototype.onBeforeUnload = function() { |
| 757 if (this.editor_.isBusy()) | 758 if (this.editor_.isBusy()) |
| 758 return this.displayStringFunction_('unsaved_changes'); | 759 return this.displayStringFunction_('unsaved_changes'); |
| 759 return null; | 760 return null; |
| 760 }; | 761 }; |
| 761 | 762 |
| 762 /** | 763 /** |
| 763 * Click handler for the image container. | 764 * Click handler for the image container. |
| 765 * |
| 766 * @param {Event} event Mouse click event. |
| 764 * @private | 767 * @private |
| 765 */ | 768 */ |
| 766 SlideMode.prototype.onClick_ = function() { | 769 SlideMode.prototype.onClick_ = function(event) { |
| 767 if (this.isShowingVideo_()) | 770 if (!this.isShowingVideo_()) |
| 771 return; |
| 772 if (event.ctrlKey) { |
| 773 this.mediaControls_.toggleLoopedModeWithFeedback(true); |
| 774 if (!this.mediaControls_.isPlaying()) |
| 775 this.mediaControls_.togglePlayStateWithFeedback(); |
| 776 } else { |
| 768 this.mediaControls_.togglePlayStateWithFeedback(); | 777 this.mediaControls_.togglePlayStateWithFeedback(); |
| 778 } |
| 769 }; | 779 }; |
| 770 | 780 |
| 771 /** | 781 /** |
| 772 * Click handler for the entire document. | 782 * Click handler for the entire document. |
| 773 * @param {Event} e Mouse click event. | 783 * @param {Event} e Mouse click event. |
| 774 * @private | 784 * @private |
| 775 */ | 785 */ |
| 776 SlideMode.prototype.onDocumentClick_ = function(e) { | 786 SlideMode.prototype.onDocumentClick_ = function(e) { |
| 777 // Close the bubble if clicked outside of it and if it is visible. | 787 // Close the bubble if clicked outside of it and if it is visible. |
| 778 if (!this.bubble_.contains(e.target) && | 788 if (!this.bubble_.contains(e.target) && |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 done = true; | 1286 done = true; |
| 1277 } | 1287 } |
| 1278 }.bind(this); | 1288 }.bind(this); |
| 1279 }; | 1289 }; |
| 1280 | 1290 |
| 1281 /** | 1291 /** |
| 1282 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD | 1292 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD |
| 1283 * horizontally it's considered as a swipe gesture (change the current image). | 1293 * horizontally it's considered as a swipe gesture (change the current image). |
| 1284 */ | 1294 */ |
| 1285 SwipeOverlay.SWIPE_THRESHOLD = 100; | 1295 SwipeOverlay.SWIPE_THRESHOLD = 100; |
| OLD | NEW |