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

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

Issue 398263002: Gallery: Random fixes for the Viewport class. (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
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/viewport.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 return this.selectionModel_.selectedIndex; 387 return this.selectionModel_.selectedIndex;
388 }; 388 };
389 389
390 /** 390 /**
391 * @return {Rect} Screen rectangle of the selected image. 391 * @return {Rect} Screen rectangle of the selected image.
392 */ 392 */
393 SlideMode.prototype.getSelectedImageRect = function() { 393 SlideMode.prototype.getSelectedImageRect = function() {
394 if (this.getSelectedIndex() < 0) 394 if (this.getSelectedIndex() < 0)
395 return null; 395 return null;
396 else 396 else
397 return this.viewport_.getScreenClipped(); 397 return this.viewport_.getImageBoundsOnScreen();
398 }; 398 };
399 399
400 /** 400 /**
401 * @return {Gallery.Item} Selected item. 401 * @return {Gallery.Item} Selected item.
402 */ 402 */
403 SlideMode.prototype.getSelectedItem = function() { 403 SlideMode.prototype.getSelectedItem = function() {
404 return this.getItem(this.getSelectedIndex()); 404 return this.getItem(this.getSelectedIndex());
405 }; 405 };
406 406
407 /** 407 /**
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 } 882 }
883 883
884 return true; 884 return true;
885 }; 885 };
886 886
887 /** 887 /**
888 * Resize handler. 888 * Resize handler.
889 * @private 889 * @private
890 */ 890 */
891 SlideMode.prototype.onResize_ = function() { 891 SlideMode.prototype.onResize_ = function() {
892 this.viewport_.sizeByFrameAndFit(this.container_); 892 this.viewport_.setScreenSize(
893 this.viewport_.update(); 893 this.container_.clientWidth, this.container_.clientHeight);
894 this.editor_.getBuffer().draw(); 894 this.editor_.getBuffer().draw();
895 }; 895 };
896 896
897 /** 897 /**
898 * Update thumbnails. 898 * Update thumbnails.
899 */ 899 */
900 SlideMode.prototype.updateThumbnails = function() { 900 SlideMode.prototype.updateThumbnails = function() {
901 this.ribbon_.reset(); 901 this.ribbon_.reset();
902 if (this.active_) 902 if (this.active_)
903 this.ribbon_.redraw(); 903 this.ribbon_.redraw();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 }; 1040 };
1041 1041
1042 /** 1042 /**
1043 * Start the slideshow. 1043 * Start the slideshow.
1044 * @param {number=} opt_interval First interval in ms. 1044 * @param {number=} opt_interval First interval in ms.
1045 * @param {Event=} opt_event Event. 1045 * @param {Event=} opt_event Event.
1046 */ 1046 */
1047 SlideMode.prototype.startSlideshow = function(opt_interval, opt_event) { 1047 SlideMode.prototype.startSlideshow = function(opt_interval, opt_event) {
1048 // Reset zoom. 1048 // Reset zoom.
1049 this.viewport_.setZoomIndex(0); 1049 this.viewport_.setZoomIndex(0);
1050 this.imageView_.draw(); 1050 this.imageView_.applyViewportChange();
1051 1051
1052 // Set the attribute early to prevent the toolbar from flashing when 1052 // Set the attribute early to prevent the toolbar from flashing when
1053 // the slideshow is being started from the mosaic view. 1053 // the slideshow is being started from the mosaic view.
1054 this.container_.setAttribute('slideshow', 'playing'); 1054 this.container_.setAttribute('slideshow', 'playing');
1055 1055
1056 if (this.active_) { 1056 if (this.active_) {
1057 this.stopEditing_(); 1057 this.stopEditing_();
1058 } else { 1058 } else {
1059 // We are in the Mosaic mode. Toggle the mode but remember to return. 1059 // We are in the Mosaic mode. Toggle the mode but remember to return.
1060 this.leaveAfterSlideshow_ = true; 1060 this.leaveAfterSlideshow_ = true;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 return; 1195 return;
1196 } 1196 }
1197 1197
1198 this.stopSlideshow_(); 1198 this.stopSlideshow_();
1199 1199
1200 ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing()); 1200 ImageUtil.setAttribute(this.container_, 'editing', !this.isEditing());
1201 1201
1202 if (this.isEditing()) { // isEditing has just been flipped to a new value. 1202 if (this.isEditing()) { // isEditing has just been flipped to a new value.
1203 // Reset zoom. 1203 // Reset zoom.
1204 this.viewport_.setZoomIndex(0); 1204 this.viewport_.setZoomIndex(0);
1205 this.imageView_.draw(); 1205 this.imageView_.applyViewportChange();
1206 if (this.context_.readonlyDirName) { 1206 if (this.context_.readonlyDirName) {
1207 this.editor_.getPrompt().showAt( 1207 this.editor_.getPrompt().showAt(
1208 'top', 'GALLERY_READONLY_WARNING', 0, this.context_.readonlyDirName); 1208 'top', 'GALLERY_READONLY_WARNING', 0, this.context_.readonlyDirName);
1209 } 1209 }
1210 } else { 1210 } else {
1211 this.editor_.getPrompt().hide(); 1211 this.editor_.getPrompt().hide();
1212 this.editor_.leaveModeGently(); 1212 this.editor_.leaveModeGently();
1213 } 1213 }
1214 }; 1214 };
1215 1215
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 done = true; 1292 done = true;
1293 } 1293 }
1294 }.bind(this); 1294 }.bind(this);
1295 }; 1295 };
1296 1296
1297 /** 1297 /**
1298 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD 1298 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD
1299 * horizontally it's considered as a swipe gesture (change the current image). 1299 * horizontally it's considered as a swipe gesture (change the current image).
1300 */ 1300 */
1301 SwipeOverlay.SWIPE_THRESHOLD = 100; 1301 SwipeOverlay.SWIPE_THRESHOLD = 100;
OLDNEW
« 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