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

Side by Side Diff: ui/file_manager/gallery/js/slide_mode.js

Issue 392543002: Gallery.app: Add shortcut keys for zooming in the slide mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Slide mode displays a single image and has a set of controls to navigate 8 * Slide mode displays a single image and has a set of controls to navigate
9 * between the images and to edit an image. 9 * between the images and to edit an image.
10 * 10 *
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 this.dataModel_.removeEventListener('splice', this.onSpliceBound_); 327 this.dataModel_.removeEventListener('splice', this.onSpliceBound_);
328 this.dataModel_.removeEventListener('content', this.onContentBound_); 328 this.dataModel_.removeEventListener('content', this.onContentBound_);
329 this.ribbon_.disable(); 329 this.ribbon_.disable();
330 this.active_ = false; 330 this.active_ = false;
331 if (this.savedSelection_) 331 if (this.savedSelection_)
332 this.selectionModel_.selectedIndexes = this.savedSelection_; 332 this.selectionModel_.selectedIndexes = this.savedSelection_;
333 this.unloadImage_(zoomToRect); 333 this.unloadImage_(zoomToRect);
334 callback(); 334 callback();
335 }.bind(this); 335 }.bind(this);
336 336
337 this.viewport_.setZoomIndex(0);
337 if (this.getItemCount_() === 0) { 338 if (this.getItemCount_() === 0) {
338 this.showErrorBanner_(false); 339 this.showErrorBanner_(false);
339 commitDone(); 340 commitDone();
340 } else { 341 } else {
341 this.commitItem_(commitDone); 342 this.commitItem_(commitDone);
342 } 343 }
343 344
344 // Disable the slide-mode only buttons when leaving. 345 // Disable the slide-mode only buttons when leaving.
345 this.editButton_.setAttribute('disabled', ''); 346 this.editButton_.setAttribute('disabled', '');
346 this.printButton_.setAttribute('disabled', ''); 347 this.printButton_.setAttribute('disabled', '');
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 case 'End': 850 case 'End':
850 this.selectLast(); 851 this.selectLast();
851 break; 852 break;
852 case 'Up': 853 case 'Up':
853 case 'Down': 854 case 'Down':
854 case 'Left': 855 case 'Left':
855 case 'Right': 856 case 'Right':
856 this.advanceWithKeyboard(keyID); 857 this.advanceWithKeyboard(keyID);
857 break; 858 break;
858 859
859 default: return false; 860 case 'Ctrl-U+00BB': // Ctrl+'=' zoom in.
861 if (!this.isEditing()) {
862 this.viewport_.setZoomIndex(this.viewport_.getZoomIndex() + 1);
863 this.imageView_.draw();
864 }
865 break;
866
867 case 'Ctrl-U+00BD': // Ctrl+'-' zoom out.
868 if (!this.isEditing()) {
869 this.viewport_.setZoomIndex(this.viewport_.getZoomIndex() - 1);
870 this.imageView_.draw();
871 }
872 break;
860 } 873 }
861 874
862 return true; 875 return true;
863 }; 876 };
864 877
865 /** 878 /**
866 * Resize handler. 879 * Resize handler.
867 * @private 880 * @private
868 */ 881 */
869 SlideMode.prototype.onResize_ = function() { 882 SlideMode.prototype.onResize_ = function() {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 SlideMode.prototype.isSlideshowOn_ = function() { 1029 SlideMode.prototype.isSlideshowOn_ = function() {
1017 return this.container_.hasAttribute('slideshow'); 1030 return this.container_.hasAttribute('slideshow');
1018 }; 1031 };
1019 1032
1020 /** 1033 /**
1021 * Start the slideshow. 1034 * Start the slideshow.
1022 * @param {number=} opt_interval First interval in ms. 1035 * @param {number=} opt_interval First interval in ms.
1023 * @param {Event=} opt_event Event. 1036 * @param {Event=} opt_event Event.
1024 */ 1037 */
1025 SlideMode.prototype.startSlideshow = function(opt_interval, opt_event) { 1038 SlideMode.prototype.startSlideshow = function(opt_interval, opt_event) {
1039 // Reset zoom.
1040 this.viewport_.setZoomIndex(0);
1041 this.imageView_.draw();
1042
1026 // Set the attribute early to prevent the toolbar from flashing when 1043 // Set the attribute early to prevent the toolbar from flashing when
1027 // the slideshow is being started from the mosaic view. 1044 // the slideshow is being started from the mosaic view.
1028 this.container_.setAttribute('slideshow', 'playing'); 1045 this.container_.setAttribute('slideshow', 'playing');
1029 1046
1030 if (this.active_) { 1047 if (this.active_) {
1031 this.stopEditing_(); 1048 this.stopEditing_();
1032 } else { 1049 } else {
1033 // We are in the Mosaic mode. Toggle the mode but remember to return. 1050 // We are in the Mosaic mode. Toggle the mode but remember to return.
1034 this.leaveAfterSlideshow_ = true; 1051 this.leaveAfterSlideshow_ = true;
1035 this.toggleMode_(this.startSlideshow.bind( 1052 this.toggleMode_(this.startSlideshow.bind(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 if (!this.active_) { 1184 if (!this.active_) {
1168 this.toggleMode_(this.toggleEditor.bind(this)); 1185 this.toggleMode_(this.toggleEditor.bind(this));
1169 return; 1186 return;
1170 } 1187 }
1171 1188
1172 this.stopSlideshow_(); 1189 this.stopSlideshow_();
1173 1190
1174 ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing()); 1191 ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing());
1175 1192
1176 if (this.isEditing()) { // isEditing has just been flipped to a new value. 1193 if (this.isEditing()) { // isEditing has just been flipped to a new value.
1194 // Reset zoom.
1195 this.viewport_.setZoomIndex(0);
1196 this.imageView_.draw();
1177 if (this.context_.readonlyDirName) { 1197 if (this.context_.readonlyDirName) {
1178 this.editor_.getPrompt().showAt( 1198 this.editor_.getPrompt().showAt(
1179 'top', 'GALLERY_READONLY_WARNING', 0, this.context_.readonlyDirName); 1199 'top', 'GALLERY_READONLY_WARNING', 0, this.context_.readonlyDirName);
1180 } 1200 }
1181 } else { 1201 } else {
1182 this.editor_.getPrompt().hide(); 1202 this.editor_.getPrompt().hide();
1183 this.editor_.leaveModeGently(); 1203 this.editor_.leaveModeGently();
1184 } 1204 }
1185 }; 1205 };
1186 1206
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 done = true; 1283 done = true;
1264 } 1284 }
1265 }.bind(this); 1285 }.bind(this);
1266 }; 1286 };
1267 1287
1268 /** 1288 /**
1269 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD 1289 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD
1270 * horizontally it's considered as a swipe gesture (change the current image). 1290 * horizontally it's considered as a swipe gesture (change the current image).
1271 */ 1291 */
1272 SwipeOverlay.SWIPE_THRESHOLD = 100; 1292 SwipeOverlay.SWIPE_THRESHOLD = 100;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698