import DecorationManagement from 'minimap/lib/mixins/decoration-management.js'
DecorationManagement
Extends:
The mixin that provides the decorations API to the minimap editor view.
This mixin is injected into the Minimap
prototype, so every methods defined
in this file will be available on any Minimap
instance.
Method Summary
Public Methods | ||
public |
decorateMarker(marker: Marker, decorationParams: Object): Decoration Adds a decoration that tracks a |
|
public |
decorationForId(id: number): Decoration Returns the decoration with the passed-in id. |
|
public |
Returns the decorations that intersects the passed-in row range in a structured way. |
|
public |
decorationsForScreenRowRange(startScreenRow: number, endScreenRow: number): Array<Decoration> Returns all the decorations that intersect the passed-in row range. |
|
public |
Returns all the decorations registered in the current |
|
public |
Initializes the decorations related properties. |
|
public |
Invalidates the decoration by screen rows cache. |
|
public |
onDidAddDecoration(callback: function(event: Object): void): Disposable Registers an event listener to the |
|
public |
onDidChangeDecoration(callback: function(event: Object): void): Disposable Registers an event listener to the |
|
public |
onDidChangeDecorationRange(callback: function(event: Object): void): Disposable Registers an event listener to the |
|
public |
onDidRemoveDecoration(callback: function(event: Object): void): Disposable Registers an event listener to the |
|
public |
onDidUpdateDecoration(callback: function(decoration: Decoration): void): Disposable Registers an event listener to the |
|
public |
Removes all the decorations that was created in the current |
|
public |
removeAllDecorationsForMarker(marker: Marker) Removes all the decorations registered for the passed-in marker. |
|
public |
removeDecoration(decoration: Decoration) Removes a |
Public Methods
public decorateMarker(marker: Marker, decorationParams: Object): Decoration source
Adds a decoration that tracks a Marker
. When the marker moves,
is invalidated, or is destroyed, the decoration will be updated to reflect
the marker's state.
Params:
Name | Type | Attribute | Description |
marker | Marker | the marker you want this decoration to follow |
|
decorationParams | Object | the decoration properties |
|
decorationParams.type | string | the decoration type in the following list:
|
|
decorationParams.class | string | the CSS class to use to retrieve
the background color of the
decoration by building a scop
corresponding to
|
|
decorationParams.scope | string | the scope to use to retrieve the
decoration background. Note that if
the |
|
decorationParams.color | string | the CSS color to use to render the
decoration. When set, neither
|
Emit:
did-add-decoration |
when the decoration is created successfully |
did-change |
when the decoration is created successfully |
public decorationForId(id: number): Decoration source
Returns the decoration with the passed-in id.
Params:
Name | Type | Attribute | Description |
id | number | the decoration id |
public decorationsByTypeThenRows(): Object source
Returns the decorations that intersects the passed-in row range in a structured way.
At the first level, the keys are the available decoration types. At the second level, the keys are the row index for which there are decorations available. The value is an array containing the decorations that intersects with the corresponding row.
Return:
Object | the decorations grouped by type and then rows |
Return Properties:
Name | Type | Attribute | Description |
line | Object | all the line decorations by row |
|
line[row] | Array<Decoration> | all the line decorations at a given row |
|
highlight-under | Object | all the highlight-under decorations by row |
|
highlight-under[row] | Array<Decoration> | all the highlight-under decorations at a given row |
|
highlight-over | Object | all the highlight-over decorations by row |
|
highlight-over[row] | Array<Decoration> | all the highlight-over decorations at a given row |
|
highlight-outine | Object | all the highlight-outine decorations by row |
|
highlight-outine[row] | Array<Decoration> | all the highlight-outine decorations at a given row |
public decorationsForScreenRowRange(startScreenRow: number, endScreenRow: number): Array<Decoration> source
Returns all the decorations that intersect the passed-in row range.
public getDecorations(): Array<Decoration> source
Returns all the decorations registered in the current Minimap
.
public invalidateDecorationForScreenRowsCache() source
Invalidates the decoration by screen rows cache.
public onDidAddDecoration(callback: function(event: Object): void): Disposable source
Registers an event listener to the did-add-decoration
event.
Return:
Disposable | a disposable to stop listening to the event |
public onDidChangeDecoration(callback: function(event: Object): void): Disposable source
Registers an event listener to the did-change-decoration
event.
This event is triggered when the marker targeted by the decoration was changed.
Return:
Disposable | a disposable to stop listening to the event |
public onDidChangeDecorationRange(callback: function(event: Object): void): Disposable source
Registers an event listener to the did-change-decoration-range
event.
This event is triggered when the marker range targeted by the decoration was changed.
Return:
Disposable | a disposable to stop listening to the event |
public onDidRemoveDecoration(callback: function(event: Object): void): Disposable source
Registers an event listener to the did-remove-decoration
event.
Return:
Disposable | a disposable to stop listening to the event |
public onDidUpdateDecoration(callback: function(decoration: Decoration): void): Disposable source
Registers an event listener to the did-update-decoration
event.
This event is triggered when the decoration itself is modified.
Params:
Name | Type | Attribute | Description |
callback | function(decoration: Decoration): void | a function to call when the event is triggered |
Return:
Disposable | a disposable to stop listening to the event |
public removeAllDecorations() source
Removes all the decorations that was created in the current Minimap
.
public removeAllDecorationsForMarker(marker: Marker) source
Removes all the decorations registered for the passed-in marker.
Params:
Name | Type | Attribute | Description |
marker | Marker | the marker for which removing its decorations |
Emit:
did-change |
when a decoration have been removed |
did-remove-decoration |
when a decoration have been removed |
public removeDecoration(decoration: Decoration) source
Removes a Decoration
from this minimap.
Params:
Name | Type | Attribute | Description |
decoration | Decoration | the decoration to remove |
Emit:
did-change |
when the decoration is removed |
did-remove-decoration |
when the decoration is removed |