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
true
when the Minimap can scroll. -
::constructor(options = {})
Creates a new Minimap instance for the given
TextEditor
. -
Number ::getCapedTextEditorScrollRatio()
Returns the
TextEditor
scroll as a value normalized between0
and1
. - 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
minimap
settings. -
Number ::getHorizontalScaleFactor()
Returns the horizontal scaling factor when converting coordinates from the
TextEditor
to 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
TextEditor
that this minimap represents. -
Number ::getTextEditorMaxScrollTop()
Returns the maximum scroll the
TextEditor
can perform. -
Number ::getTextEditorScaledHeight()
Returns the height of the
TextEditor
at the Minimap scale. -
Number ::getTextEditorScaledScrollLeft()
Returns the
TextEditor::getScrollLeft
value at the Minimap scale. -
Number ::getTextEditorScaledScrollTop()
Returns the
TextEditor::getScrollTop
value at the Minimap scale. -
Number ::getTextEditorScrollRatio()
Returns the
TextEditor
scroll as a value normalized between0
and1
. -
Number ::getVerticalScaleFactor()
Returns the vertical scaling factor when converting coordinates from the
TextEditor
to the Minimap. - Number ::getVisibleHeight() Returns the height the Minimap will take on screen.
-
::onDidChange(callback)
Calls the
callback
when changes have been made in the buffer or in the minimap that alter the minimap display. -
::onDidChangeConfig(callback)
Calls the
callback
when changes have been made in the configuration fields of theminimap
package. -
::onDidChangeScrollLeft(callback)
Calls the
callback
when the text editorscrollLeft
value have been changed. -
::onDidChangeScrollTop(callback)
Calls the
callback
when the text editorscrollTop
value have been changed. -
::onDidDestroy(callback)
Calls the
callback
when 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.