MCPcopy
hub / github.com/react-grid-layout/react-grid-layout / generateGridLayout

Function generateGridLayout

test/spec/fast-compactor-test.js:38–50  ·  view source on GitHub ↗
(n, cols = 12)

Source from the content-addressed store, hash-verified

36
37// Generate a grid layout (items placed in order)
38function generateGridLayout(n, cols = 12) {
39 const layout = [];
40 for (let i = 0; i < n; i++) {
41 layout.push({
42 i: String(i),
43 x: (i * 2) % cols,
44 y: Math.floor((i * 2) / cols) * 2,
45 w: 2,
46 h: 2
47 });
48 }
49 return layout;
50}
51
52// Generate a messy (gaps, overlaps) layout
53function generateMessyLayout(n, cols = 12) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…