MapCameraPositionState

A state object that can be hoisted to control and observe the map camera.

Pass it to WemapMap and it becomes two-way: the map writes every settled camera back into position — including the ones the user produced by panning, pinching or rotating — and assigning position moves the map. So a camera can be persisted and restored, driven from a search result, or mirrored into another view.

One instance drives one WemapMap; it reflects the camera of a single map.

val cameraState = rememberMapCameraPositionState()

WemapMap(session = session, cameraPositionState = cameraState)

Text("zoom ${cameraState.position?.zoom}")

Assigning position does not animate. A state write is synchronisation, not a user action: animating it would stream intermediate frames back into your state. Animate deliberately through the map view handed to WemapMap's onLoaded when you want a camera flight.

Note the naming: MapCameraState is the immutable camera value, while this type is the observable holder that Compose hoists out of the composable — the …State suffix is Compose's convention for a holder.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The current camera of the map.