You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But, you can also share a short block of code here:
usingSkiaSharp;usingSkiaSharp.Views.Maui;usingSKCanvasView=SkiaSharp.Views.Maui.Controls.SKCanvasView;namespaceSkiaSharpSample{publicpartialclassMainPage:ContentPage{SKBitmapskBitmap;publicMainPage(){InitializeComponent();skCanvasView.EnableTouchEvents=true;skCanvasView.PaintSurface+=View_PaintSurface;skCanvasView.Touch+=SkCanvasView_Touch;}protectedoverridevoidOnAppearing(){base.OnAppearing();// Load and render a PNG image using SkiaSharpRenderSkiaSharpImage();}privatevoidRenderSkiaSharpImage(){// Get the stream of the embedded resourcevarstream=typeof(MainPage).Assembly.GetManifestResourceStream("SkiaSharpSample.Resources.Images.dotnet_bot.png");// Create a SKBitmap from the streamskBitmap=SKBitmap.Decode(stream);}privatevoidSkCanvasView_Touch(object?sender,SkiaSharp.Views.Maui.SKTouchEventArgse){switch(e.ActionType){caseSKTouchAction.Entered:DebugLabel.Text="Entered";break;caseSKTouchAction.Pressed:DebugLabel.Text="Pressed";break;caseSKTouchAction.Moved:DebugLabel.Text="Moved";break;caseSKTouchAction.Released:DebugLabel.Text="Released";break;caseSKTouchAction.Cancelled:DebugLabel.Text="Canceled";break;caseSKTouchAction.Exited:DebugLabel.Text="Exited";break;}// Invalidate the canvas to trigger a redraw((SKCanvasView)sender).InvalidateSurface();}privatevoidView_PaintSurface(object?sender,SkiaSharp.Views.Maui.SKPaintSurfaceEventArgse){// Get the SKCanvas from the event argumentsvarcanvas=e.Surface.Canvas;// Clear the canvascanvas.Clear(SKColors.White);// Draw the SKBitmap onto the canvascanvas.DrawBitmap(skBitmap,newSKPoint(0,0));}}}
I would also be interested to hear about the roadmap of SkiaSharp touch. It seems to me a difficult problem to deal with touch on all the platforms, and there were some changes in the api in the past. Perhaps we should use the touch of the platform itself instead of SkiaSharp. Any advise is welcome.
Heya! Just realized that your test needs to set e.Handled = true; at the end of the OnTouch handler. If you update the sample and it behaves correctly we have to investigate Mapsui again.
Description
CanvasView.Touch is only fired on Pressed on iOS
Code
Minimal Reproducible Example - https://github.com/nm4568/SkiaSharpSamples
But, you can also share a short block of code here:
You can also share some XAML:
Expected Behavior
Events with all other ActionTypes should be fired.
Actual Behavior
CanvasView.Touch is only firing one ActionType on iOS - ActionType.Pressed.
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
Other (Please indicate in the description)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
iOS
Platform / Operating System Version
iOS 17.2
Devices
iOS Simulator - iPhone 14 Pro Max
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: