Hey everyone,
I am implementing a map-heavy application. I am following the Crane sample to set up the
MapView
.
I am trying to move the camera as the user is sliding up a bottom sheet.
The problem is that if i change the camera position according to the offset with
GoogleMap.moveCamera()
, the maps moves really laggy.
Calling
GoogleMap.setPadding()
is smooth though. Can anyone help me with this? Thanks in advance!
⬆️ 1
👍 1
👀 1
Csaba Kozák
07/29/2021, 6:20 PM
This is the gist of the code:
Copy code
coroutineScope.launch {
val googleMap = mapView.awaitMap()
val target = googleMap.cameraPosition.target
// mapBottomPadding is changing due to bottom sheet offset
googleMap.setPadding(0, mapTopPadding, 0, mapBottomPadding)
googleMap.moveCamera(CameraUpdateFactory.newLatLng(target))
}