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
-
Boolean ::canScroll()
Returns
truewhen the Minimap can scroll. -
::constructor(options = {})
Creates a new Minimap instance for the given
TextEditor. -
Number ::getCapedTextEditorScrollRatio()
Returns the
TextEditorscroll as a value normalized between0and1. - Number ::getCharHeight() Returns the height of a character in the Minimap in pixels.
- Number ::getCharWidth() Returns the width of a character in the Minimap in pixels.
- Number ::getFirstVisibleScreenRow() Returns the index of the first visible row in the Minimap.
-
Number ::getHeight()
Returns the height of the whole minimap in pixels based on the
minimapsettings. -
Number ::getHorizontalScaleFactor()
Returns the horizontal scaling factor when converting coordinates from the
TextEditorto the Minimap. - Number ::getInterline() Returns the space between lines in the Minimap in pixels.
- Number ::getLastVisibleScreenRow() Returns the index of the last visible row in the Minimap.
- Number ::getLineHeight() Returns the height of a line in the Minimap in pixels.
- Number ::getMaxScrollTop() Returns the maximum scroll value of the Minimap.
- Number ::getScrollTop() Returns the current scroll of the Minimap.
-
::getTextEditor()
Returns the
TextEditorthat this minimap represents. -
Number ::getTextEditorMaxScrollTop()
Returns the maximum scroll the
TextEditorcan perform. -
Number ::getTextEditorScaledHeight()
Returns the height of the
TextEditorat the Minimap scale. -
Number ::getTextEditorScaledScrollLeft()
Returns the
TextEditor::getScrollLeftvalue at the Minimap scale. -
Number ::getTextEditorScaledScrollTop()
Returns the
TextEditor::getScrollTopvalue at the Minimap scale. -
Number ::getTextEditorScrollRatio()
Returns the
TextEditorscroll as a value normalized between0and1. -
Number ::getVerticalScaleFactor()
Returns the vertical scaling factor when converting coordinates from the
TextEditorto the Minimap. - Number ::getVisibleHeight() Returns the height the Minimap will take on screen.
-
::onDidChange(callback)
Calls the
callbackwhen changes have been made in the buffer or in the minimap that alter the minimap display. -
::onDidChangeConfig(callback)
Calls the
callbackwhen changes have been made in the configuration fields of theminimappackage. -
::onDidChangeScrollLeft(callback)
Calls the
callbackwhen the text editorscrollLeftvalue have been changed. -
::onDidChangeScrollTop(callback)
Calls the
callbackwhen the text editorscrollTopvalue have been changed. -
::onDidDestroy(callback)
Calls the
callbackwhen this Minimap was destroyed.
Constructor Details
Instance Method Details
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.
Number ::getFirstVisibleScreenRow() Source
Returns the index of the first visible row in the Minimap.
Number ::getHeight() Source
Returns the height of the whole minimap in pixels based on the minimap settings.
Number ::getHorizontalScaleFactor() Source
Returns the horizontal scaling factor when converting coordinates from the TextEditor to the Minimap.
Number ::getScrollTop() Source
::getTextEditor() Source
Returns the TextEditor that this minimap represents.
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.
Number ::getTextEditorScaledHeight() Source
Returns the height of the TextEditor at the Minimap scale.
Number ::getTextEditorScaledScrollLeft() Source
Returns the TextEditor::getScrollLeft value at the Minimap scale.
Number ::getTextEditorScaledScrollTop() Source
Returns the TextEditor::getScrollTop value at the Minimap scale.
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.
Number ::getVerticalScaleFactor() Source
Returns the vertical scaling factor when converting coordinates from the TextEditor to the Minimap.
Number ::getVisibleHeight() Source
::onDidChange(callback) Source
Calls the callback when changes have been made in the buffer or in the minimap that alter the minimap display.
::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.
::onDidChangeScrollLeft(callback) Source
Calls the callback when the text editor scrollLeft value have been changed.
::onDidChangeScrollTop(callback) Source
Calls the callback when the text editor scrollTop value have been changed.