Open anewton opened 2 years ago
Quick update: Hoping to see this magically fixed in a future version or from another bug report. In the meantime, wanted to mention that I found a decent workaround. My workaround does not support pen on a Windows 11 tablet for drag/drop. But does work for touch and mouse trackpad/mouse. Subclassed a user control with a custom Panel class that starts drag with OnPointerPressed, OnPointerMoved, OnPointerRelease, OnPointerCaptureLost. In OnPointerReleased, my code calls DragDrop.DoDragDrop. Based on the Avalonia sample PointerCanvas.cs and trial and error. Subclassed an ItemsControl too. Set AllowDrop to true and implemented a DragDrop.DropEvent handler method for the Drop. I'd prefer to see the sample code working again for Drag and Drop using pen, touch, and mouse. But for now my workaround works for my use cases. Please keep this bug open unless it is tracked elsewhere. Thanks!
Cleaned up my sample application to prevent cascade of mouse events from duplicated Popup child control that was being created. Now creating a bitmap from the control being dragged to display as the Popup's child.
Brought in sample controls from Avalonia to help with testing on a tablet. Added these fixes only to the "ReleaseVersion" project.
Upgraded Avalonia from v11.0.2 to v.11.0.4.
Still seeing the same issue for my custom Drag/Drop control. Sample Avalonia Drag Drop page was still showing the reported issue above. Not sure what is causing the pen or touch pointer to break the drag/drop.
@maxkatz6 FYI, I've been making changes to my referenced test projects. Found that a custom GestureRecognizer worked well for Touch DnD but still not quite there for the Pen (stylus). At this point, it seems like some UI thread blocking or perhaps a GestureRecognizer is preventing the DragDrop.DoDragDrop method from working for a Pen input.
Same behavior on Android
It seems that DragDrop.DoDragDrop
also hangs on iOS. AvaloniaVersion 11.0.6
I think drag and drop is not supported on iOS. However, that hang may have been fixed by #13942, so you should upgrade at least to v11.0.7.
Hi @tovgroliv , @ztl8702 , and @jp2masa
I wrote a sample app for Windows desktop that might be easy to port to iOS and Android. I have not tried iOS for anything yet. You might take a look at this. The idea that I stumbled on was that it seemed a GestureRecognizer may have taken over pointer input. So I wrote a very simple custom gesture recognizer. That can be found here: https://github.com/anewton/Avalonia.Testing/blob/ca43c21d2836246699b306ae30051e0e55e382ee/Avalonia.DragDrop/ReleaseVersion/ReleaseVersion/Controls/DragGestureRecognizer.cs
If anyone can try that out in a sample app on iOS and Android, it might make a bug report more interesting for the Avalonia team.
Thanks!
Describe the bug Drag+Drop no longer working as expected on desktop platforms for pointer devices other than mouse, after updating to Avalonia version 11.0.0-preview2. Drag+Drop for Windows Desktop no longer works for Pen and Touch since EnableMultitouch was removed. Can no longer set EnableMultitouch to false, which allowed Pen and Touch drag+drop to work. Note: Mousepad or Mouse drag+drop still works as expected.
To Reproduce
Expected behavior All touch devices should allow the drag and drop feature to work on desktop touch screens. In version 0.10.18 of Avalonia, the flag EnableMultitouch could be set to false and touch for all pointer types on desktop operating systems did work. Please refer to this Gitter thread which led me to set the flag false in the first place. https://gitter.im/AvaloniaUI/Avalonia?at=620f73fd708e9c3dd7857a9c
Screenshots
Desktop (please complete the following information):
Additional context Also noticed that MacOs trackpad drag+drop stopped working. I have uploaded two sample projects to my repo to demonstrate the issue between two Avalonia versions. That code can be found here (as of this writing): Avalonia.DragDrop issue code.