| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 | 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 * @param {!HTMLElement} container Main container element. | 9 * @param {!HTMLElement} container Main container element. |
| 10 * @param {!HTMLElement} content Content container element. | 10 * @param {!HTMLElement} content Content container element. |
| 11 * @param {!HTMLElement} topToolbar Top toolbar element. | 11 * @param {!HTMLElement} topToolbar Top toolbar element. |
| 12 * @param {!HTMLElement} bottomToolbar Toolbar element. | 12 * @param {!HTMLElement} bottomToolbar Toolbar element. |
| 13 * @param {!ImageEditorPrompt} prompt Prompt. | 13 * @param {!ImageEditorPrompt} prompt Prompt. |
| 14 * @param {!ErrorBanner} errorBanner Error banner. | 14 * @param {!ErrorBanner} errorBanner Error banner. |
| 15 * @param {!cr.ui.ArrayDataModel} dataModel Data model. | 15 * @param {!GalleryDataModel} dataModel Data model. |
| 16 * @param {!cr.ui.ListSelectionModel} selectionModel Selection model. | 16 * @param {!cr.ui.ListSelectionModel} selectionModel Selection model. |
| 17 * @param {!MetadataModel} metadataModel | 17 * @param {!MetadataModel} metadataModel |
| 18 * @param {!ThumbnailModel} thumbnailModel | 18 * @param {!ThumbnailModel} thumbnailModel |
| 19 * @param {!Object} context Context. | 19 * @param {!{appWindow: chrome.app.window.AppWindow, readonlyDirName: string, |
| 20 displayStringFunction: function(), loadTimeData: Object}} context Context. |
| 20 * @param {!VolumeManagerWrapper} volumeManager Volume manager. | 21 * @param {!VolumeManagerWrapper} volumeManager Volume manager. |
| 21 * @param {function(function())} toggleMode Function to toggle the Gallery mode. | 22 * @param {function(function())} toggleMode Function to toggle the Gallery mode. |
| 22 * @param {function(string):string} displayStringFunction String formatting | 23 * @param {function(string):string} displayStringFunction String formatting |
| 23 * function. | 24 * function. |
| 24 * @param {!DimmableUIController} dimmableUIController Dimmable UI controller. | 25 * @param {!DimmableUIController} dimmableUIController Dimmable UI controller. |
| 25 * @constructor | 26 * @constructor |
| 26 * @struct | 27 * @struct |
| 27 * @extends {cr.EventTarget} | 28 * @extends {cr.EventTarget} |
| 28 */ | 29 */ |
| 29 function SlideMode(container, content, topToolbar, bottomToolbar, prompt, | 30 function SlideMode(container, content, topToolbar, bottomToolbar, prompt, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 this.prompt_ = prompt; | 73 this.prompt_ = prompt; |
| 73 | 74 |
| 74 /** | 75 /** |
| 75 * @type {!ErrorBanner} | 76 * @type {!ErrorBanner} |
| 76 * @private | 77 * @private |
| 77 * @const | 78 * @const |
| 78 */ | 79 */ |
| 79 this.errorBanner_ = errorBanner; | 80 this.errorBanner_ = errorBanner; |
| 80 | 81 |
| 81 /** | 82 /** |
| 82 * @type {!cr.ui.ArrayDataModel} | 83 * @type {!GalleryDataModel} |
| 83 * @private | 84 * @private |
| 84 * @const | 85 * @const |
| 85 */ | 86 */ |
| 86 this.dataModel_ = dataModel; | 87 this.dataModel_ = dataModel; |
| 87 | 88 |
| 88 /** | 89 /** |
| 89 * @type {!cr.ui.ListSelectionModel} | 90 * @type {!cr.ui.ListSelectionModel} |
| 90 * @private | 91 * @private |
| 91 * @const | 92 * @const |
| 92 */ | 93 */ |
| 93 this.selectionModel_ = selectionModel; | 94 this.selectionModel_ = selectionModel; |
| 94 | 95 |
| 95 /** | 96 /** |
| 96 * @type {!Object} | 97 * @type {{appWindow: chrome.app.window.AppWindow, readonlyDirName: string, |
| 98 * displayStringFunction: function(), loadTimeData: Object}} |
| 97 * @private | 99 * @private |
| 98 * @const | 100 * @const |
| 99 */ | 101 */ |
| 100 this.context_ = context; | 102 this.context_ = context; |
| 101 | 103 |
| 102 /** | 104 /** |
| 103 * @type {!VolumeManagerWrapper} | 105 * @type {!VolumeManagerWrapper} |
| 104 * @private | 106 * @private |
| 105 * @const | 107 * @const |
| 106 */ | 108 */ |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 /** | 469 /** |
| 468 * @type {!TouchHandler} | 470 * @type {!TouchHandler} |
| 469 * @private | 471 * @private |
| 470 * @const | 472 * @const |
| 471 */ | 473 */ |
| 472 this.touchHandlers_ = new TouchHandler(this.imageContainer_, this); | 474 this.touchHandlers_ = new TouchHandler(this.imageContainer_, this); |
| 473 } | 475 } |
| 474 | 476 |
| 475 /** | 477 /** |
| 476 * List of available editor modes. | 478 * List of available editor modes. |
| 477 * @type {!Array<ImageEditor.Mode>} | 479 * @type {!Array<ImageEditorMode>} |
| 478 * @const | 480 * @const |
| 479 */ | 481 */ |
| 480 SlideMode.EDITOR_MODES = [ | 482 SlideMode.EDITOR_MODES = [ |
| 481 new ImageEditor.Mode.InstantAutofix(), | 483 new ImageEditorMode.InstantAutofix(), new ImageEditorMode.Crop(), |
| 482 new ImageEditor.Mode.Crop(), | 484 new ImageEditorMode.Resize(), new ImageEditorMode.Exposure(), |
| 483 new ImageEditor.Mode.Resize(), | 485 new ImageEditorMode.OneClick( |
| 484 new ImageEditor.Mode.Exposure(), | |
| 485 new ImageEditor.Mode.OneClick( | |
| 486 'rotate_left', 'GALLERY_ROTATE_LEFT', new Command.Rotate(-1)), | 486 'rotate_left', 'GALLERY_ROTATE_LEFT', new Command.Rotate(-1)), |
| 487 new ImageEditor.Mode.OneClick( | 487 new ImageEditorMode.OneClick( |
| 488 'rotate_right', 'GALLERY_ROTATE_RIGHT', new Command.Rotate(1)) | 488 'rotate_right', 'GALLERY_ROTATE_RIGHT', new Command.Rotate(1)) |
| 489 ]; | 489 ]; |
| 490 | 490 |
| 491 /** | 491 /** |
| 492 * Map of the key identifier and offset delta. | 492 * Map of the key identifier and offset delta. |
| 493 * @enum {!Array<number>}) | 493 * @enum {!Array<number>}) |
| 494 * @const | 494 * @const |
| 495 */ | 495 */ |
| 496 SlideMode.KEY_OFFSET_MAP = { | 496 SlideMode.KEY_OFFSET_MAP = { |
| 497 'Up': [0, 20], | 497 'Up': [0, 20], |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 this.stopSlideshow_(); | 1617 this.stopSlideshow_(); |
| 1618 | 1618 |
| 1619 ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing()); | 1619 ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing()); |
| 1620 this.editButtonToggleRipple_.activated = this.isEditing(); | 1620 this.editButtonToggleRipple_.activated = this.isEditing(); |
| 1621 | 1621 |
| 1622 if (this.isEditing()) { // isEditing has just been flipped to a new value. | 1622 if (this.isEditing()) { // isEditing has just been flipped to a new value. |
| 1623 // Reset zoom. | 1623 // Reset zoom. |
| 1624 this.viewport_.resetView(); | 1624 this.viewport_.resetView(); |
| 1625 | 1625 |
| 1626 // Scale the screen so that it doesn't overlap the toolbars. | 1626 // Scale the screen so that it doesn't overlap the toolbars. |
| 1627 this.viewport_.setScreenTop(ImageEditor.Toolbar.HEIGHT); | 1627 this.viewport_.setScreenTop(ImageEditorToolbar.HEIGHT); |
| 1628 this.viewport_.setScreenBottom(ImageEditor.Toolbar.HEIGHT); | 1628 this.viewport_.setScreenBottom(ImageEditorToolbar.HEIGHT); |
| 1629 | 1629 |
| 1630 this.imageView_.applyViewportChange(); | 1630 this.imageView_.applyViewportChange(); |
| 1631 | 1631 |
| 1632 this.touchHandlers_.enabled = false; | 1632 this.touchHandlers_.enabled = false; |
| 1633 | 1633 |
| 1634 // Show editor warning message. | 1634 // Show editor warning message. |
| 1635 SlideMode.getEditorWarningMessage( | 1635 SlideMode.getEditorWarningMessage( |
| 1636 assert(this.getItem(this.getSelectedIndex())), | 1636 assert(this.getItem(this.getSelectedIndex())), |
| 1637 this.context_.readonlyDirName, | 1637 this.context_.readonlyDirName, |
| 1638 assert(this.dataModel_.fallbackSaveDirectory) | 1638 assert(this.dataModel_.fallbackSaveDirectory) |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 /** | 2144 /** |
| 2145 * Handles mouse up events. | 2145 * Handles mouse up events. |
| 2146 * @param {!Event} event Wheel event. | 2146 * @param {!Event} event Wheel event. |
| 2147 * @private | 2147 * @private |
| 2148 */ | 2148 */ |
| 2149 TouchHandler.prototype.onMouseUp_ = function(event) { | 2149 TouchHandler.prototype.onMouseUp_ = function(event) { |
| 2150 if (event.button !== 0) | 2150 if (event.button !== 0) |
| 2151 return; | 2151 return; |
| 2152 this.clickStarted_ = false; | 2152 this.clickStarted_ = false; |
| 2153 }; | 2153 }; |
| OLD | NEW |