Class Minimap

Defined in: lib/minimap.coffee
Inherits: Model

Overview

The Minimap class is the underlying model of a MinimapElement. Most manipulations of the minimap is done through the model.

Any Minimap instance is tied to a TextEditor. Their lifecycle follow the one of their target TextEditor, so they are destroyed whenever their TextEditor is destroyed.

Instance Method Summary

Constructor Details

::constructor(options = {}) Source

Creates a new Minimap instance for the given TextEditor.

Parameters:

  • (Object) optionsAn Object with the following properties:
    • textEditorA TextEditor instance.

Instance Method Details

Boolean ::canScroll() Source

Returns true when the Minimap can scroll.

Returns:

Number ::getCapedTextEditorScrollRatio() Source

Returns the TextEditor scroll as a value normalized between 0 and 1.

The returned value will always be strictly between 0 and 1.

Returns:

  • (Number) — Returns a Number.

Number ::getCharHeight() Source

Returns the height of a character in the Minimap in pixels.

Returns:

  • (Number) — Returns a Number.

Number ::getCharWidth() Source

Returns the width of a character in the Minimap in pixels.

Returns:

  • (Number) — Returns a Number.

Number ::getFirstVisibleScreenRow() Source

Returns the index of the first visible row in the Minimap.

Returns:

  • (Number) — Returns a Number.

Number ::getHeight() Source

Returns the height of the whole minimap in pixels based on the minimap settings.

Returns:

  • (Number) — Returns a Number.

Number ::getHorizontalScaleFactor() Source

Returns the horizontal scaling factor when converting coordinates from the TextEditor to the Minimap.

Returns:

  • (Number) — Returns a Number.

Number ::getInterline() Source

Returns the space between lines in the Minimap in pixels.

Returns:

  • (Number) — Returns a Number.

Number ::getLastVisibleScreenRow() Source

Returns the index of the last visible row in the Minimap.

Returns:

  • (Number) — Returns a Number.

Number ::getLineHeight() Source

Returns the height of a line in the Minimap in pixels.

Returns:

  • (Number) — Returns a Number.

Number ::getMaxScrollTop() Source

Returns the maximum scroll value of the Minimap.

Returns:

  • (Number) — Returns a Number.

Number ::getScrollTop() Source

Returns the current scroll of the Minimap.

The Minimap can scroll only when its height is greater that the height of its TextEditor.

Returns:

  • (Number) — Returns a Number.

::getTextEditor() Source

Returns the TextEditor that this minimap represents.

Returns:

  • Returns a TextEditor.

Number ::getTextEditorMaxScrollTop() Source

Returns the maximum scroll the TextEditor can perform.

When the scrollPastEnd setting is enabled, the method compensate the extra scroll by removing the same height as added by the editor from the final value.

Returns:

  • (Number) — Returns a Number.

Number ::getTextEditorScaledHeight() Source

Returns the height of the TextEditor at the Minimap scale.

Returns:

  • (Number) — Returns a Number.

Number ::getTextEditorScaledScrollLeft() Source

Returns the TextEditor::getScrollLeft value at the Minimap scale.

Returns:

  • (Number) — Returns a Number.

Number ::getTextEditorScaledScrollTop() Source

Returns the TextEditor::getScrollTop value at the Minimap scale.

Returns:

  • (Number) — Returns a Number.

Number ::getTextEditorScrollRatio() Source

Returns the TextEditor scroll as a value normalized between 0 and 1.

When the scrollPastEnd setting is enabled the value may exceed 1 as the maximum scroll value used to compute this ratio compensate for the extra height in the editor. Use ::getCapedTextEditorScrollRatio when you need a value that is strictly between 0 and 1.

Returns:

  • (Number) — Returns a Number.

Number ::getVerticalScaleFactor() Source

Returns the vertical scaling factor when converting coordinates from the TextEditor to the Minimap.

Returns:

  • (Number) — Returns a Number.

Number ::getVisibleHeight() Source

Returns the height the Minimap will take on screen.

When the Minimap height is greater than the TextEditor height, the TextEditor height is returned instead.

Returns:

  • (Number) — Returns a Number.

::onDidChange(callback) Source

Calls the callback when changes have been made in the buffer or in the minimap that alter the minimap display.

Parameters:

  • (Function) callbackThe callback Function. The event the callback will receive a change Object with the following properties:
    • (Number) startThe Number of the change's start row.
    • (Number) endThe Number of the change's end row.
    • (Number) screenDeltaThe Number of rows affected by the changes.

Returns:

  • Returns a Disposable.

::onDidChangeConfig(callback) Source

Calls the callback when changes have been made in the configuration fields of the minimap package. As many computation are tied to these configurations this method allow to be notified when these fields changes.

Parameters:

  • (Function) callbackThe callback Function. The event the callback will receive a change Object with the following properties:
    • (String) configThe String name of the changed configuration.
    • valueThe new value of the configuration.

Returns:

  • Returns a Disposable.

::onDidChangeScrollLeft(callback) Source

Calls the callback when the text editor scrollLeft value have been changed.

Parameters:

  • (Function) callbackThe callback Function. The event the callback will receive the new scrollLeft Number value.

Returns:

  • Returns a Disposable.

::onDidChangeScrollTop(callback) Source

Calls the callback when the text editor scrollTop value have been changed.

Parameters:

  • (Function) callbackThe callback Function. The event the callback will receive the new scrollTop Number value.

Returns:

  • Returns a Disposable.

::onDidDestroy(callback) Source

Calls the callback when this Minimap was destroyed.

Parameters:

  • (Function) callbackThe callback Function.

Returns:

  • Returns a Disposable.