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

Function calcGridItemWHPx

src/core/calculate.ts:54–64  ·  view source on GitHub ↗
(
  gridUnits: number,
  colOrRowSize: number,
  marginPx: number
)

Source from the content-addressed store, hash-verified

52 * @returns Size in pixels
53 */
54export function calcGridItemWHPx(
55 gridUnits: number,
56 colOrRowSize: number,
57 marginPx: number
58): number {
59 // 0 * Infinity === NaN, which causes problems with resize constraints
60 if (!Number.isFinite(gridUnits)) return gridUnits;
61 return Math.round(
62 colOrRowSize * gridUnits + Math.max(0, gridUnits - 1) * marginPx
63 );
64}
65
66// ============================================================================
67// Position Calculations

Callers 7

GridItemFunction · 0.85
GridLayoutFunction · 0.85
calcGridItemPositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…