CanvasDrawer
Extends:
The CanvasDrawer mixin is responsible for the rendering of a Minimap
in a canvas element.
This mixin is injected in the MinimapElement prototype, so all these
methods are available on any MinimapElement instance.
Member Summary
| Public Members | ||
| public |
backLayer: CanvasLayer The canvas layer for decorations below the text. |
|
| public |
frontLayer: CanvasLayer The canvas layer for decorations above the text. |
|
| public |
tokensLayer: CanvasLayer The main canvas layer where lines are rendered. |
|
Method Summary
| Public Methods | ||
| public |
getDecorationColor(decoration: Decoration): string Returns the background color for the passed-in |
|
| public |
Returns the default text color for an editor content. |
|
| public |
getFrontCanvas(): HTMLCanvasElement Returns the uppermost canvas in the MinimapElement. |
|
| public |
Returns the opacity value to use when rendering the |
|
| public |
getTokenColor(token: Object): string Returns the text color for the passed-in |
|
| public |
Initializes the canvas elements needed to perform the |
|
| public |
Performs an update of the rendered |
|
Public Members
Public Methods
public getDecorationColor(decoration: Decoration): string source
Returns the background color for the passed-in decoration object.
The color value is read from the DOM by creating a node structure that
match the decoration scope property unless the decoration provides
its own color property.
Params:
| Name | Type | Attribute | Description |
| decoration | Decoration | the decoration to get the color for |
public getDefaultColor(): string source
Returns the default text color for an editor content.
The color value is directly read from the TextEditorView computed styles.
public getFrontCanvas(): HTMLCanvasElement source
Returns the uppermost canvas in the MinimapElement.
Return:
| HTMLCanvasElement | the html canvas element |
public getTextOpacity(): Number source
Returns the opacity value to use when rendering the Minimap text.
public getTokenColor(token: Object): string source
Returns the text color for the passed-in token object.
The color value is read from the DOM by creating a node structure that
match the token scope property.
Params:
| Name | Type | Attribute | Description |
| token | Object | a |
public initializeCanvas() source
Initializes the canvas elements needed to perform the Minimap rendering.
public updateCanvas() source
Performs an update of the rendered Minimap based on the changes
registered in the instance.