Abstract Class: AbstractMapTextLabel
Defined in: src/sdk/components/map/MapTextLabel.ts:99
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:172
Constructor.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | string | Subscribable<string> | The text of this label, or a subscribable which provides it. |
priority | number | Subscribable<number> | The render priority of this label, or a subscribable which provides it. |
options? | AbstractMapTextLabelOptions | Options with which to initialize this label. |
Returns
AbstractMapTextLabel
Properties
anchor
readonlyanchor:Subscribable<Readonly<Omit<Float64Array<ArrayBufferLike>,"set"|"sort"|"copyWithin">>>
Defined in: src/sdk/components/map/MapTextLabel.ts:112
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
readonlybgBorderRadius:Subscribable<number>
Defined in: src/sdk/components/map/MapTextLabel.ts:139
The border radius of this label's background.
bgColor
readonlybgColor:Subscribable<string>
Defined in: src/sdk/components/map/MapTextLabel.ts:133
This label's background color.
bgOutlineColor
readonlybgOutlineColor:Subscribable<string>
Defined in: src/sdk/components/map/MapTextLabel.ts:145
The outline color of this label's background.
bgOutlineWidth
readonlybgOutlineWidth:Subscribable<number>
Defined in: src/sdk/components/map/MapTextLabel.ts:142
The outline width of this label's background.
bgPadding
readonlybgPadding:Subscribable<Readonly<Omit<Float64Array<ArrayBufferLike>,"set"|"sort"|"copyWithin">>>
Defined in: src/sdk/components/map/MapTextLabel.ts:136
The padding of this label's background, in pixels. Expressed as [top, right, bottom, left].
drawData
protectedreadonlydrawData:object
Defined in: src/sdk/components/map/MapTextLabel.ts:159
size
size:
Float64Array<ArrayBufferLike>
textSize
textSize:
Float64Array<ArrayBufferLike>
textTopLeft
textTopLeft:
Float64Array<ArrayBufferLike>
topLeft
topLeft:
Float64Array<ArrayBufferLike>
font
readonlyfont:Subscribable<string>
Defined in: src/sdk/components/map/MapTextLabel.ts:115
The font type of this label.
fontColor
readonlyfontColor:Subscribable<string>
Defined in: src/sdk/components/map/MapTextLabel.ts:121
The font color of this label.
fontOutlineColor
readonlyfontOutlineColor:Subscribable<string>
Defined in: src/sdk/components/map/MapTextLabel.ts:127
The font outline color of this label.
fontOutlineWidth
readonlyfontOutlineWidth:Subscribable<number>
Defined in: src/sdk/components/map/MapTextLabel.ts:124
The font outline width of this label, in pixels.
fontSize
readonlyfontSize:Subscribable<number>
Defined in: src/sdk/components/map/MapTextLabel.ts:118
The font size of this label, in pixels.
onDraw
readonlyonDraw:ReadonlySubEvent<AbstractMapTextLabel,AbstractMapTextLabelDrawData>
Defined in: src/sdk/components/map/MapTextLabel.ts:157
An event that notifies subscribers when this label is drawn (when draw() is called). The sender of
the event is this label. The event data describes the draw operation that triggered the event. When the draw operation
did not draw a visible label, the event is triggered with all NaN values.
The data object passed to event handlers is only guaranteed to be valid at the moment the handler is called. If a handler needs to retain the data past this moment, then it is recommended that a copy of the data be made.
priority
readonlypriority:Subscribable<number>
Defined in: src/sdk/components/map/MapTextLabel.ts:106
The render priority of this label. Higher numbers will render on top of labels with lower numbers when used with a MapCullableTextLabelManager.
Implementation of
showBg
readonlyshowBg:Subscribable<boolean>
Defined in: src/sdk/components/map/MapTextLabel.ts:130
Whether to show the background for this label.
text
readonlytext:Subscribable<string>
Defined in: src/sdk/components/map/MapTextLabel.ts:103
The text of this label.
Implementation of
tempVec2
protectedreadonlystatictempVec2:Float64Array<ArrayBuffer>
Defined in: src/sdk/components/map/MapTextLabel.ts:100
Methods
draw()
draw(
context,mapProjection):void
Defined in: src/sdk/components/map/MapTextLabel.ts:209
Draws this label to a canvas.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | CanvasRenderingContext2D | The canvas rendering context to use to draw. |
mapProjection | MapProjection | The projection to use to project the location of the label. |
Returns
void
Implementation of
drawBackground()
protecteddrawBackground(context,centerX,centerY,width,height):void
Defined in: src/sdk/components/map/MapTextLabel.ts:296
Draws this label's background to a canvas.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | CanvasRenderingContext2D | The canvas rendering context. |
centerX | number | The x-coordinate of the center of the label, in pixels. |
centerY | number | the y-coordinate of the center of the label, in pixels. |
width | number | The width of the background, in pixels. |
height | number | The height of the background, in pixels. |
Returns
void
drawText()
protecteddrawText(context,centerX,centerY):void
Defined in: src/sdk/components/map/MapTextLabel.ts:275
Draws this label's text to a canvas.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | CanvasRenderingContext2D | The canvas rendering context. |
centerX | number | The x-coordinate of the center of the label, in pixels. |
centerY | number | the y-coordinate of the center of the label, in pixels. |
Returns
void
getLastDrawData()
getLastDrawData():
AbstractMapTextLabelDrawData
Defined in: src/sdk/components/map/MapTextLabel.ts:204
Gets data describing this label's last executed drawing operation (the last time that draw() was
called). If the label has not been drawn yet or the last draw operation did not draw a visible label, then
the data will report all NaN values.
Returns
Data describing this label's last executed drawing operation. The returned data object passed is only guaranteed to be valid at the moment it is returned. If you need to retain the data past this moment, then it is recommended that a copy of the data be made.
getPosition()
abstractprotectedgetPosition(mapProjection,out):Float64Array
Defined in: src/sdk/components/map/MapTextLabel.ts:257
Gets the projected position of the label, in pixels.
Parameters
| Parameter | Type | Description |
|---|---|---|
mapProjection | MapProjection | The map projection to use. |
out | Float64Array | The vector to which to write the result. |
Returns
Float64Array
The projected position of the label.
loadBackgroundPath()
protectedloadBackgroundPath(context,left,top,width,height,radius):void
Defined in: src/sdk/components/map/MapTextLabel.ts:347
Loads the path of this label's background to a canvas rendering context.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | CanvasRenderingContext2D | The canvas rendering context to use. |
left | number | The x-coordinate of the left edge of the background, in pixels. |
top | number | The y-coordinate of the top edge of the background, in pixels. |
width | number | The width of the background, in pixels. |
height | number | The height of the background, in pixels. |
radius | number | The border radius of the background, in pixels. |
Returns
void
setTextStyle()
protectedsetTextStyle(context):void
Defined in: src/sdk/components/map/MapTextLabel.ts:263
Loads this label's text style to a canvas rendering context.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | CanvasRenderingContext2D | The canvas rendering context to use. |
Returns
void