Skip to content
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

Merged
merged 5 commits into from
May 30, 2023
Merged

Conversation

Numpsy
Copy link
Collaborator

@Numpsy Numpsy commented Apr 7, 2023

This contains the changes from #130 plus

  1. It's rebased on top of the current master branch to pick up changes like the DSL code being moved into the main lib and the Elmish v4 updates
  2. There's an extra commit to update it to deal with a couple of Avalonia 11 changes
Copy link
Member

@JaggerJo JaggerJo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

renngar and others added 5 commits May 22, 2023 12:07
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.
@Numpsy
Copy link
Collaborator Author

Numpsy commented May 22, 2023

Rebase on top of the current code, to make sure there's no issues with the new Avalonia 11 previews

@JaggerJo
Copy link
Member

LGTM, should I merge?

@Numpsy
Copy link
Collaborator Author

Numpsy commented May 22, 2023

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 :-( )

@Numpsy
Copy link
Collaborator Author

Numpsy commented May 29, 2023

I tried plugging it into a test app and it works sufficiently to open a file via drag and drop, so the base functionality looks good :-)

dragdrop

@JaggerJo JaggerJo merged commit a81e8f0 into fsprojects:master May 30, 2023
1 check passed
@Numpsy Numpsy deleted the rw/dragdrop_rebase branch May 30, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants