function initSvgMatrix() {
  var matrix = document.getElementById('matrix');
  if (!matrix) throw Error('No matrix SVG element found.');
  for (var x = 0; x < WIDTH; x++) {
    var matrixX = x * CELL_SIZE;
    for (var y = 0; y < HEIGHT; y++) {
      var matrixY = y * CELL_SIZE;
      var g = document.createElementNS(SVG_NS, 'g');
      g.id = x + '_' + y;
      g.setAttribute('class', 'cell-empty');
      g.setAttribute('transform', 'translate(' + matrixX + ',' + matrixY + ')');
      // <rect x="0" y="0" height="64" width="64" class="cell"/>
      var rect = document.createElementNS(SVG_NS, 'rect');
      rect.setAttribute('x', 0.5);
      rect.setAttribute('y', 0.5);
      rect.setAttribute('height', CELL_SIZE);
      rect.setAttribute('width', CELL_SIZE);
      rect.setAttribute('class', 'cell-bg');
      g.appendChild(rect);
      matrix.appendChild(g);
    }
  }
  setHoverClass(true);
}
// Draw empty matrix cells on the board.
Draw empty matrix cells on the board.
Draw empty matrix cells on the board .
function initSvgMatrix() {
  var matrix = document.getElementById('matrix');
  if (!matrix) throw Error('No matrix SVG element found.');
  for (var x = 0; x < WIDTH; x++) {
    var matrixX = x * CELL_SIZE;
    for (var y = 0; y < HEIGHT; y++) {
      var matrixY = y * CELL_SIZE;
      var g = document.createElementNS(SVG_NS, 'g');
      g.id = x + '_' + y;
      g.setAttribute('class', 'cell-empty');
      g.setAttribute('transform', 'translate(' + matrixX + ',' + matrixY + ')');
      var rect = document.createElementNS(SVG_NS, 'rect');
      rect.setAttribute('x', 0.5);
      rect.setAttribute('y', 0.5);
      rect.setAttribute('height', CELL_SIZE);
      rect.setAttribute('width', CELL_SIZE);
      rect.setAttribute('class', 'cell-bg');
      g.appendChild(rect);
      matrix.appendChild(g);
    }
  }
  setHoverClass(true);
}
function initSvgMatrix ( ) { var matrix = document . getElementById ( 'matrix' ) ; if ( ! matrix ) throw Error ( 'No matrix SVG element found.' ) ; for ( var x = 0 ; x < WIDTH ; x ++ ) { var matrixX = x * CELL_SIZE ; for ( var y = 0 ; y < HEIGHT ; y ++ ) { var matrixY = y * CELL_SIZE ; var g = document . createElementNS ( SVG_NS , 'g' ) ; g . id = x + '_' + y ; g . setAttribute ( 'class' , 'cell-empty' ) ; g . setAttribute ( 'transform' , 'translate(' + matrixX + ',' + matrixY + ')' ) ; var rect = document . createElementNS ( SVG_NS , 'rect' ) ; rect . setAttribute ( 'x' , 0.5 ) ; rect . setAttribute ( 'y' , 0.5 ) ; rect . setAttribute ( 'height' , CELL_SIZE ) ; rect . setAttribute ( 'width' , CELL_SIZE ) ; rect . setAttribute ( 'class' , 'cell-bg' ) ; g . appendChild ( rect ) ; matrix . appendChild ( g ) ; } } setHoverClass ( true ) ; }
Draw empty matrix cells on the board.
Draw empty matrix cells on the board .
// <rect x="0" y="0" height="64" width="64" class="cell"/>