MCPcopy Create free account
hub / github.com/angular/components / getBaseTileSize

Function getBaseTileSize

src/material/grid-list/tile-styler.ts:61–68  ·  view source on GitHub ↗

* Computes the amount of space a single 1x1 tile would take up (width or height). * Used as a basis for other calculations. * @param sizePercent Percent of the total grid-list space that one 1x1 tile would take up. * @param gutterFraction Fraction of the gutter size taken up by one 1x1 tile

(sizePercent: number, gutterFraction: number)

Source from the content-addressed store, hash-verified

59 * @return The size of a 1x1 tile as an expression that can be evaluated via CSS calc().
60 */
61 getBaseTileSize(sizePercent: number, gutterFraction: number): string {
62 // Take the base size percent (as would be if evenly dividing the size between cells),
63 // and then subtracting the size of one gutter. However, since there are no gutters on the
64 // edges, each tile only uses a fraction (gutterShare = numGutters / numCells) of the gutter
65 // size. (Imagine having one gutter per tile, and then breaking up the extra gutter on the
66 // edge evenly among the cells).
67 return `(${sizePercent}% - (${this._gutterSize} * ${gutterFraction}))`;
68 }
69
70 /**
71 * Gets The horizontal or vertical position of a tile, e.g., the 'top' or 'left' property value.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected