From 5e534ef0d453c7aa40a2d4f973521bedd57d4c02 Mon Sep 17 00:00:00 2001 From: ryoh Date: Mon, 7 Mar 2016 18:26:13 -0800 Subject: [PATCH] Gallery: Update edit-mode-applicavilities even if it's a instant auto fix, and update them on undo/redo BUG=591609 TEST=manually Review URL: https://codereview.chromium.org/1766343002 Cr-Commit-Position: refs/heads/master@{#379703} --- .../gallery/js/image_editor/image_editor.js | 11 ++++++++++- ui/file_manager/gallery/js/slide_mode.js | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/file_manager/gallery/js/image_editor/image_editor.js b/ui/file_manager/gallery/js/image_editor/image_editor.js index 9040fe6926ceb..78860293941f9 100644 --- a/ui/file_manager/gallery/js/image_editor/image_editor.js +++ b/ui/file_manager/gallery/js/image_editor/image_editor.js @@ -301,6 +301,7 @@ ImageEditor.prototype.undo = function() { this.leaveModeInternal_(false, false /* not to switch mode */); this.commandQueue_.undo(); this.updateUndoRedo(); + this.calculateModeApplicativity_(); }; /** @@ -313,6 +314,7 @@ ImageEditor.prototype.redo = function() { this.leaveModeInternal_(false, false /* not to switch mode */); this.commandQueue_.redo(); this.updateUndoRedo(); + this.calculateModeApplicativity_(); }; /** @@ -635,6 +637,7 @@ ImageEditor.prototype.setUpMode_ = function(mode) { this.currentMode_.setUp(); + this.calculateModeApplicativity_(); if (this.currentMode_.instant) { // Instant tool. this.leaveModeInternal_(true, false /* not to switch mode */); return; @@ -645,7 +648,6 @@ ImageEditor.prototype.setUpMode_ = function(mode) { this.modeToolbar_.clear(); this.currentMode_.createTools(this.modeToolbar_); this.modeToolbar_.show(true); - this.calculateModeApplicativity_(); }; /** @@ -809,6 +811,13 @@ ImageEditor.prototype.onDoubleTap_ = function(x, y) { } }; +/** + * Called when the user starts editing image. + */ +ImageEditor.prototype.onStartEditing = function() { + this.calculateModeApplicativity_(); +}; + /** * A helper object for panning the ImageBuffer. * diff --git a/ui/file_manager/gallery/js/slide_mode.js b/ui/file_manager/gallery/js/slide_mode.js index 1c0ba4a026a02..dcad95590e71f 100644 --- a/ui/file_manager/gallery/js/slide_mode.js +++ b/ui/file_manager/gallery/js/slide_mode.js @@ -1643,6 +1643,7 @@ SlideMode.prototype.toggleEditor = function(opt_event) { }.bind(this)); this.setSubMode_(Gallery.SubMode.EDIT); + this.editor_.onStartEditing(); } else { this.editor_.getPrompt().hide(); this.editor_.leaveMode(false /* not to switch mode */);