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

Side by Side Diff: chrome/browser/resources/file_manager/js/photo/slide_mode.js

Issue 10919292: Photo Editor: better mode transitions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * Slide mode displays a single image and has a set of controls to navigate 6 * Slide mode displays a single image and has a set of controls to navigate
7 * between the images and to edit an image. 7 * between the images and to edit an image.
8 * 8 *
9 * TODO(kaznacheev): Introduce a parameter object. 9 * TODO(kaznacheev): Introduce a parameter object.
10 * 10 *
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 displayCallback, loadDone); 274 displayCallback, loadDone);
275 }.bind(this)); 275 }.bind(this));
276 276
277 } 277 }
278 }; 278 };
279 279
280 /** 280 /**
281 * Leave the mode. 281 * Leave the mode.
282 * @param {Rect} zoomToRect Rectangle for zoom effect. 282 * @param {Rect} zoomToRect Rectangle for zoom effect.
283 * @param {function} callback Called when the image is committed and 283 * @param {function} callback Called when the image is committed and
284 * the zoom-out animation is done. 284 * the zoom-out animation has started.
285 */ 285 */
286 SlideMode.prototype.leave = function(zoomToRect, callback) { 286 SlideMode.prototype.leave = function(zoomToRect, callback) {
287 if (this.prefetchTimer_) { 287 if (this.prefetchTimer_) {
288 clearTimeout(this.prefetchTimer_); 288 clearTimeout(this.prefetchTimer_);
289 this.prefetchTimer_ = null; 289 this.prefetchTimer_ = null;
290 } 290 }
291 291
292 var commitDone = function() { 292 var commitDone = function() {
293 this.stopEditing_(); 293 this.stopEditing_();
294 this.stopSlideshow_(); 294 this.stopSlideshow_();
295 ImageUtil.setAttribute(this.arrowBox_, 'active', false); 295 ImageUtil.setAttribute(this.arrowBox_, 'active', false);
296 this.unloadImage_(zoomToRect);
297 this.selectionModel_.removeEventListener( 296 this.selectionModel_.removeEventListener(
298 'change', this.onSelectionBound_); 297 'change', this.onSelectionBound_);
299 this.dataModel_.removeEventListener('splice', this.onSpliceBound_); 298 this.dataModel_.removeEventListener('splice', this.onSpliceBound_);
300 this.ribbon_.disable(); 299 this.ribbon_.disable();
301 this.active_ = false; 300 this.active_ = false;
302 if (this.savedSelection_) 301 if (this.savedSelection_)
303 this.selectionModel_.selectedIndexes = this.savedSelection_; 302 this.selectionModel_.selectedIndexes = this.savedSelection_;
304 if (zoomToRect) 303 this.unloadImage_(zoomToRect);
305 setTimeout(callback, ImageView.ANIMATION_WAIT_INTERVAL); 304 callback();
306 else
307 callback();
308 }.bind(this); 305 }.bind(this);
309 306
310 if (this.getItemCount_() == 0) { 307 if (this.getItemCount_() == 0) {
311 this.showErrorBanner_(false); 308 this.showErrorBanner_(false);
312 commitDone(); 309 commitDone();
313 } else { 310 } else {
314 this.commitItem_(commitDone); 311 this.commitItem_(commitDone);
315 } 312 }
316 }; 313 };
317 314
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 }; 346 };
350 347
351 /** 348 /**
352 * @return {Gallery.Item} Selected index. 349 * @return {Gallery.Item} Selected index.
353 */ 350 */
354 SlideMode.prototype.getSelectedIndex = function() { 351 SlideMode.prototype.getSelectedIndex = function() {
355 return this.selectionModel_.selectedIndex; 352 return this.selectionModel_.selectedIndex;
356 }; 353 };
357 354
358 /** 355 /**
356 * @return {Rect} Screen rectangle of the selected image.
357 */
358 SlideMode.prototype.getSelectedImageRect = function() {
359 if (this.getSelectedIndex() < 0)
dgozman 2012/09/14 15:17:38 No selection in slide mode?
Vladislav Kaznacheev 2012/09/14 16:20:04 It is possible if there is 0 items. On 2012/09/14
360 return null;
361 else
362 return this.viewport_.getScreenClipped();
363 };
364
365 /**
359 * @return {Gallery.Item} Selected item 366 * @return {Gallery.Item} Selected item
360 */ 367 */
361 SlideMode.prototype.getSelectedItem = function() { 368 SlideMode.prototype.getSelectedItem = function() {
362 return this.getItem(this.getSelectedIndex()); 369 return this.getItem(this.getSelectedIndex());
363 }; 370 };
364 371
365 /** 372 /**
366 * Selection change handler. 373 * Selection change handler.
367 * 374 *
368 * Commits the current image and displays the newly selected image. 375 * Commits the current image and displays the newly selected image.
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 done = true; 1171 done = true;
1165 } 1172 }
1166 }.bind(this); 1173 }.bind(this);
1167 }; 1174 };
1168 1175
1169 /** 1176 /**
1170 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD 1177 * If the user touched the image and moved the finger more than SWIPE_THRESHOLD
1171 * horizontally it's considered as a swipe gesture (change the current image). 1178 * horizontally it's considered as a swipe gesture (change the current image).
1172 */ 1179 */
1173 SwipeOverlay.SWIPE_THRESHOLD = 100; 1180 SwipeOverlay.SWIPE_THRESHOLD = 100;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698