MapLayr
    Preparing search index...

    Class UserLocationMarker

    A user location marker that can be displayed on the map.

    The user location marker can be configured with either a static position or a position provider (such as GeolocationPositionProvider) for automatic location updates. The marker itself implements the PositionProvider interface, allowing it to be used as a reactive location source for features like ReactiveRoute.

    When configured with a position provider, the marker will automatically update its position and notify subscribers when the underlying position changes. When configured with a static position, the position can be updated manually by setting the position property.

    Implements

    Index

    Constructors

    Accessors

    • get fillColor(): string

      The fill color of the marker.

      Returns string

    • set fillColor(newColor: string): void

      Parameters

      • newColor: string

      Returns void

    • get position(): Position | null

      The current position that the user location marker is displaying.

      Returns Position | null

      If there is no position available, null is returned and the user location marker isn't shown. Setting this property will clear the position provider if one is set.

    • set position(newValue: Position | null): void

      Parameters

      Returns void

    • get positionProvider(): PositionProvider | null

      The current position provider that the user location marker is subscribed to, or null if one isn't set.

      Returns PositionProvider | null

      Setting the position provider will immediately update the current position. If the position provider is set to null, the marker's position will also be cleared. Use clearPositionProvider to clear the position provider without clearing the current position.

    • set positionProvider(newValue: PositionProvider | null): void

      Parameters

      Returns void

    Methods

    • Clears the position provider without clearing the current position.

      Returns void

    • Subscribes to position updates.

      Parameters

      • callback: (position: Position | null) => void

        The callback to call when the position changes.

      Returns () => void

      A function to unsubscribe from the position updates.

      The callback function is not called until the position provider produces a new position: use currentPosition to get the current position.