Skip to content

Commit

Permalink
Gallery: Update edit-mode-applicavilities even if it's a instant auto…
Browse files Browse the repository at this point in the history
… fix, and update them on undo/redo

BUG=591609
TEST=manually
[email protected]

Review URL: https://codereview.chromium.org/1766343002

Cr-Commit-Position: refs/heads/master@{#379703}
(cherry picked from commit 5e534ef)

Review URL: https://codereview.chromium.org/1784143003 .

Cr-Commit-Position: refs/branch-heads/2661@{crosswalk-project#191}
Cr-Branched-From: ef6f6ae-refs/heads/master@{#378081}
  • Loading branch information
Naoki Fukino committed Mar 11, 2016
1 parent 9d54806 commit d82140b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ui/file_manager/gallery/js/image_editor/image_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ ImageEditor.prototype.undo = function() {
this.leaveModeInternal_(false, false /* not to switch mode */);
this.commandQueue_.undo();
this.updateUndoRedo();
this.calculateModeApplicativity_();
};

/**
Expand All @@ -313,6 +314,7 @@ ImageEditor.prototype.redo = function() {
this.leaveModeInternal_(false, false /* not to switch mode */);
this.commandQueue_.redo();
this.updateUndoRedo();
this.calculateModeApplicativity_();
};

/**
Expand Down Expand Up @@ -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;
Expand All @@ -645,7 +648,6 @@ ImageEditor.prototype.setUpMode_ = function(mode) {
this.modeToolbar_.clear();
this.currentMode_.createTools(this.modeToolbar_);
this.modeToolbar_.show(true);
this.calculateModeApplicativity_();
};

/**
Expand Down Expand Up @@ -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.
*
Expand Down
1 change: 1 addition & 0 deletions ui/file_manager/gallery/js/slide_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */);
Expand Down

0 comments on commit d82140b

Please sign in to comment.