 dirty = true
 redraw = -> dirty = true
 
-drawEverything = (context) ->
+drawEverything = (w, h, context) ->
   return false unless application.observer.canDraw()
   context.fillStyle = "white"  
   #context.clearRect 0, 0, canvas.width, canvas.height
-  context.fillRect 0, 0, canvas.width, canvas.height
+  context.fillRect 0, 0, w, h
   context.save()
-  s = Math.min( canvas.width, canvas.height ) / 2 #
+  s = Math.min( w, h ) / 2 #
   context.scale s, s
   context.translate 1, 1
   context.fillStyle = "black"

    return [fieldData, catalogRecord]
    
  doExportSvg: ->
    svgContext = new C2S(canvas.width, canvas.height)
    drawEverything svgContext
    showExportDialog svgContext.getSerializedSvg()
    


  getCanvasResize: -> canvasSizeUpdateBlocked
  redraw: -> redraw()
  getObserver: -> @observer
  drawEverything: -> drawEverything canvas.width, canvas.height, context
  uploadToServer: (name, cb) -> uploadToServer name, cb
  getCanvas: -> canvas
  getGroup: -> @tessellation.group
