 class PuzzlePiece
 
   constructor: (puzzle_app) ->
+    console.log "PuzzlePiece constructor"
     @puzzle = puzzle_app
     @hex_box = @puzzle.hex_box
     @pattern  = new PiecePattern(this)
+    console.log "    @pattern.img.id = #{@pattern.img.id}"
     @redraw = new PieceRedrawBuffer(this)
     @hexes = []
     @bounding_box = [0,0,0,0,]



  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")


