| 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 * ImageEditor is the top level object that holds together and connects | 6 * ImageEditor is the top level object that holds together and connects |
| 7 * everything needed for image editing. | 7 * everything needed for image editing. |
| 8 * | 8 * |
| 9 * @param {!Viewport} viewport The viewport. | 9 * @param {!Viewport} viewport The viewport. |
| 10 * @param {!ImageView} imageView The ImageView containing the images to edit. | 10 * @param {!ImageView} imageView The ImageView containing the images to edit. |
| 11 * @param {!ImageEditor.Prompt} prompt Prompt instance. | 11 * @param {!ImageEditor.Prompt} prompt Prompt instance. |
| 12 * @param {!Object} DOMContainers Various DOM containers required for the | 12 * @param {!Object} DOMContainers Various DOM containers required for the |
| 13 * editor. | 13 * editor. |
| 14 * @param {!Array.<!ImageEditor.Mode>} modes Available editor modes. | 14 * @param {!Array.<!ImageEditor.Mode>} modes Available editor modes. |
| 15 * @param {function(string, ...[string])} displayStringFunction String | 15 * @param {function(string, ...string)} displayStringFunction String |
| 16 * formatting function. | 16 * formatting function. |
| 17 * @param {function()} onToolsVisibilityChanged Callback to be called, when | 17 * @param {function()} onToolsVisibilityChanged Callback to be called, when |
| 18 * some of the UI elements have been dimmed or revealed. | 18 * some of the UI elements have been dimmed or revealed. |
| 19 * @constructor | 19 * @constructor |
| 20 * @struct | 20 * @struct |
| 21 */ | 21 */ |
| 22 function ImageEditor( | 22 function ImageEditor( |
| 23 viewport, imageView, prompt, DOMContainers, modes, displayStringFunction, | 23 viewport, imageView, prompt, DOMContainers, modes, displayStringFunction, |
| 24 onToolsVisibilityChanged) { | 24 onToolsVisibilityChanged) { |
| 25 this.rootContainer_ = DOMContainers.root; | 25 this.rootContainer_ = DOMContainers.root; |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 ImageEditor.Toolbar.prototype.show = function(on) { | 1193 ImageEditor.Toolbar.prototype.show = function(on) { |
| 1194 if (!this.wrapper_.firstChild) | 1194 if (!this.wrapper_.firstChild) |
| 1195 return; // Do not show empty toolbar; | 1195 return; // Do not show empty toolbar; |
| 1196 | 1196 |
| 1197 this.wrapper_.hidden = !on; | 1197 this.wrapper_.hidden = !on; |
| 1198 }; | 1198 }; |
| 1199 | 1199 |
| 1200 /** A prompt panel for the editor. | 1200 /** A prompt panel for the editor. |
| 1201 * | 1201 * |
| 1202 * @param {!HTMLElement} container Container element. | 1202 * @param {!HTMLElement} container Container element. |
| 1203 * @param {function(string, ...[string])} displayStringFunction A formatting | 1203 * @param {function(string, ...string)} displayStringFunction A formatting |
| 1204 * function. | 1204 * function. |
| 1205 * @constructor | 1205 * @constructor |
| 1206 * @struct | 1206 * @struct |
| 1207 */ | 1207 */ |
| 1208 ImageEditor.Prompt = function(container, displayStringFunction) { | 1208 ImageEditor.Prompt = function(container, displayStringFunction) { |
| 1209 this.container_ = container; | 1209 this.container_ = container; |
| 1210 this.displayStringFunction_ = displayStringFunction; | 1210 this.displayStringFunction_ = displayStringFunction; |
| 1211 | 1211 |
| 1212 /** | 1212 /** |
| 1213 * @type {HTMLDivElement} | 1213 * @type {HTMLDivElement} |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 | 1337 |
| 1338 /** | 1338 /** |
| 1339 * Hide the prompt. | 1339 * Hide the prompt. |
| 1340 */ | 1340 */ |
| 1341 ImageEditor.Prompt.prototype.hide = function() { | 1341 ImageEditor.Prompt.prototype.hide = function() { |
| 1342 if (!this.prompt_) return; | 1342 if (!this.prompt_) return; |
| 1343 this.prompt_.setAttribute('state', 'fadeout'); | 1343 this.prompt_.setAttribute('state', 'fadeout'); |
| 1344 // Allow some time for the animation to play out. | 1344 // Allow some time for the animation to play out. |
| 1345 this.setTimer(this.reset.bind(this), 500); | 1345 this.setTimer(this.reset.bind(this), 500); |
| 1346 }; | 1346 }; |
| OLD | NEW |