     @context.moveTo domain.x0, 0
     @context.lineTo domain.x1, 0
 
-    @stroke 'rgba(0,0,0,1)'
-
-    @end()
+    @restore()
+    @lineWidth = 1
+    @strokeStyle = 'rgba(0,0,0,1)'
+    @stroke()
 
 class Grid extends Layer
   constructor: (transforms)->


    @_render domain

  begin: ()->
    transform = @transforms[@transforms.length-1]

    @context.save()
    @context.beginPath()
    transform.apply @context

  end: ()->
    @context.restore()
  
  stroke: (color, width=1, cap='butt', join='miter')->
    transform = @transforms[@transforms.length-1]

    @context.restore()
    @context.lineWidth = width
    @context.lineCap = cap
    @context.lineJoin = join
    @context.strokeStyle = color
    @context.stroke()

    @context.save()
    @context.beginPath()
    transform.apply @context
    
  fill: (color)->
    @context.restore()
    @context.fillStyle = color
    @context.fill()

    @context.save()
    @context.beginPath()

  $$resize: (event)->
    @canvas.width = window.innerWidth

      @context.moveTo domain.x0, i/scale
      @context.lineTo domain.x1, i/scale

    @restore()
    @lineWidth = 1
    @strokeStyle = 'rgba(0,0,0,0.125)'
    @stroke()

class Fractal extends Layer

