Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Unified Diff: ui/file_manager/gallery/js/slide_mode.js

Issue 398283002: Gallery: Add the offset feature in the slide mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/viewport.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/gallery/js/slide_mode.js
diff --git a/ui/file_manager/gallery/js/slide_mode.js b/ui/file_manager/gallery/js/slide_mode.js
index 2d48a8940a78ea894dcc7996c6c5d7541c81e9da..4d3c12a683350cfaa30966b8d04926a8aea5328d 100644
--- a/ui/file_manager/gallery/js/slide_mode.js
+++ b/ui/file_manager/gallery/js/slide_mode.js
@@ -334,7 +334,7 @@ SlideMode.prototype.leave = function(zoomToRect, callback) {
callback();
}.bind(this);
- this.viewport_.setZoomIndex(0);
+ this.viewport_.resetView();
if (this.getItemCount_() === 0) {
this.showErrorBanner_(false);
commitDone();
@@ -846,9 +846,14 @@ SlideMode.prototype.onKeyDown = function(event) {
break;
case 'U+001B': // Escape
- if (!this.isEditing())
+ if (this.isEditing()) {
+ this.toggleEditor(event);
+ } else if (this.viewport_.getZoomIndex() !== 0) {
+ this.viewport_.resetView();
+ this.imageView_.applyViewportChange();
+ } else {
return false; // Not handled.
- this.toggleEditor(event);
+ }
break;
case 'Home':
@@ -861,6 +866,19 @@ SlideMode.prototype.onKeyDown = function(event) {
case 'Down':
case 'Left':
case 'Right':
+ if (!this.isEditing() && this.viewport_.getZoomIndex() !== 0) {
+ var delta = {
+ 'Up': [0, 10], 'Down': [0, -10], 'Left': [10, 0], 'Right': [-10, 0]
mtomasz 2014/07/17 07:51:16 nit: How about moving 10 to a constant? nit: How a
hirono 2014/07/18 04:57:26 I made the offset map constant.
+ }[keyID];
+ this.viewport_.setOffset(
+ this.viewport_.getOffsetX() + delta[0],
+ this.viewport_.getOffsetY() + delta[1],
+ true);
+ this.imageView_.applyViewportChange();
+ } else {
+ this.advanceWithKeyboard(keyID);
+ }
+ break;
case 'MediaNextTrack':
case 'MediaPreviousTrack':
this.advanceWithKeyboard(keyID);
@@ -879,6 +897,12 @@ SlideMode.prototype.onKeyDown = function(event) {
this.imageView_.applyViewportChange();
}
break;
+
+ case 'Ctrl-U+0030': // Ctrl+'0' zoom reset.
+ if (!this.isEditing()) {
+ this.viewport_.resetView();
+ this.imageView_.applyViewportChange();
+ }
mtomasz 2014/07/17 07:51:16 nit: break; at the end for consistency?
}
return true;
@@ -1046,7 +1070,7 @@ SlideMode.prototype.isSlideshowOn_ = function() {
*/
SlideMode.prototype.startSlideshow = function(opt_interval, opt_event) {
// Reset zoom.
- this.viewport_.setZoomIndex(0);
+ this.viewport_.resetView();
this.imageView_.applyViewportChange();
// Set the attribute early to prevent the toolbar from flashing when
@@ -1201,7 +1225,7 @@ SlideMode.prototype.toggleEditor = function(opt_event) {
if (this.isEditing()) { // isEditing has just been flipped to a new value.
// Reset zoom.
- this.viewport_.setZoomIndex(0);
+ this.viewport_.resetView();
this.imageView_.applyViewportChange();
if (this.context_.readonlyDirName) {
this.editor_.getPrompt().showAt(
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/viewport.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698