How to get coordinates of the fingers on the trackpad?

MichaelRumplerMichaelRumpler ATMember ✭✭✭✭
edited October 17 in Xamarin.Mac

I'm trying to get the position of my fingers on the trackpad in a (Xamarin.Forms for) MacOS app.

Ideally I'd get them in my custom implementation of NSGestureRecognizer. But the TouchesBegan and TouchesEnded methods seem to be only for the touch bar of the newer MacBooks. They are not called when I touch the trackpad.

There is a description at Touch Events Represent Fingers on the Trackpad. So I tried overriding the Touches*WithEvent methods in the NSView. But these are not called either. The doc says that one must setAcceptsTouchEvents to true for these methods to work, but there is no such property or method in NSView for Xamarin.Mac.

Apple's own NSMagnificationGestureRecognizer and NSRotationGestureRecognizer don't seem to provide the current coordinates of all fingers. I only get one with LocationInView(NSView). Furthermore the NSRotationGestureRecognizer is raised only twice - when the gesture begins and when it ends but not intermittently. Even if I set DelaysRotationEvents = false. Therefore I cannot show the continued rotation on the screen.

Can anybody help me out with this?

Best Answer

Answers

Sign In or Register to comment.