@@ -2,17 +2,19 @@ package com.rnmapbox.rnmbx.components.camera
22
33import android.animation.Animator
44import android.content.Context
5- import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toPointGeometry
6- import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toLatLng
7- import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toLatLngBounds
8- import com.rnmapbox.rnmbx.utils.LatLngBounds
9- import com.rnmapbox.rnmbx.components.mapview.RNMBXMapView
10- import com.mapbox.maps.CameraOptions
115import com.facebook.react.bridge.ReadableMap
126import com.mapbox.geojson.FeatureCollection
7+ import com.mapbox.geojson.Point
8+ import com.mapbox.maps.CameraOptions
139import com.mapbox.maps.EdgeInsets
10+ import com.mapbox.maps.ScreenCoordinate
1411import com.rnmapbox.rnmbx.components.camera.constants.CameraMode
12+ import com.rnmapbox.rnmbx.components.mapview.RNMBXMapView
13+ import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toLatLng
14+ import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toLatLngBounds
15+ import com.rnmapbox.rnmbx.utils.GeoJSONUtils.toPointGeometry
1516import com.rnmapbox.rnmbx.utils.LatLng
17+ import com.rnmapbox.rnmbx.utils.LatLngBounds
1618
1719class CameraStop {
1820 private var mBearing: Double? = null
@@ -124,14 +126,22 @@ class CameraStop {
124126 if (mLatLng != null ) {
125127 builder.center(mLatLng!! .point)
126128 } else if (mBounds != null ) {
129+ val coordinates = listOf<Point >(
130+ mBounds!! .toBounds().northeast,
131+ mBounds!! .toBounds().southwest
132+ )
127133 val tilt = if (mTilt != null ) mTilt!! else currentCamera.pitch
128134 val bearing = if (mBearing != null ) mBearing!! else currentCamera.bearing
129135
130- val boundsCamera = map.cameraForCoordinateBounds(
131- mBounds!! .toBounds(),
136+ val boundsCamera = map.cameraForCoordinates(
137+ coordinates,
138+ CameraOptions .Builder ()
139+ .pitch(tilt)
140+ .bearing(bearing)
141+ .build(),
132142 cameraPaddingEdgeInsets,
133- bearing ,
134- tilt
143+ null ,
144+ ScreenCoordinate ( 0.0 , 0.0 )
135145 )
136146 builder.center(boundsCamera.center)
137147 builder.anchor(boundsCamera.anchor)
0 commit comments