Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,13 @@ class RNMBXCamera(private val mContext: Context, private val mManager: RNMBXCame

private fun updateMaxBounds(mapView: RNMBXMapView) {
val map = mapView.getMapboxMap()
val currentBounds = map.getBounds()
val builder = CameraBoundsOptions.Builder()
builder.bounds(mMaxBounds?.toBounds())
builder.minZoom(mMinZoomLevel ?: 0.0) // Passing null does not reset this value.
builder.maxZoom(mMaxZoomLevel ?: 25.0) // Passing null does not reset this value.
builder.minPitch(currentBounds.minPitch)
builder.maxPitch(currentBounds.maxPitch)
map.setBounds(builder.build())
mCameraStop?.let { updateCamera(it, mapView) }
}
Expand Down
7 changes: 5 additions & 2 deletions ios/RNMBX/RNMBXCamera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ open class RNMBXCamera : RNMBXMapAndMapViewComponentBase {

func _updateMaxBounds() {
withMapView { map in
let current = map.mapboxMap.cameraBounds
var options = CameraBoundsOptions()

if let maxBounds = self.maxBoundsFeature {
logged("RNMBXCamera._updateMaxBounds._toCoordinateBounds") {
options.bounds = try self._toCoordinateBounds(maxBounds)
Expand All @@ -342,7 +343,9 @@ open class RNMBXCamera : RNMBXMapAndMapViewComponentBase {
}
options.minZoom = self.minZoomLevel?.CGFloat
options.maxZoom = self.maxZoomLevel?.CGFloat

options.minPitch = current.minPitch
options.maxPitch = current.maxPitch

logged("RNMBXCamera._updateMaxBounds") {
try map.mapboxMap.setCameraBounds(with: options)
}
Expand Down
5 changes: 5 additions & 0 deletions ios/RNMBX/RNMBXMapViewComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
RNMBX_REMAP_OPTIONAL_PROP_BOOL(rotateEnabled, reactRotateEnabled)

RNMBX_REMAP_OPTIONAL_PROP_BOOL(pitchEnabled, reactPitchEnabled)

id maxPitch = RNMBXConvertFollyDynamicToId(newViewProps.maxPitch);
if (maxPitch != nil) {
_view.reactMaxPitch = maxPitch;
}

RNMBX_REMAP_OPTIONAL_PROP_NSDictionary(gestureSettings, reactGestureSettings)

Expand Down