extends Layout

The GridLayout class represents a layout that positions objects in a grid. To create a GridLayout object and apply it to a collection, use the layout function:

let gl = atlas.layout("grid", {numCols: 2, hGap: 10});
collection.layout = gl;


propertyexplanationtypedefault value
type the type of the layoutString“grid”
group the group that uses this layoutGroup
numRowsthe number of rows in the gridNumberundefined
numColsthe number of columns in the gridNumberundefined
rowGapthe horizontal gap between adjacent rows in the gridNumber5
colGapthe vertical gap between adjacent columns in the gridNumber5
cellBounds the bounds of the grid cellsArray of Rectangle[]

Methods inherited from Layout

methodexplanationreturn type
clone() returns a copy of this layoutvoid
run() apply this layoutvoid