   canvasDown: (event) =>
     switch @state.type
       when 'normal'
-        mouseX = event.pageX - $('#main-canvas').offset().left
-        mouseY = event.pageY - $('#main-canvas').offset().top
+        mouseX = event.pageX - @mainCanvas.offset().left
+        mouseY = event.pageY - @mainCanvas.offset().top
         info = @renderer.resolveScreenCoordinates mouseX, mouseY
         if info.block
           @state.type  = 'down'

    return off

  canvasMove: (event) =>
    mouseX = event.pageX - $('#main-canvas').offset().left
    mouseY = event.pageY - $('#main-canvas').offset().top
    switch @state.type
      when 'down'
        # If the user moves more than @settings.draggingOffset pixels

      when 'dragging'
        @draggingUp event
      when 'down'
        mouseX = event.pageX - @mainCanvas.offset().left
        mouseY = event.pageY - @mainCanvas.offset().top
        if @state.info.block is @renderer.resolveScreenCoordinates(mouseX, mouseY).block
          @selectBlock @state.info.block
          @state.type = 'normal'
