Pinch gesture not recognized on trackpad
Environment
- Xcode version: 14.1
- iOS version: 16.1
- Devices affected: All devices with a trackpad connected
- Maps SDK Version: 10.9.1
Observed behavior and steps to reproduce
When performing a pinch gesture on a connected trackpad, there is no change on the map view, instead of the expected behavior of zooming in/out (this is what MapKit looks like).
This may affect many scenarios including iPad + Magic Trackpad, iPad + Universal Control, iPad app running on Apple Silicon Mac etc.
Expected behavior
A pinch gesture on the trackpad should be recognized and reacted as same as the one on the touch screen.
Notes / preliminary analysis
I tried to dive down a little bit into this issue and I found that it's supposed to be caused by the numberOfTouches validation in PinchGestureHandler.swift - the validation discards any input whose numberOfTouches is other than 2, while the property will always return 0 when the input is from a trackpad.
Note: I haven't found any information about numberOfTouches returning 0 in Apple's documents, but it is observed every time in my testing.
Additional links and references
I am experiencing the same issue. Did you find any workaround @mic12130 ?
Ahh it has been 2 years. I gave up fixing this as the outcome wasn't worth the works for me. Besides updating codes of the framework, an idea once in my mind was implementing a custom pinch gesture recognizer to particularly handle the trackpad case. (as the built-in recognizer just skips anything happened on trackpads) Then with the combination of the finger locations and the map's camera setter, everything should work.
Hi! @mapbox-ci I have run into this issue as well, pinch gestures do not work on trackpad
Run into it recently too. Any updates/advances on the issue? Happy to help if needed.
There will be some updates on this front soon 👍 Stay tuned to the release notes.
Starting the 11.11.0-beta.1 release we do support pinching, panning and rotation gestures on trackpad 🎉
Looking forward to your feedback and other proposals 👍
Awesome! Was looking forward to this, thank you for your work @OdNairy 👍🏼