Open FoggyFinder opened 5 years ago
@axeluser can you look at a fix for this? We tried disabling the scrollview on initial touch (after your PR in Xamarin.Forms) but that doesn't prevent subsequent touch events from being eaten by the scrollview.
So, I had a look and tested a few things.
What I found was that UWP works in that as soon as you start drawing, it captures the pointer and won't scroll. This PR will fix it for Android.
I checked iOS and there is no easy way to prevent the bubbling of events, so it always scrolls. I fill that it is correct to stop scrolling, so we should probably fix iOS as well.
Not sure what Tizen, macOS, WPF will do.
But then again, maybe UWP is wrong. If you want to work with gestures and touch evens inside the canvas, you either disable the scroll on the scrollview, or you don't put the canvas inside the scrollview.
I can check WPF but not iOS since I don't have device or emulator. I've found this with quick search:
Stop ScrollView scrolling from child elements (works in Android but not iOS)
but I think there is easier and better way to achieve it.
I think the issue is there is a bug: https://github.com/xamarin/Xamarin.Forms/issues/8497
The correct way would be to track the touch events, and when you start dragging, you disable the scroll.
Matching @FoggyFinder , we have the scrolling problem on Android. iOS appears to be working as expected for us though @mattleibow (clicking and dragging inside the box doesn't scroll, which is what we want)
I think if your fix works for Android, then that would work in our case on all the devices we've tested.
---As an update: We were previously using a PanGestureRecognizer rather than the native SkiaSharp ones, which explains why we saw iOS working ok with the scrolling. Having just tested with the native SkiaSharp touch, we also do see a problem on iOS
I think the issue is there is a bug: xamarin/Xamarin.Forms#8497
@mattleibow I see. Almost 3 weeks past without any responses and I have feeling that it won't be changed in foreseeable future. No, really, I understand why - ScrollOrientation.Neither
was added relatively recently and there are much more important bugs to fix.
The correct way would be to track the touch events, and when you start dragging, you disable the scroll.
But currently, as far as I can tell, there is no such way, isn't it?
I do think having a fix (even temporary) much better than nothing.
Did anyone find a workaround for this issue?
For .NET MAUI: https://github.com/dotnet/maui/discussions/18758
Description
When
SKCanvasView
is placed inside, for example,ScrollViewer
then touch events are intercepted even thoughe.Handled = args.Handled
.Here is a link to the SO topic with proper description of the issue:
ACTION_CANCEL while touching
And with advise how to handle it.
Code
With slight modification to demo app:
https://github.com/mattleibow/SkiaSharpDemo/tree/master/SkiaSharpDemo/SkiaSharpDemo
Add
ListView
to the bottom andLabel
to the top of theStackLayout
:I also changed background color but it's doesn't related.
Expected Behavior
Content doesn't scroll when user drags inside of
SKCanvasView
.Actual Behavior
It does scroll:
Basic Information
Reproduction Link
Since it's very easy to modify demo I haven't uploaded MCVE anywhere. But I could if it's required.