buttonwoodcx / bcx-aurelia-dnd

Aurelia Drag and Drop.
https://buttonwoodcx.github.io/doc-bcx-aurelia-dnd
MIT License
21 stars 2 forks source link

Crosstalk #12

Closed si2030 closed 4 years ago

si2030 commented 5 years ago

Hi there,

Reading your docs for a second time and you have a small part on crosstalk at the bottom of "DnD target". I actually want to be able to drag a source and drop it onto another drop zone but as a re-orderable list item in the second drop zone.. can this be done and if so I am wondering how.. especially considering your warnings on sources being mutable... Let me know if you need more clarification.. I note this can be done from one list to another but I was wondering if you can do it from a DnD zone to reorder-able list etc

3cp commented 5 years ago

Not a normal dnd target to reorderable-repeat as reorderable-repeat is self sealed.

You can have two dnd target zones which can handle drag from either ones, aka deliberate crosstalk (which is how multi list reorderable-repeat was implemented).

If I understand you correctly, one of the two crosstalk target zones, you want it be like reorderable-repeat. Since you cannot use reorderable-repeat here, you can however implement a reorderable list directly in bcx-aurelia-dnd. Follow example https://buttonwoodcx.github.io/doc-bcx-aurelia-dnd/#/e6-reorder-list

Just make sure dndCanDrop returns true for drags from either zone, and handle two cases (drag from self, and drag from the other) properly in dndDrop and dndHover.

si2030 commented 5 years ago

Mate.. lightning response thank you.. I am still in the early throws of getting this to work (I have it working basically) but will need a bit of time to evolve it to what I want.. This however really points me in the right direction. :D

si2030 commented 5 years ago

I thought I would stay on this thread as its the same topic.

Regarding multiple crosstalk zones, I note you said above to follow re-orderable-repeat when you have two drop zones. Can I clarify that in this instance you would still use the reorderable-group="groupName" for each repeater and that you would also implement in an outside container for each repeater reorderable-group-for.bind="arrayModel" even if this is DND and not reorderable-repeat...

If you're using dndHover for both drop zones would you then use patchedas the arrayModel.

If this is not how it works wondering if you might elaborate on how you manage crosstalk for two dnd zones..

3cp commented 5 years ago

What I suggested was you have to skip using reorderable-repeat at all, use plain bcx-aurelia-dnd to implement all of them. You want one of them to be a reorderable list, you have to go down the hard path to implement it in plain bcx-aurelia-dnd like https://buttonwoodcx.github.io/doc-bcx-aurelia-dnd/#/e6-reorder-list

si2030 commented 5 years ago

Thanks for replying again.. thing is, I will do that for the list drop zone after avoiding crosstalk contamination with the other drop zone.. I actually have three drop zones in DnD which I want to DnD across all of them - at the moment there is contamination. Whats the process of managing two (or more) drop zones.. am I missing something.. I have implemented grid snap and resize snap so far but now I want to drag and drop across all three containers etc..

3cp commented 5 years ago

There is nothing special, you just need dndCanDrop on all 3 targets can accept source from either one.

Your hover/drop logic need to handle various sources properly (either a model from self, or a model from a foreign zone).