     # 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
+      
+      # Store the down position for later comparison
+      @xDown = e.pageX
+      @yDown = e.pageY
+      
+      # TODO: Find more efficient way to do this
+      for key, a of @annotations
+        return if a.drag
+      
+      @viewer.wfits.canvas.onmousedown(e)
+      
     svg.onmouseup = (e) =>
-      @viewer.wfits.canvas.onmouseup(e) if @panKey
+      
+      # Propagate to annotation layer if down coordinates match up coordinates
+      if @xDown is e.pageX and @yDown is e.pageY
+        @toAnnotate = true
+      else
+        @toAnnotate = false
+      return if @viewer.wfits.drag is false
+      
+      @viewer.wfits.canvas.onmouseup(e)
+      
     svg.onmousemove = (e) =>
-      if @panKey
-        # Pass event to WebFITS object
-        @viewer.wfits.canvas.onmousemove(e)
+      # Pass event to WebFITS object
+      @viewer.wfits.canvas.onmousemove(e)
+      
+      # TODO: Find more efficient way to do this
+      for key, a of @annotations
+        return if a.drag
+      
+      if @viewer.wfits.drag
+        # Update Annotation class attributes
+        Annotation.xOffset = xOffset = @viewer.wfits.xOffset
+        Annotation.yOffset = yOffset = @viewer.wfits.yOffset
         
-        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
           
-          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})")
+          a.gRoot.setAttribute("transform", "translate(#{x}, #{y})")
           
     svg.onmouseout = (e) =>
-      @viewer.wfits.canvas.onmouseout(e) if @panKey
+      @viewer.wfits.canvas.onmouseout(e)
     svg.onmouseover = (e) =>
-      @viewer.wfits.canvas.onmouseover(e) if @panKey
+      @viewer.wfits.canvas.onmouseover(e)
   
   onViewerClose: (e) =>
     @maskEl.removeClass('show')
     @viewerEl.removeClass('show')
+    
+    # Allow annotation again
+    @toAnnotate = true
     
     # Reset Annotation attributes
     Annotation.xOffset = -220.5

  
  maxAnnotations: 5
  initialFetch: true
  panKey: false
  isTrainingSubject: false
  
  subjectGroup: '5154a3783ae74086ab000001'

  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
