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 * @param {Element} container Content container. | 8 * @param {Element} container Content container. |
9 * @param {cr.ui.ArrayDataModel} dataModel Data model. | 9 * @param {cr.ui.ArrayDataModel} dataModel Data model. |
10 * @param {cr.ui.ListSelectionModel} selectionModel Selection model. | 10 * @param {cr.ui.ListSelectionModel} selectionModel Selection model. |
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 | 1700 |
1701 /** | 1701 /** |
1702 * Max size of an image considered to be 'small'. | 1702 * Max size of an image considered to be 'small'. |
1703 * Small images are laid out slightly differently. | 1703 * Small images are laid out slightly differently. |
1704 */ | 1704 */ |
1705 Mosaic.Tile.SMALL_IMAGE_SIZE = 160; | 1705 Mosaic.Tile.SMALL_IMAGE_SIZE = 160; |
1706 | 1706 |
1707 /** | 1707 /** |
1708 * @return {Gallery.Item} The Gallery item. | 1708 * @return {Gallery.Item} The Gallery item. |
1709 */ | 1709 */ |
1710 Mosaic.Tile.prototype.getItem = function() { return this.item_ }; | 1710 Mosaic.Tile.prototype.getItem = function() { return this.item_; }; |
1711 | 1711 |
1712 /** | 1712 /** |
1713 * @return {number} Maximum content height that this tile can have. | 1713 * @return {number} Maximum content height that this tile can have. |
1714 */ | 1714 */ |
1715 Mosaic.Tile.prototype.getMaxContentHeight = function() { | 1715 Mosaic.Tile.prototype.getMaxContentHeight = function() { |
1716 return this.maxContentHeight_; | 1716 return this.maxContentHeight_; |
1717 }; | 1717 }; |
1718 | 1718 |
1719 /** | 1719 /** |
1720 * @return {number} The aspect ratio of the tile image. | 1720 * @return {number} The aspect ratio of the tile image. |
1721 */ | 1721 */ |
1722 Mosaic.Tile.prototype.getAspectRatio = function() { return this.aspectRatio_ }; | 1722 Mosaic.Tile.prototype.getAspectRatio = function() { return this.aspectRatio_; }; |
1723 | 1723 |
1724 /** | 1724 /** |
1725 * @return {boolean} True if the tile is initialized. | 1725 * @return {boolean} True if the tile is initialized. |
1726 */ | 1726 */ |
1727 Mosaic.Tile.prototype.isInitialized = function() { | 1727 Mosaic.Tile.prototype.isInitialized = function() { |
1728 return !!this.maxContentHeight_; | 1728 return !!this.maxContentHeight_; |
1729 }; | 1729 }; |
1730 | 1730 |
1731 /** | 1731 /** |
1732 * Checks whether the image of specified (or better resolution) has been loaded. | 1732 * Checks whether the image of specified (or better resolution) has been loaded. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1975 if (!this.wrapper_) { // First time, create DOM. | 1975 if (!this.wrapper_) { // First time, create DOM. |
1976 this.container_.appendChild(this); | 1976 this.container_.appendChild(this); |
1977 var border = util.createChild(this, 'img-border'); | 1977 var border = util.createChild(this, 'img-border'); |
1978 this.wrapper_ = util.createChild(border, 'img-wrapper'); | 1978 this.wrapper_ = util.createChild(border, 'img-wrapper'); |
1979 } | 1979 } |
1980 if (this.hasAttribute('selected')) | 1980 if (this.hasAttribute('selected')) |
1981 this.scrollIntoView(false); | 1981 this.scrollIntoView(false); |
1982 | 1982 |
1983 if (this.imageLoaded_) { | 1983 if (this.imageLoaded_) { |
1984 this.thumbnailLoader_.attachImage(this.wrapper_, | 1984 this.thumbnailLoader_.attachImage(this.wrapper_, |
1985 ThumbnailLoader.FillMode.FILL); | 1985 ThumbnailLoader.FillMode.OVER_FILL); |
1986 } | 1986 } |
1987 }; | 1987 }; |
1988 | 1988 |
1989 /** | 1989 /** |
1990 * If the tile is not fully visible scroll the parent to make it fully visible. | 1990 * If the tile is not fully visible scroll the parent to make it fully visible. |
1991 * @param {boolean=} opt_animated True, if scroll should be animated, | 1991 * @param {boolean=} opt_animated True, if scroll should be animated, |
1992 * default: true. | 1992 * default: true. |
1993 */ | 1993 */ |
1994 Mosaic.Tile.prototype.scrollIntoView = function(opt_animated) { | 1994 Mosaic.Tile.prototype.scrollIntoView = function(opt_animated) { |
1995 if (this.left_ === null) // Not laid out. | 1995 if (this.left_ === null) // Not laid out. |
(...skipping 30 matching lines...) Expand all Loading... |
2026 return new Rect(this.left_ - this.container_.scrollLeft, this.top_, | 2026 return new Rect(this.left_ - this.container_.scrollLeft, this.top_, |
2027 this.width_, this.height_).inflate(-margin, -margin); | 2027 this.width_, this.height_).inflate(-margin, -margin); |
2028 }; | 2028 }; |
2029 | 2029 |
2030 /** | 2030 /** |
2031 * @return {number} X coordinate of the tile center. | 2031 * @return {number} X coordinate of the tile center. |
2032 */ | 2032 */ |
2033 Mosaic.Tile.prototype.getCenterX = function() { | 2033 Mosaic.Tile.prototype.getCenterX = function() { |
2034 return this.left_ + Math.round(this.width_ / 2); | 2034 return this.left_ + Math.round(this.width_ / 2); |
2035 }; | 2035 }; |
OLD | NEW |