<MapboxGL.PointAnnotation />
PointAnnotation represents a one-dimensional shape located at a single geographical coordinate. PointAnnotation is legacy, soon to be deprecated, and should use ShapeSource and SymbolLayer instead.
PointAnnotation表示位于单个地理坐标处的一维形状。
PointAnnotation是遗留的,很快就会被弃用,应该改用ShapeSource和SymbolLayer。
只是起到点位的标识作用,可以设置提示信息,用法比较局限,推荐使用其它layer
props
Prop | Type | Default | Required | Description |
---|---|---|---|---|
id | string |
none |
true |
A string that uniquely identifies the annotation |
title | string |
none |
false |
The string containing the annotation’s title. Note this is required to be set if you want to see a callout appear on iOS. 包含批注标题的字符串。请注意,如果您希望看到IOS上出现标注,则需要设置此选项。 |
snippet | string |
none |
false |
The string containing the annotation’s snippet(subtitle). Not displayed in the default callout. 包含注释片段(副标题)的字符串。不显示在默认详图索引中。 |
selected | bool |
none |
false |
Manually selects/deselects annotation @type {[type]} |
draggable | bool |
false |
false |
Enable or disable dragging. Defaults to false. |
coordinate | array |
none |
true |
The center point (specified as a map coordinate) of the annotation. |
anchor | shape |
{x: 0.5, y: 0.5} |
false |
Specifies the anchor being set on a particular point of the annotation. The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0], where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner. Note this is only for custom annotations not the default pin view. Defaults to the center of the view. 指定在注释的特定点上设置的锚点。锚点在连续空间[0.0,1.0]x[0.0,1.0]中指定,其中(0,0)是图像的左上角,(1,1)是右下角。注意:这只适用于自定义注释,而不是默认的管脚视图。<br />默认为视图的中心。 |
x | number |
none |
true |
FIX ME NO DESCRIPTION |
y | number |
none |
true |
FIX ME NO DESCRIPTION |
onSelected | func |
none |
false |
This callback is fired once this annotation is selected. Returns a Feature as the first param. |
onDeselected | func |
none |
false |
This callback is fired once this annotation is deselected. |
onDragStart | func |
none |
false |
This callback is fired once this annotation has started being dragged. |
onDragEnd | func |
none |
false |
This callback is fired once this annotation has stopped being dragged. |