-
-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAUI Flyout Locks Map (regression) #2364
Comments
Thanks for the report. Did you work with a version in which this was fixed? Which version was it? |
I did, - the issue was first reported using v4.0.0-rc.1 and I believe it was fixed in v4.0.0, however, for some reason I can reproduce the issue on all versions (v4.0.0 thru v4.1.2). I am using a physical iPhone 14 Pro Max (v17.1.2). The device hasn't changed since the issue was first reported, only the iOS version. I did upgrade to .NET 8 recently - Here are my workloads. |
The underlying cause is a bug in SkiaSharp/MAUI. Our fix was a workaround for this problem. I confirmed the problem and reported a bug here: mono/SkiaSharp#2493. You could help us by by posting your problem on that issue. You could help them by providing a minimal reproducible sample (so not using Mapsui but SkiaSharp directly) and post it there. |
Thanks for looking into. I attempted to recreate a minimal reproducible sample but seeing that only the SKTouchAction.Pressed event is firing on iOS. On Windows, I am seeing other ActionTypes, not just Pressed. Before I submit it, I wanted to see if you could take a quick look at my code to see if i'm missing something? Repo - https://github.com/nm4568/SkiaSharpSamples XAML <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:skia="clr-namespace:SkiaSharp.Views.Maui.Controls;assembly=SkiaSharp.Views.Maui.Controls"
x:Class="SkiaSharpSample.MainPage">
<StackLayout>
<skia:SKCanvasView x:Name="skCanvasView" PaintSurface="View_PaintSurface" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/>
<Label x:Name="DebugLabel"
FontSize="20"
HorizontalOptions="Center"
VerticalOptions="End" />
</StackLayout>
</ContentPage>
C# using SkiaSharp;
using SkiaSharp.Views.Maui;
using SKCanvasView = SkiaSharp.Views.Maui.Controls.SKCanvasView;
namespace SkiaSharpSample
{
public partial class MainPage : ContentPage
{
SKBitmap skBitmap;
public MainPage()
{
InitializeComponent();
skCanvasView.EnableTouchEvents = true;
skCanvasView.PaintSurface += View_PaintSurface;
skCanvasView.Touch += SkCanvasView_Touch;
}
protected override void OnAppearing()
{
base.OnAppearing();
// Load and render a PNG image using SkiaSharp
RenderSkiaSharpImage();
}
private void RenderSkiaSharpImage()
{
// Get the stream of the embedded resource
var stream = typeof(MainPage).Assembly.GetManifestResourceStream("SkiaSharpSample.Resources.Images.dotnet_bot.png");
// Create a SKBitmap from the stream
skBitmap = SKBitmap.Decode(stream);
}
private void SkCanvasView_Touch(object? sender, SkiaSharp.Views.Maui.SKTouchEventArgs e)
{
switch (e.ActionType)
{
case SKTouchAction.Entered:
DebugLabel.Text = "Entered";
break;
case SKTouchAction.Pressed:
DebugLabel.Text = "Pressed";
break;
case SKTouchAction.Moved:
DebugLabel.Text = "Moved";
break;
case SKTouchAction.Released:
DebugLabel.Text = "Released";
break;
case SKTouchAction.Cancelled:
DebugLabel.Text = "Canceled";
break;
case SKTouchAction.Exited:
DebugLabel.Text = "Exited";
break;
}
// Invalidate the canvas to trigger a redraw
((SKCanvasView)sender).InvalidateSurface();
}
private void View_PaintSurface(object? sender, SkiaSharp.Views.Maui.SKPaintSurfaceEventArgs e)
{
// Get the SKCanvas from the event arguments
var canvas = e.Surface.Canvas;
// Clear the canvas
canvas.Clear(SKColors.White);
// Draw the SKBitmap onto the canvas
canvas.DrawBitmap(skBitmap, new SKPoint(0, 0));
}
}
} |
This looks good to me but also I am not expert in this particular topic. Note, that by providing a sample you already post a great issue, even if it turns out to be a misunderstanding instead of a bug. @inforithmics do you have any remarks on this? One thing to take into account it that Mapsui MAUI supports both SKGLView and SKCanvasView. If MapControl.UseGPU = true SKGLView is use, else SKCanvasView. I am not sure what the default is (This is different for different configuration because we prefer SKGLView but it crashed in some platforms). So this sample which uses SKCanvasView corresponds to MapControl.UseGPU = false. You may want to test both in Mapsui. |
I attempted to use the SKGLView and the app immediately crashes on load in the iOS Emulator. |
I have added a post to the SkiaSharp issue thread you posted with the minimal reproducible sample that was created. |
No reaction yet. You could also post this as a new issue. I see that they are triaging new issues, so at least they will look at it. Something else, we might go for an entirely different solution in main. If possible we will use MAUI events instead of SkiaSharp events. |
New issue has been posted - mono/SkiaSharp#2722 Thank you! |
Mapsui Version
4.1.2
See following issue where this bug was fixed but is repoducible in 4.1.2 using the same sample project provided in Issue # 2000.
#2000
Steps to reproduce
The text was updated successfully, but these errors were encountered: