   draw: ->
     @view.draw()
 
+  windowResized: ->
+    @view.resetBounds()
+    @grid.resetBounds(@view.width, @view.height)
+    @view.draw()
+
 $(document).ready ->
   viewController = new ViewController
   viewController.draw()
 
+  $(window).resize ->
+    viewController.windowResized()
+ 
+    
 
 

      hPosition += 40
      break if hPosition > @width

  drawVerticalLine: (hPosition) ->
    @ctx.moveTo(hPosition+0.5, 0)
    @ctx.lineTo(hPosition+0.5, @width)


class View
  constructor: (@width, @height) ->
    @canvas = $('#view').get(0)
    @canvas.width = @width
    @canvas.height = @height
    @ctx = @canvas.getContext('2d')
    @elements = []

  draw: ->
    for i in @elements
      i.draw()

class ViewController
  constructor: ->
    @view = new View($(window).width(), $(window).height())
    @ctx = @view.ctx
    @grid = new Grid(@view.width, @view.height, @ctx)
    @addElement(@grid)

  addElement: (element) ->

class Grid
  constructor: (width, height)->
    @increment = 10
    @resetBounds(width, height)

  resetBounds: (width, height) ->
    @width = width
    @height = height

  draw: (ctx) ->
    @ctx = ctx
    @ctx.strokeStyle = '#B4D6D7'
    @ctx.beginPath()
    @drawHorizontalLines()
    @drawVerticalLines()
