mirror of
https://github.com/microg/GmsCore
synced 2026-08-06 12:26:08 -04:00
Maps: Handle camera position update without valid lat/lng
This commit is contained in:
parent
f8bbaf1f30
commit
f7ee6646f6
2 changed files with 3 additions and 3 deletions
|
|
@ -135,8 +135,8 @@ class ZoomByWithFocusCameraUpdate(private val delta: Float, private val x: Int,
|
|||
class NewCameraPositionCameraUpdate(private val cameraPosition: CameraPosition) : LiteModeCameraUpdate, CameraUpdate {
|
||||
override fun getLiteModeCameraPosition(map: IGoogleMapDelegate): CameraPosition = this.cameraPosition
|
||||
|
||||
override fun getCameraPosition(mapboxMap: MapboxMap): com.mapbox.mapboxsdk.camera.CameraPosition =
|
||||
this.cameraPosition.toMapbox()
|
||||
override fun getCameraPosition(mapboxMap: MapboxMap): com.mapbox.mapboxsdk.camera.CameraPosition? =
|
||||
this.cameraPosition.toMapbox().takeIf { it.target != null }
|
||||
}
|
||||
|
||||
class NewLatLngCameraUpdate(private val latLng: LatLng) : LiteModeCameraUpdate, CameraUpdate {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ fun GmsLatLngBounds.toMapbox(): LatLngBounds =
|
|||
|
||||
fun GmsCameraPosition.toMapbox(): CameraPosition =
|
||||
CameraPosition.Builder()
|
||||
.target(target.toMapbox())
|
||||
.target(target.takeIf { it.longitude.isFinite() && it.latitude.isFinite() }?.toMapbox())
|
||||
.zoom(zoom.toDouble() - 1.0)
|
||||
.tilt(tilt.toDouble())
|
||||
.bearing(bearing.toDouble())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue