MCPcopy Create free account
hub / github.com/bvaughn/react-virtualized / cellPositioner

Function cellPositioner

source/Masonry/createCellPositioner.js:27–46  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

25 initOrResetDerivedValues();
26
27 function cellPositioner(index) {
28 // Find the shortest column and use it.
29 let columnIndex = 0;
30 for (let i = 1; i < columnHeights.length; i++) {
31 if (columnHeights[i] < columnHeights[columnIndex]) {
32 columnIndex = i;
33 }
34 }
35
36 const left = columnIndex * (columnWidth + spacer);
37 const top = columnHeights[columnIndex] || 0;
38
39 columnHeights[columnIndex] =
40 top + cellMeasurerCache.getHeight(index) + spacer;
41
42 return {
43 left,
44 top,
45 };
46 }
47
48 function initOrResetDerivedValues(): void {
49 // Track the height of each column.

Callers 1

Masonry.jsFile · 0.85

Calls 1

getHeightMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…