 
   isClicked: false
 
-  # VIEW CREATION/DESTRUCTION
-
+  ### Public ###
+
+  #    #### ##    ## #### ########
+  #     ##  ###   ##  ##     ##
+  #     ##  ####  ##  ##     ##
+  #     ##  ## ## ##  ##     ##
+  #     ##  ##  ####  ##     ##
+  #     ##  ##   ###  ##     ##
+  #    #### ##    ## ####    ##
+
+  # Creates a new {MinimapView}.
+  #
+  # editorView - The `EditorView` for which displaying a minimap.
   constructor: (@editorView) ->
     @editor = @editorView.getEditor()
     @paneView = @editorView.getPaneView()

    @renderView.destroy()
    @remove()

  # MINIMAP DISPLAY MANAGEMENT

  attachToPaneView: ->
    @paneView.append(this)
    @adjustTopPosition()

  detachFromPaneView: ->
    @detach()

  minimapIsAttached: -> @paneView.find('.minimap').length is 1

  # EDITOR VIEW MANAGEMENT

  unsubscribeFromEditor: ->
    @unsubscribe @editor, '.minimap' if @editor?
    @unsubscribe @scrollView, '.minimap' if @scrollView?

  subscribeToEditor: ->
    @subscribe @editor, 'scroll-top-changed.minimap', @updateScrollY
    # Hacked scroll-left
    @subscribe @scrollView, 'scroll.minimap', @updateScrollX

  getEditorViewClientRect: -> @scrollView[0].getBoundingClientRect()

  getScrollViewClientRect: -> @scrollViewLines[0].getBoundingClientRect()

  getMinimapClientRect: -> @[0].getBoundingClientRect()

  # UPDATE METHODS

  updateMinimapRenderView: => @renderView.update()

  updateMinimapSize: =>
    return unless @indicator?

    {width, height} = @getMinimapClientRect()
    editorViewRect = @getEditorViewClientRect()
    miniScrollViewRect = @renderView.getClientRect()

    evw = editorViewRect.width
    evh = editorViewRect.height

    minimapVisibilityRatio = miniScrollViewRect.height / height

    @miniScroller.height(evh / minimapVisibilityRatio)
    @miniScroller.toggleClass 'visible', minimapVisibilityRatio > 1 and @miniScrollVisible

    @miniWrapper.css {width}

    # VisibleArea's size
    @indicator.height = evh * @scaleY
    @indicator.width = width / @scaleX

    @miniVisibleArea.css
      width : width / @scaleX
      height: evh * @scaleY

    msvw = miniScrollViewRect.width || 0
    msvh = miniScrollViewRect.height || 0

    # Minimap's size
    @indicator.setWrapperSize width, Math.min(height, msvh)

    # Minimap ScrollView's size
    @indicator.setScrollerSize msvw, msvh

    # Compute boundary
    @indicator.updateBoundary()


  updateMinimapView: =>
    return unless @editorView
    return unless @indicator

      @updateScroll()
      @frameRequested = false

  # Calls the `update` method of the {MinimapRenderView}.
  updateMinimapRenderView: => @renderView.update()

  # Internal: Updates the size of the minimap according to the new
  # size of the editor.
  updateMinimapSize: =>
    return unless @indicator?

    {width, height} = @getMinimapClientRect()
    editorViewRect = @getEditorViewClientRect()
    miniScrollViewRect = @renderView.getClientRect()

    evw = editorViewRect.width
    evh = editorViewRect.height

    minimapVisibilityRatio = miniScrollViewRect.height / height

    @miniScroller.height(evh / minimapVisibilityRatio)
    @miniScroller.toggleClass 'visible', minimapVisibilityRatio > 1 and @miniScrollVisible

    @miniWrapper.css {width}

    # VisibleArea's size
    @indicator.height = evh * @scaleY
    @indicator.width = width / @scaleX

    @miniVisibleArea.css
      width : width / @scaleX
      height: evh * @scaleY

    msvw = miniScrollViewRect.width || 0
    msvh = miniScrollViewRect.height || 0

    # Minimap's size
    @indicator.setWrapperSize width, Math.min(height, msvh)

    # Minimap ScrollView's size
    @indicator.setScrollerSize msvw, msvh

    # Compute boundary
    @indicator.updateBoundary()

  # Internal: Updates the vertical scrolling of the minimap.
  #
  # top - The scroll top offset {Number}.
  updateScrollY: (top) =>
    # Need scroll-top value when in find pane or on Vim mode(`gg`, `shift+g`).
    # Or we can find a better solution.
