Minimap
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.
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) Creates a new Minimap instance for the given |
Method Summary
Public Methods | ||
public |
Returns |
|
public |
destroy() Destroys the model. |
|
public |
Returns the |
|
public |
Returns the height of a character in the Minimap in pixels. |
|
public |
Returns the width of a character in the Minimap in pixels. |
|
public |
Returns the index of the first visible row in the Minimap. |
|
public |
Returns the height of the whole minimap in pixels based on the |
|
public |
Returns the horizontal scaling factor when converting coordinates from the
|
|
public |
Returns the height of an interline in the Minimap in pixels. |
|
public |
Returns the index of the last visible row in the Minimap. |
|
public |
Returns the height of a line in the Minimap in pixels. |
|
public |
Returns the maximum scroll value of the Minimap. |
|
public |
Returns the height the minimap should take once displayed, it's either
the height of the |
|
public |
Returns the width the Minimap should take once displayed, it's either the
width of the Minimap content or the provided |
|
public |
Returns the current scroll of the Minimap. |
|
public |
getTextEditor(): TextEditor Returns the |
|
public |
Returns the height of the |
|
public |
Returns the |
|
public |
Returns the height of the |
|
public |
Returns the |
|
public |
Returns the |
|
public |
Returns the |
|
public |
Returns the |
|
public |
Returns the |
|
public |
Returns the vertical scaling factor when converting coordinates from the
|
|
public |
Returns the height the Minimap content will take on screen. |
|
public |
Returns the width the whole Minimap will take on screen. |
|
public |
Returns the width of the whole minimap in pixels based on the |
|
public |
Returns |
|
public |
Returns |
|
public |
onDidChange(callback: function(event: Object): void): Disposable Registers an event listener to the |
|
public |
onDidChangeConfig(callback: function(): void): Disposable Registers an event listener to the |
|
public |
onDidChangeScrollLeft(callback: function(minimap: Minimap): void): Disposable Registers an event listener to the |
|
public |
onDidChangeScrollTop(callback: function(minimap: Minimap): void): Disposable Registers an event listener to the |
|
public |
onDidChangeStandAlone(callback: function(minimap: Minimap): void): Disposable Registers an event listener to the |
|
public |
onDidDestroy(callback: function(): void): Disposable Registers an event listener to the |
|
public |
setCharHeight(charHeight: number) Sets the char height for this Minimap. |
|
public |
setCharWidth(charWidth: number) Sets the char width for this Minimap. |
|
public |
setInterline(interline: number) Sets the interline height for this Minimap. |
|
public |
setScreenHeightAndWidth(height: number, width: number) Sets the preferred height and width when in stand-alone mode. |
|
public |
setScrollTop(scrollTop: number) Sets the minimap scroll top value when in stand-alone mode. |
|
public |
setStandAlone(standAlone: boolean) Sets the stand-alone mode for this minimap. |
|
public |
setTextEditorScrollTop(scrollTop: number) Sets the scroll top of the |
Public Constructors
public constructor(options: Object) source
Creates a new Minimap instance for the given TextEditor
.
Params:
Name | Type | Attribute | Description |
options | Object | an object with the new Minimap properties |
|
options.textEditor | TextEditor | the target text editor for the minimap |
|
options.standAlone | boolean |
|
whether this minimap is in stand-alone mode or not |
options.width | number |
|
the minimap width in pixels |
options.height | number |
|
the minimap height in pixels |
Throw:
Cannot create a minimap without an editor |
Public Methods
public getCapedTextEditorScrollRatio(): number source
Returns the TextEditor
scroll as a value normalized between 0
and 1
.
The returned value will always be strictly between 0
and 1
.
public getFirstVisibleScreenRow(): number source
Returns the index of the first visible row in the Minimap.
public getHeight(): number source
Returns the height of the whole minimap in pixels based on the minimap
settings.
public getHorizontalScaleFactor(): number source
Returns the horizontal scaling factor when converting coordinates from the
TextEditor
to the Minimap.
public getLastVisibleScreenRow(): number source
Returns the index of the last visible row in the Minimap.
public getScreenHeight(): number source
Returns the height the minimap should take once displayed, it's either
the height of the TextEditor
or the provided height
when in stand-alone
mode.
public getScreenWidth(): number source
Returns the width the Minimap should take once displayed, it's either the
width of the Minimap content or the provided width
when in standAlone
mode.
public getScrollTop(): number source
Returns the current scroll of the Minimap.
The Minimap can scroll only when its height is greater that the height
of its TextEditor
.
public getTextEditor(): TextEditor source
Returns the TextEditor
that this minimap represents.
Return:
TextEditor | this Minimap's text editor |
public getTextEditorMaxScrollTop(): number source
Returns the TextEditor
maximum scroll top value.
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.
public getTextEditorScaledHeight(): number source
Returns the height of the TextEditor
at the Minimap scale.
public getTextEditorScaledScrollLeft(): number source
Returns the TextEditor
scroll left value at the Minimap scale.
public getTextEditorScaledScrollTop(): number source
Returns the TextEditor
scroll top value at the Minimap scale.
public getTextEditorScrollRatio(): number 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
.
public getVerticalScaleFactor(): number source
Returns the vertical scaling factor when converting coordinates from the
TextEditor
to the Minimap.
public getVisibleHeight(): number source
Returns the height the Minimap content will take on screen.
When the Minimap height is greater than the TextEditor
height, the
TextEditor
height is returned instead.
public getWidth(): number source
Returns the width of the whole minimap in pixels based on the minimap
settings.
public isStandAlone(): boolean source
Returns true
when the current Minimap is a stand-alone minimap.
public onDidChange(callback: function(event: Object): void): Disposable source
Registers an event listener to the did-change
event.
Params:
Name | Type | Attribute | Description |
callback | function(event: Object): void | a function to call when the event is triggered. the callback will be called with an event object with the following properties:
|
Return:
Disposable | a disposable to stop listening to the event |
public onDidChangeConfig(callback: function(): void): Disposable source
Registers an event listener to the did-change-config
event.
Params:
Name | Type | Attribute | Description |
callback | function(): void | a function to call when the event is triggered. |
Return:
Disposable | a disposable to stop listening to the event |
public onDidChangeScrollLeft(callback: function(minimap: Minimap): void): Disposable source
Registers an event listener to the did-change-scroll-left
event.
Return:
Disposable | a disposable to stop listening to the event |
public onDidChangeScrollTop(callback: function(minimap: Minimap): void): Disposable source
Registers an event listener to the did-change-scroll-top
event.
The event is dispatched when the text editor scrollTop
value have been
changed or when the minimap scroll top have been changed in stand-alone
mode.
Return:
Disposable | a disposable to stop listening to the event |
public onDidChangeStandAlone(callback: function(minimap: Minimap): void): Disposable source
Registers an event listener to the did-change-stand-alone
event.
This event is dispatched when the stand-alone of the current Minimap is either enabled or disabled.
Return:
Disposable | a disposable to stop listening to the event |
public onDidDestroy(callback: function(): void): Disposable source
Registers an event listener to the did-destroy
event.
This event is dispatched when this Minimap have been destroyed. It can occurs either because the destroy method have been called on the Minimap or because the target text editor have been destroyed.
Params:
Name | Type | Attribute | Description |
callback | function(): void | a function to call when the event is triggered. |
Return:
Disposable | a disposable to stop listening to the event |
public setCharHeight(charHeight: number) source
Sets the char height for this Minimap. This value will override the
value from the config for this instance only. A did-change-config
event is dispatched.
Params:
Name | Type | Attribute | Description |
charHeight | number | the new height of a char in the Minimap |
Emit:
did-change-config |
when the value is changed |
public setCharWidth(charWidth: number) source
Sets the char width for this Minimap. This value will override the
value from the config for this instance only. A did-change-config
event is dispatched.
Params:
Name | Type | Attribute | Description |
charWidth | number | the new width of a char in the Minimap |
Emit:
did-change-config |
when the value is changed |
public setInterline(interline: number) source
Sets the interline height for this Minimap. This value will override the
value from the config for this instance only. A did-change-config
event is dispatched.
Params:
Name | Type | Attribute | Description |
interline | number | the new height of an interline in the Minimap |
Emit:
did-change-config |
when the value is changed |
public setScreenHeightAndWidth(height: number, width: number) source
Sets the preferred height and width when in stand-alone mode.
This method is called by the <MinimapElement> for this Minimap so that the model is kept in sync with the view.
public setScrollTop(scrollTop: number) source
Sets the minimap scroll top value when in stand-alone mode.
Params:
Name | Type | Attribute | Description |
scrollTop | number | the new scroll top for the Minimap |
Emit:
did-change-scroll-top |
if the Minimap's stand-alone mode is enabled |