Chromium Code Reviews| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 }; | 316 }; |
| 317 | 317 |
| 318 /** | 318 /** |
| 319 * Update Undo/Redo buttons state. | 319 * Update Undo/Redo buttons state. |
| 320 */ | 320 */ |
| 321 ImageEditor.prototype.updateUndoRedo = function() { | 321 ImageEditor.prototype.updateUndoRedo = function() { |
| 322 var canUndo = this.commandQueue_ && this.commandQueue_.canUndo(); | 322 var canUndo = this.commandQueue_ && this.commandQueue_.canUndo(); |
| 323 var canRedo = this.commandQueue_ && this.commandQueue_.canRedo(); | 323 var canRedo = this.commandQueue_ && this.commandQueue_.canRedo(); |
| 324 ImageUtil.setAttribute(this.undoButton_, 'disabled', !canUndo); | 324 ImageUtil.setAttribute(this.undoButton_, 'disabled', !canUndo); |
| 325 ImageUtil.setAttribute(this.redoButton_, 'disabled', !canRedo); | 325 ImageUtil.setAttribute(this.redoButton_, 'disabled', !canRedo); |
| 326 this.calculateModeApplicativity_(); | |
| 326 }; | 327 }; |
| 327 | 328 |
| 328 /** | 329 /** |
| 329 * @return {HTMLCanvasElement|HTMLImageElement} The current image. | 330 * @return {HTMLCanvasElement|HTMLImageElement} The current image. |
| 330 */ | 331 */ |
| 331 ImageEditor.prototype.getImage = function() { | 332 ImageEditor.prototype.getImage = function() { |
| 332 return this.getImageView().getImage(); | 333 return this.getImageView().getImage(); |
| 333 }; | 334 }; |
| 334 | 335 |
| 335 /** | 336 /** |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 if (!this.currentMode_.instant) { | 629 if (!this.currentMode_.instant) { |
| 629 this.getViewport().setScreenTop( | 630 this.getViewport().setScreenTop( |
| 630 ImageEditor.Toolbar.HEIGHT + mode.paddingTop); | 631 ImageEditor.Toolbar.HEIGHT + mode.paddingTop); |
| 631 this.getViewport().setScreenBottom( | 632 this.getViewport().setScreenBottom( |
| 632 ImageEditor.Toolbar.HEIGHT * 2 + mode.paddingBottom); | 633 ImageEditor.Toolbar.HEIGHT * 2 + mode.paddingBottom); |
| 633 this.getImageView().applyViewportChange(); | 634 this.getImageView().applyViewportChange(); |
| 634 } | 635 } |
| 635 | 636 |
| 636 this.currentMode_.setUp(); | 637 this.currentMode_.setUp(); |
| 637 | 638 |
| 639 this.calculateModeApplicativity_(); | |
|
yawano
2016/03/07 11:16:18
setUpMode_ is called when user has clicked each mo
ryoh
2016/03/07 11:55:09
That's right!
I introduce new callback, ImageEdito
| |
| 638 if (this.currentMode_.instant) { // Instant tool. | 640 if (this.currentMode_.instant) { // Instant tool. |
| 639 this.leaveModeInternal_(true, false /* not to switch mode */); | 641 this.leaveModeInternal_(true, false /* not to switch mode */); |
| 640 return; | 642 return; |
| 641 } | 643 } |
| 642 | 644 |
| 643 this.exitButton_.hidden = true; | 645 this.exitButton_.hidden = true; |
| 644 | 646 |
| 645 this.modeToolbar_.clear(); | 647 this.modeToolbar_.clear(); |
| 646 this.currentMode_.createTools(this.modeToolbar_); | 648 this.currentMode_.createTools(this.modeToolbar_); |
| 647 this.modeToolbar_.show(true); | 649 this.modeToolbar_.show(true); |
| 648 this.calculateModeApplicativity_(); | |
| 649 }; | 650 }; |
| 650 | 651 |
| 651 /** | 652 /** |
| 652 * Handles click event of Done button. | 653 * Handles click event of Done button. |
| 653 * @param {!Event} event An event. | 654 * @param {!Event} event An event. |
| 654 * @private | 655 * @private |
| 655 */ | 656 */ |
| 656 ImageEditor.prototype.onDoneClicked_ = function(event) { | 657 ImageEditor.prototype.onDoneClicked_ = function(event) { |
| 657 this.leaveModeInternal_(true /* commit */, false /* not to switch mode */); | 658 this.leaveModeInternal_(true /* commit */, false /* not to switch mode */); |
| 658 }; | 659 }; |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1519 | 1520 |
| 1520 /** | 1521 /** |
| 1521 * Hide the prompt. | 1522 * Hide the prompt. |
| 1522 */ | 1523 */ |
| 1523 ImageEditor.Prompt.prototype.hide = function() { | 1524 ImageEditor.Prompt.prototype.hide = function() { |
| 1524 if (!this.prompt_) return; | 1525 if (!this.prompt_) return; |
| 1525 this.prompt_.setAttribute('state', 'fadeout'); | 1526 this.prompt_.setAttribute('state', 'fadeout'); |
| 1526 // Allow some time for the animation to play out. | 1527 // Allow some time for the animation to play out. |
| 1527 this.setTimer(this.reset.bind(this), 500); | 1528 this.setTimer(this.reset.bind(this), 500); |
| 1528 }; | 1529 }; |
| OLD | NEW |