     @piece = piece
     @puzzle = @piece.puzzle
     @view = @puzzle.puzzle_view
-
+    @canvas = document.getElementById("puzzle-widget")
     @redraw_image = document.createElement('canvas')
     @redraw_image.width = 30
     @redraw_image.height = 30

  draw_piece: (x,y) ->
    @redraw.apply_redraw()
    @redraw.prepare_next_redraw(x,y)
    context = @puzzle.puzzle_view.context_canvas
    context.drawImage(@pattern.img,x,y)
    @reset_bounding_box(x,y)


    if x < 0
      wd = wd + x
      x = 0
    ctx.drawImage(@canvas,x,y,wd,ht,0,0,wd,ht)
    @redraw_x = x
    @redraw_y =y

