From d82140b585a7bc81054ad11f7dfadbec61b97d16 Mon Sep 17 00:00:00 2001 From: Naoki Fukino Date: Fri, 11 Mar 2016 17:21:02 +0900 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 TBR=ryoh@chromium.org Review URL: https://codereview.chromium.org/1766343002 Cr-Commit-Position: refs/heads/master@{#379703} (cherry picked from commit 5e534ef0d453c7aa40a2d4f973521bedd57d4c02) Review URL: https://codereview.chromium.org/1784143003 . Cr-Commit-Position: refs/branch-heads/2661@{#191} Cr-Branched-From: ef6f6ae5e4c96622286b563658d5cd62a6cf1197-refs/heads/master@{#378081} --- .../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 */);