-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Drag and Drop functionality #295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This may expose a bug in Avalonia.FuncUI. As soon as you press the mouse button on Drag Me you get two PressedPointerEvents. This makes certain cases not work properly. For example, 1. When you immediately release the button you do not get a DragDropEffects.None cancellation response. 2. If you drag it to the drop target, you get a count of 1 the first time and n + 2 for each subsequent attempt. If you look at the output in the terminal you can see the multiple messages being triggered and how the display and state do not match.
This is an ugly hack to work around the fact that we get to PointerPressedEvents when the user presses the mouse button over the drag source. It should be reverted or removed once that is fixed.
Marks the event as handled avoiding the ugly hack of tracking drag state in the model. The remaining bug is that occassionally we get a Dragged message without receiving a Dropped message. The Dragged message is fired by completion of the doDrag Async. I assume that is why we always get one. However the Dropped message is dispatched from the drop target's onDrop handler. It is possible that this is responsible for the difference. I tried adding diagnostics to the onDrop handler to see if it was receiving and unexpected data type that is not being handled, but it is not even being called.
ca36426
to
f9e3545
Compare
Rebase on top of the current code, to make sure there's no issues with the new Avalonia 11 previews |
LGTM, should I merge? |
The demo in the control catalog does seem to be working ok with the latest code. (I was previously intending to try adding drop-drop file opening to a tool I was working on that would use this, but I've been snowed under with other things and haven't got to it yet :-( ) |
This contains the changes from #130 plus