Compass
fun Compass( modifier: Modifier = Modifier, contentPadding: PaddingValues = PaddingValues(4.dp), alignment: Alignment = Alignment.TopEnd, fadeWhenFacingNorth: Boolean = true, resetToNorthUponClick: Boolean = true, content: @Composable () -> Unit = {
Image(
painter = painterResource(id = R.drawable.mapbox_compass_icon),
contentDescription = "Mapbox Compass"
)
})
Add a Compass ornament to the map, the direction of the compass will follow the map camera's bearing, when the compass is clicked, the map camera's bearing will be reset to face north.
By default, the Compass will be placed to the Alignment.TopEnd of the map with padding of 4dp.
Parameters
modifier
Modifier to be applied to the Compass.
alignment
The alignment of the Compass within the Map.
fadeWhenFacingNorth
Whether the compass fades out to invisible when facing north direction.
resetToNorthUponClick
Whether the map camera bearing should be reset to 0 when the compass is clicked.
content
The composable to draw the compass.