 
   constructor: (piece) ->
     @piece = piece
-    @hex_draw = @piece.puzzle.hex_draw
+    @puzzle = @piece.puzzle
+    @hex_box = @puzzle.hex_box
+    @hex_draw = @puzzle.hex_draw
     @img = document.createElement('canvas')
     @img.id = "piece-mask"
     @piece_mask_context = @img.getContext('2d')
 
 
-  draw_pattern: () ->
-    @img.width = @piece.box.width
-    @img.height = @piece.box.height
+  draw_piece_pattern: () -> # TODO Fix this and the HexBox refactor is complete.
+    @img.width = @hex_box.width
+    @img.height = @hex_box.height
     @hexes = @piece.hexes
     @hex_draw.set_context("piece_mask")
     xx = 6
+    xx = 0
     if @piece.box.high_hex_adjust == true then hx_adjust = -9 else hx_adjust = 0
     for hx in @hexes
       aa = hx[0] - @piece.box.anchor_hex[0] + 1

      when "canvas" then context = @context_canvas
      when "piece_mask"
        if @puzzle.piece
          context = @puzzle.piece.p_mask.img.getContext('2d')
        else
          context = null
    return context



  get_box_metrics: () ->
    @init_box_params()
    for hx in @hexes
      aa = hx[0]
