Skip to main content

Abstract Class: AbstractMapTextLabel

Defined in: src/sdk/components/map/MapTextLabel.ts:76

An abstract implementation of a map text label.

Extended by​

Implements​

Constructors​

Constructor​

new AbstractMapTextLabel(text, priority, options?): AbstractMapTextLabel

Defined in: src/sdk/components/map/MapTextLabel.ts:132

Constructor.

Parameters​

ParameterTypeDescription
textstring | Subscribable<string>The text of this label, or a subscribable which provides it.
prioritynumber | Subscribable<number>The render priority of this label, or a subscribable which provides it.
options?AbstractMapTextLabelOptionsOptions with which to initialize this label.

Returns​

AbstractMapTextLabel

Properties​

anchor​

readonly anchor: Subscribable<Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>>

Defined in: src/sdk/components/map/MapTextLabel.ts:89

The anchor point of this label, expressed relative to this label's width/height. [0, 0] is the top-left corner, and [1, 1] is the bottom-right corner.


bgBorderRadius​

readonly bgBorderRadius: Subscribable<number>

Defined in: src/sdk/components/map/MapTextLabel.ts:116

The border radius of this label's background.


bgColor​

readonly bgColor: Subscribable<string>

Defined in: src/sdk/components/map/MapTextLabel.ts:110

This label's background color.


bgOutlineColor​

readonly bgOutlineColor: Subscribable<string>

Defined in: src/sdk/components/map/MapTextLabel.ts:122

The outline color of this label's background.


bgOutlineWidth​

readonly bgOutlineWidth: Subscribable<number>

Defined in: src/sdk/components/map/MapTextLabel.ts:119

The outline width of this label's background.


bgPadding​

readonly bgPadding: Subscribable<Readonly<Omit<Float64Array, "set" | "sort" | "copyWithin">>>

Defined in: src/sdk/components/map/MapTextLabel.ts:113

The padding of this label's background, in pixels. Expressed as [top, right, bottom, left].


font​

readonly font: Subscribable<string>

Defined in: src/sdk/components/map/MapTextLabel.ts:92

The font type of this label.


fontColor​

readonly fontColor: Subscribable<string>

Defined in: src/sdk/components/map/MapTextLabel.ts:98

The font color of this label.


fontOutlineColor​

readonly fontOutlineColor: Subscribable<string>

Defined in: src/sdk/components/map/MapTextLabel.ts:104

The font outline color of this label.


fontOutlineWidth​

readonly fontOutlineWidth: Subscribable<number>

Defined in: src/sdk/components/map/MapTextLabel.ts:101

The font outline width of this label, in pixels.


fontSize​

readonly fontSize: Subscribable<number>

Defined in: src/sdk/components/map/MapTextLabel.ts:95

The font size of this label, in pixels.


priority​

readonly priority: Subscribable<number>

Defined in: src/sdk/components/map/MapTextLabel.ts:83

The render priority of this label. Higher numbers will render on top of labels with lower numbers when used with a MapCullableTextLabelManager.

Implementation of​

MapTextLabel.priority


showBg​

readonly showBg: Subscribable<boolean>

Defined in: src/sdk/components/map/MapTextLabel.ts:107

Whether to show the background for this label.


text​

readonly text: Subscribable<string>

Defined in: src/sdk/components/map/MapTextLabel.ts:80

The text of this label.

Implementation of​

MapTextLabel.text


tempVec2​

protected readonly static tempVec2: Float64Array

Defined in: src/sdk/components/map/MapTextLabel.ts:77

Methods​

draw()​

draw(context, mapProjection): void

Defined in: src/sdk/components/map/MapTextLabel.ts:157

Draws this label to a canvas.

Parameters​

ParameterTypeDescription
contextCanvasRenderingContext2DThe canvas rendering context to use to draw.
mapProjectionMapProjectionThe projection to use to project the location of the label.

Returns​

void

Implementation of​

MapTextLabel.draw


drawBackground()​

protected drawBackground(context, centerX, centerY, width, height): void

Defined in: src/sdk/components/map/MapTextLabel.ts:230

Draws this label's background to a canvas.

Parameters​

ParameterTypeDescription
contextCanvasRenderingContext2DThe canvas rendering context.
centerXnumberThe x-coordinate of the center of the label, in pixels.
centerYnumberthe y-coordinate of the center of the label, in pixels.
widthnumberThe width of the background, in pixels.
heightnumberThe height of the background, in pixels.

Returns​

void


drawText()​

protected drawText(context, centerX, centerY): void

Defined in: src/sdk/components/map/MapTextLabel.ts:209

Draws this label's text to a canvas.

Parameters​

ParameterTypeDescription
contextCanvasRenderingContext2DThe canvas rendering context.
centerXnumberThe x-coordinate of the center of the label, in pixels.
centerYnumberthe y-coordinate of the center of the label, in pixels.

Returns​

void


getPosition()​

abstract protected getPosition(mapProjection, out): Float64Array

Defined in: src/sdk/components/map/MapTextLabel.ts:191

Gets the projected position of the label, in pixels.

Parameters​

ParameterTypeDescription
mapProjectionMapProjectionThe map projection to use.
outFloat64ArrayThe vector to which to write the result.

Returns​

Float64Array

The projected position of the label.


loadBackgroundPath()​

protected loadBackgroundPath(context, left, top, width, height, radius): void

Defined in: src/sdk/components/map/MapTextLabel.ts:278

Loads the path of this label's background to a canvas rendering context.

Parameters​

ParameterTypeDescription
contextCanvasRenderingContext2DThe canvas rendering context to use.
leftnumberThe x-coordinate of the left edge of the background, in pixels.
topnumberThe y-coordinate of the top edge of the background, in pixels.
widthnumberThe width of the background, in pixels.
heightnumberThe height of the background, in pixels.
radiusnumberThe border radius of the background, in pixels.

Returns​

void


setTextStyle()​

protected setTextStyle(context): void

Defined in: src/sdk/components/map/MapTextLabel.ts:197

Loads this label's text style to a canvas rendering context.

Parameters​

ParameterTypeDescription
contextCanvasRenderingContext2DThe canvas rendering context to use.

Returns​

void