     newBounds
 
   didInsertElement: ->
-    component = @
-
     Ember.run.scheduleOnce 'afterRender', @, =>
       sdViewer = new OpenSeadragon
         hash: @elementId

          return if @isDestroying
          Em.run.debounce @, @timestampImage, 200
      sdViewer.addHandler 'canvas-drag', (info) =>
        component.sendAction 'sdBounds', sdViewer.viewport.getBounds()
      sdViewer.addHandler 'zoom', (info) =>
        component.sendAction 'sdZoom', info.zoom
        if sdViewer.viewport
          component.sendAction 'sdBounds', sdViewer.viewport.getBounds()

      sdViewer.addHandler 'open', (viewer, source) =>
        component.sendAction 'sdOpen', source
        @set 'sdViewport', @get('sdViewer').viewport

        @timestampImage()

    @set 'sectionEdited', undefined

    # send the section, the new logical bounds, and the new physical bounds
    physical = @get('sdViewport').viewportToImageRectangle(newBounds)
    Em.keys(physical).forEach (key) ->
      physical[key] = Math.round(physical[key])
    @sendAction 'sectionMoved', section, newBounds, physical

  # converts the distance moved to a logical distance. The returned values are end minus start
  diffPoint: (startX, startY, endX, endY) ->
