SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.52k
stars
540
forks
source link
[FEATURE][QUESTION] Support for macOS Multitouch Events on Xamarin.Forms #826
Is your feature request related to a problem? Please describe.
In #309 touch events where added to SkiaSharp. In the conversation of the PR it says that multitouch is fully supported that it's correct for iOS and Android, butt not macOS as it seems. I tried a pinch and two-finger pan gesture with the trackpad but OnTouch(SKTouchEventArgs e) doesn't get called.
Describe the solution you'd like
a great solution would be that trackpad gestures are handled the same way as touch gestures on a mobile platform (iOS / Android). In the file
source/SkiaSharp.Views.Forms/SkiaSharp.Views.Forms.Mac/SKTouchHandler.cs i saw that SKTouchHandler derives from NSGestureRecognizer so maybe we could add override void Magnify(NSEvent magnifyEvent) to support the pinch gestures. For two-finger panning i think maybe override void ScrollWheel(NSEvent theEvent) is a good starting point.
Describe alternatives you've considered
An alternative for pinch gestures would be to use a Xamarin.FormsPinchGestureRecognizer but my current application also supports Android and as mentioned in #309 Xamarin.Forms GestureRecognizers won't work in that case. So I would have to do are Runtime checks like:
if(Xamarin.Forms.Device.RuntimePlatform == Xamarin.Forms.Device.macOS)
{
var pinch = new PinchGestureRecognizer();
pinch.PinchUpdated += OnPinch;
this.GestureRecognizers.Add(pinch);
}
Is this something that's planned for future releases?
thanks
Is your feature request related to a problem? Please describe. In #309 touch events where added to SkiaSharp. In the conversation of the PR it says that multitouch is fully supported that it's correct for iOS and Android, butt not macOS as it seems. I tried a pinch and two-finger pan gesture with the trackpad but
OnTouch(SKTouchEventArgs e)
doesn't get called.Describe the solution you'd like a great solution would be that trackpad gestures are handled the same way as touch gestures on a mobile platform (iOS / Android). In the file source/SkiaSharp.Views.Forms/SkiaSharp.Views.Forms.Mac/SKTouchHandler.cs i saw that
SKTouchHandler
derives fromNSGestureRecognizer
so maybe we could addoverride void Magnify(NSEvent magnifyEvent)
to support the pinch gestures. For two-finger panning i think maybeoverride void ScrollWheel(NSEvent theEvent)
is a good starting point.Describe alternatives you've considered An alternative for pinch gestures would be to use a
Xamarin.Forms
PinchGestureRecognizer
but my current application also supports Android and as mentioned in #309 Xamarin.Forms GestureRecognizers won't work in that case. So I would have to do are Runtime checks like:Is this something that's planned for future releases? thanks