Function: matchSlots()
ts
function matchSlots(
layout,
aspects,
options?
): number[];Like contentSlots, but puts each item in a cell of similar shape, so content shown with object-fit: cover loses as little as possible to cropping. aspects gives each item's width / height (one per item, in item order); a cell's shape is its bounding box, which is what content is laid out in.
Featured cells still take their items first (see contentSlots). The rest are matched to minimize the total crop (measured as the difference in log aspect ratio, which is optimal to match by sorting both sides). Returns the item index per cell (by cell.index), or -1.
Parameters
| Parameter | Type |
|---|---|
layout | Layout |
aspects | readonly number[] |
options | MatchOptions |
Returns
number[]