app/scripts/box.js
// UPDATE BOX GRID WHEN USER CHANGES BOX SIZE
UPDATE BOX GRID WHEN USER CHANGES BOX SIZE
UPDATE BOX GRID WHEN USER CHANGES BOX SIZE
function updateGrid() {
  calcGrid();
  let index = 0;
  for (let i=0; i<totalXCount; i++) {
    for (let j=0; j<totalYCount; j++) {
      let x = (boxSize/2) + (i * boxSize);
      let y = (boxSize/2) + (j * boxSize);
      boxes[index].x = x;
      boxes[index].y = y;
      boxes[index].s = boxSize;
      index++;
    }
  }
}
function updateGrid ( ) { calcGrid ( ) ; let index = 0 ; for ( let i = 0 ; i < totalXCount ; i ++ ) { for ( let j = 0 ; j < totalYCount ; j ++ ) { let x = ( boxSize / 2 ) + ( i * boxSize ) ; let y = ( boxSize / 2 ) + ( j * boxSize ) ; boxes [ index ] . x = x ; boxes [ index ] . y = y ; boxes [ index ] . s = boxSize ; index ++ ; } } }
UPDATE BOX GRID WHEN USER CHANGES BOX SIZE
UPDATE BOX GRID WHEN USER CHANGES BOX SIZE
// RECALCULATE GRID // UPDATE BOX POSITION AND SIZE // CALC X AND Y POSITIONGS // UPDATE BOXES