DefaultCompassViewModel

Default implementation of CompassViewModel that integrates with CompassControlModel.

Listens to the native compass control model and exposes the current bearing as a kotlinx.coroutines.flow.StateFlow. Delegates click actions to the model.

Parameters

map

The map instance to control the compass for.

Constructors

Link copied to clipboard
constructor(map: Map)

Properties

Link copied to clipboard
open override val bearing: StateFlow<Double>

Observable state of the current map bearing in degrees. A value of 0.0 means the map is aligned with true north.

Functions

Link copied to clipboard
open override fun onCleared()

Releases resources when the view model is no longer needed.

Link copied to clipboard
open override fun onClicked()

Called when the user clicks the compass button. Typically resets the map bearing to north (0.0).