OLD | NEW |
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 * Tile view displays images/videos tiles. | 6 * Tile view displays images/videos tiles. |
| 7 * |
7 * @param {HTMLDocument} document Document. | 8 * @param {HTMLDocument} document Document. |
8 * @param {function(TailBox, callback)} prepareBox This function should provide | 9 * @param {function(TailBox, callback)} prepareBox This function should provide |
9 * the passed box with width and height properties of the image. | 10 * the passed box with width and height properties of the image. |
10 * @param {function(TailBox, callback)} loadBox This function should display | 11 * @param {function(TailBox, callback)} loadBox This function should display |
11 * the image in the box respecting clientWidth and clientHeight. | 12 * the image in the box respecting clientWidth and clientHeight. |
12 * @constructor | 13 * @constructor |
13 */ | 14 */ |
14 function TileView(document, prepareBox, loadBox) { | 15 function TileView(document, prepareBox, loadBox) { |
15 var self = document.createElement('div'); | 16 var self = document.createElement('div'); |
16 TileView.decorate(self, prepareBox, loadBox); | 17 TileView.decorate(self, prepareBox, loadBox); |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 self.ready = false; | 443 self.ready = false; |
443 self.rect = {row: 0, col: 0, width: 0, height: 0}; | 444 self.rect = {row: 0, col: 0, width: 0, height: 0}; |
444 | 445 |
445 self.index = null; | 446 self.index = null; |
446 self.height = null; | 447 self.height = null; |
447 self.width = null; | 448 self.width = null; |
448 }; | 449 }; |
449 | 450 |
450 /** | 451 /** |
451 * Sets box position according to the |rect| property and given sizes. | 452 * Sets box position according to the |rect| property and given sizes. |
452 * @constructor | |
453 * @param {number} margin Margin between cells. | 453 * @param {number} margin Margin between cells. |
454 * @param {number} cellSize The size of one cell. | 454 * @param {number} cellSize The size of one cell. |
| 455 * @constructor |
455 */ | 456 */ |
456 TileBox.setPositionFromRect = function(margin, cellSize) { | 457 TileBox.setPositionFromRect = function(margin, cellSize) { |
457 this.style.top = margin + (cellSize + margin) * this.rect.row + 'px'; | 458 this.style.top = margin + (cellSize + margin) * this.rect.row + 'px'; |
458 this.style.left = margin + (cellSize + margin) * this.rect.col + 'px'; | 459 this.style.left = margin + (cellSize + margin) * this.rect.col + 'px'; |
459 this.style.height = (cellSize + margin) * this.rect.height - margin + 'px'; | 460 this.style.height = (cellSize + margin) * this.rect.height - margin + 'px'; |
460 this.style.width = (cellSize + margin) * this.rect.width - margin + 'px'; | 461 this.style.width = (cellSize + margin) * this.rect.width - margin + 'px'; |
461 }; | 462 }; |
OLD | NEW |