-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Labels
bug 🪲Something isn't workingSomething isn't working
Description
Environment
- Android OS version: -
- Devices affected: -
- Maps SDK Version: 11.15.0
Observed behavior and steps to reproduce
On high zoom levels the move gesture does not work correctly. The amount the map is moved is not the same as the finger. It feels weird and unnatural.
Move almost completely breaks at zoom level 25.
Expected behavior
The move gesture should work correctly at all zoom levels.
Notes / preliminary analysis
I think this is because CameraOptions discards small movements.
For example the below code will not move the camera at all. The values are small but these small values add up.
MapEffect(Unit) { mapView ->
launch {
while (true) {
delay(1)
val currentCenter = mapView.mapboxMap.cameraState.center
mapView.mapboxMap.setCamera(
CameraOptions.Builder()
.center(
Point.fromLngLat(
currentCenter.longitude(),
currentCenter.latitude() + 0.000000001 // very small value
)
)
.build()
)
println("${currentCenter.latitude()} --> ${mapView.mapboxMap.cameraState.center.latitude()}") // Camera latitude DOES NOT change!
}
}
}
However, using FreeCameraOptions works.
MapEffect(Unit) { mapView ->
launch {
while (true) {
delay(1)
val freeCameraOptions = mapView.mapboxMap.getFreeCameraOptions()
val prevLat = freeCameraOptions.location!!.latitude()
freeCameraOptions.setLocation(
Point.fromLngLat(
freeCameraOptions.location!!.longitude(),
freeCameraOptions.location!!.latitude() + 0.0000000001
)
)
mapView.mapboxMap.setCamera(freeCameraOptions)
println("$prevLat --> ${mapView.mapboxMap.getFreeCameraOptions().location!!.latitude()}") // Camera latitude DOES change.
}
}
}
Metadata
Metadata
Assignees
Labels
bug 🪲Something isn't workingSomething isn't working