-
Notifications
You must be signed in to change notification settings - Fork 109
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
Event for getting current position #223
Comments
Hi @Florian-Schoenherr, all of the events emitted by the library include the id of the dragged item (under info) which can be used to retrieve the index very easily. alternatively, it can be added to the info very easily if needed. no one has asked for it so far. regarding the whiteboard. i will need some more info or an example in order to respond. |
You probably know apps like diagrams.net/excalidraw/miro.com (although they differ in implementation). I want to use something like that, but also want to use your "sortable-list"-type dnd. That would mean we'd need something like dropinside, dropoutside and the current position of the dropped element. If that's out of scope, it's okay. "Whiteboard" would then mean, maybe we want a completely separate "dnd-absolute" for absolutely positioned elements and then people would be able to drag&drop between your dnd and "dnd-absolute"? Maybe I'm overthinking. |
this type of "whiteboard" drop zone makes different assumptions than a sortable dropzone. |
That's the thing. I wouldn't want to re-invent the wheel (although I tried - but barely working). Stacking order is not needed in my usecase (although if there should potentially be a component that others can use, people would need it). You may know this kind of implementation for finding containers under a dragged element:
I could potentially abuse this, with a |
@Florian-Schoenherr |
Wow, thank you! I made an implementation too, without the dndzone on whiteboard. I used TRIGGERS.DROPPED_OUTSIDE_OF_ANY. Gonna REPL when it's done. (Just realized your solution has the advantage of sorting when dragging the element from whiteboard to dndzone.) |
REPL. |
so u want to be able to put one item inside another... |
Yes, if you have two or more items in a group, you should be able to move the group, too. I gave the .droppable a margin so that you can drag it's parent, in reality it would be more obvious. Using a dndzone for it doesn't work because it drags inside itself, into the inner dndzone (or something, it throws many errors). |
Nesting should work. Which errors were you getting?
From the user perspective what is this application doing?
…On Sat, Jan 16, 2021, 19:16 Florian-Schoenherr ***@***.***> wrote:
Yes, if you have two or more items in a group, you should be able to move
the group, too. I gave the .droppable a margin so that you can drag it's
parent, in reality it would be more obvious. Using a dndzone for it doesn't
work because it drags inside itself, into the inner dndzone (or something,
it throws many errors).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#223 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE4OZC6ZAUWN3Z4NQMKS56DS2FDPRANCNFSM4WBHDNEQ>
.
|
@Florian-Schoenherr you might find this conversation relevant. |
Errors REPL |
I didn't look deeply yet but position:absolute shouldn't cause issues (my example of whiteboard had it) and nesting shouldn't either (ex: crazy nesting). what can cause issues is if dom elements (zones or children) and added, removed or rearranged without the data that is passed-in reflecting that. |
Yeah, the inner consider/finalize is probably triggering when I drag it inside itself, that's my fault. Also I haven't added the position:absolute container dragging |
I have implemented some dnd stuff myself and found that I really wish for a way to retrieve the current position while dragging, so that I can potentially reconfigure the dragged element to be
position: absolute;
. I know you're using translate3d, but that would work the same way. Maybe an event on every movement would be overkill.I also thought about a separate dropzone for whiteboard-like absolute positioned dnd and then just changing the drag-elements type when dragging it over a different dropzone. Then just react to data changes.
🤔
The text was updated successfully, but these errors were encountered: