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

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

Issue 624563002: Files.app: Rename Rect used in Gallery with ImageRect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 }, 236 },
237 SlideMode.EDITOR_MODES, 237 SlideMode.EDITOR_MODES,
238 this.displayStringFunction_, 238 this.displayStringFunction_,
239 this.onToolsVisibilityChanged_.bind(this)); 239 this.onToolsVisibilityChanged_.bind(this));
240 240
241 this.touchHandlers_ = new TouchHandler(this.imageContainer_, this); 241 this.touchHandlers_ = new TouchHandler(this.imageContainer_, this);
242 }; 242 };
243 243
244 /** 244 /**
245 * Load items, display the selected item. 245 * Load items, display the selected item.
246 * @param {Rect} zoomFromRect Rectangle for zoom effect. 246 * @param {ImageRect} zoomFromRect Rectangle for zoom effect.
247 * @param {function} displayCallback Called when the image is displayed. 247 * @param {function} displayCallback Called when the image is displayed.
248 * @param {function} loadCallback Called when the image is displayed. 248 * @param {function} loadCallback Called when the image is displayed.
249 */ 249 */
250 SlideMode.prototype.enter = function( 250 SlideMode.prototype.enter = function(
251 zoomFromRect, displayCallback, loadCallback) { 251 zoomFromRect, displayCallback, loadCallback) {
252 this.sequenceDirection_ = 0; 252 this.sequenceDirection_ = 0;
253 this.sequenceLength_ = 0; 253 this.sequenceLength_ = 0;
254 254
255 var loadDone = function(loadType, delay) { 255 var loadDone = function(loadType, delay) {
256 this.active_ = true; 256 this.active_ = true;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // Call load callback. 322 // Call load callback.
323 if (loadCallback) 323 if (loadCallback)
324 loadCallback(); 324 loadCallback();
325 }.bind(this)).catch(function(error) { 325 }.bind(this)).catch(function(error) {
326 console.error(error.stack, error); 326 console.error(error.stack, error);
327 }); 327 });
328 }; 328 };
329 329
330 /** 330 /**
331 * Leave the mode. 331 * Leave the mode.
332 * @param {Rect} zoomToRect Rectangle for zoom effect. 332 * @param {ImageRect} zoomToRect Rectangle for zoom effect.
333 * @param {function} callback Called when the image is committed and 333 * @param {function} callback Called when the image is committed and
334 * the zoom-out animation has started. 334 * the zoom-out animation has started.
335 */ 335 */
336 SlideMode.prototype.leave = function(zoomToRect, callback) { 336 SlideMode.prototype.leave = function(zoomToRect, callback) {
337 var commitDone = function() { 337 var commitDone = function() {
338 this.stopEditing_(); 338 this.stopEditing_();
339 this.stopSlideshow_(); 339 this.stopSlideshow_();
340 ImageUtil.setAttribute(this.arrowBox_, 'active', false); 340 ImageUtil.setAttribute(this.arrowBox_, 'active', false);
341 this.selectionModel_.removeEventListener( 341 this.selectionModel_.removeEventListener(
342 'change', this.onSelectionBound_); 342 'change', this.onSelectionBound_);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 }; 399 };
400 400
401 /** 401 /**
402 * @return {Gallery.Item} Selected index. 402 * @return {Gallery.Item} Selected index.
403 */ 403 */
404 SlideMode.prototype.getSelectedIndex = function() { 404 SlideMode.prototype.getSelectedIndex = function() {
405 return this.selectionModel_.selectedIndex; 405 return this.selectionModel_.selectedIndex;
406 }; 406 };
407 407
408 /** 408 /**
409 * @return {Rect} Screen rectangle of the selected image. 409 * @return {ImageRect} Screen rectangle of the selected image.
410 */ 410 */
411 SlideMode.prototype.getSelectedImageRect = function() { 411 SlideMode.prototype.getSelectedImageRect = function() {
412 if (this.getSelectedIndex() < 0) 412 if (this.getSelectedIndex() < 0)
413 return null; 413 return null;
414 else 414 else
415 return this.viewport_.getImageBoundsOnScreen(); 415 return this.viewport_.getImageBoundsOnScreen();
416 }; 416 };
417 417
418 /** 418 /**
419 * @return {Gallery.Item} Selected item. 419 * @return {Gallery.Item} Selected item.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 if (shouldPrefetch(loadType, step, this.sequenceLength_)) 543 if (shouldPrefetch(loadType, step, this.sequenceLength_))
544 this.requestPrefetch(step, delay); 544 this.requestPrefetch(step, delay);
545 if (this.isSlideshowPlaying_()) 545 if (this.isSlideshowPlaying_())
546 this.scheduleNextSlide_(); 546 this.scheduleNextSlide_();
547 }.bind(this)); 547 }.bind(this));
548 }; 548 };
549 549
550 /** 550 /**
551 * Unload the current image. 551 * Unload the current image.
552 * 552 *
553 * @param {Rect} zoomToRect Rectangle for zoom effect. 553 * @param {ImageRect} zoomToRect Rectangle for zoom effect.
554 * @private 554 * @private
555 */ 555 */
556 SlideMode.prototype.unloadImage_ = function(zoomToRect) { 556 SlideMode.prototype.unloadImage_ = function(zoomToRect) {
557 this.imageView_.unload(zoomToRect); 557 this.imageView_.unload(zoomToRect);
558 }; 558 };
559 559
560 /** 560 /**
561 * Data model 'splice' event handler. 561 * Data model 'splice' event handler.
562 * @param {Event} event Event. 562 * @param {Event} event Event.
563 * @private 563 * @private
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 TouchHandler.prototype.onMouseWheel_ = function(event) { 1574 TouchHandler.prototype.onMouseWheel_ = function(event) {
1575 var viewport = this.slideMode_.getViewport(); 1575 var viewport = this.slideMode_.getViewport();
1576 if (!this.enabled_ || !viewport.isZoomed()) 1576 if (!this.enabled_ || !viewport.isZoomed())
1577 return; 1577 return;
1578 this.stopOperation(); 1578 this.stopOperation();
1579 viewport.setOffset( 1579 viewport.setOffset(
1580 viewport.getOffsetX() + event.wheelDeltaX, 1580 viewport.getOffsetX() + event.wheelDeltaX,
1581 viewport.getOffsetY() + event.wheelDeltaY); 1581 viewport.getOffsetY() + event.wheelDeltaY);
1582 this.slideMode_.applyViewportChange(); 1582 this.slideMode_.applyViewportChange();
1583 }; 1583 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698