Open Pioneer Trails Packages
    Preparing search index...

    Interface Overlay

    An overlay is a UI element that is displayed over the map.

    Overlays are tied to coordinates on the map and not to a position on the screen. The overlay renders a react node at the specified coordinates.

    interface Overlay {
        get content(): ReactNode;
        get currentCoordinate(): Coordinate | undefined;
        destroy(): void;
        get element(): HTMLElement;
        id: string;
        get isDestroyed(): boolean;
        get offset(): number[];
        olOverlay: Overlay;
        get position(): OverlayPosition;
        get positioning(): OverlayPositioning;
        setContent(content: ReactNode): void;
        setOffset(offset: number[]): void;
        setPosition(
            position: Coordinate | OverlayPosition | "follow-pointer" | undefined,
        ): void;
        setPositioning(positioning: OverlayPositioning): void;
        tag: string | undefined;
    }
    Index
    • get currentCoordinate(): Coordinate | undefined

      Current coordinates of the overlay on the map.

      The coordinates on the map are configured via OverlayOptions.position or setPosition.

      • If configured with static coordinates (i.e. position.kind === "coordinate"), this is the same as position.coordinate.
      • If configured with "follow-pointer" position, this is the result of the user's pointer movements.

      Returns Coordinate | undefined

    • get offset(): number[]

      Offset in pixels relative to the overlay's coordinates.

      The first element in the array is the horizontal offset.

      Returns number[]

    • Destroys the overlay and removes it from the map. An overlay that is destroyed cannot be added to the map again.

      Returns void

    • Set offset in pixels relative to the overlay's coordinates on the map. The first element in the array is the horizontal offset.

      Parameters

      • offset: number[]

      Returns void

    id: string

    Unique, readonly id of the overlay.

    Automatically assigned when the overlay is created. Use the tag property for custom identifiers.

    olOverlay: Overlay

    Raw, corresponding OpenLayers overlay object.

    warning Manipulation of the OpenLayers object can create inconsistencies that lead to errors. The OpenLayers API can change with updates of OpenLayers.

    tag: string | undefined

    Optional, readonly tag that helps to identify the overlay instance.