I have a need to automate the zoom level and position of the Camera on my Google map in order to accurately place it.
In Google Maps Compose I would use something similar to:
val cameraPositionState = rememberCameraPositionState()
// Use a DerivedState to avoid unnecessary recompositions
val mapBounds by remember {
derivedStateOf {
cameraPositionState.projection?.visibleRegion?.latLngBounds
}
}
GoogleMap(
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState
) {
// Map content here
}
// Accessing the corners
mapBounds?.let { bounds ->
val northEast = bounds.northeast
val southWest = bounds.southwest
}
Do you have any plans to expand your current CameraPosition parameter to support this - or possible add a Google-only variant for CameraPosition?