Add a floating label to a single polygon or node. When labelling a polygon, all entrance nodes of that polygon receive a label.
// Label the apple store with the label "Apple Store"
const location = mapView.venue.locations.find((l) => l.name === "Apple")!;
mapView.FloatingLabels.add(location.nodes[0], "Apple Store");
The MappedinPolygon or MappedinNode or MappedinCoordinate to label.
The text to display on the label.
Optional
options: TAddFloatingLabelOptionsAdd a floating label to one entrance node of each polygons associated with all locations on the venue. The text is automatically determined based on location data.
// Draw red labels with black outlines on an entrance node of all polygons with a location
mapView.FloatingLabels.labelAllLocations({
appearance: {
text: {
foregroundColor: 'red',
backgroundColor: 'black',
}
}
});
Optional
options: TFloatingLabelAllLocationsOptionsRemove a floating label from a single polygon or node.
mapView.FloatingLabels.add(polygon, "Label");
...
// Remove the label currently on this polygon's first entrance
mapView.FloatingLabels.remove(polygon.entrances[0]);
The MappedinPolygon or MappedinNode or MappedinCoordinate with a label to remove.
Resets the priority of an existing floating label (or labels, in the case of a polygon)
mapView.FloatingLabels.setPriority(polygon0, 0);
mapView.FloatingLabels.setPriority(polygon1, 1);
...
// Labels should now behave as they did by default
mapView.FloatingLabels.resetPriority();
The MappedinPolygon or MappedinNode or MappedinCoordinate with a label to update.
Update the appearance attributes of an already-existing label. If the provided polygon or node does not have a label already, this is a no-op.
mapView.FloatingLabels.setAppearance(node, {
text: {
size: 25,
}
});
The MappedinPolygon or MappedinNode or MappedinCoordinate with a label to update.
The new TFlatLabelAppearance settings to apply to the polygon's label.
Updates the priority of an existing floating label (or labels, in the case of a polygon). This controls whether it is preferred over other labels during collisions.
// Polygon 1's label should always show above polygon 2's label
mapView.FloatingLabels.setPriority(polygon0, 0);
mapView.FloatingLabels.setPriority(polygon1, 1);
The MappedinPolygon or MappedinNode or MappedinCoordinate with a label to update.
API to add and remove floating labels on the map.