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 * Slide mode displays a single image and has a set of controls to navigate | 6 * Slide mode displays a single image and has a set of controls to navigate |
7 * between the images and to edit an image. | 7 * between the images and to edit an image. |
8 * | 8 * |
9 * TODO(kaznacheev): Introduce a parameter object. | 9 * TODO(kaznacheev): Introduce a parameter object. |
10 * | 10 * |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 */ | 61 */ |
62 SlideMode.editorModes = [ | 62 SlideMode.editorModes = [ |
63 new ImageEditor.Mode.InstantAutofix(), | 63 new ImageEditor.Mode.InstantAutofix(), |
64 new ImageEditor.Mode.Crop(), | 64 new ImageEditor.Mode.Crop(), |
65 new ImageEditor.Mode.Exposure(), | 65 new ImageEditor.Mode.Exposure(), |
66 new ImageEditor.Mode.OneClick('rotate_left', new Command.Rotate(-1)), | 66 new ImageEditor.Mode.OneClick('rotate_left', new Command.Rotate(-1)), |
67 new ImageEditor.Mode.OneClick('rotate_right', new Command.Rotate(1)) | 67 new ImageEditor.Mode.OneClick('rotate_right', new Command.Rotate(1)) |
68 ]; | 68 ]; |
69 | 69 |
70 /** | 70 /** |
71 * @return {string} Mode name | 71 * @return {string} Mode name. |
72 */ | 72 */ |
73 SlideMode.prototype.getName = function() { return 'slide' }; | 73 SlideMode.prototype.getName = function() { return 'slide' }; |
74 | 74 |
75 /** | 75 /** |
76 * Initialize the listeners. | 76 * Initialize the listeners. |
77 * @private | 77 * @private |
78 */ | 78 */ |
79 SlideMode.prototype.initListeners_ = function() { | 79 SlideMode.prototype.initListeners_ = function() { |
80 window.addEventListener('resize', this.onResize_.bind(this), false); | 80 window.addEventListener('resize', this.onResize_.bind(this), false); |
81 }; | 81 }; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 * @return {Rect} Screen rectangle of the selected image. | 361 * @return {Rect} Screen rectangle of the selected image. |
362 */ | 362 */ |
363 SlideMode.prototype.getSelectedImageRect = function() { | 363 SlideMode.prototype.getSelectedImageRect = function() { |
364 if (this.getSelectedIndex() < 0) | 364 if (this.getSelectedIndex() < 0) |
365 return null; | 365 return null; |
366 else | 366 else |
367 return this.viewport_.getScreenClipped(); | 367 return this.viewport_.getScreenClipped(); |
368 }; | 368 }; |
369 | 369 |
370 /** | 370 /** |
371 * @return {Gallery.Item} Selected item | 371 * @return {Gallery.Item} Selected item. |
372 */ | 372 */ |
373 SlideMode.prototype.getSelectedItem = function() { | 373 SlideMode.prototype.getSelectedItem = function() { |
374 return this.getItem(this.getSelectedIndex()); | 374 return this.getItem(this.getSelectedIndex()); |
375 }; | 375 }; |
376 | 376 |
377 /** | 377 /** |
378 * Selection change handler. | 378 * Selection change handler. |
379 * | 379 * |
380 * Commits the current image and displays the newly selected image. | 380 * Commits the current image and displays the newly selected image. |
381 * @private | 381 * @private |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 done = true; | 1263 done = true; |
1264 } | 1264 } |
1265 }.bind(this); | 1265 }.bind(this); |
1266 }; | 1266 }; |
1267 | 1267 |
1268 /** | 1268 /** |
1269 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD | 1269 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD |
1270 * horizontally it's considered as a swipe gesture (change the current image). | 1270 * horizontally it's considered as a swipe gesture (change the current image). |
1271 */ | 1271 */ |
1272 SwipeOverlay.SWIPE_THRESHOLD = 100; | 1272 SwipeOverlay.SWIPE_THRESHOLD = 100; |
OLD | NEW |