Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visionOS panning and zooming gestures broken when rotating the map in a 3D volume #2238

Open
eurobob opened this issue Sep 16, 2024 · 2 comments
Labels
bug 🪲 Something is broken!

Comments

@eurobob
Copy link

eurobob commented Sep 16, 2024

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

@eurobob eurobob added the bug 🪲 Something is broken! label Sep 16, 2024
@eurobob
Copy link
Author

eurobob commented Sep 16, 2024

After some more testing, I notice that if I set the angle to 45 degrees it is more responsive. Up to 75-85 degrees it starts to get a bit weird.

I notice that I still have to pan with a vertical motion in the air, instead of horizontally, which isn't very user friendly. Do i need to translate the gestures in some way?

pull bot pushed a commit to kkpan11/mapbox-maps-ios that referenced this issue Oct 23, 2024
@jelemans
Copy link

this also happens without mapboxMaps. Straight Mapkit, same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something is broken!
Projects
None yet
Development

No branches or pull requests

2 participants