| OLD | NEW |
| 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 * The overlay displaying the image. | 8 * The overlay displaying the image. |
| 9 * | 9 * |
| 10 * @param {HTMLElement} container The container element. | 10 * @param {HTMLElement} container The container element. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 /** | 245 /** |
| 246 * Loads and display a new image. | 246 * Loads and display a new image. |
| 247 * | 247 * |
| 248 * Loads the thumbnail first, then replaces it with the main image. | 248 * Loads the thumbnail first, then replaces it with the main image. |
| 249 * Takes into account the image orientation encoded in the metadata. | 249 * Takes into account the image orientation encoded in the metadata. |
| 250 * | 250 * |
| 251 * @param {Gallery.Item} item Gallery item to be loaded. | 251 * @param {Gallery.Item} item Gallery item to be loaded. |
| 252 * @param {Object} effect Transition effect object. | 252 * @param {Object} effect Transition effect object. |
| 253 * @param {function(number} displayCallback Called when the image is displayed | 253 * @param {function(number} displayCallback Called when the image is displayed |
| 254 * (possibly as a prevew). | 254 * (possibly as a preview). |
| 255 * @param {function(number} loadCallback Called when the image is fully loaded. | 255 * @param {function(number} loadCallback Called when the image is fully loaded. |
| 256 * The parameter is the load type. | 256 * The parameter is the load type. |
| 257 */ | 257 */ |
| 258 ImageView.prototype.load = | 258 ImageView.prototype.load = |
| 259 function(item, effect, displayCallback, loadCallback) { | 259 function(item, effect, displayCallback, loadCallback) { |
| 260 var entry = item.getEntry(); | 260 var entry = item.getEntry(); |
| 261 var metadata = item.getMetadata() || {}; | 261 var metadata = item.getMetadata() || {}; |
| 262 | 262 |
| 263 if (effect) { | 263 if (effect) { |
| 264 // Skip effects when reloading repeatedly very quickly. | 264 // Skip effects when reloading repeatedly very quickly. |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 return this.getDuration() + ImageView.Effect.MARGIN; | 690 return this.getDuration() + ImageView.Effect.MARGIN; |
| 691 }; | 691 }; |
| 692 | 692 |
| 693 /** | 693 /** |
| 694 * @return {string} CSS transition timing function name. | 694 * @return {string} CSS transition timing function name. |
| 695 */ | 695 */ |
| 696 ImageView.Effect.prototype.getTiming = function() { return this.timing_; }; | 696 ImageView.Effect.prototype.getTiming = function() { return this.timing_; }; |
| 697 | 697 |
| 698 /** | 698 /** |
| 699 * Obtains the CSS transformation string of the effect. | 699 * Obtains the CSS transformation string of the effect. |
| 700 * @param {DOMCanvas} element Canvas element to be applied the transforamtion. | 700 * @param {DOMCanvas} element Canvas element to be applied the transformation. |
| 701 * @param {Viewport} viewport Current viewport. | 701 * @param {Viewport} viewport Current viewport. |
| 702 * @return CSS transformation description. | 702 * @return CSS transformation description. |
| 703 */ | 703 */ |
| 704 ImageView.Effect.prototype.transform = function(element, viewport) { | 704 ImageView.Effect.prototype.transform = function(element, viewport) { |
| 705 throw new Error('Not implemented.'); | 705 throw new Error('Not implemented.'); |
| 706 }; | 706 }; |
| 707 | 707 |
| 708 /** | 708 /** |
| 709 * Default effect. | 709 * Default effect. |
| 710 * | 710 * |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 ImageView.Effect.Slide.prototype.transform = function(element, viewport) { | 762 ImageView.Effect.Slide.prototype.transform = function(element, viewport) { |
| 763 return viewport.getShiftTransformation(this.shift_); | 763 return viewport.getShiftTransformation(this.shift_); |
| 764 }; | 764 }; |
| 765 | 765 |
| 766 /** | 766 /** |
| 767 * Zoom effect. | 767 * Zoom effect. |
| 768 * | 768 * |
| 769 * Animates the original rectangle to the target rectangle. | 769 * Animates the original rectangle to the target rectangle. |
| 770 * | 770 * |
| 771 * @param {number} previousImageWidth Width of the full resolution image. | 771 * @param {number} previousImageWidth Width of the full resolution image. |
| 772 * @param {number} previousImageHeight Hieght of the full resolution image. | 772 * @param {number} previousImageHeight Height of the full resolution image. |
| 773 * @param {Rect} imageCropRect Crop rectangle in the full resolution image. | 773 * @param {Rect} imageCropRect Crop rectangle in the full resolution image. |
| 774 * @param {number=} opt_duration Duration of the effect. | 774 * @param {number=} opt_duration Duration of the effect. |
| 775 * @constructor | 775 * @constructor |
| 776 * @extends {ImageView.Effect} | 776 * @extends {ImageView.Effect} |
| 777 */ | 777 */ |
| 778 ImageView.Effect.Zoom = function( | 778 ImageView.Effect.Zoom = function( |
| 779 previousImageWidth, previousImageHeight, imageCropRect, opt_duration) { | 779 previousImageWidth, previousImageHeight, imageCropRect, opt_duration) { |
| 780 ImageView.Effect.call(this, | 780 ImageView.Effect.call(this, |
| 781 opt_duration || ImageView.Effect.DEFAULT_DURATION, 'ease-out'); | 781 opt_duration || ImageView.Effect.DEFAULT_DURATION, 'ease-out'); |
| 782 this.previousImageWidth_ = previousImageWidth; | 782 this.previousImageWidth_ = previousImageWidth; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 }; | 833 }; |
| 834 | 834 |
| 835 ImageView.Effect.Rotate.prototype = { __proto__: ImageView.Effect.prototype }; | 835 ImageView.Effect.Rotate.prototype = { __proto__: ImageView.Effect.prototype }; |
| 836 | 836 |
| 837 /** | 837 /** |
| 838 * @override | 838 * @override |
| 839 */ | 839 */ |
| 840 ImageView.Effect.Rotate.prototype.transform = function(element, viewport) { | 840 ImageView.Effect.Rotate.prototype.transform = function(element, viewport) { |
| 841 return viewport.getInverseTransformForRotatedImage(this.orientation_); | 841 return viewport.getInverseTransformForRotatedImage(this.orientation_); |
| 842 }; | 842 }; |
| OLD | NEW |