MCPcopy Index your code
hub / github.com/react-grid-layout/react-grid-layout / generateMessyLayout

Function generateMessyLayout

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

Source from the content-addressed store, hash-verified

51
52// Generate a messy (gaps, overlaps) layout
53function generateMessyLayout(n, cols = 12) {
54 const layout = [];
55 for (let i = 0; i < n; i++) {
56 layout.push({
57 i: String(i),
58 x: Math.floor(Math.random() * (cols - 2)),
59 y: Math.floor(Math.random() * (n / 2)),
60 w: 1 + Math.floor(Math.random() * 3),
61 h: 1 + Math.floor(Math.random() * 3)
62 });
63 }
64 return layout;
65}
66
67// Check if a layout has any overlaps (ignoring static items overlapping each other)
68function hasOverlaps(layout) {

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…