   
   maxAnnotations: 5
   initialFetch: true
-  panKey: false
+  xDown: null
+  yDown: null
+  toAnnotate: true
   isTrainingSubject: false
   
   subjectGroup: '5154a3783ae74086ab000001'

    # Setup mouse controls on the SVG element
    svg.addEventListener('mousewheel', @wheelHandler, false)
    
    # Set up pan key and mouse events
    $(document).keyup((e) => @panKey = false if e.keyCode is 32)
    $(document).keydown((e) =>
      if e.keyCode is 32
        e.preventDefault()
        @panKey = true
    )
    
    # Pass events to viewer if pan key is true
    svg.onmousedown = (e) =>
      @viewer.wfits.canvas.onmousedown(e) if @panKey
    svg.onmouseup = (e) =>
      @viewer.wfits.canvas.onmouseup(e) if @panKey
    svg.onmousemove = (e) =>
      if @panKey
        # Pass event to WebFITS object
        @viewer.wfits.canvas.onmousemove(e)
        
        if @viewer.wfits.drag
          # Update Annotation class attributes
          Annotation.xOffset = xOffset = @viewer.wfits.xOffset
          Annotation.yOffset = yOffset = @viewer.wfits.yOffset
          
          halfWidth = Annotation.halfWidth
          halfHeight = Annotation.halfHeight
          zoom = Annotation.zoom
          
          # Translate origin
          deltaX = halfWidth + xOffset
          deltaY = halfHeight + yOffset
          
          # Move element within pan-zoom reference frame
          for key, a of @annotations
            x = (a.x + deltaX - halfWidth) * zoom + halfWidth
            y = (a.y - deltaY - halfHeight) * zoom + halfHeight
            
            a.gRoot.setAttribute("transform", "translate(#{x}, #{y})")
          
    svg.onmouseout = (e) =>
      @viewer.wfits.canvas.onmouseout(e) if @panKey
    svg.onmouseover = (e) =>
      @viewer.wfits.canvas.onmouseover(e) if @panKey
  
  onViewerClose: (e) =>
    @maskEl.removeClass('show')
    @viewerEl.removeClass('show')
    
    # Reset Annotation attributes
    Annotation.xOffset = -220.5

  setupMouseControls: (e) =>
    svg = @svg[0]
    
    # Activate annotate flag
    @toAnnotate = false
    
    # Update/reset Annotation class attributes
    Annotation.halfWidth = @viewer.wfits.width / 2
    Annotation.halfHeight = @viewer.wfits.height / 2
