Add 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',
}
}
});
Remove 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]);
Remove all floating labels from the venue.
mapView.FloatingLabels.add(polygon, "Label 1");
mapView.FloatingLabels.add(node, "Label 2");
...
// Remove all labels from all polygons
mapView.FloatingLabels.removeAll();
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();
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,
}
});
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);
Add a floating label to a single polygon or node. When labelling a polygon, all entrance nodes of that polygon receive a label.