Class FlatLabels

API to add and remove flat labels on the map.

Hierarchy

  • FlatLabels

Implements

Methods

  • Add a flat label to a single polygon.

    // Label the apple store with the label "Apple Store"
    const location = mapView.venue.locations.find((l) => l.name === "Apple")!;
    mapView.FlatLabels.add(location.polygons[0], "Apple Store");

    Parameters

    Returns void

  • Add a flat label to the polygons associated with all locations on the venue. The text is automatically determined based on location data.

    // Draw red labels on all polygons with a location
    mapView.FlatLabels.labelAllLocations({
    appearance: {
    color: 'red',
    }
    });

    Parameters

    Returns void

  • Remove a flat label from a single polygon.

    mapView.FlatLabels.add(polygon, "Label");

    ...

    // Remove the label currently on this polygon
    mapView.FlatLabels.remove(polygon);

    Parameters

    Returns void

  • Remove all flat labels from the venue.

    mapView.FlatLabels.add(polygon1, "Label 1");
    mapView.FlatLabels.add(polygon2, "Label 2");

    ...

    // Remove all labels from all polygons
    mapView.FlatLabels.removeAll();

    Returns void

  • Update the appearance attributes of an already-existing label. If the provided polygon does not have a label already, this is a no-op.

    mapView.FlatLabels.setAppearance(polygon, {
    color: 'blue',
    font: 'times',
    });

    Parameters

    Returns void

  • Set the hover text color for all Flat Labels. To set hover color for all polygons, see MapView.setHoverColor.

    // Make all flat labels turn red on hover
    mapView.FlatLabels.setHoverColorForAll('#ff0000');

    Parameters

    • color: string

      A hexidecimal string representing the hover color.

    Returns void