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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 * @param {Event} event Event. | 459 * @param {Event} event Event. |
460 * @private | 460 * @private |
461 */ | 461 */ |
462 Mosaic.prototype.onSplice_ = function(event) { | 462 Mosaic.prototype.onSplice_ = function(event) { |
463 var index = event.index; | 463 var index = event.index; |
464 this.layoutModel_.invalidateFromTile_(index); | 464 this.layoutModel_.invalidateFromTile_(index); |
465 | 465 |
466 if (event.removed.length) { | 466 if (event.removed.length) { |
467 for (var t = 0; t !== event.removed.length; t++) { | 467 for (var t = 0; t !== event.removed.length; t++) { |
468 // If the layout for the tile has not done yet, the parent is null. | 468 // If the layout for the tile has not done yet, the parent is null. |
469 // And the layout will not be done after onSplice_ becuase it is removed | 469 // And the layout will not be done after onSplice_ because it is removed |
470 // from this.tiles_. | 470 // from this.tiles_. |
471 if (this.tiles_[index + t].parentNode) | 471 if (this.tiles_[index + t].parentNode) |
472 this.removeChild(this.tiles_[index + t]); | 472 this.removeChild(this.tiles_[index + t]); |
473 } | 473 } |
474 | 474 |
475 this.tiles_.splice(index, event.removed.length); | 475 this.tiles_.splice(index, event.removed.length); |
476 this.scheduleLayout(Mosaic.LAYOUT_DELAY); | 476 this.scheduleLayout(Mosaic.LAYOUT_DELAY); |
477 } | 477 } |
478 | 478 |
479 if (event.added.length) { | 479 if (event.added.length) { |
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |