| 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. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 var self = this; | 219 var self = this; |
| 220 this.imageView_.load( | 220 this.imageView_.load( |
| 221 item, effect, displayCallback, function(loadType, delay, error) { | 221 item, effect, displayCallback, function(loadType, delay, error) { |
| 222 self.lockUI(false); | 222 self.lockUI(false); |
| 223 | 223 |
| 224 // Always handle an item as original for new session. | 224 // Always handle an item as original for new session. |
| 225 item.setAsOriginal(); | 225 item.setAsOriginal(); |
| 226 | 226 |
| 227 self.commandQueue_ = new CommandQueue( | 227 self.commandQueue_ = new CommandQueue( |
| 228 self.container_.ownerDocument, assert(self.imageView_.getCanvas()), | 228 self.container_.ownerDocument, assert(self.imageView_.getImage()), |
| 229 saveFunction); | 229 saveFunction); |
| 230 self.commandQueue_.attachUI( | 230 self.commandQueue_.attachUI( |
| 231 self.getImageView(), self.getPrompt(), self.filesToast_, | 231 self.getImageView(), self.getPrompt(), self.filesToast_, |
| 232 self.updateUndoRedo.bind(self), self.lockUI.bind(self)); | 232 self.updateUndoRedo.bind(self), self.lockUI.bind(self)); |
| 233 self.updateUndoRedo(); | 233 self.updateUndoRedo(); |
| 234 loadCallback(loadType, delay, error); | 234 loadCallback(loadType, delay, error); |
| 235 }); | 235 }); |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 /** | 238 /** |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 * Update Undo/Redo buttons state. | 320 * Update Undo/Redo buttons state. |
| 321 */ | 321 */ |
| 322 ImageEditor.prototype.updateUndoRedo = function() { | 322 ImageEditor.prototype.updateUndoRedo = function() { |
| 323 var canUndo = this.commandQueue_ && this.commandQueue_.canUndo(); | 323 var canUndo = this.commandQueue_ && this.commandQueue_.canUndo(); |
| 324 var canRedo = this.commandQueue_ && this.commandQueue_.canRedo(); | 324 var canRedo = this.commandQueue_ && this.commandQueue_.canRedo(); |
| 325 ImageUtil.setAttribute(this.undoButton_, 'disabled', !canUndo); | 325 ImageUtil.setAttribute(this.undoButton_, 'disabled', !canUndo); |
| 326 ImageUtil.setAttribute(this.redoButton_, 'disabled', !canRedo); | 326 ImageUtil.setAttribute(this.redoButton_, 'disabled', !canRedo); |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 /** | 329 /** |
| 330 * @return {HTMLCanvasElement} The current image canvas. | 330 * @return {HTMLCanvasElement|HTMLImageElement} The current image. |
| 331 */ | 331 */ |
| 332 ImageEditor.prototype.getCanvas = function() { | 332 ImageEditor.prototype.getImage = function() { |
| 333 return this.getImageView().getCanvas(); | 333 return this.getImageView().getImage(); |
| 334 }; | 334 }; |
| 335 | 335 |
| 336 /** | 336 /** |
| 337 * @return {!ImageBuffer} ImageBuffer instance. | 337 * @return {!ImageBuffer} ImageBuffer instance. |
| 338 */ | 338 */ |
| 339 ImageEditor.prototype.getBuffer = function() { return this.buffer_; }; | 339 ImageEditor.prototype.getBuffer = function() { return this.buffer_; }; |
| 340 | 340 |
| 341 /** | 341 /** |
| 342 * @return {!ImageView} ImageView instance. | 342 * @return {!ImageView} ImageView instance. |
| 343 */ | 343 */ |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 | 1519 |
| 1520 /** | 1520 /** |
| 1521 * Hide the prompt. | 1521 * Hide the prompt. |
| 1522 */ | 1522 */ |
| 1523 ImageEditor.Prompt.prototype.hide = function() { | 1523 ImageEditor.Prompt.prototype.hide = function() { |
| 1524 if (!this.prompt_) return; | 1524 if (!this.prompt_) return; |
| 1525 this.prompt_.setAttribute('state', 'fadeout'); | 1525 this.prompt_.setAttribute('state', 'fadeout'); |
| 1526 // Allow some time for the animation to play out. | 1526 // Allow some time for the animation to play out. |
| 1527 this.setTimer(this.reset.bind(this), 500); | 1527 this.setTimer(this.reset.bind(this), 500); |
| 1528 }; | 1528 }; |
| OLD | NEW |