function onClick(e) {
  if (inputMode !== inputModes.PLAY) return;
  var svg = document.getElementById('board');
  // Compute the X/Y cell coordinates of the click.
  var rect = svg.getBoundingClientRect();
  var x = Math.floor((e.clientX - rect.left) / CELL_SIZE);
  var y = Math.floor((e.clientY - rect.top) / CELL_SIZE);
  if (x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT) {
    // Out of bounds.
    return;
  }
  if (plantBomb(x, y)) {
    sequenceDetonations(true);
  }
}
// User clicked on the SVG.  Plant a bomb there -- if legal.
User clicked on the SVG.  Plant a bomb there -- if legal.
User clicked on the SVG . Plant a bomb there -- if legal .
function onClick(e) {
  if (inputMode !== inputModes.PLAY) return;
  var svg = document.getElementById('board');
  var rect = svg.getBoundingClientRect();
  var x = Math.floor((e.clientX - rect.left) / CELL_SIZE);
  var y = Math.floor((e.clientY - rect.top) / CELL_SIZE);
  if (x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT) {
    return;
  }
  if (plantBomb(x, y)) {
    sequenceDetonations(true);
  }
}
function onClick ( e ) { if ( inputMode !== inputModes . PLAY ) return ; var svg = document . getElementById ( 'board' ) ; var rect = svg . getBoundingClientRect ( ) ; var x = Math . floor ( ( e . clientX - rect . left ) / CELL_SIZE ) ; var y = Math . floor ( ( e . clientY - rect . top ) / CELL_SIZE ) ; if ( x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT ) { return ; } if ( plantBomb ( x , y ) ) { sequenceDetonations ( true ) ; } }
User clicked on the SVG.
User clicked on the SVG .
// Compute the X/Y cell coordinates of the click. // Out of bounds.