Function cellFromIndex

Returns x,y from an array index.

 const data = [
1, 2,
3, 4,
5, 6 ];

// Cols of 2, index 2 (ie. data[2] == 3)
const cell = cellFromIndex(2, 2);
// Yields: {x: 0, y: 1}

indexFromCell

  • Parameters

    • colsOrGrid: number | Grid
    • index: number

    Returns Cell