   get_drawing_context: (mode) ->
     switch mode
       when "canvas" then context = @context_canvas
-      when "piece_mask"
-        if @puzzle.piece
-          context = @puzzle.piece.piece_mask.img.getContext('2d')
-        else
-          context = null
+      when "piece-mask"
+        pm_img = document.getElementById("piece-mask")
+        context = pm_img.getContext('2d')
     return context
 
 



  set_context: (mode) ->
    @mode = mode
    @context = @puzzle_view.get_drawing_context(mode)


  get_hex_xy: (a,b) ->

      yy = anchor_y + (bb - anchor_b) * 20
      if aa%2 != anchor_a%2
        if anchor_a%2 == 0 then yy = yy+10 else yy = yy-10
      @hex_draw.set_context2(@img)
      @hex_draw.fill_hex_xy(xx,yy,"#000000")


