| 273 | */ |
| 274 | export class FitTileStyler extends TileStyler { |
| 275 | setRowStyles(tile: MatGridTile, rowIndex: number): void { |
| 276 | // Percent of the available vertical space that one row takes up. |
| 277 | let percentHeightPerTile = 100 / this._rowspan; |
| 278 | |
| 279 | // Fraction of the horizontal gutter size that each column takes up. |
| 280 | let gutterHeightPerTile = (this._rows - 1) / this._rows; |
| 281 | |
| 282 | // Base vertical size of a column. |
| 283 | let baseTileHeight = this.getBaseTileSize(percentHeightPerTile, gutterHeightPerTile); |
| 284 | |
| 285 | tile._setStyle('top', this.getTilePosition(baseTileHeight, rowIndex)); |
| 286 | tile._setStyle('height', calc(this.getTileSize(baseTileHeight, tile.rowspan))); |
| 287 | } |
| 288 | |
| 289 | reset(list: TileStyleTarget) { |
| 290 | if (list._tiles) { |