-
Name Type Description fontstring | undefined Font style as CSS
fontvalue, see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is'10px sans-serif'maxAnglenumber (defaults to Math.PI/4) When
placementis set to'line', allow a maximum angle between adjacent characters. The expected value is in radians, and the default is 45° (Math.PI / 4).offsetXnumber (defaults to 0) Horizontal text offset in pixels. A positive will shift the text right.
offsetYnumber (defaults to 0) Vertical text offset in pixels. A positive will shift the text down.
overflowboolean (defaults to false) For polygon labels or when
placementis set to'line', allow text to exceed the width of the polygon at the label position or the length of the path that it follows.placementTextPlacement (defaults to 'point') Text placement.
repeatnumber | undefined Repeat interval. When set, the text will be repeated at this interval, which specifies the distance between two text anchors in pixels. Only available when
placementis set to'line'. Overrides 'textAlign'.scalenumber | Size | undefined Scale.
rotateWithViewboolean (defaults to false) Whether to rotate the text with the view.
rotationnumber (defaults to 0) Rotation in radians (positive rotation clockwise).
textstring | Array.<string> | undefined Text content or rich text content. For plain text provide a string, which can contain line breaks (
\n). For rich text provide an array of text/font tuples. A tuple consists of the text to render and the font to use (or''to use the text style's font). A line break has to be a separate tuple (i.e.'\n', ''). Example:['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', '']will yield "foo bar baz". Note: Rich text is not supported forplacement: 'line'or the immediate rendering API.textAlignCanvasTextAlign | undefined Text alignment. Possible values:
'left','right','center','end'or'start'. Default is'center'forplacement: 'point'. Forplacement: 'line', the default is to let the renderer choose a placement wheremaxAngleis not exceeded.justifyTextJustify | undefined Text justification within the text box. If not set, text is justified towards the
textAlignanchor. Otherwise, use options'left','center', or'right'to justify the text within the text box. Note:justifyis ignored for immediate rendering and also forplacement: 'line'.textBaselineCanvasTextBaseline (defaults to 'middle') Text base line. Possible values:
'bottom','top','middle','alphabetic','hanging','ideographic'.fillFill | null | undefined Fill style. If none is provided, we'll use a dark fill-style (#333). Specify
nullfor no fill.strokeStroke | undefined Stroke style.
backgroundFillFill | undefined Fill style for the text background when
placementis'point'. Default is no fill.backgroundStrokeStroke | undefined Stroke style for the text background when
placementis'point'. Default is no stroke.paddingArray.<number> (defaults to [0, 0, 0, 0]) Padding in pixels around the text for decluttering and background. The order of values in the array is
[top, right, bottom, left].declutterModeDeclutterMode | undefined Declutter mode:
declutter,obstacle,none
Methods
-
Clones the style.
Returns:
The cloned style.
-
Get the background fill style for the text.
Returns:
Fill style.
-
Get the background stroke style for the text.
Returns:
Stroke style.
-
Get the declutter mode of the shape
Returns:
Shape's declutter mode
-
Get the fill style for the text.
Returns:
Fill style.
-
Get the font name.
Returns:
Font.
-
Get the justification.
Returns:
Justification.
-
Get the maximum angle between adjacent characters.
Returns:
Angle in radians.
-
Get the x-offset for the text.
Returns:
Horizontal text offset.
-
Get the y-offset for the text.
Returns:
Vertical text offset.
-
Get the
overflowconfiguration.Returns:
Let text overflow the length of the path they follow.
-
Get the padding for the text.
Returns:
Padding.
-
Get the label placement.
Returns:
Text placement.
-
Get the repeat interval of the text.
Returns:
Repeat interval in pixels.
-
Determine whether the text rotates with the map.
Returns:
Rotate with map.
-
Get the text rotation.
Returns:
Rotation.
-
Get the text scale.
Returns:
Scale.
-
Get the stroke style for the text.
Returns:
Stroke style.
-
Get the text to be rendered.
Returns:
Text.
-
Get the text alignment.
Returns:
Text align.
-
Get the text baseline.
Returns:
Text baseline.
-
Set the background fill.
Name Type Description fillFill | null Fill style.
-
Set the background stroke.
Name Type Description strokeStroke | null Stroke style.
-
Set the fill.
Name Type Description fillFill | null Fill style.
-
Set the font.
Name Type Description fontstring | undefined Font.
-
Set the justification.
Name Type Description justifyTextJustify | undefined Justification.
-
Set the maximum angle between adjacent characters.
Name Type Description maxAnglenumber Angle in radians.
-
Set the x offset.
Name Type Description offsetXnumber Horizontal text offset.
-
Set the y offset.
Name Type Description offsetYnumber Vertical text offset.
-
Set the
overflowproperty.Name Type Description overflowboolean Let text overflow the path that it follows.
-
Set the padding (
[top, right, bottom, left]).Name Type Description paddingArray.<number> | null Padding.
-
Set the text placement.
Name Type Description placementTextPlacement Placement.
-
Set the repeat interval of the text.
Name Type Description repeatnumber | undefined Repeat interval in pixels.
-
Set whether to rotate the text with the view.
Name Type Description rotateWithViewboolean Rotate with map.
-
Set the rotation.
Name Type Description rotationnumber | undefined Rotation.
-
Set the scale.
Name Type Description scalenumber | Size | undefined Scale.
-
Set the stroke.
Name Type Description strokeStroke | null Stroke style.
-
Set the text.
Name Type Description textstring | Array.<string> | undefined Text.
-
Set the text alignment.
Name Type Description textAlignCanvasTextAlign | undefined Text align.
-
Set the text baseline.
Name Type Description textBaselineCanvasTextBaseline | undefined Text baseline.