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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Current DragAndDrop API is unworkable #45

Open
hakanai opened this issue Aug 27, 2022 · 1 comment
Open

[BUG] Current DragAndDrop API is unworkable #45

hakanai opened this issue Aug 27, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@hakanai
Copy link

hakanai commented Aug 27, 2022

馃悰 Describe the bug

The DragAndDrop API in its current form is not possible to use.

鈿狅笍 Current behavior

Functions have dubious naming:

  • DragContainer and DropContainer sound like counterparts but they are not. DragTarget is the current counterpart for DropContainer. Try to use them by their current naming and it doesn't even layout correctly - DragContainer does something to break the component being added to layouts.
  • DragTarget makes no sense because "target" refers to where you are dropping the thing. Usually we refer to the place where you start the operation as the "drag source".
  • What DragContainer actually appears to be for is... just drawing the overlay? So maybe a good name would be DragAndDropOverlay or something to that effect.

Next issue is, the MIME type system isn't flexible enough to actually use, real data transfer pretty much lets you have anything you want.

Last issue is major, the current API requires the draggable data to be constructed in order to declare the drag target. You don't want to eagerly instantiate the draggable data for every item in the application. That's how you make an application run out of memory. Instead, there should be some kind of callback to create the draggable data which would be one of the parameters for the drag source.

I also expected some kind of method for consuming the thing when it was dropped but I couldn't find it at all. Actually I'd expect two callbacks. One for the drop target to inform it that some data has been dropped, and another for the drag source to inform it that the data has been dragged out (at the time when the drop happens, though, not as soon as it's picked up, otherwise when the user cancels the drag by hitting Escape, they will find out they have nothing left).

So all up I don't think this library is usable to implement drag and drop, but it does give good, solid examples of how the different bits have to be fit together to make drag and drop work, which is helpful anyway.

鉁旓笍 Expected behavior

The library can be used without hassle, the API makes sense and things generally work.

馃獪 Steps to reproduce

馃摲 Screenshots

馃摫 Tech info

  • Name of the library:
  • Library/sample version:
  • Device/emulator version/model:
  • OS:
@hakanai hakanai added the bug Something isn't working label Aug 27, 2022
@khalp
Copy link
Contributor

khalp commented Aug 29, 2022

Hi @hakanai, thanks for the feedback. The API is still under development, so we'll keep these ideas in mind as we work on future releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants