mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

Pinch gesture not recognized on trackpad

Open mic12130 opened this issue 3 years ago • 3 comments

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

mic12130 avatar Nov 21 '22 10:11 mic12130

I am experiencing the same issue. Did you find any workaround @mic12130 ?

raphschwander avatar May 12 '24 18:05 raphschwander

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.

mic12130 avatar May 22 '24 09:05 mic12130

Hi! @mapbox-ci I have run into this issue as well, pinch gestures do not work on trackpad

snboyle16 avatar Oct 04 '24 04:10 snboyle16

Run into it recently too. Any updates/advances on the issue? Happy to help if needed.

edXmO avatar Feb 20 '25 16:02 edXmO

There will be some updates on this front soon 👍 Stay tuned to the release notes.

OdNairy avatar Feb 21 '25 08:02 OdNairy

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 👍

OdNairy avatar Mar 19 '25 14:03 OdNairy

Awesome! Was looking forward to this, thank you for your work @OdNairy 👍🏼

edXmO avatar Mar 19 '25 15:03 edXmO