       @cells.put unity, 1
     
     @observer = new @ObserverClass @tessellation, @appendRewrite, minVisibleSize, config.getViewBase(), config.getViewOffset()
-    @observer.isDrawingHomePtr = E('flag-origin-mark').checked
+    if (isDrawing=localStorage?.getItem('observer.isDrawingHomePtr'))?
+      isDrawing = isDrawing is '1'
+      E('flag-origin-mark').checked = isDrawing
+      @observer.isDrawingHomePtr = isDrawing
+      console.log "restore #{isDrawing}"
+    else
+      @setDrawingHomePtr E('flag-origin-mark').checked
+      
     @observer.onFinish = -> redraw()
 
     @navigator = new Navigator this

  getTransitionFunc: -> @transitionFunc

  getMargin: -> if @observer.isDrawingHomePtr then @margin else 0
  
  #Convert canvas X,Y coordinates to relative X,Y in (0..1) range
  canvas2relative: (x,y) ->
    s = Math.min(canvas.width, canvas.height) - 2*@getMargin()

  doSetFixedSize true
  
E('flag-origin-mark').addEventListener 'change', (e)->
  application.setDrawingHomePtr E('flag-origin-mark').checked
  
E('btn-mode-edit').addEventListener 'click', (e) -> doSetPanMode false
E('btn-mode-pan').addEventListener 'click', (e) -> doSetPanMode true
