-
Name Type Description fontstring | undefined 字体样式,作为 CSS
font值,参见:https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font。默认为'10px sans-serif'maxAnglenumber (defaults to Math.PI/4) 当
placement设置为'line'时,允许相邻字符之间的最大角度。预期值以弧度为单位,默认为 45°(Math.PI / 4)。offsetXnumber (defaults to 0) 水平文本偏移量(像素)。正值将使文本向右偏移。
offsetYnumber (defaults to 0) 垂直文本偏移量(像素)。正值将使文本向下偏移。
overflowboolean (defaults to false) 对于多边形标签或当
placement设置为'line'时,允许文本超出标签位置处多边形的宽度或其跟随路径的长度。placement文本Placement (defaults to 'point') 文本放置。
repeatnumber | undefined 重复间隔。设置后,文本将按此间隔重复,间隔指定两个文本锚点之间的距离(像素)。仅在
placement设置为'line'时可用。覆盖 'textAlign'。scalenumber | Size | undefined 比例。
rotateWithViewboolean (defaults to false) 文本是否随视图旋转。
keepUprightboolean (defaults to true) 是否可以将文本旋转 180° 以防止倒置渲染。
rotationnumber (defaults to 0) 旋转角度(弧度,正值为顺时针)。
textstring | Array.<string> | undefined 文本内容或富文本内容。对于纯文本,提供一个字符串,可以包含换行符(
\n)。对于富文本,提供文本/字体元组的数组。元组由要渲染的文本和要使用的字体组成(或''使用文本样式的字体)。换行必须是单独的元组(即'\n', '')。示例:['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', '']将生成 "foo bar baz"。注意:富文本不支持placement: 'line'或即时渲染 API。textAlignCanvas文本Align | undefined 文本对齐方式。可能的值:
'left'、'right'、'center'、'end'或'start'。placement: 'point'时默认为'center'。placement: 'line'时,默认让渲染器选择不超过maxAngle的放置位置。justify文本Justify | undefined 文本框内的文本对齐。如果未设置,文本向
textAlign锚点对齐。否则,使用'left'、'center'或'right'选项在文本框内对齐文本。注意:justify在即时渲染和placement: 'line'时被忽略。textBaselineCanvas文本Baseline (defaults to 'middle') 文本基线。可能的值:
'bottom'、'top'、'middle'、'alphabetic'、'hanging'、'ideographic'。fillFill | null | undefined 填充样式。如果未提供,将使用深色填充样式 (#333)。指定 null 表示不填充。
strokeStroke | undefined 描边样式。
backgroundFillFill | undefined 当
placement为'point'时文本背景的填充样式。默认无填充。backgroundStrokeStroke | undefined 当
placement为'point'时文本背景的描边样式。默认无描边。paddingArray.<number> (defaults to [0, 0, 0, 0]) 文本周围用于去重叠和背景的内边距(像素)。数组中值的顺序为
[top, right, bottom, left]。declutterModeDeclutterMode | undefined 去重叠模式:
declutter、obstacle、none
Methods
-
克隆样式。
返回值:
The cloned style.
-
获取文本的背景填充样式。
返回值:
填充样式。
-
获取文本的背景描边样式。
返回值:
描边样式。
-
获取形状的去重叠模式
返回值:
Shape's declutter mode
-
获取文本的填充样式。
返回值:
填充样式。
-
获取font name.
返回值:
字体。
-
获取justification.
返回值:
对齐方式。
-
判断文本是否可以倒置渲染。
返回值:
保持文本直立。
-
获取相邻字符之间的最大角度。
返回值:
角度(弧度)。
-
获取x-offset for the text.
返回值:
水平文本偏移量。
-
获取y-offset for the text.
返回值:
垂直文本偏移量。
-
获取
overflowconfiguration.返回值:
Let text overflow the length of the path they follow.
-
获取padding for the text.
返回值:
内边距。
-
获取label placement.
返回值:
文本放置。
-
获取文本的重复间隔。
返回值:
重复间隔(像素)。
-
判断文本是否随地图旋转。
返回值:
随地图旋转。
-
获取text rotation.
返回值:
旋转角度。
-
获取text scale.
返回值:
比例。
-
获取文本的描边样式。
返回值:
描边样式。
-
获取text to be rendered.
返回值:
文本。
-
获取text alignment.
返回值:
文本 align.
-
获取text baseline.
返回值:
文本 baseline.
-
设置background fill.
Name Type Description fillFill | null 填充样式。
-
设置background stroke.
Name Type Description strokeStroke | null 描边样式。
-
设置fill.
Name Type Description fillFill | null 填充样式。
-
设置font.
Name Type Description fontstring | undefined 字体。
-
设置justification.
Name Type Description justify文本Justify | undefined 对齐方式。
-
设置文本是否可以倒置渲染。
Name Type Description keepUprightboolean 保持文本直立。
-
设置相邻字符之间的最大角度。
Name Type Description maxAnglenumber 角度(弧度)。
-
设置x offset.
Name Type Description offsetXnumber 水平文本偏移量。
-
设置y offset.
Name Type Description offsetYnumber 垂直文本偏移量。
-
设置
overflowproperty.Name Type Description overflowboolean 允许文本溢出其跟随的路径。
-
设置padding (
[top, right, bottom, left]).Name Type Description paddingArray.<number> | null 内边距。
-
设置text placement.
Name Type Description placement文本Placement 放置方式。
-
设置文本的重复间隔。
Name Type Description repeatnumber | undefined 重复间隔(像素)。
-
设置文本是否随视图旋转。
Name Type Description rotateWithViewboolean 随地图旋转。
-
设置旋转角度。
Name Type Description rotationnumber | undefined 旋转角度。
-
设置比例。
Name Type Description scalenumber | Size | undefined 比例。
-
设置stroke.
Name Type Description strokeStroke | null 描边样式。
-
设置text.
Name Type Description textstring | Array.<string> | undefined 文本。
-
设置text alignment.
Name Type Description textAlignCanvas文本Align | undefined 文本 align.
-
设置text baseline.
Name Type Description textBaselineCanvas文本Baseline | undefined 文本 baseline.