CameraPositionState

class CameraPositionState(position: CameraPosition = CameraPosition(LatLng(0.0, 0.0), 0f, 0f, 0f))

A state object that can be hoisted to control and observe the map's camera state. A CameraPositionState may only be used by a single GoogleMap composable at a time as it reflects instance state for a single view of a map.

Parameters

position

the initial camera position

Constructors

Link copied to clipboard
constructor(position: CameraPosition = CameraPosition(LatLng(0.0, 0.0), 0f, 0f, 0f))

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The reason for the start of the most recent camera moment, or CameraMoveStartedReason.NO_MOVEMENT_YET if the camera hasn't moved yet or CameraMoveStartedReason.UNKNOWN if an unknown constant is received from the Maps SDK.

Link copied to clipboard

Whether the camera is currently moving or not. This includes any kind of movement: panning, zooming, or rotation.

Link copied to clipboard
var position: CameraPosition

Current position of the camera on the map.

Link copied to clipboard
val projection: Projection?

Returns the current Projection to be used for converting between screen coordinates and lat/lng.

Functions

Link copied to clipboard
suspend fun animate(update: CameraUpdate, durationMs: Int = MAX_VALUE)

Animate the camera position as specified by update, returning once the animation has completed. position will reflect the position of the camera as the animation proceeds.

Link copied to clipboard
fun move(update: CameraUpdate)

Move the camera instantaneously as specified by update. Any calls to animate in progress will be cancelled. position will be updated when the bound map's position has been updated, or if the map is currently unbound, update will be applied when a map is next bound. Other calls to move, animate, or setting position will override an earlier pending call to move.