mapbox / mapbox/mapbox-maps-ios
visionOS panning and zooming gestures broken when rotating the map in a 3D volume
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 601
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Description
Environment
- Xcode version: 15.4
- visionOS version: 2.0
- Devices affected: Vision Pro
- Maps SDK Version: 11.6.1
Observed behavior and steps to reproduce
In visionOS, I'm trying to apply a 3d rotation effect to have the map take up the space on the "floor" of a volume, but when i do this, the drag and zoom gestures become unusable. A small movement makes the panning go haywire and it infinitely scrolls as fast as possible. There is no control at all.
import SwiftUI
import RealityKit
import RealityKitContent
@_spi(Experimental) import MapboxMaps
struct VolumeView: View {
init() {
MapboxOptions.accessToken = "<redacted>"
}
var body: some View {
GeometryReader3D { geometry in
MapboxMapView()
.ignoresSafeArea()
.rotation3DEffect(
.degrees(90),
axis: (x: 1.0, y: 0.0, z: 0.0)
)
.offset(z: geometry.size.depth / 2)
.offset(y: geometry.size.height / 2)
}
}
}
struct MapboxMapView: UIViewRepresentable {
private let arrifana = CLLocationCoordinate2D(latitude: 37.292182, longitude: -8.863332)
func makeUIView(context: Context) -> MapView {
let gestureOptions = GestureOptions(pitchEnabled: false)
let cameraOptions = CameraOptions(center: arrifana, zoom: 10, pitch: 70)
let mapView = MapView(frame: .zero)
mapView.mapboxMap.setCamera(to: cameraOptions)
mapView.gestures.options = gestureOptions
return mapView
}
func updateUIView(_ uiView: MapView, context: Context) {}
}
#Preview(windowStyle: .automatic) {
VolumeView()
}
Expected behavior
Drag and zoom behaviour should be consistent regardless of 3D translation of the Map View
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MapboxMapView makeUIView entry point and the GestureOptions configuration shown in the report, then reproduce the issue in the provided VolumeView on visionOS. The work is done when panning and zooming remain controllable and consistent after the MapView is rotated and translated in the 3D volume.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- ar-vr-xr, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100