ClassUserLocationMarker

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

Constructors

  • Creates a new user location marker.

    Parameters

    • positionOrProvider: null | Position | PositionProvider = ...

      The position of the marker, or a position provider. Pass null to create a marker with no position that you can update later.

    Returns UserLocationMarker

Accessors

  • get fillColor(): string
  • The fill color of the marker.

    Returns string

  • set fillColor(newColor): void
  • Parameters

    • newColor: string

    Returns void

  • get position(): null | Position
  • The current position that the user location marker is displaying.

    Returns null | Position

    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): void
  • Parameters

    Returns void

  • get positionProvider(): null | PositionProvider
  • The current position provider that the user location marker is subscribed to, or null if one isn't set.

    Returns null | PositionProvider

    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): void
  • Parameters

    Returns void

Methods

  • Clears the position provider without clearing the current position.

    Returns void

  • Subscribes to position updates.

    Parameters

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

      The callback to call when the position changes.

        • (position): void
        • Parameters

          Returns void

    Returns (() => void)

    A function to unsubscribe from the position updates.

      • (): void
      • Returns void

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