   gridSize: 10
 
   initialize: ->
-    # Ensure 'this' has correct context
-    #_.bindAll @, 'onPointStart', 'onPointMove', 'onPointEnd', 'fillBlock', 'checkCompleted', 'win', 'pause', 'changePoint', 'updateTimer', 'showTutorial', 'resize', 'hide', 'show'
     _.bindAll(@, 'onPointStart', 'onPointMove', 'onPointEnd')
 
     # View is initialized hidden

    @previousRow = @previousCol = null

  fillBlock: (row, col) ->
    index = row * 10 + col

    block = @grid.find('div').eq(index)

    if block.hasClass('filled') is true

      block.addClass 'filled'

  resize: (width, height, orientation) ->
    # TODO: lots of duplication here, refactor!
    # TODO: rename @gridSize; it's the # of cells in the grid, whereas
    # @blockSize is an actual pixel size
    if orientation is 'landscape'
      maxGridSize = Math.round(height * 0.97 / 10) * 10   # Make sure grid background size is 97% of viewport
      @blockSize = maxGridSize / 10
      @grid.width(@gridSize * @blockSize)
      @grid.height(@gridSize * @blockSize)

      # Add some margin to the grid, so it appears centered
      horizontalMargin = (height - @grid.width() - 10) / 2
      verticalMargin = (maxGridSize - @grid.height()) / 2

    else if orientation is 'portrait'
      maxGridSize = Math.round(width * 0.97 / 10) * 10  # grid size is 97% of viewport
      @blockSize = maxGridSize / 10
      @grid.width(@gridSize * @blockSize)
      @grid.height(@gridSize * @blockSize)

      # Add some margin to the grid, so it appears centered
      verticalMargin = (width - @grid.height() - 10) / 2
      horizontalMargin = (maxGridSize - @grid.width()) / 2
      
    @grid.css
      margin: "#{horizontalMargin}px #{verticalMargin}px"

    @grid.children('div').css
      width: @blockSize
      height: @blockSize

module.exports = EditorScene
