Skip to content
Discussion options

You must be logged in to vote

Since you're copying the camera's current position when you animate, you're stopping that camera's movement to its previous position and only animating the new, different, value you passed. Instead you should copy the previous final position to maintain both destinations:

var destination by remember { mutableStateOf(cameraState.position) }

LaunchedEffect(finalPosition) {
	cameraState.animateTo(destination)
}

LaunchedEffect(lastLocation) {
	destination = destination.copy(
		target = lastLocation.toPosition()
	)
}

fun onPressZoomButton() {
	destination = destination.copy(
		zoom = finalPosition.zoom + MapConstant.ZOOM_LEVEL_DELTA
	)
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MAXBAF1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants