@@ -160,6 +160,7 @@ open class RNMBXMapView(private val mContext: Context, var mManager: RNMBXMapVie
160160 private var mQueuedFeatures: MutableList <AbstractMapFeature >? = ArrayList ()
161161 private val mCameraChangeTracker = CameraChangeTracker ()
162162 private var mPreferredFrameRate: Int? = null
163+ private var mMaxPitch: Double? = null
163164 private lateinit var mMap: MapboxMap
164165
165166 private lateinit var mMapView: MapView
@@ -513,7 +514,8 @@ open class RNMBXMapView(private val mContext: Context, var mManager: RNMBXMapVie
513514 ATTRIBUTION (RNMBXMapView ::applyAttribution),
514515 LOGO (RNMBXMapView ::applyLogo),
515516 SCALEBAR (RNMBXMapView ::applyScaleBar),
516- COMPASS (RNMBXMapView ::applyCompass),;
517+ COMPASS (RNMBXMapView ::applyCompass),
518+ MAX_PITCH (RNMBXMapView ::applyMaxPitch),;
517519
518520 override fun apply (mapView : RNMBXMapView ) {
519521 _apply (mapView)
@@ -582,6 +584,28 @@ open class RNMBXMapView(private val mContext: Context, var mManager: RNMBXMapVie
582584 }
583585 }
584586
587+ fun setReactMaxPitch (maxPitch : Double? ) {
588+ mMaxPitch = maxPitch
589+ changes.add(Property .MAX_PITCH )
590+ }
591+
592+ private fun applyMaxPitch () {
593+ val maxPitch = mMaxPitch ? : return
594+ if (! this ::mMap.isInitialized) {
595+ return
596+ }
597+
598+ val currentBounds = mMap.getBounds()
599+ val builder = CameraBoundsOptions .Builder ()
600+ .bounds(currentBounds.bounds)
601+ .maxZoom(currentBounds.maxZoom)
602+ .minZoom(currentBounds.minZoom)
603+ .minPitch(currentBounds.minPitch)
604+ .maxPitch(maxPitch)
605+
606+ mMap.setBounds(builder.build())
607+ }
608+
585609 fun setReactStyleURL (styleURL : String ) {
586610 mStyleURL = styleURL
587611 changes.add(Property .STYLE_URL )
0 commit comments